import { MsgGrantAllowance, MsgBroadcasterWithPk } from '@injectivelabs/sdk-ts'
import { Network } from '@injectivelabs/networks'
const privateKeyOfGranter = '0x...'
const date = new Date('2023-10-02T00:00:00Z')
const expiration = date.getTime() / 1000
const granter = 'inj...'
const grantee = 'inj...'
const allowance = {
spendLimit: [
{
denom: 'inj',
amount: '10000',
},
],
expiration
}
const msg = MsgGrantAllowance.fromJSON({
granter,
grantee,
allowance,
})
const txHash = await new MsgBroadcasterWithPk({
privateKey: privateKeyOfGranter,
network: Network.Testnet,
}).broadcast({
msgs: msg,
})
console.log(txHash)