UNPKG

42.2 kBTypeScriptView Raw
1import * as Bluebird from 'bluebird';
2import { BitGo } from '../bitgo';
3import { BaseCoin, SignedTransaction, TransactionPrebuild, VerificationOptions } from './baseCoin';
4import { Keychain } from './keychains';
5import { TradingAccount } from './trading/tradingAccount';
6import { NodeCallback } from './types';
7import { PendingApproval, PendingApprovalData } from './pendingApproval';
8import { RequestTracer } from './internal/util';
9export interface MaximumSpendableOptions {
10 minValue?: number;
11 maxValue?: number;
12 minHeight?: number;
13 minConfirms?: number;
14 enforceMinConfirmsForChange?: boolean;
15 feeRate?: number;
16 maxFeeRate?: number;
17 recipientAddress?: string;
18 limit?: number;
19 target?: number;
20 plainTarget?: number;
21}
22export interface MaximumSpendable {
23 maximumSpendable: number;
24 coin: string;
25}
26export interface Memo {
27 value: string;
28 type: string;
29}
30/**
31 * A small set of parameters should be used for building a consolidation transaction:
32 * - walletPassphrase - necessary for signing
33 * - feeRate
34 * - maxFeeRate
35 * - validFromBlock
36 * - validToBlock
37 *
38 * What shouldn't be passed (these will be ignored):
39 * - recipients
40 */
41export interface BuildConsolidationTransactionOptions extends PrebuildTransactionOptions {
42 consolidateAddresses?: string[];
43}
44export interface PrebuildTransactionOptions {
45 reqId?: RequestTracer;
46 recipients?: {
47 address: string;
48 amount: string | number;
49 }[];
50 numBlocks?: number;
51 feeRate?: number;
52 maxFeeRate?: number;
53 minConfirms?: number;
54 enforceMinConfirmsForChange?: boolean;
55 targetWalletUnspents?: number;
56 minValue?: number;
57 maxValue?: number;
58 sequenceId?: string;
59 lastLedgerSequence?: number;
60 ledgerSequenceDelta?: number;
61 gasPrice?: number;
62 noSplitChange?: boolean;
63 unspents?: any[];
64 changeAddress?: string;
65 type?: string;
66 closeRemainderTo?: string;
67 nonParticipation?: boolean;
68 validFromBlock?: number;
69 validToBlock?: number;
70 instant?: boolean;
71 memo?: Memo;
72 addressType?: string;
73 hop?: boolean;
74 walletPassphrase?: string;
75 reservation?: {
76 expireTime?: string;
77 pendingApprovalId?: string;
78 };
79 offlineVerification?: boolean;
80 walletContractAddress?: string;
81 [index: string]: unknown;
82}
83export interface PrebuildAndSignTransactionOptions extends PrebuildTransactionOptions {
84 prebuildTx?: string | PrebuildTransactionResult;
85 verification?: VerificationOptions;
86}
87export interface PrebuildTransactionResult extends TransactionPrebuild {
88 walletId: string;
89 consolidateId?: string;
90}
91export interface WalletSignTransactionOptions {
92 txPrebuild?: TransactionPrebuild;
93 prv?: string;
94 userKeychain?: Keychain;
95 backupKeychain?: Keychain;
96 bitgoKeychain?: Keychain;
97 isLastSignature?: boolean;
98 [index: string]: unknown;
99}
100export interface GetUserPrvOptions {
101 keychain?: Keychain;
102 key?: Keychain;
103 prv?: string;
104 coldDerivationSeed?: string;
105 walletPassphrase?: string;
106}
107export interface WalletCoinSpecific {
108 tokenFlushThresholds?: any;
109 addressVersion?: number;
110 baseAddress?: string;
111 rootAddress?: string;
112 customChangeWalletId: string;
113}
114export interface PaginationOptions {
115 prevId?: string;
116 limit?: number;
117}
118export interface GetTransactionOptions extends PaginationOptions {
119 txHash?: string;
120}
121export interface TransfersOptions extends PaginationOptions {
122 txHash?: string;
123 allTokens?: string;
124 searchLabel?: string;
125 address?: string[] | string;
126 dateGte?: string;
127 dateLt?: string;
128 valueGte?: string;
129 valueLt?: string;
130 includeHex?: boolean;
131 state?: string[] | string;
132 type?: string;
133}
134export interface GetTransferOptions {
135 id?: string;
136}
137export interface TransferBySequenceIdOptions {
138 sequenceId?: string;
139}
140export interface UnspentsOptions extends PaginationOptions {
141 minValue?: number;
142 maxValue?: number;
143 minHeight?: number;
144 minConfirms?: number;
145 target?: number;
146 segwit?: boolean;
147 chains?: number[];
148}
149export interface ConsolidateUnspentsOptions {
150 walletPassphrase?: string;
151 xprv?: string;
152 minValue?: number;
153 maxValue?: number;
154 minHeight?: number;
155 numUnspentsToMake?: number;
156 feeTxConfirmTarget?: number;
157 limit?: number;
158 minConfirms?: number;
159 enforceMinConfirmsForChange?: boolean;
160 feeRate?: number;
161 maxFeeRate?: number;
162 maxFeePercentage?: number;
163 comment?: string;
164 otp?: string;
165 targetAddress?: string;
166 [index: string]: unknown;
167}
168export interface FanoutUnspentsOptions {
169 walletPassphrase?: string;
170 xprv?: string;
171 minValue?: number;
172 maxValue?: number;
173 minHeight?: number;
174 maxNumInputsToUse?: number;
175 numUnspentsToMake?: number;
176 minConfirms?: number;
177 enforceMinConfirmsForChange?: boolean;
178 feeRate?: number;
179 maxFeeRate?: number;
180 maxFeePercentage?: number;
181 feeTxConfirmTarget?: number;
182 comment?: string;
183 otp?: string;
184 targetAddress?: string;
185 [index: string]: unknown;
186}
187export interface SweepOptions {
188 address?: string;
189 walletPassphrase?: string;
190 xprv?: string;
191 otp?: string;
192 feeRate?: number;
193 maxFeeRate?: number;
194 feeTxConfirmTarget?: number;
195 allowPartialSweep?: boolean;
196 [index: string]: unknown;
197}
198export interface FreezeOptions {
199 duration?: number;
200}
201export interface TransferCommentOptions {
202 id?: string;
203 comment?: string;
204}
205export interface AddressesOptions extends PaginationOptions {
206 mine?: boolean;
207 sort?: number;
208 labelContains?: string;
209 segwit?: boolean;
210 chains?: number[];
211}
212export interface GetAddressOptions {
213 address?: string;
214 id?: string;
215 reqId?: RequestTracer;
216}
217export interface CreateAddressOptions {
218 chain?: number;
219 gasPrice?: number | string;
220 count?: number;
221 label?: string;
222 lowPriority?: boolean;
223 forwarderVersion?: number;
224 format?: 'base58' | 'cashaddr';
225}
226export interface UpdateAddressOptions {
227 label?: string;
228 address?: string;
229}
230export interface SimulateWebhookOptions {
231 webhookId?: string;
232 transferId?: string;
233 pendingApprovalId?: string;
234}
235export interface ModifyWebhookOptions {
236 url?: string;
237 type?: string;
238}
239export interface GetPrvOptions {
240 prv?: string;
241 walletPassphrase?: string;
242}
243export interface CreateShareOptions {
244 user?: string;
245 permissions?: string;
246 keychain?: {
247 pub?: string;
248 encryptedPrv?: string;
249 fromPubKey?: string;
250 toPubKey?: string;
251 path?: string;
252 };
253 reshare?: boolean;
254 message?: string;
255 disableEmail?: boolean;
256}
257export interface ShareWalletOptions {
258 email?: string;
259 permissions?: string;
260 walletPassphrase?: string;
261 message?: string;
262 reshare?: boolean;
263 skipKeychain?: boolean;
264 disableEmail?: boolean;
265}
266export interface RemoveUserOptions {
267 userId?: string;
268}
269export interface AccelerateTransactionOptions {
270 cpfpTxIds?: string[];
271 cpfpFeeRate?: number;
272 noCpfpFeeRate?: boolean;
273 maxFee?: number;
274 noMaxFee?: boolean;
275 recipients?: {
276 address: string;
277 amount: string;
278 }[];
279 [index: string]: unknown;
280}
281export interface SubmitTransactionOptions {
282 otp?: string;
283 txHex?: string;
284 halfSigned?: {
285 txHex?: string;
286 payload?: string;
287 txBase64?: string;
288 };
289 comment?: string;
290}
291export interface SendOptions {
292 address?: string;
293 amount?: number | string;
294 data?: string;
295 feeLimit?: string;
296 message?: string;
297 walletPassphrase?: string;
298 prv?: string;
299 minConfirms?: number;
300 enforceMinConfirmsForChange?: boolean;
301 custodianTransactionId?: string;
302 [index: string]: unknown;
303}
304export interface SendManyOptions {
305 reqId?: RequestTracer;
306 recipients?: {
307 address: string;
308 amount: string | number;
309 feeLimit?: string;
310 data?: string;
311 }[];
312 numBlocks?: number;
313 feeRate?: number;
314 maxFeeRate?: number;
315 minConfirms?: number;
316 enforceMinConfirmsForChange?: boolean;
317 targetWalletUnspents?: number;
318 message?: string;
319 minValue?: number;
320 maxValue?: number;
321 sequenceId?: string;
322 lastLedgerSequence?: number;
323 ledgerSequenceDelta?: number;
324 gasPrice?: number;
325 noSplitChange?: boolean;
326 unspents?: string[];
327 comment?: string;
328 otp?: string;
329 changeAddress?: string;
330 instant?: boolean;
331 memo?: Memo;
332 transferId?: number;
333 [index: string]: unknown;
334}
335export interface WalletData {
336 id: string;
337 approvalsRequired: number;
338 balance: number;
339 confirmedBalance: number;
340 spendableBalance: number;
341 balanceString: string;
342 confirmedBalanceString: string;
343 spendableBalanceString: string;
344 coin: string;
345 label: string;
346 keys: string[];
347 receiveAddress: {
348 address: string;
349 };
350 migratedFrom?: string;
351 coinSpecific: WalletCoinSpecific;
352 pendingApprovals: PendingApprovalData[];
353 enterprise: string;
354 customChangeKeySignatures?: {
355 user?: string;
356 backup?: string;
357 bitgo?: string;
358 };
359}
360export interface RecoverTokenOptions {
361 tokenContractAddress?: string;
362 recipient?: string;
363 broadcast?: boolean;
364 walletPassphrase?: string;
365 prv?: string;
366}
367export interface ChangeFeeOptions {
368 txid?: string;
369 fee?: string;
370}
371export interface CreatePolicyRuleOptions {
372 id?: string;
373 type?: string;
374 message?: string;
375 condition?: unknown;
376 action?: unknown;
377}
378export interface SetPolicyRuleOptions {
379 id?: string;
380 type?: string;
381 message?: string;
382 condition?: unknown;
383 action?: unknown;
384}
385export interface RemovePolicyRuleOptions {
386 id?: string;
387 message?: string;
388}
389export interface DownloadKeycardOptions {
390 jsPDF?: any;
391 QRCode?: any;
392 userKeychain?: Keychain;
393 backupKeychain?: Keychain;
394 bitgoKeychain?: Keychain;
395 passphrase?: string;
396 passcodeEncryptionCode?: string;
397 activationCode?: string;
398 walletKeyID?: string;
399 backupKeyID?: string;
400}
401export declare class Wallet {
402 readonly bitgo: BitGo;
403 readonly baseCoin: BaseCoin;
404 private _wallet;
405 private readonly _permissions?;
406 constructor(bitgo: BitGo, baseCoin: BaseCoin, walletData: any);
407 /**
408 * Build a URL using this wallet's id which can be used for BitGo API operations
409 * @param extra API specific string to append to the wallet id
410 */
411 url(extra?: string): string;
412 /**
413 * Get this wallet's id
414 */
415 id(): string;
416 /**
417 * Get the number of approvals required for spending funds from this wallet
418 */
419 approvalsRequired(): number;
420 /**
421 * Get the current balance of this wallet
422 */
423 balance(): number;
424 prebuildWhitelistedParams(): string[];
425 /**
426 * This is a strict sub-set of prebuildWhitelistedParams
427 */
428 prebuildConsolidateAccountParams(): string[];
429 /**
430 * Get the confirmed balance of this wallet
431 */
432 confirmedBalance(): number;
433 /**
434 * Get the spendable balance of this wallet
435 */
436 spendableBalance(): number;
437 /**
438 * Get a string representation of the balance of this wallet
439 *
440 * This is useful when balances have the potential to overflow standard javascript numbers
441 */
442 balanceString(): string;
443 /**
444 * Get a string representation of the confirmed balance of this wallet
445 *
446 * This is useful when balances have the potential to overflow standard javascript numbers
447 */
448 confirmedBalanceString(): string;
449 /**
450 * Get a string representation of the spendable balance of this wallet
451 *
452 * This is useful when balances have the potential to overflow standard javascript numbers
453 */
454 spendableBalanceString(): string;
455 /**
456 * Get the coin identifier for the type of coin this wallet holds
457 */
458 coin(): string;
459 /**
460 * Get the label (name) for this wallet
461 */
462 label(): string;
463 /**
464 * Get the public object ids for the keychains on this wallet.
465 */
466 keyIds(): string[];
467 /**
468 * Get a receive address for this wallet
469 */
470 receiveAddress(): string;
471 /**
472 * Get the wallet id of the wallet that this wallet was migrated from.
473 *
474 * For example, if this is a BCH wallet that was created from a BTC wallet,
475 * the BCH wallet migrated from field would have the BTC wallet id.
476 */
477 migratedFrom(): string | undefined;
478 /**
479 * Return the token flush thresholds for this wallet
480 * @return {*|Object} pairs of { [tokenName]: thresholds } base units
481 */
482 tokenFlushThresholds(): any;
483 /**
484 * Get wallet properties which are specific to certain coin implementations
485 */
486 coinSpecific(): WalletCoinSpecific | undefined;
487 /**
488 * Get all pending approvals on this wallet
489 */
490 pendingApprovals(): PendingApproval[];
491 /**
492 * Refresh the wallet object by syncing with the back-end
493 * @param params
494 * @param callback
495 * @returns {Wallet}
496 */
497 refresh(params?: Record<string, never>, callback?: NodeCallback<Wallet>): Bluebird<Wallet>;
498 /**
499 * List the transactions for a given wallet
500 * @param params
501 * @param callback
502 * @returns {*}
503 */
504 transactions(params?: PaginationOptions, callback?: NodeCallback<any>): Bluebird<any>;
505 /**
506 * List the transactions for a given wallet
507 * @param params
508 * - txHash the transaction hash to search for
509 * @param callback
510 * @returns {*}
511 */
512 getTransaction(params?: GetTransactionOptions, callback?: NodeCallback<any>): Bluebird<any>;
513 /**
514 * List the transfers for a given wallet
515 * @param params
516 * @param callback
517 * @returns {*}
518 */
519 transfers(params?: TransfersOptions, callback?: NodeCallback<any>): Bluebird<any>;
520 /**
521 * Get transfers on this wallet
522 * @param params
523 * @param callback
524 */
525 getTransfer(params?: GetTransferOptions, callback?: NodeCallback<any>): Bluebird<any>;
526 /**
527 * Get a transaction by sequence id for a given wallet
528 * @param params
529 * @param callback
530 */
531 transferBySequenceId(params?: TransferBySequenceIdOptions, callback?: NodeCallback<any>): Bluebird<any>;
532 /**
533 * Get the maximum amount you can spend in a single transaction
534 *
535 * @param {Object} params - parameters object
536 * @param {Number} params.limit - maximum number of selectable unspents
537 * @param {Number} params.minValue - the minimum value of unspents to use in satoshis
538 * @param {Number} params.maxValue - the maximum value of unspents to use in satoshis
539 * @param {Number} params.minHeight - the minimum height of unspents on the block chain to use
540 * @param {Number} params.minConfirms - all selected unspents will have at least this many confirmations
541 * @param {Boolean} params.enforceMinConfirmsForChange - Enforces minConfirms on change inputs
542 * @param {Number} params.feeRate - fee rate to use in calculation of maximum spendable in satoshis/kB
543 * @param {Number} params.maxFeeRate - upper limit for feeRate in satoshis/kB
544 * @param {String} params.recipientAddress - recipient addresses for a more accurate calculation of the maximum available to send
545 * @param callback
546 * @returns {{maximumSpendable: Number, coin: String}}
547 * NOTE : feeTxConfirmTarget omitted on purpose because gauging the maximum spendable amount with dynamic fees does not make sense
548 */
549 maximumSpendable(params?: MaximumSpendableOptions, callback?: NodeCallback<MaximumSpendable>): Bluebird<MaximumSpendable>;
550 /**
551 * List the unspents for a given wallet
552 * @param params
553 * @param callback
554 * @returns {*}
555 */
556 unspents(params?: UnspentsOptions, callback?: NodeCallback<any>): Bluebird<any>;
557 /**
558 * Consolidate or fanout unspents on a wallet
559 *
560 * @param {String} routeName - either `consolidate` or `fanout`
561 *
562 * @param {Object} params - parameters object
563 *
564 * Wallet parameters:
565 * @param {String} params.walletPassphrase - the users wallet passphrase
566 * @param {String} params.xprv - the private key in string form if the walletPassphrase is not available
567 *
568 * Fee parameters:
569 * @param {Number} params.feeRate - The fee rate to use for the consolidation in satoshis/kB
570 * @param {Number} params.maxFeeRate - upper limit for feeRate in satoshis/kB
571 * @param {Number} params.maxFeePercentage - the maximum relative portion that you're willing to spend towards fees
572 * @param {Number} params.feeTxConfirmTarget - estimate the fees to aim for first confirmation with this number of blocks
573 *
574 * Input parameters:
575 * @param {Number} params.minValue - the minimum value of unspents to use in satoshis
576 * @param {Number} params.maxValue - the maximum value of unspents to use in satoshis
577 * @param {Number} params.minHeight - the minimum height of unspents on the block chain to use
578 * @param {Number} params.minConfirms - all selected unspents will have at least this many confirmations
579 * @param {Boolean} params.enforceMinConfirmsForChange - if true, minConfirms also applies to change outputs
580 * @param {Number} params.limit for routeName === 'consolidate'
581 * params.maxNumInputsToUse for routeName === 'fanout'
582 * - maximum number of unspents you want to use in the transaction
583 * Output parameters:
584 * @param {Number} params.numUnspentsToMake - the number of new unspents to make
585 *
586 * @param callback
587 */
588 private manageUnspents;
589 /**
590 * Consolidate unspents on a wallet
591 *
592 * @param {Object} params - parameters object
593 * @param {String} params.walletPassphrase - the users wallet passphrase
594 * @param {String} params.xprv - the private key in string form if the walletPassphrase is not available
595 * @param {Number} params.feeRate - The fee rate to use for the consolidation in satoshis/kB
596 * @param {Number} params.maxFeeRate - upper limit for feeRate in satoshis/kB
597 * @param {Number} params.maxFeePercentage - the maximum relative portion that you're willing to spend towards fees
598 * @param {Number} params.feeTxConfirmTarget - estimate the fees to aim for first confirmation with this number of blocks
599 * @param {Number} params.minValue - the minimum value of unspents to use in satoshis
600 * @param {Number} params.maxValue - the maximum value of unspents to use in satoshis
601 * @param {Number} params.minHeight - the minimum height of unspents on the block chain to use
602 * @param {Number} params.minConfirms - all selected unspents will have at least this many confirmations
603 * @param {Boolean} params.enforceMinConfirmsForChange - if true, minConfirms also applies to change outputs
604 * @param {Number} params.limit for routeName === 'consolidate'
605 * params.maxNumInputsToUse for routeName === 'fanout'
606 * - maximum number of unspents you want to use in the transaction
607 * @param {Number} params.numUnspentsToMake - the number of new unspents to make
608 * @param callback
609 */
610 consolidateUnspents(params?: ConsolidateUnspentsOptions, callback?: NodeCallback<any>): Bluebird<any>;
611 /**
612 * Fanout unspents on a wallet
613 *
614 * @param {Object} params - parameters object
615 * @param {String} params.walletPassphrase - the users wallet passphrase
616 * @param {String} params.xprv - the private key in string form if the walletPassphrase is not available
617 * @param {Number} params.minValue - the minimum value of unspents to use
618 * @param {Number} params.maxValue - the maximum value of unspents to use
619 * @param {Number} params.minHeight - the minimum height of unspents on the block chain to use
620 * @param {Number} params.minConfirms - all selected unspents will have at least this many confirmations
621 * @param {Number} params.maxFeePercentage - the maximum proportion of an unspent you are willing to lose to fees
622 * @param {Number} params.feeTxConfirmTarget - estimate the fees to aim for first confirmation with this number of blocks
623 * @param {Number} params.feeRate - The desired fee rate for the transaction in satoshis/kB
624 * @param {Number} params.maxFeeRate - The max limit for a fee rate in satoshis/kB
625 * @param {Number} params.maxNumInputsToUse - the number of unspents you want to use in the transaction
626 * @param {Number} params.numUnspentsToMake - the number of new unspents to make
627 * @param callback
628 */
629 fanoutUnspents(params?: FanoutUnspentsOptions, callback?: NodeCallback<any>): Bluebird<any>;
630 /**
631 * Set the token flush thresholds for the wallet. Updates the wallet.
632 * Tokens will only be flushed from forwarder contracts if the balance is greater than the threshold defined here.
633 * @param thresholds {Object} - pairs of { [tokenName]: threshold } (base units)
634 * @param [callback]
635 */
636 updateTokenFlushThresholds(thresholds?: any, callback?: NodeCallback<any>): Bluebird<any>;
637 /**
638 * Sweep funds for a wallet
639 *
640 * @param {Object} params - parameters object
641 * @param {String} params.address - The address to send all the funds in the wallet to
642 * @param {String} params.walletPassphrase - the users wallet passphrase
643 * @param {String} params.xprv - the private key in string form if the walletPassphrase is not available
644 * @param {String} params.otp - Two factor auth code to enable sending the transaction
645 * @param {Number} params.feeTxConfirmTarget - Estimate the fees to aim for first confirmation within this number of blocks
646 * @param {Number} params.feeRate - The desired fee rate for the transaction in satoshis/kB
647 * @param {Number} [params.maxFeeRate] - upper limit for feeRate in satoshis/kB
648 * @param {Boolean} [params.allowPartialSweep] - allows sweeping 200 unspents when the wallet has more than that
649 * @param [callback]
650 * @returns txHex {String} the txHex of the signed transaction
651 */
652 sweep(params?: SweepOptions, callback?: NodeCallback<any>): Bluebird<any>;
653 /**
654 * Freeze a given wallet
655 * @param params
656 * @param callback
657 * @returns {*}
658 */
659 freeze(params?: FreezeOptions, callback?: NodeCallback<any>): Bluebird<any>;
660 /**
661 * Update comment of a transfer
662 * @param params
663 * @param callback
664 * @returns {*}
665 */
666 transferComment(params?: TransferCommentOptions, callback?: NodeCallback<any>): Bluebird<any>;
667 /**
668 * List the addresses for a given wallet
669 * @param params
670 * @param callback
671 * @returns {*}
672 */
673 addresses(params?: AddressesOptions, callback?: NodeCallback<any>): Bluebird<any>;
674 /**
675 * Get a single wallet address by its id
676 * @param params
677 * @param callback
678 * @returns {*}
679 */
680 getAddress(params?: GetAddressOptions, callback?: NodeCallback<any>): Bluebird<any>;
681 /**
682 * Create one or more new address(es) for use with this wallet.
683 *
684 * If the `count` field is defined and greater than 1, an object with a single
685 * array property named `addresses` containing `count` address objects
686 * will be returned. Otherwise, a single address object is returned.
687 *
688 * @param params
689 * @param {Number} params.chain on which the new address should be created
690 * @param {(Number|String)} params.gasPrice gas price for new address creation, if applicable
691 * @param {String} params.label label for the new address(es)
692 * @param {String} params.label label for the new address(es)
693 * @param {Number} params.count=1 number of new addresses which should be created (maximum 250)
694 * @param {Number} params.forwarderVersion The version of address to create, if applicable
695 * @param {Boolean} params.lowPriority Ethereum-specific param to create address using low priority fee address
696 * @param callback
697 */
698 createAddress(params?: CreateAddressOptions, callback?: NodeCallback<any>): Bluebird<any>;
699 /**
700 * Update properties on an address
701 * @param params
702 * @param callback
703 * @returns {*}
704 */
705 updateAddress(params?: UpdateAddressOptions, callback?: NodeCallback<any>): Bluebird<any>;
706 /**
707 * List webhooks on this wallet
708 * @param params
709 * @param callback
710 */
711 listWebhooks(params?: PaginationOptions, callback?: NodeCallback<any>): Bluebird<any>;
712 /**
713 * Simulate wallet webhook, currently for webhooks of type transfer and pending approval
714 * @param params
715 * - webhookId (required) id of the webhook to be simulated
716 * - transferId (optional but required for transfer webhooks) id of the simulated transfer
717 * - pendingApprovalId (optional but required for pending approval webhooks) id of the simulated pending approval
718 * @param callback
719 * @returns {*}
720 */
721 simulateWebhook(params?: SimulateWebhookOptions, callback?: NodeCallback<any>): Bluebird<any>;
722 /**
723 * Add a webhook to this wallet
724 * @param params
725 * @param callback
726 */
727 addWebhook(params?: ModifyWebhookOptions, callback?: NodeCallback<any>): Bluebird<any>;
728 /**
729 * Remove a webhook from this wallet
730 * @param params
731 * @param callback
732 */
733 removeWebhook(params?: ModifyWebhookOptions, callback?: NodeCallback<any>): Bluebird<any>;
734 /**
735 * Gets the user key chain for this wallet
736 *
737 * The user key chain is the first keychain of the wallet and usually has the encrypted prv stored on BitGo.
738 * Useful when trying to get the users' keychain from the server before decrypting to sign a transaction.
739 * @param params
740 * @param callback
741 */
742 getEncryptedUserKeychain(params?: Record<string, never>, callback?: NodeCallback<any>): Bluebird<any>;
743 /**
744 * Gets the unencrypted private key for this wallet (be careful!)
745 * Requires wallet passphrase
746 *
747 * @param params
748 * @param callback
749 */
750 getPrv(params?: GetPrvOptions, callback?: NodeCallback<any>): Bluebird<any>;
751 /**
752 * Send an encrypted wallet share to BitGo.
753 * @param params
754 * @param callback
755 */
756 createShare(params?: CreateShareOptions, callback?: NodeCallback<any>): Bluebird<any>;
757 /**
758 * Share this wallet with another BitGo user.
759 * @param params
760 * @param callback
761 * @returns {*}
762 */
763 shareWallet(params?: ShareWalletOptions, callback?: NodeCallback<any>): Bluebird<any>;
764 /**
765 * Remove user from wallet
766 * @param params
767 * - userId Id of the user to remove
768 * @param callback
769 * @return {*}
770 */
771 removeUser(params?: RemoveUserOptions, callback?: NodeCallback<any>): Bluebird<any>;
772 /**
773 * Fetch a transaction prebuild (unsigned transaction) from BitGo
774 *
775 * @param {Object} params
776 * @param {{address: string, amount: string}} params.recipients - list of recipients and necessary recipient information
777 * @param {Number} params.numBlocks - Estimates the approximate fee per kilobyte necessary for a transaction confirmation within numBlocks blocks
778 * @param {Number} params.feeRate - the desired feeRate for the transaction in base units/kB
779 * @param {Number} params.maxFeeRate - upper limit for feeRate in base units/kB
780 * @param {Number} params.minConfirms - Minimum number of confirmations unspents going into this transaction should have
781 * @param {Boolean} params.enforceMinConfirmsForChange - Enforce minimum number of confirmations on change (internal) inputs.
782 * @param {Number} params.targetWalletUnspents - The desired count of unspents in the wallet. If the wallet’s current unspent count is lower than the target, up to four additional change outputs will be added to the transaction.
783 * @param {Number} params.minValue - Ignore unspents smaller than this amount of base units
784 * @param {Number} params.maxValue - Ignore unspents larger than this amount of base units
785 * @param {Number} params.sequenceId - The sequence ID of the transaction
786 * @param {Number} params.lastLedgerSequence - Absolute max ledger the transaction should be accepted in, whereafter it will be rejected.
787 * @param {Number} params.ledgerSequenceDelta - Relative ledger height (in relation to the current ledger) that the transaction should be accepted in, whereafter it will be rejected.
788 * @param {Number} params.gasPrice - Custom gas price to be used for sending the transaction
789 * @param {Number} params.gasLimit - Custom gas limit to be used for sending the transaction
790 * @param {Boolean} params.noSplitChange - Set to true to disable automatic change splitting for purposes of unspent management
791 * @param {Array} params.unspents - The unspents to use in the transaction. Each unspent should be in the form prevTxId:nOutput
792 * @param {String} params.changeAddress - Specifies the destination of the change output
793 * @param {Boolean} params.nonParticipation - (Algorand) Non participating key reg transaction
794 * @param {Number} params.validFromBlock - (Algorand) The minimum round this will run on
795 * @param {Number} params.validToBlock - (Algorand) The maximum round this will run on
796 * @param {Boolean} params.instant - Build this transaction to conform with instant sending coin-specific method (if available)
797 * @param {{value: String, type: String}} params.memo - Memo to use in transaction (supported by Stellar)
798 * @param {String} param.transferId - transfer Id to use in transaction (supported by casper)
799 * @param {String} params.addressType - The type of address to create for change. One of `p2sh`, `p2shP2wsh`, and `p2wsh`. Case-sensitive.
800 * @param {Boolean} params.hop - Build this as an Ethereum hop transaction
801 * @param {Object} params.reservation - Object to reserve the unspents that this tx build uses. Format is reservation = { expireTime: ISODateString, pendingApprovalId: String }
802 * @param {String} params.walletPassphrase The passphrase to the wallet user key, to sign commitment data for Ethereum hop transactions
803 * @param {String} params.walletContractAddress - The contract address used as the "to" field of a transaction
804 * @param callback
805 * @returns {*}
806 */
807 prebuildTransaction(params?: PrebuildTransactionOptions, callback?: NodeCallback<PrebuildTransactionResult>): Bluebird<PrebuildTransactionResult>;
808 /**
809 * Sign a transaction
810 * @param params
811 * - txPrebuild
812 * - [keychain / key] (object) or prv (string)
813 * - walletPassphrase
814 * @param callback
815 * @return {*}
816 */
817 signTransaction(params?: WalletSignTransactionOptions, callback?: NodeCallback<SignedTransaction>): Bluebird<SignedTransaction>;
818 /**
819 * Get the user private key from either a derivation or an encrypted keychain
820 * @param [params.keychain / params.key] (object) or params.prv (string)
821 * @param params.walletPassphrase (string)
822 */
823 getUserPrv(params?: GetUserPrvOptions): string;
824 /**
825 * Get a transaction prebuild from BitGo, validate it, and then decrypt the user key and sign the transaction
826 * @param params
827 * @param callback
828 */
829 prebuildAndSignTransaction(params?: PrebuildAndSignTransactionOptions, callback?: NodeCallback<SignedTransaction>): Bluebird<SignedTransaction>;
830 /**
831 * Accelerate a transaction's confirmation using Child-Pays-For-Parent (CPFP)
832 * @param params
833 * @param callback
834 */
835 accelerateTransaction(params?: AccelerateTransactionOptions, callback?: NodeCallback<any>): Bluebird<any>;
836 /**
837 * Submit a half-signed transaction to BitGo
838 * @param params
839 * - txHex: transaction hex to submit
840 * - halfSigned: object containing transaction (txHex or txBase64) to submit
841 * @param callback
842 */
843 submitTransaction(params?: SubmitTransactionOptions, callback?: NodeCallback<any>): Bluebird<any>;
844 /**
845 * Send coins to a recipient
846 * @param params
847 * @param params.address - the destination address
848 * @param params.amount - the amount in satoshis/wei/base value to be sent
849 * @param params.message - optional message to attach to transaction
850 * @param params.data - [Ethereum Specific] optional data to pass to transaction
851 * @param params.custodianTransactionId - [Ethereum/MMI Specific] id of transaction created via metamask
852 * @param params.walletPassphrase - the passphrase to be used to decrypt the user key on this wallet
853 * @param params.prv - the private key in string form, if walletPassphrase is not available
854 * @param params.minConfirms - the minimum confirmation threshold for inputs
855 * @param params.enforceMinConfirmsForChange - whether to enforce minConfirms for change inputs
856 * @param callback
857 * @returns {*}
858 */
859 send(params?: SendOptions, callback?: NodeCallback<any>): Bluebird<any>;
860 /**
861 * Send money to multiple recipients
862 * 1. Gets the user keychain by checking the wallet for a key which has an encrypted prv
863 * 2. Decrypts user key
864 * 3. Creates the transaction with default fee
865 * 4. Signs transaction with decrypted user key
866 * 5. Sends the transaction to BitGo
867 * @param {object} params
868 * @param {{address: string, amount: string}} params.recipients - list of recipients and necessary recipient information
869 * @param {Number} params.numBlocks - Estimates the approximate fee per kilobyte necessary for a transaction confirmation within numBlocks blocks
870 * @param {Number} params.feeRate - the desired feeRate for the transaction in satothis/kB
871 * @param {Number} params.maxFeeRate - upper limit for feeRate in satoshis/kB
872 * @param {Number} params.minConfirms - all selected unspents will have at least this many confirmations
873 * @param {Boolean} params.enforceMinConfirmsForChange - Enforces minConfirms on change inputs
874 * @param {Number} params.targetWalletUnspents - The desired count of unspents in the wallet
875 * @param {String} params.message - optional message to attach to transaction
876 * @param {Number} params.minValue - Ignore unspents smaller than this amount of satoshis
877 * @param {Number} params.maxValue - Ignore unspents larger than this amount of satoshis
878 * @param {Number} params.sequenceId - The sequence ID of the transaction
879 * @param {Number} params.lastLedgerSequence - Absolute max ledger the transaction should be accepted in, whereafter it will be rejected.
880 * @param {Number} params.ledgerSequenceDelta - Relative ledger height (in relation to the current ledger) that the transaction should be accepted in, whereafter it will be rejected.
881 * @param {Number} params.gasPrice - Custom gas price to be used for sending the transaction
882 * @param {Boolean} params.noSplitChange - Set to true to disable automatic change splitting for purposes of unspent management
883 * @param {Array} params.unspents - The unspents to use in the transaction. Each unspent should be in the form prevTxId:nOutput
884 * @param {String} params.comment - Any additional comment to attach to the transaction
885 * @param {String} params.otp - Two factor auth code to enable sending the transaction
886 * @param {String} params.changeAddress - Specifies the destination of the change output
887 * @param {Boolean} params.instant - Send this transaction using coin-specific instant sending method (if available)
888 * @param {{value: String, type: String}} params.memo - Memo to use in transaction (supported by Stellar)
889 * @param {String} params.type - Type of the transaction (e.g. trustline)
890 * @param {{token: params, action: String, limit: String}[]} options.trustlines - Array of trustlines to manage (supported by Stellar)
891 * @param callback
892 * @returns {*}
893 */
894 sendMany(params?: SendManyOptions, callback?: NodeCallback<any>): Bluebird<any>;
895 /**
896 * Recover an unsupported token from a BitGo multisig wallet
897 * params are validated in Eth.prototype.recoverToken
898 * @param params
899 * @param params.tokenContractAddress the contract address of the unsupported token
900 * @param params.recipient the destination address recovered tokens should be sent to
901 * @param params.walletPassphrase the wallet passphrase
902 * @param params.prv the xprv
903 * @param callback
904 */
905 recoverToken(params?: RecoverTokenOptions, callback?: NodeCallback<any>): Bluebird<any>;
906 /**
907 * Get transaction metadata for the oldest transaction that is still pending or attempted
908 * @param params
909 * @param callback
910 * @returns {Object} Object with txid, walletId, tx, and fee (if supported for coin)
911 */
912 getFirstPendingTransaction(params?: Record<string, never>, callback?: NodeCallback<any>): Bluebird<any>;
913 /**
914 * Change the fee on the pending transaction that corresponds to the given txid to the given new fee
915 * @param params
916 * @param {String} params.txid The transaction Id corresponding to the transaction whose fee is to be changed
917 * @param {String} params.fee The new fee to apply to the denoted transaction
918 * @param callback
919 * @returns {String} The transaction ID of the new transaction that contains the new fee rate
920 */
921 changeFee(params?: ChangeFeeOptions, callback?: NodeCallback<any>): Bluebird<any>;
922 /**
923 * Fetch info from merchant server
924 * @param {Object} params The params passed into the function
925 * @param {String} params.url The Url to retrieve info from
926 * @param callback
927 * @returns {Object} The info returned from the merchant server
928 * @deprecated
929 */
930 getPaymentInfo(params?: {
931 url?: string;
932 }, callback?: NodeCallback<any>): Bluebird<any>;
933 /**
934 * Send json payment response
935 * @param {Object} params The params passed into the function
936 * @param {String} params.paymentUrl - The url to send the fully signed transaction to
937 * @param {String} params.txHex - The transaction hex of the payment
938 * @param {String} params.memo {String} - A memo supplied by the merchant, to be inserted into the transfer as the comment
939 * @param {String} params.expires {String} - ISO Date format of when the payment request expires
940 * @param callback
941 * @returns {Object} The info returned from the merchant server Payment Ack
942 * @deprecated
943 */
944 sendPaymentResponse(params?: any, callback?: NodeCallback<any>): Bluebird<any>;
945 /**
946 * Create a policy rule
947 * @param params
948 * @param params.condition condition object
949 * @param params.action action object
950 * @param callback
951 * @returns {*}
952 */
953 createPolicyRule(params?: CreatePolicyRuleOptions, callback?: NodeCallback<any>): Bluebird<any>;
954 /**
955 * Update a policy rule
956 * @param params
957 * @param params.condition condition object
958 * @param params.action action object
959 * @param callback
960 * @returns {*}
961 */
962 setPolicyRule(params?: any, callback?: NodeCallback<any>): Bluebird<unknown>;
963 /**
964 * Remove Policy Rule
965 * @param params
966 * @param callback
967 * @returns {*}
968 */
969 removePolicyRule(params?: RemovePolicyRuleOptions, callback?: NodeCallback<any>): Bluebird<any>;
970 /**
971 * Remove this wallet
972 * @param params
973 * @param callback
974 * @returns {*}
975 */
976 remove(params?: Record<string, never>, callback?: NodeCallback<any>): Bluebird<any>;
977 /**
978 * Extract a JSON representable version of this wallet
979 */
980 toJSON(): WalletData;
981 /**
982 * Create a trading account from this wallet
983 */
984 toTradingAccount(): TradingAccount;
985 /**
986 * Creates and downloads PDF keycard for wallet (requires response from wallets.generateWallet)
987 *
988 * Note: this is example code and is not the version used on bitgo.com
989 *
990 * @param params
991 * * jsPDF - an instance of the jsPDF library
992 * * QRCode - an instance of the QRious library
993 * * userKeychain - a wallet's private user keychain
994 * * backupKeychain - a wallet's private backup keychain
995 * * bitgoKeychain - a wallet's private bitgo keychain
996 * * passphrase - the wallet passphrase
997 * * passcodeEncryptionCode - the encryption secret used for Box D
998 * * activationCode - a randomly generated six-digit activation code
999 * * walletKeyID - the Key ID used for deriving a cold wallet's signing key
1000 * * backupKeyID - the Key ID used for deriving a cold wallet's backup key
1001 * @returns {*}
1002 */
1003 downloadKeycard(params?: DownloadKeycardOptions): void;
1004 /**
1005 * Builds a set of consolidation transactions for a wallet.
1006 * @param params
1007 * consolidateAddresses - these are the on-chain receive addresses we want to pick a consolidation amount from
1008 * @param callback
1009 */
1010 buildAccountConsolidations(params?: BuildConsolidationTransactionOptions, callback?: NodeCallback<PrebuildTransactionResult[]>): Bluebird<PrebuildTransactionResult[]>;
1011 /**
1012 * Builds and sends a set of consolidation transactions for a wallet.
1013 * @param params
1014 * prebuildTx - this is the pre-build consolidation tx. this is a normally built tx with
1015 * an additional parameter of consolidateId.
1016 * verification - normal keychains, etc. for verification
1017 */
1018 sendAccountConsolidation(params?: PrebuildAndSignTransactionOptions, callback?: NodeCallback<any>): Bluebird<any>;
1019 /**
1020 * Builds and sends a set of account consolidations. This is intended to flush many balances to the root wallet balance.
1021 * @param params -
1022 * consolidateAddresses - these are the on-chain receive addresses we want to pick a consolidation amount from
1023 * @param callback
1024 */
1025 sendAccountConsolidations(params?: BuildConsolidationTransactionOptions, callback?: NodeCallback<any>): Bluebird<any>;
1026}
1027//# sourceMappingURL=wallet.d.ts.map
\No newline at end of file