approve
Approves NFT allowance for a spender.
Usage
example.ts
import { mintclub, wei } from 'mint.club-v2-sdk'
await mintclub.network('ethereum').nft('SYMBOL').approve({
approved: true,
spender: '0x...'
})
Return Value
Promise<TransactionReceipt>
Returns a promise that resolves to a TransactionReceipt
object when the transaction is successful.
Parameters
approved
- Type:
boolean
example.ts
import { mintclub, wei } from 'mint.club-v2-sdk'
await mintclub.network('ethereum').nft('SYMBOL').approve({
approved: true,
spender: '0x...'
})
spender
- Type:
'0x...${string}'
The address of the spender
example.ts
import { mintclub, wei } from 'mint.club-v2-sdk'
await mintclub.network('ethereum').nft('SYMBOL').approve({
approved: true,
spender: '0x...'
})
onSignatureRequest (optional)
- Type:
onSignatureRequest?: () => void;
- Default:
undefined
Callback function for when the user is requested to sign the transaction.
await mintclub
.network('ethereum')
.nft('MINT')
.approve({
approved: true,
spender: '0x...'
onSignatureRequest: () => {}
})
onSigned (optional)
- Type:
onSigned?: (txHash: '0x${string}') => void;
- Default:
undefined
Callback function for when the user is signs the transaction.
await mintclub
.network('ethereum')
.nft('MINT')
.approve({
approved: true,
spender: '0x...'
onSigned: (txHash) => {}
})
onSuccess (optional)
- Type:
onSuccess?: (receipt: TransactionReceipt) => void;
- Default:
undefined
Callback function for when the transaction is successful.
await mintclub
.network('ethereum')
.nft('MINT')
.approve({
approved: true,
spender: '0x...'
onSuccess: (receipt) => {}
})
onError (optional)
- Type:
onError?: (error: unknown) => void;
- Default:
undefined
Callback function for when the transaction fails. This also includes when the user rejects the transaction.
await mintclub
.network('ethereum')
.nft('MINT')
.approve({
approved: true,
spender: '0x...'
onError: (error) => {}
})