getMintAmount()
function getMintAmount(client, props): Promise<bigint>
Reads the mixed token amount that needs to be minted when a certain amount of native token is raised.
Parameters
Parameter | Type | Description |
---|---|---|
client | ReadClient | ReadClient The read client to use. |
props | BondingCurveGetMintAmountProps | BondingCurveGetMintAmountProps The properties to use. |
- BondingCurveGetMintAmountProps
type BondingCurveGetMintAmountProps: BondingCurveProps & {
address: Address;
raisingAmount: bigint;
currentSupply: bigint;
};
Returns
Promise
<bigint
>
The mixed token amount.
Examples
bonding-curve.ts
// for exponential
import { bondingCurve } from '@solio/core';
import { createClient, http } from 'viem';
import { sepolia } from 'viem/chains';
const readClient = createClient({
chain: sepolia,
transport: http(),
});
const amount = await bondingCurve.read.getMintAmount(readClient, {
address: '0x...', // bonding curve contract address
type: 'exponential',
param: {
a: 10000000000000000n,
b: 100000000000000000000000n,
},
raisingAmount: 1000000000000000000n,
currentSupply: 0n
});
console.log(amount);
bonding-curve.ts
// for linear
import { bondingCurve } from '@solio/core';
import { createClient, http } from 'viem';
import { sepolia } from 'viem/chains';
const readClient = createClient({
chain: sepolia,
transport: http(),
});
const amount = await bondingCurve.read.getMintAmount(readClient, {
address: '0x...', // bonding curve contract address
type: 'linear',
param: {
initPrice: 0.001,
finalPrice: 1000,
supply: 1e32,
},
raisingAmount: 1000000000000000000n,
currentSupply: 0n
});
console.log(amount);