@ledgerhq/live-common 21.33.1-cosmos.2 → 21.34.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/support.js +1 -1
- package/lib/account/support.js.map +1 -1
- package/lib/env.js +1 -1
- package/lib/env.js.map +1 -1
- package/lib/families/bitcoin/bridge/js.d.ts.map +1 -1
- package/lib/families/bitcoin/bridge/js.js.map +1 -1
- package/lib/families/cosmos/libcore-buildTransaction.d.ts.map +1 -1
- package/lib/families/cosmos/libcore-buildTransaction.js +1 -5
- package/lib/families/cosmos/libcore-buildTransaction.js.map +1 -1
- package/lib/families/cosmos/specs.d.ts.map +1 -1
- package/lib/families/cosmos/specs.js +37 -37
- package/lib/families/cosmos/specs.js.map +1 -1
- package/lib/families/cosmos/test-dataset.js +2 -2
- package/lib/families/cosmos/test-dataset.js.map +1 -1
- package/lib/families/cosmos/validators.d.ts.map +1 -1
- package/lib/families/cosmos/validators.js +15 -61
- package/lib/families/cosmos/validators.js.map +1 -1
- package/lib/families/filecoin/account.d.ts +8 -0
- package/lib/families/filecoin/account.d.ts.map +1 -0
- package/lib/families/filecoin/account.js +49 -0
- package/lib/families/filecoin/account.js.map +1 -0
- package/lib/families/filecoin/bridge/account.d.ts.map +1 -1
- package/lib/families/filecoin/bridge/account.js +30 -17
- package/lib/families/filecoin/bridge/account.js.map +1 -1
- package/lib/families/filecoin/bridge/utils/utils.d.ts +1 -2
- package/lib/families/filecoin/bridge/utils/utils.d.ts.map +1 -1
- package/lib/families/filecoin/bridge/utils/utils.js +7 -7
- package/lib/families/filecoin/bridge/utils/utils.js.map +1 -1
- package/lib/families/filecoin/deviceTransactionConfig.d.ts +28 -0
- package/lib/families/filecoin/deviceTransactionConfig.d.ts.map +1 -0
- package/lib/families/filecoin/deviceTransactionConfig.js +41 -0
- package/lib/families/filecoin/deviceTransactionConfig.js.map +1 -0
- package/lib/families/filecoin/transaction.d.ts +2 -2
- package/lib/families/filecoin/transaction.d.ts.map +1 -1
- package/lib/families/filecoin/transaction.js +12 -4
- package/lib/families/filecoin/transaction.js.map +1 -1
- package/lib/families/filecoin/utils.d.ts +1 -0
- package/lib/families/filecoin/utils.d.ts.map +1 -1
- package/lib/families/filecoin/utils.js +10 -1
- package/lib/families/filecoin/utils.js.map +1 -1
- package/lib/generated/account.d.ts +4 -0
- package/lib/generated/account.d.ts.map +1 -1
- package/lib/generated/account.js +4 -2
- package/lib/generated/account.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 +22 -24
- package/lib/generated/bridge/js.js.map +1 -1
- package/lib/generated/deviceTransactionConfig.d.ts +4 -1
- package/lib/generated/deviceTransactionConfig.d.ts.map +1 -1
- package/lib/generated/deviceTransactionConfig.js +14 -12
- package/lib/generated/deviceTransactionConfig.js.map +1 -1
- package/lib/generated/transaction.d.ts +1 -1
- package/package.json +1 -5
- package/src/__tests__/__snapshots__/all.libcore.ts.snap +0 -875
- package/src/account/support.ts +1 -1
- package/src/env.ts +1 -1
- package/src/families/bitcoin/bridge/js.ts +0 -1
- package/src/families/cosmos/libcore-buildTransaction.ts +1 -4
- package/src/families/cosmos/specs.ts +43 -45
- package/src/families/cosmos/test-dataset.ts +2 -2
- package/src/families/cosmos/validators.ts +77 -98
- package/src/families/filecoin/account.ts +44 -0
- package/src/families/filecoin/bridge/account.ts +34 -18
- package/src/families/filecoin/bridge/utils/utils.ts +8 -11
- package/src/families/filecoin/deviceTransactionConfig.ts +73 -0
- package/src/families/filecoin/transaction.ts +16 -6
- package/src/families/filecoin/utils.ts +9 -0
- package/src/generated/account.ts +3 -0
- package/src/generated/bridge/js.ts +0 -3
- package/src/generated/deviceTransactionConfig.ts +5 -0
- package/lib/families/cosmos/api/Cosmos.d.ts +0 -24
- package/lib/families/cosmos/api/Cosmos.d.ts.map +0 -1
- package/lib/families/cosmos/api/Cosmos.js +0 -524
- package/lib/families/cosmos/api/Cosmos.js.map +0 -1
- package/lib/families/cosmos/bridge/js.d.ts +0 -8
- package/lib/families/cosmos/bridge/js.d.ts.map +0 -1
- package/lib/families/cosmos/bridge/js.js +0 -103
- package/lib/families/cosmos/bridge/js.js.map +0 -1
- package/lib/families/cosmos/js-buildTransaction.d.ts +0 -6
- package/lib/families/cosmos/js-buildTransaction.d.ts.map +0 -1
- package/lib/families/cosmos/js-buildTransaction.js +0 -239
- package/lib/families/cosmos/js-buildTransaction.js.map +0 -1
- package/lib/families/cosmos/js-createTransaction.d.ts +0 -9
- package/lib/families/cosmos/js-createTransaction.d.ts.map +0 -1
- package/lib/families/cosmos/js-createTransaction.js +0 -23
- package/lib/families/cosmos/js-createTransaction.js.map +0 -1
- package/lib/families/cosmos/js-estimateMaxSpendable.d.ts +0 -10
- package/lib/families/cosmos/js-estimateMaxSpendable.d.ts.map +0 -1
- package/lib/families/cosmos/js-estimateMaxSpendable.js +0 -78
- package/lib/families/cosmos/js-estimateMaxSpendable.js.map +0 -1
- package/lib/families/cosmos/js-getTransactionStatus.d.ts +0 -5
- package/lib/families/cosmos/js-getTransactionStatus.d.ts.map +0 -1
- package/lib/families/cosmos/js-getTransactionStatus.js +0 -267
- package/lib/families/cosmos/js-getTransactionStatus.js.map +0 -1
- package/lib/families/cosmos/js-prepareTransaction.d.ts +0 -14
- package/lib/families/cosmos/js-prepareTransaction.d.ts.map +0 -1
- package/lib/families/cosmos/js-prepareTransaction.js +0 -149
- package/lib/families/cosmos/js-prepareTransaction.js.map +0 -1
- package/lib/families/cosmos/js-signOperation.d.ts +0 -10
- package/lib/families/cosmos/js-signOperation.d.ts.map +0 -1
- package/lib/families/cosmos/js-signOperation.js +0 -171
- package/lib/families/cosmos/js-signOperation.js.map +0 -1
- package/lib/families/cosmos/js-synchronisation.d.ts +0 -5
- package/lib/families/cosmos/js-synchronisation.d.ts.map +0 -1
- package/lib/families/cosmos/js-synchronisation.js +0 -277
- package/lib/families/cosmos/js-synchronisation.js.map +0 -1
- package/lib/families/cosmos/js-updateTransaction.d.ts +0 -4
- package/lib/families/cosmos/js-updateTransaction.d.ts.map +0 -1
- package/lib/families/cosmos/js-updateTransaction.js +0 -26
- package/lib/families/cosmos/js-updateTransaction.js.map +0 -1
- package/src/.DS_Store +0 -0
- package/src/__tests__/.DS_Store +0 -0
- package/src/families/cosmos/api/Cosmos.ts +0 -346
- package/src/families/cosmos/bridge/js.ts +0 -68
- package/src/families/cosmos/js-buildTransaction.ts +0 -233
- package/src/families/cosmos/js-createTransaction.ts +0 -23
- package/src/families/cosmos/js-estimateMaxSpendable.ts +0 -33
- package/src/families/cosmos/js-getTransactionStatus.ts +0 -292
- package/src/families/cosmos/js-prepareTransaction.ts +0 -131
- package/src/families/cosmos/js-signOperation.ts +0 -167
- package/src/families/cosmos/js-synchronisation.ts +0 -223
- package/src/families/cosmos/js-updateTransaction.ts +0 -21
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { DeviceTransactionField } from "../../transaction";
|
|
2
|
+
import type { Account, AccountLike, TransactionStatus } from "../../types";
|
|
3
|
+
import type { Transaction } from "./types";
|
|
4
|
+
import { formatCurrencyUnit, getCryptoCurrencyById } from "../../currencies";
|
|
5
|
+
import { methodToString } from "./utils";
|
|
6
|
+
|
|
7
|
+
const currency = getCryptoCurrencyById("filecoin");
|
|
8
|
+
|
|
9
|
+
export type ExtraDeviceTransactionField =
|
|
10
|
+
| {
|
|
11
|
+
type: "filecoin.gasFeeCap";
|
|
12
|
+
label: string;
|
|
13
|
+
value: string;
|
|
14
|
+
}
|
|
15
|
+
| {
|
|
16
|
+
type: "filecoin.gasPremium";
|
|
17
|
+
label: string;
|
|
18
|
+
value: string;
|
|
19
|
+
}
|
|
20
|
+
| {
|
|
21
|
+
type: "filecoin.gasLimit";
|
|
22
|
+
label: string;
|
|
23
|
+
value: string;
|
|
24
|
+
}
|
|
25
|
+
| {
|
|
26
|
+
type: "filecoin.method";
|
|
27
|
+
label: string;
|
|
28
|
+
value: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
function getDeviceTransactionConfig(input: {
|
|
32
|
+
account: AccountLike;
|
|
33
|
+
parentAccount: Account | null | undefined;
|
|
34
|
+
transaction: Transaction;
|
|
35
|
+
status: TransactionStatus;
|
|
36
|
+
}): Array<DeviceTransactionField> {
|
|
37
|
+
const fields: Array<DeviceTransactionField> = [];
|
|
38
|
+
|
|
39
|
+
fields.push({
|
|
40
|
+
type: "amount",
|
|
41
|
+
label: "Value",
|
|
42
|
+
});
|
|
43
|
+
fields.push({
|
|
44
|
+
type: "filecoin.gasLimit",
|
|
45
|
+
label: "Gas Limit",
|
|
46
|
+
value: input.transaction.gasLimit.toFixed(),
|
|
47
|
+
});
|
|
48
|
+
fields.push({
|
|
49
|
+
type: "filecoin.gasPremium",
|
|
50
|
+
label: "Gas Premium",
|
|
51
|
+
value: formatCurrencyUnit(currency.units[0], input.transaction.gasPremium, {
|
|
52
|
+
showCode: false,
|
|
53
|
+
disableRounding: true,
|
|
54
|
+
}),
|
|
55
|
+
});
|
|
56
|
+
fields.push({
|
|
57
|
+
type: "filecoin.gasFeeCap",
|
|
58
|
+
label: "Gas Fee Cap",
|
|
59
|
+
value: formatCurrencyUnit(currency.units[0], input.transaction.gasFeeCap, {
|
|
60
|
+
showCode: false,
|
|
61
|
+
disableRounding: true,
|
|
62
|
+
}),
|
|
63
|
+
});
|
|
64
|
+
fields.push({
|
|
65
|
+
type: "filecoin.method",
|
|
66
|
+
label: "Method",
|
|
67
|
+
value: methodToString(input.transaction.method),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return fields;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default getDeviceTransactionConfig;
|
|
@@ -8,12 +8,22 @@ import { getAccountUnit } from "../../account";
|
|
|
8
8
|
import { formatCurrencyUnit } from "../../currencies";
|
|
9
9
|
import BigNumber from "bignumber.js";
|
|
10
10
|
|
|
11
|
-
export const formatTransaction = (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
export const formatTransaction = (
|
|
12
|
+
{ recipient, useAllAmount, amount }: Transaction,
|
|
13
|
+
account: Account
|
|
14
|
+
): string => `
|
|
15
|
+
SEND ${
|
|
16
|
+
useAllAmount
|
|
17
|
+
? "MAX"
|
|
18
|
+
: amount.isZero()
|
|
19
|
+
? ""
|
|
20
|
+
: " " +
|
|
21
|
+
formatCurrencyUnit(getAccountUnit(account), amount, {
|
|
22
|
+
showCode: true,
|
|
23
|
+
disableRounding: true,
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
TO ${recipient}`;
|
|
17
27
|
|
|
18
28
|
export const fromTransactionRaw = (tr: TransactionRaw): Transaction => {
|
|
19
29
|
const common = fromTransactionCommonRaw(tr);
|
|
@@ -19,6 +19,15 @@ export const isError = (r: { return_code: number; error_message: string }) => {
|
|
|
19
19
|
throw new Error(`${r.return_code} - ${r.error_message}`);
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
export const methodToString = (method: number): string => {
|
|
23
|
+
switch (method) {
|
|
24
|
+
case 0:
|
|
25
|
+
return "Transfer";
|
|
26
|
+
default:
|
|
27
|
+
return "Unknown";
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
22
31
|
export const getBufferFromString = (message: string): Buffer =>
|
|
23
32
|
isValidHex(message)
|
|
24
33
|
? Buffer.from(message, "hex")
|
package/src/generated/account.ts
CHANGED
|
@@ -8,6 +8,8 @@ import crypto_org from "../families/crypto_org/account";
|
|
|
8
8
|
|
|
9
9
|
import elrond from "../families/elrond/account";
|
|
10
10
|
|
|
11
|
+
import filecoin from "../families/filecoin/account";
|
|
12
|
+
|
|
11
13
|
import polkadot from "../families/polkadot/account";
|
|
12
14
|
|
|
13
15
|
|
|
@@ -17,5 +19,6 @@ export default {
|
|
|
17
19
|
cosmos,
|
|
18
20
|
crypto_org,
|
|
19
21
|
elrond,
|
|
22
|
+
filecoin,
|
|
20
23
|
polkadot,
|
|
21
24
|
};
|
|
@@ -4,8 +4,6 @@ import bitcoin from "../../families/bitcoin/bridge/js";
|
|
|
4
4
|
|
|
5
5
|
import celo from "../../families/celo/bridge/js";
|
|
6
6
|
|
|
7
|
-
import cosmos from "../../families/cosmos/bridge/js";
|
|
8
|
-
|
|
9
7
|
import crypto_org from "../../families/crypto_org/bridge/js";
|
|
10
8
|
|
|
11
9
|
import elrond from "../../families/elrond/bridge/js";
|
|
@@ -33,7 +31,6 @@ export default {
|
|
|
33
31
|
algorand,
|
|
34
32
|
bitcoin,
|
|
35
33
|
celo,
|
|
36
|
-
cosmos,
|
|
37
34
|
crypto_org,
|
|
38
35
|
elrond,
|
|
39
36
|
ethereum,
|
|
@@ -12,6 +12,8 @@ import elrond from "../families/elrond/deviceTransactionConfig";
|
|
|
12
12
|
|
|
13
13
|
import ethereum from "../families/ethereum/deviceTransactionConfig";
|
|
14
14
|
|
|
15
|
+
import filecoin from "../families/filecoin/deviceTransactionConfig";
|
|
16
|
+
|
|
15
17
|
import polkadot from "../families/polkadot/deviceTransactionConfig";
|
|
16
18
|
|
|
17
19
|
import ripple from "../families/ripple/deviceTransactionConfig";
|
|
@@ -33,6 +35,7 @@ export default {
|
|
|
33
35
|
crypto_org,
|
|
34
36
|
elrond,
|
|
35
37
|
ethereum,
|
|
38
|
+
filecoin,
|
|
36
39
|
polkadot,
|
|
37
40
|
ripple,
|
|
38
41
|
solana,
|
|
@@ -41,12 +44,14 @@ export default {
|
|
|
41
44
|
tron,
|
|
42
45
|
};
|
|
43
46
|
import { ExtraDeviceTransactionField as ExtraDeviceTransactionField_cosmos } from "../families/cosmos/deviceTransactionConfig";
|
|
47
|
+
import { ExtraDeviceTransactionField as ExtraDeviceTransactionField_filecoin } from "../families/filecoin/deviceTransactionConfig";
|
|
44
48
|
import { ExtraDeviceTransactionField as ExtraDeviceTransactionField_polkadot } from "../families/polkadot/deviceTransactionConfig";
|
|
45
49
|
import { ExtraDeviceTransactionField as ExtraDeviceTransactionField_stellar } from "../families/stellar/deviceTransactionConfig";
|
|
46
50
|
import { ExtraDeviceTransactionField as ExtraDeviceTransactionField_tezos } from "../families/tezos/deviceTransactionConfig";
|
|
47
51
|
import { ExtraDeviceTransactionField as ExtraDeviceTransactionField_tron } from "../families/tron/deviceTransactionConfig";
|
|
48
52
|
export type ExtraDeviceTransactionField =
|
|
49
53
|
| ExtraDeviceTransactionField_cosmos
|
|
54
|
+
| ExtraDeviceTransactionField_filecoin
|
|
50
55
|
| ExtraDeviceTransactionField_polkadot
|
|
51
56
|
| ExtraDeviceTransactionField_stellar
|
|
52
57
|
| ExtraDeviceTransactionField_tezos
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import BigNumber from "bignumber.js";
|
|
2
|
-
import { Operation } from "../../../types";
|
|
3
|
-
export declare const getAccountInfo: (address: string) => Promise<any>;
|
|
4
|
-
export declare const getAccount: (address: string) => Promise<any>;
|
|
5
|
-
export declare const getDelegators: (address: string) => Promise<any>;
|
|
6
|
-
export declare const getRedelegations: (address: string) => Promise<any>;
|
|
7
|
-
export declare const getUnbondings: (address: string) => Promise<any>;
|
|
8
|
-
export declare const isValidRecipent: (address: string) => Promise<boolean>;
|
|
9
|
-
export declare const getWithdrawAddress: (address: string) => Promise<string>;
|
|
10
|
-
export declare const getTransactions: (address: string) => Promise<any>;
|
|
11
|
-
export declare const broadcast: ({ signedOperation: { operation, signature }, }: {
|
|
12
|
-
signedOperation: {
|
|
13
|
-
operation: any;
|
|
14
|
-
signature: any;
|
|
15
|
-
};
|
|
16
|
-
}) => Promise<Operation>;
|
|
17
|
-
export declare const getBlock: (height: number) => Promise<any>;
|
|
18
|
-
export declare const simulate: (tx_bytes: Array<any>) => Promise<BigNumber>;
|
|
19
|
-
export declare const getHeight: () => Promise<number>;
|
|
20
|
-
export declare const getAllBalances: (address: string) => Promise<BigNumber>;
|
|
21
|
-
export declare const getChainId: () => Promise<string>;
|
|
22
|
-
export declare const getSequence: (address: string) => Promise<number>;
|
|
23
|
-
export declare const getAccountNumber: (address: string) => Promise<number>;
|
|
24
|
-
//# sourceMappingURL=Cosmos.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Cosmos.d.ts","sourceRoot":"","sources":["../../../../src/families/cosmos/api/Cosmos.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAO3C,eAAO,MAAM,cAAc,YAAmB,MAAM,KAAG,QAAQ,GAAG,CAgCjE,CAAC;AAEF,eAAO,MAAM,UAAU,YAAmB,MAAM,KAAG,QAAQ,GAAG,CA6B7D,CAAC;AAEF,eAAO,MAAM,aAAa,YAAmB,MAAM,KAAG,QAAQ,GAAG,CA6DhE,CAAC;AAEF,eAAO,MAAM,gBAAgB,YAAmB,MAAM,KAAG,QAAQ,GAAG,CAoBnE,CAAC;AAEF,eAAO,MAAM,aAAa,YAAmB,MAAM,KAAG,QAAQ,GAAG,CAmBhE,CAAC;AAEF,eAAO,MAAM,eAAe,YAAmB,MAAM,KAAG,QAAQ,OAAO,CAWtE,CAAC;AAEF,eAAO,MAAM,kBAAkB,YAAmB,MAAM,KAAG,QAAQ,MAAM,CAWxE,CAAC;AAEF,eAAO,MAAM,eAAe,YAAmB,MAAM,KAAG,QAAQ,GAAG,CAgBlE,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;MAElB,QAAQ,SAAS,CAsBpB,CAAC;AAEF,eAAO,MAAM,QAAQ,WAAkB,MAAM,KAAG,QAAQ,GAAG,CAW1D,CAAC;AAEF,eAAO,MAAM,QAAQ,aAAoB,MAAM,GAAG,CAAC,KAAG,QAAQ,SAAS,CActE,CAAC;AAEF,eAAO,MAAM,SAAS,QAAa,QAAQ,MAAM,CAWhD,CAAC;AAEF,eAAO,MAAM,cAAc,YAAmB,MAAM,KAAG,QAAQ,SAAS,CAavE,CAAC;AAEF,eAAO,MAAM,UAAU,QAAa,QAAQ,MAAM,CAWjD,CAAC;AAEF,eAAO,MAAM,WAAW,YAAmB,MAAM,KAAG,QAAQ,MAAM,CAWjE,CAAC;AAEF,eAAO,MAAM,gBAAgB,YAAmB,MAAM,KAAG,QAAQ,MAAM,CAWtE,CAAC"}
|