Request Links make it easy to ask for tokens or payments.
Creating a request link is easy you will need to have your api key (get one here!) and the following data for the request:
Recipient Address
Token Address
Chain Id
Amount to request
Token Decimal
Example code:
import peanut from'@squirrel-labs/peanut-sdk';constrecipientAddress='0x42A5DC31169Da17639468e7Ffa271e90Fdb5e85A';consttokenAddress='0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85'; // USDC on OptimismconstchainId='10'; // OptimismconsttokenAmount='10';consttokenDecimals='6';constAPIKey='YOUR-API-KEY-HERE';asyncfunctioncreateRequestLink():Promise<string|undefined> {try {const { link } =awaitpeanut.createRequestLink({ chainId, tokenAddress, tokenAmount, tokenType:peanut.interfaces.EPeanutLinkType.erc20,// or EPeanutLinkType.native tokenDecimals, recipientAddress, APIKey,// apiUrl: '' // if using a different api endpoint });return link; } catch (error) {console.error('Error creating request link:', error);returnundefined }}// Call the function and log the linkcreateRequestLink().then((link) =>console.log(link));