Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mintclub.network("avalanchefuji").token('SuperSquad').create({...params}) returns undefined #1

Open
Resister-boy opened this issue Mar 18, 2024 · 13 comments
Assignees

Comments

@Resister-boy
Copy link

Resister-boy commented Mar 18, 2024

I just follow the official documentation but function create({...params}) returns undefined. We are planning build with mintclub-sdk how can i get returns Promise from function create({...params})

@Resister-boy Resister-boy changed the title mintclub.network("avalanchefuji").token('SuperSquad').create({...values}) returns undefined mintclub.network("avalanchefuji").token('SuperSquad').create({...params}) returns undefined Mar 18, 2024
@ggomaeng
Copy link
Member

could you please share the code you used?

@ggomaeng ggomaeng self-assigned this Mar 19, 2024
@Resister-boy
Copy link
Author

  const mmValue = mintclub.network("avalanchefuji").nft('SuperSquad');

  const createToken = async () => {
    try {
      const res = await mmValue.create({
        name: 'SuperSquad',

        reserveToken: {
          address: '0x4200000000000000000000000000000000000006',
          decimals: 18,
        },
        // Bonding curve data
        curveData: {
          curveType: 'EXPONENTIAL',

          stepCount: 10, // how granular the curve is
          maxSupply: 10_000, // NFT max supply
          initialMintingPrice: 0.01, // starting price, 0.01 WETH
          finalMintingPrice: 0.1, // ending price, 0.1 WETH
          creatorAllocation: 100, // initial supply to the deployer
        },
        metadataUrl: 'https://api.filebase.io/v1/ipfs',
      });

      console.log('res', res);
    } catch (e) {
      console.log(e);
    }
  };

@ggomaeng
Copy link
Member

ggomaeng commented Mar 19, 2024

Note that create function can also return undefined if it runs into an error.

You should use use the callback functions provided.

The flow goes

  1. Create token function called https://sdk.mint.club/docs/sdk/network/token/create#onsignaturerequest-optional
  2. User signs the transaction https://sdk.mint.club/docs/sdk/network/token/create#onsigned-optional
  3. The transaction is successfully submitted https://sdk.mint.club/docs/sdk/network/token/create#onsuccess-optional

If any of this fails, it will trigger onError and return undefined
https://sdk.mint.club/docs/sdk/network/token/create#onerror-optional


Also, from the code I can see that an invalid metadataUrl is provided.

Please check the example code here

@ggomaeng
Copy link
Member

These will also help

You will want to pass the ipfs url passed from uploadMetadata to the metadataUrl function

@ggomaeng
Copy link
Member

I added the debugging section so this could also help.

https://sdk.mint.club/docs/sdk/bonus/debugging

@Resister-boy
Copy link
Author

Thank you, I will try this all. But there is another weird thing, when I choose 'base' for network, I work successfully while other case(means all chains except 'base') it does not work and returns undefiend for function create. I am wondering is there something difference.

@ggomaeng
Copy link
Member

Thank you, I will try this all. But there is another weird thing, when I choose 'base' for network, I work successfully while other case(means all chains except 'base') it does not work and returns undefiend for function create. I am wondering is there something difference.

Do you have enough gas fees to cover the transaction?

@Resister-boy
Copy link
Author

Yes, Of course. In most case, It does not request deploy token contract with out base.

@ggomaeng
Copy link
Member

Yes, Of course. In most case, It does not request deploy token contract with out base.

could you share the code?

@Resister-boy
Copy link
Author

Sorry, It is same code, there is a only defference "avalanchefuji" to "base"

@ggomaeng
Copy link
Member

did you try console logging in the onError function?

@Resister-boy
Copy link
Author

Sorry, I never tried yet. I'll try it now

@ggomaeng
Copy link
Member

Sorry, I never tried yet. I'll try it now

did you figure it out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants