@quantovainc/qcore 0.4.3 → 0.5.0

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
@@ -105,7 +105,7 @@ Quantova shares no wire, no address, and no unit with any other chain, and QCore
105
105
  const { generateSeed, core } = require('@quantovainc/qcore');
106
106
 
107
107
  const seed = generateSeed(); // thirty two random bytes in a Uint8Array from the platform source
108
- const phrase = core.mnemonicFromSeed(seed); // the only backup, shown once and kept on the device
108
+ const phrase = core.mnemonicFromSeed(seed); // the only backup as UTF-8 bytes in a Uint8Array you can wipe
109
109
  ```
110
110
 
111
111
  `core.seedFromMnemonic(phrase)` restores the seed from the twenty five words as a Uint8Array. It ignores
@@ -116,10 +116,24 @@ wallet is refused with its own error, since a Quantova phrase carries a SHA3 che
116
116
  from it.
117
117
 
118
118
  Every seed is a Uint8Array. Call `seed.fill(0)` when you are done with it, and never print or log any part of
119
- it. The WASM core wipes its own copies of a seed before it frees them.
119
+ it. The WASM core wipes its own copies of a seed before it frees them. The phrase comes back as a Uint8Array
120
+ of UTF-8 text for the same reason, so call `phrase.fill(0)` once it has been shown, and pass it back to
121
+ `core.seedFromMnemonic` as the same bytes. `core.mnemonicFromSeedText(seed)` returns the words as a string for
122
+ a caller that must display them, and a JavaScript string can never be wiped, so prefer the bytes.
120
123
 
121
124
  ## Using it
122
125
 
126
+ The Client checks every number the gateway reports before it signs. A fee or balance must be a string of
127
+ the ASCII digits zero to nine, a nonce or head height must be a JSON integer, and the head is bounded by the
128
+ time since the genesis of the named network, a constant the Client reads from the compiled core so all three
129
+ QCore clients share one value. The Client keeps a signing session in memory. A nonce it signed once is not
130
+ signed again until you pass that nonce as the expected nonce, which is how you say the first transaction never
131
+ landed, and a gateway that rejects a transaction and then reports a later nonce is refused for the same reason.
132
+ An order nonce the gateway raises above the one the session tracked needs the expected order nonce as well.
133
+ Pass `addressBook`, a list of Q1 addresses you trust, in the Client options, and the Client refuses to sign for
134
+ a target that shares two or more leading and trailing characters with a known address, eight in all, but is a
135
+ different address. The sending accounts and every target signed for in the session are known as well.
136
+
123
137
  The last argument to a Client signing call, transfer, register, call, or callSignedOrder, is a fee
124
138
  ceiling, the most you are ever willing to pay in fees for one transaction. You choose it yourself, as a
125
139
  fixed number your app decides on its own, before you sign. The Client reads the gateway's reported fee,
package/index.d.ts CHANGED
@@ -14,11 +14,14 @@ export interface SignedOrder {
14
14
  public_key: string;
15
15
  signer: string;
16
16
  nonce: number;
17
+ expiry: number;
17
18
  }
18
19
 
19
20
  export interface OrderLayout {
20
21
  schemeOff: number | bigint;
21
22
  ptrOff: number | bigint;
23
+ expiryOff: number | bigint;
24
+ expiry: number | bigint;
22
25
  fieldOffs?: ReadonlyArray<number | bigint>;
23
26
  regionOff?: number | bigint;
24
27
  }
@@ -32,6 +35,8 @@ export interface SignedOrderField {
32
35
  export interface SignedOrderSpec {
33
36
  schemeOff: number | bigint;
34
37
  ptrOff: number | bigint;
38
+ expiryOff: number | bigint;
39
+ expiry: number | bigint;
35
40
  regionOff?: number | bigint;
36
41
  fields: ReadonlyArray<SignedOrderField>;
37
42
  }
@@ -59,12 +64,14 @@ export interface QCore {
59
64
  selector_hex: string,
60
65
  scheme_off: WholeNumber,
61
66
  ptr_off: WholeNumber,
67
+ expiry_off: WholeNumber,
62
68
  field_offs_csv: string,
63
69
  fields_csv: string,
64
70
  region_off: WholeNumber,
65
71
  owner_seed: Uint8Array,
66
72
  owner_index: WholeNumber,
67
73
  nonce: WholeNumber,
74
+ expiry: WholeNumber,
68
75
  ): string;
69
76
  buildTypedOrderCall(
70
77
  chain_id: WholeNumber,
@@ -72,11 +79,13 @@ export interface QCore {
72
79
  selector_hex: string,
73
80
  scheme_off: WholeNumber,
74
81
  ptr_off: WholeNumber,
82
+ expiry_off: WholeNumber,
75
83
  region_off: WholeNumber,
76
84
  fields_json: string,
77
85
  owner_seed: Uint8Array,
78
86
  owner_index: WholeNumber,
79
87
  nonce: WholeNumber,
88
+ expiry: WholeNumber,
80
89
  ): string;
81
90
  checkValidUntil(valid_until: WholeNumber, head: WholeNumber): void;
82
91
  contractAddress(deployer: string, nonce: WholeNumber): string | undefined;
@@ -86,7 +95,8 @@ export interface QCore {
86
95
  mainnetChainId(): bigint;
87
96
  mapAddrWordKey(map_domain_tag: WholeNumber, key32_hex: string, word: WholeNumber): string;
88
97
  mapSlotKey(map_domain_tag: WholeNumber, key_address_hex: string): string;
89
- mnemonicFromSeed(seed: Uint8Array): string;
98
+ mnemonicFromSeed(seed: Uint8Array): Uint8Array;
99
+ mnemonicFromSeedText(seed: Uint8Array): string;
90
100
  nonceSlotKey(signer_hex: string): string;
91
101
  orderSigner(seed: Uint8Array, index: WholeNumber): string;
92
102
  parseEvents(response: string): string;
@@ -97,7 +107,22 @@ export interface QCore {
97
107
  unpackSymbol(word: WholeNumber): string;
98
108
  assetBalanceBody(issuer: string, holder: string): string;
99
109
  assetSupplyBody(issuer: string): string;
100
- seedFromMnemonic(phrase: string): Uint8Array;
110
+ seedFromMnemonic(phrase: string | Uint8Array): Uint8Array;
111
+ seedFromMnemonicBytes(phrase: Uint8Array): Uint8Array;
112
+ genesisSecs(chain_name: string): bigint;
113
+ headCeiling(chain_name: string, wall_secs: WholeNumber): bigint;
114
+ boundedValidUntil(
115
+ chain_name: string,
116
+ head: WholeNumber,
117
+ wall_secs: WholeNumber,
118
+ floor: WholeNumber | undefined,
119
+ floor_age_secs: WholeNumber,
120
+ ): bigint;
121
+ checkGatewayJson(response: string): void;
122
+ testnetRpcUrl(): string;
123
+ testnetChainName(): string;
124
+ validityBlocks(): bigint;
125
+ SigningSession: new (book: string[]) => SigningSession;
101
126
  signPayableCall(
102
127
  seed: Uint8Array,
103
128
  index: WholeNumber,
@@ -167,6 +192,17 @@ export interface QCore {
167
192
  vmDeployAddress(): string;
168
193
  }
169
194
 
195
+ export interface SigningSession {
196
+ rememberAddress(address: string): void;
197
+ checkTarget(address: string): void;
198
+ slot(key: string, reported: bigint, expected: bigint | undefined, order: boolean): bigint;
199
+ signed(key: string, slot: bigint): void;
200
+ outcome(key: string, slot: bigint, accepted: boolean): void;
201
+ nextNonce(key: string): bigint | undefined;
202
+ isHeld(key: string, slot: bigint): boolean;
203
+ free(): void;
204
+ }
205
+
170
206
  export class Network {
171
207
  readonly name: string;
172
208
  readonly chainId: string | null;
@@ -184,6 +220,7 @@ export interface ClientOptions {
184
220
  acknowledgeMainnet?: boolean;
185
221
  network?: Network;
186
222
  expectedChainId?: string;
223
+ addressBook?: ReadonlyArray<string>;
187
224
  }
188
225
 
189
226
  export class Client {
@@ -245,6 +282,8 @@ export class Client {
245
282
  ): Promise<TransferResult>;
246
283
  contractNonce(contract: string, signerHex: string): Promise<bigint>;
247
284
  contractScalar(contract: string, slot: number | bigint): Promise<bigint>;
285
+ contractMap(contract: string, mapDomainTag: number | bigint, keyHex: string): Promise<bigint>;
286
+ assetBalance(issuer: string, holder: string): Promise<bigint>;
248
287
  callSignedOrder(
249
288
  callerSeed: Uint8Array,
250
289
  callerIndex: number,
@@ -264,6 +303,6 @@ export const core: QCore;
264
303
 
265
304
  export function generateSeed(): Uint8Array;
266
305
 
267
- export function validUntil(nodeInfo: { head_height?: number | string | bigint }): bigint;
306
+ export function validUntil(nodeInfo: { head_height?: number | bigint }): bigint;
268
307
 
269
308
  export function vmCallFee(transferFee: WholeNumber, meterLimit: WholeNumber): bigint;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantovainc/qcore",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "description": "Quantova's post quantum client core for JavaScript. Signs with ML-DSA-65 and builds Q1 addresses.",
5
5
  "scripts": {
6
6
  "build": "bash scripts/build.sh",
package/pkg/README.md CHANGED
@@ -105,7 +105,7 @@ Quantova shares no wire, no address, and no unit with any other chain, and QCore
105
105
  const { generateSeed, core } = require('@quantovainc/qcore');
106
106
 
107
107
  const seed = generateSeed(); // thirty two random bytes in a Uint8Array from the platform source
108
- const phrase = core.mnemonicFromSeed(seed); // the only backup, shown once and kept on the device
108
+ const phrase = core.mnemonicFromSeed(seed); // the only backup as UTF-8 bytes in a Uint8Array you can wipe
109
109
  ```
