Claim Gasless Link
Want a better experience? Let the end user claim without having to pay for gas, best way to solve the 'cold start' problem!
Claiming a Peanut Link Gasless
import peanut, { getDefaultProvider } from '@squirrel-labs/peanut-sdk'
import { Wallet } from 'ethersv5'
const chainId = '137' // polygon
const mnemonic = 'announce room limb pattern dry unit scale effort smooth jazz weasel alcohol'
async function createLinks(): Promise<string> {
let wallet = Wallet.fromMnemonic(mnemonic)
const provider = await getDefaultProvider(chainId)
wallet = wallet.connect(provider)
const link = 'https://peanut.to/claim?c=137&v=v4.3&i=2160&t=ui#p=0JObAtHfeDX7HI7K'
const claimedLinkResponse = await peanut.claimLinkGasless({
APIKey: '',
link,
recipientAddress: wallet.address,
})
console.log(claimedLinkResponse.txHash)
return claimedLinkResponse.txHash
}
createLinks().then((hash) => console.log(hash))Last updated