Fix nft transactions (#229)
* Removed pluginType "hack" * Fix some ERC 721 & 1155 function signature hashes * Fix UI for ERC721 operations * Explicit Batch Transfer UI with ERC1155 * Unified some ERC721 & 1155 non-static functions naming * Fix UI for ERC1155 operations * Added missing pin-lock check when signing transactions * Fix the shell script that builds the elf files for testing * Add tests dependency ethers * Removed the space in the test filename * Tests build script refactoring * Now works when called from anywhere (not just the script's directory) * Now handles LNS & LNX builds together (less duplicated code) * Temporarily disable Nano X tests Until Zemu supports Nano X 2.0 SDK * Tests now start with blind signing disabled Makes it closer to reality & very few of them requires it * Update to the latest sdk version * make eth_plugin_perform_init() readable Introduce 2 functions. * Now properly parses the apdu and displays the total quantity of NFT IDs transferred in ERC1155 batch transfer * Add NFT prod public keys * Added extra checks for the chain ID handling Following the security review * NFTs now only supported by LNS * Version bump Co-authored-by: Alexandre Paillier <alexandre.paillier@ledger.fr> Co-authored-by: greenknot <greenknot@users.noreply.github.com>
This commit is contained in:
@@ -19,7 +19,7 @@ test('[Nano S] Approve DAI tokens', zemu("nanos", async (sim, eth) => {
|
||||
});
|
||||
}));
|
||||
|
||||
test('[Nano X] Approve DAI tokens', zemu("nanox", async (sim, eth) => {
|
||||
test.skip('[Nano X] Approve DAI tokens', zemu("nanox", async (sim, eth) => {
|
||||
|
||||
const tx = eth.signTransaction(
|
||||
"44'/60'/1'/0/0",
|
||||
|
||||
@@ -3,6 +3,8 @@ import "regenerator-runtime/runtime";
|
||||
import { waitForAppScreen, zemu } from './test.fixture';
|
||||
|
||||
test('[Nano S] Deposit ETH on compound, blind sign', zemu("nanos", async (sim, eth) => {
|
||||
// Enable blind-signing
|
||||
await sim.navigateAndCompareSnapshots('.', 'nanos_enable_blind_signing', [-2, 0, 0, 3, 0]);
|
||||
|
||||
const tx = eth.signTransaction(
|
||||
"44'/60'/1'/0/0",
|
||||
@@ -19,7 +21,7 @@ test('[Nano S] Deposit ETH on compound, blind sign', zemu("nanos", async (sim, e
|
||||
});
|
||||
}));
|
||||
|
||||
test('[Nano X] Deposit ETH on compound, blind sign', zemu("nanox", async (sim, eth) => {
|
||||
test.skip('[Nano X] Deposit ETH on compound, blind sign', zemu("nanox", async (sim, eth) => {
|
||||
|
||||
const tx = eth.signTransaction(
|
||||
"44'/60'/1'/0/0",
|
||||
|
||||
@@ -36,7 +36,7 @@ test('[Nano S] Transfer on palm network on Ethereum', zemu("nanos", async (sim,
|
||||
});
|
||||
}));
|
||||
|
||||
test('[Nano X] Transfer on network 112233445566 on Ethereum', zemu("nanox", async (sim, eth) => {
|
||||
test.skip('[Nano X] Transfer on network 112233445566 on Ethereum', zemu("nanox", async (sim, eth) => {
|
||||
|
||||
const tx = eth.signTransaction(
|
||||
"44'/60'/1'/0/0",
|
||||
@@ -53,7 +53,7 @@ test('[Nano X] Transfer on network 112233445566 on Ethereum', zemu("nanox", asyn
|
||||
});
|
||||
}));
|
||||
|
||||
test('[Nano X] Transfer on palm network on Ethereum', zemu("nanox", async (sim, eth) => {
|
||||
test.skip('[Nano X] Transfer on palm network on Ethereum', zemu("nanox", async (sim, eth) => {
|
||||
|
||||
const tx = eth.signTransaction(
|
||||
"44'/60'/1'/0/0",
|
||||
@@ -68,4 +68,4 @@ test('[Nano X] Transfer on palm network on Ethereum', zemu("nanox", async (sim,
|
||||
"s": "3698e84564e58477a49f7a9cea572ef5d672a5538db08f3ee42df5eb75a1b907",
|
||||
"v": "0542b8613d",
|
||||
});
|
||||
}));
|
||||
}));
|
||||
|
||||
@@ -6,9 +6,6 @@ import { waitForAppScreen, zemu } from './test.fixture';
|
||||
import Zemu from '@zondax/zemu';
|
||||
|
||||
test('[Nano S] Try to blind sign with setting disabled', zemu("nanos", async (sim, eth) => {
|
||||
// disable blind signing
|
||||
await sim.navigateAndCompareSnapshots('.', 'nanos_disable_blind_signing', [-2, 0, 0, 3, 0]);
|
||||
|
||||
// we can't use eth.signTransaction because it detects that contract data is disabled and fails early
|
||||
let transport = await sim.getTransport();
|
||||
let buffer = Buffer.from("058000002c8000003c800000010000000000000000f849208506fc23ac008303dc3194f650c3d88d12db855b8bf7d11be6c55a4e07dcc980a4a1712d6800000000000000000000000000000000000000000000000000000000000acbc7018080", "hex");
|
||||
@@ -21,7 +18,7 @@ test('[Nano S] Try to blind sign with setting disabled', zemu("nanos", async (si
|
||||
await sim.navigateAndCompareSnapshots('.', 'nanos_try_to_blind_sign_with_setting_disabled', [1, 0]);
|
||||
}));
|
||||
|
||||
test('[Nano X] Try to blind sign with setting disabled', zemu("nanox", async (sim, eth) => {
|
||||
test.skip('[Nano X] Try to blind sign with setting disabled', zemu("nanox", async (sim, eth) => {
|
||||
// disable blind signing
|
||||
await sim.navigateAndCompareSnapshots('.', 'nanox_disable_blind_signing', [-2, 0, 0, 3, 0]);
|
||||
|
||||
@@ -35,4 +32,4 @@ test('[Nano X] Try to blind sign with setting disabled', zemu("nanox", async (si
|
||||
await Zemu.sleep(1000);
|
||||
await waitForAppScreen(sim);
|
||||
await sim.navigateAndCompareSnapshots('.', 'nanox_try_to_blind_sign_with_setting_disabled', [0]);
|
||||
}));
|
||||
}));
|
||||
|
||||
@@ -20,7 +20,7 @@ test('[Nano S] Transfer eip1559', zemu("nanos", async (sim, eth) => {
|
||||
|
||||
}));
|
||||
|
||||
test('[Nano X] Transfer eip1559', zemu("nanox", async (sim, eth) => {
|
||||
test.skip('[Nano X] Transfer eip1559', zemu("nanox", async (sim, eth) => {
|
||||
|
||||
const tx = eth.signTransaction(
|
||||
"44'/60'/0'/0/0",
|
||||
@@ -36,4 +36,4 @@ test('[Nano X] Transfer eip1559', zemu("nanox", async (sim, eth) => {
|
||||
"v": "01"
|
||||
});
|
||||
|
||||
}));
|
||||
}));
|
||||
|
||||
@@ -2,7 +2,7 @@ import "core-js/stable";
|
||||
import "regenerator-runtime/runtime";
|
||||
import { waitForAppScreen, zemu, txFromEtherscan } from './test.fixture';
|
||||
|
||||
test('[Nano S] Transfer erc721', zemu("nanos", async (sim, eth) => {
|
||||
test.skip('[Nano S] Transfer erc721', zemu("nanos", async (sim, eth) => {
|
||||
|
||||
// https://etherscan.io/tx/0x73cec4fc07de3a24ba42e8756e13b7ddfa9bd449126c37640881195e8ea9e679
|
||||
// Modified to put a bigger token id
|
||||
@@ -24,7 +24,7 @@ test('[Nano S] Transfer erc721', zemu("nanos", async (sim, eth) => {
|
||||
});
|
||||
}));
|
||||
|
||||
test('[Nano S] Transfer erc721 with attached ETH', zemu("nanos", async (sim, eth) => {
|
||||
test.skip('[Nano S] Transfer erc721 with attached ETH', zemu("nanos", async (sim, eth) => {
|
||||
|
||||
const rawTx = "0x02f8d601058459682f0085233da9943e8301865b94bd3531da5cf5857e7cfaa92426877b022e612cf8854242424242b86423b872dd0000000000000000000000004cc568b73c0dcf8e90db26d7fd3a6cfadca108a3000000000000000000000000d4c9b20950c3eca38fc1f33f54bdf9694e4887990000000000000000000000000000000000000000000000000000000000000f21c080a094c8632fe7277aa8c54cea9d81a15911cfa4970a2bf7356d14d04cc5afbcdab7a013a77b8c79e5d9b2b35edb3c44db3bb41b92f5c463ff126bf19d213b2b9ba8b5"
|
||||
const serializedTx = txFromEtherscan(rawTx);
|
||||
@@ -45,7 +45,7 @@ test('[Nano S] Transfer erc721 with attached ETH', zemu("nanos", async (sim, eth
|
||||
});
|
||||
}));
|
||||
|
||||
test('[Nano S] set approval for all erc721', zemu("nanos", async (sim, eth) => {
|
||||
test.skip('[Nano S] set approval for all erc721', zemu("nanos", async (sim, eth) => {
|
||||
|
||||
// https://etherscan.io/tx/0x86b936db53c19fddf26b8d145f165e1c7fdff3c0f8b14b7758a38f0400cfd93f
|
||||
const rawTx = "0x02f8b0010c8459682f00852cfbb00ee682b54294d4e4078ca3495de5b1d4db434bebc5a98619778280b844a22cb4650000000000000000000000002efcb1e8d4472d35356b9747bea8a051eac2e3f50000000000000000000000000000000000000000000000000000000000000001c001a0c5b8c024c15ca1452ce8a13eacfcdc25f1c6f581bb3ce570e82f08f1b792b3aca03be4dba0302ae190618a72eb1202ce3af3e17afd7d8a94345a48cae5cad15541";
|
||||
@@ -87,7 +87,7 @@ test.skip('[Nano S] approval erc721', zemu("nanos", async (sim, eth) => {
|
||||
});
|
||||
}));
|
||||
|
||||
test('[Nano S] safe transfer erc721', zemu("nanos", async (sim, eth) => {
|
||||
test.skip('[Nano S] safe transfer erc721', zemu("nanos", async (sim, eth) => {
|
||||
|
||||
// https://etherscan.io/tx/0x1ee6ce9be1c9fe6f030ff124ba8c88a410223c022816547e4b3fedd3a4d2dc1e
|
||||
const rawTx = "0xf8cc82028585077359400083061a8094d4e4078ca3495de5b1d4db434bebc5a98619778280b86442842e0e000000000000000000000000c352b534e8b987e036a93539fd6897f53488e56a0000000000000000000000000a9287d9339c175cd3ea0ad4228f734a9f75ee6200000000000000000000000000000000000000000000000000000000000000621ca08250f4b2c8f28c5e4ef621dba4682990d1faf930c8cb6d032c6e7278e8951d92a03c1e1f6d63ed339041f69f24c6c0968ba26f244f779cb4fa7a468f3ba3d3e06e";
|
||||
@@ -127,4 +127,4 @@ test.skip('[Nano S] safe transfer with data erc721', zemu("nanos", async (sim, e
|
||||
|
||||
await expect(tx).resolves.toEqual({
|
||||
});
|
||||
}));
|
||||
}));
|
||||
|
||||
@@ -47,7 +47,7 @@ test('[Nano S] Transfer Ether on network 5234 on Ethereum app', zemu("nanos", as
|
||||
});
|
||||
}));
|
||||
|
||||
test('[Nano X] Transfer Ether on Ethereum app', zemu("nanox", async (sim, eth) => {
|
||||
test.skip('[Nano X] Transfer Ether on Ethereum app', zemu("nanox", async (sim, eth) => {
|
||||
|
||||
const tx = eth.signTransaction(
|
||||
"44'/60'/1'/0/0",
|
||||
@@ -64,7 +64,7 @@ test('[Nano X] Transfer Ether on Ethereum app', zemu("nanox", async (sim, eth) =
|
||||
});
|
||||
}));
|
||||
|
||||
test('[Nano X] Transfer Ether on network 5234 on Ethereum app', zemu("nanox", async (sim, eth) => {
|
||||
test.skip('[Nano X] Transfer Ether on network 5234 on Ethereum app', zemu("nanox", async (sim, eth) => {
|
||||
|
||||
const tx = eth.signTransaction(
|
||||
"44'/60'/1'/0/0",
|
||||
|
||||
@@ -19,7 +19,7 @@ test('[Nano S] Transfer bsc', zemu("nanos", async (sim, eth) => {
|
||||
});
|
||||
}));
|
||||
|
||||
test('[Nano X] Transfer bsc', zemu("nanox", async (sim, eth) => {
|
||||
test.skip('[Nano X] Transfer bsc', zemu("nanox", async (sim, eth) => {
|
||||
|
||||
const tx = eth.signTransaction(
|
||||
"44'/60'/1'/0/0",
|
||||
@@ -34,4 +34,4 @@ test('[Nano X] Transfer bsc', zemu("nanox", async (sim, eth) => {
|
||||
"s": "6b35492b7108d9d9e1cc7aede536ed6b3173197b56dd873cbc3b43e041d6f407",
|
||||
"v": "93",
|
||||
});
|
||||
}));
|
||||
}));
|
||||
|
||||
@@ -60,7 +60,7 @@ test("[Nano S] Transfer on network 5234 on Ethereum clone", async () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("[Nano X] Transfer on Ethereum clone app", async () => {
|
||||
test.skip("[Nano X] Transfer on Ethereum clone app", async () => {
|
||||
jest.setTimeout(TIMEOUT);
|
||||
const sim = new Zemu(NANOX_CLONE_ELF_PATH, NANOX_ETH_LIB);
|
||||
|
||||
@@ -89,7 +89,7 @@ test("[Nano X] Transfer on Ethereum clone app", async () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("[Nano X] Transfer on network 5234 on Ethereum clone", async () => {
|
||||
test.skip("[Nano X] Transfer on network 5234 on Ethereum clone", async () => {
|
||||
jest.setTimeout(TIMEOUT);
|
||||
const sim = new Zemu(NANOX_CLONE_ELF_PATH, NANOX_ETH_LIB);
|
||||
|
||||
@@ -111,4 +111,4 @@ test("[Nano X] Transfer on network 5234 on Ethereum clone", async () => {
|
||||
} finally {
|
||||
await sim.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ test('[Nano S] Transfer Ether on Ethereum app', zemu("nanos", async (sim, eth) =
|
||||
});
|
||||
}));
|
||||
|
||||
test('[Nano X] Transfer Ether on Ethereum app', zemu("nanox", async (sim, eth) => {
|
||||
test.skip('[Nano X] Transfer Ether on Ethereum app', zemu("nanox", async (sim, eth) => {
|
||||
|
||||
// Provide USDT token info to the app
|
||||
const usdt_info = byContractAddressAndChainId("0xdac17f958d2ee523a2206206994597c13d831ec7", 1);
|
||||
|
||||
Reference in New Issue
Block a user