UNPKG

7.36 kBTypeScriptView Raw
1import { BitGo } from '../bitgo';
2import { BaseCoin, KeychainsTriplet } from './baseCoin';
3import { NodeCallback, RequestTracer as IRequestTracer } from './types';
4import { PaginationOptions, Wallet } from './wallet';
5import * as Bluebird from 'bluebird';
6import { RequestTracer } from './internal/util';
7export interface WalletWithKeychains extends KeychainsTriplet {
8 wallet: Wallet;
9 warning?: string;
10}
11export interface GetWalletOptions {
12 allTokens?: boolean;
13 reqId?: IRequestTracer;
14 id?: string;
15}
16export interface GenerateWalletOptions {
17 label?: string;
18 passphrase?: string;
19 userKey?: string;
20 backupXpub?: string;
21 backupXpubProvider?: string;
22 passcodeEncryptionCode?: string;
23 enterprise?: string;
24 disableTransactionNotifications?: string;
25 gasPrice?: string;
26 eip1559?: {
27 maxFeePerGas: string;
28 maxPriorityFeePerGas: string;
29 };
30 walletVersion?: number;
31 disableKRSEmail?: boolean;
32 krsSpecific?: {
33 [index: string]: boolean | string | number;
34 };
35 coldDerivationSeed?: string;
36 rootPrivateKey?: string;
37}
38export interface GetWalletByAddressOptions {
39 address?: string;
40 reqId?: RequestTracer;
41}
42export interface UpdateShareOptions {
43 walletShareId?: string;
44 state?: string;
45 encryptedPrv?: string;
46}
47export interface AcceptShareOptions {
48 overrideEncryptedPrv?: string;
49 walletShareId?: string;
50 userPassword?: string;
51 newWalletPassphrase?: string;
52}
53export interface AddWalletOptions {
54 type?: string;
55 keys?: string[];
56 m?: number;
57 n?: number;
58 tags?: string[];
59 clientFlags?: string[];
60 signingKeyId?: string;
61 isCold?: boolean;
62 isCustodial?: boolean;
63 address?: string;
64 rootPub?: string;
65 rootPrivateKey?: string;
66 initializationTxs?: any;
67 disableTransactionNotifications?: boolean;
68 gasPrice?: number;
69 walletVersion?: number;
70}
71export interface ListWalletOptions extends PaginationOptions {
72 skip?: number;
73 getbalances?: boolean;
74 allTokens?: boolean;
75}
76export declare class Wallets {
77 private readonly bitgo;
78 private readonly baseCoin;
79 constructor(bitgo: BitGo, baseCoin: BaseCoin);
80 /**
81 * Get a wallet by ID (proxy for getWallet)
82 * @param params
83 * @param callback
84 */
85 get(params?: GetWalletOptions, callback?: NodeCallback<Wallet>): Bluebird<Wallet>;
86 /**
87 * List a user's wallets
88 * @param params
89 * @param callback
90 * @returns {*}
91 */
92 list(params?: ListWalletOptions, callback?: NodeCallback<{
93 wallets: Wallet[];
94 }>): Bluebird<{
95 wallets: Wallet[];
96 }>;
97 /**
98 * add
99 * Add a new wallet (advanced mode).
100 * This allows you to manually submit the keys, type, m and n of the wallet
101 * Parameters include:
102 * "label": label of the wallet to be shown in UI
103 * "m": number of keys required to unlock wallet (2)
104 * "n": number of keys available on the wallet (3)
105 * "keys": array of keychain ids
106 */
107 add(params?: AddWalletOptions, callback?: NodeCallback<any>): Bluebird<any>;
108 /**
109 * Generate a new wallet
110 * 1. Creates the user keychain locally on the client, and encrypts it with the provided passphrase
111 * 2. If no pub was provided, creates the backup keychain locally on the client, and encrypts it with the provided passphrase
112 * 3. Uploads the encrypted user and backup keychains to BitGo
113 * 4. Creates the BitGo key on the service
114 * 5. Creates the wallet on BitGo with the 3 public keys above
115 * @param params
116 * @param params.label
117 * @param params.passphrase
118 * @param params.userKey User xpub
119 * @param params.backupXpub Backup xpub
120 * @param params.backupXpubProvider
121 * @param params.enterprise
122 * @param params.disableTransactionNotifications
123 * @param params.passcodeEncryptionCode
124 * @param params.coldDerivationSeed
125 * @param params.gasPrice
126 * @param params.disableKRSEmail
127 * @param params.walletVersion
128 * @param callback
129 * @returns {*}
130 */
131 generateWallet(params?: GenerateWalletOptions, callback?: NodeCallback<WalletWithKeychains>): Bluebird<WalletWithKeychains>;
132 /**
133 * List the user's wallet shares
134 * @param params
135 * @param callback
136 */
137 listShares(params?: Record<string, unknown>, callback?: NodeCallback<any>): Bluebird<any>;
138 /**
139 * Gets a wallet share information, including the encrypted sharing keychain. requires unlock if keychain is present.
140 * @param params
141 * @param params.walletShareId - the wallet share to get information on
142 * @param callback
143 */
144 getShare(params?: {
145 walletShareId?: string;
146 }, callback?: NodeCallback<any>): Bluebird<any>;
147 /**
148 * Update a wallet share
149 * @param params.walletShareId - the wallet share to update
150 * @param params.state - the new state of the wallet share
151 * @param params
152 * @param callback
153 */
154 updateShare(params?: UpdateShareOptions, callback?: NodeCallback<any>): Bluebird<any>;
155 /**
156 * Resend a wallet share invitation email
157 * @param params
158 * @param params.walletShareId - the wallet share whose invitiation should be resent
159 * @param callback
160 */
161 resendShareInvite(params?: {
162 walletShareId?: string;
163 }, callback?: NodeCallback<any>): Bluebird<any>;
164 /**
165 * Cancel a wallet share
166 * @param params
167 * @param params.walletShareId - the wallet share to update
168 * @param callback
169 */
170 cancelShare(params?: {
171 walletShareId?: string;
172 }, callback?: NodeCallback<any>): Bluebird<any>;
173 /**
174 * Accepts a wallet share, adding the wallet to the user's list
175 * Needs a user's password to decrypt the shared key
176 *
177 * @param params
178 * @param params.walletShareId - the wallet share to accept
179 * @param params.userPassword - (required if more a keychain was shared) user's password to decrypt the shared wallet
180 * @param params.newWalletPassphrase - new wallet passphrase for saving the shared wallet prv.
181 * If left blank and a wallet with more than view permissions was shared,
182 * then the user's login password is used.
183 * @param params.overrideEncryptedPrv - set only if the prv was received out-of-band.
184 * @param callback
185 */
186 acceptShare(params?: AcceptShareOptions, callback?: NodeCallback<any>): Bluebird<any>;
187 /**
188 * Get a wallet by its ID
189 * @param params
190 * @param params.id wallet id
191 * @param callback
192 * @returns {*}
193 */
194 getWallet(params?: GetWalletOptions, callback?: NodeCallback<Wallet>): Bluebird<Wallet>;
195 /**
196 * Get a wallet by its address
197 * @param params
198 * @param params.address wallet address
199 * @param callback
200 * @returns {*}
201 */
202 getWalletByAddress(params?: GetWalletByAddressOptions, callback?: NodeCallback<Wallet>): Bluebird<Wallet>;
203 /**
204 * For any given supported coin, get total balances for all wallets of that
205 * coin type on the account.
206 * @param params
207 * @param callback
208 * @returns {*}
209 */
210 getTotalBalances(params?: Record<string, never>, callback?: NodeCallback<any>): Bluebird<any>;
211}
212//# sourceMappingURL=wallets.d.ts.map
\No newline at end of file