diff --git a/examples/nodejs/cases/storage.js b/examples/nodejs/cases/storage.js index eaaa9ee2..02e76140 100644 --- a/examples/nodejs/cases/storage.js +++ b/examples/nodejs/cases/storage.js @@ -106,4 +106,33 @@ console.log('objectName', objectName); if (uploadRes.code === 0) { console.log('upload object success', uploadRes); } + + // create folder example: + const createFolderTx = await client.object.createFolder( + { + bucketName: bucketName, + objectName: objectName + '/', + creator: ACCOUNT_ADDRESS, + }, + { + type: 'ECDSA', + privateKey: ACCOUNT_PRIVATEKEY, + }, + ); + const simulateInfo = await createFolderTx.simulate({ + denom: 'BNB', + }); + + const res = await createFolderTx.broadcast({ + denom: 'BNB', + gasLimit: Number(simulateInfo?.gasLimit), + gasPrice: simulateInfo?.gasPrice || '5000000000', + payer: ACCOUNT_ADDRESS, + granter: '', + privateKey: ACCOUNT_PRIVATEKEY, + }); + + if (res.code === 0) { + console.log('create folder success', res); + } })();