110
110
 
111
111
  `core.seedFromMnemonic(phrase)` restores the seed from the twenty five words as a Uint8Array. It ignores
@@ -116,10 +116,24 @@ wallet is refused with its own error, since a Quantova phrase carries a SHA3 che
116
116
  from it.
117
117
 
118
118
  Every seed is a Uint8Array. Call `seed.fill(0)` when you are done with it, and never print or log any part of
119
- it. The WASM core wipes its own copies of a seed before it frees them.
119
+ it. The WASM core wipes its own copies of a seed before it frees them. The phrase comes back as a Uint8Array
120
+ of UTF-8 text for the same reason, so call `phrase.fill(0)` once it has been shown, and pass it back to
121
+ `core.seedFromMnemonic` as the same bytes. `core.mnemonicFromSeedText(seed)` returns the words as a string for
122
+ a caller that must display them, and a JavaScript string can never be wiped, so prefer the bytes.
120
123
 
121
124
  ## Using it
122
125
 
126
+ The Client checks every number the gateway reports before it signs. A fee or balance must be a string of
127
+ the ASCII digits zero to nine, a nonce or head height must be a JSON integer, and the head is bounded by the
128
+ time since the genesis of the named network, a constant the Client reads from the compiled core so all three
129
+ QCore clients share one value. The Client keeps a signing session in memory. A nonce it signed once is not
130
+ signed again until you pass that nonce as the expected nonce, which is how you say the first transaction never
131
+ landed, and a gateway that rejects a transaction and then reports a later nonce is refused for the same reason.
132
+ An order nonce the gateway raises above the one the session tracked needs the expected order nonce as well.
133
+ Pass `addressBook`, a list of Q1 addresses you trust, in the Client options, and the Client refuses to sign for
134
+ a target that shares two or more leading and trailing characters with a known address, eight in all, but is a
135
+ different address. The sending accounts and every target signed for in the session are known as well.
136
+
123
137
  The last argument to a Client signing call, transfer, register, call, or callSignedOrder, is a fee
