Skip to content

Commit

Permalink
Merge branch 'alpha' of github-rr523.com:bnb-chain/greenfield-js-sdk …
Browse files Browse the repository at this point in the history
…into alpha
  • Loading branch information
rrr523 committed Sep 23, 2024
2 parents 1f7718a + d866493 commit a9057cf
Show file tree
Hide file tree
Showing 13 changed files with 11,231 additions and 14,673 deletions.
4 changes: 3 additions & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
"@bnb-chain/greenfield-js-sdk": "2.1.0",
"@bnb-chain/reed-solomon": "1.1.3"
},
"changesets": []
"changesets": [
"seven-hornets-wave"
]
}
5 changes: 5 additions & 0 deletions .changeset/seven-hornets-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@bnb-chain/greenfield-js-sdk': minor
---

fix: Metamask now must using valid contract address
22 changes: 19 additions & 3 deletions examples/browser-file-management/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
# browser-file-management

## 0.1.4-alpha.0

### Patch Changes

- Updated dependencies
[[`f13088b326aec067ce464d7f1256fb9b09527db3`](https://github.com/bnb-chain/greenfield-js-sdk/commit/f13088b326aec067ce464d7f1256fb9b09527db3)]:
- @bnb-chain/greenfield-js-sdk@2.2.0-alpha.0

## 0.1.3

### Patch Changes

- Updated dependencies
[[`3a2b8deecad7e4ba001151f4fc293d33ec2baa07`](https://github.com/bnb-chain/greenfield-js-sdk/commit/3a2b8deecad7e4ba001151f4fc293d33ec2baa07)]:
- @bnb-chain/greenfield-js-sdk@2.1.1

## 0.1.2

### Patch Changes

- Updated dependencies
[[`64a62b1e1d0387148bbd621448a67b2bb2c2aa5b`](https://github.com/bnb-chain/greenfield-js-sdk/commit/64a62b1e1d0387148bbd621448a67b2bb2c2aa5b)]:
- @bnb-chain/greenfield-js-sdk@2.0.1
[[`909b463c72a0c83bddc1e41b840d5c871325d54a`](https://github.com/bnb-chain/greenfield-js-sdk/commit/909b463c72a0c83bddc1e41b840d5c871325d54a),
[`34aa1c71d9ee1bc3856aa199a3eee9e50827376b`](https://github.com/bnb-chain/greenfield-js-sdk/commit/34aa1c71d9ee1bc3856aa199a3eee9e50827376b),
[`3e7f1cae3ac12215d5d46ef6755fd198ad450190`](https://github.com/bnb-chain/greenfield-js-sdk/commit/3e7f1cae3ac12215d5d46ef6755fd198ad450190)]:
[[`909b463c72a0c83bddc1e41b840d5c871325d54a`](https://github.com/bnb-chain/greenfield-js-sdk/commit/909b463c72a0c83bddc1e41b840d5c871325d54a),
[`34aa1c71d9ee1bc3856aa199a3eee9e50827376b`](https://github.com/bnb-chain/greenfield-js-sdk/commit/34aa1c71d9ee1bc3856aa199a3eee9e50827376b),
[`3e7f1cae3ac12215d5d46ef6755fd198ad450190`](https://github.com/bnb-chain/greenfield-js-sdk/commit/3e7f1cae3ac12215d5d46ef6755fd198ad450190)]:
- @bnb-chain/greenfield-js-sdk@2.1.0

## 0.1.2-alpha.2
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-file-management/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "browser-file-management",
"version": "0.1.2",
"version": "0.1.4-alpha.0",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
16 changes: 16 additions & 0 deletions examples/nextjs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# @demo/wallet

## 0.0.31-alpha.0

### Patch Changes

- Updated dependencies
[[`f13088b326aec067ce464d7f1256fb9b09527db3`](https://github.com/bnb-chain/greenfield-js-sdk/commit/f13088b326aec067ce464d7f1256fb9b09527db3)]:
- @bnb-chain/greenfield-js-sdk@2.2.0-alpha.0

## 0.0.30

### Patch Changes

- Updated dependencies
[[`3a2b8deecad7e4ba001151f4fc293d33ec2baa07`](https://github.com/bnb-chain/greenfield-js-sdk/commit/3a2b8deecad7e4ba001151f4fc293d33ec2baa07)]:
- @bnb-chain/greenfield-js-sdk@2.1.1

## 0.0.29

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@demo/wallet",
"version": "0.0.29",
"version": "0.0.31-alpha.0",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development next dev",
Expand Down
16 changes: 16 additions & 0 deletions examples/nodejs-file-management/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# @demo/nodejs

## 0.0.30-alpha.0

### Patch Changes

- Updated dependencies
[[`f13088b326aec067ce464d7f1256fb9b09527db3`](https://github.com/bnb-chain/greenfield-js-sdk/commit/f13088b326aec067ce464d7f1256fb9b09527db3)]:
- @bnb-chain/greenfield-js-sdk@2.2.0-alpha.0

## 0.0.29

### Patch Changes

- Updated dependencies
[[`3a2b8deecad7e4ba001151f4fc293d33ec2baa07`](https://github.com/bnb-chain/greenfield-js-sdk/commit/3a2b8deecad7e4ba001151f4fc293d33ec2baa07)]:
- @bnb-chain/greenfield-js-sdk@2.1.1

## 0.0.28

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/nodejs-file-management/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@demo/nodejs",
"version": "0.0.28",
"version": "0.0.30-alpha.0",
"type": "commonjs",
"private": true,
"scripts": {
Expand Down
16 changes: 16 additions & 0 deletions packages/js-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# @bnb-chain/greenfield-js-sdk

## 2.2.0-alpha.0

### Minor Changes

- [#566](https://github.com/bnb-chain/greenfield-js-sdk/pull/566)
[`f13088b326aec067ce464d7f1256fb9b09527db3`](https://github.com/bnb-chain/greenfield-js-sdk/commit/f13088b326aec067ce464d7f1256fb9b09527db3)
Thanks [@rrr523](https://github.com/rrr523)! - fix: Metamask now must using valid contract address

## 2.1.1

### Patch Changes

- [#558](https://github.com/bnb-chain/greenfield-js-sdk/pull/558)
[`3a2b8deecad7e4ba001151f4fc293d33ec2baa07`](https://github.com/bnb-chain/greenfield-js-sdk/commit/3a2b8deecad7e4ba001151f4fc293d33ec2baa07)
Thanks [@rrr523](https://github.com/rrr523)! - feat: Remove warning in browser.

## 2.1.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/js-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bnb-chain/greenfield-js-sdk",
"version": "2.1.0",
"version": "2.2.0-alpha.0",
"description": "greenfield js chain and sp sdk",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
Expand Down
31 changes: 14 additions & 17 deletions packages/js-sdk/src/clients/spclient/spClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ export class SpClient implements ISpClient {
},
) {
const R = superagent.put(url);
R.buffer(true);
R.timeout(timeout);
R.ok((res) => res.status < 500);

Expand All @@ -179,25 +178,23 @@ export class SpClient implements ISpClient {
});
}

try {
if (options.headers) {
(options.headers as Headers).forEach((v: string, k: string) => {
R.set(k, v);
});
}
if (callback && callback.onProgress) {
R.on('progress', (e) => {
callback.onProgress?.(e);
});
}

if (callback && callback.onProgress) {
R.on('progress', (e) => {
callback.onProgress?.(e);
});
}
const file = assertFileType(uploadFile) ? uploadFile.content : uploadFile;

const file = assertFileType(uploadFile) ? uploadFile.content : uploadFile;
// https://ladjs.github.io/superagent/docs/index.html#serializing-request-body
const sendFile =
isNode && R.get('Content-Type') === 'application/json' ? file.toString() : file;
if (isNode) {
R.buffer(true);
}

// https://ladjs.github.io/superagent/docs/index.html#serializing-request-body
const serializeFile =
isNode && R.get('Content-Type') === 'application/json' ? file.toString() : file;
const response = await R.send(serializeFile);
try {
const response = await R.send(sendFile);
const { status } = response;

if (status === SP_NOT_AVAILABLE_ERROR_CODE) {
Expand Down
2 changes: 1 addition & 1 deletion packages/js-sdk/src/messages/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const createEIP712 = (types: object, chainId: string, message: object) =>
name: 'Greenfield Tx',
version: '1.0.0',
chainId,
verifyingContract: 'greenfield',
verifyingContract: '0x71e835aff094655dEF897fbc85534186DbeaB75d',
salt: '0',
},
message,
Expand Down
Loading

0 comments on commit a9057cf

Please sign in to comment.