@sovereign-sdk/universal-wallet-wasm 0.6.0 → 0.8.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/dist/esm/wallet_wasm.d.ts +14 -14
- package/dist/esm/wallet_wasm_bg.js +76 -76
- package/dist/esm/wallet_wasm_bg.wasm +0 -0
- package/dist/esm/wallet_wasm_bg.wasm.d.ts +7 -7
- package/dist/node/wallet_wasm.d.ts +14 -14
- package/dist/node/wallet_wasm.js +76 -76
- package/dist/node/wallet_wasm_bg.wasm +0 -0
- package/dist/node/wallet_wasm_bg.wasm.d.ts +7 -7
- package/package.json +5 -2
|
@@ -9,9 +9,9 @@ export enum KnownTypeId {
|
|
|
9
9
|
*/
|
|
10
10
|
Transaction = 0,
|
|
11
11
|
/**
|
|
12
|
-
* The type id of the
|
|
12
|
+
* The type id of the transaction signing payload.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
TransactionSigningPayload = 1,
|
|
15
15
|
/**
|
|
16
16
|
* The type id of the runtime call.
|
|
17
17
|
*/
|
|
@@ -25,24 +25,28 @@ export enum KnownTypeId {
|
|
|
25
25
|
export class Schema {
|
|
26
26
|
private constructor();
|
|
27
27
|
free(): void;
|
|
28
|
-
|
|
29
|
-
* Creates a `Schema` instance from the provided JSON descriptor.
|
|
30
|
-
*/
|
|
31
|
-
static fromJSON(json: string): Schema;
|
|
28
|
+
eip712Json(type_index: number, input: Uint8Array): string;
|
|
32
29
|
/**
|
|
33
30
|
* Converts the provided JSON to borsh according to the provided schema.
|
|
34
31
|
*/
|
|
35
32
|
jsonToBorsh(type_index: number, input: string): Uint8Array;
|
|
33
|
+
/**
|
|
34
|
+
* Get the index of the provided known type within the schema.
|
|
35
|
+
*/
|
|
36
|
+
knownTypeIndex(known_type_id: KnownTypeId): number;
|
|
37
|
+
eip712SigningHash(type_index: number, input: Uint8Array): Uint8Array;
|
|
36
38
|
/**
|
|
37
39
|
* Displays the provided borsh bytes as a string according to the provided schema.
|
|
38
40
|
*/
|
|
39
41
|
display(type_index: number, input: Uint8Array): string;
|
|
40
42
|
/**
|
|
41
|
-
*
|
|
43
|
+
* Creates a `Schema` instance from the provided JSON descriptor.
|
|
42
44
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
static fromJSON(json: string): Schema;
|
|
46
|
+
/**
|
|
47
|
+
* Get the chain hash from the schema.
|
|
48
|
+
*/
|
|
49
|
+
readonly chainHash: Uint8Array;
|
|
46
50
|
/**
|
|
47
51
|
* Returns the JSON descriptor that was used to create this schema instance.
|
|
48
52
|
*/
|
|
@@ -51,8 +55,4 @@ export class Schema {
|
|
|
51
55
|
* Get the metadata hash from the schema.
|
|
52
56
|
*/
|
|
53
57
|
readonly metadataHash: Uint8Array;
|
|
54
|
-
/**
|
|
55
|
-
* Get the chain hash from the schema.
|
|
56
|
-
*/
|
|
57
|
-
readonly chainHash: Uint8Array;
|
|
58
58
|
}
|
|
@@ -24,8 +24,26 @@ function getStringFromWasm0(ptr, len) {
|
|
|
24
24
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
function takeFromExternrefTable0(idx) {
|
|
28
|
+
const value = wasm.__wbindgen_export_0.get(idx);
|
|
29
|
+
wasm.__externref_table_dealloc(idx);
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
34
|
+
ptr = ptr >>> 0;
|
|
35
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
let WASM_VECTOR_LEN = 0;
|
|
28
39
|
|
|
40
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
41
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
42
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
43
|
+
WASM_VECTOR_LEN = arg.length;
|
|
44
|
+
return ptr;
|
|
45
|
+
}
|
|
46
|
+
|
|
29
47
|
const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
|
|
30
48
|
|
|
31
49
|
let cachedTextEncoder = new lTextEncoder('utf-8');
|
|
@@ -81,24 +99,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
81
99
|
WASM_VECTOR_LEN = offset;
|
|
82
100
|
return ptr;
|
|
83
101
|
}
|
|
84
|
-
|
|
85
|
-
function takeFromExternrefTable0(idx) {
|
|
86
|
-
const value = wasm.__wbindgen_export_0.get(idx);
|
|
87
|
-
wasm.__externref_table_dealloc(idx);
|
|
88
|
-
return value;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
92
|
-
ptr = ptr >>> 0;
|
|
93
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
97
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
98
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
99
|
-
WASM_VECTOR_LEN = arg.length;
|
|
100
|
-
return ptr;
|
|
101
|
-
}
|
|
102
102
|
/**
|
|
103
103
|
* Well-known ids of types utilized in the rollup.
|
|
104
104
|
* @enum {0 | 1 | 2}
|
|
@@ -109,9 +109,9 @@ export const KnownTypeId = Object.freeze({
|
|
|
109
109
|
*/
|
|
110
110
|
Transaction: 0, "0": "Transaction",
|
|
111
111
|
/**
|
|
112
|
-
* The type id of the
|
|
112
|
+
* The type id of the transaction signing payload.
|
|
113
113
|
*/
|
|
114
|
-
|
|
114
|
+
TransactionSigningPayload: 1, "1": "TransactionSigningPayload",
|
|
115
115
|
/**
|
|
116
116
|
* The type id of the runtime call.
|
|
117
117
|
*/
|
|
@@ -148,18 +148,17 @@ export class Schema {
|
|
|
148
148
|
wasm.__wbg_schema_free(ptr, 0);
|
|
149
149
|
}
|
|
150
150
|
/**
|
|
151
|
-
*
|
|
152
|
-
* @
|
|
153
|
-
* @returns {Schema}
|
|
151
|
+
* Get the chain hash from the schema.
|
|
152
|
+
* @returns {Uint8Array}
|
|
154
153
|
*/
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if (ret[2]) {
|
|
160
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
154
|
+
get chainHash() {
|
|
155
|
+
const ret = wasm.schema_chainHash(this.__wbg_ptr);
|
|
156
|
+
if (ret[3]) {
|
|
157
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
161
158
|
}
|
|
162
|
-
|
|
159
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
160
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
161
|
+
return v1;
|
|
163
162
|
}
|
|
164
163
|
/**
|
|
165
164
|
* Returns the JSON descriptor that was used to create this schema instance.
|
|
@@ -178,35 +177,17 @@ export class Schema {
|
|
|
178
177
|
}
|
|
179
178
|
}
|
|
180
179
|
/**
|
|
181
|
-
* Converts the provided JSON to borsh according to the provided schema.
|
|
182
|
-
* @param {number} type_index
|
|
183
|
-
* @param {string} input
|
|
184
|
-
* @returns {Uint8Array}
|
|
185
|
-
*/
|
|
186
|
-
jsonToBorsh(type_index, input) {
|
|
187
|
-
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
188
|
-
const len0 = WASM_VECTOR_LEN;
|
|
189
|
-
const ret = wasm.schema_jsonToBorsh(this.__wbg_ptr, type_index, ptr0, len0);
|
|
190
|
-
if (ret[3]) {
|
|
191
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
192
|
-
}
|
|
193
|
-
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
194
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
195
|
-
return v2;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Displays the provided borsh bytes as a string according to the provided schema.
|
|
199
180
|
* @param {number} type_index
|
|
200
181
|
* @param {Uint8Array} input
|
|
201
182
|
* @returns {string}
|
|
202
183
|
*/
|
|
203
|
-
|
|
184
|
+
eip712Json(type_index, input) {
|
|
204
185
|
let deferred3_0;
|
|
205
186
|
let deferred3_1;
|
|
206
187
|
try {
|
|
207
188
|
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
|
|
208
189
|
const len0 = WASM_VECTOR_LEN;
|
|
209
|
-
const ret = wasm.
|
|
190
|
+
const ret = wasm.schema_eip712Json(this.__wbg_ptr, type_index, ptr0, len0);
|
|
210
191
|
var ptr2 = ret[0];
|
|
211
192
|
var len2 = ret[1];
|
|
212
193
|
if (ret[3]) {
|
|
@@ -221,16 +202,21 @@ export class Schema {
|
|
|
221
202
|
}
|
|
222
203
|
}
|
|
223
204
|
/**
|
|
224
|
-
*
|
|
225
|
-
* @param {
|
|
226
|
-
* @
|
|
205
|
+
* Converts the provided JSON to borsh according to the provided schema.
|
|
206
|
+
* @param {number} type_index
|
|
207
|
+
* @param {string} input
|
|
208
|
+
* @returns {Uint8Array}
|
|
227
209
|
*/
|
|
228
|
-
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
210
|
+
jsonToBorsh(type_index, input) {
|
|
211
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
212
|
+
const len0 = WASM_VECTOR_LEN;
|
|
213
|
+
const ret = wasm.schema_jsonToBorsh(this.__wbg_ptr, type_index, ptr0, len0);
|
|
214
|
+
if (ret[3]) {
|
|
215
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
232
216
|
}
|
|
233
|
-
|
|
217
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
218
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
219
|
+
return v2;
|
|
234
220
|
}
|
|
235
221
|
/**
|
|
236
222
|
* Get the metadata hash from the schema.
|
|
@@ -246,30 +232,46 @@ export class Schema {
|
|
|
246
232
|
return v1;
|
|
247
233
|
}
|
|
248
234
|
/**
|
|
249
|
-
* Get the
|
|
235
|
+
* Get the index of the provided known type within the schema.
|
|
236
|
+
* @param {KnownTypeId} known_type_id
|
|
237
|
+
* @returns {number}
|
|
238
|
+
*/
|
|
239
|
+
knownTypeIndex(known_type_id) {
|
|
240
|
+
const ret = wasm.schema_knownTypeIndex(this.__wbg_ptr, known_type_id);
|
|
241
|
+
if (ret[2]) {
|
|
242
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
243
|
+
}
|
|
244
|
+
return ret[0] >>> 0;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* @param {number} type_index
|
|
248
|
+
* @param {Uint8Array} input
|
|
250
249
|
* @returns {Uint8Array}
|
|
251
250
|
*/
|
|
252
|
-
|
|
253
|
-
const
|
|
251
|
+
eip712SigningHash(type_index, input) {
|
|
252
|
+
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
|
|
253
|
+
const len0 = WASM_VECTOR_LEN;
|
|
254
|
+
const ret = wasm.schema_eip712SigningHash(this.__wbg_ptr, type_index, ptr0, len0);
|
|
254
255
|
if (ret[3]) {
|
|
255
256
|
throw takeFromExternrefTable0(ret[2]);
|
|
256
257
|
}
|
|
257
|
-
var
|
|
258
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
258
259
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
259
|
-
return
|
|
260
|
+
return v2;
|
|
260
261
|
}
|
|
261
262
|
/**
|
|
263
|
+
* Displays the provided borsh bytes as a string according to the provided schema.
|
|
262
264
|
* @param {number} type_index
|
|
263
265
|
* @param {Uint8Array} input
|
|
264
266
|
* @returns {string}
|
|
265
267
|
*/
|
|
266
|
-
|
|
268
|
+
display(type_index, input) {
|
|
267
269
|
let deferred3_0;
|
|
268
270
|
let deferred3_1;
|
|
269
271
|
try {
|
|
270
272
|
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
|
|
271
273
|
const len0 = WASM_VECTOR_LEN;
|
|
272
|
-
const ret = wasm.
|
|
274
|
+
const ret = wasm.schema_display(this.__wbg_ptr, type_index, ptr0, len0);
|
|
273
275
|
var ptr2 = ret[0];
|
|
274
276
|
var len2 = ret[1];
|
|
275
277
|
if (ret[3]) {
|
|
@@ -284,20 +286,18 @@ export class Schema {
|
|
|
284
286
|
}
|
|
285
287
|
}
|
|
286
288
|
/**
|
|
287
|
-
*
|
|
288
|
-
* @param {
|
|
289
|
-
* @returns {
|
|
289
|
+
* Creates a `Schema` instance from the provided JSON descriptor.
|
|
290
|
+
* @param {string} json
|
|
291
|
+
* @returns {Schema}
|
|
290
292
|
*/
|
|
291
|
-
|
|
292
|
-
const ptr0 =
|
|
293
|
+
static fromJSON(json) {
|
|
294
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
293
295
|
const len0 = WASM_VECTOR_LEN;
|
|
294
|
-
const ret = wasm.
|
|
295
|
-
if (ret[
|
|
296
|
-
throw takeFromExternrefTable0(ret[
|
|
296
|
+
const ret = wasm.schema_fromJSON(ptr0, len0);
|
|
297
|
+
if (ret[2]) {
|
|
298
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
297
299
|
}
|
|
298
|
-
|
|
299
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
300
|
-
return v2;
|
|
300
|
+
return Schema.__wrap(ret[0]);
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
|
|
Binary file
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const __wbg_schema_free: (a: number, b: number) => void;
|
|
5
|
-
export const
|
|
5
|
+
export const schema_chainHash: (a: number) => [number, number, number, number];
|
|
6
6
|
export const schema_descriptor: (a: number) => [number, number];
|
|
7
|
-
export const schema_jsonToBorsh: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
8
7
|
export const schema_display: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
9
|
-
export const schema_knownTypeIndex: (a: number, b: number) => [number, number, number];
|
|
10
|
-
export const schema_metadataHash: (a: number) => [number, number, number, number];
|
|
11
|
-
export const schema_chainHash: (a: number) => [number, number, number, number];
|
|
12
8
|
export const schema_eip712Json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
13
9
|
export const schema_eip712SigningHash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
10
|
+
export const schema_fromJSON: (a: number, b: number) => [number, number, number];
|
|
11
|
+
export const schema_jsonToBorsh: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
12
|
+
export const schema_knownTypeIndex: (a: number, b: number) => [number, number, number];
|
|
13
|
+
export const schema_metadataHash: (a: number) => [number, number, number, number];
|
|
14
14
|
export const __wbindgen_export_0: WebAssembly.Table;
|
|
15
|
-
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
16
|
-
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
17
15
|
export const __externref_table_dealloc: (a: number) => void;
|
|
18
16
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
17
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
18
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
19
19
|
export const __wbindgen_start: () => void;
|
|
@@ -9,9 +9,9 @@ export enum KnownTypeId {
|
|
|
9
9
|
*/
|
|
10
10
|
Transaction = 0,
|
|
11
11
|
/**
|
|
12
|
-
* The type id of the
|
|
12
|
+
* The type id of the transaction signing payload.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
TransactionSigningPayload = 1,
|
|
15
15
|
/**
|
|
16
16
|
* The type id of the runtime call.
|
|
17
17
|
*/
|
|
@@ -25,24 +25,28 @@ export enum KnownTypeId {
|
|
|
25
25
|
export class Schema {
|
|
26
26
|
private constructor();
|
|
27
27
|
free(): void;
|
|
28
|
-
|
|
29
|
-
* Creates a `Schema` instance from the provided JSON descriptor.
|
|
30
|
-
*/
|
|
31
|
-
static fromJSON(json: string): Schema;
|
|
28
|
+
eip712Json(type_index: number, input: Uint8Array): string;
|
|
32
29
|
/**
|
|
33
30
|
* Converts the provided JSON to borsh according to the provided schema.
|
|
34
31
|
*/
|
|
35
32
|
jsonToBorsh(type_index: number, input: string): Uint8Array;
|
|
33
|
+
/**
|
|
34
|
+
* Get the index of the provided known type within the schema.
|
|
35
|
+
*/
|
|
36
|
+
knownTypeIndex(known_type_id: KnownTypeId): number;
|
|
37
|
+
eip712SigningHash(type_index: number, input: Uint8Array): Uint8Array;
|
|
36
38
|
/**
|
|
37
39
|
* Displays the provided borsh bytes as a string according to the provided schema.
|
|
38
40
|
*/
|
|
39
41
|
display(type_index: number, input: Uint8Array): string;
|
|
40
42
|
/**
|
|
41
|
-
*
|
|
43
|
+
* Creates a `Schema` instance from the provided JSON descriptor.
|
|
42
44
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
static fromJSON(json: string): Schema;
|
|
46
|
+
/**
|
|
47
|
+
* Get the chain hash from the schema.
|
|
48
|
+
*/
|
|
49
|
+
readonly chainHash: Uint8Array;
|
|
46
50
|
/**
|
|
47
51
|
* Returns the JSON descriptor that was used to create this schema instance.
|
|
48
52
|
*/
|
|
@@ -51,8 +55,4 @@ export class Schema {
|
|
|
51
55
|
* Get the metadata hash from the schema.
|
|
52
56
|
*/
|
|
53
57
|
readonly metadataHash: Uint8Array;
|
|
54
|
-
/**
|
|
55
|
-
* Get the chain hash from the schema.
|
|
56
|
-
*/
|
|
57
|
-
readonly chainHash: Uint8Array;
|
|
58
58
|
}
|
package/dist/node/wallet_wasm.js
CHANGED
|
@@ -22,8 +22,26 @@ function getStringFromWasm0(ptr, len) {
|
|
|
22
22
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
function takeFromExternrefTable0(idx) {
|
|
26
|
+
const value = wasm.__wbindgen_export_0.get(idx);
|
|
27
|
+
wasm.__externref_table_dealloc(idx);
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
32
|
+
ptr = ptr >>> 0;
|
|
33
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
34
|
+
}
|
|
35
|
+
|
|
25
36
|
let WASM_VECTOR_LEN = 0;
|
|
26
37
|
|
|
38
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
39
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
40
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
41
|
+
WASM_VECTOR_LEN = arg.length;
|
|
42
|
+
return ptr;
|
|
43
|
+
}
|
|
44
|
+
|
|
27
45
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
28
46
|
|
|
29
47
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
@@ -77,24 +95,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
77
95
|
WASM_VECTOR_LEN = offset;
|
|
78
96
|
return ptr;
|
|
79
97
|
}
|
|
80
|
-
|
|
81
|
-
function takeFromExternrefTable0(idx) {
|
|
82
|
-
const value = wasm.__wbindgen_export_0.get(idx);
|
|
83
|
-
wasm.__externref_table_dealloc(idx);
|
|
84
|
-
return value;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
88
|
-
ptr = ptr >>> 0;
|
|
89
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
93
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
94
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
95
|
-
WASM_VECTOR_LEN = arg.length;
|
|
96
|
-
return ptr;
|
|
97
|
-
}
|
|
98
98
|
/**
|
|
99
99
|
* Well-known ids of types utilized in the rollup.
|
|
100
100
|
* @enum {0 | 1 | 2}
|
|
@@ -105,9 +105,9 @@ module.exports.KnownTypeId = Object.freeze({
|
|
|
105
105
|
*/
|
|
106
106
|
Transaction: 0, "0": "Transaction",
|
|
107
107
|
/**
|
|
108
|
-
* The type id of the
|
|
108
|
+
* The type id of the transaction signing payload.
|
|
109
109
|
*/
|
|
110
|
-
|
|
110
|
+
TransactionSigningPayload: 1, "1": "TransactionSigningPayload",
|
|
111
111
|
/**
|
|
112
112
|
* The type id of the runtime call.
|
|
113
113
|
*/
|
|
@@ -144,18 +144,17 @@ class Schema {
|
|
|
144
144
|
wasm.__wbg_schema_free(ptr, 0);
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
147
|
-
*
|
|
148
|
-
* @
|
|
149
|
-
* @returns {Schema}
|
|
147
|
+
* Get the chain hash from the schema.
|
|
148
|
+
* @returns {Uint8Array}
|
|
150
149
|
*/
|
|
151
|
-
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (ret[2]) {
|
|
156
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
150
|
+
get chainHash() {
|
|
151
|
+
const ret = wasm.schema_chainHash(this.__wbg_ptr);
|
|
152
|
+
if (ret[3]) {
|
|
153
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
157
154
|
}
|
|
158
|
-
|
|
155
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
156
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
157
|
+
return v1;
|
|
159
158
|
}
|
|
160
159
|
/**
|
|
161
160
|
* Returns the JSON descriptor that was used to create this schema instance.
|
|
@@ -174,35 +173,17 @@ class Schema {
|
|
|
174
173
|
}
|
|
175
174
|
}
|
|
176
175
|
/**
|
|
177
|
-
* Converts the provided JSON to borsh according to the provided schema.
|
|
178
|
-
* @param {number} type_index
|
|
179
|
-
* @param {string} input
|
|
180
|
-
* @returns {Uint8Array}
|
|
181
|
-
*/
|
|
182
|
-
jsonToBorsh(type_index, input) {
|
|
183
|
-
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
184
|
-
const len0 = WASM_VECTOR_LEN;
|
|
185
|
-
const ret = wasm.schema_jsonToBorsh(this.__wbg_ptr, type_index, ptr0, len0);
|
|
186
|
-
if (ret[3]) {
|
|
187
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
188
|
-
}
|
|
189
|
-
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
190
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
191
|
-
return v2;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Displays the provided borsh bytes as a string according to the provided schema.
|
|
195
176
|
* @param {number} type_index
|
|
196
177
|
* @param {Uint8Array} input
|
|
197
178
|
* @returns {string}
|
|
198
179
|
*/
|
|
199
|
-
|
|
180
|
+
eip712Json(type_index, input) {
|
|
200
181
|
let deferred3_0;
|
|
201
182
|
let deferred3_1;
|
|
202
183
|
try {
|
|
203
184
|
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
|
|
204
185
|
const len0 = WASM_VECTOR_LEN;
|
|
205
|
-
const ret = wasm.
|
|
186
|
+
const ret = wasm.schema_eip712Json(this.__wbg_ptr, type_index, ptr0, len0);
|
|
206
187
|
var ptr2 = ret[0];
|
|
207
188
|
var len2 = ret[1];
|
|
208
189
|
if (ret[3]) {
|
|
@@ -217,16 +198,21 @@ class Schema {
|
|
|
217
198
|
}
|
|
218
199
|
}
|
|
219
200
|
/**
|
|
220
|
-
*
|
|
221
|
-
* @param {
|
|
222
|
-
* @
|
|
201
|
+
* Converts the provided JSON to borsh according to the provided schema.
|
|
202
|
+
* @param {number} type_index
|
|
203
|
+
* @param {string} input
|
|
204
|
+
* @returns {Uint8Array}
|
|
223
205
|
*/
|
|
224
|
-
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
206
|
+
jsonToBorsh(type_index, input) {
|
|
207
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
208
|
+
const len0 = WASM_VECTOR_LEN;
|
|
209
|
+
const ret = wasm.schema_jsonToBorsh(this.__wbg_ptr, type_index, ptr0, len0);
|
|
210
|
+
if (ret[3]) {
|
|
211
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
228
212
|
}
|
|
229
|
-
|
|
213
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
214
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
215
|
+
return v2;
|
|
230
216
|
}
|
|
231
217
|
/**
|
|
232
218
|
* Get the metadata hash from the schema.
|
|
@@ -242,30 +228,46 @@ class Schema {
|
|
|
242
228
|
return v1;
|
|
243
229
|
}
|
|
244
230
|
/**
|
|
245
|
-
* Get the
|
|
231
|
+
* Get the index of the provided known type within the schema.
|
|
232
|
+
* @param {KnownTypeId} known_type_id
|
|
233
|
+
* @returns {number}
|
|
234
|
+
*/
|
|
235
|
+
knownTypeIndex(known_type_id) {
|
|
236
|
+
const ret = wasm.schema_knownTypeIndex(this.__wbg_ptr, known_type_id);
|
|
237
|
+
if (ret[2]) {
|
|
238
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
239
|
+
}
|
|
240
|
+
return ret[0] >>> 0;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* @param {number} type_index
|
|
244
|
+
* @param {Uint8Array} input
|
|
246
245
|
* @returns {Uint8Array}
|
|
247
246
|
*/
|
|
248
|
-
|
|
249
|
-
const
|
|
247
|
+
eip712SigningHash(type_index, input) {
|
|
248
|
+
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
|
|
249
|
+
const len0 = WASM_VECTOR_LEN;
|
|
250
|
+
const ret = wasm.schema_eip712SigningHash(this.__wbg_ptr, type_index, ptr0, len0);
|
|
250
251
|
if (ret[3]) {
|
|
251
252
|
throw takeFromExternrefTable0(ret[2]);
|
|
252
253
|
}
|
|
253
|
-
var
|
|
254
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
254
255
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
255
|
-
return
|
|
256
|
+
return v2;
|
|
256
257
|
}
|
|
257
258
|
/**
|
|
259
|
+
* Displays the provided borsh bytes as a string according to the provided schema.
|
|
258
260
|
* @param {number} type_index
|
|
259
261
|
* @param {Uint8Array} input
|
|
260
262
|
* @returns {string}
|
|
261
263
|
*/
|
|
262
|
-
|
|
264
|
+
display(type_index, input) {
|
|
263
265
|
let deferred3_0;
|
|
264
266
|
let deferred3_1;
|
|
265
267
|
try {
|
|
266
268
|
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
|
|
267
269
|
const len0 = WASM_VECTOR_LEN;
|
|
268
|
-
const ret = wasm.
|
|
270
|
+
const ret = wasm.schema_display(this.__wbg_ptr, type_index, ptr0, len0);
|
|
269
271
|
var ptr2 = ret[0];
|
|
270
272
|
var len2 = ret[1];
|
|
271
273
|
if (ret[3]) {
|
|
@@ -280,20 +282,18 @@ class Schema {
|
|
|
280
282
|
}
|
|
281
283
|
}
|
|
282
284
|
/**
|
|
283
|
-
*
|
|
284
|
-
* @param {
|
|
285
|
-
* @returns {
|
|
285
|
+
* Creates a `Schema` instance from the provided JSON descriptor.
|
|
286
|
+
* @param {string} json
|
|
287
|
+
* @returns {Schema}
|
|
286
288
|
*/
|
|
287
|
-
|
|
288
|
-
const ptr0 =
|
|
289
|
+
static fromJSON(json) {
|
|
290
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
289
291
|
const len0 = WASM_VECTOR_LEN;
|
|
290
|
-
const ret = wasm.
|
|
291
|
-
if (ret[
|
|
292
|
-
throw takeFromExternrefTable0(ret[
|
|
292
|
+
const ret = wasm.schema_fromJSON(ptr0, len0);
|
|
293
|
+
if (ret[2]) {
|
|
294
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
293
295
|
}
|
|
294
|
-
|
|
295
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
296
|
-
return v2;
|
|
296
|
+
return Schema.__wrap(ret[0]);
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
module.exports.Schema = Schema;
|
|
Binary file
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const __wbg_schema_free: (a: number, b: number) => void;
|
|
5
|
-
export const
|
|
5
|
+
export const schema_chainHash: (a: number) => [number, number, number, number];
|
|
6
6
|
export const schema_descriptor: (a: number) => [number, number];
|
|
7
|
-
export const schema_jsonToBorsh: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
8
7
|
export const schema_display: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
9
|
-
export const schema_knownTypeIndex: (a: number, b: number) => [number, number, number];
|
|
10
|
-
export const schema_metadataHash: (a: number) => [number, number, number, number];
|
|
11
|
-
export const schema_chainHash: (a: number) => [number, number, number, number];
|
|
12
8
|
export const schema_eip712Json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
13
9
|
export const schema_eip712SigningHash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
10
|
+
export const schema_fromJSON: (a: number, b: number) => [number, number, number];
|
|
11
|
+
export const schema_jsonToBorsh: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
12
|
+
export const schema_knownTypeIndex: (a: number, b: number) => [number, number, number];
|
|
13
|
+
export const schema_metadataHash: (a: number) => [number, number, number, number];
|
|
14
14
|
export const __wbindgen_export_0: WebAssembly.Table;
|
|
15
|
-
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
16
|
-
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
17
15
|
export const __externref_table_dealloc: (a: number) => void;
|
|
18
16
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
17
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
18
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
19
19
|
export const __wbindgen_start: () => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sovereign-sdk/universal-wallet-wasm",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"repository":
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/Sovereign-Labs/sovereign-sdk.git"
|
|
7
|
+
},
|
|
5
8
|
"files": [
|
|
6
9
|
"dist/**/*",
|
|
7
10
|
"!dist/**/.gitignore",
|