UNPKG

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