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

[worker] fix: can't parse shielding key: buffer.readUIntBE is not a function in react-js environment #95

Merged
merged 3 commits into from
Apr 11, 2024
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
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"publishConfig": {
"directory": "build"
},
"version": "0.12.0-alpha.6"
"version": "0.12.0-alpha.7"
}
4 changes: 2 additions & 2 deletions packages/node-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
},
"sideEffects": false,
"type": "module",
"version": "0.12.0-alpha.6",
"version": "0.12.0-alpha.7",
"main": "index.js",
"dependencies": {
"@encointer/types": "^0.12.0-alpha.6",
"@encointer/types": "^0.12.0-alpha.7",
"@polkadot/api": "^10.9.1",
"tslib": "^2.5.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"sideEffects": false,
"type": "module",
"version": "0.12.0-alpha.6",
"version": "0.12.0-alpha.7",
"main": "index.js",
"scripts": {
"generate:defs": "node --experimental-specifier-resolution=node --loader ts-node/esm ../../node_modules/.bin/polkadot-types-from-defs --package @encointer/types/interfaces --input ./src/interfaces",
Expand Down
2 changes: 1 addition & 1 deletion packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"sideEffects": false,
"type": "module",
"types": "./index.d.ts",
"version": "0.12.0-alpha.6",
"version": "0.12.0-alpha.7",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.9",
Expand Down
8 changes: 4 additions & 4 deletions packages/worker-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
"sideEffects": false,
"type": "module",
"types": "./index.d.ts",
"version": "0.12.0-alpha.6",
"version": "0.12.0-alpha.7",
"main": "index.js",
"dependencies": {
"@encointer/node-api": "^0.12.0-alpha.6",
"@encointer/types": "^0.12.0-alpha.6",
"@encointer/util": "^0.12.0-alpha.6",
"@encointer/node-api": "^0.12.0-alpha.7",
"@encointer/types": "^0.12.0-alpha.7",
"@encointer/util": "^0.12.0-alpha.7",
"@polkadot/api": "^10.9.1",
"@polkadot/keyring": "^12.3.2",
"@polkadot/types": "^10.9.1",
Expand Down
5 changes: 3 additions & 2 deletions packages/worker-api/src/parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import NodeRSA from 'node-rsa';

import type { IWorker } from './interface.js';
import type { BalanceEntry } from "@encointer/types";
import BN from "bn.js";

export function parseBalance(self: IWorker, data: any): BalanceEntry {
const balanceEntry = self.createType('BalanceEntry<BlockNumber>', data);
Expand All @@ -25,12 +26,12 @@ export function parseBalanceType(data: any): number {
export function parseNodeRSA(data: any): NodeRSA {
const keyJson = JSON.parse(data);
keyJson.n = u8aToBuffer(keyJson.n).reverse();
keyJson.e = u8aToBuffer(keyJson.e).reverse();
keyJson.e = new BN(keyJson.e);
const key = new NodeRSA();
setKeyOpts(key);
key.importKey({
n: keyJson.n,
e: keyJson.e
e: keyJson.e.toNumber()
}, 'components-public');
return key;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/worker-api/src/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const createTrustedCall = (

const payload = Uint8Array.from([...call.toU8a(), ...nonce.toU8a(), ...hash.toU8a(), ...shard.toU8a()]);

return self.createType('IntegriteeIntegriteeTrustedCallSigned', {
return self.createType('IntegriteeTrustedCallSigned', {
call: call,
nonce: nonce,
signature: { Sr25519: toAccount(accountOrPubKey, self.keyring()).sign(payload) },
Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -755,18 +755,18 @@ __metadata:
languageName: node
linkType: hard

"@encointer/node-api@^0.12.0-alpha.6, @encointer/node-api@workspace:packages/node-api":
"@encointer/node-api@^0.12.0-alpha.7, @encointer/node-api@workspace:packages/node-api":
version: 0.0.0-use.local
resolution: "@encointer/node-api@workspace:packages/node-api"
dependencies:
"@encointer/types": ^0.12.0-alpha.6
"@encointer/types": ^0.12.0-alpha.7
"@polkadot/api": ^10.9.1
"@polkadot/util-crypto": ^12.3.2
tslib: ^2.5.3
languageName: unknown
linkType: soft

"@encointer/types@^0.12.0-alpha.6, @encointer/types@workspace:packages/types":
"@encointer/types@^0.12.0-alpha.7, @encointer/types@workspace:packages/types":
version: 0.0.0-use.local
resolution: "@encointer/types@workspace:packages/types"
dependencies:
Expand All @@ -781,7 +781,7 @@ __metadata:
languageName: unknown
linkType: soft

"@encointer/util@^0.12.0-alpha.6, @encointer/util@workspace:packages/util":
"@encointer/util@^0.12.0-alpha.7, @encointer/util@workspace:packages/util":
version: 0.0.0-use.local
resolution: "@encointer/util@workspace:packages/util"
dependencies:
Expand All @@ -798,9 +798,9 @@ __metadata:
version: 0.0.0-use.local
resolution: "@encointer/worker-api@workspace:packages/worker-api"
dependencies:
"@encointer/node-api": ^0.12.0-alpha.6
"@encointer/types": ^0.12.0-alpha.6
"@encointer/util": ^0.12.0-alpha.6
"@encointer/node-api": ^0.12.0-alpha.7
"@encointer/types": ^0.12.0-alpha.7
"@encointer/util": ^0.12.0-alpha.7
"@polkadot/api": ^10.9.1
"@polkadot/keyring": ^12.3.2
"@polkadot/types": ^10.9.1
Expand Down
Loading