Create Link
Creating a Link that holds funds is easy. Have a look here how you can create one yourself!
Create a Link using EthersV5
import peanut, { getDefaultProvider } from '@squirrel-labs/peanut-sdk';
import { Wallet } from 'ethersv5';
const chainId = '11155111' // Sepolia
const mnemonic = 'announce room limb pattern dry unit scale effort smooth jazz weasel alcohol'
async function createLink(): Promise<string | null> {
let wallet = Wallet.fromMnemonic(mnemonic)
const provider = await getDefaultProvider(chainId)
wallet = wallet.connect(provider)
const { link, txHash } = await peanut.createLink({
structSigner: {
signer: wallet
},
linkDetails: {
chainId: chainId,
tokenAmount: 0.01,
tokenType: 0, // 0 for ether, 1 for erc20, 2 for erc721, 3 for erc1155
tokenDecimals: 18,
}
})
return link
}
createLink().then((link) => console.log(link))Create a Link using Signer Agnostic Functions:
Last updated