@bitgo-beta/sdk-coin-flr 1.0.1-beta.81 → 1.0.1-beta.810
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/dist/src/flr.d.ts +141 -3
- package/dist/src/flr.d.ts.map +1 -1
- package/dist/src/flr.js +452 -3
- package/dist/src/flrToken.d.ts +26 -0
- package/dist/src/flrToken.d.ts.map +1 -0
- package/dist/src/flrToken.js +49 -0
- package/dist/src/iface.d.ts +148 -0
- package/dist/src/iface.d.ts.map +1 -0
- package/dist/src/iface.js +3 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -1
- package/dist/src/lib/transactionBuilder.d.ts +2 -0
- package/dist/src/lib/transactionBuilder.d.ts.map +1 -1
- package/dist/src/lib/transactionBuilder.js +5 -1
- package/dist/src/register.d.ts.map +1 -1
- package/dist/src/register.js +5 -1
- package/dist/test/resources.d.ts +42 -0
- package/dist/test/resources.d.ts.map +1 -0
- package/dist/test/resources.js +117 -0
- package/dist/test/unit/flr.d.ts +2 -0
- package/dist/test/unit/flr.d.ts.map +1 -0
- package/dist/test/unit/flr.js +846 -0
- package/dist/test/unit/flrToken.d.ts +2 -0
- package/dist/test/unit/flrToken.d.ts.map +1 -0
- package/dist/test/unit/flrToken.js +30 -0
- package/dist/test/unit/getBuilder.d.ts +3 -0
- package/dist/test/unit/getBuilder.d.ts.map +1 -0
- package/dist/test/unit/getBuilder.js +10 -0
- package/dist/test/unit/transactionBuilder/send.d.ts +2 -0
- package/dist/test/unit/transactionBuilder/send.d.ts.map +1 -0
- package/dist/test/unit/transactionBuilder/send.js +19 -0
- package/dist/test/unit/utils.d.ts +2 -0
- package/dist/test/unit/utils.d.ts.map +1 -0
- package/dist/test/unit/utils.js +29 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +22 -10
- package/.eslintignore +0 -5
- package/.mocharc.yml +0 -8
- package/CHANGELOG.md +0 -44
package/dist/src/flr.d.ts
CHANGED
|
@@ -6,18 +6,156 @@
|
|
|
6
6
|
* @coinFullName Flare
|
|
7
7
|
* @coinWebsite https://flare-explorer.flare.network
|
|
8
8
|
*/
|
|
9
|
-
import { BaseCoin, BitGoBase, MPCAlgorithm } from '@bitgo-beta/sdk-core';
|
|
9
|
+
import { BaseCoin, BitGoBase, FeeEstimateOptions, IWallet, MPCAlgorithm, MultisigType, Recipient, TransactionExplanation } from '@bitgo-beta/sdk-core';
|
|
10
10
|
import { BaseCoin as StaticsBaseCoin } from '@bitgo-beta/statics';
|
|
11
|
-
import { AbstractEthLikeNewCoins } from '@bitgo-beta/abstract-eth';
|
|
11
|
+
import { AbstractEthLikeNewCoins, UnsignedSweepTxMPCv2, RecoverOptions, OfflineVaultTxInfo } from '@bitgo-beta/abstract-eth';
|
|
12
12
|
import { TransactionBuilder } from './lib';
|
|
13
|
+
import { FlrPLib } from '@bitgo-beta/sdk-coin-flrp';
|
|
14
|
+
import { BuildOptions, ExplainTransactionOptions, FeeEstimate, HopParams, HopPrebuild, HopTransactionBuildOptions, PresignTransactionOptions, TransactionPrebuild, VerifyFlrTransactionOptions } from './iface';
|
|
13
15
|
export declare class Flr extends AbstractEthLikeNewCoins {
|
|
14
16
|
protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>);
|
|
15
17
|
static createInstance(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>): BaseCoin;
|
|
16
18
|
protected getTransactionBuilder(): TransactionBuilder;
|
|
17
19
|
/** @inheritDoc */
|
|
18
20
|
supportsTss(): boolean;
|
|
21
|
+
/** inherited doc */
|
|
22
|
+
getDefaultMultisigType(): MultisigType;
|
|
19
23
|
/** @inheritDoc */
|
|
20
24
|
getMPCAlgorithm(): MPCAlgorithm;
|
|
21
|
-
|
|
25
|
+
protected buildUnsignedSweepTxnTSS(params: RecoverOptions): Promise<OfflineVaultTxInfo | UnsignedSweepTxMPCv2>;
|
|
26
|
+
/**
|
|
27
|
+
* Validates if an address is valid for FLR
|
|
28
|
+
* Also validates P-chain addresses for cross-chain transactions
|
|
29
|
+
* @param {string} address - address to validate
|
|
30
|
+
* @returns {boolean} - validation result
|
|
31
|
+
*/
|
|
32
|
+
isValidAddress(address: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Get the corresponding P-chain coin name
|
|
35
|
+
* @returns {string} flrp or tflrp depending on mainnet/testnet
|
|
36
|
+
*/
|
|
37
|
+
getFlrP(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Get the atomic transaction builder factory for cross-chain operations
|
|
40
|
+
* @returns {FlrPLib.TransactionBuilderFactory} the atomic builder factory
|
|
41
|
+
*/
|
|
42
|
+
protected getAtomicBuilder(): FlrPLib.TransactionBuilderFactory;
|
|
43
|
+
/**
|
|
44
|
+
* Check if this coin is a token
|
|
45
|
+
* @returns {boolean} false for FLR (base chain)
|
|
46
|
+
*/
|
|
47
|
+
isToken(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Explains an atomic transaction using atomic builder.
|
|
50
|
+
* @param {string} txHex - the transaction hex
|
|
51
|
+
* @returns {Promise<AtomicTransactionExplanation>} the transaction explanation
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
private explainAtomicTransaction;
|
|
55
|
+
/**
|
|
56
|
+
* Verify signature for an atomic transaction using atomic builder.
|
|
57
|
+
* @param {string} txHex - the transaction hex
|
|
58
|
+
* @returns {Promise<boolean>} true if signature is from the input address
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
61
|
+
private verifySignatureForAtomicTransaction;
|
|
62
|
+
/**
|
|
63
|
+
* Explain a transaction from txHex, overriding BaseCoins
|
|
64
|
+
* transaction can be either atomic or eth txn.
|
|
65
|
+
* @param {ExplainTransactionOptions} params The options with which to explain the transaction
|
|
66
|
+
* @returns {Promise<TransactionExplanation>} the transaction explanation
|
|
67
|
+
*/
|
|
68
|
+
explainTransaction(params: ExplainTransactionOptions): Promise<TransactionExplanation>;
|
|
69
|
+
/**
|
|
70
|
+
* Explains an EVM transaction using regular eth txn builder
|
|
71
|
+
* @param {BaseTransaction} tx - the transaction to explain
|
|
72
|
+
* @returns {Object} the transaction explanation
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
private explainEVMTransaction;
|
|
76
|
+
/**
|
|
77
|
+
* Verify that a transaction prebuild complies with the original intention
|
|
78
|
+
*
|
|
79
|
+
* @param {VerifyFlrTransactionOptions} params
|
|
80
|
+
* @param params.txParams params object passed to send
|
|
81
|
+
* @param params.txPrebuild prebuild object returned by server
|
|
82
|
+
* @param params.wallet Wallet object to obtain keys to verify against
|
|
83
|
+
* @returns {Promise<boolean>}
|
|
84
|
+
*/
|
|
85
|
+
verifyTransaction(params: VerifyFlrTransactionOptions): Promise<boolean>;
|
|
86
|
+
/**
|
|
87
|
+
* Check if an address is a FLR C-chain address (0x format)
|
|
88
|
+
* @param {string} address - the address to check
|
|
89
|
+
* @returns {boolean} true if it's a C-chain address
|
|
90
|
+
* @private
|
|
91
|
+
*/
|
|
92
|
+
private static isFLRAddress;
|
|
93
|
+
/**
|
|
94
|
+
* Verify that the coin matches in the prebuild
|
|
95
|
+
* @param {TransactionPrebuild} txPrebuild - the transaction prebuild
|
|
96
|
+
* @returns {boolean} true if coin matches
|
|
97
|
+
*/
|
|
98
|
+
verifyCoin(txPrebuild: TransactionPrebuild): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Coin-specific things done before signing a transaction, i.e. verification
|
|
101
|
+
* @param {PresignTransactionOptions} params - the presign options
|
|
102
|
+
* @returns {Promise<PresignTransactionOptions>}
|
|
103
|
+
*/
|
|
104
|
+
presignTransaction(params: PresignTransactionOptions): Promise<PresignTransactionOptions>;
|
|
105
|
+
/**
|
|
106
|
+
* Modify prebuild after receiving it from the server. Add things like nlocktime
|
|
107
|
+
* @param {TransactionPrebuild} params - the transaction prebuild
|
|
108
|
+
* @returns {Promise<TransactionPrebuild>}
|
|
109
|
+
*/
|
|
110
|
+
postProcessPrebuild(params: TransactionPrebuild): Promise<TransactionPrebuild>;
|
|
111
|
+
/**
|
|
112
|
+
* Validates that the hop prebuild from the HSM is valid and correct
|
|
113
|
+
* @param {IWallet} wallet The wallet that the prebuild is for
|
|
114
|
+
* @param {HopPrebuild} hopPrebuild The prebuild to validate
|
|
115
|
+
* @param {Object} originalParams The original parameters passed to prebuildTransaction
|
|
116
|
+
* @returns {Promise<void>}
|
|
117
|
+
* @throws Error if The prebuild is invalid
|
|
118
|
+
*/
|
|
119
|
+
validateHopPrebuild(wallet: IWallet, hopPrebuild: HopPrebuild, originalParams?: {
|
|
120
|
+
recipients: Recipient[];
|
|
121
|
+
}): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Modify prebuild before sending it to the server. Add things like hop transaction params
|
|
124
|
+
* @param {BuildOptions} buildParams The whitelisted parameters for this prebuild
|
|
125
|
+
* @param {boolean} buildParams.hop True if this should prebuild a hop tx, else false
|
|
126
|
+
* @param {Recipient[]} buildParams.recipients The recipients array of this transaction
|
|
127
|
+
* @param {Wallet} buildParams.wallet The wallet sending this tx
|
|
128
|
+
* @param {string} buildParams.walletPassphrase the passphrase for this wallet
|
|
129
|
+
* @returns {Promise<BuildOptions>}
|
|
130
|
+
*/
|
|
131
|
+
getExtraPrebuildParams(buildParams: BuildOptions): Promise<BuildOptions>;
|
|
132
|
+
/**
|
|
133
|
+
* Creates the extra parameters needed to build a hop transaction
|
|
134
|
+
* @param {HopTransactionBuildOptions} params The original build parameters
|
|
135
|
+
* @returns {Promise<HopParams>} extra parameters object to merge with the original build parameters object and send to the platform
|
|
136
|
+
*/
|
|
137
|
+
createHopTransactionParams({ recipients, type }: HopTransactionBuildOptions): Promise<HopParams>;
|
|
138
|
+
/**
|
|
139
|
+
* Fetch fee estimate information from the server
|
|
140
|
+
* @param {FeeEstimateOptions} params The params passed into the function
|
|
141
|
+
* @param {Boolean} [params.hop] True if we should estimate fee for a hop transaction
|
|
142
|
+
* @param {String} [params.recipient] The recipient of the transaction to estimate a send to
|
|
143
|
+
* @param {String} [params.data] The data to estimate a send for
|
|
144
|
+
* @returns {Promise<FeeEstimate>} The fee info returned from the server
|
|
145
|
+
*/
|
|
146
|
+
feeEstimate(params: FeeEstimateOptions): Promise<FeeEstimate>;
|
|
147
|
+
/**
|
|
148
|
+
* Calculate tx hash like evm from tx hex.
|
|
149
|
+
* @param {string} tx - the transaction hex
|
|
150
|
+
* @returns {Buffer} tx hash
|
|
151
|
+
*/
|
|
152
|
+
static getTxHash(tx: string): Buffer;
|
|
153
|
+
/**
|
|
154
|
+
* Make a query to Flare explorer for information such as balance, token balance, solidity calls
|
|
155
|
+
* @param {Object} query key-value pairs of parameters to append after /api
|
|
156
|
+
* @param {string} apiKey optional API key to use instead of the one from the environment
|
|
157
|
+
* @returns {Promise<Object>} response from Flare explorer
|
|
158
|
+
*/
|
|
159
|
+
recoveryBlockchainExplorerQuery(query: Record<string, string>, apiKey?: string): Promise<Record<string, unknown>>;
|
|
22
160
|
}
|
|
23
161
|
//# sourceMappingURL=flr.d.ts.map
|
package/dist/src/flr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flr.d.ts","sourceRoot":"","sources":["../../src/flr.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"flr.d.ts","sourceRoot":"","sources":["../../src/flr.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,EACL,QAAQ,EAER,SAAS,EAET,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,YAAY,EAEZ,SAAS,EACT,sBAAsB,EAEvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAuB,MAAM,qBAAqB,CAAC;AACvF,OAAO,EACL,uBAAuB,EAGvB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE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