This repository has been archived by the owner on Jun 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 376
[WIP] Add automated preparation of Ethereum device app for plugins and ERC20 #587
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
166191b
PoC: Add automatic support for Ethereum plugins
TamtamHero 38c72de
add compat with old nano apps
machard cc9a04d
same same setExternalPlugin
machard 01d0107
Support signed plugins
TamtamHero 71ba9dc
fix crypto-assets imports
machard 53100ee
update paths
machard 6c6daa8
remove useless yarn.lock
machard aeba097
setup
machard 1b02a4e
safety
machard 7a696dc
step
machard 1241f1e
doc
machard e5617ac
update json + handle erc20ofInterests
machard a6bdca5
remove todo
machard 4547ead
add logs
machard cdd0d27
test attemp
machard e348025
test ok
machard 68dddc8
fix link
machard 9413041
remove rlp
machard 97c291d
remove console log
machard 12cbdd0
Merge branch 'master' into auto-plugin
gre 3f1b39d
Merge branch 'master' into auto-plugin
gre 1b7cd40
prettify json import
machard 8a9a4f2
Merge branch 'auto-plugin' of github.com:TamtamHero/ledgerjs into aut…
machard 1f2c4fd
fix test
machard 034ad45
ci
gre e79b7fc
update cal
machard 138ed82
Merge branch 'auto-plugin' of github.com:TamtamHero/ledgerjs into aut…
machard 71bb241
ensure lowercase
machard 148e00a
Merge branch 'master' into auto-plugin
gre f036341
Merge branch 'master' into auto-plugin
gre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import data from "@ledgerhq/cryptoassets/data/dapps/ethereum"; | ||
|
||
/** | ||
* Retrieve the metadatas a given contract address and a method selector | ||
*/ | ||
|
||
export const getInfosForContractMethod = (contractAddress, selector) => { | ||
const lcSelector = selector.toLowerCase(); | ||
const lcContractAddress = contractAddress.toLowerCase(); | ||
|
||
if (lcContractAddress in data) { | ||
const contractSelectors = data[lcContractAddress]; | ||
|
||
if (lcSelector in contractSelectors) { | ||
return { | ||
payload: contractSelectors[lcSelector]["serialized_data"], | ||
signature: contractSelectors[lcSelector]["signature"], | ||
plugin: contractSelectors[lcSelector]["plugin"], | ||
erc20OfInterest: contractSelectors[lcSelector]["erc20OfInterest"], | ||
abi: contractSelectors["abi"], | ||
}; | ||
} | ||
} | ||
}; | ||
|
||
exports.getInfosForContractMethod = getInfosForContractMethod; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes signTransactionLargeChainID2 test fail with "data array too short".
Should we catch silently this case or does the test needs to be fixed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also just before this part, we modify rawTx in case its an EIP155 transaction.
Should we use the updated rawTx instead of the original rawTxHex?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no idea for
signTransactionLargeChainID2
But I'd say yes, you should use the updated rawTx here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rawTx is actually not updated so its ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
signTransactionLargeChainID2 fixed