124
138
  ceiling, the most you are ever willing to pay in fees for one transaction. You choose it yourself, as a
125
139
  fixed number your app decides on its own, before you sign. The Client reads the gateway's reported fee,
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.4.3",
5
+ "version": "0.5.0",
6
6
  "license": "Apache-2.0 OR MIT",
7
7
  "repository": {
8
8
  "type": "git",
package/pkg/qcore_js.d.ts CHANGED
@@ -1,6 +1,19 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
+ export class SigningSession {
5
+ free(): void;
6
+ [Symbol.dispose](): void;
7
+ checkTarget(address: string): void;
8
+ isHeld(key: string, slot: bigint): boolean;
9
+ constructor(book: string[]);
10
+ nextNonce(key: string): bigint | undefined;
11
+ outcome(key: string, slot: bigint, accepted: boolean): void;
12
+ rememberAddress(address: string): void;
13
+ signed(key: string, slot: bigint): void;
14
+ slot(key: string, reported: bigint, expected: bigint | null | undefined, order: boolean): bigint;
15
+ }
16
+
4
17
  export function account_body(address: string): string;
5
18
 
6
19
  export function address(seed_bytes: Uint8Array, index: bigint): string;
@@ -11,18 +24,26 @@ export function assetSupplyBody(issuer: string): string;
11
24
 
12
25
  export function block_by_height_body(height: bigint): string;
13
26
 
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_bytes: Uint8Array, owner_index: bigint, nonce: bigint): string;
27
+ export function boundedValidUntil(chain_name: string, head: bigint, wall_secs: bigint, floor: bigint | null | undefined, floor_age_secs: bigint): bigint;
28
+
29
+ export function buildSignedOrderCall(chain_id: bigint, contract: string, selector_hex: string, scheme_off: bigint, ptr_off: bigint, expiry_off: bigint, field_offs_csv: string, fields_csv: string, region_off: bigint, owner_seed_bytes: Uint8Array, owner_index: bigint, nonce: bigint, expiry: bigint): string;
15
30
 
