@quantovainc/qcore 0.4.3 → 0.5.1
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 +16 -2
- package/index.d.ts +42 -3
- package/package.json +1 -1
- package/pkg/README.md +16 -2
- package/pkg/package.json +1 -1
- package/pkg/qcore_js.d.ts +34 -3
- package/pkg/qcore_js.js +1 -1
- package/pkg/qcore_js_bg.js +241 -5
- package/pkg/qcore_js_bg.wasm +0 -0
- package/pkg/qcore_js_bg.wasm.d.ts +21 -3
- package/pkg-node/README.md +16 -2
- package/pkg-node/package.json +1 -1
- package/pkg-node/qcore_js.d.ts +34 -3
- package/pkg-node/qcore_js.js +252 -6
- package/pkg-node/qcore_js_bg.wasm +0 -0
- package/shared.js +190 -183
- package/shared.mjs +190 -183
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_signingsession_free: (a: number, b: number) => void;
|
|
4
5
|
export const account_body: (a: number, b: number) => [number, number];
|
|
5
6
|
export const address: (a: number, b: number, c: bigint) => [number, number, number, number];
|
|
6
7
|
export const assetBalanceBody: (a: number, b: number, c: number, d: number) => [number, number];
|
|
7
8
|
export const assetSupplyBody: (a: number, b: number) => [number, number];
|
|
8
9
|
export const block_by_height_body: (a: bigint) => [number, number];
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
10
|
+
export const boundedValidUntil: (a: number, b: number, c: bigint, d: bigint, e: number, f: bigint, g: bigint) => [bigint, number, number];
|
|
11
|
+
export const buildSignedOrderCall: (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: number, o: number, p: bigint, q: bigint, r: bigint) => [number, number, number, number];
|
|
12
|
+
export const buildTypedOrderCall: (a: bigint, b: number, c: number, d: number, e: number, f: bigint, g: bigint, h: bigint, i: bigint, j: number, k: number, l: number, m: number, n: bigint, o: bigint, p: bigint) => [number, number, number, number];
|
|
11
13
|
export const chainIdFromName: (a: number, b: number) => bigint;
|
|
14
|
+
export const checkGatewayJson: (a: number, b: number) => [number, number];
|
|
12
15
|
export const checkValidUntil: (a: bigint, b: bigint) => [number, number];
|
|
13
16
|
export const contractAddress: (a: number, b: number, c: bigint) => [number, number];
|
|
14
17
|
export const eventsBody: (a: bigint) => [number, number];
|
|
18
|
+
export const genesisSecs: (a: number, b: number) => bigint;
|
|
19
|
+
export const headCeiling: (a: number, b: number, c: bigint) => bigint;
|
|
15
20
|
export const localChainId: () => bigint;
|
|
16
21
|
export const lookalikeOf: (a: number, b: number, c: number, d: number) => [number, number];
|
|
17
22
|
export const mainnetChainId: () => bigint;
|
|
18
23
|
export const mapAddrWordKey: (a: bigint, b: number, c: number, d: bigint) => [number, number, number, number];
|
|
19
24
|
export const mapSlotKey: (a: bigint, b: number, c: number) => [number, number, number, number];
|
|
20
|
-
export const mnemonicFromSeed: (a: number, b: number) => [number, number, number];
|
|
25
|
+
export const mnemonicFromSeed: (a: number, b: number) => [number, number, number, number];
|
|
26
|
+
export const mnemonicFromSeedText: (a: number, b: number) => [number, number, number];
|
|
21
27
|
export const nameKey: (a: number, b: number) => [number, number];
|
|
22
28
|
export const nonceSlotKey: (a: number, b: number) => [number, number, number, number];
|
|
23
29
|
export const orderSigner: (a: number, b: number, c: bigint) => [number, number, number, number];
|
|
@@ -26,20 +32,32 @@ export const parseEvents: (a: number, b: number) => [number, number, number, num
|
|
|
26
32
|
export const sameAddress: (a: number, b: number, c: number, d: number) => number;
|
|
27
33
|
export const scalarSlotKey: (a: bigint) => [number, number];
|
|
28
34
|
export const seedFromMnemonic: (a: number, b: number) => [number, number, number, number];
|
|
35
|
+
export const seedFromMnemonicBytes: (a: number, b: number) => [number, number, number, number];
|
|
29
36
|
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, q: bigint, r: number, s: number) => [number, number, number, number];
|
|
30
37
|
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, o: bigint, p: number, q: number) => [number, number, number, number];
|
|
31
38
|
export const signRegister: (a: number, b: number, c: bigint, d: bigint, e: number, f: number, g: bigint, h: bigint) => [number, number, number, number];
|
|
32
39
|
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, m: bigint, n: number, o: number) => [number, number, number, number];
|
|
33
40
|
export const sign_transfer: (a: number, b: number, c: bigint, d: number, e: number, f: number, g: number, h: bigint, i: number, j: number, k: bigint, l: bigint) => [number, number, number, number];
|
|
41
|
+
export const signingsession_checkTarget: (a: number, b: number, c: number) => [number, number];
|
|
42
|
+
export const signingsession_isHeld: (a: number, b: number, c: number, d: bigint) => number;
|
|
43
|
+
export const signingsession_new: (a: number, b: number) => [number, number, number];
|
|
44
|
+
export const signingsession_nextNonce: (a: number, b: number, c: number) => [number, bigint];
|
|
45
|
+
export const signingsession_outcome: (a: number, b: number, c: number, d: bigint, e: number) => void;
|
|
46
|
+
export const signingsession_rememberAddress: (a: number, b: number, c: number) => void;
|
|
47
|
+
export const signingsession_signed: (a: number, b: number, c: number, d: bigint) => void;
|
|
48
|
+
export const signingsession_slot: (a: number, b: number, c: number, d: bigint, e: number, f: bigint, g: number) => [bigint, number, number];
|
|
34
49
|
export const storageBody: (a: number, b: number) => [number, number];
|
|
35
50
|
export const storageValue: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
36
51
|
export const submit_body: (a: number, b: number) => [number, number, number, number];
|
|
37
52
|
export const testnetChainId: () => bigint;
|
|
53
|
+
export const testnetChainName: () => [number, number];
|
|
54
|
+
export const testnetRpcUrl: () => [number, number];
|
|
38
55
|
export const tokenDecimalsSlot: () => bigint;
|
|
39
56
|
export const tokenSymbolSlot: () => bigint;
|
|
40
57
|
export const transaction_body: (a: number, b: number) => [number, number];
|
|
41
58
|
export const unpackSymbol: (a: bigint) => [number, number];
|
|
42
59
|
export const valid_address: (a: number, b: number) => number;
|
|
60
|
+
export const validityBlocks: () => bigint;
|
|
43
61
|
export const vmCallFee: (a: number, b: number, c: bigint) => [number, number, number, number];
|
|
44
62
|
export const vmDeployAddress: () => [number, number];
|
|
45
63
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
package/pkg-node/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
|
|
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-node/package.json
CHANGED
|
@@ -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.
|
|
4
|
+
"version": "0.5.1",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
package/pkg-node/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
|
|
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):
|
|
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-node/qcore_js.js
CHANGED
|
@@ -1,5 +1,109 @@
|
|
|
1
1
|
/* @ts-self-types="./qcore_js.d.ts" */
|
|
2
2
|
|
|
3
|
+
class SigningSession {
|
|
4
|
+
__destroy_into_raw() {
|
|
5
|
+
const ptr = this.__wbg_ptr;
|
|
6
|
+
this.__wbg_ptr = 0;
|
|
7
|
+
SigningSessionFinalization.unregister(this);
|
|
8
|
+
return ptr;
|
|
9
|
+
}
|
|
10
|
+
free() {
|
|
11
|
+
const ptr = this.__destroy_into_raw();
|
|
12
|
+
wasm.__wbg_signingsession_free(ptr, 0);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @param {string} address
|
|
16
|
+
*/
|
|
17
|
+
checkTarget(address) {
|
|
18
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
19
|
+
const len0 = WASM_VECTOR_LEN;
|
|
20
|
+
const ret = wasm.signingsession_checkTarget(this.__wbg_ptr, ptr0, len0);
|
|
21
|
+
if (ret[1]) {
|
|
22
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @param {string} key
|
|
27
|
+
* @param {bigint} slot
|
|
28
|
+
* @returns {boolean}
|
|
29
|
+
*/
|
|
30
|
+
isHeld(key, slot) {
|
|
31
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
32
|
+
const len0 = WASM_VECTOR_LEN;
|
|
33
|
+
const ret = wasm.signingsession_isHeld(this.__wbg_ptr, ptr0, len0, slot);
|
|
34
|
+
return ret !== 0;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @param {string[]} book
|
|
38
|
+
*/
|
|
39
|
+
constructor(book) {
|
|
40
|
+
const ptr0 = passArrayJsValueToWasm0(book, wasm.__wbindgen_malloc);
|
|
41
|
+
const len0 = WASM_VECTOR_LEN;
|
|
42
|
+
const ret = wasm.signingsession_new(ptr0, len0);
|
|
43
|
+
if (ret[2]) {
|
|
44
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
45
|
+
}
|
|
46
|
+
this.__wbg_ptr = ret[0];
|
|
47
|
+
SigningSessionFinalization.register(this, this.__wbg_ptr, this);
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @param {string} key
|
|
52
|
+
* @returns {bigint | undefined}
|
|
53
|
+
*/
|
|
54
|
+
nextNonce(key) {
|
|
55
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
56
|
+
const len0 = WASM_VECTOR_LEN;
|
|
57
|
+
const ret = wasm.signingsession_nextNonce(this.__wbg_ptr, ptr0, len0);
|
|
58
|
+
return ret[0] === 0 ? undefined : BigInt.asUintN(64, ret[1]);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @param {string} key
|
|
62
|
+
* @param {bigint} slot
|
|
63
|
+
* @param {boolean} accepted
|
|
64
|
+
*/
|
|
65
|
+
outcome(key, slot, accepted) {
|
|
66
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
67
|
+
const len0 = WASM_VECTOR_LEN;
|
|
68
|
+
wasm.signingsession_outcome(this.__wbg_ptr, ptr0, len0, slot, accepted);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @param {string} address
|
|
72
|
+
*/
|
|
73
|
+
rememberAddress(address) {
|
|
74
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
75
|
+
const len0 = WASM_VECTOR_LEN;
|
|
76
|
+
wasm.signingsession_rememberAddress(this.__wbg_ptr, ptr0, len0);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @param {string} key
|
|
80
|
+
* @param {bigint} slot
|
|
81
|
+
*/
|
|
82
|
+
signed(key, slot) {
|
|
83
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
84
|
+
const len0 = WASM_VECTOR_LEN;
|
|
85
|
+
wasm.signingsession_signed(this.__wbg_ptr, ptr0, len0, slot);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* @param {string} key
|
|
89
|
+
* @param {bigint} reported
|
|
90
|
+
* @param {bigint | null | undefined} expected
|
|
91
|
+
* @param {boolean} order
|
|
92
|
+
* @returns {bigint}
|
|
93
|
+
*/
|
|
94
|
+
slot(key, reported, expected, order) {
|
|
95
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
96
|
+
const len0 = WASM_VECTOR_LEN;
|
|
97
|
+
const ret = wasm.signingsession_slot(this.__wbg_ptr, ptr0, len0, reported, !isLikeNone(expected), isLikeNone(expected) ? BigInt(0) : expected, order);
|
|
98
|
+
if (ret[2]) {
|
|
99
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
100
|
+
}
|
|
101
|
+
return BigInt.asUintN(64, ret[0]);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (Symbol.dispose) SigningSession.prototype[Symbol.dispose] = SigningSession.prototype.free;
|
|
105
|
+
exports.SigningSession = SigningSession;
|
|
106
|
+
|
|
3
107
|
/**
|
|
4
108
|
* @param {string} address
|
|
5
109
|
* @returns {string}
|
|
@@ -108,21 +212,42 @@ function block_by_height_body(height) {
|
|
|
108
212
|
}
|
|
109
213
|
exports.block_by_height_body = block_by_height_body;
|
|
110
214
|
|
|
215
|
+
/**
|
|
216
|
+
* @param {string} chain_name
|
|
217
|
+
* @param {bigint} head
|
|
218
|
+
* @param {bigint} wall_secs
|
|
219
|
+
* @param {bigint | null | undefined} floor
|
|
220
|
+
* @param {bigint} floor_age_secs
|
|
221
|
+
* @returns {bigint}
|
|
222
|
+
*/
|
|
223
|
+
function boundedValidUntil(chain_name, head, wall_secs, floor, floor_age_secs) {
|
|
224
|
+
const ptr0 = passStringToWasm0(chain_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
225
|
+
const len0 = WASM_VECTOR_LEN;
|
|
226
|
+
const ret = wasm.boundedValidUntil(ptr0, len0, head, wall_secs, !isLikeNone(floor), isLikeNone(floor) ? BigInt(0) : floor, floor_age_secs);
|
|
227
|
+
if (ret[2]) {
|
|
228
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
229
|
+
}
|
|
230
|
+
return BigInt.asUintN(64, ret[0]);
|
|
231
|
+
}
|
|
232
|
+
exports.boundedValidUntil = boundedValidUntil;
|
|
233
|
+
|
|
111
234
|
/**
|
|
112
235
|
* @param {bigint} chain_id
|
|
113
236
|
* @param {string} contract
|
|
114
237
|
* @param {string} selector_hex
|
|
115
238
|
* @param {bigint} scheme_off
|
|
116
239
|
* @param {bigint} ptr_off
|
|
240
|
+
* @param {bigint} expiry_off
|
|
117
241
|
* @param {string} field_offs_csv
|
|
118
242
|
* @param {string} fields_csv
|
|
119
243
|
* @param {bigint} region_off
|
|
120
244
|
* @param {Uint8Array} owner_seed_bytes
|
|
121
245
|
* @param {bigint} owner_index
|
|
122
246
|
* @param {bigint} nonce
|
|
247
|
+
* @param {bigint} expiry
|
|
123
248
|
* @returns {string}
|
|
124
249
|
*/
|
|
125
|
-
function buildSignedOrderCall(chain_id, contract, selector_hex, scheme_off, ptr_off, field_offs_csv, fields_csv, region_off, owner_seed_bytes, owner_index, nonce) {
|
|
250
|
+
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) {
|
|
126
251
|
let deferred7_0;
|
|
127
252
|
let deferred7_1;
|
|
128
253
|
try {
|
|
@@ -136,7 +261,7 @@ function buildSignedOrderCall(chain_id, contract, selector_hex, scheme_off, ptr_
|
|
|
136
261
|
const len3 = WASM_VECTOR_LEN;
|
|
137
262
|
const ptr4 = passArray8ToWasm0(owner_seed_bytes, wasm.__wbindgen_malloc);
|
|
138
263
|
const len4 = WASM_VECTOR_LEN;
|
|
139
|
-
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);
|
|
264
|
+
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);
|
|
140
265
|
var ptr6 = ret[0];
|
|
141
266
|
var len6 = ret[1];
|
|
142
267
|
if (ret[3]) {
|
|
@@ -158,14 +283,16 @@ exports.buildSignedOrderCall = buildSignedOrderCall;
|
|
|
158
283
|
* @param {string} selector_hex
|
|
159
284
|
* @param {bigint} scheme_off
|
|
160
285
|
* @param {bigint} ptr_off
|
|
286
|
+
* @param {bigint} expiry_off
|
|
161
287
|
* @param {bigint} region_off
|
|
162
288
|
* @param {string} fields_json
|
|
163
289
|
* @param {Uint8Array} owner_seed_bytes
|
|
164
290
|
* @param {bigint} owner_index
|
|
165
291
|
* @param {bigint} nonce
|
|
292
|
+
* @param {bigint} expiry
|
|
166
293
|
* @returns {string}
|
|
167
294
|
*/
|
|
168
|
-
function buildTypedOrderCall(chain_id, contract, selector_hex, scheme_off, ptr_off, region_off, fields_json, owner_seed_bytes, owner_index, nonce) {
|
|
295
|
+
function buildTypedOrderCall(chain_id, contract, selector_hex, scheme_off, ptr_off, expiry_off, region_off, fields_json, owner_seed_bytes, owner_index, nonce, expiry) {
|
|
169
296
|
let deferred6_0;
|
|
170
297
|
let deferred6_1;
|
|
171
298
|
try {
|
|
@@ -177,7 +304,7 @@ function buildTypedOrderCall(chain_id, contract, selector_hex, scheme_off, ptr_o
|
|
|
177
304
|
const len2 = WASM_VECTOR_LEN;
|
|
178
305
|
const ptr3 = passArray8ToWasm0(owner_seed_bytes, wasm.__wbindgen_malloc);
|
|
179
306
|
const len3 = WASM_VECTOR_LEN;
|
|
180
|
-
const ret = wasm.buildTypedOrderCall(chain_id, ptr0, len0, ptr1, len1, scheme_off, ptr_off, region_off, ptr2, len2, ptr3, len3, owner_index, nonce);
|
|
307
|
+
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);
|
|
181
308
|
var ptr5 = ret[0];
|
|
182
309
|
var len5 = ret[1];
|
|
183
310
|
if (ret[3]) {
|
|
@@ -205,6 +332,19 @@ function chainIdFromName(name) {
|
|
|
205
332
|
}
|
|
206
333
|
exports.chainIdFromName = chainIdFromName;
|
|
207
334
|
|
|
335
|
+
/**
|
|
336
|
+
* @param {string} response
|
|
337
|
+
*/
|
|
338
|
+
function checkGatewayJson(response) {
|
|
339
|
+
const ptr0 = passStringToWasm0(response, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
340
|
+
const len0 = WASM_VECTOR_LEN;
|
|
341
|
+
const ret = wasm.checkGatewayJson(ptr0, len0);
|
|
342
|
+
if (ret[1]) {
|
|
343
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
exports.checkGatewayJson = checkGatewayJson;
|
|
347
|
+
|
|
208
348
|
/**
|
|
209
349
|
* @param {bigint} valid_until
|
|
210
350
|
* @param {bigint} head
|
|
@@ -253,6 +393,31 @@ function eventsBody(height) {
|
|
|
253
393
|
}
|
|
254
394
|
exports.eventsBody = eventsBody;
|
|
255
395
|
|
|
396
|
+
/**
|
|
397
|
+
* @param {string} chain_name
|
|
398
|
+
* @returns {bigint}
|
|
399
|
+
*/
|
|
400
|
+
function genesisSecs(chain_name) {
|
|
401
|
+
const ptr0 = passStringToWasm0(chain_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
402
|
+
const len0 = WASM_VECTOR_LEN;
|
|
403
|
+
const ret = wasm.genesisSecs(ptr0, len0);
|
|
404
|
+
return BigInt.asUintN(64, ret);
|
|
405
|
+
}
|
|
406
|
+
exports.genesisSecs = genesisSecs;
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* @param {string} chain_name
|
|
410
|
+
* @param {bigint} wall_secs
|
|
411
|
+
* @returns {bigint}
|
|
412
|
+
*/
|
|
413
|
+
function headCeiling(chain_name, wall_secs) {
|
|
414
|
+
const ptr0 = passStringToWasm0(chain_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
415
|
+
const len0 = WASM_VECTOR_LEN;
|
|
416
|
+
const ret = wasm.headCeiling(ptr0, len0, wall_secs);
|
|
417
|
+
return BigInt.asUintN(64, ret);
|
|
418
|
+
}
|
|
419
|
+
exports.headCeiling = headCeiling;
|
|
420
|
+
|
|
256
421
|
/**
|
|
257
422
|
* @returns {bigint}
|
|
258
423
|
*/
|
|
@@ -348,18 +513,35 @@ exports.mapSlotKey = mapSlotKey;
|
|
|
348
513
|
|
|
349
514
|
/**
|
|
350
515
|
* @param {Uint8Array} seed_bytes
|
|
351
|
-
* @returns {
|
|
516
|
+
* @returns {Uint8Array}
|
|
352
517
|
*/
|
|
353
518
|
function mnemonicFromSeed(seed_bytes) {
|
|
354
519
|
const ptr0 = passArray8ToWasm0(seed_bytes, wasm.__wbindgen_malloc);
|
|
355
520
|
const len0 = WASM_VECTOR_LEN;
|
|
356
521
|
const ret = wasm.mnemonicFromSeed(ptr0, len0);
|
|
522
|
+
if (ret[3]) {
|
|
523
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
524
|
+
}
|
|
525
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
526
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
527
|
+
return v2;
|
|
528
|
+
}
|
|
529
|
+
exports.mnemonicFromSeed = mnemonicFromSeed;
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* @param {Uint8Array} seed_bytes
|
|
533
|
+
* @returns {any}
|
|
534
|
+
*/
|
|
535
|
+
function mnemonicFromSeedText(seed_bytes) {
|
|
536
|
+
const ptr0 = passArray8ToWasm0(seed_bytes, wasm.__wbindgen_malloc);
|
|
537
|
+
const len0 = WASM_VECTOR_LEN;
|
|
538
|
+
const ret = wasm.mnemonicFromSeedText(ptr0, len0);
|
|
357
539
|
if (ret[2]) {
|
|
358
540
|
throw takeFromExternrefTable0(ret[1]);
|
|
359
541
|
}
|
|
360
542
|
return takeFromExternrefTable0(ret[0]);
|
|
361
543
|
}
|
|
362
|
-
exports.
|
|
544
|
+
exports.mnemonicFromSeedText = mnemonicFromSeedText;
|
|
363
545
|
|
|
364
546
|
/**
|
|
365
547
|
* @param {string} label
|
|
@@ -522,6 +704,23 @@ function seedFromMnemonic(phrase) {
|
|
|
522
704
|
}
|
|
523
705
|
exports.seedFromMnemonic = seedFromMnemonic;
|
|
524
706
|
|
|
707
|
+
/**
|
|
708
|
+
* @param {Uint8Array} phrase
|
|
709
|
+
* @returns {Uint8Array}
|
|
710
|
+
*/
|
|
711
|
+
function seedFromMnemonicBytes(phrase) {
|
|
712
|
+
const ptr0 = passArray8ToWasm0(phrase, wasm.__wbindgen_malloc);
|
|
713
|
+
const len0 = WASM_VECTOR_LEN;
|
|
714
|
+
const ret = wasm.seedFromMnemonicBytes(ptr0, len0);
|
|
715
|
+
if (ret[3]) {
|
|
716
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
717
|
+
}
|
|
718
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
719
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
720
|
+
return v2;
|
|
721
|
+
}
|
|
722
|
+
exports.seedFromMnemonicBytes = seedFromMnemonicBytes;
|
|
723
|
+
|
|
525
724
|
/**
|
|
526
725
|
* @param {Uint8Array} seed_bytes
|
|
527
726
|
* @param {bigint} index
|
|
@@ -816,6 +1015,40 @@ function testnetChainId() {
|
|
|
816
1015
|
}
|
|
817
1016
|
exports.testnetChainId = testnetChainId;
|
|
818
1017
|
|
|
1018
|
+
/**
|
|
1019
|
+
* @returns {string}
|
|
1020
|
+
*/
|
|
1021
|
+
function testnetChainName() {
|
|
1022
|
+
let deferred1_0;
|
|
1023
|
+
let deferred1_1;
|
|
1024
|
+
try {
|
|
1025
|
+
const ret = wasm.testnetChainName();
|
|
1026
|
+
deferred1_0 = ret[0];
|
|
1027
|
+
deferred1_1 = ret[1];
|
|
1028
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1029
|
+
} finally {
|
|
1030
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
exports.testnetChainName = testnetChainName;
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* @returns {string}
|
|
1037
|
+
*/
|
|
1038
|
+
function testnetRpcUrl() {
|
|
1039
|
+
let deferred1_0;
|
|
1040
|
+
let deferred1_1;
|
|
1041
|
+
try {
|
|
1042
|
+
const ret = wasm.testnetRpcUrl();
|
|
1043
|
+
deferred1_0 = ret[0];
|
|
1044
|
+
deferred1_1 = ret[1];
|
|
1045
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1046
|
+
} finally {
|
|
1047
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
exports.testnetRpcUrl = testnetRpcUrl;
|
|
1051
|
+
|
|
819
1052
|
/**
|
|
820
1053
|
* @returns {bigint}
|
|
821
1054
|
*/
|
|
@@ -884,6 +1117,15 @@ function valid_address(address) {
|
|
|
884
1117
|
}
|
|
885
1118
|
exports.valid_address = valid_address;
|
|
886
1119
|
|
|
1120
|
+
/**
|
|
1121
|
+
* @returns {bigint}
|
|
1122
|
+
*/
|
|
1123
|
+
function validityBlocks() {
|
|
1124
|
+
const ret = wasm.validityBlocks();
|
|
1125
|
+
return BigInt.asUintN(64, ret);
|
|
1126
|
+
}
|
|
1127
|
+
exports.validityBlocks = validityBlocks;
|
|
1128
|
+
|
|
887
1129
|
/**
|
|
888
1130
|
* @param {string} transfer_fee
|
|
889
1131
|
* @param {bigint} meter_limit
|
|
@@ -966,6 +1208,10 @@ function __wbg_get_imports() {
|
|
|
966
1208
|
};
|
|
967
1209
|
}
|
|
968
1210
|
|
|
1211
|
+
const SigningSessionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1212
|
+
? { register: () => {}, unregister: () => {} }
|
|
1213
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_signingsession_free(ptr, 1));
|
|
1214
|
+
|
|
969
1215
|
function addToExternrefTable0(obj) {
|
|
970
1216
|
const idx = wasm.__externref_table_alloc();
|
|
971
1217
|
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
Binary file
|