### Install mint.club-v2-sdk Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/getting-started.mdx Installs the mint.club-v2-sdk package using various package managers. This is the first step to integrate the SDK into your project. ```bash npm i mint.club-v2-sdk ``` ```bash pnpm i mint.club-v2-sdk ``` ```bash yarn add mint.club-v2-sdk ``` ```bash bun i mint.club-v2-sdk ``` -------------------------------- ### Purchase Token Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/getting-started.mdx Shows an example of purchasing a token using the mint.club-v2-sdk. This operation requires specifying the network, token, recipient address, amount, and slippage tolerance. ```typescript import { mintclub } from 'mint.club-v2-sdk' const result = await mintclub.network('base').token('CHICKEN').buy({ amount: 100n, slippage: 0, recipient: '0x...', }) ``` -------------------------------- ### Read Token Total Supply Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/getting-started.mdx Demonstrates how to retrieve the total supply of a token on a specific network using the mint.club-v2-sdk. It requires specifying the network and the token identifier. ```typescript import { mintclub } from 'mint.club-v2-sdk' const totalSupply = await mintclub .network('base') .token('CHICKEN') .getTotalSupply() // $CHICKEN token actually exists! // https://mint.club/token/base/CHICKEN 🐔 ``` -------------------------------- ### Install Mint Club V2 SDK Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/index.mdx Installs the Mint Club V2 SDK package using various package managers like npm, pnpm, yarn, and bun. This is the first step to integrate the SDK into your project. ```bash npm i mint.club-v2-sdk ``` ```bash pnpm i mint.club-v2-sdk ``` ```bash yarn add mint.club-v2-sdk ``` ```bash bun i mint.club-v2-sdk ``` -------------------------------- ### Example Usage: Create Lockup Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/lockup/createLockUp.mdx Demonstrates how to use the `createLockUp` function from the mint.club-v2-sdk to create a token lockup. This snippet shows a typical call with required parameters. ```ts import { mintclub } from 'mint.club-v2-sdk' await mintclub.network('base').lockup.createLockUp({ title: 'Test Lock Up', token: '0x...', isERC20: true, amount: 1000000000000000n, unlockTime: Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 7, receiver: '0x...', }) ``` -------------------------------- ### Running Project Tests Source: https://github.com/unibaseio/bitagent-sdk/blob/main/README.md This snippet outlines the essential steps to set up the project, compile smart contracts, and execute tests. It requires Node.js and npm to be installed. ```bash npm i npx hardhat compile npm test ``` -------------------------------- ### Upload Wallets to IPFS and Create Airdrop Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/airdrop/createAirdrop.mdx Shows how to prepare wallet data, upload it to IPFS to get a CID, and then use this CID when creating an airdrop with the mintclub SDK. ```ts import { mintclub } from 'mint.club-v2-sdk' const wallets = [ '0x...', '0x...', '0x...', ] as `0x${string}`[] const json = JSON.stringify(wallets, null, 2); const blob = new Blob([json], { type: 'application/json' }); const ipfsCID = await mintclub.ipfs.add('YOUR API KEY', blob); // [!code focus] await mintclub.network('base').airdrop.createAirdrop({ title: 'Test Airdrop', token: '0x...', isERC20: true, amountPerClaim: 1000000000000000n, walletCount: wallets.length, startTime: Math.floor(Date.now() / 1000), endTime: Math.floor(Date.now() / 1000 + 60 * 60 * 24 * 7), merkleRoot, ipfsCID // [!code focus] }) ``` -------------------------------- ### Sell Tokens Example Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/token-nft/sell.mdx Example usage of the sell method to sell tokens from the bonding curve contract. ```typescript import { mintclub, wei } from 'mint.club-v2-sdk' await mintclub.network('ethereum').token('SYMBOL').sell({ amount: wei(1, 18), }) ``` -------------------------------- ### Accessing Wallet Client with viem Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/bonus/juice.mdx The Mint Club SDK uses viem for write operations and signing. You can access the wallet client to sign messages or perform transactions. ```APIDOC Mint Club SDK's getWalletClient: Description: Access the internal viem wallet client for write operations and signing. Purpose: Enables signing messages and performing transactions. Dependencies: viem@2.7.16 Usage: Call getWalletClient() to obtain the client instance. ``` -------------------------------- ### Accessing Public Client with viem Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/bonus/juice.mdx The Mint Club SDK internally uses viem for read operations. You can access the public client to read block data and other network information. ```APIDOC Mint Club SDK's getPublicClient: Description: Access the internal viem public client for read operations. Purpose: Enables reading block data and other network information. Dependencies: viem@2.7.16 Usage: Call getPublicClient() to obtain the client instance. ``` -------------------------------- ### Overriding Public Client Configuration Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/bonus/juice.mdx Allows overriding the default configuration of the internal viem public client used by the Mint Club SDK. ```APIDOC Mint Club SDK's withPublicClient: Description: Override the default public client configuration. Purpose: Customize the viem public client settings for specific needs. Usage: Call withPublicClient(newConfig) to apply custom configurations. ``` -------------------------------- ### getDetail TypeScript Usage Example Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/token-nft/getDetail.mdx Shows how to retrieve detailed information about a token using the mint.club-v2-sdk. It demonstrates calling the getDetail method on a specific network and token. ```ts import { mintclub } from 'mint.club-v2-sdk'\n\nconst detail = await mintclub.network('ethereum').token('SYMBOL').getDetail() ``` -------------------------------- ### Get Tokens by Reserve Token Usage Example Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/bond/getTokensByReserveToken.mdx Demonstrates how to use the `getTokensByReserveToken` method from the mint.club-v2-sdk to retrieve tokens associated with a reserve token. ```ts import { mintclub } from 'mint.club-v2-sdk' const tokens = await mintclub.network('ethereum').bond.getTokensByReserveToken({ reserveToken: `0x...`, start: 0, end: 1000 }) ``` -------------------------------- ### Get Is Approved For All Example Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/nft/getIsApprovedForAll.mdx Demonstrates how to use the getIsApprovedForAll function to check if a spender is approved for all tokens owned by an owner. ```typescript import { mintclub } from 'mint.club-v2-sdk' const isApproved = await mintclub.network('ethereum').nft('SYMBOL').getIsApprovedForAll({ owner: '0x...', spender: '0x...' }) ``` -------------------------------- ### Example Usage of getLockUpIdsByReceiver Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/lockup/getLockUpIdsByReceiver.mdx Demonstrates how to import and use the getLockUpIdsByReceiver function from the mint.club-v2-sdk. ```ts import { mintclub } from 'mint.club-v2-sdk' const ids = await mintclub.network('base').lockup.getLockUpIdsByReceiver({ receiver: '0x...', start: 0, end: 1000 }) ``` -------------------------------- ### Mintclub SDK NFT Initialization (TypeScript) Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/nft/index.mdx Demonstrates initializing an NFT object from the mint.club-v2-sdk for ERC-1155 tokens. It shows how to select a network and specify an NFT identifier (symbol or address). Read calls are prefixed with 'get', while write calls require transaction signing. ```typescript import { mintclub } from 'mint.club-v2-sdk' const symbolOrAddress: string = 'CHICKEN' // [!code focus] // @noErrors mintclub.network('base').nft(symbolOrAddress). // [!code focus] // ^| ``` -------------------------------- ### IPFS Upload and Merkle Root Generation Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/airdrop/createAirdrop.mdx Illustrates the necessary steps before creating an airdrop: uploading the wallet list to IPFS to get a CID and generating a Merkle root from the wallet list. ```ts import { mintclub } from 'mint.club-v2-sdk' const wallets = [ '0x...', // Replace with actual wallet addresses '0x...', '0x...' ] as `0x${string}`[] // 1. Prepare wallet list for IPFS const json = JSON.stringify(wallets, null, 2); const blob = new Blob([json], { type: 'application/json' }); // 2. Upload to IPFS (requires an API key or configured IPFS service) // const ipfsCID = await mintclub.ipfs.add('YOUR API KEY', blob); // For demonstration, assuming ipfsCID is obtained: const ipfsCID = 'Qm...'; // Replace with your actual IPFS CID // 3. Generate Merkle Root const merkleRoot = await mintclub.utils.generateMerkleRoot(wallets); console.log('IPFS CID:', ipfsCID); console.log('Merkle Root:', merkleRoot); ``` -------------------------------- ### Overriding Wallet Client Configuration Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/bonus/juice.mdx Allows overriding the default configuration of the internal viem wallet client used by the Mint Club SDK. ```APIDOC Mint Club SDK's withWalletClient: Description: Override the default wallet client configuration. Purpose: Customize the viem wallet client settings for specific needs. Usage: Call withWalletClient(newConfig) to apply custom configurations. ``` -------------------------------- ### Get Allowance Example Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/token/getAllowance.mdx Demonstrates how to fetch the allowance of a spender for a token on behalf of an owner using the mint.club-v2-sdk. It requires the owner's and spender's addresses. ```ts import { mintclub } from 'mint.club-v2-sdk' const allowance = await mintclub.network('ethereum').token('SYMBOL').getAllowance({ owner: '0x...', spender: '0x...' }) ``` -------------------------------- ### Buy and Sell Bonding Curve Tokens/NFTs Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/index.mdx Provides examples for interacting with deployed bonding curve tokens or NFTs by buying and selling them. It shows how to specify the amount for transactions. ```typescript import { mintclub } from 'mint.club-v2-sdk' // 💲 Buying/Selling $MNM-NFT tokens const MortyMee6Nft = mintclub.network('base').nft('MnM-NFT') // buy const buyParams = { amount: 100n } await MortyMee6Nft.buy(buyParams) // sell const sellParams = { amount: 100n } await MortyMee6Nft.sell(sellParams) ``` -------------------------------- ### Example: Claiming an Airdrop Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/airdrop/claimAirdrop.mdx Demonstrates how to use the claimAirdrop method from the mint.club-v2-sdk to claim a specific airdrop. This snippet shows the basic invocation with an airdrop ID. ```ts import { mintclub } from 'mint.club-v2-sdk' await mintclub.network('base').airdrop.claimAirdrop({ airdropId: 1 }) ``` -------------------------------- ### Get Buy Estimation using Mint.club SDK Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/token-nft/getBuyEstimation.mdx Estimates the output amount of a token for a given input amount, including royalty calculations. Requires the Mint.club SDK and network/token context. ```typescript import { mintclub } from 'mint.club-v2-sdk' const [estimation, royalty] = await mintclub.network('ethereum').token('SYMBOL').getBuyEstimation(1n) ``` -------------------------------- ### Handle Airdrop Allowance Signature Request Callback Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/airdrop/createAirdrop.mdx Provides an example of the `onAllowanceSignatureRequest` callback, which is triggered when the user is prompted to sign an approval transaction for the airdrop. ```ts await mintclub.network('base').airdrop.createAirdrop({ onAllowanceSignatureRequest: () => {} // [!code focus] }) ``` -------------------------------- ### Get Tokens by Reserve Token (API Reference) Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/bond/getTokensByReserveToken.mdx Provides detailed information about the `getTokensByReserveToken` API method, including its parameters, return type, and usage context. ```APIDOC getTokensByReserveToken Returns tokens created by the reserve token. Parameters: reserveTokenAddress: The address of the reserve token. Type: '0x${string}' start (optional): Start index for fetching tokens. Type: number Default: 0 end (optional): End index for fetching tokens. Type: number Default: 1000 Return Value: A Promise resolving to a readonly array of token addresses. Type: Promise Note: Passing 0 and 100 for start and end does not fetch the first 100 tokens, but rather checks and returns IDs from 0 to 100. ``` -------------------------------- ### Mint.club SDK: Create Token with Custom Account Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/withAccount.mdx Demonstrates using the `withAccount` method to create a token with a specified wallet address and custom provider. This example shows chaining `network`, `withAccount`, `token`, and `create` methods. ```ts await mintclub .network('ethereum') .withAccount('0x...', window.ethereum) // [!code focus] .token('MINT') .create({ name: 'Mint Club', reserveToken: { address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address decimals: 18, }, curveData }) ``` -------------------------------- ### TypeScript: onError Callback Usage Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/lockup/createLockUp.mdx This example shows how to implement the `onError` callback when initiating a lock-up transaction. The callback function is invoked when the transaction fails or is rejected by the user. ```typescript await mintclub.network('base').lockup.createLockUp({ onError: (error) => {} // [!code focus] }) ``` -------------------------------- ### Bond Step Parameters Example Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/curve-design.mdx This JSON object illustrates the structure for defining price steps in the bonding curve contract. It includes arrays for the range boundaries and the corresponding prices at those boundaries. ```json { "stepRanges": [ 1000, 10000, 500000, 1000000, "...", 21000000 ], "stepPrices": [ 0, 1, 2, 4, "...", 100 ] } ``` -------------------------------- ### Deploy Token with Step-Based Bonding Curve Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/token/create.mdx Example of deploying an ERC-20 token with a step-based bonding curve configuration. This method uses the `stepData` array to define price points at different supply ranges. ```ts import { mintclub } from 'mint.club-v2-sdk'; import { stepData } from './data'; await mintclub .network('ethereum') .token('MINT') .create({ name: 'Mint Club', reserveToken: { address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address decimals: 18, }, stepData, }) ``` -------------------------------- ### Get WalletClient using Mint.club SDK (TypeScript) Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/getWalletClient.mdx Obtains a WalletClient instance from the Mint.club SDK for a specific network. This client is essential for performing write operations on smart contracts and signing messages. ```ts import { mintclub } from 'mint.club-v2-sdk' const walletClient = await mintclub.network('base').getWalletClient() // [!code focus] ``` -------------------------------- ### Define NFT Pricing Data Structures Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/nft/create.mdx Provides example data structures for stepData (price tiers) and curveData (pricing curve parameters) used in NFT creation. ```ts // Only one of curveData or stepData is required export const stepData = [ { rangeTo: 50, price: 0 }, // Since price is 0, the first 50 tokens will be allocated to the creator { rangeTo: 100, price: 0.01 }, // 0.01 WETH for the next 50 tokens { rangeTo: 1000, price: 0.1 }, // 0.1 WETH for the next 900 tokens { rangeTo: 10_000, price: 1 }, // 1 WETH for the next 9000 tokens ] export const curveData = { curveType: 'LINEAR', stepCount: 10, maxSupply: 10_000, initialMintingPrice: 0.01, // 0.01 WETH finalMintingPrice: 0.1, // 0.1 WETH creatorAllocation: 100, } ``` -------------------------------- ### Protocol Creation Fee Structure Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/bond/getCreationFee.mdx Details the creation fee policy for Mint.club, including its purpose and specific fee amounts for various blockchain networks. This fee acts as a safeguard against front-running and abusive attempts. ```APIDOC Creation Fee Policy: Purpose: Safeguard against front-runners who might attempt to steal a chosen token symbol, and to minimize abusive attempts. Fee Equivalent: A nominal fee, equivalent to $5 in tokens. Chain-Specific Fees: - Ethereum: 0.002 ETH - Optimism: 0.002 ETH - Arbitrum: 0.002 ETH - Base: 0.002 ETH - Polygon: 5 MATIC - BSC: 0.015 BNB - Avalanche: 0.15 AVAX Note: Gas fees for launching, minting, burning, or updating information of bonding assets will also need to be covered separately. ``` -------------------------------- ### Deploy Token with Linear Bonding Curve Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/token/create.mdx Example of deploying an ERC-20 token with a predefined linear bonding curve configuration. This method uses the `curveData` object to define curve parameters. ```ts import { mintclub } from 'mint.club-v2-sdk'; import { curveData } from './data'; await mintclub .network('ethereum') .token('MINT') .create({ name: 'Mint Club', reserveToken: { address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address decimals: 18, }, curveData, }) ``` -------------------------------- ### Get Total Airdrop Count Example Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/airdrop/getTotalAirdropCount.mdx Demonstrates how to fetch the total airdrop count from the mintclub SDK. ```typescript import { mintclub } from 'mint.club-v2-sdk' const count = mintclub.network('base').airdrop.getTotalAirdropCount() ``` -------------------------------- ### Initialize mintclub Module Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/introduction.mdx This snippet shows how to access the main mintclub module from the SDK. It serves as the entry point for most SDK operations. ```typescript import { mintclub } from 'mint.club-v2-sdk'; ``` -------------------------------- ### Get Airdrop IDs by Token (mint.club-v2-sdk) Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/airdrop/getAirdropIdsByToken.mdx Fetches airdrop IDs for a given token address. It allows specifying a range of IDs to retrieve using `start` and `end` parameters. The `start` and `end` parameters define the inclusive range of IDs to check, not the count of IDs to fetch. ```typescript import { mintclub } from 'mint.club-v2-sdk' const ids = await mintclub.network('base').airdrop.getAirdropIdsByToken({ token: '0x...', start: 0, end: 1000 }) // Return Value: Promise // Parameters: // token: '0x${string}' - Token address. // start (optional): number - Start index (default: 0). // end (optional): number - End index (default: 1000). ``` -------------------------------- ### Configure PublicClient with Custom Transport Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/withPublicClient.mdx This example demonstrates overriding the default PublicClient configuration in the Mint.club SDK using the withPublicClient method. It allows specifying custom chain and transport for network connections. The method returns a network instance, enabling further chaining of operations like token and nft. ```ts import { mintclub } from 'mint.club-v2-sdk'; import { http } from 'viem'; await mintclub .withPublicClient({ chain: 'rick-morty-chain', transport: http('https://rnm-mainnet.g.alchemy.com/v2/...') }) .token('MINT') .create({ name: 'Mint Club', reserveToken: { address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address decimals: 18, }, curveData: { curveType: 'LINEAR', stepCount: 10, maxSupply: 10_000, initialMintingPrice: 0.01, // 0.01 WETH finalMintingPrice: 0.1, // 0.1 WETH creatorAllocation: 100, } }) ``` -------------------------------- ### Create Wallet Client with Custom Provider Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/withProvider.mdx Demonstrates using the `withProvider` method to initialize a network client with a custom wallet provider. This method is crucial for integrating custom wallet solutions and returns the network instance for further chaining of operations. ```typescript await mintclub .network('ethereum') .withProvider(window.birdman!) // [!code focus] .token('MINT') .create({ name: 'Mint Club', reserveToken: { address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address decimals: 18, }, curveData }) ``` -------------------------------- ### Initialize Token Creation Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/token/create.mdx Demonstrates the initial steps to set up token creation by specifying the network and the token symbol. ```ts import { mintclub } from 'mint.club-v2-sdk'; await mintclub .network('ethereum') .token('MINT'); ``` -------------------------------- ### Get Lockup IDs by Token Address (TypeScript) Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/lockup/getLockUpIdsByToken.mdx Retrieves lockup identifiers for a given token address. It accepts the token address, an optional start index, and an optional end index to define the search range. The function returns a Promise resolving to an array of bigint IDs. Note that the start and end parameters define the range to check, not the number of items to fetch. ```typescript import { mintclub } from 'mint.club-v2-sdk' const ids = await mintclub.network('base').lockup.getLockUpIdsByToken({ token: '0x...', start: 0, end: 1000 }) ``` -------------------------------- ### Get Airdrop IDs by Owner Address Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/airdrop/getAirdropIdsByOwner.mdx Retrieves airdrop IDs owned by a specific address. It takes an owner address and optional start/end parameters to define the range of IDs to check. The function returns a promise resolving to an array of bigints representing the airdrop IDs. Note that the start and end parameters define the range of IDs to check, not the count of IDs to fetch. ```typescript import { mintclub } from 'mint.club-v2-sdk'\n\nconst ids = await mintclub.network('base').airdrop.getAirdropIdsByOwner({\n owner: '0x...',\n start: 0,\n end: 1000\n}) ``` -------------------------------- ### Get Lockup IDs by Receiver Address Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/lockup/getLockUpIdsByReceiver.mdx Retrieves lockup IDs associated with a specific receiver address. It allows specifying a range for fetching IDs, with optional start and end indices. Note that the range defines the search space, not a count of items. ```APIDOC getLockUpIdsByReceiver: description: Get lockup ids by reciever address. parameters: receiver: type: "'0x${string}'" description: Reciever address. start (optional): type: "number" default: "0" description: Start index for fetching IDs. end (optional): type: "number" default: "1000" description: End index for fetching IDs. returns: type: "Promise" description: A promise that resolves to an array of lockup IDs (bigint). notes: - Passing 0 and 100 does NOT mean that it will fetch the first 100. - It means that it will check and return the ids from 0 to 100. ``` -------------------------------- ### getUsdRate Method Documentation Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/token-nft/getUsdRate.mdx Documentation for the getUsdRate method, detailing its parameters, return value, and usage context within the mint.club-v2-sdk. ```APIDOC getUsdRate(amount?: number): Promise<{ usdRate: null | number, stableCoin: null | { address: '0x${string}', symbol: string, decimals: number }}> Description: Returns the estimated UsdRate from OneInch spot aggregator Contract. Parameters: - amount (optional): The amount of the token to be converted to USD. Type: `number`. Default: `1`. Return Value: A Promise that resolves to an object containing: - usdRate: The estimated USD rate, or `null` if unavailable. - stableCoin: Details of the stable coin used (address, symbol, decimals), or `null` if unavailable. Usage Notes: - For mint tokens, pass the symbol of the token in the `token` parameter. - For non-mint tokens, pass the token address. - Returns `null` if the aggregator contract does not exist on the chain. ``` -------------------------------- ### Mint.club SDK: withPrivateKey Method API Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/withPrivateKey.mdx Details the `withPrivateKey` method for initializing a wallet client with a private key in the Mint.club SDK. This method is chained after selecting a network and precedes token or NFT operations. It accepts the private key as a string and returns the network instance. ```APIDOC withPrivateKey(privateKey: '0x${string}') - Initializes a wallet client using a provided private key. - Parameters: - privateKey: The private key of the wallet. Must be a hex string starting with '0x'. - Returns: The network instance, allowing further chaining of methods like `token` or `nft`. - Usage: mintclub.network('ethereum').withPrivateKey('0xdeadbeef')... - Warning: Avoid using in public-facing applications due to private key exposure. ``` -------------------------------- ### Get Token Symbol using mint.club-v2-sdk Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/token-nft/getSymbol.mdx Retrieves the symbol of a specific token from the network. This function is part of the mint.club-v2-sdk and returns a Promise resolving to the token's symbol string. ```typescript import { mintclub } from 'mint.club-v2-sdk' const symbol = await mintclub.network('ethereum').token('SYMBOL').getSymbol() ``` -------------------------------- ### Get Token Name Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/token-nft/getName.mdx Retrieves the name of a token using the mint.club SDK. This method is part of the token object within a network context. It returns a Promise that resolves to a string representing the token's name. ```typescript import { mintclub } from 'mint.club-v2-sdk' const name = await mintclub.network('ethereum').token('SYMBOL').getName() ``` -------------------------------- ### Mint.club SDK: Create Wallet Client with Private Key Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/withPrivateKey.mdx Demonstrates how to create a wallet client using a private key with the Mint.club SDK. This method is part of the network instance and allows for token creation. It requires a private key as input and returns the network instance for further chaining. ```ts import { mintclub } from 'mint.club-v2-sdk'; await mintclub .network('ethereum') .withPrivateKey('0xdeadbeef') // [!code focus] .token('MINT') .create({ name: 'Mint Club', reserveToken: { address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address decimals: 18, }, curveData: { curveType: 'LINEAR', stepCount: 10, maxSupply: 10_000, initialMintingPrice: 0.01, // 0.01 WETH finalMintingPrice: 0.1, // 0.1 WETH creatorAllocation: 100, } }) ``` -------------------------------- ### Get Creation Fee (TypeScript) Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/bond/getCreationFee.mdx Retrieves the current creation fee for bonding curve-backed tokens or NFT contracts using the Mint.club SDK. This method is asynchronous and returns a `bigint` representing the fee. It requires the SDK to be initialized with network information. ```ts import { mintclub } from 'mint.club-v2-sdk' const fee = await mintclub.network('ethereum').bond.getCreationFee() ``` -------------------------------- ### Example Usage of cancelAirdrop Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/airdrop/cancelAirdrop.mdx Demonstrates how to call the cancelAirdrop function with a specific airdrop ID using the mint.club SDK. ```ts import { mintclub } from 'mint.club-v2-sdk' await mintclub.network('base').airdrop.cancelAirdrop({ airdropId: 1 }) ``` -------------------------------- ### getBuyEstimation API Reference Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/token-nft/getBuyEstimation.mdx Provides detailed information about the getBuyEstimation method, including its signature, parameters, and return types. ```APIDOC getBuyEstimation(amount: bigint) - Returns the estimated output amount of the token for the given input amount of the token. - Parameters: - amount: The input amount of the token (bigint). - Returns: A Promise resolving to a tuple containing: - estimatedOutcome: The estimated output amount of the token (bigint). - royalty: The royalty amount given to the creator of the token (bigint). - Example Usage: const [estimation, royalty] = await mintclub.network('ethereum').token('SYMBOL').getBuyEstimation(1n) ``` -------------------------------- ### Initialize NFT Creation Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/nft/create.mdx Shows how to initialize the NFT creation process by specifying the network and NFT symbol before calling the create function. ```ts await mintclub .network('ethereum') .nft('MNFT') ``` -------------------------------- ### Handle Airdrop Error Callback Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/airdrop/createAirdrop.mdx Provides an example of the `onError` callback, which is triggered when any transaction related to the airdrop fails or is rejected by the user. ```ts await mintclub.network('base').airdrop.createAirdrop({ onError: (error) => {} // [!code focus] }) ``` -------------------------------- ### Get Bond Address Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/token-nft/getBondAddress.mdx Retrieves the address of the bond contract that was used to deploy a specific token. This method is part of the mint.club SDK for interacting with network tokens. ```ts import { mintclub } from 'mint.club-v2-sdk' const bondContractAddress = await mintclub.network('ethereum').token('SYMBOL').getBondAddress() ``` -------------------------------- ### Mint.club SDK: withAccount Method Parameters Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/withAccount.mdx Details the parameters accepted by the `withAccount` method, which configures the wallet client with a specific account and provider. ```APIDOC withAccount(walletAddress: '0x${string}', provider?: any) - Configures the wallet client with a custom provider and account. - Parameters: - walletAddress: The wallet address from the provider. Type: '0x${string}'. - provider (optional): Custom wallet provider. Type: any. Default: window.ethereum. - Returns: The network instance for further chaining. ``` -------------------------------- ### Initialize ERC-20 Token with mint.club SDK (TypeScript) Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/token/index.mdx This snippet demonstrates how to initialize an ERC-20 token object using the mint.club-v2-sdk. It shows selecting a network and specifying a token by its symbol or address. Dependencies include the 'mint.club-v2-sdk'. ```typescript import { mintclub } from 'mint.club-v2-sdk'; const symbolOrAddress: string = 'CHICKEN'; mintclub.network('base').token(symbolOrAddress); ``` -------------------------------- ### Create Token with Mint.club SDK Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/bonus/receipt.mdx Demonstrates how to create a token using the mint.club SDK on the Ethereum network. It specifies token details, curve data, and includes a callback for handling transaction success, referencing the concept of a transaction receipt. ```typescript import { mintclub } from 'mint.club-v2-sdk'; await mintclub .network('ethereum') .token('MINT') .create({ name: 'Mint Club', reserveToken: { address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address decimals: 18, }, curveData: { curveType: 'LINEAR', stepCount: 10, maxSupply: 10_000, initialMintingPrice: 0.01, // 0.01 WETH finalMintingPrice: 0.1, // 0.1 WETH creatorAllocation: 100, }, onSuccess: (receipt) => { const a = { ...receipt }; // ^? } }) ``` -------------------------------- ### Set Network Configuration Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/introduction.mdx Demonstrates setting the network for SDK interactions. The network can be specified by its string name or chain ID. ```typescript import { mintclub } from 'mint.club-v2-sdk'; mintclub.network('base'); ``` ```typescript import { mintclub } from 'mint.club-v2-sdk'; mintclub.network(1); ``` -------------------------------- ### Connect Wallet with mint.club-v2-sdk Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/wallet/connect.mdx Requests the user to connect their wallet to the application using the mint.club-v2-sdk. It defaults to using `window.ethereum` but allows specifying a different provider. The function returns a promise that resolves with the connected wallet address. ```typescript import { mintclub } from 'mint.club-v2-sdk' const address = await mintclub.wallet.connect(); // uses window.ethereum by default // you can also pass a different provider as an argument // const okexWallet = await mintclub.wallet.connect(window.okex); ``` -------------------------------- ### Create NFT with Step Data Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/nft/create.mdx Demonstrates deploying an ERC-1155 NFT using stepData to define pricing tiers. Requires name, reserveToken, stepData, and metadataUrl. ```ts import { stepData } from './data'; await mintclub .network('ethereum') .nft('MNFT') .create({ name: 'Mint Club Collection', reserveToken: { address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH nft address decimals: 18, }, stepData, }) ``` -------------------------------- ### Get Max Supply Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/token-nft/getMaxSupply.mdx Retrieves the maximum supply of a token. This asynchronous function returns a Promise that resolves to a bigint representing the token's maximum supply. ```ts import { mintclub } from 'mint.club-v2-sdk' const maxSupply = await mintclub.network('ethereum').token('SYMBOL').getMaxSupply() ``` -------------------------------- ### Create Airdrop Function Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/airdrop/createAirdrop.mdx Demonstrates how to create an airdrop by providing necessary details such as token address, amounts, timing, and IPFS CID for the wallet list. It also covers pre-requisites like approving the airdrop contract. ```APIDOC createAirdrop Creates an airdrop campaign. :::warning[Tip] You will need to upload the list of wallets to IPFS and get the CID. Refer to [getting a filebase API Key](/docs/sdk/ipfs#getting-an-api-key). ::: :::tip[tip] Before user makes a `createAirdrop` call, the airdrop contract must be `approved` to use the token to airdrop. ::: :::success The SDK will automatically check if the airdrop contract is approved to use the asset. If not approved, it will prompt the user to sign an approval transaction. ::: ## Usage Example ```ts import { mintclub } from 'mint.club-v2-sdk' const wallets = [ '0x...', // Replace with actual wallet addresses '0x...', '0x...' ] as `0x${string}`[] const json = JSON.stringify(wallets, null, 2); const blob = new Blob([json], { type: 'application/json' }); // Assuming you have an IPFS upload function or service // const ipfsCID = await mintclub.ipfs.add('YOUR API KEY', blob); // For demonstration, let's assume ipfsCID is obtained elsewhere const ipfsCID = 'Qm...'; // Replace with your actual IPFS CID const merkleRoot = await mintclub.utils.generateMerkleRoot(wallets); await mintclub.network('base').airdrop.createAirdrop({ title: 'Test Airdrop', token: '0x...', // Replace with the token address isERC20: true, // Set to false for ERC721 or other token types amountPerClaim: 1000000000000000n, // Amount per claim (e.g., 0.001 tokens) walletCount: wallets.length, // Total number of wallets eligible startTime: Math.floor(Date.now() / 1000), // Airdrop start time in seconds endTime: Math.floor(Date.now() / 1000 + 60 * 60 * 24 * 7), // Airdrop end time in seconds (e.g., 7 days from now) merkleRoot, ipfsCID }) ``` ## Parameters - **title** (`string`): The title of the airdrop. - **token** (`'0x${string}'`): The address of the token to be airdropped. - **isERC20** (`boolean`): Specifies if the token is an ERC20 token. Set to `false` for ERC721 or other token standards. - **amountPerClaim** (`bigint`): The amount of tokens to be distributed per claim. Use `bigint` for precise token amounts. - **walletCount** (`number`): The total number of wallets that are eligible for the airdrop. If this number is less than the actual number of wallets in the `merkleRoot`, the airdrop will operate on a first-come, first-served basis up to `walletCount` claims. - **startTime** (`number`): The Unix timestamp (in seconds) when the airdrop becomes claimable. Must be in seconds, not milliseconds. - **endTime** (`number`): The Unix timestamp (in seconds) when the airdrop closes. Must be in seconds, not milliseconds. - **merkleRoot** (`string`): The Merkle root hash generated from the list of eligible wallet addresses. This is crucial for verifying claims. - **ipfsCID** (`string`): The IPFS Content Identifier (CID) pointing to the JSON file containing the list of eligible wallet addresses. This file should be structured as an array of wallet addresses. ## Return Value `Promise`: Returns a promise that resolves to a `TransactionReceipt` object upon successful submission of the airdrop creation transaction to the blockchain. ``` -------------------------------- ### Get Native Balance Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/wallet/getNativeBalance.mdx Retrieves the native balance for a user's wallet address and chain ID. It defaults to the currently connected wallet but can be used for other addresses by providing parameters. ```ts import { mintclub } from 'mint.club-v2-sdk' const balance = await mintclub.wallet.getNativeBalance(); // [!code focus] ``` -------------------------------- ### getTokensByCreator Method Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/network/bond/getTokensByCreator.mdx Retrieves a list of tokens created by a specific user on the Ethereum network. It supports pagination via start and end indices and returns an array of token addresses. ```APIDOC getTokensByCreator(creator: '0x${string}', start?: number, end?: number) Description: Returns tokens created by a user. Parameters: creator: The address of creator. Type: '0x${string}'. start (optional): Start index. Type: number. Default: 0. end (optional): End index. Type: number. Default: 1000. Return Value: Promise. Returns tokens created by a user. Usage Example: import { mintclub } from 'mint.club-v2-sdk' const tokens = await mintclub.network('ethereum').bond.getTokensByCreator({ creator: '0x...', start: 0, end: 1000 }) Note: Passing 0 and 100 does NOT mean that it will fetch the first 100. It means that it will check and return the ids from 0 to 100. ``` -------------------------------- ### RPC Fallback Configuration Source: https://github.com/unibaseio/bitagent-sdk/blob/main/site/docs/pages/docs/sdk/bonus/rpcs.mdx Demonstrates the configuration of RPC clients using viem's fallback transport. The SDK pings all available RPCs to select the one with the lowest latency, and automatically switches to another if the selected RPC fails. ```typescript // [!include ~/snippets/example.ts:rpc] ```