Skip to content

Commit

Permalink
[LIVE-11375] Feature - CAL service migration for tokens (#7621)
Browse files Browse the repository at this point in the history
* Update all importers to use CAL service
instead of the CDN.

* Fix comment of `disableCountervalue` depreciation

* Deprecated `disableCountervalue` for ASA tokens

* Deprecated `disableCountervalue` for ESDT tokens

* Deprecated `disableCountervalue` for Cardano token

* Deprecated `disableCountervalue` of Stellar tokens

* Deprecated `disableCountervalue` of Ton tokens

* Add missing vip180 importer

* Remove `convertBEP20` useless method

* Update `coin-evm` preload to use CAL service
It should also limit the number of requests done via a commit hash

* Update `types-cryptoassets` doc for types

* Update snapshot

* Remove useless doc script from types-cryptoassets

* changesets
  • Loading branch information
lambertkevin authored Sep 23, 2024
1 parent c95ac37 commit 1605678
Show file tree
Hide file tree
Showing 201 changed files with 1,951 additions and 1,428 deletions.
6 changes: 6 additions & 0 deletions .changeset/blue-apricots-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ledgerhq/cryptoassets": patch
"@ledgerhq/live-common": patch
---

CAL update
5 changes: 5 additions & 0 deletions .changeset/calm-rocks-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/types-cryptoassets": patch
---

Remove useless documentation script
5 changes: 5 additions & 0 deletions .changeset/funny-suits-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/coin-evm": minor
---

Update preloading method to use the crypto-assets service instead of the CDN for fetching token definitions
5 changes: 5 additions & 0 deletions .changeset/poor-dots-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/coin-cosmos": patch
---

Update `axios` to fixed version `1.7.3`
5 changes: 5 additions & 0 deletions .changeset/yellow-masks-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/cryptoassets": minor
---

Update all importers to use the crypt-assets service instead of the CDN & remove when possible deprecated and usued values like `disableCounterValue` and `BEP20` type.
4 changes: 2 additions & 2 deletions libs/coin-modules/coin-cosmos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@ledgerhq/logs": "workspace:^",
"@ledgerhq/types-cryptoassets": "workspace:^",
"@ledgerhq/types-live": "workspace:^",
"axios": "0.26.1",
"axios": "1.7.3",
"bech32": "^1.1.3",
"bignumber.js": "^9.1.2",
"cosmjs-types": "0.2.1",
Expand Down Expand Up @@ -90,4 +90,4 @@
"test": "jest",
"unimported": "unimported"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import BigNumber from "bignumber.js";
import { hashes as localTokensHashesByChainId } from "@ledgerhq/cryptoassets/data/evm/index";
import { ERC20Token } from "@ledgerhq/cryptoassets/types";
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
import { AccountShapeInfo } from "@ledgerhq/coin-framework/bridge/jsHelpers";
import { makeOperation } from "./common.fixtures";

export const currency = getCryptoCurrencyById("scroll_sepolia");
export const fakeToken: ERC20Token = [
currency.id, // parent currency id
"new_token_mock", // token id
"NTM", // ticker
18, // precision
"Awesome Fake Token", // name
"dadcoffee", // ledgerSignature
"0xdeadbeef", // contract address
false, // [deprecated] disabled counter values
false, // delisted
];

export const localCALHash =
localTokensHashesByChainId[
currency.ethereumLikeInfo!.chainId as keyof typeof localTokensHashesByChainId
];
export const getAccountShapeParameters: AccountShapeInfo = {
address: "0xkvn",
currency,
derivationMode: "",
derivationPath: "44'/60'/0'/0/0",
index: 0,
};
export const TMUSDTTransaction = makeOperation({
hash: "anyHash",
accountId:
"js:2:scroll_sepolia:0xkvn:+scroll~!underscore!~sepolia%2Ferc20%2Fmock~!underscore!~usdt",
blockHash: "0x95dc138a02c1b0e3fd49305f785e8e27e88a885004af13a9b4c62ad94eed07dd",
recipients: ["0xB0B"],
senders: ["0x9b744C0451D73C0958d8aA566dAd33022E4Ee797"], // sbf.eth
contract: "0x389942E33440c00869B68d66f18335BF11974B87",
value: new BigNumber(0),
fee: new BigNumber(0),
type: "OUT",
date: new Date(),
blockHeight: 10,
});
export const NTMTransaction = makeOperation({
hash: "anyOtherHash",
accountId:
"js:2:scroll_sepolia:0xkvn:+scroll~!underscore!~sepolia%2Ferc20%2Fnew~!underscore!~token~!underscore!~mock",
blockHash: "0x1234",
recipients: ["0xB0B"],
senders: ["0x9b744C0451D73C0958d8aA566dAd33022E4Ee797"], // sbf.eth
contract: fakeToken[6],
value: new BigNumber(0),
fee: new BigNumber(0),
type: "OUT",
date: new Date(),
blockHeight: 10,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { ERC20Token } from "@ledgerhq/cryptoassets/types";

export const usdcDefinition: ERC20Token = [
"ethereum",
"usd__coin",
"USDC",
6,
"USD Coin",
"3045022100b2e358726e4e6a6752cf344017c0e9d45b9a904120758d45f61b2804f9ad5299022015161ef28d8c4481bd9432c13562def9cce688bcfec896ef244c9a213f106cdd",
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
false,
false,
];
export const usdtDefinition: ERC20Token = [
"ethereum",
"usd_tether__erc20_",
"USDT",
6,
"Tether USD",
"3044022078c66ccea3e4dedb15a24ec3c783d7b582cd260daf62fd36afe9a8212a344aed0220160ba8c1c4b6a8aa6565bed20632a091aeeeb7bfdac67fc6589a6031acbf511c",
"0xdAC17F958D2ee523a2206206994597C13D831ec7",
false,
false,
];
export const binanceDaiDefinition: ERC20Token = [
"bsc",
"binance-peg_dai_token",
"DAI",
18,
"Binance-Peg Dai Token",
"3044022032f0a880722af8c9e2196b5c0fc5273e2088f23692bdd2b35f6cf41c4001213f02205226e2023e409c73b031c790c64ae24db67c04b0aefd0d979b8c5002ca969b7b",
"0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",
false,
false,
];
export const wethDefinition: ERC20Token = [
"bsc",
"wrapped_ether_wormhole",
"WETH",
18,
"Wrapped Ether (Wormhole)",
"3045022100b83ee696d6d934c7b1b30f62ca9736a5d36a0020e8c03757ffb51f81aa7f599802201e89feebccb518251fe6151b82ddcdc8c552b012429326ea7ea1fb0e308af60d",
"0x4DB5a66E937A9F4473fA95b1cAF1d1E1D62E29EA",
false,
false,
];
export const brettDefinition: ERC20Token = [
"base",
"brett",
"BRETT",
18,
"Brett",
"deafcoffee",
"0x532f27101965dd16442e59d40670faf5ebb142e4",
false,
false,
];
export const toshiDefinition: ERC20Token = [
"base",
"toshi",
"TOSHI",
18,
"Toshi",
"coffeedeaf",
"0xac1bd2486aaf3b5c0fc3fd868558b082a531b2b4",
false,
false,
];
Loading

0 comments on commit 1605678

Please sign in to comment.