1 |
|
2 | import * as Bluebird from 'bluebird';
|
3 | import { BitGo } from '../bitgo';
|
4 | import { NodeCallback } from './types';
|
5 | import { RequestTracer } from './internal/util';
|
6 | import { Wallet } from './wallet';
|
7 | import { Wallets } from './wallets';
|
8 | import { Markets } from './markets';
|
9 | import { Webhooks } from './webhooks';
|
10 | import { PendingApprovals } from './pendingApprovals';
|
11 | import { Keychain, Keychains } from './keychains';
|
12 | import { Enterprises } from './enterprises';
|
13 | import { BaseCoin as AccountLibBasecoin } from '@bitgo/account-lib';
|
14 | export declare type TransactionType = AccountLibBasecoin.TransactionType;
|
15 | export interface TransactionRecipient {
|
16 | address: string;
|
17 | amount: string | number;
|
18 | memo?: string;
|
19 | }
|
20 | export interface TransactionFee {
|
21 | fee: string;
|
22 | feeRate?: number;
|
23 | size?: number;
|
24 | }
|
25 | export interface TransactionExplanation {
|
26 | displayOrder: string[];
|
27 | id: string;
|
28 | outputs: TransactionRecipient[];
|
29 | outputAmount: string;
|
30 | changeOutputs: TransactionRecipient[];
|
31 | changeAmount: string;
|
32 | fee: TransactionFee;
|
33 | proxy?: string;
|
34 | producers?: string[];
|
35 | }
|
36 | export interface KeyPair {
|
37 | pub?: string;
|
38 | prv: string;
|
39 | }
|
40 | export interface VerifyAddressOptions {
|
41 | address: string;
|
42 | addressType?: string;
|
43 | keychains?: {
|
44 | pub: string;
|
45 | }[];
|
46 | error?: string;
|
47 | coinSpecific?: AddressCoinSpecific;
|
48 | }
|
49 | export interface TransactionParams {
|
50 | recipients?: TransactionRecipient[];
|
51 | walletPassphrase?: string;
|
52 | type?: string;
|
53 | }
|
54 | export interface AddressVerificationData {
|
55 | coinSpecific?: AddressCoinSpecific;
|
56 | chain?: number;
|
57 | index?: number;
|
58 | }
|
59 | export interface VerificationOptions {
|
60 | disableNetworking?: boolean;
|
61 | keychains?: {
|
62 | user?: Keychain;
|
63 | backup?: Keychain;
|
64 | bitgo?: Keychain;
|
65 | };
|
66 | addresses?: {
|
67 | [address: string]: AddressVerificationData;
|
68 | };
|
69 | allowPaygoOutput?: boolean;
|
70 | }
|
71 | export interface VerifyTransactionOptions {
|
72 | txPrebuild: TransactionPrebuild;
|
73 | txParams: TransactionParams;
|
74 | wallet: Wallet;
|
75 | verification?: VerificationOptions;
|
76 | reqId?: RequestTracer;
|
77 | }
|
78 | export interface SupplementGenerateWalletOptions {
|
79 | label: string;
|
80 | m: number;
|
81 | n: number;
|
82 | enterprise?: string;
|
83 | disableTransactionNotifications?: boolean;
|
84 | gasPrice?: number;
|
85 | walletVersion?: number;
|
86 | keys: string[];
|
87 | isCold: boolean;
|
88 | keySignatures?: {
|
89 | backup: string;
|
90 | bitgo: string;
|
91 | };
|
92 | rootPrivateKey?: string;
|
93 | disableKRSEmail?: boolean;
|
94 | }
|
95 | export interface FeeEstimateOptions {
|
96 | numBlocks?: number;
|
97 | hop?: boolean;
|
98 | recipient?: string;
|
99 | data?: string;
|
100 | amount?: string;
|
101 | }
|
102 | export interface ExtraPrebuildParamsOptions {
|
103 | [index: string]: unknown;
|
104 | }
|
105 | export interface PresignTransactionOptions {
|
106 | [index: string]: unknown;
|
107 | }
|
108 | export interface PrecreateBitGoOptions {
|
109 | [index: string]: unknown;
|
110 | }
|
111 | export interface VerifyRecoveryTransactionOptions {
|
112 | [index: string]: unknown;
|
113 | }
|
114 | export interface ParseTransactionOptions {
|
115 | [index: string]: unknown;
|
116 | }
|
117 | export interface ParsedTransaction {
|
118 | [index: string]: unknown;
|
119 | }
|
120 | export interface SignTransactionOptions {
|
121 | [index: string]: unknown;
|
122 | }
|
123 | export interface InitiateRecoveryOptions {
|
124 | userKey: string;
|
125 | backupKey: string;
|
126 | bitgoKey?: string;
|
127 | recoveryDestination: string;
|
128 | walletPassphrase?: string;
|
129 | }
|
130 | export interface KeychainsTriplet {
|
131 | userKeychain: Keychain;
|
132 | backupKeychain: Keychain;
|
133 | bitgoKeychain: Keychain;
|
134 | }
|
135 | export interface TransactionPrebuild {
|
136 | txBase64?: string;
|
137 | txHex?: string;
|
138 | wallet?: Wallet;
|
139 | buildParams?: any;
|
140 | consolidateId?: string;
|
141 | }
|
142 | export interface AddressCoinSpecific {
|
143 | outputScript?: string;
|
144 | redeemScript?: string;
|
145 | witnessScript?: string;
|
146 | baseAddress?: string;
|
147 | pendingChainInitialization?: boolean;
|
148 | }
|
149 | export interface FullySignedTransaction {
|
150 | txHex: string;
|
151 | }
|
152 | export interface HalfSignedTransaction {
|
153 | halfSigned?: {
|
154 | txHex?: string;
|
155 | payload?: string;
|
156 | txBase64?: string;
|
157 | };
|
158 | }
|
159 | export declare type SignedTransaction = HalfSignedTransaction | FullySignedTransaction;
|
160 | export declare abstract class BaseCoin {
|
161 | protected readonly bitgo: BitGo;
|
162 | protected readonly _url: string;
|
163 | protected readonly _enterprises: Enterprises;
|
164 | protected readonly _wallets: Wallets;
|
165 | protected readonly _keychains: Keychains;
|
166 | protected readonly _webhooks: Webhooks;
|
167 | protected readonly _pendingApprovals: PendingApprovals;
|
168 | protected readonly _markets: Markets;
|
169 | protected static readonly _coinTokenPatternSeparator = ":";
|
170 | protected constructor(bitgo: BitGo);
|
171 | url(suffix: string): string;
|
172 | wallets(): Wallets;
|
173 | enterprises(): Enterprises;
|
174 | keychains(): Keychains;
|
175 | webhooks(): Webhooks;
|
176 | pendingApprovals(): PendingApprovals;
|
177 | markets(): Markets;
|
178 | static get coinTokenPatternSeparator(): string;
|
179 | get type(): string;
|
180 | /**
|
181 | * Name of the chain which supports this coin (eg, 'btc', 'eth')
|
182 | */
|
183 | abstract getChain(): string;
|
184 | /**
|
185 | * Name of the coin family (eg. for tbtc, this would be btc)
|
186 | */
|
187 | abstract getFamily(): string;
|
188 | /**
|
189 | * Human readable full name for the coin
|
190 | */
|
191 | abstract getFullName(): string;
|
192 | /**
|
193 | * Flag for sending value of 0.
|
194 | * @returns {boolean} True if okay to send 0 value, false otherwise
|
195 | */
|
196 | valuelessTransferAllowed(): boolean;
|
197 | |
198 |
|
199 |
|
200 |
|
201 | transactionDataAllowed(): boolean;
|
202 | |
203 |
|
204 |
|
205 |
|
206 |
|
207 | allowsAccountConsolidations(): boolean;
|
208 | |
209 |
|
210 |
|
211 |
|
212 | abstract getBaseFactor(): number | string;
|
213 | |
214 |
|
215 |
|
216 |
|
217 | baseUnitsToBigUnits(baseUnits: string | number): string;
|
218 | |
219 |
|
220 |
|
221 |
|
222 |
|
223 | bigUnitsToBaseUnits(bigUnits: string | number): string;
|
224 | |
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 | signMessage(key: {
|
232 | prv: string;
|
233 | }, message: string, callback?: NodeCallback<Buffer>): Bluebird<Buffer>;
|
234 | |
235 |
|
236 |
|
237 | abstract verifyTransaction(params: VerifyTransactionOptions, callback?: NodeCallback<boolean>): Bluebird<boolean>;
|
238 | |
239 |
|
240 |
|
241 |
|
242 | abstract verifyAddress(params: VerifyAddressOptions): boolean;
|
243 | |
244 |
|
245 |
|
246 |
|
247 | supportsBlockTarget(): boolean;
|
248 | |
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 | supplementGenerateWallet(walletParams: SupplementGenerateWalletOptions, keychains: KeychainsTriplet): Bluebird<any>;
|
255 | |
256 |
|
257 |
|
258 | getExtraPrebuildParams(buildParams: ExtraPrebuildParamsOptions, callback?: NodeCallback<Record<string, unknown>>): Bluebird<Record<string, unknown>>;
|
259 | |
260 |
|
261 |
|
262 | postProcessPrebuild(prebuildResponse: TransactionPrebuild, callback?: NodeCallback<TransactionPrebuild>): Bluebird<TransactionPrebuild>;
|
263 | |
264 |
|
265 |
|
266 | presignTransaction(params: PresignTransactionOptions, callback?: NodeCallback<TransactionPrebuild>): Bluebird<TransactionPrebuild>;
|
267 | |
268 |
|
269 |
|
270 |
|
271 | newWalletObject(walletParams: any): Wallet;
|
272 | |
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 | feeEstimate(params: FeeEstimateOptions, callback?: NodeCallback<any>): Bluebird<any>;
|
280 | |
281 |
|
282 |
|
283 |
|
284 |
|
285 |
|
286 | deriveKeyWithSeed({ key, seed }: {
|
287 | key: string;
|
288 | seed: string;
|
289 | }): {
|
290 | key: string;
|
291 | derivationPath: string;
|
292 | };
|
293 | |
294 |
|
295 |
|
296 |
|
297 | keyIdsForSigning(): number[];
|
298 | |
299 |
|
300 |
|
301 |
|
302 |
|
303 | preCreateBitGo(params: PrecreateBitGoOptions): void;
|
304 | initiateRecovery(params: InitiateRecoveryOptions): Bluebird<any>;
|
305 | verifyRecoveryTransaction(txInfo: VerifyRecoveryTransactionOptions): Bluebird<any>;
|
306 | abstract parseTransaction(params: ParseTransactionOptions, callback?: NodeCallback<ParsedTransaction>): Bluebird<ParsedTransaction>;
|
307 | |
308 |
|
309 |
|
310 |
|
311 |
|
312 | abstract generateKeyPair(seed?: Buffer): KeyPair;
|
313 | |
314 |
|
315 |
|
316 |
|
317 |
|
318 |
|
319 | abstract isValidPub(pub: string): boolean;
|
320 | |
321 |
|
322 |
|
323 | isValidMofNSetup({ m, n }: {
|
324 | m?: number;
|
325 | n?: number;
|
326 | }): boolean;
|
327 | |
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 | abstract isValidAddress(address: string): boolean;
|
335 | |
336 |
|
337 |
|
338 | abstract signTransaction(params: SignTransactionOptions): Bluebird<SignedTransaction>;
|
339 | }
|
340 |
|
\ | No newline at end of file |