Skip to main content

Feegrant

grantAllowance Tx

Provides a way to grant allowance, the user needs to construct the desired type of allowance.

paramsdescription
amountamount of Coin
denomdenom of Coin
allowedMessagesarray of Msg Type URL
granterthe address of the user granting an allowance of their funds
granteethe address of the user being granted an allowance of another user's funds.
expirationTimeTimestamp
example
const tx = await client.feegrant.grantAllowance({
granter: '0x00...',
grantee: '0x00...',
allowedMessages: [MsgDeleteObjectTypeUrl],
amount: parseEther('0.09').toString(),
denom: 'BNB',
expirationTime: toTimestamp(date),
});
tip

This is only construct tx, next need simulate and broadcast

revokeAllowance Tx

revokes allowance on a grantee by the granter.

paramsdescription
granterthe address of the user granting an allowance of their funds
granteegrantee is the address of the user being granted an allowance of another user's funds
example
const tx = await client.feegrant.revokeAllowance({
granter: '0x00...',
grantee: '0x00...',
});
tip

This is only construct tx, next need simulate and broadcast

getAllowence Query

queries the BasicAllowance.

paramsdescription
granterthe address of the user granting an allowance of their funds
granteegrantee is the address of the user being granted an allowance of another user's funds
example
await client.feegrant.getAllowence({
granter: '0x00...',
grantee: '0x00...',
});

getAllowences Query

queries the BasicAllowance by account address.

paramsdescription
granteegrantee is the address of the user being granted an allowance of another user's funds
paginationPagination
example
import { Long } from '@bnb-chain/greenfield-js-sdk';
await client.feegrant.getAllowences({
grantee: '0x00...',
pagination: {
limit: Long.fromInt(10),
offset: Long.fromInt(0),
countTotal: true,
key: Uint8Array.from([]),
reverse: false,
},
});