Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/common #28

Merged
merged 8 commits into from
May 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/eleven-mayflies-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@bnb-chain/greenfiled-file-handle': patch
'@bnb-chain/greenfield-chain-sdk': patch
---

support commonjs export
8 changes: 8 additions & 0 deletions .changeset/great-walls-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@bnb-chain/greenfiled-file-handle': patch
'@bnb-chain/greenfield-chain-sdk': patch
'@demo/wallet': patch
'@demo/nodejs': patch
---

Query support nodejs and browser
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
import { client } from '@/client';
import { GRPC_URL } from '@/config';
import { decodeFromHex } from '@/utils/encoding';
import { getGasFeeBySimulate } from '@/utils/simulate';
import {
Long,
CreateBucketTx,
ISignature712,
makeCosmsPubKey,
recoverPk,
StorageEnums,
ZERO_PUBKEY,
} from '@bnb-chain/greenfield-chain-sdk';
import { getGasFeeBySimulate } from '@/utils/simulate';
import { CreateBucketTx, ISignature712 } from '@bnb-chain/greenfield-chain-sdk';
import { useState } from 'react';
import { useAccount, useNetwork } from 'wagmi';
import { client } from '@/client';

interface IApprovalCreateBucket {
type: string;
value: {
bucket_name: string;
creator: string;
visibility: string;
primary_sp_address: string;
primary_sp_approval: {
expired_height: string;
sig: string;
};
charged_read_quota: number;
redundancy_type: string;
bucket_name: string;
creator: string;
visibility: string;
primary_sp_address: string;
primary_sp_approval: {
expired_height: string;
sig: string;
};
charged_read_quota: number;
redundancy_type: string;
}

export const CreateBucket = () => {
Expand All @@ -39,7 +35,7 @@ export const CreateBucket = () => {
});
const [gasLimit, setGasLimit] = useState(0);
const [textarea, setTextArea] = useState('');
const [xGnfdSignedMsg, setXGnfdSignedMsg] = useState<IApprovalCreateBucket['value'] | null>(null);
const [xGnfdSignedMsg, setXGnfdSignedMsg] = useState<IApprovalCreateBucket | null>(null);
const [gasPrice, setGasPrice] = useState('');

return (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions examples/nodejs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { Client } = require('@bnb-chain/greenfield-chain-sdk');
// import {Client} from '@bnb-chain/greenfield-chain-sdk'

const client = Client.create('https://gnfd.qa.bnbchain.world', '9000');

(async () => {
const account = await client.account.getAccount('0x7239B73CA99b095d4FEe1495cB62e36be8CfeeD1');

console.log(account);
})();
17 changes: 17 additions & 0 deletions examples/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@demo/nodejs",
"version": "0.0.1",
"type": "commonjs",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development next dev",
"dev:qa": "cross-env NODE_ENV=test next dev",
"build": "cross-env NODE_ENV=development next build",
"build:qa": "cross-env NODE_ENV=test next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@bnb-chain/greenfield-chain-sdk": "workspace:*"
}
}
6 changes: 5 additions & 1 deletion packages/chain-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@bnb-chain/greenfield-chain-sdk",
"version": "0.1.0-alpha.2",
"description": "greenfield js chain sdk",
"main": "./dist/esm/index.js",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/esm/index.d.ts",
"exports": {
Expand All @@ -17,6 +17,10 @@
}
}
},
"browser": {
"./dist/cjs/index.js": "./dist/cjs/index.js",
"./dist/esm/index.js": "./dist/esm/index.js"
},
"scripts": {
"predev": "rimraf ./dist",
"dev": "rollup -cw",
Expand Down
File renamed without changes.
20 changes: 18 additions & 2 deletions packages/files/package.json → packages/file-handle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@
"name": "@bnb-chain/greenfiled-file-handle",
"version": "0.1.0-alpha.0",
"description": "greenfield js chain sdk",
"main": "./dist/esm/index.js",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/esm/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/esm/**.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/cjs/**.d.ts",
"default": "./dist/cjs/index.js"
}
}
},
"browser": {
"./dist/cjs/index.js": "./dist/cjs/index.js",
"./dist/esm/index.js": "./dist/esm/index.js"
},
"scripts": {
"predev": "rimraf ./dist",
"dev": "rollup -cw",
Expand Down Expand Up @@ -48,4 +64,4 @@
"tslib": "^2.5.0",
"typescript": "^4.9.5"
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading