Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support/filecoin evm #7414

Merged
merged 36 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
cf6ebfe
feat(fil): add erc20 tokens data for filecoin
lawRathod Mar 26, 2024
e32ed57
chore(fil): add token icons and remove staked tokens
lawRathod May 23, 2024
de35282
refac(fil): update logic and minor updates to dependencies
lawRathod May 31, 2024
bd434bb
chore(fil): update logic post refac
lawRathod May 31, 2024
5a5ceac
tests(fil): update bot tests
lawRathod Jun 1, 2024
a814b1c
refac(fil): fixup operation and increase bot tests timeout
lawRathod Jun 4, 2024
ecff89e
Merge branch 'develop' into support/filecoin-evm
lawRathod Jun 24, 2024
ac94e04
chore(fil): bump iso-filecoin
lawRathod Jul 23, 2024
27677d4
feat(fil): use importer for erc20 tokens
lawRathod Jul 23, 2024
ce6f959
refac(fil): update ifil svg icon
lawRathod Jul 23, 2024
9618193
refac(fil): add recipient address when using 0xff
lawRathod Jul 23, 2024
fac0c54
Merge pull request #7413 from Zondax/support/filecoin-evm
hzheng-ledger Jul 24, 2024
5fa6f45
Merge branch 'develop' into support/filecoin-evm
hzheng-ledger Jul 24, 2024
3e5a512
refac(fil): deviceTransactionConfig updates
lawRathod Jul 25, 2024
42583fb
fix: rework estimate fees for token transfer
emmanuelm41 Jul 26, 2024
b32472c
refac(fil): lowercase recipient always
lawRathod Jul 30, 2024
a725ee1
refac(fil): drop network call for address convert
lawRathod Jul 31, 2024
c63b255
refactor: rework functions to make them cleaner
emmanuelm41 Jul 31, 2024
07c9008
refac(fil): fix error when estimating fee with wrong params
lawRathod Aug 1, 2024
2f2c573
refac(fil): fix wrong recipient on confirmation screen
lawRathod Aug 1, 2024
1f0e9a0
refac(fil): fix problem with estimating gas
lawRathod Aug 1, 2024
4f918e2
fix: remove leading 0x for eth addresses
emmanuelm41 Aug 1, 2024
28545a7
feat: handle hasFailed flag from erc20 txs sync
emmanuelm41 Aug 1, 2024
1f40d14
Merge pull request #7509 from Zondax/support/filecoin-evm
hzheng-ledger Aug 5, 2024
210036d
Merge branch 'develop' into support/filecoin-evm
hzheng-ledger Aug 5, 2024
3c54e68
fix(fil): irrelevant error on feeEstimationFail
lawRathod Aug 5, 2024
bd92747
refac(fil): update type of fees transfers
lawRathod Aug 5, 2024
6d34a4c
fix(fil): estimateMaxSpendable failing for native transfer
lawRathod Aug 5, 2024
72eb552
fix(fil): sort operations on sync
lawRathod Aug 6, 2024
bbaaee3
Merge pull request #7535 from Zondax/support/filecoin-evm
hzheng-ledger Aug 7, 2024
f376d1f
fix: update snapshots
emmanuelm41 Aug 7, 2024
ac1a0c0
fix(icp): estimatedSpendable and transactionStatus
lawRathod Aug 13, 2024
6567938
Merge pull request #7594 from Zondax/support/filecoin-evm
hzheng-ledger Aug 13, 2024
0aff4c3
Merge branch 'develop' into support/filecoin-evm
hzheng-ledger Aug 13, 2024
15f3ae2
fix: unit test
hzheng-ledger Aug 13, 2024
1d8a113
fix: update sortByMarketcap unit test snapshot
hzheng-ledger Aug 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/famous-worms-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@ledgerhq/cryptoassets": minor
"ledger-live-desktop": minor
"live-mobile": minor
"@ledgerhq/live-common": minor
"@ledgerhq/live-env": minor
---

