Skip to content

Commit 7fd50fd

Browse files
wip
1 parent ea92e32 commit 7fd50fd

24 files changed

+542
-62
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"type": "TokenCurrency",
3+
"id": "cardano/native/8654e8b350e298c80d2451beb5ed80fc9eee9f38ce6b039fb8706bc34c4f4253544552",
4+
"contractAddress": "8654e8b350e298c80d2451beb5ed80fc9eee9f38ce6b039fb8706bc34c4f4253544552",
5+
"parentCurrency": {
6+
"type": "CryptoCurrency",
7+
"id": "cardano",
8+
"coinType": 1815,
9+
"name": "Cardano",
10+
"managerAppName": "Cardano ADA",
11+
"ticker": "ADA",
12+
"scheme": "cardano",
13+
"color": "#0A1D2C",
14+
"family": "cardano",
15+
"blockAvgTime": 20,
16+
"units": [
17+
{
18+
"name": "ada",
19+
"code": "ADA",
20+
"magnitude": 6
21+
},
22+
{
23+
"name": "Lovelace",
24+
"code": "Lovelace",
25+
"magnitude": 0
26+
}
27+
],
28+
"explorerViews": [
29+
{
30+
"tx": "https://cardanoscan.io/transaction/$hash",
31+
"address": "https://cardanoscan.io/address/$address",
32+
"stakePool": "https://cardanoscan.io/pool/$poolId"
33+
}
34+
],
35+
"keywords": [
36+
"ada",
37+
"cardano"
38+
]
39+
},
40+
"tokenType": "native",
41+
"name": "LOBSTER",
42+
"ticker": "$LOBSTER",
43+
"delisted": false,
44+
"disableCountervalue": false,
45+
"units": [
46+
{
47+
"name": "LOBSTER",
48+
"code": "$LOBSTER",
49+
"magnitude": 0
50+
}
51+
]
52+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"accountId": "js:2:ethereum:0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d:+ethereum%2Ferc20%2Fusd~!underscore!~~!underscore!~coin",
3+
"blockHash": "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
4+
"blockHeight": 16240731,
5+
"contract": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
6+
"date": "2022-12-22T14:06:23.000Z",
7+
"extra": {},
8+
"fee": "1595338583295225",
9+
"hash": "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
10+
"id": "js:2:ethereum:0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d:+js%3A2%3Aethereum%3A0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d%3A%2Bethereum%252Ferc20%252Fusd~!underscore!~~!underscore!~coin~!dash!~0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf~!dash!~OUT~!dash!~i0-0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf-IN-i0",
11+
"recipients": [
12+
"0xC2907EFccE4011C491BbedA8A0fA63BA7aab596C"
13+
],
14+
"senders": [
15+
"0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d"
16+
],
17+
"transactionSequenceNumber": 53,
18+
"type": "OUT",
19+
"value": "2000000"
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"accountId": "js:2:ethereum:0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d:+js%3A2%3Aethereum%3A0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d%3A%2Bethereum%252Ferc20%252Fusd~!underscore!~~!underscore!~coin~!dash!~0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf~!dash!~OUT~!dash!~i0",
3+
"blockHash": "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
4+
"blockHeight": 16240731,
5+
"date": "2022-12-22T14:06:23.000Z",
6+
"extra": {},
7+
"fee": "1595338583295225",
8+
"hash": "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
9+
"id": "js:2:ethereum:0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d:+js%3A2%3Aethereum%3A0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d%3A%2Bethereum%252Ferc20%252Fusd~!underscore!~~!underscore!~coin~!dash!~0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf~!dash!~OUT~!dash!~i0-0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf-OUT-i0",
10+
"recipients": [
11+
"0xC2907EFccE4011C491BbedA8A0fA63BA7aab596C"
12+
],
13+
"senders": [
14+
"0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d"
15+
],
16+
"transactionSequenceNumber": 53,
17+
"type": "OUT",
18+
"value": "2000000"
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
type: "TokenCurrency",
3+
id: "ethereum/erc20/usd__coin",
4+
ledgerSignature: "3045022100b2e358726e4e6a6752cf344017c0e9d45b9a904120758d45f61b2804f9ad5299022015161ef28d8c4481bd9432c13562def9cce688bcfec896ef244c9a213f106cdd",
5+
contractAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
6+
parentCurrency: {
7+
type: "CryptoCurrency",
8+
id: "ethereum",
9+
coinType: 60,
10+
name: "Ethereum",
11+
managerAppName: "Ethereum",
12+
ticker: "ETH",
13+
scheme: "ethereum",
14+
color: "#0ebdcd",
15+
symbol: "Ξ",
16+
family: "evm",
17+
blockAvgTime: 15,
18+
units: [
19+
{
20+
name: "ether",
21+
code: "ETH",
22+
magnitude: 18,
23+
},
24+
{
25+
name: "Gwei",
26+
code: "Gwei",
27+
magnitude: 9,
28+
},
29+
{
30+
name: "Mwei",
31+
code: "Mwei",
32+
magnitude: 6,
33+
},
34+
{
35+
name: "Kwei",
36+
code: "Kwei",
37+
magnitude: 3,
38+
},
39+
{
40+
name: "wei",
41+
code: "wei",
42+
magnitude: 0,
43+
},
44+
],
45+
ethereumLikeInfo: {
46+
chainId: 1,
47+
},
48+
explorerViews: [
49+
{
50+
tx: "https://etherscan.io/tx/$hash",
51+
address: "https://etherscan.io/address/$address",
52+
token: "https://etherscan.io/token/$contractAddress?a=$address",
53+
},
54+
],
55+
keywords: [
56+
"eth",
57+
"ethereum",
58+
],
59+
explorerId: "eth",
60+
},
61+
tokenType: "erc20",
62+
name: "USD Coin",
63+
ticker: "USDC",
64+
delisted: false,
65+
disableCountervalue: false,
66+
units: [
67+
{
68+
name: "USD Coin",
69+
code: "USDC",
70+
magnitude: 6,
71+
},
72+
],
73+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"type": "TokenCurrency",
3+
"id": "ethereum/erc20/weth",
4+
"ledgerSignature": "3045022100b47ee8551c15a2cf681c649651e987d7e527c481d27c38da1f971a8242792bd3022069c3f688ac5493a23dab5798e3c9b07484765069e1d4be14321aae4d92cb8cbe",
5+
"contractAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
6+
"parentCurrency": {
7+
"type": "CryptoCurrency",
8+
"id": "ethereum",
9+
"coinType": 60,
10+
"name": "Ethereum",
11+
"managerAppName": "Ethereum",
12+
"ticker": "ETH",
13+
"scheme": "ethereum",
14+
"color": "#0ebdcd",
15+
"symbol": "Ξ",
16+
"family": "evm",
17+
"blockAvgTime": 15,
18+
"units": [
19+
{
20+
"name": "ether",
21+
"code": "ETH",
22+
"magnitude": 18
23+
},
24+
{
25+
"name": "Gwei",
26+
"code": "Gwei",
27+
"magnitude": 9
28+
},
29+
{
30+
"name": "Mwei",
31+
"code": "Mwei",
32+
"magnitude": 6
33+
},
34+
{
35+
"name": "Kwei",
36+
"code": "Kwei",
37+
"magnitude": 3
38+
},
39+
{
40+
"name": "wei",
41+
"code": "wei",
42+
"magnitude": 0
43+
}
44+
],
45+
"ethereumLikeInfo": {
46+
"chainId": 1
47+
},
48+
"explorerViews": [
49+
{
50+
"tx": "https://etherscan.io/tx/$hash",
51+
"address": "https://etherscan.io/address/$address",
52+
"token": "https://etherscan.io/token/$contractAddress?a=$address"
53+
}
54+
],
55+
"keywords": [
56+
"eth",
57+
"ethereum"
58+
],
59+
"explorerId": "eth"
60+
},
61+
"tokenType": "erc20",
62+
"name": "WETH",
63+
"ticker": "WETH",
64+
"delisted": false,
65+
"disableCountervalue": false,
66+
"units": [
67+
{
68+
"name": "WETH",
69+
"code": "WETH",
70+
"magnitude": 18
71+
}
72+
]
73+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"type": "TokenCurrency",
3+
"id": "optimism/erc20/usd_coin",
4+
"ledgerSignature": "30440220597e4a9911df217d680aa240ca96f7e8fca24c24e7c673c43820c94b08ef69e402206e975e27e82b3370eca40041fca772bd6c4ca7dd087d2bfcc8aa146cb8e1de53",
5+
"contractAddress": "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
6+
"parentCurrency": {
7+
"type": "CryptoCurrency",
8+
"id": "optimism",
9+
"coinType": 60,
10+
"name": "OP Mainnet",
11+
"managerAppName": "Ethereum",
12+
"ticker": "ETH",
13+
"scheme": "optimism",
14+
"color": "#FF0421",
15+
"family": "evm",
16+
"units": [
17+
{
18+
"name": "ether",
19+
"code": "ETH",
20+
"magnitude": 18
21+
},
22+
{
23+
"name": "Gwei",
24+
"code": "Gwei",
25+
"magnitude": 9
26+
},
27+
{
28+
"name": "Mwei",
29+
"code": "Mwei",
30+
"magnitude": 6
31+
},
32+
{
33+
"name": "Kwei",
34+
"code": "Kwei",
35+
"magnitude": 3
36+
},
37+
{
38+
"name": "wei",
39+
"code": "wei",
40+
"magnitude": 0
41+
}
42+
],
43+
"ethereumLikeInfo": {
44+
"chainId": 10
45+
},
46+
"explorerViews": [
47+
{
48+
"tx": "https://optimism.blockscout.com/tx/$hash",
49+
"address": "https://optimism.blockscout.com/address/$address",
50+
"token": "https://optimism.blockscout.com/address/$address?tab=token_transfer&token=$contractAddress"
51+
}
52+
],
53+
"keywords": [
54+
"optimism"
55+
]
56+
},
57+
"tokenType": "erc20",
58+
"name": "USD Coin",
59+
"ticker": "USDC",
60+
"delisted": false,
61+
"disableCountervalue": false,
62+
"units": [
63+
{
64+
"name": "USD Coin",
65+
"code": "USDC",
66+
"magnitude": 6
67+
}
68+
]
69+
}

