-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: Tx * fix: Type * feat: Add Group API * feat: Update Sp API * feat: Bucket add authType * feat: and add params * fix: Types * feat: Change type
- Loading branch information
Showing
26 changed files
with
620 additions
and
432 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@bnb-chain/greenfield-js-sdk': patch | ||
--- | ||
|
||
refactor: Tx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@bnb-chain/greenfield-js-sdk': patch | ||
--- | ||
|
||
feat: Changet auth type: `OffChainAuth` -> `EDDSA`, `V1` -> `ECDSA` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@bnb-chain/greenfield-js-sdk': patch | ||
--- | ||
|
||
feat: Upgrade types and update SP API: `getQueryGlobalSpStorePriceByTime` `getQuerySpStoragePrice` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@bnb-chain/greenfield-js-sdk': patch | ||
--- | ||
|
||
feat: `getCreateBucketApproval` and `createBucket` add `authType` params |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@bnb-chain/greenfield-js-sdk': patch | ||
--- | ||
|
||
feat: `getCreateObjectApproval` and `createObject` add `authType` params |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@bnb-chain/greenfield-js-sdk': patch | ||
--- | ||
|
||
feat: Group Exist API: `queryGroupMembersExist` `queryGroupExist` `queryGroupsExistById` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,43 @@ | ||
const { Client } = require('@bnb-chain/greenfield-js-sdk'); | ||
const { getCheckSums } = require('@bnb-chain/greenfiled-file-handle/files'); | ||
const fs = require('fs'); | ||
// const { getCheckSums } = require('@bnb-chain/greenfiled-file-handle/files'); | ||
// const fs = require('fs'); | ||
|
||
// const client = Client.create('https://gnfd-dev.qa.bnbchain.world', '8981'); | ||
|
||
const client = Client.create('https://gnfd.qa.bnbchain.world', '9000'); | ||
|
||
// (async () => { | ||
// const filePath = './package.json'; | ||
// const fileBuf = fs.readFileSync(filePath); | ||
// const DEFAULT_SEGMENT_SIZE = 16 * 1024 * 1024; | ||
// const DEFAULT_DATA_BLOCKS = 4; | ||
// const DEFAULT_PARITY_BLOCKS = 2; | ||
// const bytes = new Uint8Array(fileBuf); | ||
(async () => { | ||
const createBucketTx = await client.bucket.createBucket({ | ||
bucketName: 'foo', | ||
creator: '0x1C893441AB6c1A75E01887087ea508bE8e07AAae', | ||
visibility: 'VISIBILITY_TYPE_PUBLIC_READ', | ||
chargedReadQuota: '0', | ||
spInfo: { | ||
primarySpAddress: '0x66d06FFe266B46C6F0730cC9Ec2fc5B811cdA085', | ||
}, | ||
signType: 'authTypeV1', | ||
privateKey: '0x6547492644d0136f76ef65e3bd04a77d079ed38028f747700c6c6063564d7032', | ||
// signType: 'offChainAuth', | ||
// domain: window.location.origin, | ||
// seedString: offChainData.seedString, | ||
}); | ||
|
||
const simulateInfo = await createBucketTx.simulate({ | ||
denom: 'BNB', | ||
}); | ||
|
||
// const hashResult = await getCheckSums( | ||
// Buffer.from(bytes).toString('hex'), | ||
// DEFAULT_SEGMENT_SIZE, | ||
// DEFAULT_DATA_BLOCKS, | ||
// DEFAULT_PARITY_BLOCKS, | ||
// ); | ||
// console.log('hashResult', hashResult); | ||
// })(); | ||
console.log('simulateInfo', simulateInfo); | ||
|
||
(async () => { | ||
const account = await client.account.getAccount('0x1C893441AB6c1A75E01887087ea508bE8e07AAae'); | ||
const res = await createBucketTx.broadcast({ | ||
denom: 'BNB', | ||
gasLimit: Number(simulateInfo?.gasLimit), | ||
gasPrice: simulateInfo?.gasPrice || '5000000000', | ||
payer: '0x1C893441AB6c1A75E01887087ea508bE8e07AAae', | ||
granter: '', | ||
privateKey: '0x6547492644d0136f76ef65e3bd04a77d079ed38028f747700c6c6063564d7032', | ||
}); | ||
|
||
console.log(account); | ||
if (res.code === 0) { | ||
console.log('success'); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.