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

Fix usage in 3rd party projects #94

Merged
merged 12 commits into from
Apr 11, 2024
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.1"
"version": "0.12.0-alpha.6"
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"version": "yarn install && git stage yarn.lock"
},
"dependencies": {
"@types/node": "20.3.2",
"jest-resolve": "^29.5.0",
"jest-ts-webcompat-resolver": "^1.0.0"
},
"devDependencies": {
Expand Down
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.1",
"version": "0.12.0-alpha.6",
"main": "index.js",
"dependencies": {
"@encointer/types": "^0.12.0-alpha.1",
"@encointer/types": "^0.12.0-alpha.6",
"@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.1",
"version": "0.12.0-alpha.6",
"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.1",
"version": "0.12.0-alpha.6",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.9",
Expand Down
1 change: 1 addition & 0 deletions packages/util/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {ParserFixPointFn} from './parserFixPoint.js';
export * from './cidUtil.js';
export * from './toFixPoint.js';
export * from './parserFixPoint.js';
export * from './common.js';

export const parseI4F4: ParserFixPointFn = parserFixPoint(4, 4);

Expand Down
12 changes: 8 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.1",
"version": "0.12.0-alpha.6",
"main": "index.js",
"dependencies": {
"@encointer/node-api": "^0.12.0-alpha.1",
"@encointer/types": "^0.12.0-alpha.1",
"@encointer/util": "^0.12.0-alpha.1",
"@encointer/node-api": "^0.12.0-alpha.6",
"@encointer/types": "^0.12.0-alpha.6",
"@encointer/util": "^0.12.0-alpha.6",
"@polkadot/api": "^10.9.1",
"@polkadot/keyring": "^12.3.2",
"@polkadot/types": "^10.9.1",
Expand All @@ -33,10 +33,14 @@
"@polkadot/wasm-crypto": "^7.2.1",
"bs58": "^4.0.1",
"node-rsa": "^1.1.1",
"promised-map": "^1.0.0",
"websocket": "^1.0.34",
"websocket-as-promised": "^2.0.1"
},
"devDependencies": {
"@types/bs58": "^4.0.1"
},
"peerDependencies": {
"@polkadot/x-randomvalues": "^12.3.2"
}
}
4 changes: 2 additions & 2 deletions packages/worker-api/src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import WebSocketAsPromised from 'websocket-as-promised';
import {Keyring} from "@polkadot/keyring";
import type {u8} from "@polkadot/types-codec";
import type {TypeRegistry, Vec} from "@polkadot/types";
import type {RegistryTypes} from "@polkadot/types/types";

export interface IWorker extends WebSocketAsPromised {
rsCount: number;
Expand Down Expand Up @@ -32,8 +33,7 @@ export function createJsonRpcRequest(method: string, params: any, id: number | s

export interface WorkerOptions {
keyring?: Keyring;
api: any;
types: any;
types?: RegistryTypes;
createWebSocket?: (url: string) => WebSocket;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/worker-api/src/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {
createJsonRpcRequest,
type IWorker, type PublicGetterArgs,
type TrustedGetterArgs
} from "@encointer/worker-api/interface.js";
} from "./interface.js";
import type {BalanceTransferArgs, BalanceUnshieldArgs, ShardIdentifier, IntegriteeTrustedCallSigned} from "@encointer/types";
import type {KeyringPair} from "@polkadot/keyring/types";
import {type PubKeyPinPair, toAccount} from "@encointer/util/common.js";
import {type PubKeyPinPair, toAccount} from "@encointer/util";
import type {u32} from "@polkadot/types";
import bs58 from "bs58";

Expand Down
6 changes: 2 additions & 4 deletions packages/worker-api/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,12 @@ export class Worker extends WebSocketAsPromised implements IWorker {
attachRequestId: (data: any): any => data,
extractRequestId: () => this.rsCount = ++this.rsCount
});
const {api, types} = options;
this.#keyring = (options.keyring || undefined);
this.#registry = new TypeRegistry();
this.rsCount = 0;
this.rqStack = [] as string[]
if (api) {
this.#registry = api.registry;
} else if (types) {

if (options.types != undefined) {
this.#registry.register(encointerOptions({types: options.types}).types as RegistryTypes);
} else {
this.#registry.register(encointerOptions().types as RegistryTypes);
Expand Down
21 changes: 13 additions & 8 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.1, @encointer/node-api@workspace:packages/node-api":
"@encointer/node-api@^0.12.0-alpha.6, @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.1
"@encointer/types": ^0.12.0-alpha.6
"@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.1, @encointer/types@workspace:packages/types":
"@encointer/types@^0.12.0-alpha.6, @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.1, @encointer/util@workspace:packages/util":
"@encointer/util@^0.12.0-alpha.6, @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.1
"@encointer/types": ^0.12.0-alpha.1
"@encointer/util": ^0.12.0-alpha.1
"@encointer/node-api": ^0.12.0-alpha.6
"@encointer/types": ^0.12.0-alpha.6
"@encointer/util": ^0.12.0-alpha.6
"@polkadot/api": ^10.9.1
"@polkadot/keyring": ^12.3.2
"@polkadot/types": ^10.9.1
Expand All @@ -810,8 +810,11 @@ __metadata:
"@types/bs58": ^4.0.1
bs58: ^4.0.1
node-rsa: ^1.1.1
promised-map: ^1.0.0
websocket: ^1.0.34
websocket-as-promised: ^2.0.1
peerDependencies:
"@polkadot/x-randomvalues": ^12.3.2
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -3598,7 +3601,7 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:^20.3.1":
"@types/node@npm:20.3.2, @types/node@npm:^20.3.1":
version: 20.3.2
resolution: "@types/node@npm:20.3.2"
checksum: 5929ce2b9b12b1e2a2304a0921a953c72a81f5753ad39ac43b99ce6312fbb2b4fb5bc6b60d64a2550704e3223cd5de1299467d36085ac69888899db978f2653a
Expand Down Expand Up @@ -13227,8 +13230,10 @@ __metadata:
"@polkadot/dev": ^0.75.22
"@polkadot/types": ^10.9.1
"@types/jest": ^28.1.7
"@types/node": 20.3.2
"@types/websocket": ^1.0.5
jest: ^29.5.0
jest-resolve: ^29.5.0
jest-ts-webcompat-resolver: ^1.0.0
lerna: ^5.4.3
ts-jest: ^29.1.0
Expand Down
Loading