libs/coin-modules/coin-evm/src/__tests__/fixtures/prepareTransaction.fixtures.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { ethers } from "ethers";
22
import BigNumber from "bignumber.js";
3-
import { getTokenById } from "@ledgerhq/cryptoassets/tokens";
4-
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
3+
import { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
54
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
65
import { Account } from "@ledgerhq/types-live";
7-
86
import { EvmNftTransaction, Transaction as EvmTransaction } from "../../types";
97
import ERC1155ABI from "../../abis/erc1155.abi.json";
108
import ERC721ABI from "../../abis/erc721.abi.json";
119
import ERC20ABI from "../../abis/erc20.abi.json";
10+
import usdtTokenData from "../../__fixtures__/scroll_sepolia-erc20-mock_usdt.json";
1211

1312
import { makeAccount, makeTokenAccount } from "./common.fixtures";
1413

@@ -19,7 +18,8 @@ const currency: CryptoCurrency = {
1918
},
2019
};
2120

22-
export const tokenAccount = makeTokenAccount("0xkvn", getTokenById("ethereum/erc20/usd__coin"));
21+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
22+
export const tokenAccount = makeTokenAccount("0xkvn", usdtTokenData as unknown as TokenCurrency);
2323
export const account = makeAccount("0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d", currency, [
2424
tokenAccount,
2525
]);

libs/coin-modules/coin-evm/src/__tests__/fixtures/transaction.fixtures.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import BigNumber from "bignumber.js";
2-
import { getTokenById } from "@ledgerhq/cryptoassets/tokens";
3-
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
2+
import { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
43
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
54

65
import {
@@ -12,6 +11,7 @@ import {
1211
EvmNftTransactionRaw,
1312
EvmNftTransaction,
1413
} from "../../types";
14+
import usdtTokenData from "../../__fixtures__/ethereum-erc20-usd__coin.json";
1515
import { makeAccount, makeTokenAccount } from "./common.fixtures";
1616

1717
export const testData = Object.freeze(Buffer.from("testBufferString").toString("hex"));
@@ -217,7 +217,8 @@ export const currency: CryptoCurrency = Object.freeze({
217217
},
218218
});
219219

220-
export const tokenCurrency = Object.freeze(getTokenById("ethereum/erc20/usd__coin"));
220+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
221+
export const tokenCurrency = Object.freeze(usdtTokenData as unknown as TokenCurrency);
221222
export const tokenAccount = makeTokenAccount(
222223
"0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d",
223224
tokenCurrency,

0 commit comments

Comments
 (0)