You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Initiliazing SDK in v2constsdk=LinkdropP2P({
apiKey,
baseUrl,
apiUrl
})// Initiliazing SDK in v3 (getRandomBytes is passed on LinkdropP2P initialization)constgetRandomBytes=(length)=>{returnnewUint8Array(crypto.randomBytes(length));}constsdk=LinkdropP2P({
apiKey,
baseUrl,
apiUrl,
getRandomBytes
})
Updating amount
// Updating amount in v2const{ amount, fee, totalAmount }=awaitclaimLink.updateAmount(amount)// Updating amount in v3; fee renamed to feeAmount, feeToken added// feeToken is a token contract address that should cover fees// when token is a stablecoin fees are accrued in the token// otherwise fees should be paid in native tokens (ETH/MATIC)const{ amount, feeAmount, totalAmount, feeToken }=awaitclaimLink.updateAmount(amount)
Depositing USDC gaslessly
// Depositing USDC gaslessly in v2const{ claimUrl, transferId, txHash }=awaitclaimLink.depositWithAuthorization({ signTypedData, getRandomBytes })// Updating amount in v3; no need to pass getRandomBytes function as we passed to the SDK constructor const{ claimUrl, transferId, txHash }=awaitclaimLink.depositWithAuthorization({ signTypedData })
Depositing native tokens and ERC20 tokens
// depositing native tokens in v2const{ claimUrl, transferId, txHash }=awaitclaimLink.deposit({ sendTransaction, getRandomBytes })// depositing native tokens in v3; no need to pass getRandomBytes function as we passed to the SDK constructor const{ claimUrl, transferId, txHash }=awaitclaimLink.deposit({ sendTransaction })
Retrieving Claim Link details
// Retrieving Claim Link details in v2constclaimLink=awaitsdk.retrieveClaimLink({ chainId, sender, transferId })// Retrieving Claim Link details in v3; no need to pass sender address constclaimLink=awaitsdk.retrieveClaimLink({ chainId, transferId })