@quantovainc/qcore 0.1.21 → 0.1.24

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/README.md CHANGED
@@ -161,12 +161,8 @@ and `@quantovainc/qcore/pkg-node` for the nodejs build. Those export only the co
161
161
  Client, no fee cap, and no amount guard, and are for an advanced caller who assembles the fee comparison
162
162
  alone. The default browser, import, node, and require resolutions never reach them.
163
163
 
164
- To build both from source, run the two documented builds or `npm run build`.
165
-
166
- ```
167
- wasm-pack build --target bundler --out-dir pkg
168
- wasm-pack build --target nodejs --out-dir pkg-node
169
- ```
164
+ To build both from source, run `npm run build`, which produces the bundler build in `pkg` and the node
165
+ build in `pkg-node`.
170
166
 
171
167
  The offline test scripts run with `npm test`, and they need no network and no running gateway.
172
168
 
@@ -180,7 +176,7 @@ The [examples](examples) folder holds a runnable quickstart that mirrors the one
180
176
 
181
177
  ## Releases and provenance
182
178
 
183
- Releases are published from CI by the publish workflow in `.github/workflows/publish.yml`, which runs on a pushed git tag. It runs the offline tests and publishes with npm provenance, so the published tarball carries a provenance badge that ties it to this exact public commit. The wasm is built from the Rust core and committed to the repository, so confirming that the shipped wasm matches the source means rebuilding it from this commit and comparing the bytes. Nothing is published to a registry without an explicit tag. This package handles a user's keys and a published version cannot be taken back.
179
+ Releases are published from CI by the publish workflow in `.github/workflows/publish.yml`, which runs on a pushed git tag. It runs the offline tests and publishes with npm provenance, so the published tarball carries a provenance badge that ties it to this exact public commit. The compiled client core is built from the Rust source and committed to the repository, so confirming that the shipped build matches the source means rebuilding it from this commit and comparing the bytes. Nothing is published to a registry without an explicit tag. This package handles a user's keys and a published version cannot be taken back.
184
180
 
185
181
  For the provenance publish to run, the maintainer adds an `NPM_TOKEN` automation secret to the repository, or configures npm trusted publishing for the package so the workflow authenticates over OIDC with no stored token.
186
182
 
