From 8601ee692a85d44bb84cafcab98e90f1eea51af5 Mon Sep 17 00:00:00 2001 From: rk <59029880+rrr523@users.noreply.github.com> Date: Tue, 20 Feb 2024 16:50:53 +0800 Subject: [PATCH] chore: TestCase Env Update (#475) --- .../src/components/feegrant/createObj.tsx | 20 +++++++++++++++++-- packages/js-sdk/tests/.env.simple | 4 ++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/examples/nextjs/src/components/feegrant/createObj.tsx b/examples/nextjs/src/components/feegrant/createObj.tsx index 42f84e2f..094d90a6 100644 --- a/examples/nextjs/src/components/feegrant/createObj.tsx +++ b/examples/nextjs/src/components/feegrant/createObj.tsx @@ -4,6 +4,7 @@ import { GRNToString, MsgCreateObjectTypeUrl, newBucketGRN, + newObjectGRN, PermissionTypes, toTimestamp, } from '@bnb-chain/greenfield-js-sdk'; @@ -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', diff --git a/packages/js-sdk/tests/.env.simple b/packages/js-sdk/tests/.env.simple index 7af35f11..6dfbd432 100644 --- a/packages/js-sdk/tests/.env.simple +++ b/packages/js-sdk/tests/.env.simple @@ -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