Skip to content

Commit

Permalink
fix: Ensure correct context in encode function (#17)
Browse files Browse the repository at this point in the history
* fix: upload finish error & scroll style on edge (#15)

* fix: scroll style on edge (#6)

* chore: update versions (alpha) (#7)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: upload finish error (#8)

* chore: update versions (alpha) (#9)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: upload finish error & scroll style on edge

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update versions (#16)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: Ensure correct context in encode function

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 15, 2024
1 parent a889cf5 commit 74fdd5c
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 35 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-terms-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@node-real/greenfield-uploadkit': patch
---

fix: Ensure correct context in encode function
12 changes: 12 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"mode": "exit",
"tag": "alpha",
"initialVersions": {
"docs": "0.0.1",
"uploadkit-with-nextjs-rainbowkit": "0.0.1",
"uploadkit-with-nextjs-walletkit": "0.0.1",
"uploadkit-with-vite-walletkit": "0.0.1",
"@node-real/greenfield-uploadkit": "0.0.3"
},
"changesets": []
}
8 changes: 4 additions & 4 deletions examples/uploadkit-with-nextjs-rainbowkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"lint": "next lint"
},
"dependencies": {
"@bnb-chain/greenfield-cosmos-types": "0.4.0-alpha.30",
"@bnb-chain/greenfield-js-sdk": "1.2.0",
"@bnb-chain/reed-solomon": "^1.1.3",
"@node-real/greenfield-uploadkit": "workspace:*",
"@bnb-chain/greenfield-cosmos-types": "latest",
"@bnb-chain/greenfield-js-sdk": "latest",
"@bnb-chain/reed-solomon": "latest",
"@node-real/greenfield-uploadkit": "latest",
"@rainbow-me/rainbowkit": "^1.3.3",
"@totejs/walletkit": "^1.0.8",
"axios": "^1.6.3",
Expand Down
8 changes: 4 additions & 4 deletions examples/uploadkit-with-nextjs-walletkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"lint": "next lint"
},
"dependencies": {
"@bnb-chain/greenfield-cosmos-types": "0.4.0-alpha.30",
"@bnb-chain/greenfield-js-sdk": "1.2.0",
"@bnb-chain/reed-solomon": "^1.1.3",
"@node-real/greenfield-uploadkit": "workspace:*",
"@bnb-chain/greenfield-cosmos-types": "latest",
"@bnb-chain/greenfield-js-sdk": "latest",
"@bnb-chain/reed-solomon": "latest",
"@node-real/greenfield-uploadkit": "latest",
"axios": "^1.6.3",
"next": "^13.5.6",
"react": "^18.2.0",
Expand Down
8 changes: 4 additions & 4 deletions examples/uploadkit-with-vite-walletkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"preview": "vite preview"
},
"dependencies": {
"@bnb-chain/greenfield-cosmos-types": "0.4.0-alpha.30",
"@bnb-chain/greenfield-js-sdk": "1.2.0",
"@bnb-chain/reed-solomon": "^1.1.3",
"@node-real/greenfield-uploadkit": "workspace:*",
"@bnb-chain/greenfield-cosmos-types": "latest",
"@bnb-chain/greenfield-js-sdk": "latest",
"@bnb-chain/reed-solomon": "latest",
"@node-real/greenfield-uploadkit": "latest",
"@totejs/walletkit": "^1.0.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
11 changes: 5 additions & 6 deletions packages/uploadkit/dev/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ const options: WalletKitOptions = {
const uploadOptions: UploadKitOptions = {
client: client,
bucketName: 'test-upload-kit',
seedString:
'0xa25fa0de5d5e82b84826a0bce8c84a1bf1b0c8786c586ec696dc52300a9ffe007bb7e10d9901a32b67ed06fdef1d296f6d6fa00fdd33deaeadbd2363fe87708d1c',
checksumFn: async (data: Uint8Array) => {
const rs = new ReedSolomon();
return rs.encode(data);
},
// seedString: '0xa25fa0de5d5e82b84826a0bce8c84a1bf1b0c8786c586ec696dc52300a9ffe007bb7e10d9901a32b67ed06fdef1d296f6d6fa00fdd33deaeadbd2363fe87708d1c',
// checksumFn: async (data: Uint8Array) => {
// const rs = new ReedSolomon();
// return rs.encode(data);
// },
sp: {
operatorAddress: '0x89A1CC91B642DECbC4789474694C606E0E0c420b',
endpoint: 'https://gnfd-testnet-sp1.bnbchain.org',
Expand Down
6 changes: 4 additions & 2 deletions packages/uploadkit/src/components/GlobalTasks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ export const GlobalTasks = () => {
},
});
const fileBytes = await hashTask.waitObject.file.arrayBuffer();
const calChecksumFn = typeof checksumFn === 'function' ? checksumFn : rs.encode;
const checkSumRes = await calChecksumFn(new Uint8Array(fileBytes));
const checkSumRes =
typeof checksumFn === 'function'
? await checksumFn(new Uint8Array(fileBytes))
: await rs.encode(new Uint8Array(fileBytes));
if (!checkSumRes) {
return dispatch({
type: 'SET_UPLOAD_TASK_ERROR_MSG',
Expand Down
37 changes: 22 additions & 15 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 74fdd5c

Please sign in to comment.