Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/lazy-mayflies-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/coin-evm": major
---

refactor(coin-evm): remove dead code
5 changes: 1 addition & 4 deletions libs/coin-modules/coin-evm/docs/adapters.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ Set of functions in charge of converting a transaction format specific to a libr

## Files

#### ethers.ts
Functions used to convert transactions for the [ethers.js v6 library](https://docs.ethers.org/v6/)

#### etherscan.ts
Functions used to convert transactions coming from the [etherscan-like explorers](https://docs.etherscan.io/api-endpoints/accounts)

#### ledger.ts
Functions used to convert transactions coming from the [Ledger explorers](https://explorers.api.live.ledger.com/blockchain/v4/eth/docs/#/address/Transactions%20by%20address)
Functions used to convert transactions coming from the [Ledger explorers](https://explorers.api.live.ledger.com/blockchain/v4/eth/docs/#/address/Transactions%20by%20address)
16 changes: 1 addition & 15 deletions libs/coin-modules/coin-evm/docs/logic.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ Set of helpers for the whole coin-evm module.

## Methods

#### legacyTransactionHasFees
Simple function to verify the presence of key and values specific to transactions of type 0 and 1 (not type 2 / EIP-1559).

#### eip1559TransactionHasFees
Simple function to verify the presence of key and values specific to transactions of type 2 (not type 0/Legacy or type 1/EIP-2930).

#### getGasLimit
Helper return the gas limit of a transaction, either customized by the user or the default one.

Expand All @@ -29,16 +23,8 @@ Helper working with the idea of maintaining the javascript memory references of
Method creating a hash that will help triggering or not a full synchronization on an account.
Modifying the result of this method will force every ledger live account to do at least 1 full synchronization the next time they use this lib.

#### attachOperations
Helper in charge of linking operations together based on transaction hash. Token operations & NFT operations are the result of a coin operation and if this coin operation is originated by our user we want to link those operations together as main & children operations.
A sub operation should always be linked to a coin operation, even if the user isn't at the origin of the sub operation. "NONE" type coin operations can be added when necessary.
⚠️ If an NFT operation was found without a coin parent operation just like if it was not initiated by the synced account and we were to find that coin operation during another sync, the NONE operation created would not be removed, creating a duplicate that will cause issues regarding NFT balances & React key duplications.

#### isNftTransaction
Type gard method narrowing NFT related transactions.

#### padHexString
Add necessary "0" in a hexadecimal string in order to make its character an even number, which can be necessary to some implementations. (e.g. 0x123 => 0x0123)

#### getMessageProperties
Function returning the properties that will be displayed on the nano in order to sign it, based on the message type/standard.
Function returning the properties that will be displayed on the nano in order to sign it, based on the message type/standard.
7 changes: 0 additions & 7 deletions libs/coin-modules/coin-evm/docs/transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,5 @@ This serializer transforms a stringified transaction into a hydrated transaction
##### toTransactionRaw <sub><sup><sub><sup>[standard]</sup><sub></sup><sub>
This serializer transforms a stringified transaction into a hydrated transaction.

##### getTransactionData
This method returns the *callData* of a smart contract transaction when crafted with a transaction mode (`send` mode can be coins or ERC20 transactions, while `erc721` & `erc1155` modes are NFT transactions).

##### getTypedTransaction
[EIP-2718](https://eips.ethereum.org/EIPS/eip-2718 "eip-2718") defines the capacity of a transaction to have different types, which can introduce new properties compared to the legacy definition. This method acts as a type guard for a transaction, depending on its type, to ensure that you're interacting with a transaction that has all the necessary properties for the [RLP encoding](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/ "RLP encoding") to work correctly. As of today, only type 0 (legacy) and type 2 ([EIP-1559](https://eips.ethereum.org/EIPS/eip-1559 "EIP-1559")) transactions are supported. Type 1 ([EIP-2930](https://eips.ethereum.org/EIPS/eip-2930 "EIP-2930")) is compatible but does not add any access lists.


##### getSerializedTransaction
This method returns an [RLP encoding](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/ "RLP encoding") hexadecimal string representation of the provided transaction.
131 changes: 0 additions & 131 deletions libs/coin-modules/coin-evm/src/adapters/ethers.test.ts

This file was deleted.

39 changes: 0 additions & 39 deletions libs/coin-modules/coin-evm/src/adapters/ethers.ts

This file was deleted.

1 change: 0 additions & 1 deletion libs/coin-modules/coin-evm/src/adapters/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* istanbul ignore file: pure exports, bridge tested by live-common with bridge.integration.test.ts */

export * from "./ethers";
export * from "./ledger";
export * from "./etherscan";
export * from "./blockOperations";
2 changes: 0 additions & 2 deletions libs/coin-modules/coin-evm/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const InvalidExplorerResponse = createCustomErrorClass("InvalidExplorerRe
// Node
export const UnknownNode = createCustomErrorClass("UnknownNode");
export const LedgerNodeUsedIncorrectly = createCustomErrorClass("LedgerNodeUsedIncorrectly");
export const ExternalNodeUsedIncorrectly = createCustomErrorClass("ExternalNodeUsedIncorrectly");
export const UnsupportedRpcMethodError = createCustomErrorClass<{
method: string;
rawError: unknown;
Expand All @@ -35,4 +34,3 @@ export const InsufficientFunds = createCustomErrorClass("InsufficientFunds");
// Nfts
export const NotOwnedNft = createCustomErrorClass("NotOwnedNft");
export const NotEnoughNftOwned = createCustomErrorClass("NotEnoughNftOwned");
export const QuantityNeedsToBePositive = createCustomErrorClass("QuantityNeedsToBePositive");
Loading
Loading