@corpus-core/colibri-stateless 0.1.18 → 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -4,6 +4,10 @@ export interface Cache {
4
4
  get(req: DataRequest): Uint8Array | undefined;
5
5
  set(req: DataRequest, data: Uint8Array): void;
6
6
  }
7
+ interface RequestArguments {
8
+ readonly method: string;
9
+ readonly params?: readonly unknown[] | object;
10
+ }
7
11
  export interface Config {
8
12
  chainId: number;
9
13
  beacon_apis: string[];
@@ -68,4 +72,8 @@ export default class C4Client {
68
72
  */
69
73
  rpc(method: string, args: any[]): Promise<any>;
70
74
  static register_storage(storage: C4Storage): Promise<void>;
75
+ request(args: RequestArguments): Promise<any>;
76
+ on(event: string, callback: (data: any) => void): void;
77
+ removeListener(event: string, callback: (data: any) => void): void;
71
78
  }
79
+ export {};
package/index.js CHANGED
@@ -225,4 +225,12 @@ export default class C4Client {
225
225
  const c4w = await getC4w();
226
226
  c4w.storage = storage;
227
227
  }
228
+ async request(args) {
229
+ const res = await this.rpc(args.method, args.params || []);
230
+ return res;
231
+ }
232
+ on(event, callback) {
233
+ }
234
+ removeListener(event, callback) {
235
+ }
228
236
  }
package/package.json CHANGED
@@ -1,10 +1,17 @@
1
1
  {
2
2
  "name": "@corpus-core/colibri-stateless",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "Colibri is a stateless and trustless ethereum client, which is optimized for the mobile apps or embedded devices, because it does not hols the state, but verifies on demand.",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
- "scripts": {},
7
+ "scripts": {
8
+ "test": "npm run test:node && npm run test:webpack",
9
+ "test:node": "node --test test/*.test.mjs",
10
+ "test:webpack": "npm run webpack:install && npm run webpack:build",
11
+ "webpack:install": "cd webpack && npm install --legacy-peer-deps",
12
+ "webpack:build": "cd webpack && npm run build",
13
+ "webpack:start": "cd webpack && npm run start"
14
+ },
8
15
  "repository": {
9
16
  "type": "git",
10
17
  "url": "git+https://github.com/corpus-core/c4.git"
package/c4w.wasm DELETED
Binary file