mint()

function mint(client, props): Promise<`0x${string}`>

Mints a mixed token using the router contract.

Parameters

ParameterTypeDescription
clientWriteClientThe write client to use for the contract call.
propsRouterMintPropsAn object containing the properties for the function.
type RouterMintProps: WriteContractBaseProps & {
  address: Address;
  raisingToken: Address;
  raisingAmount: bigint;
  mixedTokenIndex: bigint;
  minMixedTokenAmount: bigint;
  timeout: bigint;
};

Returns

Promise<`0x${string}`>

A promise that resolves to the result of the write contract.

Example

router.ts
import { router } from '@solio/core';
import { createWalletClient, custom } from 'viem';
import { sepolia } from 'viem/chains';
const writeClient = createWalletClient({
 chain: sepolia,
 transport: custom(window.ethereum),
});
const hash = await router.write.mint(writeClient, {
 address: '0x...', // Router contract address
 raisingToken: '0x...',
 raisingAmount: 100n,
 mixedTokenIndex: 0n,
 minMixedTokenAmount: 100n
});
console.log(hash);