Claim Raffle Link

Here is how you can claim a Raffle Link.

The following code example shows how to use the claimRaffleLink function.

Please note that there are many customizable options to a Raffle Link (MFA, captcha, sibil resistance...). If you have any questions regarding any customizable options, please don't hesitate to reach out to us via Telegram or our Discord!

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://red.peanut.to/packet?c=137&v=v4.2&i=637,638,639,640,641,642,643,644,645,646&t=ui#p=rTe4ve5LkxcHbZVb'

	const claimInfo = await peanut.claimRaffleLink({
		link,
		APIKey: '',
		recipientAddress: wallet.address,
		recipientName: 'bob',
	})

	return claimInfo.txHash ?? ''
}

createLinks().then((hash) => console.log(hash))

```

Last updated