@bitgo-beta/sdk-coin-avaxc 2.2.3-alpha.21 → 2.2.3-alpha.210
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/CHANGELOG.md +625 -0
- package/dist/src/avaxc.d.ts +42 -15
- package/dist/src/avaxc.d.ts.map +1 -1
- package/dist/src/avaxc.js +185 -70
- package/dist/src/iface.d.ts +4 -2
- package/dist/src/iface.d.ts.map +1 -1
- package/dist/src/iface.js +1 -1
- package/dist/src/index.js +6 -2
- package/dist/src/lib/index.js +6 -2
- package/dist/src/lib/keyPair.js +6 -6
- package/dist/src/lib/transactionBuilder.js +2 -2
- package/dist/src/lib/utils.d.ts +2 -1
- package/dist/src/lib/utils.d.ts.map +1 -1
- package/dist/src/lib/utils.js +27 -5
- package/package.json +17 -15
package/dist/src/avaxc.d.ts
CHANGED
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
2
|
+
/// <reference types="bn.js" />
|
|
3
|
+
import { BaseCoin as StaticsBaseCoin, CoinFamily, EthereumNetwork } from '@bitgo-beta/statics';
|
|
3
4
|
import { BaseCoin, BitGoBase, FeeEstimateOptions, FullySignedTransaction, IWallet, KeyPair, ParsedTransaction, ParseTransactionOptions, Recipient, TransactionExplanation, VerifyAddressOptions } from '@bitgo-beta/sdk-core';
|
|
4
|
-
import { GetSendMethodArgsOptions, RecoverOptions, RecoveryInfo, SendMethodArgs, TransactionBuilder as EthTransactionBuilder, TransactionPrebuild } from '@bitgo-beta/sdk-coin-eth';
|
|
5
|
+
import { AbstractEthLikeNewCoins, GetSendMethodArgsOptions, RecoverOptions, RecoveryInfo, SendMethodArgs, TransactionBuilder as EthTransactionBuilder, TransactionPrebuild } from '@bitgo-beta/sdk-coin-eth';
|
|
6
|
+
import { BN } from 'ethereumjs-util';
|
|
7
|
+
import { Buffer } from 'buffer';
|
|
5
8
|
import { AvaxSignTransactionOptions, BuildOptions, ExplainTransactionOptions, FeeEstimate, HopParams, HopPrebuild, HopTransactionBuildOptions, OfflineVaultTxInfo, PrecreateBitGoOptions, PresignTransactionOptions, SignedTransaction, SignFinalOptions, VerifyAvaxcTransactionOptions } from './iface';
|
|
6
9
|
import { AvaxpLib } from '@bitgo-beta/sdk-coin-avaxp';
|
|
7
|
-
|
|
10
|
+
import { SignTransactionOptions } from '@bitgo-beta/abstract-eth';
|
|
11
|
+
/** COIN-1708 : Avaxc is added for CCR in WRW,
|
|
12
|
+
* hence adding the feature for AbstractEthLikeNewCoins
|
|
13
|
+
* Super class changed from BaseCoin to AbstractEthLikeNewCoins
|
|
14
|
+
* @since Sept 2024
|
|
15
|
+
*/
|
|
16
|
+
export declare class AvaxC extends AbstractEthLikeNewCoins {
|
|
8
17
|
static hopTransactionSalt: string;
|
|
9
18
|
protected readonly _staticsCoin: Readonly<StaticsBaseCoin>;
|
|
10
19
|
protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>);
|
|
11
20
|
static createInstance(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>): BaseCoin;
|
|
12
21
|
getBaseFactor(): number;
|
|
13
22
|
getChain(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Method to return the coin's network object
|
|
25
|
+
* @returns {BaseNetwork}
|
|
26
|
+
*/
|
|
27
|
+
getNetwork(): EthereumNetwork;
|
|
14
28
|
/**
|
|
15
29
|
* Get the base chain that the coin exists on.
|
|
16
30
|
*/
|
|
@@ -51,11 +65,11 @@ export declare class AvaxC extends BaseCoin {
|
|
|
51
65
|
*/
|
|
52
66
|
setGasPrice(userGasPrice?: number): number;
|
|
53
67
|
/**
|
|
54
|
-
* Make a query to
|
|
68
|
+
* Make a query to avax.network for information such as balance, token balance, solidity calls
|
|
55
69
|
* @param {Object} query — key-value pairs of parameters to append after /api
|
|
56
|
-
* @returns {Promise<Object>} response from
|
|
70
|
+
* @returns {Promise<Object>} response from avax.network
|
|
57
71
|
*/
|
|
58
|
-
recoveryBlockchainExplorerQuery(query: Record<string,
|
|
72
|
+
recoveryBlockchainExplorerQuery(query: Record<string, any>): Promise<any>;
|
|
59
73
|
/**
|
|
60
74
|
* Queries public block explorer to get the next nonce that should be used for
|
|
61
75
|
* the given AVAXC address
|
|
@@ -64,13 +78,20 @@ export declare class AvaxC extends BaseCoin {
|
|
|
64
78
|
*/
|
|
65
79
|
getAddressNonce(address: string): Promise<number>;
|
|
66
80
|
/**
|
|
67
|
-
* Queries
|
|
81
|
+
* Queries avax.network for the balance of an address
|
|
68
82
|
* @param {string} address - the AVAXC address
|
|
69
83
|
* @returns {Promise<BigNumber>} address balance
|
|
70
84
|
*/
|
|
71
|
-
queryAddressBalance(address: string): Promise<
|
|
85
|
+
queryAddressBalance(address: string): Promise<BN>;
|
|
86
|
+
/**
|
|
87
|
+
* Queries avax.network for the token balance of an address
|
|
88
|
+
* @param {string} walletContractAddress - the AVAXC address
|
|
89
|
+
* @param {string} tokenContractAddress - the Token contract address
|
|
90
|
+
* @returns {Promise<BigNumber>} address balance
|
|
91
|
+
*/
|
|
92
|
+
queryAddressTokenBalance(tokenContractAddress: string, walletContractAddress: string): Promise<BN>;
|
|
72
93
|
/**
|
|
73
|
-
* Queries the contract (via
|
|
94
|
+
* Queries the contract (via avax.network) for the next sequence ID
|
|
74
95
|
* @param {string} address - address of the contract
|
|
75
96
|
* @returns {Promise<number>} sequence ID
|
|
76
97
|
*/
|
|
@@ -185,7 +206,7 @@ export declare class AvaxC extends BaseCoin {
|
|
|
185
206
|
* Assemble half-sign prebuilt transaction
|
|
186
207
|
* @param params
|
|
187
208
|
*/
|
|
188
|
-
signTransaction(params: AvaxSignTransactionOptions): Promise<SignedTransaction>;
|
|
209
|
+
signTransaction(params: AvaxSignTransactionOptions | SignTransactionOptions): Promise<SignedTransaction>;
|
|
189
210
|
/**
|
|
190
211
|
* Modify prebuild before sending it to the server. Add things like hop transaction params
|
|
191
212
|
* @param buildParams The whitelisted parameters for this prebuild
|
|
@@ -210,11 +231,6 @@ export declare class AvaxC extends BaseCoin {
|
|
|
210
231
|
* @returns {Object} The fee info returned from the server
|
|
211
232
|
*/
|
|
212
233
|
feeEstimate(params: FeeEstimateOptions): Promise<FeeEstimate>;
|
|
213
|
-
/**
|
|
214
|
-
* Gets the hop digest for the user to sign. This is validated in the HSM to prove that the user requested this tx
|
|
215
|
-
* @param paramsArr The parameters to hash together for the digest
|
|
216
|
-
*/
|
|
217
|
-
static getHopDigest(paramsArr: string[]): Buffer;
|
|
218
234
|
/**
|
|
219
235
|
* Calculate tx hash like evm from tx hex.
|
|
220
236
|
* @param {string} tx
|
|
@@ -230,5 +246,16 @@ export declare class AvaxC extends BaseCoin {
|
|
|
230
246
|
*/
|
|
231
247
|
preCreateBitGo(params: PrecreateBitGoOptions): void;
|
|
232
248
|
getAvaxP(): string;
|
|
249
|
+
/**
|
|
250
|
+
* Fetch the gas price from the explorer
|
|
251
|
+
*/
|
|
252
|
+
getGasPriceFromExternalAPI(): Promise<BN>;
|
|
253
|
+
/**
|
|
254
|
+
* Fetch the gas limit from the explorer
|
|
255
|
+
* @param from
|
|
256
|
+
* @param to
|
|
257
|
+
* @param data
|
|
258
|
+
*/
|
|
259
|
+
getGasLimitFromExternalAPI(from: string, to: string, data: string): Promise<BN>;
|
|
233
260
|
}
|
|
234
261
|
//# sourceMappingURL=avaxc.d.ts.map
|
package/dist/src/avaxc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avaxc.d.ts","sourceRoot":"","sources":["../../src/avaxc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"avaxc.d.ts","sourceRoot":"","sources":["../../src/avaxc.ts"],"names":[],"mappings":";;AAQA,OAAO,EAEL,QAAQ,IAAI,eAAe,EAC3B,UAAU,EAGV,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,QAAQ,EAER,SAAS,EAET,kBAAkB,EAClB,sBAAsB,EAGtB,OAA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