bulk-keychain-wasm 0.1.0 → 0.1.3
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 +284 -129
- package/bulk_keychain_wasm.js +989 -613
- package/bulk_keychain_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/bulk_keychain_wasm.d.ts
CHANGED
|
@@ -1,102 +1,237 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* WASM wrapper for Keypair
|
|
6
|
+
*/
|
|
4
7
|
export class WasmKeypair {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
8
|
+
free(): void;
|
|
9
|
+
[Symbol.dispose](): void;
|
|
10
|
+
/**
|
|
11
|
+
* Create from base58-encoded secret key or full keypair
|
|
12
|
+
*/
|
|
13
|
+
static fromBase58(s: string): WasmKeypair;
|
|
14
|
+
/**
|
|
15
|
+
* Create from raw bytes (32-byte secret or 64-byte full keypair)
|
|
16
|
+
*/
|
|
17
|
+
static fromBytes(bytes: Uint8Array): WasmKeypair;
|
|
18
|
+
/**
|
|
19
|
+
* Generate a new random keypair
|
|
20
|
+
*/
|
|
21
|
+
constructor();
|
|
22
|
+
/**
|
|
23
|
+
* Get the secret key as bytes (32 bytes)
|
|
24
|
+
*/
|
|
25
|
+
secretKey(): Uint8Array;
|
|
26
|
+
/**
|
|
27
|
+
* Get the full keypair as base58 (64 bytes)
|
|
28
|
+
*/
|
|
29
|
+
toBase58(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Get the full keypair as bytes (64 bytes)
|
|
32
|
+
*/
|
|
33
|
+
toBytes(): Uint8Array;
|
|
34
|
+
/**
|
|
35
|
+
* Get the public key as base58 string
|
|
36
|
+
*/
|
|
37
|
+
readonly pubkey: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Prepared message for external wallet signing
|
|
42
|
+
*
|
|
43
|
+
* This contains everything needed to sign with an external wallet
|
|
44
|
+
* and then finalize into a SignedTransaction.
|
|
45
|
+
*/
|
|
46
|
+
export class WasmPreparedMessage {
|
|
47
|
+
private constructor();
|
|
48
|
+
free(): void;
|
|
49
|
+
[Symbol.dispose](): void;
|
|
50
|
+
/**
|
|
51
|
+
* Finalize with a signature (base58 string)
|
|
52
|
+
*
|
|
53
|
+
* Call this after your wallet signs the messageBytes.
|
|
54
|
+
*/
|
|
55
|
+
finalize(signature: string): any;
|
|
56
|
+
/**
|
|
57
|
+
* Finalize with signature bytes (Uint8Array)
|
|
58
|
+
*/
|
|
59
|
+
finalizeBytes(signature: Uint8Array): any;
|
|
60
|
+
/**
|
|
61
|
+
* Get the account public key (base58)
|
|
62
|
+
*/
|
|
63
|
+
readonly account: string;
|
|
64
|
+
/**
|
|
65
|
+
* Get the action JSON
|
|
66
|
+
*/
|
|
67
|
+
readonly action: any;
|
|
68
|
+
/**
|
|
69
|
+
* Get message as base58 string
|
|
70
|
+
*/
|
|
71
|
+
readonly messageBase58: string;
|
|
72
|
+
/**
|
|
73
|
+
* Get message as base64 string
|
|
74
|
+
*/
|
|
75
|
+
readonly messageBase64: string;
|
|
76
|
+
/**
|
|
77
|
+
* Get the raw message bytes to sign (Uint8Array)
|
|
78
|
+
*/
|
|
79
|
+
readonly messageBytes: Uint8Array;
|
|
80
|
+
/**
|
|
81
|
+
* Get message as hex string
|
|
82
|
+
*/
|
|
83
|
+
readonly messageHex: string;
|
|
84
|
+
/**
|
|
85
|
+
* Get the nonce
|
|
86
|
+
*/
|
|
87
|
+
readonly nonce: number;
|
|
88
|
+
/**
|
|
89
|
+
* Get the pre-computed order ID
|
|
90
|
+
*/
|
|
91
|
+
readonly orderId: string;
|
|
92
|
+
/**
|
|
93
|
+
* Get the signer public key (base58)
|
|
94
|
+
*/
|
|
95
|
+
readonly signer: string;
|
|
35
96
|
}
|
|
36
97
|
|
|
98
|
+
/**
|
|
99
|
+
* WASM wrapper for Signer
|
|
100
|
+
*/
|
|
37
101
|
export class WasmSigner {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
102
|
+
free(): void;
|
|
103
|
+
[Symbol.dispose](): void;
|
|
104
|
+
/**
|
|
105
|
+
* Create a signer from base58-encoded secret key
|
|
106
|
+
*/
|
|
107
|
+
static fromBase58(s: string): WasmSigner;
|
|
108
|
+
/**
|
|
109
|
+
* Create a new signer from a keypair
|
|
110
|
+
*/
|
|
111
|
+
constructor(keypair: WasmKeypair);
|
|
112
|
+
/**
|
|
113
|
+
* Sign a single order/cancel/cancelAll
|
|
114
|
+
*/
|
|
115
|
+
sign(order: any, nonce?: number | null): any;
|
|
116
|
+
/**
|
|
117
|
+
* Sign agent wallet creation/deletion
|
|
118
|
+
*/
|
|
119
|
+
signAgentWallet(agent_pubkey: string, _delete: boolean, nonce?: number | null): any;
|
|
120
|
+
/**
|
|
121
|
+
* Sign multiple orders - each becomes its own transaction (parallel)
|
|
122
|
+
*/
|
|
123
|
+
signAll(orders: any, base_nonce?: number | null): any;
|
|
124
|
+
/**
|
|
125
|
+
* Sign a faucet request (testnet only)
|
|
126
|
+
*/
|
|
127
|
+
signFaucet(nonce?: number | null): any;
|
|
128
|
+
/**
|
|
129
|
+
* Sign multiple orders atomically in ONE transaction
|
|
130
|
+
*/
|
|
131
|
+
signGroup(orders: any, nonce?: number | null): any;
|
|
132
|
+
/**
|
|
133
|
+
* @deprecated Use sign(), signAll(), or signGroup() instead
|
|
134
|
+
*/
|
|
135
|
+
signOrder(orders: any, nonce?: number | null): any;
|
|
136
|
+
/**
|
|
137
|
+
* @deprecated Use signAll() instead
|
|
138
|
+
*/
|
|
139
|
+
signOrdersBatch(batches: any, base_nonce?: number | null): any;
|
|
140
|
+
/**
|
|
141
|
+
* Sign user settings update
|
|
142
|
+
*/
|
|
143
|
+
signUserSettings(settings: any, nonce?: number | null): any;
|
|
144
|
+
/**
|
|
145
|
+
* Create a signer with nonce management
|
|
146
|
+
*/
|
|
147
|
+
static withNonceManager(keypair: WasmKeypair, strategy: string): WasmSigner;
|
|
148
|
+
/**
|
|
149
|
+
* Get the signer's public key
|
|
150
|
+
*/
|
|
151
|
+
readonly pubkey: string;
|
|
88
152
|
}
|
|
89
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Compute order ID from wincode bytes
|
|
156
|
+
*
|
|
157
|
+
* This computes SHA256(wincode_bytes), which matches BULK's server-side
|
|
158
|
+
* order ID generation. Useful if you're serializing transactions yourself.
|
|
159
|
+
*/
|
|
160
|
+
export function computeOrderId(wincode_bytes: Uint8Array): string;
|
|
161
|
+
|
|
90
162
|
/**
|
|
91
163
|
* Get current timestamp in milliseconds
|
|
92
164
|
*/
|
|
93
165
|
export function currentTimestamp(): number;
|
|
94
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Finalize a prepared message with a signature
|
|
169
|
+
*
|
|
170
|
+
* Alternative to calling prepared.finalize() - useful if you have
|
|
171
|
+
* the prepared message as a plain object.
|
|
172
|
+
*/
|
|
173
|
+
export function finalizeTransaction(prepared: any, signature: string): any;
|
|
174
|
+
|
|
95
175
|
/**
|
|
96
176
|
* Initialize the WASM module
|
|
97
177
|
*/
|
|
98
178
|
export function init(): void;
|
|
99
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Prepare agent wallet creation for external signing
|
|
182
|
+
*
|
|
183
|
+
* @param agentPubkey - The agent wallet public key to authorize
|
|
184
|
+
* @param delete - Whether to delete (true) or add (false) the agent
|
|
185
|
+
* @param options - { account: string, signer?: string, nonce?: number }
|
|
186
|
+
*/
|
|
187
|
+
export function prepareAgentWallet(agent_pubkey: string, _delete: boolean, options: any): WasmPreparedMessage;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Prepare multiple orders - each becomes its own transaction (parallel)
|
|
191
|
+
*
|
|
192
|
+
* @param orders - Array of orders to prepare
|
|
193
|
+
* @param options - { account: string, signer?: string, nonce?: number }
|
|
194
|
+
* @returns Array of PreparedMessage
|
|
195
|
+
*/
|
|
196
|
+
export function prepareAll(orders: any, options: any): WasmPreparedMessage[];
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Prepare faucet request for external signing
|
|
200
|
+
*
|
|
201
|
+
* @param options - { account: string, signer?: string, nonce?: number }
|
|
202
|
+
*/
|
|
203
|
+
export function prepareFaucet(options: any): WasmPreparedMessage;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Prepare multiple orders as ONE atomic transaction
|
|
207
|
+
*
|
|
208
|
+
* Use for bracket orders (entry + stop loss + take profit).
|
|
209
|
+
*
|
|
210
|
+
* @param orders - Array of orders for the atomic transaction
|
|
211
|
+
* @param options - { account: string, signer?: string, nonce?: number }
|
|
212
|
+
* @returns Single PreparedMessage containing all orders
|
|
213
|
+
*/
|
|
214
|
+
export function prepareGroup(orders: any, options: any): WasmPreparedMessage;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Prepare a single order for external wallet signing
|
|
218
|
+
*
|
|
219
|
+
* Use this when you don't have access to the private key and need
|
|
220
|
+
* to sign with an external wallet (like Phantom, Privy, etc).
|
|
221
|
+
*
|
|
222
|
+
* @param order - The order to prepare
|
|
223
|
+
* @param options - { account: string, signer?: string, nonce?: number }
|
|
224
|
+
* @returns PreparedMessage with messageBytes to sign
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```typescript
|
|
228
|
+
* const prepared = prepareOrder(order, { account: myPubkey });
|
|
229
|
+
* const signature = await wallet.signMessage(prepared.messageBytes);
|
|
230
|
+
* const signed = prepared.finalize(signature);
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
export function prepareOrder(order: any, options: any): WasmPreparedMessage;
|
|
234
|
+
|
|
100
235
|
/**
|
|
101
236
|
* Generate a random hash (for client order IDs)
|
|
102
237
|
*/
|
|
@@ -115,61 +250,81 @@ export function validatePubkey(s: string): boolean;
|
|
|
115
250
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
116
251
|
|
|
117
252
|
export interface InitOutput {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
253
|
+
readonly memory: WebAssembly.Memory;
|
|
254
|
+
readonly __wbg_wasmkeypair_free: (a: number, b: number) => void;
|
|
255
|
+
readonly __wbg_wasmpreparedmessage_free: (a: number, b: number) => void;
|
|
256
|
+
readonly __wbg_wasmsigner_free: (a: number, b: number) => void;
|
|
257
|
+
readonly computeOrderId: (a: number, b: number) => [number, number];
|
|
258
|
+
readonly currentTimestamp: () => number;
|
|
259
|
+
readonly finalizeTransaction: (a: any, b: number, c: number) => [number, number, number];
|
|
260
|
+
readonly prepareAgentWallet: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
261
|
+
readonly prepareAll: (a: any, b: any) => [number, number, number, number];
|
|
262
|
+
readonly prepareFaucet: (a: any) => [number, number, number];
|
|
263
|
+
readonly prepareGroup: (a: any, b: any) => [number, number, number];
|
|
264
|
+
readonly prepareOrder: (a: any, b: any) => [number, number, number];
|
|
265
|
+
readonly randomHash: () => [number, number];
|
|
266
|
+
readonly validateHash: (a: number, b: number) => number;
|
|
267
|
+
readonly validatePubkey: (a: number, b: number) => number;
|
|
268
|
+
readonly wasmkeypair_fromBase58: (a: number, b: number) => [number, number, number];
|
|
269
|
+
readonly wasmkeypair_fromBytes: (a: number, b: number) => [number, number, number];
|
|
270
|
+
readonly wasmkeypair_new: () => number;
|
|
271
|
+
readonly wasmkeypair_pubkey: (a: number) => [number, number];
|
|
272
|
+
readonly wasmkeypair_secretKey: (a: number) => [number, number];
|
|
273
|
+
readonly wasmkeypair_toBase58: (a: number) => [number, number];
|
|
274
|
+
readonly wasmkeypair_toBytes: (a: number) => [number, number];
|
|
275
|
+
readonly wasmpreparedmessage_account: (a: number) => [number, number];
|
|
276
|
+
readonly wasmpreparedmessage_action: (a: number) => any;
|
|
277
|
+
readonly wasmpreparedmessage_finalize: (a: number, b: number, c: number) => any;
|
|
278
|
+
readonly wasmpreparedmessage_finalizeBytes: (a: number, b: number, c: number) => any;
|
|
279
|
+
readonly wasmpreparedmessage_messageBase58: (a: number) => [number, number];
|
|
280
|
+
readonly wasmpreparedmessage_messageBase64: (a: number) => [number, number];
|
|
281
|
+
readonly wasmpreparedmessage_messageBytes: (a: number) => [number, number];
|
|
282
|
+
readonly wasmpreparedmessage_messageHex: (a: number) => [number, number];
|
|
283
|
+
readonly wasmpreparedmessage_nonce: (a: number) => number;
|
|
284
|
+
readonly wasmpreparedmessage_orderId: (a: number) => [number, number];
|
|
285
|
+
readonly wasmpreparedmessage_signer: (a: number) => [number, number];
|
|
286
|
+
readonly wasmsigner_fromBase58: (a: number, b: number) => [number, number, number];
|
|
287
|
+
readonly wasmsigner_new: (a: number) => number;
|
|
288
|
+
readonly wasmsigner_pubkey: (a: number) => [number, number];
|
|
289
|
+
readonly wasmsigner_sign: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
290
|
+
readonly wasmsigner_signAgentWallet: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
291
|
+
readonly wasmsigner_signAll: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
292
|
+
readonly wasmsigner_signFaucet: (a: number, b: number, c: number) => [number, number, number];
|
|
293
|
+
readonly wasmsigner_signGroup: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
294
|
+
readonly wasmsigner_signOrdersBatch: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
295
|
+
readonly wasmsigner_signUserSettings: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
296
|
+
readonly wasmsigner_withNonceManager: (a: number, b: number, c: number) => [number, number, number];
|
|
297
|
+
readonly init: () => void;
|
|
298
|
+
readonly wasmsigner_signOrder: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
299
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
300
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
301
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
302
|
+
readonly __externref_table_alloc: () => number;
|
|
303
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
304
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
305
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
306
|
+
readonly __externref_drop_slice: (a: number, b: number) => void;
|
|
307
|
+
readonly __wbindgen_start: () => void;
|
|
153
308
|
}
|
|
154
309
|
|
|
155
310
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
156
311
|
|
|
157
312
|
/**
|
|
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
|
-
*/
|
|
313
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
314
|
+
* a precompiled `WebAssembly.Module`.
|
|
315
|
+
*
|
|
316
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
317
|
+
*
|
|
318
|
+
* @returns {InitOutput}
|
|
319
|
+
*/
|
|
165
320
|
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
166
321
|
|
|
167
322
|
/**
|
|
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
|
-
*/
|
|
323
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
324
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
325
|
+
*
|
|
326
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
327
|
+
*
|
|
328
|
+
* @returns {Promise<InitOutput>}
|
|
329
|
+
*/
|
|
175
330
|
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|