logo

Want a better experience? Let the end user claim without having to pay for gas, best way to solve the 'cold start' problem!

You can claim a Link gaslessly, with no additional trust assumptions (no one can frontrun you!) using our API. This involves creating an offchain signature using the Links private key, but it's all handled under the hood in claimLinkGasless.

Claiming a Peanut Link Gasless

plain text
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))