Add ERC20 token support for filecoin
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const fieldComponents = {
"filecoin.gasPremium": FilecoinField,
"filecoin.gasLimit": FilecoinField,
"filecoin.method": FilecoinField,
"filecoin.recipient": FilecoinField,
};
export default {
fieldComponents,
Expand Down
7 changes: 7 additions & 0 deletions apps/ledger-live-desktop/static/i18n/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -5569,6 +5569,13 @@
"title": "Impossible to calculate amount and fees",
"description": "Impossible to calculate amount and fees"
},
"InvalidRecipientForTokenTransfer": {
"title": "Invalid recipient for token transfer, supported account types for token transfer: [f0, f4, 0x]"
},
"FilecoinFeeEstimationFailed": {
"title": "Sorry, fee estimation failed",
"description": "Fee estimation failed on the network. Check inputs, transaction most likely to fail"
},
"NotEnoughBalance": {
"title": "Sorry, insufficient funds",
"description": "Please make sure the account has enough funds."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const fieldComponents = {
"filecoin.gasPremium": FilecoinField,
"filecoin.gasLimit": FilecoinField,
"filecoin.method": FilecoinField,
"filecoin.recipient": FilecoinField,
};
export default {
fieldComponents,
Expand Down
7 changes: 7 additions & 0 deletions apps/ledger-live-mobile/src/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,13 @@
"InvalidMemoICP": {
"title": "Memo is required to be a number"
},
"InvalidRecipientForTokenTransfer": {
"title": "Invalid recipient for token transfer, supported account types for token transfer: [f0, f4, 0x]"
},
"FilecoinFeeEstimationFailed": {
"title": "Sorry, fee estimation failed",
"description": "Fee estimation failed on the network. Check inputs, transaction most likely to fail"
},
"FirmwareNotRecognized": {
"title": "Invalid Provider",
"description": "You have to change \"My Ledger provider\" setting. To change it, open Ledger Live \"Settings\", select \"Experimental features\", and then select a different provider."
Expand Down
3 changes: 2 additions & 1 deletion libs/ledger-live-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,11 @@
"cosmjs-types": "0.2.1",
"date-fns": "^2.23.0",
"eip55": "^2.1.1",
"ethers": "5.7.2",
"expect": "^27.4.6",
"fuse.js": "^6.6.2",
"invariant": "^2.2.2",
"iso-filecoin": "^4.0.3",
"iso-filecoin": "^4.1.0",
"isomorphic-ws": "^4.0.1",
"jotai": "^2.7.0",
"json-rpc-2.0": "^0.2.19",
Expand Down
3 changes: 3 additions & 0 deletions libs/ledger-live-common/src/__tests__/currencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ test("erc20 are all consistent with those on ledgerjs side", () => {
}

if (token.tokenType === "erc20") {
if (token.parentCurrency.family === "filecoin") {
continue;
}
const tokenData = byContractAddressAndChainId(
token.contractAddress,
token.parentCurrency.ethereumLikeInfo?.chainId || 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ exports[`sortCurrenciesByIds snapshot 1`] = `
"ethereum/erc20/lambda",
"ethereum/erc20/dent",
"ethereum/erc20/odem_token",
"filecoin/erc20/securitized_filecoin_token",
"ethereum/erc20/elitium",
"ethereum/erc20/anchor",
"ethereum/erc20/arcblock_token",
Expand Down Expand Up @@ -10926,6 +10927,13 @@ exports[`sortCurrenciesByIds snapshot 1`] = `
"polygon/erc20/zrx",
"polygon/erc20/zurf",
"polygon/erc20/zurf_f91e",
"filecoin/erc20/axelar_wrapped_usdc",
"filecoin/erc20/collectif_staked_fil",
"filecoin/erc20/infinity_pool_staked_fil",
"filecoin/erc20/node_fil",
"filecoin/erc20/pfil_token",
"filecoin/erc20/wrapped_fil",
"filecoin/erc20/wrapped_pfil_token",
"tron/trc10/1002670",
"tron/trc10/1001943",
"tron/trc10/1001351",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`filecoin currency bridge scanAccounts filecoin seed 1 1`] = `
[
{
"balance": "1000000000000000",
"currencyId": "filecoin",
"derivationMode": "glifLegacy",
"freshAddress": "t15lauyzdivqj7m3yob3rxmzdsy7uyhfflwyheuri",
"freshAddressPath": "44'/1'/0'/0/0",
"id": "js:2:filecoin:t15lauyzdivqj7m3yob3rxmzdsy7uyhfflwyheuri:glifLegacy",
"index": 0,
"operationsCount": 0,
"pendingOperations": [],
"seedIdentifier": "04ca7b02cafdf36e8b4caaf530a96b949764af71b956b2a3328b7a10940794c860f574a9199be98bde3c261887fec8e5fd94bc5f104908bf5f992f52ef2a89abb0",
"spendableBalance": "1000000000000000",
"subAccounts": [],
"swapHistory": [],
"syncHash": undefined,
"used": true,
},
{
"balance": "100000000000000000",
"currencyId": "filecoin",
"derivationMode": "glif",
"freshAddress": "f1p74d4mlmeyc4agflhjqsnvoyzyfdai7fmkyso2a",
"freshAddressPath": "44'/461'/0'/0/0",
"id": "js:2:filecoin:f1p74d4mlmeyc4agflhjqsnvoyzyfdai7fmkyso2a:glif",
"index": 0,
"operationsCount": 1,
"pendingOperations": [],
"seedIdentifier": "04ca7b02cafdf36e8b4caaf530a96b949764af71b956b2a3328b7a10940794c860f574a9199be98bde3c261887fec8e5fd94bc5f104908bf5f992f52ef2a89abb0",
"spendableBalance": "100000000000000000",
"subAccounts": [],
"swapHistory": [],
"syncHash": undefined,
"used": true,
},
{
"balance": "10000000000000000",
"currencyId": "filecoin",
"derivationMode": "glif",
"freshAddress": "f1plmg3kklvmnodfboimcq5w27mnfs2hwjtas6gia",
"freshAddressPath": "44'/461'/0'/0/1",
"id": "js:2:filecoin:f1plmg3kklvmnodfboimcq5w27mnfs2hwjtas6gia:glif",
"index": 1,
"operationsCount": 1,
"pendingOperations": [],
"seedIdentifier": "04ca7b02cafdf36e8b4caaf530a96b949764af71b956b2a3328b7a10940794c860f574a9199be98bde3c261887fec8e5fd94bc5f104908bf5f992f52ef2a89abb0",
"spendableBalance": "10000000000000000",
"subAccounts": [],
"swapHistory": [],
"syncHash": undefined,
"used": true,
},
{
"balance": "12340000000000000",
"id": "js:2:filecoin:f1plmg3kklvmnodfboimcq5w27mnfs2hwjtas6gia:glif+filecoin%2Ferc20%2Fwrapped~!underscore!~fil",
"operationsCount": 1,
"parentId": "js:2:filecoin:f1plmg3kklvmnodfboimcq5w27mnfs2hwjtas6gia:glif",
"pendingOperations": [],
"spendableBalance": "12340000000000000",
"swapHistory": [],
"tokenId": "filecoin/erc20/wrapped_fil",
"type": "TokenAccountRaw",
},
{
"balance": "0",
"currencyId": "filecoin",
"derivationMode": "glif",
"freshAddress": "f15nh4cywefp6pavzjifbe2ormma74malwdyy5rfq",
"freshAddressPath": "44'/461'/0'/0/2",
"id": "js:2:filecoin:f15nh4cywefp6pavzjifbe2ormma74malwdyy5rfq:glif",
"index": 2,
"operationsCount": 0,
"pendingOperations": [],
"seedIdentifier": "04ca7b02cafdf36e8b4caaf530a96b949764af71b956b2a3328b7a10940794c860f574a9199be98bde3c261887fec8e5fd94bc5f104908bf5f992f52ef2a89abb0",
"spendableBalance": "0",
"subAccounts": [],
"swapHistory": [],
"syncHash": undefined,
"used": false,
},
{
"balance": "0",
"currencyId": "filecoin",
"derivationMode": "glif",
"freshAddress": "f1lg3347otxjblwqx6pnqnqoz4cqwasq57yo2bxcy",
"freshAddressPath": "44'/461'/0'/0/3",
"id": "js:2:filecoin:f1lg3347otxjblwqx6pnqnqoz4cqwasq57yo2bxcy:glif",
"index": 3,
"operationsCount": 0,
"pendingOperations": [],
"seedIdentifier": "04ca7b02cafdf36e8b4caaf530a96b949764af71b956b2a3328b7a10940794c860f574a9199be98bde3c261887fec8e5fd94bc5f104908bf5f992f52ef2a89abb0",
"spendableBalance": "0",
"subAccounts": [],
"swapHistory": [],
"syncHash": undefined,
"used": false,
},
{
"balance": "0",
"currencyId": "filecoin",
"derivationMode": "glif",
"freshAddress": "f1j2uoeuoiusmh2godly4fivd6gomi6asmzkd47li",
"freshAddressPath": "44'/461'/0'/0/4",
"id": "js:2:filecoin:f1j2uoeuoiusmh2godly4fivd6gomi6asmzkd47li:glif",
"index": 4,
"operationsCount": 0,
"pendingOperations": [],
"seedIdentifier": "04ca7b02cafdf36e8b4caaf530a96b949764af71b956b2a3328b7a10940794c860f574a9199be98bde3c261887fec8e5fd94bc5f104908bf5f992f52ef2a89abb0",
"spendableBalance": "0",
"subAccounts": [],
"swapHistory": [],
"syncHash": undefined,
"used": false,
},
{
"balance": "0",
"currencyId": "filecoin",
"derivationMode": "glif",
"freshAddress": "f1l7h6nvobmqc7adq7plta5kn7xaltx6k6l7paqsq",
"freshAddressPath": "44'/461'/0'/0/5",
"id": "js:2:filecoin:f1l7h6nvobmqc7adq7plta5kn7xaltx6k6l7paqsq:glif",
"index": 5,
"operationsCount": 0,
"pendingOperations": [],
"seedIdentifier": "04ca7b02cafdf36e8b4caaf530a96b949764af71b956b2a3328b7a10940794c860f574a9199be98bde3c261887fec8e5fd94bc5f104908bf5f992f52ef2a89abb0",
"spendableBalance": "0",
"subAccounts": [],
"swapHistory": [],
"syncHash": undefined,
"used": false,
},
{
"balance": "0",
"currencyId": "filecoin",
"derivationMode": "glif",
"freshAddress": "f1i2drwsilv35pp75dvd52enl3ohqakua2mshf5fy",
"freshAddressPath": "44'/461'/0'/0/6",
"id": "js:2:filecoin:f1i2drwsilv35pp75dvd52enl3ohqakua2mshf5fy:glif",
"index": 6,
"operationsCount": 0,
"pendingOperations": [],
"seedIdentifier": "04ca7b02cafdf36e8b4caaf530a96b949764af71b956b2a3328b7a10940794c860f574a9199be98bde3c261887fec8e5fd94bc5f104908bf5f992f52ef2a89abb0",
"spendableBalance": "0",
"subAccounts": [],
"swapHistory": [],
"syncHash": undefined,
"used": false,
},
{
"balance": "0",
"currencyId": "filecoin",
"derivationMode": "glif",
"freshAddress": "f1347zfz7jiz3oeufp2lrbcwwt265ejk32n2wqrla",
"freshAddressPath": "44'/461'/0'/0/7",
"id": "js:2:filecoin:f1347zfz7jiz3oeufp2lrbcwwt265ejk32n2wqrla:glif",
"index": 7,
"operationsCount": 0,
"pendingOperations": [],
"seedIdentifier": "04ca7b02cafdf36e8b4caaf530a96b949764af71b956b2a3328b7a10940794c860f574a9199be98bde3c261887fec8e5fd94bc5f104908bf5f992f52ef2a89abb0",
"spendableBalance": "0",
"subAccounts": [],
"swapHistory": [],
"syncHash": undefined,
"used": false,
},
]
`;

exports[`filecoin currency bridge scanAccounts filecoin seed 1 2`] = `
[
[],
[
{
"accountId": "js:2:filecoin:f1p74d4mlmeyc4agflhjqsnvoyzyfdai7fmkyso2a:glif",
"blockHash": null,
"blockHeight": 1802367,
"extra": {},
"fee": "0",
"hasFailed": false,
"hash": "bafy2bzaceaztepnzdzbul7nmkef6blk5x2luvbvangrjal25k6xi5qob36k32",
"id": "js:2:filecoin:f1p74d4mlmeyc4agflhjqsnvoyzyfdai7fmkyso2a:glif-bafy2bzaceaztepnzdzbul7nmkef6blk5x2luvbvangrjal25k6xi5qob36k32-IN",
"recipients": [
"f1p74d4mlmeyc4agflhjqsnvoyzyfdai7fmkyso2a",
],
"senders": [
"f1ov6d42tujoyexkbdh34oik2vhe5unqo2a5ocqoq",
],
"type": "IN",
"value": "100000000000000000",
},
],
[
{
"accountId": "js:2:filecoin:f1plmg3kklvmnodfboimcq5w27mnfs2hwjtas6gia:glif",
"blockHash": null,
"blockHeight": 3853241,
"extra": {},
"fee": "0",
"hasFailed": false,
"hash": "bafy2bzacecwvvvxtlbm5s6wpk546r66hjqw4amjioihe2rt5ufoebu3zv6xiw",
"id": "js:2:filecoin:f1plmg3kklvmnodfboimcq5w27mnfs2hwjtas6gia:glif-bafy2bzacecwvvvxtlbm5s6wpk546r66hjqw4amjioihe2rt5ufoebu3zv6xiw-IN",
"recipients": [
"f1plmg3kklvmnodfboimcq5w27mnfs2hwjtas6gia",
],
"senders": [
"f1ovlkmtnqji7wrvdpcys3i22c62obbamgokmg35q",
],
"type": "IN",
"value": "10000000000000000",
},
],
[
{
"accountId": "js:2:filecoin:f1plmg3kklvmnodfboimcq5w27mnfs2hwjtas6gia:glif+filecoin%2Ferc20%2Fwrapped~!underscore!~fil",
"blockHash": "",
"blockHeight": 3853248,
"extra": {},
"fee": "0",
"hasFailed": false,
"hash": "bafy2bzaceaw6jxm3bp6rdvtse7k4evsg2zhis3ootn2pe5k3txtxor4efhl7k",
"id": "js:2:filecoin:f1plmg3kklvmnodfboimcq5w27mnfs2hwjtas6gia:glif+filecoin%2Ferc20%2Fwrapped~!underscore!~fil-bafy2bzaceaw6jxm3bp6rdvtse7k4evsg2zhis3ootn2pe5k3txtxor4efhl7k-IN",
"recipients": [
"f1plmg3kklvmnodfboimcq5w27mnfs2hwjtas6gia",
],
"senders": [
"f1pnc33cba2c2a3olqadho7wiohyosbkl3upescei",
],
"type": "IN",
"value": "12340000000000000",
},
],
[],
[],
[],
[],
[],
[],
]
`;
Loading
Loading