16
- export function buildTypedOrderCall(chain_id: bigint, contract: string, selector_hex: string, scheme_off: bigint, ptr_off: bigint, region_off: bigint, fields_json: string, owner_seed_bytes: Uint8Array, owner_index: bigint, nonce: bigint): string;
31
+ export function buildTypedOrderCall(chain_id: bigint, contract: string, selector_hex: string, scheme_off: bigint, ptr_off: bigint, expiry_off: bigint, region_off: bigint, fields_json: string, owner_seed_bytes: Uint8Array, owner_index: bigint, nonce: bigint, expiry: bigint): string;
17
32
 
18
33
  export function chainIdFromName(name: string): bigint;
19
34
 
35
+ export function checkGatewayJson(response: string): void;
36
+
20
37
  export function checkValidUntil(valid_until: bigint, head: bigint): void;
21
38
 
22
39
  export function contractAddress(deployer: string, nonce: bigint): string | undefined;
23
40
 
24
41
  export function eventsBody(height: bigint): string;
25
42
 
43
+ export function genesisSecs(chain_name: string): bigint;
44
+
45
+ export function headCeiling(chain_name: string, wall_secs: bigint): bigint;
46
+
26
47
  export function localChainId(): bigint;
27
48
 
28
49
  export function lookalikeOf(candidate: string, known: string[]): string | undefined;
@@ -33,7 +54,9 @@ export function mapAddrWordKey(map_domain_tag: bigint, key32_hex: string, word:
33
54
 
34
55
  export function mapSlotKey(map_domain_tag: bigint, key_address_hex: string): string;
35
56
 
36
- export function mnemonicFromSeed(seed_bytes: Uint8Array): any;
57
+ export function mnemonicFromSeed(seed_bytes: Uint8Array): Uint8Array;
58
+
59
+ export function mnemonicFromSeedText(seed_bytes: Uint8Array): any;
37
60
 
38
61
  export function nameKey(label: string): string;
39
62
 
@@ -51,6 +74,8 @@ export function scalarSlotKey(slot: bigint): string;
51
74
 
52
75
  export function seedFromMnemonic(phrase: string): Uint8Array;
53
76
 
77
+ export function seedFromMnemonicBytes(phrase: Uint8Array): Uint8Array;
78
+
54
79
  export function signAssetCall(seed_bytes: Uint8Array, index: bigint, target: string, args_hex: string, asset_issuer: string, amount: string, nonce: bigint, meter_limit: bigint, fee: string, chain_id: bigint, valid_until: bigint, transfer_fee?: string | null): string;
55
80
 
56
81
  export function signPayableCall(seed_bytes: Uint8Array, index: bigint, target: string, args_hex: string, nonce: bigint, meter_limit: bigint, fee: string, value: string, chain_id: bigint, valid_until: bigint, transfer_fee?: string | null): string;
@@ -69,6 +94,10 @@ export function submit_body(tx_hex: string): string;
69
94
 
70
95
  export function testnetChainId(): bigint;
71
96
 
97
+ export function testnetChainName(): string;
98
+
99
+ export function testnetRpcUrl(): string;
100
+
72
101
  export function tokenDecimalsSlot(): bigint;
73
102
 
74
103
  export function tokenSymbolSlot(): bigint;
@@ -79,6 +108,8 @@ export function unpackSymbol(word: bigint): string;
79
108
 
80
109
  export function valid_address(address: string): boolean;
81
110
 
111
+ export function validityBlocks(): bigint;
112
+
82
113
  export function vmCallFee(transfer_fee: string, meter_limit: bigint): string;
83
114
 
84
115
  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, assetBalanceBody, assetSupplyBody, block_by_height_body, buildSignedOrderCall, buildTypedOrderCall, chainIdFromName, checkValidUntil, contractAddress, eventsBody, localChainId, lookalikeOf, mainnetChainId, mapAddrWordKey, mapSlotKey, mnemonicFromSeed, nameKey, nonceSlotKey, orderSigner, packSymbol, parseEvents, sameAddress, scalarSlotKey, seedFromMnemonic, signAssetCall, signPayableCall, signRegister, sign_call, sign_transfer, storageBody, storageValue, submit_body, testnetChainId, tokenDecimalsSlot, tokenSymbolSlot, transaction_body, unpackSymbol, valid_address, vmCallFee, vmDeployAddress
8
+ SigningSession, account_body, address, assetBalanceBody, assetSupplyBody, block_by_height_body, boundedValidUntil, buildSignedOrderCall, buildTypedOrderCall, chainIdFromName, checkGatewayJson, checkValidUntil, contractAddress, eventsBody, genesisSecs, headCeiling, localChainId, lookalikeOf, mainnetChainId, mapAddrWordKey, mapSlotKey, mnemonicFromSeed, mnemonicFromSeedText, nameKey, nonceSlotKey, orderSigner, packSymbol, parseEvents, sameAddress, scalarSlotKey, seedFromMnemonic, seedFromMnemonicBytes, signAssetCall, signPayableCall, signRegister, sign_call, sign_transfer, storageBody, storageValue, submit_body, testnetChainId, testnetChainName, testnetRpcUrl, tokenDecimalsSlot, tokenSymbolSlot, transaction_body, unpackSymbol, valid_address, validityBlocks, vmCallFee, vmDeployAddress
9
9
  } from "./qcore_js_bg.js";