package/index.d.ts CHANGED
@@ -87,6 +87,12 @@ export interface QCore {
87
87
  orderSigner(seed_hex: string, index: bigint): string;
88
88
  parseEvents(response: string): string;
89
89
  scalarSlotKey(slot: bigint): string;
90
+ tokenDecimalsSlot(): bigint;
91
+ tokenSymbolSlot(): bigint;
92
+ packSymbol(symbol: string): bigint;
93
+ unpackSymbol(word: bigint): string;
94
+ assetBalanceBody(issuer: string, holder: string): string;
95
+ assetSupplyBody(issuer: string): string;
90
96
  seedFromMnemonic(phrase: string): string;
91
97
  signPayableCall(
92
98
  seed_hex: string,
@@ -99,6 +105,18 @@ export interface QCore {
99
105
  value: string,
100
106
  chain_id: bigint,
101
107
  ): string;
108
+ signAssetCall(
109
+ seed_hex: string,
110
+ index: bigint,
111
+ target: string,
112
+ args_hex: string,
113
+ asset_issuer: string,
114
+ amount: string,
115
+ nonce: bigint,
116
+ meter_limit: bigint,
117
+ fee: string,
118
+ chain_id: bigint,
119
+ ): string;
102
120
  signRegister(seed_hex: string, index: bigint, nonce: bigint, fee: string, chain_id: bigint): string;
103
121
  sign_call(
104
122
  seed_hex: string,
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@quantovainc/qcore",
3
- "version": "0.1.21",
3
+ "version": "0.1.24",
4
4
  "description": "Quantova's post quantum client core for JavaScript. Signs with ML-DSA-65 and builds Q1 addresses.",
5
5
  "scripts": {
6
- "build": "RUSTFLAGS=\"--remap-path-prefix=$HOME/quantova-stack=/qcore --remap-path-prefix=$HOME/.cargo=/cargo --remap-path-prefix=$HOME/.rustup=/rustup\" wasm-pack build --target bundler --out-dir pkg && RUSTFLAGS=\"--remap-path-prefix=$HOME/quantova-stack=/qcore --remap-path-prefix=$HOME/.cargo=/cargo --remap-path-prefix=$HOME/.rustup=/rustup\" wasm-pack build --target nodejs --out-dir pkg-node",
6
+ "build": "bash scripts/build.sh",
7
7
  "test": "node test-conformance.js && node test-sign-validate.js && node test-transport.js && node test-fee-cap.js && node test-network.js"
8
8
  },
9
9
  "keywords": [
package/pkg/README.md CHANGED
@@ -161,12 +161,8 @@ and `@quantovainc/qcore/pkg-node` for the nodejs build. Those export only the co
161
161
  Client, no fee cap, and no amount guard, and are for an advanced caller who assembles the fee comparison
162
162
  alone. The default browser, import, node, and require resolutions never reach them.
163
163
 
164
- To build both from source, run the two documented builds or `npm run build`.
165
-
166
- ```
167
- wasm-pack build --target bundler --out-dir pkg
168
- wasm-pack build --target nodejs --out-dir pkg-node
169
- ```
164
+ To build both from source, run `npm run build`, which produces the bundler build in `pkg` and the node
165
+ build in `pkg-node`.
170
166
 
171
167
  The offline test scripts run with `npm test`, and they need no network and no running gateway.
172
168
 
@@ -180,7 +176,7 @@ The [examples](examples) folder holds a runnable quickstart that mirrors the one
180
176
 
181
177
  ## Releases and provenance
182
178
 
183
- Releases are published from CI by the publish workflow in `.github/workflows/publish.yml`, which runs on a pushed git tag. It runs the offline tests and publishes with npm provenance, so the published tarball carries a provenance badge that ties it to this exact public commit. The wasm is built from the Rust core and committed to the repository, so confirming that the shipped wasm matches the source means rebuilding it from this commit and comparing the bytes. Nothing is published to a registry without an explicit tag. This package handles a user's keys and a published version cannot be taken back.
179
+ Releases are published from CI by the publish workflow in `.github/workflows/publish.yml`, which runs on a pushed git tag. It runs the offline tests and publishes with npm provenance, so the published tarball carries a provenance badge that ties it to this exact public commit. The compiled client core is built from the Rust source and committed to the repository, so confirming that the shipped build matches the source means rebuilding it from this commit and comparing the bytes. Nothing is published to a registry without an explicit tag. This package handles a user's keys and a published version cannot be taken back.
184
180
 
185
181
  For the provenance publish to run, the maintainer adds an `NPM_TOKEN` automation secret to the repository, or configures npm trusted publishing for the package so the workflow authenticates over OIDC with no stored token.
186
182
 
package/pkg/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "qcore-js",
3
3
  "type": "module",
4
4
  "description": "The JavaScript binding for the Quantova client core, generated over QCore with wasm-bindgen. The core does the key derivation, the post quantum signing, and the wire, the page does the fetch.",
5
- "version": "0.1.0",
5
+ "version": "0.1.23",
6
6
  "license": "Apache-2.0 OR MIT",
7
7
  "repository": {
8
8
  "type": "git",
package/pkg/qcore_js.d.ts CHANGED
@@ -5,6 +5,10 @@ export function account_body(address: string): string;
5
5
 
6
6
  export function address(seed_hex: string, index: bigint): string;
7
7
 
8
+ export function assetBalanceBody(issuer: string, holder: string): string;
9
+
10
+ export function assetSupplyBody(issuer: string): string;
11
+
8
12
  export function block_by_height_body(height: bigint): string;
9
13
 
10
14
  export function buildSignedOrderCall(chain_id: bigint, contract: string, selector_hex: string, scheme_off: bigint, ptr_off: bigint, field_offs_csv: string, fields_csv: string, region_off: bigint, owner_seed_hex: string, owner_index: bigint, nonce: bigint): string;
@@ -21,20 +25,28 @@ export function localChainId(): bigint;
21
25
 
22
26
  export function mainnetChainId(): bigint;
23
27
 
28
+ export function mapAddrWordKey(map_domain_tag: bigint, key32_hex: string, word: bigint): string;
29
+
24
30
  export function mapSlotKey(map_domain_tag: bigint, key_address_hex: string): string;
25
31
 
26
32
  export function mnemonicFromSeed(seed_hex: string): string;
27
33
 
34
+ export function nameKey(label: string): string;
35
+
28
36
  export function nonceSlotKey(signer_hex: string): string;
29
37
 
30
38
  export function orderSigner(seed_hex: string, index: bigint): string;
31
39
 
40
+ export function packSymbol(symbol: string): bigint;
41
+
32
42
  export function parseEvents(response: string): string;
33
43
 
34
44
  export function scalarSlotKey(slot: bigint): string;
35
45
 
36
46
  export function seedFromMnemonic(phrase: string): string;
37
47
 
48
+ export function signAssetCall(seed_hex: string, index: bigint, target: string, args_hex: string, asset_issuer: string, amount: string, nonce: bigint, meter_limit: bigint, fee: string, chain_id: bigint): string;
49
+
38
50
  export function signPayableCall(seed_hex: string, index: bigint, target: string, args_hex: string, nonce: bigint, meter_limit: bigint, fee: string, value: string, chain_id: bigint): string;
39
51
 
40
52
  export function signRegister(seed_hex: string, index: bigint, nonce: bigint, fee: string, chain_id: bigint): string;
@@ -51,8 +63,14 @@ export function submit_body(tx_hex: string): string;
51
63
 
52
64
  export function testnetChainId(): bigint;
53
65
 
66
+ export function tokenDecimalsSlot(): bigint;
67
+
68
+ export function tokenSymbolSlot(): bigint;
69
+
54
70
  export function transaction_body(tx_id: string): string;
55
71
 
72
+ export function unpackSymbol(word: bigint): string;
73
+
56
74
  export function valid_address(address: string): boolean;
57
75
 
58
76
  export function vmDeployAddress(): string;
package/pkg/qcore_js.js CHANGED
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./qcore_js_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
  wasm.__wbindgen_start();
7
7
  export {
8
- account_body, address, block_by_height_body, buildSignedOrderCall, buildTypedOrderCall, chainIdFromName, contractAddress, eventsBody, localChainId, mainnetChainId, mapSlotKey, mnemonicFromSeed, nonceSlotKey, orderSigner, parseEvents, scalarSlotKey, seedFromMnemonic, signPayableCall, signRegister, sign_call, sign_transfer, storageBody, storageValue, submit_body, testnetChainId, transaction_body, valid_address, vmDeployAddress
8
+ account_body, address, assetBalanceBody, assetSupplyBody, block_by_height_body, buildSignedOrderCall, buildTypedOrderCall, chainIdFromName, contractAddress, eventsBody, localChainId, mainnetChainId, mapAddrWordKey, mapSlotKey, mnemonicFromSeed, nameKey, nonceSlotKey, orderSigner, packSymbol, parseEvents, scalarSlotKey, seedFromMnemonic, signAssetCall, signPayableCall, signRegister, sign_call, sign_transfer, storageBody, storageValue, submit_body, testnetChainId, tokenDecimalsSlot, tokenSymbolSlot, transaction_body, unpackSymbol, valid_address, vmDeployAddress
9
9
  } from "./qcore_js_bg.js";
@@ -43,6 +43,47 @@ export function address(seed_hex, index) {
43
43
  }
44
44
  }
45
45
 
46
+ /**
47
+ * @param {string} issuer
48
+ * @param {string} holder
49
+ * @returns {string}
50
+ */
51
+ export function assetBalanceBody(issuer, holder) {
52
+ let deferred3_0;
53
+ let deferred3_1;
54
+ try {
55
+ const ptr0 = passStringToWasm0(issuer, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
56
+ const len0 = WASM_VECTOR_LEN;
57
+ const ptr1 = passStringToWasm0(holder, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
58
+ const len1 = WASM_VECTOR_LEN;
59
+ const ret = wasm.assetBalanceBody(ptr0, len0, ptr1, len1);
60
+ deferred3_0 = ret[0];
61
+ deferred3_1 = ret[1];
62
+ return getStringFromWasm0(ret[0], ret[1]);
63
+ } finally {
64
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
65
+ }
66
+ }
67
+
68
+ /**
69
+ * @param {string} issuer
70
+ * @returns {string}
71
+ */
72
+ export function assetSupplyBody(issuer) {
73
+ let deferred2_0;
74
+ let deferred2_1;
75
+ try {
76
+ const ptr0 = passStringToWasm0(issuer, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
77
+ const len0 = WASM_VECTOR_LEN;
78
+ const ret = wasm.assetSupplyBody(ptr0, len0);
79
+ deferred2_0 = ret[0];
80
+ deferred2_1 = ret[1];
81
+ return getStringFromWasm0(ret[0], ret[1]);
82
+ } finally {
83
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
84
+ }
85
+ }
86
+
46
87
  /**
47
88
  * @param {bigint} height
48
89
  * @returns {string}
@@ -204,6 +245,33 @@ export function mainnetChainId() {
204
245
  return BigInt.asUintN(64, ret);
205
246
  }
206
247
 
248
+ /**
249
+ * @param {bigint} map_domain_tag
250
+ * @param {string} key32_hex
251
+ * @param {bigint} word
252
+ * @returns {string}
253
+ */
254
+ export function mapAddrWordKey(map_domain_tag, key32_hex, word) {
255
+ let deferred3_0;
256
+ let deferred3_1;
257
+ try {
258
+ const ptr0 = passStringToWasm0(key32_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
259
+ const len0 = WASM_VECTOR_LEN;
260
+ const ret = wasm.mapAddrWordKey(map_domain_tag, ptr0, len0, word);
261
+ var ptr2 = ret[0];
262
+ var len2 = ret[1];
263
+ if (ret[3]) {
264
+ ptr2 = 0; len2 = 0;
265
+ throw takeFromExternrefTable0(ret[2]);
266
+ }
267
+ deferred3_0 = ptr2;
268
+ deferred3_1 = len2;
269
+ return getStringFromWasm0(ptr2, len2);
270
+ } finally {
271
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
272
+ }
273
+ }
274
+
207
275
  /**
208
276
  * @param {bigint} map_domain_tag
209
277
  * @param {string} key_address_hex
@@ -255,6 +323,25 @@ export function mnemonicFromSeed(seed_hex) {
255
323
  }
256
324
  }
257
325
 
326
+ /**
327
+ * @param {string} label
328
+ * @returns {string}
329
+ */
330
+ export function nameKey(label) {
331
+ let deferred2_0;
332
+ let deferred2_1;
333
+ try {
334
+ const ptr0 = passStringToWasm0(label, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
335
+ const len0 = WASM_VECTOR_LEN;
336
+ const ret = wasm.nameKey(ptr0, len0);
337
+ deferred2_0 = ret[0];
338
+ deferred2_1 = ret[1];
339
+ return getStringFromWasm0(ret[0], ret[1]);
340
+ } finally {
341
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
342
+ }
343
+ }
344
+
258
345
  /**
259
346
  * @param {string} signer_hex
260
347
  * @returns {string}
@@ -306,6 +393,17 @@ export function orderSigner(seed_hex, index) {
306
393
  }
307
394
  }
308
395
 
396
+ /**
397
+ * @param {string} symbol
398
+ * @returns {bigint}
399
+ */
400
+ export function packSymbol(symbol) {
401
+ const ptr0 = passStringToWasm0(symbol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
402
+ const len0 = WASM_VECTOR_LEN;
403
+ const ret = wasm.packSymbol(ptr0, len0);
404
+ return BigInt.asUintN(64, ret);
405
+ }
406
+
309
407
  /**
310
408
  * @param {string} response
311
409
  * @returns {string}
@@ -373,6 +471,50 @@ export function seedFromMnemonic(phrase) {
373
471
  }
374
472
  }
375
473
 
474
+ /**
475
+ * @param {string} seed_hex
476
+ * @param {bigint} index
477
+ * @param {string} target
478
+ * @param {string} args_hex
479
+ * @param {string} asset_issuer
480
+ * @param {string} amount
481
+ * @param {bigint} nonce
482
+ * @param {bigint} meter_limit
483
+ * @param {string} fee
484
+ * @param {bigint} chain_id
485
+ * @returns {string}
486
+ */
487
+ export function signAssetCall(seed_hex, index, target, args_hex, asset_issuer, amount, nonce, meter_limit, fee, chain_id) {
488
+ let deferred8_0;
489
+ let deferred8_1;
490
+ try {
491
+ const ptr0 = passStringToWasm0(seed_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
492
+ const len0 = WASM_VECTOR_LEN;
493
+ const ptr1 = passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
494
+ const len1 = WASM_VECTOR_LEN;
495
+ const ptr2 = passStringToWasm0(args_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
496
+ const len2 = WASM_VECTOR_LEN;
497
+ const ptr3 = passStringToWasm0(asset_issuer, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
498
+ const len3 = WASM_VECTOR_LEN;
499
+ const ptr4 = passStringToWasm0(amount, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
500
+ const len4 = WASM_VECTOR_LEN;
501
+ const ptr5 = passStringToWasm0(fee, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
502
+ const len5 = WASM_VECTOR_LEN;
503
+ const ret = wasm.signAssetCall(ptr0, len0, index, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, nonce, meter_limit, ptr5, len5, chain_id);
504
+ var ptr7 = ret[0];
505
+ var len7 = ret[1];
506
+ if (ret[3]) {
507
+ ptr7 = 0; len7 = 0;
508
+ throw takeFromExternrefTable0(ret[2]);
509
+ }
510
+ deferred8_0 = ptr7;
511
+ deferred8_1 = len7;
512
+ return getStringFromWasm0(ptr7, len7);
513
+ } finally {
514
+ wasm.__wbindgen_free(deferred8_0, deferred8_1, 1);
515
+ }
516
+ }
517
+
376
518
  /**
377
519
  * @param {string} seed_hex
378
520
  * @param {bigint} index
@@ -600,6 +742,22 @@ export function testnetChainId() {
600
742
  return BigInt.asUintN(64, ret);
601
743
  }
602
744
 
745
+ /**
746
+ * @returns {bigint}
747
+ */
748
+ export function tokenDecimalsSlot() {
749
+ const ret = wasm.tokenDecimalsSlot();
750
+ return BigInt.asUintN(64, ret);
751
+ }
752
+
753
+ /**
754
+ * @returns {bigint}
755
+ */
756
+ export function tokenSymbolSlot() {
757
+ const ret = wasm.tokenSymbolSlot();
758
+ return BigInt.asUintN(64, ret);
759
+ }
760
+
603
761
  /**
604
762
  * @param {string} tx_id
605
763
  * @returns {string}
@@ -619,6 +777,23 @@ export function transaction_body(tx_id) {
619
777
  }
620
778
  }
621
779
 
780
+ /**
781
+ * @param {bigint} word
782
+ * @returns {string}
783
+ */
784
+ export function unpackSymbol(word) {
785
+ let deferred1_0;
786
+ let deferred1_1;
787
+ try {
788
+ const ret = wasm.unpackSymbol(word);
789
+ deferred1_0 = ret[0];
790
+ deferred1_1 = ret[1];
791
+ return getStringFromWasm0(ret[0], ret[1]);
792
+ } finally {
793
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
794
+ }
795
+ }
796
+
622
797
  /**
623
798
  * @param {string} address
624
799
  * @returns {boolean}
Binary file
@@ -3,6 +3,8 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const account_body: (a: number, b: number) => [number, number];
5
5
  export const address: (a: number, b: number, c: bigint) => [number, number, number, number];
6
+ export const assetBalanceBody: (a: number, b: number, c: number, d: number) => [number, number];
7
+ export const assetSupplyBody: (a: number, b: number) => [number, number];
6
8
  export const block_by_height_body: (a: bigint) => [number, number];
7
9
  export const buildSignedOrderCall: (a: bigint, b: number, c: number, d: number, e: number, f: bigint, g: bigint, h: number, i: number, j: number, k: number, l: bigint, m: number, n: number, o: bigint, p: bigint) => [number, number, number, number];
8
10
  export const buildTypedOrderCall: (a: bigint, b: number, c: number, d: number, e: number, f: bigint, g: bigint, h: bigint, i: number, j: number, k: number, l: number, m: bigint, n: bigint) => [number, number, number, number];
@@ -11,13 +13,17 @@ export const contractAddress: (a: number, b: number, c: bigint) => [number, numb
11
13
  export const eventsBody: (a: bigint) => [number, number];
12
14
  export const localChainId: () => bigint;
13
15
  export const mainnetChainId: () => bigint;
16
+ export const mapAddrWordKey: (a: bigint, b: number, c: number, d: bigint) => [number, number, number, number];
14
17
  export const mapSlotKey: (a: bigint, b: number, c: number) => [number, number, number, number];
15
18
  export const mnemonicFromSeed: (a: number, b: number) => [number, number, number, number];
19
+ export const nameKey: (a: number, b: number) => [number, number];
16
20
  export const nonceSlotKey: (a: number, b: number) => [number, number, number, number];
17
21
  export const orderSigner: (a: number, b: number, c: bigint) => [number, number, number, number];
22
+ export const packSymbol: (a: number, b: number) => bigint;
18
23
  export const parseEvents: (a: number, b: number) => [number, number, number, number];
19
24
  export const scalarSlotKey: (a: bigint) => [number, number];
20
25
  export const seedFromMnemonic: (a: number, b: number) => [number, number, number, number];
26
+ export const signAssetCall: (a: number, b: number, c: bigint, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: bigint, m: bigint, n: number, o: number, p: bigint) => [number, number, number, number];
21
27
  export const signPayableCall: (a: number, b: number, c: bigint, d: number, e: number, f: number, g: number, h: bigint, i: bigint, j: number, k: number, l: number, m: number, n: bigint) => [number, number, number, number];
22
28
  export const signRegister: (a: number, b: number, c: bigint, d: bigint, e: number, f: number, g: bigint) => [number, number, number, number];
23
29
  export const sign_call: (a: number, b: number, c: bigint, d: number, e: number, f: number, g: number, h: bigint, i: bigint, j: number, k: number, l: bigint) => [number, number, number, number];
@@ -26,7 +32,10 @@ export const storageBody: (a: number, b: number) => [number, number];
26
32
  export const storageValue: (a: number, b: number, c: number, d: number) => [number, number, number, number];
27
33
  export const submit_body: (a: number, b: number) => [number, number, number, number];
28
34
  export const testnetChainId: () => bigint;
35
+ export const tokenDecimalsSlot: () => bigint;
36
+ export const tokenSymbolSlot: () => bigint;
29
37
  export const transaction_body: (a: number, b: number) => [number, number];
38
+ export const unpackSymbol: (a: bigint) => [number, number];
30
39
  export const valid_address: (a: number, b: number) => number;
31
40
  export const vmDeployAddress: () => [number, number];
32
41
  export const __wbindgen_externrefs: WebAssembly.Table;
@@ -161,12 +161,8 @@ and `@quantovainc/qcore/pkg-node` for the nodejs build. Those export only the co
161
161
  Client, no fee cap, and no amount guard, and are for an advanced caller who assembles the fee comparison
162
162
  alone. The default browser, import, node, and require resolutions never reach them.
163
163
 
164
- To build both from source, run the two documented builds or `npm run build`.
165
-
166
- ```
167
- wasm-pack build --target bundler --out-dir pkg
168
- wasm-pack build --target nodejs --out-dir pkg-node
169
- ```
164
+ To build both from source, run `npm run build`, which produces the bundler build in `pkg` and the node
165
+ build in `pkg-node`.
170
166
 
171
167
  The offline test scripts run with `npm test`, and they need no network and no running gateway.
172
168
 
@@ -180,7 +176,7 @@ The [examples](examples) folder holds a runnable quickstart that mirrors the one
180
176
 
181
177
  ## Releases and provenance
182
178
 
183
- Releases are published from CI by the publish workflow in `.github/workflows/publish.yml`, which runs on a pushed git tag. It runs the offline tests and publishes with npm provenance, so the published tarball carries a provenance badge that ties it to this exact public commit. The wasm is built from the Rust core and committed to the repository, so confirming that the shipped wasm matches the source means rebuilding it from this commit and comparing the bytes. Nothing is published to a registry without an explicit tag. This package handles a user's keys and a published version cannot be taken back.
179
+ Releases are published from CI by the publish workflow in `.github/workflows/publish.yml`, which runs on a pushed git tag. It runs the offline tests and publishes with npm provenance, so the published tarball carries a provenance badge that ties it to this exact public commit. The compiled client core is built from the Rust source and committed to the repository, so confirming that the shipped build matches the source means rebuilding it from this commit and comparing the bytes. Nothing is published to a registry without an explicit tag. This package handles a user's keys and a published version cannot be taken back.
184
180
 
185
181
  For the provenance publish to run, the maintainer adds an `NPM_TOKEN` automation secret to the repository, or configures npm trusted publishing for the package so the workflow authenticates over OIDC with no stored token.
186
182
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "qcore-js",
3
3
  "description": "The JavaScript binding for the Quantova client core, generated over QCore with wasm-bindgen. The core does the key derivation, the post quantum signing, and the wire, the page does the fetch.",
4
- "version": "0.1.0",
4
+ "version": "0.1.23",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -5,6 +5,10 @@ export function account_body(address: string): string;
5
5
 
6
6
  export function address(seed_hex: string, index: bigint): string;
7
7
 
8
+ export function assetBalanceBody(issuer: string, holder: string): string;
9
+
10
+ export function assetSupplyBody(issuer: string): string;
11
+
8
12
  export function block_by_height_body(height: bigint): string;
9
13
 
10
14
  export function buildSignedOrderCall(chain_id: bigint, contract: string, selector_hex: string, scheme_off: bigint, ptr_off: bigint, field_offs_csv: string, fields_csv: string, region_off: bigint, owner_seed_hex: string, owner_index: bigint, nonce: bigint): string;
@@ -21,20 +25,28 @@ export function localChainId(): bigint;
21
25
 
22
26
  export function mainnetChainId(): bigint;
23
27
 
28
+ export function mapAddrWordKey(map_domain_tag: bigint, key32_hex: string, word: bigint): string;
29
+
24
30
  export function mapSlotKey(map_domain_tag: bigint, key_address_hex: string): string;
25
31
 
26
32
  export function mnemonicFromSeed(seed_hex: string): string;
27
33
 
34
+ export function nameKey(label: string): string;
35
+
28
36
  export function nonceSlotKey(signer_hex: string): string;
29
37
 
30
38
  export function orderSigner(seed_hex: string, index: bigint): string;
31
39
 
40
+ export function packSymbol(symbol: string): bigint;
41
+
32
42
  export function parseEvents(response: string): string;
33
43
 
34
44
  export function scalarSlotKey(slot: bigint): string;
35
45
 
36
46
  export function seedFromMnemonic(phrase: string): string;
37
47
 
48
+ export function signAssetCall(seed_hex: string, index: bigint, target: string, args_hex: string, asset_issuer: string, amount: string, nonce: bigint, meter_limit: bigint, fee: string, chain_id: bigint): string;
49
+
38
50
  export function signPayableCall(seed_hex: string, index: bigint, target: string, args_hex: string, nonce: bigint, meter_limit: bigint, fee: string, value: string, chain_id: bigint): string;
39
51
 
40
52
  export function signRegister(seed_hex: string, index: bigint, nonce: bigint, fee: string, chain_id: bigint): string;
@@ -51,8 +63,14 @@ export function submit_body(tx_hex: string): string;
51
63
 
52
64
  export function testnetChainId(): bigint;
53
65
 
66
+ export function tokenDecimalsSlot(): bigint;
67
+
68
+ export function tokenSymbolSlot(): bigint;
69
+
54
70
  export function transaction_body(tx_id: string): string;
55
71
 
72
+ export function unpackSymbol(word: bigint): string;
73
+
56
74
  export function valid_address(address: string): boolean;
57
75
 
58
76
  export function vmDeployAddress(): string;
@@ -47,6 +47,49 @@ function address(seed_hex, index) {
47
47
  }
48
48
  exports.address = address;
49
49
 
50
+ /**
51
+ * @param {string} issuer
52
+ * @param {string} holder
53
+ * @returns {string}
54
+ */
55
+ function assetBalanceBody(issuer, holder) {
56
+ let deferred3_0;
57
+ let deferred3_1;
58
+ try {
59
+ const ptr0 = passStringToWasm0(issuer, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
60
+ const len0 = WASM_VECTOR_LEN;
61
+ const ptr1 = passStringToWasm0(holder, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
62
+ const len1 = WASM_VECTOR_LEN;
63
+ const ret = wasm.assetBalanceBody(ptr0, len0, ptr1, len1);
64
+ deferred3_0 = ret[0];
65
+ deferred3_1 = ret[1];
66
+ return getStringFromWasm0(ret[0], ret[1]);
67
+ } finally {
68
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
69
+ }
70
+ }
71
+ exports.assetBalanceBody = assetBalanceBody;
72
+
73
+ /**
74
+ * @param {string} issuer
75
+ * @returns {string}
76
+ */
77
+ function assetSupplyBody(issuer) {
78
+ let deferred2_0;
79
+ let deferred2_1;
80
+ try {
81
+ const ptr0 = passStringToWasm0(issuer, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
82
+ const len0 = WASM_VECTOR_LEN;
83
+ const ret = wasm.assetSupplyBody(ptr0, len0);
84
+ deferred2_0 = ret[0];
85
+ deferred2_1 = ret[1];
86
+ return getStringFromWasm0(ret[0], ret[1]);
87
+ } finally {
88
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
89
+ }
90
+ }
91
+ exports.assetSupplyBody = assetSupplyBody;
92
+
50
93
  /**
51
94
  * @param {bigint} height
52
95
  * @returns {string}
@@ -216,6 +259,34 @@ function mainnetChainId() {
216
259
  }
217
260
  exports.mainnetChainId = mainnetChainId;
218
261
 
262
+ /**
263
+ * @param {bigint} map_domain_tag
264
+ * @param {string} key32_hex
265
+ * @param {bigint} word
266
+ * @returns {string}
267
+ */
268
+ function mapAddrWordKey(map_domain_tag, key32_hex, word) {
269
+ let deferred3_0;
270
+ let deferred3_1;
271
+ try {
272
+ const ptr0 = passStringToWasm0(key32_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
273
+ const len0 = WASM_VECTOR_LEN;
274
+ const ret = wasm.mapAddrWordKey(map_domain_tag, ptr0, len0, word);
275
+ var ptr2 = ret[0];
276
+ var len2 = ret[1];
277
+ if (ret[3]) {
278
+ ptr2 = 0; len2 = 0;
279
+ throw takeFromExternrefTable0(ret[2]);
280
+ }
281
+ deferred3_0 = ptr2;
282
+ deferred3_1 = len2;
283
+ return getStringFromWasm0(ptr2, len2);
284
+ } finally {
285
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
286
+ }
287
+ }
288
+ exports.mapAddrWordKey = mapAddrWordKey;
289
+
219
290
  /**
220
291
  * @param {bigint} map_domain_tag
221
292
  * @param {string} key_address_hex
@@ -269,6 +340,26 @@ function mnemonicFromSeed(seed_hex) {
269
340
  }
270
341
  exports.mnemonicFromSeed = mnemonicFromSeed;
271
342
 
343
+ /**
344
+ * @param {string} label
345
+ * @returns {string}
346
+ */
347
+ function nameKey(label) {
348
+ let deferred2_0;
349
+ let deferred2_1;
350
+ try {
351
+ const ptr0 = passStringToWasm0(label, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
352
+ const len0 = WASM_VECTOR_LEN;
353
+ const ret = wasm.nameKey(ptr0, len0);
354
+ deferred2_0 = ret[0];
355
+ deferred2_1 = ret[1];
356
+ return getStringFromWasm0(ret[0], ret[1]);
357
+ } finally {
358
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
359
+ }
360
+ }
361
+ exports.nameKey = nameKey;
362
+
272
363
  /**
273
364
  * @param {string} signer_hex
274
365
  * @returns {string}
@@ -322,6 +413,18 @@ function orderSigner(seed_hex, index) {
322
413
  }
323
414
  exports.orderSigner = orderSigner;
324
415
 
416
+ /**
417
+ * @param {string} symbol
418
+ * @returns {bigint}
419
+ */
420
+ function packSymbol(symbol) {
421
+ const ptr0 = passStringToWasm0(symbol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
422
+ const len0 = WASM_VECTOR_LEN;
423
+ const ret = wasm.packSymbol(ptr0, len0);
424
+ return BigInt.asUintN(64, ret);
425
+ }
426
+ exports.packSymbol = packSymbol;
427
+
325
428
  /**
326
429
  * @param {string} response
327
430
  * @returns {string}
@@ -392,6 +495,51 @@ function seedFromMnemonic(phrase) {
392
495
  }
393
496
  exports.seedFromMnemonic = seedFromMnemonic;
394
497
 
498
+ /**
499
+ * @param {string} seed_hex
500
+ * @param {bigint} index
501
+ * @param {string} target
502
+ * @param {string} args_hex
503
+ * @param {string} asset_issuer
504
+ * @param {string} amount
505
+ * @param {bigint} nonce
506
+ * @param {bigint} meter_limit
507
+ * @param {string} fee
508
+ * @param {bigint} chain_id
509
+ * @returns {string}
510
+ */
511
+ function signAssetCall(seed_hex, index, target, args_hex, asset_issuer, amount, nonce, meter_limit, fee, chain_id) {
512
+ let deferred8_0;
513
+ let deferred8_1;
514
+ try {
515
+ const ptr0 = passStringToWasm0(seed_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
516
+ const len0 = WASM_VECTOR_LEN;
517
+ const ptr1 = passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
518
+ const len1 = WASM_VECTOR_LEN;
519
+ const ptr2 = passStringToWasm0(args_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
520
+ const len2 = WASM_VECTOR_LEN;
521
+ const ptr3 = passStringToWasm0(asset_issuer, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
522
+ const len3 = WASM_VECTOR_LEN;
523
+ const ptr4 = passStringToWasm0(amount, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
524
+ const len4 = WASM_VECTOR_LEN;
525
+ const ptr5 = passStringToWasm0(fee, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
526
+ const len5 = WASM_VECTOR_LEN;
527
+ const ret = wasm.signAssetCall(ptr0, len0, index, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, nonce, meter_limit, ptr5, len5, chain_id);
528
+ var ptr7 = ret[0];
529
+ var len7 = ret[1];
530
+ if (ret[3]) {
531
+ ptr7 = 0; len7 = 0;
532
+ throw takeFromExternrefTable0(ret[2]);
533
+ }
534
+ deferred8_0 = ptr7;
535
+ deferred8_1 = len7;
536
+ return getStringFromWasm0(ptr7, len7);
537
+ } finally {
538
+ wasm.__wbindgen_free(deferred8_0, deferred8_1, 1);
539
+ }
540
+ }
541
+ exports.signAssetCall = signAssetCall;
542
+
395
543
  /**
396
544
  * @param {string} seed_hex
397
545
  * @param {bigint} index
@@ -627,6 +775,24 @@ function testnetChainId() {
627
775
  }
628
776
  exports.testnetChainId = testnetChainId;
629
777
 
778
+ /**
779
+ * @returns {bigint}
780
+ */
781
+ function tokenDecimalsSlot() {
782
+ const ret = wasm.tokenDecimalsSlot();
783
+ return BigInt.asUintN(64, ret);
784
+ }
785
+ exports.tokenDecimalsSlot = tokenDecimalsSlot;
786
+
787
+ /**
788
+ * @returns {bigint}
789
+ */
790
+ function tokenSymbolSlot() {
791
+ const ret = wasm.tokenSymbolSlot();
792
+ return BigInt.asUintN(64, ret);
793
+ }
794
+ exports.tokenSymbolSlot = tokenSymbolSlot;
795
+
630
796
  /**
631
797
  * @param {string} tx_id
632
798
  * @returns {string}
@@ -647,6 +813,24 @@ function transaction_body(tx_id) {
647
813
  }
648
814
  exports.transaction_body = transaction_body;
649
815
 
816
+ /**
817
+ * @param {bigint} word
818
+ * @returns {string}
819
+ */
820
+ function unpackSymbol(word) {
821
+ let deferred1_0;
822
+ let deferred1_1;
823
+ try {
824
+ const ret = wasm.unpackSymbol(word);
825
+ deferred1_0 = ret[0];
826
+ deferred1_1 = ret[1];
827
+ return getStringFromWasm0(ret[0], ret[1]);
828
+ } finally {
829
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
830
+ }
831
+ }
832
+ exports.unpackSymbol = unpackSymbol;
833
+
650
834
  /**
651
835
  * @param {string} address
652
836
  * @returns {boolean}
Binary file