@ledgerhq/live-common 21.4.1-btcjs.4 → 21.5.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/lib/account/addAccounts.d.ts.map +1 -1
- package/lib/account/addAccounts.js +1 -2
- package/lib/account/addAccounts.js.map +1 -1
- package/lib/account/support.d.ts.map +1 -1
- package/lib/account/support.js +1 -24
- package/lib/account/support.js.map +1 -1
- package/lib/api/explorerConfig/index.js +15 -15
- package/lib/apps/polyfill.d.ts.map +1 -1
- package/lib/apps/polyfill.js +5 -0
- package/lib/apps/polyfill.js.map +1 -1
- package/lib/bridge/jsHelpers.d.ts +1 -6
- package/lib/bridge/jsHelpers.d.ts.map +1 -1
- package/lib/bridge/jsHelpers.js +3 -11
- package/lib/bridge/jsHelpers.js.map +1 -1
- package/lib/env.js +2 -2
- package/lib/families/bitcoin/account.d.ts.map +1 -1
- package/lib/families/bitcoin/account.js +2 -3
- package/lib/families/bitcoin/account.js.map +1 -1
- package/lib/families/bitcoin/datasets/bitcoin.js +6 -6
- package/lib/families/bitcoin/datasets/bitcoin.js.map +1 -1
- package/lib/families/bitcoin/datasets/litecoin.js +3 -3
- package/lib/families/bitcoin/datasets/litecoin.js.map +1 -1
- package/lib/families/bitcoin/serialization.d.ts +2 -2
- package/lib/families/bitcoin/serialization.d.ts.map +1 -1
- package/lib/families/bitcoin/serialization.js +4 -8
- package/lib/families/bitcoin/serialization.js.map +1 -1
- package/lib/families/bitcoin/specs.d.ts.map +1 -1
- package/lib/families/bitcoin/specs.js +5 -8
- package/lib/families/bitcoin/specs.js.map +1 -1
- package/lib/families/bitcoin/speculos-deviceActions.js +2 -2
- package/lib/families/bitcoin/speculos-deviceActions.js.map +1 -1
- package/lib/families/bitcoin/test-dataset.js +1 -1
- package/lib/families/bitcoin/test-dataset.js.map +1 -1
- package/lib/families/bitcoin/transaction.d.ts +3 -3
- package/lib/families/bitcoin/transaction.d.ts.map +1 -1
- package/lib/families/bitcoin/transaction.js +61 -64
- package/lib/families/bitcoin/transaction.js.map +1 -1
- package/lib/families/bitcoin/types.d.ts +36 -66
- package/lib/families/bitcoin/types.d.ts.map +1 -1
- package/lib/families/bitcoin/types.js +1 -16
- package/lib/families/bitcoin/types.js.map +1 -1
- package/lib/families/crypto_org/logic.d.ts +1 -1
- package/lib/families/crypto_org/logic.js +7 -7
- package/lib/families/elrond/js-getTransactionStatus.d.ts.map +1 -1
- package/lib/families/elrond/js-getTransactionStatus.js +3 -0
- package/lib/families/elrond/js-getTransactionStatus.js.map +1 -1
- package/lib/families/elrond/js-signOperation.d.ts.map +1 -1
- package/lib/families/elrond/js-signOperation.js +10 -7
- package/lib/families/elrond/js-signOperation.js.map +1 -1
- package/lib/generated/bridge/js.d.ts +0 -4
- package/lib/generated/bridge/js.d.ts.map +1 -1
- package/lib/generated/bridge/js.js +18 -20
- package/lib/generated/bridge/js.js.map +1 -1
- package/lib/hw/actions/initSwap.js +2 -2
- package/lib/hw/actions/initSwap.js.map +1 -1
- package/lib/migrations/accounts-dataset.d.ts.map +1 -1
- package/lib/migrations/accounts-dataset.js +2 -4
- package/lib/migrations/accounts-dataset.js.map +1 -1
- package/lib/migrations/accounts.d.ts.map +1 -1
- package/lib/migrations/accounts.js +0 -17
- package/lib/migrations/accounts.js.map +1 -1
- package/lib/mock/account.d.ts.map +1 -1
- package/lib/mock/account.js +1 -2
- package/lib/mock/account.js.map +1 -1
- package/package.json +22 -22
- package/src/__tests__/__snapshots__/all.libcore.ts.snap +43 -6
- package/src/account/addAccounts.ts +1 -2
- package/src/account/support.ts +1 -24
- package/src/api/explorerConfig/index.ts +15 -15
- package/src/apps/polyfill.ts +5 -0
- package/src/bridge/jsHelpers.ts +2 -22
- package/src/env.ts +2 -2
- package/src/families/bitcoin/account.ts +1 -2
- package/src/families/bitcoin/datasets/bitcoin.ts +6 -6
- package/src/families/bitcoin/datasets/litecoin.ts +6 -6
- package/src/families/bitcoin/serialization.ts +0 -6
- package/src/families/bitcoin/specs.ts +2 -5
- package/src/families/bitcoin/speculos-deviceActions.ts +1 -1
- package/src/families/bitcoin/test-dataset.ts +1 -1
- package/src/families/bitcoin/transaction.ts +93 -98
- package/src/families/bitcoin/types.ts +37 -95
- package/src/families/crypto_org/logic.ts +6 -6
- package/src/families/elrond/js-getTransactionStatus.ts +5 -0
- package/src/families/elrond/js-signOperation.ts +1 -0
- package/src/generated/bridge/js.ts +0 -3
- package/src/hw/actions/initSwap.ts +2 -2
- package/src/migrations/accounts-dataset.ts +0 -3
- package/src/migrations/accounts.ts +0 -18
- package/src/mock/account.ts +0 -2
- package/lib/families/bitcoin/bridge/js.d.ts +0 -8
- package/lib/families/bitcoin/bridge/js.d.ts.map +0 -1
- package/lib/families/bitcoin/bridge/js.js +0 -149
- package/lib/families/bitcoin/bridge/js.js.map +0 -1
- package/lib/families/bitcoin/cache.d.ts +0 -28
- package/lib/families/bitcoin/cache.d.ts.map +0 -1
- package/lib/families/bitcoin/cache.js +0 -109
- package/lib/families/bitcoin/cache.js.map +0 -1
- package/lib/families/bitcoin/getAccountNetworkInfo.d.ts +0 -6
- package/lib/families/bitcoin/getAccountNetworkInfo.d.ts.map +0 -1
- package/lib/families/bitcoin/getAccountNetworkInfo.js +0 -124
- package/lib/families/bitcoin/getAccountNetworkInfo.js.map +0 -1
- package/lib/families/bitcoin/getAccountNetworkInfo.test.d.ts +0 -2
- package/lib/families/bitcoin/getAccountNetworkInfo.test.d.ts.map +0 -1
- package/lib/families/bitcoin/getAccountNetworkInfo.test.js +0 -71
- package/lib/families/bitcoin/getAccountNetworkInfo.test.js.map +0 -1
- package/lib/families/bitcoin/js-broadcast.d.ts +0 -11
- package/lib/families/bitcoin/js-broadcast.d.ts.map +0 -1
- package/lib/families/bitcoin/js-broadcast.js +0 -80
- package/lib/families/bitcoin/js-broadcast.js.map +0 -1
- package/lib/families/bitcoin/js-buildTransaction.d.ts +0 -5
- package/lib/families/bitcoin/js-buildTransaction.d.ts.map +0 -1
- package/lib/families/bitcoin/js-buildTransaction.js +0 -106
- package/lib/families/bitcoin/js-buildTransaction.js.map +0 -1
- package/lib/families/bitcoin/js-createTransaction.d.ts +0 -9
- package/lib/families/bitcoin/js-createTransaction.d.ts.map +0 -1
- package/lib/families/bitcoin/js-createTransaction.js +0 -27
- package/lib/families/bitcoin/js-createTransaction.js.map +0 -1
- package/lib/families/bitcoin/js-estimateMaxSpendable.d.ts +0 -15
- package/lib/families/bitcoin/js-estimateMaxSpendable.d.ts.map +0 -1
- package/lib/families/bitcoin/js-estimateMaxSpendable.js +0 -95
- package/lib/families/bitcoin/js-estimateMaxSpendable.js.map +0 -1
- package/lib/families/bitcoin/js-getFeesForTransaction.d.ts +0 -26
- package/lib/families/bitcoin/js-getFeesForTransaction.d.ts.map +0 -1
- package/lib/families/bitcoin/js-getFeesForTransaction.js +0 -100
- package/lib/families/bitcoin/js-getFeesForTransaction.js.map +0 -1
- package/lib/families/bitcoin/js-getTransactionStatus.d.ts +0 -5
- package/lib/families/bitcoin/js-getTransactionStatus.d.ts.map +0 -1
- package/lib/families/bitcoin/js-getTransactionStatus.js +0 -131
- package/lib/families/bitcoin/js-getTransactionStatus.js.map +0 -1
- package/lib/families/bitcoin/js-prepareTransaction.d.ts +0 -5
- package/lib/families/bitcoin/js-prepareTransaction.d.ts.map +0 -1
- package/lib/families/bitcoin/js-prepareTransaction.js +0 -80
- package/lib/families/bitcoin/js-prepareTransaction.js.map +0 -1
- package/lib/families/bitcoin/js-signOperation.d.ts +0 -10
- package/lib/families/bitcoin/js-signOperation.d.ts.map +0 -1
- package/lib/families/bitcoin/js-signOperation.js +0 -212
- package/lib/families/bitcoin/js-signOperation.js.map +0 -1
- package/lib/families/bitcoin/js-synchronisation.d.ts +0 -10
- package/lib/families/bitcoin/js-synchronisation.d.ts.map +0 -1
- package/lib/families/bitcoin/js-synchronisation.js +0 -411
- package/lib/families/bitcoin/js-synchronisation.js.map +0 -1
- package/lib/families/bitcoin/logic.d.ts +0 -34
- package/lib/families/bitcoin/logic.d.ts.map +0 -1
- package/lib/families/bitcoin/logic.js +0 -283
- package/lib/families/bitcoin/logic.js.map +0 -1
- package/lib/families/bitcoin/networks.d.ts +0 -3
- package/lib/families/bitcoin/networks.d.ts.map +0 -1
- package/lib/families/bitcoin/networks.js +0 -379
- package/lib/families/bitcoin/networks.js.map +0 -1
- package/lib/families/bitcoin/wallet.d.ts +0 -6
- package/lib/families/bitcoin/wallet.d.ts.map +0 -1
- package/lib/families/bitcoin/wallet.js +0 -66
- package/lib/families/bitcoin/wallet.js.map +0 -1
- package/src/families/bitcoin/bridge/js.ts +0 -76
- package/src/families/bitcoin/cache.ts +0 -76
- package/src/families/bitcoin/getAccountNetworkInfo.test.ts +0 -27
- package/src/families/bitcoin/getAccountNetworkInfo.ts +0 -61
- package/src/families/bitcoin/js-broadcast.ts +0 -30
- package/src/families/bitcoin/js-buildTransaction.ts +0 -57
- package/src/families/bitcoin/js-createTransaction.ts +0 -27
- package/src/families/bitcoin/js-estimateMaxSpendable.ts +0 -36
- package/src/families/bitcoin/js-getFeesForTransaction.ts +0 -59
- package/src/families/bitcoin/js-getTransactionStatus.ts +0 -118
- package/src/families/bitcoin/js-prepareTransaction.ts +0 -35
- package/src/families/bitcoin/js-signOperation.ts +0 -164
- package/src/families/bitcoin/js-synchronisation.ts +0 -362
- package/src/families/bitcoin/logic.ts +0 -243
- package/src/families/bitcoin/networks.ts +0 -360
- package/src/families/bitcoin/wallet.ts +0 -21
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { BigNumber } from "bignumber.js";
|
|
2
|
-
import type { SerializedAccount as WalletSerializedAccount } from "@ledgerhq/wallet-btc";
|
|
3
|
-
|
|
4
2
|
import type {
|
|
5
3
|
TransactionCommon,
|
|
6
4
|
TransactionCommonRaw,
|
|
@@ -11,8 +9,43 @@ import type {
|
|
|
11
9
|
CoreDerivationPath,
|
|
12
10
|
Spec,
|
|
13
11
|
} from "../../libcore/types";
|
|
12
|
+
export type BitcoinInput = {
|
|
13
|
+
address: string | null | undefined;
|
|
14
|
+
value: BigNumber | null | undefined;
|
|
15
|
+
previousTxHash: string | null | undefined;
|
|
16
|
+
previousOutputIndex: number;
|
|
17
|
+
};
|
|
18
|
+
export type BitcoinInputRaw = [
|
|
19
|
+
string | null | undefined,
|
|
20
|
+
string | null | undefined,
|
|
21
|
+
string | null | undefined,
|
|
22
|
+
number
|
|
23
|
+
];
|
|
24
|
+
export type BitcoinOutput = {
|
|
25
|
+
hash: string;
|
|
26
|
+
outputIndex: number;
|
|
27
|
+
blockHeight: number | null | undefined;
|
|
28
|
+
address: string | null | undefined;
|
|
29
|
+
path: string | null | undefined;
|
|
30
|
+
value: BigNumber;
|
|
31
|
+
rbf: boolean;
|
|
32
|
+
};
|
|
33
|
+
export type BitcoinOutputRaw = [
|
|
34
|
+
string,
|
|
35
|
+
number,
|
|
36
|
+
number | null | undefined,
|
|
37
|
+
string | null | undefined,
|
|
38
|
+
string | null | undefined,
|
|
39
|
+
string,
|
|
40
|
+
number // rbf 0/1 for compression
|
|
41
|
+
];
|
|
42
|
+
export type BitcoinResources = {
|
|
43
|
+
utxos: BitcoinOutput[];
|
|
44
|
+
};
|
|
45
|
+
export type BitcoinResourcesRaw = {
|
|
46
|
+
utxos: BitcoinOutputRaw[];
|
|
47
|
+
};
|
|
14
48
|
|
|
15
|
-
//* TODO REPLACE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
|
16
49
|
declare class CoreBitcoinLikeInput {
|
|
17
50
|
getPreviousTransaction(): Promise<string>;
|
|
18
51
|
getPreviousTxHash(): Promise<string | null | undefined>;
|
|
@@ -97,93 +130,6 @@ export type CoreOperationSpecifics = {
|
|
|
97
130
|
export type CoreCurrencySpecifics = {
|
|
98
131
|
getBitcoinLikeNetworkParameters(): Promise<CoreBitcoinLikeNetworkParameters>;
|
|
99
132
|
};
|
|
100
|
-
/*/ WITH >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
101
|
-
export type CoreStatics = Record<string, never>;
|
|
102
|
-
export type CoreAccountSpecifics = Record<string, never>;
|
|
103
|
-
export type CoreOperationSpecifics = Record<string, never>;
|
|
104
|
-
export type CoreCurrencySpecifics = Record<string, never>;
|
|
105
|
-
//*/ // ====================================================
|
|
106
|
-
|
|
107
|
-
export type BitcoinInput = {
|
|
108
|
-
address: string | null | undefined;
|
|
109
|
-
value: BigNumber | null | undefined;
|
|
110
|
-
previousTxHash: string | null | undefined;
|
|
111
|
-
previousOutputIndex: number;
|
|
112
|
-
};
|
|
113
|
-
export type BitcoinInputRaw = [
|
|
114
|
-
string | null | undefined,
|
|
115
|
-
string | null | undefined,
|
|
116
|
-
string | null | undefined,
|
|
117
|
-
number
|
|
118
|
-
];
|
|
119
|
-
export type BitcoinOutput = {
|
|
120
|
-
hash: string;
|
|
121
|
-
outputIndex: number;
|
|
122
|
-
blockHeight: number | null | undefined;
|
|
123
|
-
address: string | null | undefined;
|
|
124
|
-
isChange: boolean;
|
|
125
|
-
path: string | null | undefined; // TODO DEPRECATED, TO BE REMOVED
|
|
126
|
-
value: BigNumber;
|
|
127
|
-
rbf: boolean;
|
|
128
|
-
};
|
|
129
|
-
export type BitcoinOutputRaw = [
|
|
130
|
-
string,
|
|
131
|
-
number,
|
|
132
|
-
number | null | undefined,
|
|
133
|
-
string | null | undefined,
|
|
134
|
-
number,
|
|
135
|
-
string | null | undefined, // TODO DEPRECATED, TO BE REMOVED
|
|
136
|
-
string,
|
|
137
|
-
number // rbf 0/1 for compression
|
|
138
|
-
];
|
|
139
|
-
export type BitcoinResources = {
|
|
140
|
-
utxos: BitcoinOutput[];
|
|
141
|
-
serializedData?: WalletSerializedAccount; // TODO '?' TO BE REMOVED
|
|
142
|
-
};
|
|
143
|
-
export type BitcoinResourcesRaw = {
|
|
144
|
-
utxos: BitcoinOutputRaw[];
|
|
145
|
-
serializedData?: WalletSerializedAccount; // TODO '?' TO BE REMOVED
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
export const BitcoinLikeFeePolicy = Object.freeze({
|
|
149
|
-
PER_BYTE: "PER_BYTE",
|
|
150
|
-
PER_KBYTE: "PER_KBYTE",
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
export const BitcoinLikeSigHashType = Object.freeze({
|
|
154
|
-
SIGHASH_ALL: 0x01,
|
|
155
|
-
SIGHASH_NONE: 0x02,
|
|
156
|
-
SIGHASH_SINGLE: 0x03,
|
|
157
|
-
SIGHASH_FORKID: 0x40,
|
|
158
|
-
SIGHASH_ANYONECANPAY: 0x80,
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
// TODO maybe not all fields are useful
|
|
162
|
-
export type BitcoinLikeNetworkParameters = {
|
|
163
|
-
// Name of the network.
|
|
164
|
-
identifier: string;
|
|
165
|
-
// Version of the Pay To Public Hash standard.
|
|
166
|
-
P2PKHVersion: Buffer;
|
|
167
|
-
// Version of the Pay To Script Hash standard.
|
|
168
|
-
P2SHVersion: Buffer;
|
|
169
|
-
// Version of the Extended Public Key standard.
|
|
170
|
-
xpubVersion: Buffer;
|
|
171
|
-
// Policy to use when expressing fee amount, values in BitcoinLikeFeePolicy
|
|
172
|
-
feePolicy: string;
|
|
173
|
-
// Minimal amount a UTXO should have before being considered BTC dust.
|
|
174
|
-
dustAmount: BigNumber;
|
|
175
|
-
// Constant prefix to prepend all signature messages.
|
|
176
|
-
messagePrefix: string;
|
|
177
|
-
// Are transactions encoded with timestamp?
|
|
178
|
-
usesTimestampedTransaction: boolean;
|
|
179
|
-
// Delay applied to all timestamps. Used to debounce transactions.
|
|
180
|
-
timestampDelay: BigNumber;
|
|
181
|
-
// Bitcoin signature flag indicating what part of a transaction a signature signs, values in BitcoinLikeSigHashType
|
|
182
|
-
sigHash: number;
|
|
183
|
-
// Addition BIPs enabled for this network.
|
|
184
|
-
additionalBIPs: string[];
|
|
185
|
-
};
|
|
186
|
-
|
|
187
133
|
export type FeeItem = {
|
|
188
134
|
key: string;
|
|
189
135
|
speed: string;
|
|
@@ -217,6 +163,7 @@ export const bitcoinPickingStrategy = {
|
|
|
217
163
|
};
|
|
218
164
|
export type BitcoinPickingStrategy =
|
|
219
165
|
typeof bitcoinPickingStrategy[keyof typeof bitcoinPickingStrategy];
|
|
166
|
+
// FIXME the UtxoStrategy level should be flattened back in Transaction
|
|
220
167
|
export type UtxoStrategy = {
|
|
221
168
|
strategy: BitcoinPickingStrategy;
|
|
222
169
|
pickUnconfirmedRBF: boolean;
|
|
@@ -239,8 +186,6 @@ export type TransactionRaw = TransactionCommonRaw & {
|
|
|
239
186
|
feePerByte: string | null | undefined;
|
|
240
187
|
networkInfo: NetworkInfoRaw | null | undefined;
|
|
241
188
|
};
|
|
242
|
-
|
|
243
|
-
//* TODO REPLACE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
|
244
189
|
export const reflect = (
|
|
245
190
|
declare: (arg0: string, arg1: Spec) => void
|
|
246
191
|
): {
|
|
@@ -370,6 +315,3 @@ export const reflect = (
|
|
|
370
315
|
},
|
|
371
316
|
};
|
|
372
317
|
};
|
|
373
|
-
/*/ WITH >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
374
|
-
export const reflect = (_declare: any): void => {};
|
|
375
|
-
//*/ // ====================================================
|
|
@@ -2,9 +2,9 @@ import { CroNetwork, CroSDK, utils } from "@crypto-com/chain-jslib";
|
|
|
2
2
|
export const TESTNET_CURRENCY_ID = "crypto_org_croeseid";
|
|
3
3
|
export const FIXED_GAS_PRICE = 0.025;
|
|
4
4
|
export const FIXED_DEFAULT_GAS_LIMIT = 200000;
|
|
5
|
-
export const
|
|
6
|
-
defaultNodeUrl: "https://testnet-croeseid-
|
|
7
|
-
chainId: "testnet-croeseid-
|
|
5
|
+
export const TestnetCroeseid4 = {
|
|
6
|
+
defaultNodeUrl: "https://testnet-croeseid-4.crypto.org",
|
|
7
|
+
chainId: "testnet-croeseid-4",
|
|
8
8
|
addressPrefix: "tcro",
|
|
9
9
|
validatorAddressPrefix: "tcrocncl",
|
|
10
10
|
validatorPubKeyPrefix: "tcrocnclconspub",
|
|
@@ -16,7 +16,7 @@ export const TestnetCroeseid3 = {
|
|
|
16
16
|
coinType: 1,
|
|
17
17
|
account: 0,
|
|
18
18
|
},
|
|
19
|
-
rpcUrl: "https://testnet-croeseid-
|
|
19
|
+
rpcUrl: "https://testnet-croeseid-4.crypto.org:26657",
|
|
20
20
|
};
|
|
21
21
|
const croSdks = {};
|
|
22
22
|
|
|
@@ -37,7 +37,7 @@ export function getCroSdk(currencyId: string) {
|
|
|
37
37
|
if (!croSdks[currencyId]) {
|
|
38
38
|
croSdks[currencyId] = isTestNet(currencyId)
|
|
39
39
|
? CroSDK({
|
|
40
|
-
network:
|
|
40
|
+
network: TestnetCroeseid4,
|
|
41
41
|
})
|
|
42
42
|
: CroSDK({
|
|
43
43
|
network: CroNetwork.Mainnet,
|
|
@@ -58,7 +58,7 @@ export const isValidAddress = (
|
|
|
58
58
|
currencyId: string
|
|
59
59
|
): boolean => {
|
|
60
60
|
if (!address) return false;
|
|
61
|
-
const network = isTestNet(currencyId) ?
|
|
61
|
+
const network = isTestNet(currencyId) ? TestnetCroeseid4 : CroNetwork.Mainnet;
|
|
62
62
|
const addressProps = {
|
|
63
63
|
address: address,
|
|
64
64
|
network: network,
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
InvalidAddress,
|
|
6
6
|
FeeNotLoaded,
|
|
7
7
|
InvalidAddressBecauseDestinationIsAlsoSource,
|
|
8
|
+
FeeTooHigh,
|
|
8
9
|
} from "@ledgerhq/errors";
|
|
9
10
|
import type { Account, TransactionStatus } from "../../types";
|
|
10
11
|
import type { Transaction } from "./types";
|
|
@@ -42,6 +43,10 @@ const getTransactionStatus = async (
|
|
|
42
43
|
errors.amount = new NotEnoughBalance();
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
if (amount.div(10).lt(estimatedFees)) {
|
|
47
|
+
warnings.feeTooHigh = new FeeTooHigh();
|
|
48
|
+
}
|
|
49
|
+
|
|
45
50
|
return Promise.resolve({
|
|
46
51
|
errors,
|
|
47
52
|
warnings,
|
|
@@ -59,6 +59,7 @@ const signOperation = ({
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
const elrond = new Elrond(transport);
|
|
62
|
+
await elrond.setAddress(account.freshAddressPath);
|
|
62
63
|
const { version } = await elrond.getAppConfiguration();
|
|
63
64
|
const signUsingHash = compareVersions(version, "1.0.11") >= 0;
|
|
64
65
|
const unsigned = await buildTransaction(
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import bitcoin from "../../families/bitcoin/bridge/js";
|
|
2
|
-
|
|
3
1
|
import crypto_org from "../../families/crypto_org/bridge/js";
|
|
4
2
|
|
|
5
3
|
import elrond from "../../families/elrond/bridge/js";
|
|
@@ -20,7 +18,6 @@ import tron from "../../families/tron/bridge/js";
|
|
|
20
18
|
|
|
21
19
|
|
|
22
20
|
export default {
|
|
23
|
-
bitcoin,
|
|
24
21
|
crypto_org,
|
|
25
22
|
elrond,
|
|
26
23
|
ethereum,
|
|
@@ -149,7 +149,7 @@ export const createAction = (
|
|
|
149
149
|
const hasError = error || state.error;
|
|
150
150
|
useEffect(() => {
|
|
151
151
|
if (!opened || !device) {
|
|
152
|
-
setState({ ...initialState, isLoading:
|
|
152
|
+
setState({ ...initialState, isLoading: !!device });
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -175,7 +175,7 @@ export const createAction = (
|
|
|
175
175
|
error,
|
|
176
176
|
})
|
|
177
177
|
),
|
|
178
|
-
scan(reducer, initialState)
|
|
178
|
+
scan(reducer, { ...initialState, isLoading: !hasError })
|
|
179
179
|
)
|
|
180
180
|
.subscribe(setState);
|
|
181
181
|
return () => {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { SerializedAccount as WalletSerializedAccount } from "@ledgerhq/wallet-btc";
|
|
2
1
|
import { fromAccountRaw } from "../account";
|
|
3
2
|
import type { Account, AccountRaw } from "../types";
|
|
4
3
|
|
|
@@ -27,7 +26,6 @@ const accounts: Account[] = [
|
|
|
27
26
|
xpub: "xpub6DACJs4ZgE67HEu53j2osRtw51wfJybJ88ccVQnHpmjqr9XJfMYXn6Fxt3u772FonuWfqYUrb9Z9wxe2S9pTzxGDiQZDk1cMPiDH2S5HjYa",
|
|
28
27
|
bitcoinResources: {
|
|
29
28
|
utxos: [],
|
|
30
|
-
serializedData: {} as WalletSerializedAccount,
|
|
31
29
|
},
|
|
32
30
|
swapHistory: [
|
|
33
31
|
{
|
|
@@ -90,7 +88,6 @@ const accounts: Account[] = [
|
|
|
90
88
|
xpub: "Ltub2Zx1tbqWB7AbC4fb7aWgsuyXBm2qt97gzG5av4PHAjdAhvdZQFHS7nmcScgtAvpgcGAkVQQvR9BXwu54ny6Yqwst4KQAnyD1Yx6VezNf1S8",
|
|
91
89
|
bitcoinResources: {
|
|
92
90
|
utxos: [],
|
|
93
|
-
serializedData: {} as WalletSerializedAccount,
|
|
94
91
|
},
|
|
95
92
|
swapHistory: [
|
|
96
93
|
{
|
|
@@ -16,24 +16,6 @@ function sameSwap(a: SwapOperation, b: SwapOperation) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export const implicitMigration = (accounts: Account[]): Account[] => {
|
|
19
|
-
// TODO Need this for BTC-JS?
|
|
20
|
-
/*
|
|
21
|
-
// this infer the next account id following ongoing libcore->js migration
|
|
22
|
-
function targetBitcoinJSaccountId(a: AccountLike) {
|
|
23
|
-
if (a.type === "Account") {
|
|
24
|
-
const decoded = decodeAccountId(a.id);
|
|
25
|
-
if (decoded.type !== "libcore") {
|
|
26
|
-
return a.id;
|
|
27
|
-
}
|
|
28
|
-
if (decoded.currencyId !== "bitcoin") {
|
|
29
|
-
return a.id;
|
|
30
|
-
}
|
|
31
|
-
return `js:2:${decoded.currencyId}:${a.freshAddress}:${decoded.derivationMode}`;
|
|
32
|
-
}
|
|
33
|
-
return a.id;
|
|
34
|
-
}
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
19
|
// this infer the next account id following ongoing libcore->js migration
|
|
38
20
|
function targetEthereumJSaccountId(a: AccountLike) {
|
|
39
21
|
if (a.type === "Account") {
|
package/src/mock/account.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Prando from "prando";
|
|
2
2
|
import { BigNumber } from "bignumber.js";
|
|
3
|
-
import type { SerializedAccount as WalletSerializedAccount } from "@ledgerhq/wallet-btc";
|
|
4
3
|
import {
|
|
5
4
|
listCryptoCurrencies,
|
|
6
5
|
listTokensForCryptoCurrency,
|
|
@@ -413,7 +412,6 @@ export function genAccount(
|
|
|
413
412
|
if (currency.family === "bitcoin") {
|
|
414
413
|
account.bitcoinResources = {
|
|
415
414
|
utxos: [],
|
|
416
|
-
serializedData: {} as WalletSerializedAccount,
|
|
417
415
|
};
|
|
418
416
|
}
|
|
419
417
|
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { AccountBridge, CurrencyBridge } from "../../../types/bridge";
|
|
2
|
-
import type { Transaction } from "../types";
|
|
3
|
-
declare const _default: {
|
|
4
|
-
currencyBridge: CurrencyBridge;
|
|
5
|
-
accountBridge: AccountBridge<Transaction>;
|
|
6
|
-
};
|
|
7
|
-
export default _default;
|
|
8
|
-
//# sourceMappingURL=js.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"js.d.ts","sourceRoot":"","sources":["../../../../src/families/bitcoin/bridge/js.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;;;;;AAuE5C,wBAGE"}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
-
if (mod && mod.__esModule) return mod;
|
|
27
|
-
var result = {};
|
|
28
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
-
__setModuleDefault(result, mod);
|
|
30
|
-
return result;
|
|
31
|
-
};
|
|
32
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
33
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
34
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
35
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
36
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
37
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
38
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
42
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
43
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
44
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
45
|
-
function step(op) {
|
|
46
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
47
|
-
while (_) try {
|
|
48
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
49
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
50
|
-
switch (op[0]) {
|
|
51
|
-
case 0: case 1: t = op; break;
|
|
52
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
53
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
54
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
55
|
-
default:
|
|
56
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
57
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
58
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
59
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
60
|
-
if (t[2]) _.ops.pop();
|
|
61
|
-
_.trys.pop(); continue;
|
|
62
|
-
}
|
|
63
|
-
op = body.call(thisArg, _);
|
|
64
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
65
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
69
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
70
|
-
};
|
|
71
|
-
exports.__esModule = true;
|
|
72
|
-
var js_synchronisation_1 = require("../js-synchronisation");
|
|
73
|
-
var js_createTransaction_1 = __importDefault(require("../js-createTransaction"));
|
|
74
|
-
var js_prepareTransaction_1 = __importDefault(require("../js-prepareTransaction"));
|
|
75
|
-
var js_getTransactionStatus_1 = __importDefault(require("../js-getTransactionStatus"));
|
|
76
|
-
var js_estimateMaxSpendable_1 = __importDefault(require("../js-estimateMaxSpendable"));
|
|
77
|
-
var js_signOperation_1 = __importDefault(require("../js-signOperation"));
|
|
78
|
-
var js_broadcast_1 = __importDefault(require("../js-broadcast"));
|
|
79
|
-
var cache_1 = require("./../cache");
|
|
80
|
-
var logic_1 = require("../logic");
|
|
81
|
-
var jsHelpers_1 = require("../../../bridge/jsHelpers");
|
|
82
|
-
var explorerConfigAPI = __importStar(require("../../../api/explorerConfig"));
|
|
83
|
-
var receive = (0, jsHelpers_1.makeAccountBridgeReceive)({
|
|
84
|
-
injectGetAddressParams: function (account) {
|
|
85
|
-
var perCoin = logic_1.perCoinLogic[account.currency.id];
|
|
86
|
-
if (perCoin && perCoin.injectGetAddressParams) {
|
|
87
|
-
return perCoin.injectGetAddressParams(account);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
var updateTransaction = function (t, patch) {
|
|
92
|
-
var updatedT = __assign(__assign({}, t), patch);
|
|
93
|
-
if (updatedT.recipient.toLowerCase().indexOf("bc1") === 0) {
|
|
94
|
-
updatedT.recipient = updatedT.recipient.toLowerCase();
|
|
95
|
-
}
|
|
96
|
-
return updatedT;
|
|
97
|
-
};
|
|
98
|
-
var preload = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
99
|
-
var explorerConfig;
|
|
100
|
-
return __generator(this, function (_a) {
|
|
101
|
-
switch (_a.label) {
|
|
102
|
-
case 0: return [4 /*yield*/, explorerConfigAPI.preload()];
|
|
103
|
-
case 1:
|
|
104
|
-
explorerConfig = _a.sent();
|
|
105
|
-
return [2 /*return*/, {
|
|
106
|
-
explorerConfig: explorerConfig
|
|
107
|
-
}];
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}); };
|
|
111
|
-
var hydrate = function (maybeConfig) {
|
|
112
|
-
if (typeof maybeConfig === "object" &&
|
|
113
|
-
maybeConfig &&
|
|
114
|
-
maybeConfig.explorerConfig) {
|
|
115
|
-
explorerConfigAPI.hydrate(maybeConfig.explorerConfig);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
var currencyBridge = {
|
|
119
|
-
scanAccounts: js_synchronisation_1.scanAccounts,
|
|
120
|
-
preload: preload,
|
|
121
|
-
hydrate: hydrate
|
|
122
|
-
};
|
|
123
|
-
var accountBridge = {
|
|
124
|
-
estimateMaxSpendable: js_estimateMaxSpendable_1["default"],
|
|
125
|
-
createTransaction: js_createTransaction_1["default"],
|
|
126
|
-
prepareTransaction: js_prepareTransaction_1["default"],
|
|
127
|
-
updateTransaction: updateTransaction,
|
|
128
|
-
getTransactionStatus: js_getTransactionStatus_1["default"],
|
|
129
|
-
receive: receive,
|
|
130
|
-
sync: js_synchronisation_1.sync,
|
|
131
|
-
signOperation: js_signOperation_1["default"],
|
|
132
|
-
broadcast: function (_a) {
|
|
133
|
-
var account = _a.account, signedOperation = _a.signedOperation;
|
|
134
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
135
|
-
return __generator(this, function (_b) {
|
|
136
|
-
cache_1.calculateFees.reset();
|
|
137
|
-
return [2 /*return*/, (0, js_broadcast_1["default"])({
|
|
138
|
-
account: account,
|
|
139
|
-
signedOperation: signedOperation
|
|
140
|
-
})];
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
exports["default"] = {
|
|
146
|
-
currencyBridge: currencyBridge,
|
|
147
|
-
accountBridge: accountBridge
|
|
148
|
-
};
|
|
149
|
-
//# sourceMappingURL=js.js.map
|