@@ -1,3 +1,106 @@
1
+ export class SigningSession {
2
+ __destroy_into_raw() {
3
+ const ptr = this.__wbg_ptr;
4
+ this.__wbg_ptr = 0;
5
+ SigningSessionFinalization.unregister(this);
6
+ return ptr;
7
+ }
8
+ free() {
9
+ const ptr = this.__destroy_into_raw();
10
+ wasm.__wbg_signingsession_free(ptr, 0);
11
+ }
12
+ /**
13
+ * @param {string} address
14
+ */
15
+ checkTarget(address) {
16
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
17
+ const len0 = WASM_VECTOR_LEN;
18
+ const ret = wasm.signingsession_checkTarget(this.__wbg_ptr, ptr0, len0);
19
+ if (ret[1]) {
20
+ throw takeFromExternrefTable0(ret[0]);
21
+ }
22
+ }
23
+ /**
24
+ * @param {string} key
25
+ * @param {bigint} slot
26
+ * @returns {boolean}
27
+ */
28
+ isHeld(key, slot) {
29
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30
+ const len0 = WASM_VECTOR_LEN;
31
+ const ret = wasm.signingsession_isHeld(this.__wbg_ptr, ptr0, len0, slot);
32
+ return ret !== 0;
33
+ }
34
+ /**
35
+ * @param {string[]} book
36
+ */
37
+ constructor(book) {
38
+ const ptr0 = passArrayJsValueToWasm0(book, wasm.__wbindgen_malloc);
39
+ const len0 = WASM_VECTOR_LEN;
40
+ const ret = wasm.signingsession_new(ptr0, len0);
41
+ if (ret[2]) {
42
+ throw takeFromExternrefTable0(ret[1]);
43
+ }
44
+ this.__wbg_ptr = ret[0];
45
+ SigningSessionFinalization.register(this, this.__wbg_ptr, this);
46
+ return this;
47
+ }
48
+ /**
49
+ * @param {string} key
50
+ * @returns {bigint | undefined}
51
+ */
52
+ nextNonce(key) {
53
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
54
+ const len0 = WASM_VECTOR_LEN;
55
+ const ret = wasm.signingsession_nextNonce(this.__wbg_ptr, ptr0, len0);
56
+ return ret[0] === 0 ? undefined : BigInt.asUintN(64, ret[1]);
57
+ }
58
+ /**
59
+ * @param {string} key
60
+ * @param {bigint} slot
61
+ * @param {boolean} accepted
62
+ */
63
+ outcome(key, slot, accepted) {
64
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
65
+ const len0 = WASM_VECTOR_LEN;
66
+ wasm.signingsession_outcome(this.__wbg_ptr, ptr0, len0, slot, accepted);
67
+ }
68
+ /**
69
+ * @param {string} address
70
+ */
71
+ rememberAddress(address) {
72
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
73
+ const len0 = WASM_VECTOR_LEN;
74
+ wasm.signingsession_rememberAddress(this.__wbg_ptr, ptr0, len0);
75
+ }
76
+ /**
77
+ * @param {string} key
78
+ * @param {bigint} slot
79
+ */
80
+ signed(key, slot) {
81
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
82
+ const len0 = WASM_VECTOR_LEN;
83
+ wasm.signingsession_signed(this.__wbg_ptr, ptr0, len0, slot);
84
+ }
85
+ /**
86
+ * @param {string} key
87
+ * @param {bigint} reported
88
+ * @param {bigint | null | undefined} expected
89
+ * @param {boolean} order
90
+ * @returns {bigint}
91
+ */
92
+ slot(key, reported, expected, order) {
93
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
94
+ const len0 = WASM_VECTOR_LEN;
95
+ const ret = wasm.signingsession_slot(this.__wbg_ptr, ptr0, len0, reported, !isLikeNone(expected), isLikeNone(expected) ? BigInt(0) : expected, order);
96
+ if (ret[2]) {
97
+ throw takeFromExternrefTable0(ret[1]);
98
+ }
99
+ return BigInt.asUintN(64, ret[0]);
100
+ }
101
+ }
102
+ if (Symbol.dispose) SigningSession.prototype[Symbol.dispose] = SigningSession.prototype.free;
103
+
1
104
  /**
2
105
  * @param {string} address
3
106
  * @returns {string}
@@ -101,21 +204,41 @@ export function block_by_height_body(height) {
101
204
  }
102
205
  }
103
206
 
207
+ /**
208
+ * @param {string} chain_name
209
+ * @param {bigint} head
210
+ * @param {bigint} wall_secs
211
+ * @param {bigint | null | undefined} floor
212
+ * @param {bigint} floor_age_secs
213
+ * @returns {bigint}
214
+ */
215
+ export function boundedValidUntil(chain_name, head, wall_secs, floor, floor_age_secs) {
216
+ const ptr0 = passStringToWasm0(chain_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
217
+ const len0 = WASM_VECTOR_LEN;
218
+ const ret = wasm.boundedValidUntil(ptr0, len0, head, wall_secs, !isLikeNone(floor), isLikeNone(floor) ? BigInt(0) : floor, floor_age_secs);
219
+ if (ret[2]) {
220
+ throw takeFromExternrefTable0(ret[1]);
221
+ }
222
+ return BigInt.asUintN(64, ret[0]);
223
+ }
224
+
104
225
  /**
105
226
  * @param {bigint} chain_id
106
227
  * @param {string} contract
107
228
  * @param {string} selector_hex
108
229
  * @param {bigint} scheme_off
109
230
  * @param {bigint} ptr_off
231
+ * @param {bigint} expiry_off
110
232
  * @param {string} field_offs_csv
111
233
  * @param {string} fields_csv
112
234
  * @param {bigint} region_off
113
235
  * @param {Uint8Array} owner_seed_bytes
114
236
  * @param {bigint} owner_index
115
237
  * @param {bigint} nonce
238
+ * @param {bigint} expiry
116
239
  * @returns {string}
117
240
  */
118
- export function buildSignedOrderCall(chain_id, contract, selector_hex, scheme_off, ptr_off, field_offs_csv, fields_csv, region_off, owner_seed_bytes, owner_index, nonce) {
241
+ export function buildSignedOrderCall(chain_id, contract, selector_hex, scheme_off, ptr_off, expiry_off, field_offs_csv, fields_csv, region_off, owner_seed_bytes, owner_index, nonce, expiry) {
119
242
  let deferred7_0;
120
243
  let deferred7_1;
121
244
  try {
@@ -129,7 +252,7 @@ export function buildSignedOrderCall(chain_id, contract, selector_hex, scheme_of
129
252
  const len3 = WASM_VECTOR_LEN;
130
253
  const ptr4 = passArray8ToWasm0(owner_seed_bytes, wasm.__wbindgen_malloc);
131
254
  const len4 = WASM_VECTOR_LEN;
132
- const ret = wasm.buildSignedOrderCall(chain_id, ptr0, len0, ptr1, len1, scheme_off, ptr_off, ptr2, len2, ptr3, len3, region_off, ptr4, len4, owner_index, nonce);
255
+ const ret = wasm.buildSignedOrderCall(chain_id, ptr0, len0, ptr1, len1, scheme_off, ptr_off, expiry_off, ptr2, len2, ptr3, len3, region_off, ptr4, len4, owner_index, nonce, expiry);
133
256
  var ptr6 = ret[0];
134
257
  var len6 = ret[1];
135
258
  if (ret[3]) {
@@ -150,14 +273,16 @@ export function buildSignedOrderCall(chain_id, contract, selector_hex, scheme_of
150
273
  * @param {string} selector_hex
151
274
  * @param {bigint} scheme_off
152
275
  * @param {bigint} ptr_off
276
+ * @param {bigint} expiry_off
153
277
  * @param {bigint} region_off
154
278
  * @param {string} fields_json
155
279
  * @param {Uint8Array} owner_seed_bytes
156
280
  * @param {bigint} owner_index
157
281
  * @param {bigint} nonce
282
+ * @param {bigint} expiry
158
283
  * @returns {string}
159
284
  */
160
- export function buildTypedOrderCall(chain_id, contract, selector_hex, scheme_off, ptr_off, region_off, fields_json, owner_seed_bytes, owner_index, nonce) {
285
+ export function buildTypedOrderCall(chain_id, contract, selector_hex, scheme_off, ptr_off, expiry_off, region_off, fields_json, owner_seed_bytes, owner_index, nonce, expiry) {
161
286
  let deferred6_0;
162
287
  let deferred6_1;
163
288
  try {
@@ -169,7 +294,7 @@ export function buildTypedOrderCall(chain_id, contract, selector_hex, scheme_off
169
294
  const len2 = WASM_VECTOR_LEN;
170
295
  const ptr3 = passArray8ToWasm0(owner_seed_bytes, wasm.__wbindgen_malloc);
171
296
  const len3 = WASM_VECTOR_LEN;
172
- const ret = wasm.buildTypedOrderCall(chain_id, ptr0, len0, ptr1, len1, scheme_off, ptr_off, region_off, ptr2, len2, ptr3, len3, owner_index, nonce);
297
+ const ret = wasm.buildTypedOrderCall(chain_id, ptr0, len0, ptr1, len1, scheme_off, ptr_off, expiry_off, region_off, ptr2, len2, ptr3, len3, owner_index, nonce, expiry);
173
298
  var ptr5 = ret[0];
174
299
  var len5 = ret[1];
175
300
  if (ret[3]) {
@@ -195,6 +320,18 @@ export function chainIdFromName(name) {
195
320
  return BigInt.asUintN(64, ret);
196
321
  }
197
322
 
323
+ /**
324
+ * @param {string} response
325
+ */
326
+ export function checkGatewayJson(response) {
327
+ const ptr0 = passStringToWasm0(response, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
328
+ const len0 = WASM_VECTOR_LEN;
329
+ const ret = wasm.checkGatewayJson(ptr0, len0);
330
+ if (ret[1]) {
331
+ throw takeFromExternrefTable0(ret[0]);
332
+ }
333
+ }
334
+
198
335
  /**
199
336
  * @param {bigint} valid_until
200
337
  * @param {bigint} head
@@ -240,6 +377,29 @@ export function eventsBody(height) {
240
377
  }
241
378
  }
242
379
 
380
+ /**
381
+ * @param {string} chain_name
382
+ * @returns {bigint}
383
+ */
384
+ export function genesisSecs(chain_name) {
385
+ const ptr0 = passStringToWasm0(chain_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
386
+ const len0 = WASM_VECTOR_LEN;
387
+ const ret = wasm.genesisSecs(ptr0, len0);
388
+ return BigInt.asUintN(64, ret);
389
+ }
390
+
391
+ /**
392
+ * @param {string} chain_name
393
+ * @param {bigint} wall_secs
394
+ * @returns {bigint}
395
+ */
396
+ export function headCeiling(chain_name, wall_secs) {
397
+ const ptr0 = passStringToWasm0(chain_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
398
+ const len0 = WASM_VECTOR_LEN;
399
+ const ret = wasm.headCeiling(ptr0, len0, wall_secs);
400
+ return BigInt.asUintN(64, ret);
401
+ }
402
+
243
403
  /**
244
404
  * @returns {bigint}
245
405
  */
@@ -330,12 +490,28 @@ export function mapSlotKey(map_domain_tag, key_address_hex) {
330
490
 
331
491
  /**
332
492
  * @param {Uint8Array} seed_bytes
333
- * @returns {any}
493
+ * @returns {Uint8Array}
334
494
  */
335
495
  export function mnemonicFromSeed(seed_bytes) {
336
496
  const ptr0 = passArray8ToWasm0(seed_bytes, wasm.__wbindgen_malloc);
337
497
  const len0 = WASM_VECTOR_LEN;
338
498
  const ret = wasm.mnemonicFromSeed(ptr0, len0);
499
+ if (ret[3]) {
500
+ throw takeFromExternrefTable0(ret[2]);
501
+ }
502
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
503
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
504
+ return v2;
505
+ }
506
+
507
+ /**
508
+ * @param {Uint8Array} seed_bytes
509
+ * @returns {any}
510
+ */
511
+ export function mnemonicFromSeedText(seed_bytes) {
512
+ const ptr0 = passArray8ToWasm0(seed_bytes, wasm.__wbindgen_malloc);
513
+ const len0 = WASM_VECTOR_LEN;
514
+ const ret = wasm.mnemonicFromSeedText(ptr0, len0);
339
515
  if (ret[2]) {
340
516
  throw takeFromExternrefTable0(ret[1]);
341
517
  }
@@ -495,6 +671,22 @@ export function seedFromMnemonic(phrase) {
495
671
  return v2;
496
672
  }
497
673
 
674
+ /**
675
+ * @param {Uint8Array} phrase
676
+ * @returns {Uint8Array}
677
+ */
678
+ export function seedFromMnemonicBytes(phrase) {
679
+ const ptr0 = passArray8ToWasm0(phrase, wasm.__wbindgen_malloc);
680
+ const len0 = WASM_VECTOR_LEN;
681
+ const ret = wasm.seedFromMnemonicBytes(ptr0, len0);
682
+ if (ret[3]) {
683
+ throw takeFromExternrefTable0(ret[2]);
684
+ }
685
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
686
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
687
+ return v2;
688
+ }
689
+
498
690
  /**
499
691
  * @param {Uint8Array} seed_bytes
500
692
  * @param {bigint} index
@@ -780,6 +972,38 @@ export function testnetChainId() {
780
972
  return BigInt.asUintN(64, ret);
781
973
  }
782
974
 
975
+ /**
976
+ * @returns {string}
977
+ */
978
+ export function testnetChainName() {
979
+ let deferred1_0;
980
+ let deferred1_1;
981
+ try {
982
+ const ret = wasm.testnetChainName();
983
+ deferred1_0 = ret[0];
984
+ deferred1_1 = ret[1];
985
+ return getStringFromWasm0(ret[0], ret[1]);
986
+ } finally {
987
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
988
+ }
989
+ }
990
+
991
+ /**
992
+ * @returns {string}
993
+ */
994
+ export function testnetRpcUrl() {
995
+ let deferred1_0;
996
+ let deferred1_1;
997
+ try {
998
+ const ret = wasm.testnetRpcUrl();
999
+ deferred1_0 = ret[0];
1000
+ deferred1_1 = ret[1];
1001
+ return getStringFromWasm0(ret[0], ret[1]);
1002
+ } finally {
1003
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1004
+ }
1005
+ }
1006
+
783
1007
  /**
784
1008
  * @returns {bigint}
785
1009
  */
@@ -843,6 +1067,14 @@ export function valid_address(address) {
843
1067
  return ret !== 0;
844
1068
  }
845
1069
 
1070
+ /**
1071
+ * @returns {bigint}
1072
+ */
1073
+ export function validityBlocks() {
1074
+ const ret = wasm.validityBlocks();
1075
+ return BigInt.asUintN(64, ret);
1076
+ }
1077
+
846
1078
  /**
847
1079
  * @param {string} transfer_fee
848
1080
  * @param {bigint} meter_limit
@@ -913,6 +1145,10 @@ export function __wbindgen_init_externref_table() {
913
1145
  table.set(offset + 2, true);
914
1146
  table.set(offset + 3, false);
915
1147
  }
1148
+ const SigningSessionFinalization = (typeof FinalizationRegistry === 'undefined')
1149
+ ? { register: () => {}, unregister: () => {} }
1150
+ : new FinalizationRegistry(ptr => wasm.__wbg_signingsession_free(ptr, 1));
1151
+
916
1152
  function addToExternrefTable0(obj) {
917
1153
  const idx = wasm.__externref_table_alloc();
918
1154
  wasm.__wbindgen_externrefs.set(idx, obj);
Binary file