Transaction Context
// https://api.bitbadges.io/api/v0/user?address=bb1...
const res = await BitBadgesApi.getAccount({ address: '...' });
const account = res.account;
const { accountNumber, sequence, publicKey } = account;
if (Number(accountNumber) <= 0) {
// TODO: They are unregistered. Send them dust to register.
}const getPublicKey = async () => {
const account = await window?.keplr?.getKey('bitbadges-1');
if (!account) return '';
return Buffer.from(account.pubKey).toString('base64');
};//Pre-Reqs: Ensure users are registered (i.e. have a valid account number) or else this will fail
const txContext = {
testnet: false,
sender: {
//Must be in native format ('bb1..')
address: account.address,
sequence: account.sequence,
accountNumber: account.accountNumber,
//Public key is only needed for Cosmos native signatures. Leave "" if not.
publicKey: account.publicKey,
},
//TODO: adjust accordingly
fee: {
amount: `0`,
denom: 'ubadge',
gas: `400000`,
},
memo: '',
};Last updated