bulk-keychain-wasm 0.1.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/bulk_keychain_wasm.d.ts +175 -0
- package/bulk_keychain_wasm.js +940 -0
- package/bulk_keychain_wasm_bg.wasm +0 -0
- package/package.json +20 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class WasmKeypair {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
/**
|
|
8
|
+
* Create from raw bytes (32-byte secret or 64-byte full keypair)
|
|
9
|
+
*/
|
|
10
|
+
static fromBytes(bytes: Uint8Array): WasmKeypair;
|
|
11
|
+
/**
|
|
12
|
+
* Get the secret key as bytes (32 bytes)
|
|
13
|
+
*/
|
|
14
|
+
secretKey(): Uint8Array;
|
|
15
|
+
/**
|
|
16
|
+
* Create from base58-encoded secret key or full keypair
|
|
17
|
+
*/
|
|
18
|
+
static fromBase58(s: string): WasmKeypair;
|
|
19
|
+
/**
|
|
20
|
+
* Generate a new random keypair
|
|
21
|
+
*/
|
|
22
|
+
constructor();
|
|
23
|
+
/**
|
|
24
|
+
* Get the full keypair as bytes (64 bytes)
|
|
25
|
+
*/
|
|
26
|
+
toBytes(): Uint8Array;
|
|
27
|
+
/**
|
|
28
|
+
* Get the full keypair as base58 (64 bytes)
|
|
29
|
+
*/
|
|
30
|
+
toBase58(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Get the public key as base58 string
|
|
33
|
+
*/
|
|
34
|
+
readonly pubkey: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class WasmSigner {
|
|
38
|
+
free(): void;
|
|
39
|
+
[Symbol.dispose](): void;
|
|
40
|
+
/**
|
|
41
|
+
* Sign multiple orders atomically in ONE transaction
|
|
42
|
+
*/
|
|
43
|
+
signGroup(orders: any, nonce?: number | null): any;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Use sign(), signAll(), or signGroup() instead
|
|
46
|
+
*/
|
|
47
|
+
signOrder(orders: any, nonce?: number | null): any;
|
|
48
|
+
/**
|
|
49
|
+
* Create a signer from base58-encoded secret key
|
|
50
|
+
*/
|
|
51
|
+
static fromBase58(s: string): WasmSigner;
|
|
52
|
+
/**
|
|
53
|
+
* Sign a faucet request (testnet only)
|
|
54
|
+
*/
|
|
55
|
+
signFaucet(nonce?: number | null): any;
|
|
56
|
+
/**
|
|
57
|
+
* Sign agent wallet creation/deletion
|
|
58
|
+
*/
|
|
59
|
+
signAgentWallet(agent_pubkey: string, _delete: boolean, nonce?: number | null): any;
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated Use signAll() instead
|
|
62
|
+
*/
|
|
63
|
+
signOrdersBatch(batches: any, base_nonce?: number | null): any;
|
|
64
|
+
/**
|
|
65
|
+
* Sign user settings update
|
|
66
|
+
*/
|
|
67
|
+
signUserSettings(settings: any, nonce?: number | null): any;
|
|
68
|
+
/**
|
|
69
|
+
* Create a signer with nonce management
|
|
70
|
+
*/
|
|
71
|
+
static withNonceManager(keypair: WasmKeypair, strategy: string): WasmSigner;
|
|
72
|
+
/**
|
|
73
|
+
* Create a new signer from a keypair
|
|
74
|
+
*/
|
|
75
|
+
constructor(keypair: WasmKeypair);
|
|
76
|
+
/**
|
|
77
|
+
* Sign a single order/cancel/cancelAll
|
|
78
|
+
*/
|
|
79
|
+
sign(order: any, nonce?: number | null): any;
|
|
80
|
+
/**
|
|
81
|
+
* Sign multiple orders - each becomes its own transaction (parallel)
|
|
82
|
+
*/
|
|
83
|
+
signAll(orders: any, base_nonce?: number | null): any;
|
|
84
|
+
/**
|
|
85
|
+
* Get the signer's public key
|
|
86
|
+
*/
|
|
87
|
+
readonly pubkey: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Get current timestamp in milliseconds
|
|
92
|
+
*/
|
|
93
|
+
export function currentTimestamp(): number;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Initialize the WASM module
|
|
97
|
+
*/
|
|
98
|
+
export function init(): void;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Generate a random hash (for client order IDs)
|
|
102
|
+
*/
|
|
103
|
+
export function randomHash(): string;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Validate a base58-encoded hash
|
|
107
|
+
*/
|
|
108
|
+
export function validateHash(s: string): boolean;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Validate a base58-encoded public key
|
|
112
|
+
*/
|
|
113
|
+
export function validatePubkey(s: string): boolean;
|
|
114
|
+
|
|
115
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
116
|
+
|
|
117
|
+
export interface InitOutput {
|
|
118
|
+
readonly memory: WebAssembly.Memory;
|
|
119
|
+
readonly __wbg_wasmkeypair_free: (a: number, b: number) => void;
|
|
120
|
+
readonly __wbg_wasmsigner_free: (a: number, b: number) => void;
|
|
121
|
+
readonly currentTimestamp: () => number;
|
|
122
|
+
readonly randomHash: () => [number, number];
|
|
123
|
+
readonly validateHash: (a: number, b: number) => number;
|
|
124
|
+
readonly validatePubkey: (a: number, b: number) => number;
|
|
125
|
+
readonly wasmkeypair_fromBase58: (a: number, b: number) => [number, number, number];
|
|
126
|
+
readonly wasmkeypair_fromBytes: (a: number, b: number) => [number, number, number];
|
|
127
|
+
readonly wasmkeypair_new: () => number;
|
|
128
|
+
readonly wasmkeypair_pubkey: (a: number) => [number, number];
|
|
129
|
+
readonly wasmkeypair_secretKey: (a: number) => [number, number];
|
|
130
|
+
readonly wasmkeypair_toBase58: (a: number) => [number, number];
|
|
131
|
+
readonly wasmkeypair_toBytes: (a: number) => [number, number];
|
|
132
|
+
readonly wasmsigner_fromBase58: (a: number, b: number) => [number, number, number];
|
|
133
|
+
readonly wasmsigner_new: (a: number) => number;
|
|
134
|
+
readonly wasmsigner_pubkey: (a: number) => [number, number];
|
|
135
|
+
readonly wasmsigner_sign: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
136
|
+
readonly wasmsigner_signAgentWallet: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
137
|
+
readonly wasmsigner_signAll: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
138
|
+
readonly wasmsigner_signFaucet: (a: number, b: number, c: number) => [number, number, number];
|
|
139
|
+
readonly wasmsigner_signGroup: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
140
|
+
readonly wasmsigner_signOrdersBatch: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
141
|
+
readonly wasmsigner_signUserSettings: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
142
|
+
readonly wasmsigner_withNonceManager: (a: number, b: number, c: number) => [number, number, number];
|
|
143
|
+
readonly init: () => void;
|
|
144
|
+
readonly wasmsigner_signOrder: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
145
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
146
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
147
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
148
|
+
readonly __externref_table_alloc: () => number;
|
|
149
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
150
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
151
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
152
|
+
readonly __wbindgen_start: () => void;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
159
|
+
* a precompiled `WebAssembly.Module`.
|
|
160
|
+
*
|
|
161
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
162
|
+
*
|
|
163
|
+
* @returns {InitOutput}
|
|
164
|
+
*/
|
|
165
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
169
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
170
|
+
*
|
|
171
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
172
|
+
*
|
|
173
|
+
* @returns {Promise<InitOutput>}
|
|
174
|
+
*/
|
|
175
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,940 @@
|
|
|
1
|
+
let wasm;
|
|
2
|
+
|
|
3
|
+
function addToExternrefTable0(obj) {
|
|
4
|
+
const idx = wasm.__externref_table_alloc();
|
|
5
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
6
|
+
return idx;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function _assertClass(instance, klass) {
|
|
10
|
+
if (!(instance instanceof klass)) {
|
|
11
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function debugString(val) {
|
|
16
|
+
// primitive types
|
|
17
|
+
const type = typeof val;
|
|
18
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
19
|
+
return `${val}`;
|
|
20
|
+
}
|
|
21
|
+
if (type == 'string') {
|
|
22
|
+
return `"${val}"`;
|
|
23
|
+
}
|
|
24
|
+
if (type == 'symbol') {
|
|
25
|
+
const description = val.description;
|
|
26
|
+
if (description == null) {
|
|
27
|
+
return 'Symbol';
|
|
28
|
+
} else {
|
|
29
|
+
return `Symbol(${description})`;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (type == 'function') {
|
|
33
|
+
const name = val.name;
|
|
34
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
35
|
+
return `Function(${name})`;
|
|
36
|
+
} else {
|
|
37
|
+
return 'Function';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// objects
|
|
41
|
+
if (Array.isArray(val)) {
|
|
42
|
+
const length = val.length;
|
|
43
|
+
let debug = '[';
|
|
44
|
+
if (length > 0) {
|
|
45
|
+
debug += debugString(val[0]);
|
|
46
|
+
}
|
|
47
|
+
for(let i = 1; i < length; i++) {
|
|
48
|
+
debug += ', ' + debugString(val[i]);
|
|
49
|
+
}
|
|
50
|
+
debug += ']';
|
|
51
|
+
return debug;
|
|
52
|
+
}
|
|
53
|
+
// Test for built-in
|
|
54
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
55
|
+
let className;
|
|
56
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
57
|
+
className = builtInMatches[1];
|
|
58
|
+
} else {
|
|
59
|
+
// Failed to match the standard '[object ClassName]'
|
|
60
|
+
return toString.call(val);
|
|
61
|
+
}
|
|
62
|
+
if (className == 'Object') {
|
|
63
|
+
// we're a user defined class or Object
|
|
64
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
65
|
+
// easier than looping through ownProperties of `val`.
|
|
66
|
+
try {
|
|
67
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
68
|
+
} catch (_) {
|
|
69
|
+
return 'Object';
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// errors
|
|
73
|
+
if (val instanceof Error) {
|
|
74
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
75
|
+
}
|
|
76
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
77
|
+
return className;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
81
|
+
ptr = ptr >>> 0;
|
|
82
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let cachedDataViewMemory0 = null;
|
|
86
|
+
function getDataViewMemory0() {
|
|
87
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
88
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
89
|
+
}
|
|
90
|
+
return cachedDataViewMemory0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function getStringFromWasm0(ptr, len) {
|
|
94
|
+
ptr = ptr >>> 0;
|
|
95
|
+
return decodeText(ptr, len);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
let cachedUint8ArrayMemory0 = null;
|
|
99
|
+
function getUint8ArrayMemory0() {
|
|
100
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
101
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
102
|
+
}
|
|
103
|
+
return cachedUint8ArrayMemory0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function handleError(f, args) {
|
|
107
|
+
try {
|
|
108
|
+
return f.apply(this, args);
|
|
109
|
+
} catch (e) {
|
|
110
|
+
const idx = addToExternrefTable0(e);
|
|
111
|
+
wasm.__wbindgen_exn_store(idx);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function isLikeNone(x) {
|
|
116
|
+
return x === undefined || x === null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
120
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
121
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
122
|
+
WASM_VECTOR_LEN = arg.length;
|
|
123
|
+
return ptr;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
127
|
+
if (realloc === undefined) {
|
|
128
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
129
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
130
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
131
|
+
WASM_VECTOR_LEN = buf.length;
|
|
132
|
+
return ptr;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
let len = arg.length;
|
|
136
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
137
|
+
|
|
138
|
+
const mem = getUint8ArrayMemory0();
|
|
139
|
+
|
|
140
|
+
let offset = 0;
|
|
141
|
+
|
|
142
|
+
for (; offset < len; offset++) {
|
|
143
|
+
const code = arg.charCodeAt(offset);
|
|
144
|
+
if (code > 0x7F) break;
|
|
145
|
+
mem[ptr + offset] = code;
|
|
146
|
+
}
|
|
147
|
+
if (offset !== len) {
|
|
148
|
+
if (offset !== 0) {
|
|
149
|
+
arg = arg.slice(offset);
|
|
150
|
+
}
|
|
151
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
152
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
153
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
154
|
+
|
|
155
|
+
offset += ret.written;
|
|
156
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
WASM_VECTOR_LEN = offset;
|
|
160
|
+
return ptr;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function takeFromExternrefTable0(idx) {
|
|
164
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
165
|
+
wasm.__externref_table_dealloc(idx);
|
|
166
|
+
return value;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
170
|
+
cachedTextDecoder.decode();
|
|
171
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
172
|
+
let numBytesDecoded = 0;
|
|
173
|
+
function decodeText(ptr, len) {
|
|
174
|
+
numBytesDecoded += len;
|
|
175
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
176
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
177
|
+
cachedTextDecoder.decode();
|
|
178
|
+
numBytesDecoded = len;
|
|
179
|
+
}
|
|
180
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const cachedTextEncoder = new TextEncoder();
|
|
184
|
+
|
|
185
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
186
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
187
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
188
|
+
view.set(buf);
|
|
189
|
+
return {
|
|
190
|
+
read: arg.length,
|
|
191
|
+
written: buf.length
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
let WASM_VECTOR_LEN = 0;
|
|
197
|
+
|
|
198
|
+
const WasmKeypairFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
199
|
+
? { register: () => {}, unregister: () => {} }
|
|
200
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmkeypair_free(ptr >>> 0, 1));
|
|
201
|
+
|
|
202
|
+
const WasmSignerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
203
|
+
? { register: () => {}, unregister: () => {} }
|
|
204
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmsigner_free(ptr >>> 0, 1));
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* WASM wrapper for Keypair
|
|
208
|
+
*/
|
|
209
|
+
export class WasmKeypair {
|
|
210
|
+
static __wrap(ptr) {
|
|
211
|
+
ptr = ptr >>> 0;
|
|
212
|
+
const obj = Object.create(WasmKeypair.prototype);
|
|
213
|
+
obj.__wbg_ptr = ptr;
|
|
214
|
+
WasmKeypairFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
215
|
+
return obj;
|
|
216
|
+
}
|
|
217
|
+
__destroy_into_raw() {
|
|
218
|
+
const ptr = this.__wbg_ptr;
|
|
219
|
+
this.__wbg_ptr = 0;
|
|
220
|
+
WasmKeypairFinalization.unregister(this);
|
|
221
|
+
return ptr;
|
|
222
|
+
}
|
|
223
|
+
free() {
|
|
224
|
+
const ptr = this.__destroy_into_raw();
|
|
225
|
+
wasm.__wbg_wasmkeypair_free(ptr, 0);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Create from raw bytes (32-byte secret or 64-byte full keypair)
|
|
229
|
+
* @param {Uint8Array} bytes
|
|
230
|
+
* @returns {WasmKeypair}
|
|
231
|
+
*/
|
|
232
|
+
static fromBytes(bytes) {
|
|
233
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
234
|
+
const len0 = WASM_VECTOR_LEN;
|
|
235
|
+
const ret = wasm.wasmkeypair_fromBytes(ptr0, len0);
|
|
236
|
+
if (ret[2]) {
|
|
237
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
238
|
+
}
|
|
239
|
+
return WasmKeypair.__wrap(ret[0]);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Get the secret key as bytes (32 bytes)
|
|
243
|
+
* @returns {Uint8Array}
|
|
244
|
+
*/
|
|
245
|
+
secretKey() {
|
|
246
|
+
const ret = wasm.wasmkeypair_secretKey(this.__wbg_ptr);
|
|
247
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
248
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
249
|
+
return v1;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Create from base58-encoded secret key or full keypair
|
|
253
|
+
* @param {string} s
|
|
254
|
+
* @returns {WasmKeypair}
|
|
255
|
+
*/
|
|
256
|
+
static fromBase58(s) {
|
|
257
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
258
|
+
const len0 = WASM_VECTOR_LEN;
|
|
259
|
+
const ret = wasm.wasmkeypair_fromBase58(ptr0, len0);
|
|
260
|
+
if (ret[2]) {
|
|
261
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
262
|
+
}
|
|
263
|
+
return WasmKeypair.__wrap(ret[0]);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Generate a new random keypair
|
|
267
|
+
*/
|
|
268
|
+
constructor() {
|
|
269
|
+
const ret = wasm.wasmkeypair_new();
|
|
270
|
+
this.__wbg_ptr = ret >>> 0;
|
|
271
|
+
WasmKeypairFinalization.register(this, this.__wbg_ptr, this);
|
|
272
|
+
return this;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Get the public key as base58 string
|
|
276
|
+
* @returns {string}
|
|
277
|
+
*/
|
|
278
|
+
get pubkey() {
|
|
279
|
+
let deferred1_0;
|
|
280
|
+
let deferred1_1;
|
|
281
|
+
try {
|
|
282
|
+
const ret = wasm.wasmkeypair_pubkey(this.__wbg_ptr);
|
|
283
|
+
deferred1_0 = ret[0];
|
|
284
|
+
deferred1_1 = ret[1];
|
|
285
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
286
|
+
} finally {
|
|
287
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Get the full keypair as bytes (64 bytes)
|
|
292
|
+
* @returns {Uint8Array}
|
|
293
|
+
*/
|
|
294
|
+
toBytes() {
|
|
295
|
+
const ret = wasm.wasmkeypair_toBytes(this.__wbg_ptr);
|
|
296
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
297
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
298
|
+
return v1;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Get the full keypair as base58 (64 bytes)
|
|
302
|
+
* @returns {string}
|
|
303
|
+
*/
|
|
304
|
+
toBase58() {
|
|
305
|
+
let deferred1_0;
|
|
306
|
+
let deferred1_1;
|
|
307
|
+
try {
|
|
308
|
+
const ret = wasm.wasmkeypair_toBase58(this.__wbg_ptr);
|
|
309
|
+
deferred1_0 = ret[0];
|
|
310
|
+
deferred1_1 = ret[1];
|
|
311
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
312
|
+
} finally {
|
|
313
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
if (Symbol.dispose) WasmKeypair.prototype[Symbol.dispose] = WasmKeypair.prototype.free;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* WASM wrapper for Signer
|
|
321
|
+
*/
|
|
322
|
+
export class WasmSigner {
|
|
323
|
+
static __wrap(ptr) {
|
|
324
|
+
ptr = ptr >>> 0;
|
|
325
|
+
const obj = Object.create(WasmSigner.prototype);
|
|
326
|
+
obj.__wbg_ptr = ptr;
|
|
327
|
+
WasmSignerFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
328
|
+
return obj;
|
|
329
|
+
}
|
|
330
|
+
__destroy_into_raw() {
|
|
331
|
+
const ptr = this.__wbg_ptr;
|
|
332
|
+
this.__wbg_ptr = 0;
|
|
333
|
+
WasmSignerFinalization.unregister(this);
|
|
334
|
+
return ptr;
|
|
335
|
+
}
|
|
336
|
+
free() {
|
|
337
|
+
const ptr = this.__destroy_into_raw();
|
|
338
|
+
wasm.__wbg_wasmsigner_free(ptr, 0);
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Sign multiple orders atomically in ONE transaction
|
|
342
|
+
* @param {any} orders
|
|
343
|
+
* @param {number | null} [nonce]
|
|
344
|
+
* @returns {any}
|
|
345
|
+
*/
|
|
346
|
+
signGroup(orders, nonce) {
|
|
347
|
+
const ret = wasm.wasmsigner_signGroup(this.__wbg_ptr, orders, !isLikeNone(nonce), isLikeNone(nonce) ? 0 : nonce);
|
|
348
|
+
if (ret[2]) {
|
|
349
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
350
|
+
}
|
|
351
|
+
return takeFromExternrefTable0(ret[0]);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* @deprecated Use sign(), signAll(), or signGroup() instead
|
|
355
|
+
* @param {any} orders
|
|
356
|
+
* @param {number | null} [nonce]
|
|
357
|
+
* @returns {any}
|
|
358
|
+
*/
|
|
359
|
+
signOrder(orders, nonce) {
|
|
360
|
+
const ret = wasm.wasmsigner_signOrder(this.__wbg_ptr, orders, !isLikeNone(nonce), isLikeNone(nonce) ? 0 : nonce);
|
|
361
|
+
if (ret[2]) {
|
|
362
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
363
|
+
}
|
|
364
|
+
return takeFromExternrefTable0(ret[0]);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Create a signer from base58-encoded secret key
|
|
368
|
+
* @param {string} s
|
|
369
|
+
* @returns {WasmSigner}
|
|
370
|
+
*/
|
|
371
|
+
static fromBase58(s) {
|
|
372
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
373
|
+
const len0 = WASM_VECTOR_LEN;
|
|
374
|
+
const ret = wasm.wasmsigner_fromBase58(ptr0, len0);
|
|
375
|
+
if (ret[2]) {
|
|
376
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
377
|
+
}
|
|
378
|
+
return WasmSigner.__wrap(ret[0]);
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Sign a faucet request (testnet only)
|
|
382
|
+
* @param {number | null} [nonce]
|
|
383
|
+
* @returns {any}
|
|
384
|
+
*/
|
|
385
|
+
signFaucet(nonce) {
|
|
386
|
+
const ret = wasm.wasmsigner_signFaucet(this.__wbg_ptr, !isLikeNone(nonce), isLikeNone(nonce) ? 0 : nonce);
|
|
387
|
+
if (ret[2]) {
|
|
388
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
389
|
+
}
|
|
390
|
+
return takeFromExternrefTable0(ret[0]);
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Sign agent wallet creation/deletion
|
|
394
|
+
* @param {string} agent_pubkey
|
|
395
|
+
* @param {boolean} _delete
|
|
396
|
+
* @param {number | null} [nonce]
|
|
397
|
+
* @returns {any}
|
|
398
|
+
*/
|
|
399
|
+
signAgentWallet(agent_pubkey, _delete, nonce) {
|
|
400
|
+
const ptr0 = passStringToWasm0(agent_pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
401
|
+
const len0 = WASM_VECTOR_LEN;
|
|
402
|
+
const ret = wasm.wasmsigner_signAgentWallet(this.__wbg_ptr, ptr0, len0, _delete, !isLikeNone(nonce), isLikeNone(nonce) ? 0 : nonce);
|
|
403
|
+
if (ret[2]) {
|
|
404
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
405
|
+
}
|
|
406
|
+
return takeFromExternrefTable0(ret[0]);
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* @deprecated Use signAll() instead
|
|
410
|
+
* @param {any} batches
|
|
411
|
+
* @param {number | null} [base_nonce]
|
|
412
|
+
* @returns {any}
|
|
413
|
+
*/
|
|
414
|
+
signOrdersBatch(batches, base_nonce) {
|
|
415
|
+
const ret = wasm.wasmsigner_signOrdersBatch(this.__wbg_ptr, batches, !isLikeNone(base_nonce), isLikeNone(base_nonce) ? 0 : base_nonce);
|
|
416
|
+
if (ret[2]) {
|
|
417
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
418
|
+
}
|
|
419
|
+
return takeFromExternrefTable0(ret[0]);
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Sign user settings update
|
|
423
|
+
* @param {any} settings
|
|
424
|
+
* @param {number | null} [nonce]
|
|
425
|
+
* @returns {any}
|
|
426
|
+
*/
|
|
427
|
+
signUserSettings(settings, nonce) {
|
|
428
|
+
const ret = wasm.wasmsigner_signUserSettings(this.__wbg_ptr, settings, !isLikeNone(nonce), isLikeNone(nonce) ? 0 : nonce);
|
|
429
|
+
if (ret[2]) {
|
|
430
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
431
|
+
}
|
|
432
|
+
return takeFromExternrefTable0(ret[0]);
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Create a signer with nonce management
|
|
436
|
+
* @param {WasmKeypair} keypair
|
|
437
|
+
* @param {string} strategy
|
|
438
|
+
* @returns {WasmSigner}
|
|
439
|
+
*/
|
|
440
|
+
static withNonceManager(keypair, strategy) {
|
|
441
|
+
_assertClass(keypair, WasmKeypair);
|
|
442
|
+
const ptr0 = passStringToWasm0(strategy, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
443
|
+
const len0 = WASM_VECTOR_LEN;
|
|
444
|
+
const ret = wasm.wasmsigner_withNonceManager(keypair.__wbg_ptr, ptr0, len0);
|
|
445
|
+
if (ret[2]) {
|
|
446
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
447
|
+
}
|
|
448
|
+
return WasmSigner.__wrap(ret[0]);
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Create a new signer from a keypair
|
|
452
|
+
* @param {WasmKeypair} keypair
|
|
453
|
+
*/
|
|
454
|
+
constructor(keypair) {
|
|
455
|
+
_assertClass(keypair, WasmKeypair);
|
|
456
|
+
const ret = wasm.wasmsigner_new(keypair.__wbg_ptr);
|
|
457
|
+
this.__wbg_ptr = ret >>> 0;
|
|
458
|
+
WasmSignerFinalization.register(this, this.__wbg_ptr, this);
|
|
459
|
+
return this;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Sign a single order/cancel/cancelAll
|
|
463
|
+
* @param {any} order
|
|
464
|
+
* @param {number | null} [nonce]
|
|
465
|
+
* @returns {any}
|
|
466
|
+
*/
|
|
467
|
+
sign(order, nonce) {
|
|
468
|
+
const ret = wasm.wasmsigner_sign(this.__wbg_ptr, order, !isLikeNone(nonce), isLikeNone(nonce) ? 0 : nonce);
|
|
469
|
+
if (ret[2]) {
|
|
470
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
471
|
+
}
|
|
472
|
+
return takeFromExternrefTable0(ret[0]);
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Get the signer's public key
|
|
476
|
+
* @returns {string}
|
|
477
|
+
*/
|
|
478
|
+
get pubkey() {
|
|
479
|
+
let deferred1_0;
|
|
480
|
+
let deferred1_1;
|
|
481
|
+
try {
|
|
482
|
+
const ret = wasm.wasmsigner_pubkey(this.__wbg_ptr);
|
|
483
|
+
deferred1_0 = ret[0];
|
|
484
|
+
deferred1_1 = ret[1];
|
|
485
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
486
|
+
} finally {
|
|
487
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Sign multiple orders - each becomes its own transaction (parallel)
|
|
492
|
+
* @param {any} orders
|
|
493
|
+
* @param {number | null} [base_nonce]
|
|
494
|
+
* @returns {any}
|
|
495
|
+
*/
|
|
496
|
+
signAll(orders, base_nonce) {
|
|
497
|
+
const ret = wasm.wasmsigner_signAll(this.__wbg_ptr, orders, !isLikeNone(base_nonce), isLikeNone(base_nonce) ? 0 : base_nonce);
|
|
498
|
+
if (ret[2]) {
|
|
499
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
500
|
+
}
|
|
501
|
+
return takeFromExternrefTable0(ret[0]);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
if (Symbol.dispose) WasmSigner.prototype[Symbol.dispose] = WasmSigner.prototype.free;
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Get current timestamp in milliseconds
|
|
508
|
+
* @returns {number}
|
|
509
|
+
*/
|
|
510
|
+
export function currentTimestamp() {
|
|
511
|
+
const ret = wasm.currentTimestamp();
|
|
512
|
+
return ret;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Initialize the WASM module
|
|
517
|
+
*/
|
|
518
|
+
export function init() {
|
|
519
|
+
wasm.init();
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Generate a random hash (for client order IDs)
|
|
524
|
+
* @returns {string}
|
|
525
|
+
*/
|
|
526
|
+
export function randomHash() {
|
|
527
|
+
let deferred1_0;
|
|
528
|
+
let deferred1_1;
|
|
529
|
+
try {
|
|
530
|
+
const ret = wasm.randomHash();
|
|
531
|
+
deferred1_0 = ret[0];
|
|
532
|
+
deferred1_1 = ret[1];
|
|
533
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
534
|
+
} finally {
|
|
535
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Validate a base58-encoded hash
|
|
541
|
+
* @param {string} s
|
|
542
|
+
* @returns {boolean}
|
|
543
|
+
*/
|
|
544
|
+
export function validateHash(s) {
|
|
545
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
546
|
+
const len0 = WASM_VECTOR_LEN;
|
|
547
|
+
const ret = wasm.validateHash(ptr0, len0);
|
|
548
|
+
return ret !== 0;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Validate a base58-encoded public key
|
|
553
|
+
* @param {string} s
|
|
554
|
+
* @returns {boolean}
|
|
555
|
+
*/
|
|
556
|
+
export function validatePubkey(s) {
|
|
557
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
558
|
+
const len0 = WASM_VECTOR_LEN;
|
|
559
|
+
const ret = wasm.validatePubkey(ptr0, len0);
|
|
560
|
+
return ret !== 0;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
|
|
564
|
+
|
|
565
|
+
async function __wbg_load(module, imports) {
|
|
566
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
567
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
568
|
+
try {
|
|
569
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
570
|
+
} catch (e) {
|
|
571
|
+
const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
|
|
572
|
+
|
|
573
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
574
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
575
|
+
|
|
576
|
+
} else {
|
|
577
|
+
throw e;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
const bytes = await module.arrayBuffer();
|
|
583
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
584
|
+
} else {
|
|
585
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
586
|
+
|
|
587
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
588
|
+
return { instance, module };
|
|
589
|
+
} else {
|
|
590
|
+
return instance;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
function __wbg_get_imports() {
|
|
596
|
+
const imports = {};
|
|
597
|
+
imports.wbg = {};
|
|
598
|
+
imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
|
|
599
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
600
|
+
return ret;
|
|
601
|
+
};
|
|
602
|
+
imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
|
|
603
|
+
const ret = String(arg1);
|
|
604
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
605
|
+
const len1 = WASM_VECTOR_LEN;
|
|
606
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
607
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
608
|
+
};
|
|
609
|
+
imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
|
|
610
|
+
const v = arg0;
|
|
611
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
612
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
613
|
+
};
|
|
614
|
+
imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
|
|
615
|
+
const ret = debugString(arg1);
|
|
616
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
617
|
+
const len1 = WASM_VECTOR_LEN;
|
|
618
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
619
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
620
|
+
};
|
|
621
|
+
imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
|
|
622
|
+
const ret = arg0 in arg1;
|
|
623
|
+
return ret;
|
|
624
|
+
};
|
|
625
|
+
imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
|
|
626
|
+
const ret = typeof(arg0) === 'function';
|
|
627
|
+
return ret;
|
|
628
|
+
};
|
|
629
|
+
imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
|
|
630
|
+
const val = arg0;
|
|
631
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
632
|
+
return ret;
|
|
633
|
+
};
|
|
634
|
+
imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
|
|
635
|
+
const ret = typeof(arg0) === 'string';
|
|
636
|
+
return ret;
|
|
637
|
+
};
|
|
638
|
+
imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
|
|
639
|
+
const ret = arg0 === undefined;
|
|
640
|
+
return ret;
|
|
641
|
+
};
|
|
642
|
+
imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
|
|
643
|
+
const ret = arg0 == arg1;
|
|
644
|
+
return ret;
|
|
645
|
+
};
|
|
646
|
+
imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
|
|
647
|
+
const obj = arg1;
|
|
648
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
649
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
650
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
651
|
+
};
|
|
652
|
+
imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
|
|
653
|
+
const obj = arg1;
|
|
654
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
655
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
656
|
+
var len1 = WASM_VECTOR_LEN;
|
|
657
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
658
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
659
|
+
};
|
|
660
|
+
imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
661
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
662
|
+
};
|
|
663
|
+
imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
664
|
+
const ret = arg0.call(arg1, arg2);
|
|
665
|
+
return ret;
|
|
666
|
+
}, arguments) };
|
|
667
|
+
imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
|
|
668
|
+
const ret = arg0.call(arg1);
|
|
669
|
+
return ret;
|
|
670
|
+
}, arguments) };
|
|
671
|
+
imports.wbg.__wbg_crypto_86f2631e91b51511 = function(arg0) {
|
|
672
|
+
const ret = arg0.crypto;
|
|
673
|
+
return ret;
|
|
674
|
+
};
|
|
675
|
+
imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) {
|
|
676
|
+
const ret = arg0.done;
|
|
677
|
+
return ret;
|
|
678
|
+
};
|
|
679
|
+
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
680
|
+
let deferred0_0;
|
|
681
|
+
let deferred0_1;
|
|
682
|
+
try {
|
|
683
|
+
deferred0_0 = arg0;
|
|
684
|
+
deferred0_1 = arg1;
|
|
685
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
686
|
+
} finally {
|
|
687
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
imports.wbg.__wbg_getRandomValues_b3f15fcbfabb0f8b = function() { return handleError(function (arg0, arg1) {
|
|
691
|
+
arg0.getRandomValues(arg1);
|
|
692
|
+
}, arguments) };
|
|
693
|
+
imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
|
|
694
|
+
const ret = arg0[arg1 >>> 0];
|
|
695
|
+
return ret;
|
|
696
|
+
};
|
|
697
|
+
imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
|
|
698
|
+
const ret = Reflect.get(arg0, arg1);
|
|
699
|
+
return ret;
|
|
700
|
+
}, arguments) };
|
|
701
|
+
imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
|
|
702
|
+
const ret = arg0[arg1];
|
|
703
|
+
return ret;
|
|
704
|
+
};
|
|
705
|
+
imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
|
|
706
|
+
let result;
|
|
707
|
+
try {
|
|
708
|
+
result = arg0 instanceof ArrayBuffer;
|
|
709
|
+
} catch (_) {
|
|
710
|
+
result = false;
|
|
711
|
+
}
|
|
712
|
+
const ret = result;
|
|
713
|
+
return ret;
|
|
714
|
+
};
|
|
715
|
+
imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
|
|
716
|
+
let result;
|
|
717
|
+
try {
|
|
718
|
+
result = arg0 instanceof Uint8Array;
|
|
719
|
+
} catch (_) {
|
|
720
|
+
result = false;
|
|
721
|
+
}
|
|
722
|
+
const ret = result;
|
|
723
|
+
return ret;
|
|
724
|
+
};
|
|
725
|
+
imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
|
|
726
|
+
const ret = Array.isArray(arg0);
|
|
727
|
+
return ret;
|
|
728
|
+
};
|
|
729
|
+
imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function() {
|
|
730
|
+
const ret = Symbol.iterator;
|
|
731
|
+
return ret;
|
|
732
|
+
};
|
|
733
|
+
imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
|
|
734
|
+
const ret = arg0.length;
|
|
735
|
+
return ret;
|
|
736
|
+
};
|
|
737
|
+
imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
|
|
738
|
+
const ret = arg0.length;
|
|
739
|
+
return ret;
|
|
740
|
+
};
|
|
741
|
+
imports.wbg.__wbg_msCrypto_d562bbe83e0d4b91 = function(arg0) {
|
|
742
|
+
const ret = arg0.msCrypto;
|
|
743
|
+
return ret;
|
|
744
|
+
};
|
|
745
|
+
imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
|
|
746
|
+
const ret = new Object();
|
|
747
|
+
return ret;
|
|
748
|
+
};
|
|
749
|
+
imports.wbg.__wbg_new_25f239778d6112b9 = function() {
|
|
750
|
+
const ret = new Array();
|
|
751
|
+
return ret;
|
|
752
|
+
};
|
|
753
|
+
imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
|
|
754
|
+
const ret = new Uint8Array(arg0);
|
|
755
|
+
return ret;
|
|
756
|
+
};
|
|
757
|
+
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
758
|
+
const ret = new Error();
|
|
759
|
+
return ret;
|
|
760
|
+
};
|
|
761
|
+
imports.wbg.__wbg_new_b546ae120718850e = function() {
|
|
762
|
+
const ret = new Map();
|
|
763
|
+
return ret;
|
|
764
|
+
};
|
|
765
|
+
imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
|
|
766
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
767
|
+
return ret;
|
|
768
|
+
};
|
|
769
|
+
imports.wbg.__wbg_new_with_length_aa5eaf41d35235e5 = function(arg0) {
|
|
770
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
771
|
+
return ret;
|
|
772
|
+
};
|
|
773
|
+
imports.wbg.__wbg_next_138a17bbf04e926c = function(arg0) {
|
|
774
|
+
const ret = arg0.next;
|
|
775
|
+
return ret;
|
|
776
|
+
};
|
|
777
|
+
imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
|
|
778
|
+
const ret = arg0.next();
|
|
779
|
+
return ret;
|
|
780
|
+
}, arguments) };
|
|
781
|
+
imports.wbg.__wbg_node_e1f24f89a7336c2e = function(arg0) {
|
|
782
|
+
const ret = arg0.node;
|
|
783
|
+
return ret;
|
|
784
|
+
};
|
|
785
|
+
imports.wbg.__wbg_process_3975fd6c72f520aa = function(arg0) {
|
|
786
|
+
const ret = arg0.process;
|
|
787
|
+
return ret;
|
|
788
|
+
};
|
|
789
|
+
imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
|
|
790
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
791
|
+
};
|
|
792
|
+
imports.wbg.__wbg_randomFillSync_f8c153b79f285817 = function() { return handleError(function (arg0, arg1) {
|
|
793
|
+
arg0.randomFillSync(arg1);
|
|
794
|
+
}, arguments) };
|
|
795
|
+
imports.wbg.__wbg_require_b74f47fc2d022fd6 = function() { return handleError(function () {
|
|
796
|
+
const ret = module.require;
|
|
797
|
+
return ret;
|
|
798
|
+
}, arguments) };
|
|
799
|
+
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
800
|
+
arg0[arg1] = arg2;
|
|
801
|
+
};
|
|
802
|
+
imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
|
|
803
|
+
arg0[arg1 >>> 0] = arg2;
|
|
804
|
+
};
|
|
805
|
+
imports.wbg.__wbg_set_efaaf145b9377369 = function(arg0, arg1, arg2) {
|
|
806
|
+
const ret = arg0.set(arg1, arg2);
|
|
807
|
+
return ret;
|
|
808
|
+
};
|
|
809
|
+
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
810
|
+
const ret = arg1.stack;
|
|
811
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
812
|
+
const len1 = WASM_VECTOR_LEN;
|
|
813
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
814
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
815
|
+
};
|
|
816
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
|
|
817
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
818
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
819
|
+
};
|
|
820
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
|
|
821
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
822
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
823
|
+
};
|
|
824
|
+
imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
|
|
825
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
826
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
827
|
+
};
|
|
828
|
+
imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
|
|
829
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
830
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
831
|
+
};
|
|
832
|
+
imports.wbg.__wbg_subarray_845f2f5bce7d061a = function(arg0, arg1, arg2) {
|
|
833
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
834
|
+
return ret;
|
|
835
|
+
};
|
|
836
|
+
imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) {
|
|
837
|
+
const ret = arg0.value;
|
|
838
|
+
return ret;
|
|
839
|
+
};
|
|
840
|
+
imports.wbg.__wbg_versions_4e31226f5e8dc909 = function(arg0) {
|
|
841
|
+
const ret = arg0.versions;
|
|
842
|
+
return ret;
|
|
843
|
+
};
|
|
844
|
+
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
845
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
846
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
847
|
+
return ret;
|
|
848
|
+
};
|
|
849
|
+
imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
|
|
850
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
851
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
852
|
+
return ret;
|
|
853
|
+
};
|
|
854
|
+
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
855
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
856
|
+
const ret = arg0;
|
|
857
|
+
return ret;
|
|
858
|
+
};
|
|
859
|
+
imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
|
|
860
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
861
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
862
|
+
return ret;
|
|
863
|
+
};
|
|
864
|
+
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
865
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
866
|
+
const ret = arg0;
|
|
867
|
+
return ret;
|
|
868
|
+
};
|
|
869
|
+
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
870
|
+
const table = wasm.__wbindgen_externrefs;
|
|
871
|
+
const offset = table.grow(4);
|
|
872
|
+
table.set(0, undefined);
|
|
873
|
+
table.set(offset + 0, undefined);
|
|
874
|
+
table.set(offset + 1, null);
|
|
875
|
+
table.set(offset + 2, true);
|
|
876
|
+
table.set(offset + 3, false);
|
|
877
|
+
};
|
|
878
|
+
|
|
879
|
+
return imports;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
function __wbg_finalize_init(instance, module) {
|
|
883
|
+
wasm = instance.exports;
|
|
884
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
885
|
+
cachedDataViewMemory0 = null;
|
|
886
|
+
cachedUint8ArrayMemory0 = null;
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
wasm.__wbindgen_start();
|
|
890
|
+
return wasm;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
function initSync(module) {
|
|
894
|
+
if (wasm !== undefined) return wasm;
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
if (typeof module !== 'undefined') {
|
|
898
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
899
|
+
({module} = module)
|
|
900
|
+
} else {
|
|
901
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
const imports = __wbg_get_imports();
|
|
906
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
907
|
+
module = new WebAssembly.Module(module);
|
|
908
|
+
}
|
|
909
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
910
|
+
return __wbg_finalize_init(instance, module);
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
async function __wbg_init(module_or_path) {
|
|
914
|
+
if (wasm !== undefined) return wasm;
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
if (typeof module_or_path !== 'undefined') {
|
|
918
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
919
|
+
({module_or_path} = module_or_path)
|
|
920
|
+
} else {
|
|
921
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
if (typeof module_or_path === 'undefined') {
|
|
926
|
+
module_or_path = new URL('bulk_keychain_wasm_bg.wasm', import.meta.url);
|
|
927
|
+
}
|
|
928
|
+
const imports = __wbg_get_imports();
|
|
929
|
+
|
|
930
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
931
|
+
module_or_path = fetch(module_or_path);
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
935
|
+
|
|
936
|
+
return __wbg_finalize_init(instance, module);
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
export { initSync };
|
|
940
|
+
export default __wbg_init;
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bulk-keychain-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"description": "WASM bindings for BULK txn signing",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/bulk-trade/bulk-keychain"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bulk_keychain_wasm_bg.wasm",
|
|
12
|
+
"bulk_keychain_wasm.js",
|
|
13
|
+
"bulk_keychain_wasm.d.ts"
|
|
14
|
+
],
|
|
15
|
+
"main": "bulk_keychain_wasm.js",
|
|
16
|
+
"types": "bulk_keychain_wasm.d.ts",
|
|
17
|
+
"sideEffects": [
|
|
18
|
+
"./snippets/*"
|
|
19
|
+
]
|
|
20
|
+
}
|