Skip to content

Commit

Permalink
chore: TestCase Env Update
Browse files Browse the repository at this point in the history
  • Loading branch information
rrr523 committed Jan 11, 2024
1 parent e181ae7 commit c22649e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 247 deletions.
20 changes: 18 additions & 2 deletions examples/nextjs/src/components/feegrant/createObj.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
GRNToString,
MsgCreateObjectTypeUrl,
newBucketGRN,
newObjectGRN,
PermissionTypes,
toTimestamp,
} from '@bnb-chain/greenfield-js-sdk';
Expand Down Expand Up @@ -146,13 +147,28 @@ export const CreateObj = () => {
},
);

const simulateInfo = await createObjectTx.simulate({
const setTagTx = await client.storage.setTag({
operator: granteeAddr,
resource: GRNToString(newObjectGRN(bucketName, objectName)),
tags: {
tags: [
{
key: 'x',
value: 'xx',
},
],
},
});

const multiTx = await client.txClient.multiTx([createObjectTx, setTagTx]);

const simulateInfo = await multiTx.simulate({
denom: 'BNB',
});

console.log('simulateInfo', simulateInfo);

const res = await createObjectTx.broadcast({
const res = await multiTx.broadcast({
denom: 'BNB',
gasLimit: Number(simulateInfo?.gasLimit),
gasPrice: simulateInfo?.gasPrice || '5000000000',
Expand Down
4 changes: 2 additions & 2 deletions packages/js-sdk/tests/.env.simple
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ACCOUNT_ADDRESS='0x...'
ACCOUNT_PRIVATEKEY='0x...'
NEXT_PUBLIC_GREENFIELD_RPC_URL=https://gnfd-testnet-fullnode-tendermint-ap.bnbchain.org
NEXT_PUBLIC_GREEN_CHAIN_ID=5600
GREENFIELD_URL=https://gnfd-testnet-fullnode-tendermint-ap.bnbchain.org
GREENFIELD_CHAIN_ID=5600
Loading

0 comments on commit c22649e

Please sign in to comment.