bulk-keychain-wasm 0.1.12 → 0.1.13
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 +55 -0
- package/bulk_keychain_wasm.js +136 -0
- package/bulk_keychain_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/bulk_keychain_wasm.d.ts
CHANGED
|
@@ -141,6 +141,10 @@ export class WasmSigner {
|
|
|
141
141
|
* Sign multiple orders - each becomes its own transaction (parallel)
|
|
142
142
|
*/
|
|
143
143
|
signAll(orders: any, base_nonce?: number | null): any;
|
|
144
|
+
/**
|
|
145
|
+
* Sign a sub-account creation (optional initial margin transfer)
|
|
146
|
+
*/
|
|
147
|
+
signCreateSubAccount(name: string, margin_symbol?: string | null, margin_amount?: number | null, nonce?: number | null): any;
|
|
144
148
|
/**
|
|
145
149
|
* Sign a faucet request (testnet only)
|
|
146
150
|
*/
|
|
@@ -165,6 +169,24 @@ export class WasmSigner {
|
|
|
165
169
|
* Sign a batch Pyth oracle update (`o`)
|
|
166
170
|
*/
|
|
167
171
|
signPythOracle(oracles: any, nonce?: number | null): any;
|
|
172
|
+
/**
|
|
173
|
+
* Sign a sub-account removal
|
|
174
|
+
*
|
|
175
|
+
* @param toRemove - sub-account pubkey to remove (base58)
|
|
176
|
+
* @param nonce - optional nonce
|
|
177
|
+
*/
|
|
178
|
+
signRemoveSubAccount(to_remove: string, nonce?: number | null): any;
|
|
179
|
+
/**
|
|
180
|
+
* Sign a margin transfer between accounts
|
|
181
|
+
*
|
|
182
|
+
* @param kind - "internal" or "external" (defaults to "internal")
|
|
183
|
+
* @param fromPubkey - source account pubkey (base58)
|
|
184
|
+
* @param toPubkey - destination account pubkey (base58)
|
|
185
|
+
* @param marginSymbol - margin asset symbol (e.g. "USDC")
|
|
186
|
+
* @param marginAmount - amount to transfer
|
|
187
|
+
* @param nonce - optional nonce
|
|
188
|
+
*/
|
|
189
|
+
signTransfer(kind: string | null | undefined, from_pubkey: string, to_pubkey: string, margin_symbol: string, margin_amount: number, nonce?: number | null): any;
|
|
168
190
|
/**
|
|
169
191
|
* Sign user settings update
|
|
170
192
|
*/
|
|
@@ -226,6 +248,14 @@ export function prepareAgentWallet(agent_pubkey: string, _delete: boolean, optio
|
|
|
226
248
|
*/
|
|
227
249
|
export function prepareAll(orders: any, options: any): WasmPreparedMessage[];
|
|
228
250
|
|
|
251
|
+
/**
|
|
252
|
+
* Prepare a sub-account creation for external signing
|
|
253
|
+
*
|
|
254
|
+
* @param name - Sub-account display name
|
|
255
|
+
* @param options - { account: string, signer?: string, nonce?: number, marginSymbol?: string, marginAmount?: number }
|
|
256
|
+
*/
|
|
257
|
+
export function prepareCreateSubAccount(name: string, options: any): WasmPreparedMessage;
|
|
258
|
+
|
|
229
259
|
/**
|
|
230
260
|
* Prepare faucet request for external signing
|
|
231
261
|
*
|
|
@@ -263,6 +293,25 @@ export function prepareGroup(orders: any, options: any): WasmPreparedMessage;
|
|
|
263
293
|
*/
|
|
264
294
|
export function prepareOrder(order: any, options: any): WasmPreparedMessage;
|
|
265
295
|
|
|
296
|
+
/**
|
|
297
|
+
* Prepare a sub-account removal for external signing
|
|
298
|
+
*
|
|
299
|
+
* @param toRemove - sub-account pubkey to remove (base58)
|
|
300
|
+
* @param options - { account: string, signer?: string, nonce?: number }
|
|
301
|
+
*/
|
|
302
|
+
export function prepareRemoveSubAccount(to_remove: string, options: any): WasmPreparedMessage;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Prepare a margin transfer for external signing
|
|
306
|
+
*
|
|
307
|
+
* @param fromPubkey - source account pubkey (base58)
|
|
308
|
+
* @param toPubkey - destination account pubkey (base58)
|
|
309
|
+
* @param marginSymbol - margin asset symbol
|
|
310
|
+
* @param marginAmount - amount to transfer
|
|
311
|
+
* @param options - { account: string, signer?: string, nonce?: number, kind?: "internal" | "external" }
|
|
312
|
+
*/
|
|
313
|
+
export function prepareTransfer(from_pubkey: string, to_pubkey: string, margin_symbol: string, margin_amount: number, options: any): WasmPreparedMessage;
|
|
314
|
+
|
|
266
315
|
/**
|
|
267
316
|
* Prepare user settings update for external signing
|
|
268
317
|
*
|
|
@@ -298,9 +347,12 @@ export interface InitOutput {
|
|
|
298
347
|
readonly finalizeTransaction: (a: any, b: number, c: number) => [number, number, number];
|
|
299
348
|
readonly prepareAgentWallet: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
300
349
|
readonly prepareAll: (a: any, b: any) => [number, number, number, number];
|
|
350
|
+
readonly prepareCreateSubAccount: (a: number, b: number, c: any) => [number, number, number];
|
|
301
351
|
readonly prepareFaucet: (a: any) => [number, number, number];
|
|
302
352
|
readonly prepareGroup: (a: any, b: any) => [number, number, number];
|
|
303
353
|
readonly prepareOrder: (a: any, b: any) => [number, number, number];
|
|
354
|
+
readonly prepareRemoveSubAccount: (a: number, b: number, c: any) => [number, number, number];
|
|
355
|
+
readonly prepareTransfer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: any) => [number, number, number];
|
|
304
356
|
readonly prepareUpdateUserSettings: (a: any, b: any) => [number, number, number];
|
|
305
357
|
readonly randomHash: () => [number, number];
|
|
306
358
|
readonly validateHash: (a: number, b: number) => number;
|
|
@@ -334,11 +386,14 @@ export interface InitOutput {
|
|
|
334
386
|
readonly wasmsigner_sign: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
335
387
|
readonly wasmsigner_signAgentWallet: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
336
388
|
readonly wasmsigner_signAll: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
389
|
+
readonly wasmsigner_signCreateSubAccount: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
|
|
337
390
|
readonly wasmsigner_signFaucet: (a: number, b: number, c: number) => [number, number, number];
|
|
338
391
|
readonly wasmsigner_signGroup: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
339
392
|
readonly wasmsigner_signOraclePrices: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
340
393
|
readonly wasmsigner_signOrdersBatch: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
341
394
|
readonly wasmsigner_signPythOracle: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
395
|
+
readonly wasmsigner_signRemoveSubAccount: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
396
|
+
readonly wasmsigner_signTransfer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number];
|
|
342
397
|
readonly wasmsigner_signUserSettings: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
343
398
|
readonly wasmsigner_signWhitelistFaucet: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
344
399
|
readonly wasmsigner_withNonceManager: (a: number, b: number, c: number) => [number, number, number];
|
package/bulk_keychain_wasm.js
CHANGED
|
@@ -430,6 +430,25 @@ export class WasmSigner {
|
|
|
430
430
|
}
|
|
431
431
|
return takeFromExternrefTable0(ret[0]);
|
|
432
432
|
}
|
|
433
|
+
/**
|
|
434
|
+
* Sign a sub-account creation (optional initial margin transfer)
|
|
435
|
+
* @param {string} name
|
|
436
|
+
* @param {string | null} [margin_symbol]
|
|
437
|
+
* @param {number | null} [margin_amount]
|
|
438
|
+
* @param {number | null} [nonce]
|
|
439
|
+
* @returns {any}
|
|
440
|
+
*/
|
|
441
|
+
signCreateSubAccount(name, margin_symbol, margin_amount, nonce) {
|
|
442
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
443
|
+
const len0 = WASM_VECTOR_LEN;
|
|
444
|
+
var ptr1 = isLikeNone(margin_symbol) ? 0 : passStringToWasm0(margin_symbol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
445
|
+
var len1 = WASM_VECTOR_LEN;
|
|
446
|
+
const ret = wasm.wasmsigner_signCreateSubAccount(this.__wbg_ptr, ptr0, len0, ptr1, len1, !isLikeNone(margin_amount), isLikeNone(margin_amount) ? 0 : margin_amount, !isLikeNone(nonce), isLikeNone(nonce) ? 0 : nonce);
|
|
447
|
+
if (ret[2]) {
|
|
448
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
449
|
+
}
|
|
450
|
+
return takeFromExternrefTable0(ret[0]);
|
|
451
|
+
}
|
|
433
452
|
/**
|
|
434
453
|
* Sign a faucet request (testnet only)
|
|
435
454
|
* @param {number | null} [nonce]
|
|
@@ -507,6 +526,56 @@ export class WasmSigner {
|
|
|
507
526
|
}
|
|
508
527
|
return takeFromExternrefTable0(ret[0]);
|
|
509
528
|
}
|
|
529
|
+
/**
|
|
530
|
+
* Sign a sub-account removal
|
|
531
|
+
*
|
|
532
|
+
* @param toRemove - sub-account pubkey to remove (base58)
|
|
533
|
+
* @param nonce - optional nonce
|
|
534
|
+
* @param {string} to_remove
|
|
535
|
+
* @param {number | null} [nonce]
|
|
536
|
+
* @returns {any}
|
|
537
|
+
*/
|
|
538
|
+
signRemoveSubAccount(to_remove, nonce) {
|
|
539
|
+
const ptr0 = passStringToWasm0(to_remove, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
540
|
+
const len0 = WASM_VECTOR_LEN;
|
|
541
|
+
const ret = wasm.wasmsigner_signRemoveSubAccount(this.__wbg_ptr, ptr0, len0, !isLikeNone(nonce), isLikeNone(nonce) ? 0 : nonce);
|
|
542
|
+
if (ret[2]) {
|
|
543
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
544
|
+
}
|
|
545
|
+
return takeFromExternrefTable0(ret[0]);
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Sign a margin transfer between accounts
|
|
549
|
+
*
|
|
550
|
+
* @param kind - "internal" or "external" (defaults to "internal")
|
|
551
|
+
* @param fromPubkey - source account pubkey (base58)
|
|
552
|
+
* @param toPubkey - destination account pubkey (base58)
|
|
553
|
+
* @param marginSymbol - margin asset symbol (e.g. "USDC")
|
|
554
|
+
* @param marginAmount - amount to transfer
|
|
555
|
+
* @param nonce - optional nonce
|
|
556
|
+
* @param {string | null | undefined} kind
|
|
557
|
+
* @param {string} from_pubkey
|
|
558
|
+
* @param {string} to_pubkey
|
|
559
|
+
* @param {string} margin_symbol
|
|
560
|
+
* @param {number} margin_amount
|
|
561
|
+
* @param {number | null} [nonce]
|
|
562
|
+
* @returns {any}
|
|
563
|
+
*/
|
|
564
|
+
signTransfer(kind, from_pubkey, to_pubkey, margin_symbol, margin_amount, nonce) {
|
|
565
|
+
var ptr0 = isLikeNone(kind) ? 0 : passStringToWasm0(kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
566
|
+
var len0 = WASM_VECTOR_LEN;
|
|
567
|
+
const ptr1 = passStringToWasm0(from_pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
568
|
+
const len1 = WASM_VECTOR_LEN;
|
|
569
|
+
const ptr2 = passStringToWasm0(to_pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
570
|
+
const len2 = WASM_VECTOR_LEN;
|
|
571
|
+
const ptr3 = passStringToWasm0(margin_symbol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
572
|
+
const len3 = WASM_VECTOR_LEN;
|
|
573
|
+
const ret = wasm.wasmsigner_signTransfer(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, margin_amount, !isLikeNone(nonce), isLikeNone(nonce) ? 0 : nonce);
|
|
574
|
+
if (ret[2]) {
|
|
575
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
576
|
+
}
|
|
577
|
+
return takeFromExternrefTable0(ret[0]);
|
|
578
|
+
}
|
|
510
579
|
/**
|
|
511
580
|
* Sign user settings update
|
|
512
581
|
* @param {any} settings
|
|
@@ -653,6 +722,25 @@ export function prepareAll(orders, options) {
|
|
|
653
722
|
return v1;
|
|
654
723
|
}
|
|
655
724
|
|
|
725
|
+
/**
|
|
726
|
+
* Prepare a sub-account creation for external signing
|
|
727
|
+
*
|
|
728
|
+
* @param name - Sub-account display name
|
|
729
|
+
* @param options - { account: string, signer?: string, nonce?: number, marginSymbol?: string, marginAmount?: number }
|
|
730
|
+
* @param {string} name
|
|
731
|
+
* @param {any} options
|
|
732
|
+
* @returns {WasmPreparedMessage}
|
|
733
|
+
*/
|
|
734
|
+
export function prepareCreateSubAccount(name, options) {
|
|
735
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
736
|
+
const len0 = WASM_VECTOR_LEN;
|
|
737
|
+
const ret = wasm.prepareCreateSubAccount(ptr0, len0, options);
|
|
738
|
+
if (ret[2]) {
|
|
739
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
740
|
+
}
|
|
741
|
+
return WasmPreparedMessage.__wrap(ret[0]);
|
|
742
|
+
}
|
|
743
|
+
|
|
656
744
|
/**
|
|
657
745
|
* Prepare faucet request for external signing
|
|
658
746
|
*
|
|
@@ -716,6 +804,54 @@ export function prepareOrder(order, options) {
|
|
|
716
804
|
return WasmPreparedMessage.__wrap(ret[0]);
|
|
717
805
|
}
|
|
718
806
|
|
|
807
|
+
/**
|
|
808
|
+
* Prepare a sub-account removal for external signing
|
|
809
|
+
*
|
|
810
|
+
* @param toRemove - sub-account pubkey to remove (base58)
|
|
811
|
+
* @param options - { account: string, signer?: string, nonce?: number }
|
|
812
|
+
* @param {string} to_remove
|
|
813
|
+
* @param {any} options
|
|
814
|
+
* @returns {WasmPreparedMessage}
|
|
815
|
+
*/
|
|
816
|
+
export function prepareRemoveSubAccount(to_remove, options) {
|
|
817
|
+
const ptr0 = passStringToWasm0(to_remove, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
818
|
+
const len0 = WASM_VECTOR_LEN;
|
|
819
|
+
const ret = wasm.prepareRemoveSubAccount(ptr0, len0, options);
|
|
820
|
+
if (ret[2]) {
|
|
821
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
822
|
+
}
|
|
823
|
+
return WasmPreparedMessage.__wrap(ret[0]);
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Prepare a margin transfer for external signing
|
|
828
|
+
*
|
|
829
|
+
* @param fromPubkey - source account pubkey (base58)
|
|
830
|
+
* @param toPubkey - destination account pubkey (base58)
|
|
831
|
+
* @param marginSymbol - margin asset symbol
|
|
832
|
+
* @param marginAmount - amount to transfer
|
|
833
|
+
* @param options - { account: string, signer?: string, nonce?: number, kind?: "internal" | "external" }
|
|
834
|
+
* @param {string} from_pubkey
|
|
835
|
+
* @param {string} to_pubkey
|
|
836
|
+
* @param {string} margin_symbol
|
|
837
|
+
* @param {number} margin_amount
|
|
838
|
+
* @param {any} options
|
|
839
|
+
* @returns {WasmPreparedMessage}
|
|
840
|
+
*/
|
|
841
|
+
export function prepareTransfer(from_pubkey, to_pubkey, margin_symbol, margin_amount, options) {
|
|
842
|
+
const ptr0 = passStringToWasm0(from_pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
843
|
+
const len0 = WASM_VECTOR_LEN;
|
|
844
|
+
const ptr1 = passStringToWasm0(to_pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
845
|
+
const len1 = WASM_VECTOR_LEN;
|
|
846
|
+
const ptr2 = passStringToWasm0(margin_symbol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
847
|
+
const len2 = WASM_VECTOR_LEN;
|
|
848
|
+
const ret = wasm.prepareTransfer(ptr0, len0, ptr1, len1, ptr2, len2, margin_amount, options);
|
|
849
|
+
if (ret[2]) {
|
|
850
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
851
|
+
}
|
|
852
|
+
return WasmPreparedMessage.__wrap(ret[0]);
|
|
853
|
+
}
|
|
854
|
+
|
|
719
855
|
/**
|
|
720
856
|
* Prepare user settings update for external signing
|
|
721
857
|
*
|
|
Binary file
|
package/package.json
CHANGED