@ledgerhq/live-common 31.6.0 → 31.7.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/helpers.d.ts.map +1 -1
- package/lib/account/helpers.js +0 -5
- package/lib/account/helpers.js.map +1 -1
- package/lib/bot/engine.d.ts.map +1 -1
- package/lib/bot/engine.js +6 -0
- package/lib/bot/engine.js.map +1 -1
- package/lib/config/defaultConfig.js +1 -1
- package/lib/config/defaultConfig.js.map +1 -1
- package/lib/cross.d.ts +6 -1
- package/lib/cross.d.ts.map +1 -1
- package/lib/cross.js +12 -2
- package/lib/cross.js.map +1 -1
- package/lib/cross.test.js +7 -0
- package/lib/cross.test.js.map +1 -1
- package/lib/exchange/swap/api/v5/__tests__/fetchCurrencyFrom.spec.js +3 -2
- package/lib/exchange/swap/api/v5/__tests__/fetchCurrencyFrom.spec.js.map +1 -1
- package/lib/exchange/swap/api/v5/__tests__/fetchCurrencyTo.spec.js +5 -4
- package/lib/exchange/swap/api/v5/__tests__/fetchCurrencyTo.spec.js.map +1 -1
- package/lib/exchange/swap/api/v5/fetchCurrencyFrom.d.ts +1 -1
- package/lib/exchange/swap/api/v5/fetchCurrencyFrom.d.ts.map +1 -1
- package/lib/exchange/swap/api/v5/fetchCurrencyFrom.js +5 -3
- package/lib/exchange/swap/api/v5/fetchCurrencyFrom.js.map +1 -1
- package/lib/exchange/swap/api/v5/fetchCurrencyTo.d.ts +2 -2
- package/lib/exchange/swap/api/v5/fetchCurrencyTo.d.ts.map +1 -1
- package/lib/exchange/swap/api/v5/fetchCurrencyTo.js +7 -5
- package/lib/exchange/swap/api/v5/fetchCurrencyTo.js.map +1 -1
- package/lib/exchange/swap/api/v5/fetchRates.d.ts +10 -0
- package/lib/exchange/swap/api/v5/fetchRates.d.ts.map +1 -0
- package/lib/exchange/swap/api/v5/fetchRates.js +53 -0
- package/lib/exchange/swap/api/v5/fetchRates.js.map +1 -0
- package/lib/exchange/swap/completeExchange.d.ts.map +1 -1
- package/lib/exchange/swap/completeExchange.js +2 -1
- package/lib/exchange/swap/completeExchange.js.map +1 -1
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyFrom.d.ts +13 -0
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyFrom.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyFrom.js +21 -0
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyFrom.js.map +1 -0
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyTo.d.ts +13 -0
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyTo.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyTo.js +25 -0
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyTo.js.map +1 -0
- package/lib/exchange/swap/hooks/v5/useFetchRates.d.ts +18 -0
- package/lib/exchange/swap/hooks/v5/useFetchRates.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/v5/useFetchRates.js +28 -0
- package/lib/exchange/swap/hooks/v5/useFetchRates.js.map +1 -0
- package/lib/exchange/swap/types.d.ts +24 -0
- package/lib/exchange/swap/types.d.ts.map +1 -1
- package/lib/exchange/swap/utils/flattenV5CurrenciesToAndFrom.d.ts +4 -0
- package/lib/exchange/swap/utils/flattenV5CurrenciesToAndFrom.d.ts.map +1 -0
- package/lib/exchange/swap/utils/flattenV5CurrenciesToAndFrom.js +9 -0
- package/lib/exchange/swap/utils/flattenV5CurrenciesToAndFrom.js.map +1 -0
- package/lib/exchange/swap/webApp/index.d.ts +2 -0
- package/lib/exchange/swap/webApp/index.d.ts.map +1 -0
- package/lib/exchange/swap/webApp/index.js +18 -0
- package/lib/exchange/swap/webApp/index.js.map +1 -0
- package/lib/exchange/swap/webApp/utils.d.ts +31 -0
- package/lib/exchange/swap/webApp/utils.d.ts.map +1 -0
- package/lib/exchange/swap/webApp/utils.js +43 -0
- package/lib/exchange/swap/webApp/utils.js.map +1 -0
- package/lib/families/cosmos/account.js +8 -8
- package/lib/families/cosmos/account.js.map +1 -1
- package/lib/families/cosmos/api/Cosmos.d.ts +4 -0
- package/lib/families/cosmos/api/Cosmos.d.ts.map +1 -1
- package/lib/families/cosmos/api/Cosmos.js +3 -1
- package/lib/families/cosmos/api/Cosmos.js.map +1 -1
- package/lib/families/cosmos/banner.test.js +1 -0
- package/lib/families/cosmos/banner.test.js.map +1 -1
- package/lib/families/cosmos/chain/Osmosis.d.ts.map +1 -1
- package/lib/families/cosmos/chain/Osmosis.js +0 -2
- package/lib/families/cosmos/chain/Osmosis.js.map +1 -1
- package/lib/families/cosmos/chain/cosmosBase.d.ts +0 -2
- package/lib/families/cosmos/chain/cosmosBase.d.ts.map +1 -1
- package/lib/families/cosmos/chain/cosmosBase.js +0 -2
- package/lib/families/cosmos/chain/cosmosBase.js.map +1 -1
- package/lib/families/cosmos/datasets/cosmos.d.ts.map +1 -1
- package/lib/families/cosmos/datasets/cosmos.js +15 -13
- package/lib/families/cosmos/datasets/cosmos.js.map +1 -1
- package/lib/families/cosmos/js-synchronisation.d.ts.map +1 -1
- package/lib/families/cosmos/js-synchronisation.js +2 -1
- package/lib/families/cosmos/js-synchronisation.js.map +1 -1
- package/lib/families/cosmos/js-synchronisation.unit.test.js +1 -0
- package/lib/families/cosmos/js-synchronisation.unit.test.js.map +1 -1
- package/lib/families/cosmos/mock.d.ts.map +1 -1
- package/lib/families/cosmos/mock.js +6 -0
- package/lib/families/cosmos/mock.js.map +1 -1
- package/lib/families/cosmos/serialization.d.ts.map +1 -1
- package/lib/families/cosmos/serialization.js +4 -2
- package/lib/families/cosmos/serialization.js.map +1 -1
- package/lib/families/cosmos/specs.d.ts +45 -33
- package/lib/families/cosmos/specs.d.ts.map +1 -1
- package/lib/families/cosmos/specs.js +102 -41
- package/lib/families/cosmos/specs.js.map +1 -1
- package/lib/families/cosmos/types.d.ts +2 -0
- package/lib/families/cosmos/types.d.ts.map +1 -1
- package/lib/families/elrond/specs.d.ts.map +1 -1
- package/lib/families/elrond/specs.js.map +1 -1
- package/lib/families/polkadot/bridge/mock.d.ts.map +1 -1
- package/lib/families/polkadot/bridge/mock.js +105 -102
- package/lib/families/polkadot/bridge/mock.js.map +1 -1
- package/lib/generated/specs.d.ts +44 -33
- package/lib/generated/specs.d.ts.map +1 -1
- package/lib/hooks/useAPI.d.ts +20 -0
- package/lib/hooks/useAPI.d.ts.map +1 -0
- package/lib/hooks/useAPI.js +62 -0
- package/lib/hooks/useAPI.js.map +1 -0
- package/lib/mock/account.d.ts.map +1 -1
- package/lib/mock/account.js +1 -0
- package/lib/mock/account.js.map +1 -1
- package/lib-es/account/helpers.d.ts.map +1 -1
- package/lib-es/account/helpers.js +0 -5
- package/lib-es/account/helpers.js.map +1 -1
- package/lib-es/bot/engine.d.ts.map +1 -1
- package/lib-es/bot/engine.js +6 -0
- package/lib-es/bot/engine.js.map +1 -1
- package/lib-es/config/defaultConfig.js +1 -1
- package/lib-es/config/defaultConfig.js.map +1 -1
- package/lib-es/cross.d.ts +6 -1
- package/lib-es/cross.d.ts.map +1 -1
- package/lib-es/cross.js +12 -2
- package/lib-es/cross.js.map +1 -1
- package/lib-es/cross.test.js +7 -0
- package/lib-es/cross.test.js.map +1 -1
- package/lib-es/exchange/swap/api/v5/__tests__/fetchCurrencyFrom.spec.js +3 -2
- package/lib-es/exchange/swap/api/v5/__tests__/fetchCurrencyFrom.spec.js.map +1 -1
- package/lib-es/exchange/swap/api/v5/__tests__/fetchCurrencyTo.spec.js +5 -4
- package/lib-es/exchange/swap/api/v5/__tests__/fetchCurrencyTo.spec.js.map +1 -1
- package/lib-es/exchange/swap/api/v5/fetchCurrencyFrom.d.ts +1 -1
- package/lib-es/exchange/swap/api/v5/fetchCurrencyFrom.d.ts.map +1 -1
- package/lib-es/exchange/swap/api/v5/fetchCurrencyFrom.js +5 -3
- package/lib-es/exchange/swap/api/v5/fetchCurrencyFrom.js.map +1 -1
- package/lib-es/exchange/swap/api/v5/fetchCurrencyTo.d.ts +2 -2
- package/lib-es/exchange/swap/api/v5/fetchCurrencyTo.d.ts.map +1 -1
- package/lib-es/exchange/swap/api/v5/fetchCurrencyTo.js +7 -5
- package/lib-es/exchange/swap/api/v5/fetchCurrencyTo.js.map +1 -1
- package/lib-es/exchange/swap/api/v5/fetchRates.d.ts +10 -0
- package/lib-es/exchange/swap/api/v5/fetchRates.d.ts.map +1 -0
- package/lib-es/exchange/swap/api/v5/fetchRates.js +46 -0
- package/lib-es/exchange/swap/api/v5/fetchRates.js.map +1 -0
- package/lib-es/exchange/swap/completeExchange.d.ts.map +1 -1
- package/lib-es/exchange/swap/completeExchange.js +2 -1
- package/lib-es/exchange/swap/completeExchange.js.map +1 -1
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyFrom.d.ts +13 -0
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyFrom.d.ts.map +1 -0
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyFrom.js +17 -0
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyFrom.js.map +1 -0
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyTo.d.ts +13 -0
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyTo.d.ts.map +1 -0
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyTo.js +21 -0
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyTo.js.map +1 -0
- package/lib-es/exchange/swap/hooks/v5/useFetchRates.d.ts +18 -0
- package/lib-es/exchange/swap/hooks/v5/useFetchRates.d.ts.map +1 -0
- package/lib-es/exchange/swap/hooks/v5/useFetchRates.js +24 -0
- package/lib-es/exchange/swap/hooks/v5/useFetchRates.js.map +1 -0
- package/lib-es/exchange/swap/types.d.ts +24 -0
- package/lib-es/exchange/swap/types.d.ts.map +1 -1
- package/lib-es/exchange/swap/utils/flattenV5CurrenciesToAndFrom.d.ts +4 -0
- package/lib-es/exchange/swap/utils/flattenV5CurrenciesToAndFrom.d.ts.map +1 -0
- package/lib-es/exchange/swap/utils/flattenV5CurrenciesToAndFrom.js +5 -0
- package/lib-es/exchange/swap/utils/flattenV5CurrenciesToAndFrom.js.map +1 -0
- package/lib-es/exchange/swap/webApp/index.d.ts +2 -0
- package/lib-es/exchange/swap/webApp/index.d.ts.map +1 -0
- package/lib-es/exchange/swap/webApp/index.js +2 -0
- package/lib-es/exchange/swap/webApp/index.js.map +1 -0
- package/lib-es/exchange/swap/webApp/utils.d.ts +31 -0
- package/lib-es/exchange/swap/webApp/utils.d.ts.map +1 -0
- package/lib-es/exchange/swap/webApp/utils.js +38 -0
- package/lib-es/exchange/swap/webApp/utils.js.map +1 -0
- package/lib-es/families/cosmos/account.js +8 -8
- package/lib-es/families/cosmos/account.js.map +1 -1
- package/lib-es/families/cosmos/api/Cosmos.d.ts +4 -0
- package/lib-es/families/cosmos/api/Cosmos.d.ts.map +1 -1
- package/lib-es/families/cosmos/api/Cosmos.js +3 -1
- package/lib-es/families/cosmos/api/Cosmos.js.map +1 -1
- package/lib-es/families/cosmos/banner.test.js +1 -0
- package/lib-es/families/cosmos/banner.test.js.map +1 -1
- package/lib-es/families/cosmos/chain/Osmosis.d.ts.map +1 -1
- package/lib-es/families/cosmos/chain/Osmosis.js +0 -2
- package/lib-es/families/cosmos/chain/Osmosis.js.map +1 -1
- package/lib-es/families/cosmos/chain/cosmosBase.d.ts +0 -2
- package/lib-es/families/cosmos/chain/cosmosBase.d.ts.map +1 -1
- package/lib-es/families/cosmos/chain/cosmosBase.js +0 -2
- package/lib-es/families/cosmos/chain/cosmosBase.js.map +1 -1
- package/lib-es/families/cosmos/datasets/cosmos.d.ts.map +1 -1
- package/lib-es/families/cosmos/datasets/cosmos.js +15 -13
- package/lib-es/families/cosmos/datasets/cosmos.js.map +1 -1
- package/lib-es/families/cosmos/js-synchronisation.d.ts.map +1 -1
- package/lib-es/families/cosmos/js-synchronisation.js +2 -1
- package/lib-es/families/cosmos/js-synchronisation.js.map +1 -1
- package/lib-es/families/cosmos/js-synchronisation.unit.test.js +1 -0
- package/lib-es/families/cosmos/js-synchronisation.unit.test.js.map +1 -1
- package/lib-es/families/cosmos/mock.d.ts.map +1 -1
- package/lib-es/families/cosmos/mock.js +6 -0
- package/lib-es/families/cosmos/mock.js.map +1 -1
- package/lib-es/families/cosmos/serialization.d.ts.map +1 -1
- package/lib-es/families/cosmos/serialization.js +4 -2
- package/lib-es/families/cosmos/serialization.js.map +1 -1
- package/lib-es/families/cosmos/specs.d.ts +45 -33
- package/lib-es/families/cosmos/specs.d.ts.map +1 -1
- package/lib-es/families/cosmos/specs.js +102 -41
- package/lib-es/families/cosmos/specs.js.map +1 -1
- package/lib-es/families/cosmos/types.d.ts +2 -0
- package/lib-es/families/cosmos/types.d.ts.map +1 -1
- package/lib-es/families/elrond/specs.d.ts.map +1 -1
- package/lib-es/families/elrond/specs.js.map +1 -1
- package/lib-es/families/polkadot/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/polkadot/bridge/mock.js +106 -103
- package/lib-es/families/polkadot/bridge/mock.js.map +1 -1
- package/lib-es/generated/specs.d.ts +44 -33
- package/lib-es/generated/specs.d.ts.map +1 -1
- package/lib-es/hooks/useAPI.d.ts +20 -0
- package/lib-es/hooks/useAPI.d.ts.map +1 -0
- package/lib-es/hooks/useAPI.js +58 -0
- package/lib-es/hooks/useAPI.js.map +1 -0
- package/lib-es/mock/account.d.ts.map +1 -1
- package/lib-es/mock/account.js +1 -0
- package/lib-es/mock/account.js.map +1 -1
- package/package.json +12 -12
- package/src/__snapshots__/cross.test.ts.snap +2 -0
- package/src/account/helpers.ts +0 -6
- package/src/bot/engine.ts +6 -0
- package/src/config/defaultConfig.ts +1 -1
- package/src/cross.test.ts +7 -0
- package/src/cross.ts +26 -2
- package/src/exchange/swap/api/v5/__tests__/fetchCurrencyFrom.spec.ts +3 -2
- package/src/exchange/swap/api/v5/__tests__/fetchCurrencyTo.spec.ts +5 -4
- package/src/exchange/swap/api/v5/fetchCurrencyFrom.ts +5 -3
- package/src/exchange/swap/api/v5/fetchCurrencyTo.ts +8 -5
- package/src/exchange/swap/api/v5/fetchRates.ts +48 -0
- package/src/exchange/swap/completeExchange.ts +2 -1
- package/src/exchange/swap/hooks/v5/useFetchCurrencyFrom.ts +23 -0
- package/src/exchange/swap/hooks/v5/useFetchCurrencyTo.ts +28 -0
- package/src/exchange/swap/hooks/v5/useFetchRates.ts +41 -0
- package/src/exchange/swap/types.ts +29 -0
- package/src/exchange/swap/utils/flattenV5CurrenciesToAndFrom.ts +7 -0
- package/src/exchange/swap/webApp/index.ts +1 -0
- package/src/exchange/swap/webApp/utils.ts +41 -0
- package/src/families/cosmos/account.ts +8 -8
- package/src/families/cosmos/api/Cosmos.ts +21 -10
- package/src/families/cosmos/banner.test.ts +1 -0
- package/src/families/cosmos/chain/Osmosis.ts +0 -2
- package/src/families/cosmos/chain/cosmosBase.ts +0 -3
- package/src/families/cosmos/datasets/__snapshots__/coreum.integration.test.ts.snap +0 -3
- package/src/families/cosmos/datasets/__snapshots__/cosmos.integration.test.ts.snap +259 -354
- package/src/families/cosmos/datasets/__snapshots__/onomy.integration.test.ts.snap +1 -235
- package/src/families/cosmos/datasets/cosmos.ts +15 -13
- package/src/families/cosmos/js-synchronisation.ts +11 -2
- package/src/families/cosmos/js-synchronisation.unit.test.ts +1 -0
- package/src/families/cosmos/mock.ts +6 -0
- package/src/families/cosmos/serialization.ts +4 -0
- package/src/families/cosmos/specs.ts +113 -54
- package/src/families/cosmos/types.ts +2 -0
- package/src/families/elrond/specs.ts +0 -1
- package/src/families/polkadot/bridge/mock.ts +109 -103
- package/src/hooks/useAPI.ts +81 -0
- package/src/mock/account.ts +1 -0
|
@@ -34,6 +34,35 @@ export type ExchangeRate = {
|
|
|
34
34
|
expirationTime?: number;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
type ExchangeRateV5ProviderType = "DEX" | "CEX" | "DISABLED";
|
|
38
|
+
|
|
39
|
+
type ExchangeRateV5CommonProperties = {
|
|
40
|
+
provider: string;
|
|
41
|
+
providerType: ExchangeRateV5ProviderType;
|
|
42
|
+
from: string;
|
|
43
|
+
to: string;
|
|
44
|
+
amountFrom: string;
|
|
45
|
+
amountTo: string;
|
|
46
|
+
payoutNetworkFees: string;
|
|
47
|
+
status: string;
|
|
48
|
+
providerURL?: string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
type ExchangeRateV5FloatRate = ExchangeRateV5CommonProperties & {
|
|
52
|
+
tradeMethod: "float";
|
|
53
|
+
rateId?: string;
|
|
54
|
+
minAmountFrom: string;
|
|
55
|
+
maxAmountFrom?: string;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
type ExchangeRateV5FixedRate = ExchangeRateV5CommonProperties & {
|
|
59
|
+
tradeMethod: "fixed";
|
|
60
|
+
rateId: string;
|
|
61
|
+
expirationTime: string;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export type ExchangeRateV5Response = ExchangeRateV5FloatRate | ExchangeRateV5FixedRate;
|
|
65
|
+
|
|
37
66
|
export type TradeMethod = "fixed" | "float";
|
|
38
67
|
|
|
39
68
|
export type ExchangeRateRaw = {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ResponseData as ResponseDataFrom } from "../api/v5/fetchCurrencyFrom";
|
|
2
|
+
import { ResponseData as ResponseDataTo } from "../api/v5/fetchCurrencyTo";
|
|
3
|
+
|
|
4
|
+
export function flattenV5CurrenciesToAndFrom(data: ResponseDataFrom | ResponseDataTo) {
|
|
5
|
+
const supportedCurrencies = data.currencyGroups.flatMap(group => group.supportedCurrencies);
|
|
6
|
+
return Array.from(new Set(supportedCurrencies));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./utils";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getGasLimit as getEthGasLimit } from "../../../families/ethereum/transaction";
|
|
2
|
+
import { getGasLimit as getEvmGasLimit } from "@ledgerhq/coin-evm/logic";
|
|
3
|
+
|
|
4
|
+
export const getCustomFeesPerFamily = transaction => {
|
|
5
|
+
const { family, maxFeePerGas, maxPriorityFeePerGas, userGasLimit, customGasLimit, feePerByte } =
|
|
6
|
+
transaction;
|
|
7
|
+
|
|
8
|
+
switch (family) {
|
|
9
|
+
case "ethereum": {
|
|
10
|
+
return {
|
|
11
|
+
maxFeePerGas,
|
|
12
|
+
maxPriorityFeePerGas,
|
|
13
|
+
userGasLimit,
|
|
14
|
+
gasLimit: getEthGasLimit(transaction),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
case "evm": {
|
|
18
|
+
return {
|
|
19
|
+
maxFeePerGas,
|
|
20
|
+
maxPriorityFeePerGas,
|
|
21
|
+
gasLimit: getEvmGasLimit(transaction),
|
|
22
|
+
customGasLimit,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
case "bitcoin": {
|
|
26
|
+
return {
|
|
27
|
+
feePerByte,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
default:
|
|
31
|
+
return {};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const convertToNonAtomicUnit = (amount, account) => {
|
|
36
|
+
const fromMagnitude =
|
|
37
|
+
account.type === "TokenAccount"
|
|
38
|
+
? account.token.units[0].magnitude || 0
|
|
39
|
+
: account.currency?.units[0].magnitude || 0;
|
|
40
|
+
return amount.shiftedBy(-fromMagnitude);
|
|
41
|
+
};
|
|
@@ -127,7 +127,7 @@ export function fromOperationExtraRaw(extraRaw: CosmosOperationExtraRaw): Cosmos
|
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
if (extraRaw.validators) {
|
|
130
|
+
if (extraRaw.validators && extraRaw.validators.length > 0) {
|
|
131
131
|
extra.validators = extraRaw.validators.map(validator => ({
|
|
132
132
|
address: validator.address,
|
|
133
133
|
amount: new BigNumber(validator.amount),
|
|
@@ -159,23 +159,23 @@ export function toOperationExtraRaw(extra: CosmosOperationExtra): CosmosOperatio
|
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
if (extra.validators) {
|
|
162
|
+
if (extra.validators && extra.validators.length > 0) {
|
|
163
163
|
extraRaw.validators = extra.validators.map(validator => ({
|
|
164
164
|
address: validator.address,
|
|
165
165
|
amount: validator.amount.toString(),
|
|
166
166
|
}));
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
if (
|
|
170
|
-
|
|
169
|
+
if (extra.sourceValidator) {
|
|
170
|
+
extraRaw.sourceValidator = extra.sourceValidator;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
if (
|
|
174
|
-
|
|
173
|
+
if (extra.autoClaimedRewards) {
|
|
174
|
+
extraRaw.autoClaimedRewards = extra.autoClaimedRewards;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
if (
|
|
178
|
-
|
|
177
|
+
if (extra.memo) {
|
|
178
|
+
extraRaw.memo = extra.memo;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
return extraRaw;
|
|
@@ -33,20 +33,31 @@ export class CosmosAPI {
|
|
|
33
33
|
redelegations: CosmosRedelegation[];
|
|
34
34
|
unbondings: CosmosUnbonding[];
|
|
35
35
|
withdrawAddress: string;
|
|
36
|
+
accountInfo: { sequence: number; accountNumber: number };
|
|
36
37
|
}> => {
|
|
37
38
|
try {
|
|
38
|
-
const [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
const [
|
|
40
|
+
accountInfo,
|
|
41
|
+
balances,
|
|
42
|
+
blockHeight,
|
|
43
|
+
txs,
|
|
44
|
+
delegations,
|
|
45
|
+
redelegations,
|
|
46
|
+
unbondings,
|
|
47
|
+
withdrawAddress,
|
|
48
|
+
] = await Promise.all([
|
|
49
|
+
this.getAccount(address),
|
|
50
|
+
this.getAllBalances(address, currency),
|
|
51
|
+
this.getHeight(),
|
|
52
|
+
this.getTransactions(address, 100),
|
|
53
|
+
this.getDelegations(address, currency),
|
|
54
|
+
this.getRedelegations(address),
|
|
55
|
+
this.getUnbondings(address),
|
|
56
|
+
this.getWithdrawAddress(address),
|
|
57
|
+
]);
|
|
48
58
|
|
|
49
59
|
return {
|
|
60
|
+
accountInfo,
|
|
50
61
|
balances,
|
|
51
62
|
blockHeight,
|
|
52
63
|
txs,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import CosmosBase from "./cosmosBase";
|
|
2
|
-
import { BigNumber } from "bignumber.js";
|
|
3
2
|
|
|
4
3
|
class Osmosis extends CosmosBase {
|
|
5
4
|
stakingDocUrl: string;
|
|
@@ -15,7 +14,6 @@ class Osmosis extends CosmosBase {
|
|
|
15
14
|
this.unbondingPeriod = 14;
|
|
16
15
|
this.stakingDocUrl =
|
|
17
16
|
"https://support.ledger.com/hc/en-us/articles/6235986236957-Earn-Osmosis-OSMO-staking-rewards-in-Ledger-Live?docs=true";
|
|
18
|
-
this.minimalTransactionAmount = new BigNumber(10);
|
|
19
17
|
this.validatorPrefix = `${this.prefix}valoper`;
|
|
20
18
|
}
|
|
21
19
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { BigNumber } from "bignumber.js";
|
|
2
|
-
|
|
3
1
|
abstract class cosmosBase {
|
|
4
2
|
abstract lcd: string;
|
|
5
3
|
abstract stakingDocUrl: string;
|
|
@@ -9,7 +7,6 @@ abstract class cosmosBase {
|
|
|
9
7
|
abstract prefix: string;
|
|
10
8
|
defaultGas = 100000;
|
|
11
9
|
minGasPrice = 0.0025;
|
|
12
|
-
minimalTransactionAmount = new BigNumber(10000);
|
|
13
10
|
version = "v1beta1";
|
|
14
11
|
public static COSMOS_FAMILY_LEDGER_VALIDATOR_ADDRESSES: string[] = [];
|
|
15
12
|
}
|
|
@@ -119,7 +119,6 @@ Array [
|
|
|
119
119
|
"contract": undefined,
|
|
120
120
|
"extra": Object {
|
|
121
121
|
"memo": "lb",
|
|
122
|
-
"validators": Array [],
|
|
123
122
|
},
|
|
124
123
|
"fee": "8880",
|
|
125
124
|
"hash": "0B17FF19A1E8DC703A3AEC457B414DE88845DD76BB4D95F8F6368F68D59248DF",
|
|
@@ -144,7 +143,6 @@ Array [
|
|
|
144
143
|
"contract": undefined,
|
|
145
144
|
"extra": Object {
|
|
146
145
|
"memo": "Lc",
|
|
147
|
-
"validators": Array [],
|
|
148
146
|
},
|
|
149
147
|
"fee": "10000",
|
|
150
148
|
"hash": "B128DC8C3D820F0832BEBD81045FA65ABFDC88FB83246B37E3F1298AF3DE778A",
|
|
@@ -171,7 +169,6 @@ Array [
|
|
|
171
169
|
"contract": undefined,
|
|
172
170
|
"extra": Object {
|
|
173
171
|
"memo": "lb",
|
|
174
|
-
"validators": Array [],
|
|
175
172
|
},
|
|
176
173
|
"fee": "8880",
|
|
177
174
|
"hash": "0B17FF19A1E8DC703A3AEC457B414DE88845DD76BB4D95F8F6368F68D59248DF",
|