bulk-keychain-wasm 0.1.17 → 0.1.20

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.
@@ -141,6 +141,18 @@ 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 builder-code recipient approval (`abc`)
146
+ */
147
+ signApproveBuilderCode(to_pubkey: string, fee: number, nonce?: number | null): any;
148
+ /**
149
+ * Sign builder-code recipient approval (`abc`)
150
+ */
151
+ signApproveCommissionFee(to_pubkey: string, fee: number, nonce?: number | null): any;
152
+ /**
153
+ * Sign raw message bytes and return a base58 Ed25519 signature.
154
+ */
155
+ signBytes(message: Uint8Array): string;
144
156
  /**
145
157
  * Sign a multisig creation
146
158
  */
@@ -189,6 +201,13 @@ export class WasmSigner {
189
201
  * @deprecated Use signAll() instead
190
202
  */
191
203
  signOrdersBatch(batches: any, base_nonce?: number | null): any;
204
+ /**
205
+ * Sign a prepared message and finalize it into a signed transaction.
206
+ *
207
+ * This supports agent-wallet flows where prepared.account is the trading
208
+ * account and prepared.signer is this signer's pubkey.
209
+ */
210
+ signPrepared(prepared: WasmPreparedMessage): any;
192
211
  /**
193
212
  * Sign a batch Pyth oracle update (`o`)
194
213
  */
@@ -208,6 +227,14 @@ export class WasmSigner {
208
227
  * @param nonce - optional nonce
209
228
  */
210
229
  signRenameSubAccount(subaccount: string, name: string, nonce?: number | null): any;
230
+ /**
231
+ * Sign builder-code recipient revocation (`rbc`)
232
+ */
233
+ signRevokeBuilderCode(to_pubkey: string, nonce?: number | null): any;
234
+ /**
235
+ * Sign builder-code recipient revocation (`rbc`)
236
+ */
237
+ signRevokeCommissionFee(to_pubkey: string, nonce?: number | null): any;
211
238
  /**
212
239
  * Sign a margin transfer between accounts
213
240
  *
@@ -218,6 +245,10 @@ export class WasmSigner {
218
245
  * @param nonce - optional nonce
219
246
  */
220
247
  signTransfer(kind: string | null | undefined, from_pubkey: string, to_pubkey: string, margin_amount: number, nonce?: number | null): any;
248
+ /**
249
+ * Sign a liquidator config update (`liq`)
250
+ */
251
+ signUpdateLiquidatorConfig(config: any, nonce?: number | null): any;
221
252
  /**
222
253
  * Sign a multisig policy update
223
254
  */
@@ -283,6 +314,20 @@ export function prepareAgentWallet(agent_pubkey: string, _delete: boolean, optio
283
314
  */
284
315
  export function prepareAll(orders: any, options: any): WasmPreparedMessage[];
285
316
 
317
+ /**
318
+ * Prepare builder-code recipient approval for external signing
319
+ */
320
+ export function prepareApproveBuilderCode(to_pubkey: string, fee: number, options: any): WasmPreparedMessage;
321
+
322
+ /**
323
+ * Prepare builder-code recipient approval for external signing
324
+ *
325
+ * @param toPubkey - Builder-code recipient public key
326
+ * @param fee - Maximum builder-code fee in bps
327
+ * @param options - { account: string, signer?: string, nonce?: number }
328
+ */
329
+ export function prepareApproveCommissionFee(to_pubkey: string, fee: number, options: any): WasmPreparedMessage;
330
+
286
331
  /**
287
332
  * Prepare a multisig creation for external signing
288
333
  *
@@ -379,6 +424,19 @@ export function prepareRemoveSubAccount(to_remove: string, options: any): WasmPr
379
424
  */
380
425
  export function prepareRenameSubAccount(subaccount: string, name: string, options: any): WasmPreparedMessage;
381
426
 
427
+ /**
428
+ * Prepare builder-code recipient revocation for external signing
429
+ */
430
+ export function prepareRevokeBuilderCode(to_pubkey: string, options: any): WasmPreparedMessage;
431
+
432
+ /**
433
+ * Prepare builder-code recipient revocation for external signing
434
+ *
435
+ * @param toPubkey - Builder-code recipient public key
436
+ * @param options - { account: string, signer?: string, nonce?: number }
437
+ */
438
+ export function prepareRevokeCommissionFee(to_pubkey: string, options: any): WasmPreparedMessage;
439
+
382
440
  /**
383
441
  * Prepare a margin transfer for external signing
384
442
  *
@@ -389,6 +447,14 @@ export function prepareRenameSubAccount(subaccount: string, name: string, option
389
447
  */
390
448
  export function prepareTransfer(from_pubkey: string, to_pubkey: string, margin_amount: number, options: any): WasmPreparedMessage;
391
449
 
450
+ /**
451
+ * Prepare a liquidator config update for external signing
452
+ *
453
+ * @param config - { crossExposure, scoringSkew, toxicity, instruments: [...] }
454
+ * @param options - { account: string, signer?: string, nonce?: number }
455
+ */
456
+ export function prepareUpdateLiquidatorConfig(config: any, options: any): WasmPreparedMessage;
457
+
392
458
  /**
393
459
  * Prepare a multisig policy update for external signing
394
460
  */
@@ -402,6 +468,27 @@ export function prepareUpdateMultisigPolicy(multisig: string, signers: any, thre
402
468
  */
403
469
  export function prepareUpdateUserSettings(settings: any, options: any): WasmPreparedMessage;
404
470
 
471
+ /**
472
+ * Prepare a portfolio withdraw for external signing
473
+ *
474
+ * @param amount - base-unit amount to withdraw
475
+ * @param blockhash - recent Solana blockhash (base58)
476
+ * @param user - user wallet pubkey (base58)
477
+ * @param vault - vault pubkey (base58)
478
+ * @param recipientTokenAccount - recipient token account pubkey (base58)
479
+ * @param options - { account: string, signer?: string, nonce?: number }
480
+ */
481
+ export function prepareWithdraw(amount: number, blockhash: string, user: string, vault: string, recipient_token_account: string, options: any): WasmPreparedMessage;
482
+
483
+ /**
484
+ * Prepare a withdraw-lock recovery for external signing
485
+ *
486
+ * @param user - user wallet pubkey (base58)
487
+ * @param hash - withdrawal lock hash (base58)
488
+ * @param options - { account: string, signer?: string, nonce?: number }
489
+ */
490
+ export function prepareWithdrawLockRecover(user: string, hash: string, options: any): WasmPreparedMessage;
491
+
405
492
  /**
406
493
  * Generate a random hash (for client order IDs)
407
494
  */
@@ -429,6 +516,7 @@ export interface InitOutput {
429
516
  readonly finalizeTransaction: (a: any, b: number, c: number) => [number, number, number];
430
517
  readonly prepareAgentWallet: (a: number, b: number, c: number, d: any) => [number, number, number];
431
518
  readonly prepareAll: (a: any, b: any) => [number, number, number, number];
519
+ readonly prepareApproveBuilderCode: (a: number, b: number, c: number, d: any) => [number, number, number];
432
520
  readonly prepareCreateMultisig: (a: any, b: number, c: any) => [number, number, number];
433
521
  readonly prepareCreateSubAccount: (a: number, b: number, c: any) => [number, number, number];
434
522
  readonly prepareFaucet: (a: any) => [number, number, number];
@@ -441,9 +529,13 @@ export interface InitOutput {
441
529
  readonly prepareOrder: (a: any, b: any) => [number, number, number];
442
530
  readonly prepareRemoveSubAccount: (a: number, b: number, c: any) => [number, number, number];
443
531
  readonly prepareRenameSubAccount: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
532
+ readonly prepareRevokeBuilderCode: (a: number, b: number, c: any) => [number, number, number];
444
533
  readonly prepareTransfer: (a: number, b: number, c: number, d: number, e: number, f: any) => [number, number, number];
534
+ readonly prepareUpdateLiquidatorConfig: (a: any, b: any) => [number, number, number];
445
535
  readonly prepareUpdateMultisigPolicy: (a: number, b: number, c: any, d: number, e: any) => [number, number, number];
446
536
  readonly prepareUpdateUserSettings: (a: any, b: any) => [number, number, number];
537
+ readonly prepareWithdraw: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: any) => [number, number, number];
538
+ readonly prepareWithdrawLockRecover: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
447
539
  readonly randomHash: () => [number, number];
448
540
  readonly validateHash: (a: number, b: number) => number;
449
541
  readonly validatePubkey: (a: number, b: number) => number;
@@ -476,6 +568,8 @@ export interface InitOutput {
476
568
  readonly wasmsigner_sign: (a: number, b: any, c: number, d: number) => [number, number, number];
477
569
  readonly wasmsigner_signAgentWallet: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
478
570
  readonly wasmsigner_signAll: (a: number, b: any, c: number, d: number) => [number, number, number];
571
+ readonly wasmsigner_signApproveBuilderCode: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
572
+ readonly wasmsigner_signBytes: (a: number, b: number, c: number) => [number, number];
479
573
  readonly wasmsigner_signCreateMultisig: (a: number, b: any, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
480
574
  readonly wasmsigner_signCreateSubAccount: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
481
575
  readonly wasmsigner_signFaucet: (a: number, b: number, c: number) => [number, number, number];
@@ -487,16 +581,23 @@ export interface InitOutput {
487
581
  readonly wasmsigner_signMultisigReject: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
488
582
  readonly wasmsigner_signOraclePrices: (a: number, b: any, c: number, d: number) => [number, number, number];
489
583
  readonly wasmsigner_signOrdersBatch: (a: number, b: any, c: number, d: number) => [number, number, number];
584
+ readonly wasmsigner_signPrepared: (a: number, b: number) => [number, number, number];
490
585
  readonly wasmsigner_signPythOracle: (a: number, b: any, c: number, d: number) => [number, number, number];
491
586
  readonly wasmsigner_signRemoveSubAccount: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
492
587
  readonly wasmsigner_signRenameSubAccount: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
588
+ readonly wasmsigner_signRevokeBuilderCode: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
493
589
  readonly wasmsigner_signTransfer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
590
+ readonly wasmsigner_signUpdateLiquidatorConfig: (a: number, b: any, c: number, d: number) => [number, number, number];
494
591
  readonly wasmsigner_signUpdateMultisigPolicy: (a: number, b: number, c: number, d: any, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
495
592
  readonly wasmsigner_signUserSettings: (a: number, b: any, c: number, d: number) => [number, number, number];
496
593
  readonly wasmsigner_signWhitelistFaucet: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
497
594
  readonly wasmsigner_withNonceManager: (a: number, b: number, c: number) => [number, number, number];
498
595
  readonly init: () => void;
596
+ readonly wasmsigner_signApproveCommissionFee: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
597
+ readonly prepareApproveCommissionFee: (a: number, b: number, c: number, d: any) => [number, number, number];
598
+ readonly prepareRevokeCommissionFee: (a: number, b: number, c: any) => [number, number, number];
499
599
  readonly wasmsigner_signOrder: (a: number, b: any, c: number, d: number) => [number, number, number];
600
+ readonly wasmsigner_signRevokeCommissionFee: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
500
601
  readonly __wbindgen_malloc: (a: number, b: number) => number;
501
602
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
502
603
  readonly __wbindgen_exn_store: (a: number) => void;
@@ -427,6 +427,57 @@ export class WasmSigner {
427
427
  }
428
428
  return takeFromExternrefTable0(ret[0]);
429
429
  }
430
+ /**
431
+ * Sign builder-code recipient approval (`abc`)
432
+ * @param {string} to_pubkey
433
+ * @param {number} fee
434
+ * @param {number | null} [nonce]
435
+ * @returns {any}
436
+ */
437
+ signApproveBuilderCode(to_pubkey, fee, nonce) {
438
+ const ptr0 = passStringToWasm0(to_pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
439
+ const len0 = WASM_VECTOR_LEN;
440
+ const ret = wasm.wasmsigner_signApproveBuilderCode(this.__wbg_ptr, ptr0, len0, fee, !isLikeNone(nonce), isLikeNone(nonce) ? 0 : nonce);
441
+ if (ret[2]) {
442
+ throw takeFromExternrefTable0(ret[1]);
443
+ }
444
+ return takeFromExternrefTable0(ret[0]);
445
+ }
446
+ /**
447
+ * Sign builder-code recipient approval (`abc`)
448
+ * @param {string} to_pubkey
449
+ * @param {number} fee
450
+ * @param {number | null} [nonce]
451
+ * @returns {any}
452
+ */
453
+ signApproveCommissionFee(to_pubkey, fee, nonce) {
454
+ const ptr0 = passStringToWasm0(to_pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
455
+ const len0 = WASM_VECTOR_LEN;
456
+ const ret = wasm.wasmsigner_signApproveCommissionFee(this.__wbg_ptr, ptr0, len0, fee, !isLikeNone(nonce), isLikeNone(nonce) ? 0 : nonce);
457
+ if (ret[2]) {
458
+ throw takeFromExternrefTable0(ret[1]);
459
+ }
460
+ return takeFromExternrefTable0(ret[0]);
461
+ }
462
+ /**
463
+ * Sign raw message bytes and return a base58 Ed25519 signature.
464
+ * @param {Uint8Array} message
465
+ * @returns {string}
466
+ */
467
+ signBytes(message) {
468
+ let deferred2_0;
469
+ let deferred2_1;
470
+ try {
471
+ const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
472
+ const len0 = WASM_VECTOR_LEN;
473
+ const ret = wasm.wasmsigner_signBytes(this.__wbg_ptr, ptr0, len0);
474
+ deferred2_0 = ret[0];
475
+ deferred2_1 = ret[1];
476
+ return getStringFromWasm0(ret[0], ret[1]);
477
+ } finally {
478
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
479
+ }
480
+ }
430
481
  /**
431
482
  * Sign a multisig creation
432
483
  * @param {any} signers
@@ -603,6 +654,22 @@ export class WasmSigner {
603
654
  }
604
655
  return takeFromExternrefTable0(ret[0]);
605
656
  }
657
+ /**
658
+ * Sign a prepared message and finalize it into a signed transaction.
659
+ *
660
+ * This supports agent-wallet flows where prepared.account is the trading
661
+ * account and prepared.signer is this signer's pubkey.
662
+ * @param {WasmPreparedMessage} prepared
663
+ * @returns {any}
664
+ */
665
+ signPrepared(prepared) {
666
+ _assertClass(prepared, WasmPreparedMessage);
667
+ const ret = wasm.wasmsigner_signPrepared(this.__wbg_ptr, prepared.__wbg_ptr);
668
+ if (ret[2]) {
669
+ throw takeFromExternrefTable0(ret[1]);
670
+ }
671
+ return takeFromExternrefTable0(ret[0]);
672
+ }
606
673
  /**
607
674
  * Sign a batch Pyth oracle update (`o`)
608
675
  * @param {any} oracles
@@ -656,6 +723,36 @@ export class WasmSigner {
656
723
  }
657
724
  return takeFromExternrefTable0(ret[0]);
658
725
  }
726
+ /**
727
+ * Sign builder-code recipient revocation (`rbc`)
728
+ * @param {string} to_pubkey
729
+ * @param {number | null} [nonce]
730
+ * @returns {any}
731
+ */
732
+ signRevokeBuilderCode(to_pubkey, nonce) {
733
+ const ptr0 = passStringToWasm0(to_pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
734
+ const len0 = WASM_VECTOR_LEN;
735
+ const ret = wasm.wasmsigner_signRevokeBuilderCode(this.__wbg_ptr, ptr0, len0, !isLikeNone(nonce), isLikeNone(nonce) ? 0 : nonce);
736
+ if (ret[2]) {
737
+ throw takeFromExternrefTable0(ret[1]);
738
+ }
739
+ return takeFromExternrefTable0(ret[0]);
740
+ }
741
+ /**
742
+ * Sign builder-code recipient revocation (`rbc`)
743
+ * @param {string} to_pubkey
744
+ * @param {number | null} [nonce]
745
+ * @returns {any}
746
+ */
747
+ signRevokeCommissionFee(to_pubkey, nonce) {
748
+ const ptr0 = passStringToWasm0(to_pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
749
+ const len0 = WASM_VECTOR_LEN;
750
+ const ret = wasm.wasmsigner_signRevokeCommissionFee(this.__wbg_ptr, ptr0, len0, !isLikeNone(nonce), isLikeNone(nonce) ? 0 : nonce);
751
+ if (ret[2]) {
752
+ throw takeFromExternrefTable0(ret[1]);
753
+ }
754
+ return takeFromExternrefTable0(ret[0]);
755
+ }
659
756
  /**
660
757
  * Sign a margin transfer between accounts
661
758
  *
@@ -684,6 +781,19 @@ export class WasmSigner {
684
781
  }
685
782
  return takeFromExternrefTable0(ret[0]);
686
783
  }
784
+ /**
785
+ * Sign a liquidator config update (`liq`)
786
+ * @param {any} config
787
+ * @param {number | null} [nonce]
788
+ * @returns {any}
789
+ */
790
+ signUpdateLiquidatorConfig(config, nonce) {
791
+ const ret = wasm.wasmsigner_signUpdateLiquidatorConfig(this.__wbg_ptr, config, !isLikeNone(nonce), isLikeNone(nonce) ? 0 : nonce);
792
+ if (ret[2]) {
793
+ throw takeFromExternrefTable0(ret[1]);
794
+ }
795
+ return takeFromExternrefTable0(ret[0]);
796
+ }
687
797
  /**
688
798
  * Sign a multisig policy update
689
799
  * @param {string} multisig
@@ -849,6 +959,44 @@ export function prepareAll(orders, options) {
849
959
  return v1;
850
960
  }
851
961
 
962
+ /**
963
+ * Prepare builder-code recipient approval for external signing
964
+ * @param {string} to_pubkey
965
+ * @param {number} fee
966
+ * @param {any} options
967
+ * @returns {WasmPreparedMessage}
968
+ */
969
+ export function prepareApproveBuilderCode(to_pubkey, fee, options) {
970
+ const ptr0 = passStringToWasm0(to_pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
971
+ const len0 = WASM_VECTOR_LEN;
972
+ const ret = wasm.prepareApproveBuilderCode(ptr0, len0, fee, options);
973
+ if (ret[2]) {
974
+ throw takeFromExternrefTable0(ret[1]);
975
+ }
976
+ return WasmPreparedMessage.__wrap(ret[0]);
977
+ }
978
+
979
+ /**
980
+ * Prepare builder-code recipient approval for external signing
981
+ *
982
+ * @param toPubkey - Builder-code recipient public key
983
+ * @param fee - Maximum builder-code fee in bps
984
+ * @param options - { account: string, signer?: string, nonce?: number }
985
+ * @param {string} to_pubkey
986
+ * @param {number} fee
987
+ * @param {any} options
988
+ * @returns {WasmPreparedMessage}
989
+ */
990
+ export function prepareApproveCommissionFee(to_pubkey, fee, options) {
991
+ const ptr0 = passStringToWasm0(to_pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
992
+ const len0 = WASM_VECTOR_LEN;
993
+ const ret = wasm.prepareApproveCommissionFee(ptr0, len0, fee, options);
994
+ if (ret[2]) {
995
+ throw takeFromExternrefTable0(ret[1]);
996
+ }
997
+ return WasmPreparedMessage.__wrap(ret[0]);
998
+ }
999
+
852
1000
  /**
853
1001
  * Prepare a multisig creation for external signing
854
1002
  *
@@ -1077,6 +1225,41 @@ export function prepareRenameSubAccount(subaccount, name, options) {
1077
1225
  return WasmPreparedMessage.__wrap(ret[0]);
1078
1226
  }
1079
1227
 
1228
+ /**
1229
+ * Prepare builder-code recipient revocation for external signing
1230
+ * @param {string} to_pubkey
1231
+ * @param {any} options
1232
+ * @returns {WasmPreparedMessage}
1233
+ */
1234
+ export function prepareRevokeBuilderCode(to_pubkey, options) {
1235
+ const ptr0 = passStringToWasm0(to_pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1236
+ const len0 = WASM_VECTOR_LEN;
1237
+ const ret = wasm.prepareRevokeBuilderCode(ptr0, len0, options);
1238
+ if (ret[2]) {
1239
+ throw takeFromExternrefTable0(ret[1]);
1240
+ }
1241
+ return WasmPreparedMessage.__wrap(ret[0]);
1242
+ }
1243
+
1244
+ /**
1245
+ * Prepare builder-code recipient revocation for external signing
1246
+ *
1247
+ * @param toPubkey - Builder-code recipient public key
1248
+ * @param options - { account: string, signer?: string, nonce?: number }
1249
+ * @param {string} to_pubkey
1250
+ * @param {any} options
1251
+ * @returns {WasmPreparedMessage}
1252
+ */
1253
+ export function prepareRevokeCommissionFee(to_pubkey, options) {
1254
+ const ptr0 = passStringToWasm0(to_pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1255
+ const len0 = WASM_VECTOR_LEN;
1256
+ const ret = wasm.prepareRevokeCommissionFee(ptr0, len0, options);
1257
+ if (ret[2]) {
1258
+ throw takeFromExternrefTable0(ret[1]);
1259
+ }
1260
+ return WasmPreparedMessage.__wrap(ret[0]);
1261
+ }
1262
+
1080
1263
  /**
1081
1264
  * Prepare a margin transfer for external signing
1082
1265
  *
@@ -1102,6 +1285,23 @@ export function prepareTransfer(from_pubkey, to_pubkey, margin_amount, options)
1102
1285
  return WasmPreparedMessage.__wrap(ret[0]);
1103
1286
  }
1104
1287
 
1288
+ /**
1289
+ * Prepare a liquidator config update for external signing
1290
+ *
1291
+ * @param config - { crossExposure, scoringSkew, toxicity, instruments: [...] }
1292
+ * @param options - { account: string, signer?: string, nonce?: number }
1293
+ * @param {any} config
1294
+ * @param {any} options
1295
+ * @returns {WasmPreparedMessage}
1296
+ */
1297
+ export function prepareUpdateLiquidatorConfig(config, options) {
1298
+ const ret = wasm.prepareUpdateLiquidatorConfig(config, options);
1299
+ if (ret[2]) {
1300
+ throw takeFromExternrefTable0(ret[1]);
1301
+ }
1302
+ return WasmPreparedMessage.__wrap(ret[0]);
1303
+ }
1304
+
1105
1305
  /**
1106
1306
  * Prepare a multisig policy update for external signing
1107
1307
  * @param {string} multisig
@@ -1137,6 +1337,62 @@ export function prepareUpdateUserSettings(settings, options) {
1137
1337
  return WasmPreparedMessage.__wrap(ret[0]);
1138
1338
  }
1139
1339
 
1340
+ /**
1341
+ * Prepare a portfolio withdraw for external signing
1342
+ *
1343
+ * @param amount - base-unit amount to withdraw
1344
+ * @param blockhash - recent Solana blockhash (base58)
1345
+ * @param user - user wallet pubkey (base58)
1346
+ * @param vault - vault pubkey (base58)
1347
+ * @param recipientTokenAccount - recipient token account pubkey (base58)
1348
+ * @param options - { account: string, signer?: string, nonce?: number }
1349
+ * @param {number} amount
1350
+ * @param {string} blockhash
1351
+ * @param {string} user
1352
+ * @param {string} vault
1353
+ * @param {string} recipient_token_account
1354
+ * @param {any} options
1355
+ * @returns {WasmPreparedMessage}
1356
+ */
1357
+ export function prepareWithdraw(amount, blockhash, user, vault, recipient_token_account, options) {
1358
+ const ptr0 = passStringToWasm0(blockhash, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1359
+ const len0 = WASM_VECTOR_LEN;
1360
+ const ptr1 = passStringToWasm0(user, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1361
+ const len1 = WASM_VECTOR_LEN;
1362
+ const ptr2 = passStringToWasm0(vault, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1363
+ const len2 = WASM_VECTOR_LEN;
1364
+ const ptr3 = passStringToWasm0(recipient_token_account, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1365
+ const len3 = WASM_VECTOR_LEN;
1366
+ const ret = wasm.prepareWithdraw(amount, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, options);
1367
+ if (ret[2]) {
1368
+ throw takeFromExternrefTable0(ret[1]);
1369
+ }
1370
+ return WasmPreparedMessage.__wrap(ret[0]);
1371
+ }
1372
+
1373
+ /**
1374
+ * Prepare a withdraw-lock recovery for external signing
1375
+ *
1376
+ * @param user - user wallet pubkey (base58)
1377
+ * @param hash - withdrawal lock hash (base58)
1378
+ * @param options - { account: string, signer?: string, nonce?: number }
1379
+ * @param {string} user
1380
+ * @param {string} hash
1381
+ * @param {any} options
1382
+ * @returns {WasmPreparedMessage}
1383
+ */
1384
+ export function prepareWithdrawLockRecover(user, hash, options) {
1385
+ const ptr0 = passStringToWasm0(user, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1386
+ const len0 = WASM_VECTOR_LEN;
1387
+ const ptr1 = passStringToWasm0(hash, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1388
+ const len1 = WASM_VECTOR_LEN;
1389
+ const ret = wasm.prepareWithdrawLockRecover(ptr0, len0, ptr1, len1, options);
1390
+ if (ret[2]) {
1391
+ throw takeFromExternrefTable0(ret[1]);
1392
+ }
1393
+ return WasmPreparedMessage.__wrap(ret[0]);
1394
+ }
1395
+
1140
1396
  /**
1141
1397
  * Generate a random hash (for client order IDs)
1142
1398
  * @returns {string}
@@ -1180,11 +1436,11 @@ export function validatePubkey(s) {
1180
1436
  function __wbg_get_imports() {
1181
1437
  const import0 = {
1182
1438
  __proto__: null,
1183
- __wbg_Error_bce6d499ff0a4aff: function(arg0, arg1) {
1439
+ __wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
1184
1440
  const ret = Error(getStringFromWasm0(arg0, arg1));
1185
1441
  return ret;
1186
1442
  },
1187
- __wbg_Number_b7972a139bfbfdf0: function(arg0) {
1443
+ __wbg_Number_9a4e0ecb0fa16705: function(arg0) {
1188
1444
  const ret = Number(arg0);
1189
1445
  return ret;
1190
1446
  },
@@ -1195,64 +1451,64 @@ function __wbg_get_imports() {
1195
1451
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1196
1452
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1197
1453
  },
1198
- __wbg___wbindgen_bigint_get_as_i64_410e28c7b761ad83: function(arg0, arg1) {
1454
+ __wbg___wbindgen_bigint_get_as_i64_d968e41184ae354f: function(arg0, arg1) {
1199
1455
  const v = arg1;
1200
1456
  const ret = typeof(v) === 'bigint' ? v : undefined;
1201
1457
  getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1202
1458
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1203
1459
  },
1204
- __wbg___wbindgen_boolean_get_2304fb8c853028c8: function(arg0) {
1460
+ __wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
1205
1461
  const v = arg0;
1206
1462
  const ret = typeof(v) === 'boolean' ? v : undefined;
1207
1463
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1208
1464
  },
1209
- __wbg___wbindgen_debug_string_edece8177ad01481: function(arg0, arg1) {
1465
+ __wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
1210
1466
  const ret = debugString(arg1);
1211
1467
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1212
1468
  const len1 = WASM_VECTOR_LEN;
1213
1469
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1214
1470
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1215
1471
  },
1216
- __wbg___wbindgen_in_07056af4f902c445: function(arg0, arg1) {
1472
+ __wbg___wbindgen_in_aca499c5de7ff5e5: function(arg0, arg1) {
1217
1473
  const ret = arg0 in arg1;
1218
1474
  return ret;
1219
1475
  },
1220
- __wbg___wbindgen_is_bigint_aeae3893f30ed54e: function(arg0) {
1476
+ __wbg___wbindgen_is_bigint_2f76dc55065b4273: function(arg0) {
1221
1477
  const ret = typeof(arg0) === 'bigint';
1222
1478
  return ret;
1223
1479
  },
1224
- __wbg___wbindgen_is_function_5cd60d5cf78b4eef: function(arg0) {
1480
+ __wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
1225
1481
  const ret = typeof(arg0) === 'function';
1226
1482
  return ret;
1227
1483
  },
1228
- __wbg___wbindgen_is_object_b4593df85baada48: function(arg0) {
1484
+ __wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
1229
1485
  const val = arg0;
1230
1486
  const ret = typeof(val) === 'object' && val !== null;
1231
1487
  return ret;
1232
1488
  },
1233
- __wbg___wbindgen_is_string_dde0fd9020db4434: function(arg0) {
1489
+ __wbg___wbindgen_is_string_ea5e6cc2e4141dfe: function(arg0) {
1234
1490
  const ret = typeof(arg0) === 'string';
1235
1491
  return ret;
1236
1492
  },
1237
- __wbg___wbindgen_is_undefined_35bb9f4c7fd651d5: function(arg0) {
1493
+ __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
1238
1494
  const ret = arg0 === undefined;
1239
1495
  return ret;
1240
1496
  },
1241
- __wbg___wbindgen_jsval_eq_c0ed08b3e0f393b9: function(arg0, arg1) {
1497
+ __wbg___wbindgen_jsval_eq_e659fcf7b0e32763: function(arg0, arg1) {
1242
1498
  const ret = arg0 === arg1;
1243
1499
  return ret;
1244
1500
  },
1245
- __wbg___wbindgen_jsval_loose_eq_0ad77b7717db155c: function(arg0, arg1) {
1501
+ __wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function(arg0, arg1) {
1246
1502
  const ret = arg0 == arg1;
1247
1503
  return ret;
1248
1504
  },
1249
- __wbg___wbindgen_number_get_f73a1244370fcc2c: function(arg0, arg1) {
1505
+ __wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) {
1250
1506
  const obj = arg1;
1251
1507
  const ret = typeof(obj) === 'number' ? obj : undefined;
1252
1508
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1253
1509
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1254
1510
  },
1255
- __wbg___wbindgen_string_get_d109740c0d18f4d7: function(arg0, arg1) {
1511
+ __wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
1256
1512
  const obj = arg1;
1257
1513
  const ret = typeof(obj) === 'string' ? obj : undefined;
1258
1514
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -1260,14 +1516,14 @@ function __wbg_get_imports() {
1260
1516
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1261
1517
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1262
1518
  },
1263
- __wbg___wbindgen_throw_9c31b086c2b26051: function(arg0, arg1) {
1519
+ __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
1264
1520
  throw new Error(getStringFromWasm0(arg0, arg1));
1265
1521
  },
1266
- __wbg_call_13665d9f14390edc: function() { return handleError(function (arg0, arg1) {
1522
+ __wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
1267
1523
  const ret = arg0.call(arg1);
1268
1524
  return ret;
1269
1525
  }, arguments); },
1270
- __wbg_call_dfde26266607c996: function() { return handleError(function (arg0, arg1, arg2) {
1526
+ __wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
1271
1527
  const ret = arg0.call(arg1, arg2);
1272
1528
  return ret;
1273
1529
  }, arguments); },
@@ -1275,11 +1531,11 @@ function __wbg_get_imports() {
1275
1531
  const ret = arg0.crypto;
1276
1532
  return ret;
1277
1533
  },
1278
- __wbg_done_54b8da57023b7ed2: function(arg0) {
1534
+ __wbg_done_89b2b13e91a60321: function(arg0) {
1279
1535
  const ret = arg0.done;
1280
1536
  return ret;
1281
1537
  },
1282
- __wbg_entries_564a7e8b1e54ede5: function(arg0) {
1538
+ __wbg_entries_015dc610cd81ede0: function(arg0) {
1283
1539
  const ret = Object.entries(arg0);
1284
1540
  return ret;
1285
1541
  },
@@ -1297,15 +1553,15 @@ function __wbg_get_imports() {
1297
1553
  __wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
1298
1554
  arg0.getRandomValues(arg1);
1299
1555
  }, arguments); },
1300
- __wbg_get_3e9a707ab7d352eb: function() { return handleError(function (arg0, arg1) {
1301
- const ret = Reflect.get(arg0, arg1);
1302
- return ret;
1303
- }, arguments); },
1304
- __wbg_get_98fdf51d029a75eb: function(arg0, arg1) {
1556
+ __wbg_get_507a50627bffa49b: function(arg0, arg1) {
1305
1557
  const ret = arg0[arg1 >>> 0];
1306
1558
  return ret;
1307
1559
  },
1308
- __wbg_get_unchecked_1dfe6d05ad91d9b7: function(arg0, arg1) {
1560
+ __wbg_get_c7eb1f358a7654df: function() { return handleError(function (arg0, arg1) {
1561
+ const ret = Reflect.get(arg0, arg1);
1562
+ return ret;
1563
+ }, arguments); },
1564
+ __wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
1309
1565
  const ret = arg0[arg1 >>> 0];
1310
1566
  return ret;
1311
1567
  },
@@ -1313,7 +1569,7 @@ function __wbg_get_imports() {
1313
1569
  const ret = arg0[arg1];
1314
1570
  return ret;
1315
1571
  },
1316
- __wbg_instanceof_ArrayBuffer_53db37b06f6b9afe: function(arg0) {
1572
+ __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
1317
1573
  let result;
1318
1574
  try {
1319
1575
  result = arg0 instanceof ArrayBuffer;
@@ -1323,7 +1579,7 @@ function __wbg_get_imports() {
1323
1579
  const ret = result;
1324
1580
  return ret;
1325
1581
  },
1326
- __wbg_instanceof_Map_16f217b9a2a08d8c: function(arg0) {
1582
+ __wbg_instanceof_Map_e5b5e3db98422fcc: function(arg0) {
1327
1583
  let result;
1328
1584
  try {
1329
1585
  result = arg0 instanceof Map;
@@ -1333,7 +1589,7 @@ function __wbg_get_imports() {
1333
1589
  const ret = result;
1334
1590
  return ret;
1335
1591
  },
1336
- __wbg_instanceof_Uint8Array_abd07d4bd221d50b: function(arg0) {
1592
+ __wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
1337
1593
  let result;
1338
1594
  try {
1339
1595
  result = arg0 instanceof Uint8Array;
@@ -1343,23 +1599,23 @@ function __wbg_get_imports() {
1343
1599
  const ret = result;
1344
1600
  return ret;
1345
1601
  },
1346
- __wbg_isArray_94898ed3aad6947b: function(arg0) {
1602
+ __wbg_isArray_0677c962b281d01a: function(arg0) {
1347
1603
  const ret = Array.isArray(arg0);
1348
1604
  return ret;
1349
1605
  },
1350
- __wbg_isSafeInteger_01e964d144ad3a55: function(arg0) {
1606
+ __wbg_isSafeInteger_04f36e4056f1b851: function(arg0) {
1351
1607
  const ret = Number.isSafeInteger(arg0);
1352
1608
  return ret;
1353
1609
  },
1354
- __wbg_iterator_1441b47f341dc34f: function() {
1610
+ __wbg_iterator_6f722e4a93058b71: function() {
1355
1611
  const ret = Symbol.iterator;
1356
1612
  return ret;
1357
1613
  },
1358
- __wbg_length_2591a0f4f659a55c: function(arg0) {
1614
+ __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
1359
1615
  const ret = arg0.length;
1360
1616
  return ret;
1361
1617
  },
1362
- __wbg_length_56fcd3e2b7e0299d: function(arg0) {
1618
+ __wbg_length_370319915dc99107: function(arg0) {
1363
1619
  const ret = arg0.length;
1364
1620
  return ret;
1365
1621
  },
@@ -1367,35 +1623,35 @@ function __wbg_get_imports() {
1367
1623
  const ret = arg0.msCrypto;
1368
1624
  return ret;
1369
1625
  },
1370
- __wbg_new_02d162bc6cf02f60: function() {
1371
- const ret = new Object();
1372
- return ret;
1373
- },
1374
- __wbg_new_070df68d66325372: function() {
1375
- const ret = new Map();
1376
- return ret;
1377
- },
1378
1626
  __wbg_new_227d7c05414eb861: function() {
1379
1627
  const ret = new Error();
1380
1628
  return ret;
1381
1629
  },
1382
- __wbg_new_310879b66b6e95e1: function() {
1630
+ __wbg_new_32b398fb48b6d94a: function() {
1383
1631
  const ret = new Array();
1384
1632
  return ret;
1385
1633
  },
1386
- __wbg_new_7ddec6de44ff8f5d: function(arg0) {
1634
+ __wbg_new_7796ffc7ed656783: function() {
1635
+ const ret = new Map();
1636
+ return ret;
1637
+ },
1638
+ __wbg_new_cd45aabdf6073e84: function(arg0) {
1387
1639
  const ret = new Uint8Array(arg0);
1388
1640
  return ret;
1389
1641
  },
1390
- __wbg_new_with_length_99887c91eae4abab: function(arg0) {
1642
+ __wbg_new_da52cf8fe3429cb2: function() {
1643
+ const ret = new Object();
1644
+ return ret;
1645
+ },
1646
+ __wbg_new_with_length_e6785c33c8e4cce8: function(arg0) {
1391
1647
  const ret = new Uint8Array(arg0 >>> 0);
1392
1648
  return ret;
1393
1649
  },
1394
- __wbg_next_2a4e19f4f5083b0f: function(arg0) {
1650
+ __wbg_next_6dbf2c0ac8cde20f: function(arg0) {
1395
1651
  const ret = arg0.next;
1396
1652
  return ret;
1397
1653
  },
1398
- __wbg_next_6429a146bf756f93: function() { return handleError(function (arg0) {
1654
+ __wbg_next_71f2aa1cb3d1e37e: function() { return handleError(function (arg0) {
1399
1655
  const ret = arg0.next();
1400
1656
  return ret;
1401
1657
  }, arguments); },
@@ -1407,7 +1663,7 @@ function __wbg_get_imports() {
1407
1663
  const ret = arg0.process;
1408
1664
  return ret;
1409
1665
  },
1410
- __wbg_prototypesetcall_5f9bdc8d75e07276: function(arg0, arg1, arg2) {
1666
+ __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
1411
1667
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1412
1668
  },
1413
1669
  __wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
@@ -1417,16 +1673,16 @@ function __wbg_get_imports() {
1417
1673
  const ret = module.require;
1418
1674
  return ret;
1419
1675
  }, arguments); },
1676
+ __wbg_set_575dd786d51585f8: function(arg0, arg1, arg2) {
1677
+ const ret = arg0.set(arg1, arg2);
1678
+ return ret;
1679
+ },
1420
1680
  __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
1421
1681
  arg0[arg1] = arg2;
1422
1682
  },
1423
- __wbg_set_78ea6a19f4818587: function(arg0, arg1, arg2) {
1683
+ __wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
1424
1684
  arg0[arg1 >>> 0] = arg2;
1425
1685
  },
1426
- __wbg_set_facb7a5914e0fa39: function(arg0, arg1, arg2) {
1427
- const ret = arg0.set(arg1, arg2);
1428
- return ret;
1429
- },
1430
1686
  __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
1431
1687
  const ret = arg1.stack;
1432
1688
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -1434,27 +1690,27 @@ function __wbg_get_imports() {
1434
1690
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1435
1691
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1436
1692
  },
1437
- __wbg_static_accessor_GLOBAL_THIS_02344c9b09eb08a9: function() {
1438
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
1693
+ __wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {
1694
+ const ret = typeof global === 'undefined' ? null : global;
1439
1695
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1440
1696
  },
1441
- __wbg_static_accessor_GLOBAL_ac6d4ac874d5cd54: function() {
1442
- const ret = typeof global === 'undefined' ? null : global;
1697
+ __wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4: function() {
1698
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1443
1699
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1444
1700
  },
1445
- __wbg_static_accessor_SELF_9b2406c23aeb2023: function() {
1701
+ __wbg_static_accessor_SELF_146583524fe1469b: function() {
1446
1702
  const ret = typeof self === 'undefined' ? null : self;
1447
1703
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1448
1704
  },
1449
- __wbg_static_accessor_WINDOW_b34d2126934e16ba: function() {
1705
+ __wbg_static_accessor_WINDOW_f2829a2234d7819e: function() {
1450
1706
  const ret = typeof window === 'undefined' ? null : window;
1451
1707
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1452
1708
  },
1453
- __wbg_subarray_7c6a0da8f3b4a1ba: function(arg0, arg1, arg2) {
1709
+ __wbg_subarray_3ed232c8a6baee09: function(arg0, arg1, arg2) {
1454
1710
  const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1455
1711
  return ret;
1456
1712
  },
1457
- __wbg_value_9cc0518af87a489c: function(arg0) {
1713
+ __wbg_value_a5d5488a9589444a: function(arg0) {
1458
1714
  const ret = arg0.value;
1459
1715
  return ret;
1460
1716
  },
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "bulk-keychain-wasm",
3
3
  "type": "module",
4
4
  "description": "WASM bindings for BULK txn signing",
5
- "version": "0.1.17",
5
+ "version": "0.1.20",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/bulk-trade/bulk-keychain"
@@ -17,4 +17,4 @@
17
17
  "sideEffects": [
18
18
  "./snippets/*"
19
19
  ]
20
- }
20
+ }