⛔️ MOVED to monorepo "ledger-live"
eth.signTransaction(path, txHex)
becomes deprecated in favor of
eth.signTransaction(path, txHex, resolution)
where resolution is an object with following shape:
{
erc20Tokens: Array<string>;
nfts: Array<string>;
externalPlugin: Array<{ payload: string; signature: string }>;
plugin: Array<string>;
}
This object contains all the hex serialized data the device may need to clear sign information on device screen.
Hopefully we also provide a default "service" to resolve this data, example:
import ledgerService from "@ledgerhq/hw-app-eth/lib/services/ledger"
async function main() {
...
const resolution = await ledgerService.resolveTransaction(txHex, loadConfig, resolutionConfig)
.catch(() => null); // <-- up to you if you want a fallback to blind sign. (which was previous behavior)
const result = eth.signTransaction("44'/60'/0'/0/0", txHex, resolution);
}
This allows us to decouple the transaction resolution from the device signature logic itself in order for you to have better control and for more usecases
.catch(() => null)
in the snippet aboveloadConfig is a configuration file that allows to configure what endpoints are used for the resolution mecanism.
NFT resolution is not yet active in this current version but will be soon. That said, you need to explicitly request it in resolutionConfig.
you can set {}
object and it will be fallback to default values.
This is an object that specifies what need to be resolved, if any.
Here are all the possible flag to set at the moment:
{ nft: true, externalPlugins: true, erc20: true }
you can just { erc20: true }
if you just need to resolve ERC20 token signature. It gives context for the resolver to do the minimum.
You can also see:
nft
: is the mecanics to do clear signing. (it is not yet active, unless you set the correct loadConfig API)externalPlugins
: is the plugin mecanics (e.g. LIDO) to see what you sign in Ledger Live apps.ERC20 update
@ledgerhq/cryptoassets
update
@ledgerhq/hw-app-eth
: All necessary fixes to support NFT@ledgerhq/hw-app-btc
: LL-8255: call onDeviceSignatureRequested at a more accurate time