@bitgo/sdk-coin-avaxc 1.0.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +5 -0
- package/.mocharc.yml +8 -0
- package/CHANGELOG.md +8 -0
- package/LICENSE +191 -0
- package/README.md +30 -0
- package/dist/src/avaxc.d.ts +249 -0
- package/dist/src/avaxc.d.ts.map +1 -0
- package/dist/src/avaxc.js +462 -0
- package/dist/src/avaxcToken.d.ts +36 -0
- package/dist/src/avaxcToken.d.ts.map +1 -0
- package/dist/src/avaxcToken.js +79 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +17 -0
- package/dist/src/lib/index.d.ts +7 -0
- package/dist/src/lib/index.d.ts.map +1 -0
- package/dist/src/lib/index.js +34 -0
- package/dist/src/lib/keyPair.d.ts +26 -0
- package/dist/src/lib/keyPair.d.ts.map +1 -0
- package/dist/src/lib/keyPair.js +83 -0
- package/dist/src/lib/resources.d.ts +12 -0
- package/dist/src/lib/resources.d.ts.map +1 -0
- package/dist/src/lib/resources.js +27 -0
- package/dist/src/lib/transactionBuilder.d.ts +17 -0
- package/dist/src/lib/transactionBuilder.d.ts.map +1 -0
- package/dist/src/lib/transactionBuilder.js +44 -0
- package/dist/src/lib/transferBuilder.d.ts +17 -0
- package/dist/src/lib/transferBuilder.d.ts.map +1 -0
- package/dist/src/lib/transferBuilder.js +25 -0
- package/dist/src/lib/utils.d.ts +38 -0
- package/dist/src/lib/utils.d.ts.map +1 -0
- package/dist/src/lib/utils.js +70 -0
- package/dist/src/lib/walletUtil.d.ts +22 -0
- package/dist/src/lib/walletUtil.d.ts.map +1 -0
- package/dist/src/lib/walletUtil.js +62 -0
- package/dist/src/tavaxc.d.ts +11 -0
- package/dist/src/tavaxc.d.ts.map +1 -0
- package/dist/src/tavaxc.js +14 -0
- package/package.json +61 -0
package/.mocharc.yml
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## 1.0.1-rc.0 (2022-07-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @bitgo/sdk-coin-avaxc
|
package/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright 2022 BitGo
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# BitGo sdk-coin-avaxc
|
|
2
|
+
|
|
3
|
+
SDK coins provide a modular approach to a monolithic architecture. This and all BitGoJS SDK coins allow developers to use only the coins needed for a given project.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
All coins are loaded traditionally through the `bitgo` package. If you are using coins individually, you will be accessing the coin via the `@bitgo/sdk-api` package.
|
|
8
|
+
|
|
9
|
+
In your project install both `@bitgo/sdk-api` and `@bitgo/sdk-coin-avaxc`.
|
|
10
|
+
|
|
11
|
+
```shell
|
|
12
|
+
npm i @bitgo/sdk-api @bitgo/sdk-coin-avaxc
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Next, you will be able to initialize an instance of "bitgo" through `@bitgo/sdk-api` instead of `bitgo`.
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
import { BitGoAPI } from '@bitgo/sdk-api';
|
|
19
|
+
import { Avaxc } from '@bitgo/sdk-coin-avaxc';
|
|
20
|
+
|
|
21
|
+
const sdk = new BitGoAPI();
|
|
22
|
+
|
|
23
|
+
sdk.register('avaxc', Avaxc.createInstance);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Development
|
|
27
|
+
|
|
28
|
+
Most of the coin implementations are derived from `@bitgo/sdk-core`, `@bitgo/statics`, and coin specific packages. These implementations are used to interact with the BitGo API and BitGo platform services.
|
|
29
|
+
|
|
30
|
+
You will notice that the basic version of common class extensions have been provided to you and must be resolved before the package build will succeed. Upon initiation of a given SDK coin, you will need to verify that your coin has been included in the root `tsconfig.packages.json` and that the linting, formatting, and testing succeeds when run both within the coin and from the root of BitGoJS.
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { BaseCoin as StaticsBaseCoin, CoinFamily } from '@bitgo/statics';
|
|
3
|
+
import { BaseCoin, BitGoBase, FeeEstimateOptions, FullySignedTransaction, HalfSignedAccountTransaction, IWallet, KeyPair, ParsedTransaction, ParseTransactionOptions, PresignTransactionOptions as BasePresignTransactionOptions, SignTransactionOptions as BaseSignTransactionOptions, TransactionExplanation, TransactionFee, TransactionParams, TransactionPrebuild as BaseTransactionPrebuild, TransactionRecipient, VerifyAddressOptions, VerifyTransactionOptions, Wallet } from '@bitgo/sdk-core';
|
|
4
|
+
import { TransactionBuilder as EthTransactionBuilder } from '@bitgo/sdk-coin-eth';
|
|
5
|
+
interface PrecreateBitGoOptions {
|
|
6
|
+
enterprise?: string;
|
|
7
|
+
newFeeAddress?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ExplainTransactionOptions {
|
|
10
|
+
txHex?: string;
|
|
11
|
+
halfSigned?: {
|
|
12
|
+
txHex: string;
|
|
13
|
+
};
|
|
14
|
+
feeInfo: TransactionFee;
|
|
15
|
+
}
|
|
16
|
+
interface AvaxcTransactionParams extends TransactionParams {
|
|
17
|
+
gasPrice?: number;
|
|
18
|
+
gasLimit?: number;
|
|
19
|
+
hopParams?: HopParams;
|
|
20
|
+
hop?: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface VerifyAvaxcTransactionOptions extends VerifyTransactionOptions {
|
|
23
|
+
txPrebuild: TransactionPrebuild;
|
|
24
|
+
txParams: AvaxcTransactionParams;
|
|
25
|
+
}
|
|
26
|
+
interface PresignTransactionOptions extends TransactionPrebuild, BasePresignTransactionOptions {
|
|
27
|
+
wallet: Wallet;
|
|
28
|
+
}
|
|
29
|
+
interface EIP1559 {
|
|
30
|
+
maxPriorityFeePerGas: number;
|
|
31
|
+
maxFeePerGas: number;
|
|
32
|
+
}
|
|
33
|
+
export interface TransactionPrebuild extends BaseTransactionPrebuild {
|
|
34
|
+
hopTransaction?: HopPrebuild;
|
|
35
|
+
buildParams: {
|
|
36
|
+
recipients: Recipient[];
|
|
37
|
+
};
|
|
38
|
+
recipients: TransactionRecipient[];
|
|
39
|
+
nextContractSequenceId: string;
|
|
40
|
+
gasPrice: number;
|
|
41
|
+
gasLimit: number;
|
|
42
|
+
isBatch: boolean;
|
|
43
|
+
coin: string;
|
|
44
|
+
token?: string;
|
|
45
|
+
}
|
|
46
|
+
interface HopTransactionBuildOptions {
|
|
47
|
+
wallet: Wallet;
|
|
48
|
+
recipients: Recipient[];
|
|
49
|
+
walletPassphrase: string;
|
|
50
|
+
}
|
|
51
|
+
interface Recipient {
|
|
52
|
+
address: string;
|
|
53
|
+
amount: string;
|
|
54
|
+
data?: string;
|
|
55
|
+
}
|
|
56
|
+
interface BuildOptions {
|
|
57
|
+
hop?: boolean;
|
|
58
|
+
wallet?: Wallet;
|
|
59
|
+
recipients?: Recipient[];
|
|
60
|
+
walletPassphrase?: string;
|
|
61
|
+
[index: string]: unknown;
|
|
62
|
+
}
|
|
63
|
+
interface FeeEstimate {
|
|
64
|
+
gasLimitEstimate: number;
|
|
65
|
+
feeEstimate: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The extra parameters to send to platform build route for hop transactions
|
|
69
|
+
*/
|
|
70
|
+
interface HopParams {
|
|
71
|
+
hopParams: {
|
|
72
|
+
gasPriceMax: number;
|
|
73
|
+
userReqSig: string;
|
|
74
|
+
paymentId: string;
|
|
75
|
+
};
|
|
76
|
+
gasLimit: number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The prebuilt hop transaction returned from the HSM
|
|
80
|
+
*/
|
|
81
|
+
interface HopPrebuild {
|
|
82
|
+
tx: string;
|
|
83
|
+
id: string;
|
|
84
|
+
signature: string;
|
|
85
|
+
paymentId: string;
|
|
86
|
+
gasPrice: number;
|
|
87
|
+
gasLimit: number;
|
|
88
|
+
amount: number;
|
|
89
|
+
recipient: string;
|
|
90
|
+
nonce: number;
|
|
91
|
+
userReqSig: string;
|
|
92
|
+
gasPriceMax: number;
|
|
93
|
+
}
|
|
94
|
+
export interface TxInfo {
|
|
95
|
+
recipients: Recipient[];
|
|
96
|
+
from: string;
|
|
97
|
+
txid: string;
|
|
98
|
+
}
|
|
99
|
+
export interface EthTransactionFee {
|
|
100
|
+
fee: string;
|
|
101
|
+
gasLimit?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface TxPreBuild extends BaseTransactionPrebuild {
|
|
104
|
+
txHex: string;
|
|
105
|
+
txInfo: TxInfo;
|
|
106
|
+
feeInfo: EthTransactionFee;
|
|
107
|
+
source: string;
|
|
108
|
+
dataToSign: string;
|
|
109
|
+
nextContractSequenceId?: string;
|
|
110
|
+
expireTime?: number;
|
|
111
|
+
hopTransaction?: string;
|
|
112
|
+
eip1559?: EIP1559;
|
|
113
|
+
}
|
|
114
|
+
export interface AvaxSignTransactionOptions extends BaseSignTransactionOptions {
|
|
115
|
+
txPrebuild: TxPreBuild;
|
|
116
|
+
prv: string;
|
|
117
|
+
custodianTransactionId?: string;
|
|
118
|
+
}
|
|
119
|
+
export interface HalfSignedTransaction extends HalfSignedAccountTransaction {
|
|
120
|
+
halfSigned: {
|
|
121
|
+
txHex?: never;
|
|
122
|
+
recipients: Recipient[];
|
|
123
|
+
expiration?: number;
|
|
124
|
+
eip1559?: EIP1559;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
export declare type SignedTransaction = HalfSignedTransaction | FullySignedTransaction;
|
|
128
|
+
export declare class AvaxC extends BaseCoin {
|
|
129
|
+
static hopTransactionSalt: string;
|
|
130
|
+
protected readonly _staticsCoin: Readonly<StaticsBaseCoin>;
|
|
131
|
+
protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>);
|
|
132
|
+
static createInstance(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>): BaseCoin;
|
|
133
|
+
getBaseFactor(): number;
|
|
134
|
+
getChain(): string;
|
|
135
|
+
/**
|
|
136
|
+
* Get the base chain that the coin exists on.
|
|
137
|
+
*/
|
|
138
|
+
getBaseChain(): string;
|
|
139
|
+
getFamily(): CoinFamily;
|
|
140
|
+
getFullName(): string;
|
|
141
|
+
valuelessTransferAllowed(): boolean;
|
|
142
|
+
isValidAddress(address: string): boolean;
|
|
143
|
+
isToken(): boolean;
|
|
144
|
+
generateKeyPair(seed?: Buffer): KeyPair;
|
|
145
|
+
parseTransaction(params: ParseTransactionOptions): Promise<ParsedTransaction>;
|
|
146
|
+
verifyAddress({ address }: VerifyAddressOptions): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Verify that a transaction prebuild complies with the original intention
|
|
149
|
+
*
|
|
150
|
+
* @param params
|
|
151
|
+
* @param params.txParams params object passed to send
|
|
152
|
+
* @param params.txPrebuild prebuild object returned by server
|
|
153
|
+
* @param params.wallet Wallet object to obtain keys to verify against
|
|
154
|
+
* @returns {boolean}
|
|
155
|
+
*/
|
|
156
|
+
verifyTransaction(params: VerifyAvaxcTransactionOptions): Promise<boolean>;
|
|
157
|
+
private static isAVAXCAddress;
|
|
158
|
+
verifyCoin(txPrebuild: TransactionPrebuild): boolean;
|
|
159
|
+
isValidPub(pub: string): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Builds a funds recovery transaction without BitGo.
|
|
162
|
+
* We need to do three queries during this:
|
|
163
|
+
* 1) Node query - how much money is in the account
|
|
164
|
+
* 2) Build transaction - build our transaction for the amount
|
|
165
|
+
* 3) Send signed build - send our signed build to a public node
|
|
166
|
+
* @param params The options with which to recover
|
|
167
|
+
*/
|
|
168
|
+
recover(params: any): Promise<any>;
|
|
169
|
+
/**
|
|
170
|
+
* Create a new transaction builder for the current chain
|
|
171
|
+
* @return a new transaction builder
|
|
172
|
+
*/
|
|
173
|
+
protected getTransactionBuilder(): EthTransactionBuilder;
|
|
174
|
+
/**
|
|
175
|
+
* Explain a transaction from txHex, overriding BaseCoins
|
|
176
|
+
* @param params The options with which to explain the transaction
|
|
177
|
+
*/
|
|
178
|
+
explainTransaction(params: ExplainTransactionOptions): Promise<TransactionExplanation>;
|
|
179
|
+
/**
|
|
180
|
+
* Above is standard BaseCoins functions
|
|
181
|
+
* ================================================================================================================
|
|
182
|
+
* ================================================================================================================
|
|
183
|
+
* Below is transaction functions
|
|
184
|
+
*/
|
|
185
|
+
/**
|
|
186
|
+
* Coin-specific things done before signing a transaction, i.e. verification
|
|
187
|
+
* @param params
|
|
188
|
+
*/
|
|
189
|
+
presignTransaction(params: PresignTransactionOptions): Promise<PresignTransactionOptions>;
|
|
190
|
+
/**
|
|
191
|
+
* Modify prebuild after receiving it from the server. Add things like nlocktime
|
|
192
|
+
*/
|
|
193
|
+
postProcessPrebuild(params: TransactionPrebuild): Promise<TransactionPrebuild>;
|
|
194
|
+
/**
|
|
195
|
+
* Validates that the hop prebuild from the HSM is valid and correct
|
|
196
|
+
* @param wallet The wallet that the prebuild is for
|
|
197
|
+
* @param hopPrebuild The prebuild to validate
|
|
198
|
+
* @param originalParams The original parameters passed to prebuildTransaction
|
|
199
|
+
* @returns void
|
|
200
|
+
* @throws Error if The prebuild is invalid
|
|
201
|
+
*/
|
|
202
|
+
validateHopPrebuild(wallet: IWallet, hopPrebuild: HopPrebuild, originalParams?: {
|
|
203
|
+
recipients: Recipient[];
|
|
204
|
+
}): Promise<void>;
|
|
205
|
+
/**
|
|
206
|
+
* Assemble half-sign prebuilt transaction
|
|
207
|
+
* @param params
|
|
208
|
+
*/
|
|
209
|
+
signTransaction(params: AvaxSignTransactionOptions): Promise<SignedTransaction>;
|
|
210
|
+
/**
|
|
211
|
+
* Modify prebuild before sending it to the server. Add things like hop transaction params
|
|
212
|
+
* @param buildParams The whitelisted parameters for this prebuild
|
|
213
|
+
* @param buildParams.hop True if this should prebuild a hop tx, else false
|
|
214
|
+
* @param buildParams.recipients The recipients array of this transaction
|
|
215
|
+
* @param buildParams.wallet The wallet sending this tx
|
|
216
|
+
* @param buildParams.walletPassphrase the passphrase for this wallet
|
|
217
|
+
*/
|
|
218
|
+
getExtraPrebuildParams(buildParams: BuildOptions): Promise<BuildOptions>;
|
|
219
|
+
/**
|
|
220
|
+
* Creates the extra parameters needed to build a hop transaction
|
|
221
|
+
* @param buildParams The original build parameters
|
|
222
|
+
* @returns extra parameters object to merge with the original build parameters object and send to the platform
|
|
223
|
+
*/
|
|
224
|
+
createHopTransactionParams(buildParams: HopTransactionBuildOptions): Promise<HopParams>;
|
|
225
|
+
/**
|
|
226
|
+
* Fetch fee estimate information from the server
|
|
227
|
+
* @param {Object} params The params passed into the function
|
|
228
|
+
* @param {Boolean} [params.hop] True if we should estimate fee for a hop transaction
|
|
229
|
+
* @param {String} [params.recipient] The recipient of the transaction to estimate a send to
|
|
230
|
+
* @param {String} [params.data] The ETH tx data to estimate a send for
|
|
231
|
+
* @returns {Object} The fee info returned from the server
|
|
232
|
+
*/
|
|
233
|
+
feeEstimate(params: FeeEstimateOptions): Promise<FeeEstimate>;
|
|
234
|
+
/**
|
|
235
|
+
* Gets the hop digest for the user to sign. This is validated in the HSM to prove that the user requested this tx
|
|
236
|
+
* @param paramsArr The parameters to hash together for the digest
|
|
237
|
+
*/
|
|
238
|
+
private static getHopDigest;
|
|
239
|
+
isWalletAddress(params: VerifyAddressOptions): boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Ensure either enterprise or newFeeAddress is passed, to know whether to create new key or use enterprise key
|
|
242
|
+
* @param params
|
|
243
|
+
* @param params.enterprise {String} the enterprise id to associate with this key
|
|
244
|
+
* @param params.newFeeAddress {Boolean} create a new fee address (enterprise not needed in this case)
|
|
245
|
+
*/
|
|
246
|
+
preCreateBitGo(params: PrecreateBitGoOptions): void;
|
|
247
|
+
}
|
|
248
|
+
export {};
|
|
249
|
+
//# sourceMappingURL=avaxc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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