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