diff --git a/cpp/test/samples/evm-metadata.js b/cpp/test/samples/evm-metadata.js index b4114989..70d2ae18 100644 --- a/cpp/test/samples/evm-metadata.js +++ b/cpp/test/samples/evm-metadata.js @@ -1,35 +1,39 @@ const { PublicKey } = require('@wharfkit/antelope') -const teeCompressedPubKey = '0380472f799469d9af8790307a022802785c2b1e2f9c0930bdf9bafe193245e7a3' -const compressed = Uint8Array.from( - Buffer.from( - teeCompressedPubKey, - 'hex', - ), -) +const teeCompressedPubKey = + '0380472f799469d9af8790307a022802785c2b1e2f9c0930bdf9bafe193245e7a3' +const compressed = Uint8Array.from(Buffer.from(teeCompressedPubKey, 'hex')) const teePubKey = PublicKey.from({ type: 'K1', compressed }) const evmMetadataSamples = { pegin: { - preimage: '010100000000000000000000000000000000000000000000000000000000000000017e21ba208ea2a072bad2d011dbc3a9f870c574a66203d84bde926fcf85756d782e3704b180feda25af9dfe50793e292fd99d644aa505c3d170fa69407091dbd3000000000000000000000000bcf063a9eb18bc3c6eb005791c61801b7cb16fe466756e6473206172652073616675207361667520736166752073616675202e2e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000810090f35dfa6b18b5eb59d298e2a2443a2811e2aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906000000000000000000000000000000000000000000000000517d3388612e7c00000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000000000000000000000000000000000000000000c656f73726563697069656e74', - signature: '1c9d748745b9f2e6d79b252bbe69f8f13af6f8ca3d828f04b5054cd7e3695384206b28af339d2d2605483af57c901031878bffde773cfb33723598113b6e58b936', + preimage: + '010100000000000000000000000000000000000000000000000000000000000000017e21ba208ea2a072bad2d011dbc3a9f870c574a66203d84bde926fcf85756d782e3704b180feda25af9dfe50793e292fd99d644aa505c3d170fa69407091dbd3000000000000000000000000bcf063a9eb18bc3c6eb005791c61801b7cb16fe466756e6473206172652073616675207361667520736166752073616675202e2e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000810090f35dfa6b18b5eb59d298e2a2443a2811e2aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906000000000000000000000000000000000000000000000000517d3388612e7c00000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000000000000000000000000000000000000000000c656f73726563697069656e74', + signature: + '1c9d748745b9f2e6d79b252bbe69f8f13af6f8ca3d828f04b5054cd7e3695384206b28af339d2d2605483af57c901031878bffde773cfb33723598113b6e58b936', }, peginWithUserData: { - preimage: '010100000000000000000000000000000000000000000000000000000000000000018111e4e5e8ce115304d00d3947de97fb4ab73e0e3a3348cc86bae22d36f3572ff48d3b1b5ffe7149db8edf667ffc90c5b0035ab143fb2031156a4326f1c00049000000000000000000000000bcf063a9eb18bc3c6eb005791c61801b7cb16fe466756e6473206172652073616675207361667520736166752073616675202e2e0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000810090f35dfa6b18b5eb59d298e2a2443a2811e2aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e9060000000000000000000000000000000000000000000000000dd7d491e4f593a0000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000000000000000000000000000000000000000000c656f73726563697069656e7412345abcdefc0de1337f', - signature: '1c2803fe7eebafd248714903312b57bb336fb44d6d10294811d51941041a7408ab08200db8e734c0861ad48fc16e886f574568c1d549511dd9463ce4f824ce11b9', + preimage: + '010100000000000000000000000000000000000000000000000000000000000000018111e4e5e8ce115304d00d3947de97fb4ab73e0e3a3348cc86bae22d36f3572ff48d3b1b5ffe7149db8edf667ffc90c5b0035ab143fb2031156a4326f1c00049000000000000000000000000bcf063a9eb18bc3c6eb005791c61801b7cb16fe466756e6473206172652073616675207361667520736166752073616675202e2e0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000810090f35dfa6b18b5eb59d298e2a2443a2811e2aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e9060000000000000000000000000000000000000000000000000dd7d49099689000000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000000000000000000000000000000000000000000c656f73726563697069656e7412345abcdefc0de1337f', + signature: + '1b5d941f9856d83e6776500344e4e62bfe66deb509c509228bb2ab88d32b8a2dee290c160bf5c575034c88dd39d4b598f5fa7080a97be90398437cb3ccb9049051', }, peginWithWrongSignature: { - preimage: '010100000000000000000000000000000000000000000000000000000000000000017e21ba208ea2a072bad2d011dbc3a9f870c574a66203d84bde926fcf85756d782e3704b180feda25af9dfe50793e292fd99d644aa505c3d170fa69407091dbd3000000000000000000000000bcf063a9eb18bc3c6eb005791c61801b7cb16fe466756e6473206172652073616675207361667520736166752073616675202e2e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000810090f35dfa6b18b5eb59d298e2a2443a2811e2aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906000000000000000000000000000000000000000000000000517d3388612e7c00000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000000000000000000000000000000000000000000c656f73726563697069656e74', - signature: '1c6546663ecbecdae2cb802fc8bf5681dd38c1be86ccf03807c7353d98acdca37c3554231937b66a895e13b2a77371107f2a4e6613ff89e73b0b87ddc1c5783606', + preimage: + '010100000000000000000000000000000000000000000000000000000000000000017e21ba208ea2a072bad2d011dbc3a9f870c574a66203d84bde926fcf85756d782e3704b180feda25af9dfe50793e292fd99d644aa505c3d170fa69407091dbd3000000000000000000000000bcf063a9eb18bc3c6eb005791c61801b7cb16fe466756e6473206172652073616675207361667520736166752073616675202e2e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000810090f35dfa6b18b5eb59d298e2a2443a2811e2aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906000000000000000000000000000000000000000000000000517d3388612e7c00000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000000000000000000000000000000000000000000c656f73726563697069656e74', + signature: + '1c6546663ecbecdae2cb802fc8bf5681dd38c1be86ccf03807c7353d98acdca37c3554231937b66a895e13b2a77371107f2a4e6613ff89e73b0b87ddc1c5783606', }, peginWithWrongContext: { - preimage: '010100000000000000000000000000000100000000000000000000000000000000010e3595e678db71061a7fcba915f9ffc91f84cc0f5dee8e3cdfee83a68793d09bbe5c527a4c59a275b7493fab9984e26c445256dfbd328fcb928c6925baaf326c000000000000000000000000a899118f4bccb62f8c6a37887a4f450d8a4e92e066756e6473206172652073616675207361667520736166752073616675202e2e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e58cbe144dd5556c84874dec1b3f2d0d6ac45f1baca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906000000000000000000000000000000000000000000000000517d3388612e7c00000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000000000000000000000000000000000000000000c656f73726563697069656e74', - signature: '1b6bb660753f91d7b2dfbda8bc59f59dac158234315d65f0ebda9a2159dc0c18b10cbddf78b6ef6a4a0487850531d64715f8b0aec460d296a010c45960b6dae423', + preimage: + '010100000000000000000000000000000100000000000000000000000000000000010e3595e678db71061a7fcba915f9ffc91f84cc0f5dee8e3cdfee83a68793d09bbe5c527a4c59a275b7493fab9984e26c445256dfbd328fcb928c6925baaf326c000000000000000000000000a899118f4bccb62f8c6a37887a4f450d8a4e92e066756e6473206172652073616675207361667520736166752073616675202e2e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e58cbe144dd5556c84874dec1b3f2d0d6ac45f1baca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906000000000000000000000000000000000000000000000000517d3388612e7c00000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000000000000000000000000000000000000000000c656f73726563697069656e74', + signature: + '1b6bb660753f91d7b2dfbda8bc59f59dac158234315d65f0ebda9a2159dc0c18b10cbddf78b6ef6a4a0487850531d64715f8b0aec460d296a010c45960b6dae423', }, } module.exports = { evmMetadataSamples, teeCompressedPubKey, - teePubKey -} \ No newline at end of file + teePubKey, +} diff --git a/cpp/test/samples/evm-operations.js b/cpp/test/samples/evm-operations.js index 2c4bbfff..84d4c4e1 100644 --- a/cpp/test/samples/evm-operations.js +++ b/cpp/test/samples/evm-operations.js @@ -1,5 +1,5 @@ const { toBeHex, zeroPadValue, parseUnits } = require('ethers') -const { no0x } = require('../utils/bytes-utils') +const { no } = require('../utils/bytes-utils') const evmTopicZero = '66756e6473206172652073616675207361667520736166752073616675202e2e' @@ -8,64 +8,30 @@ const evmAdapter = const evmOperationSamples = { pegin: { - blockId: no0x( - zeroPadValue( - '0x7e21ba208ea2a072bad2d011dbc3a9f870c574a66203d84bde926fcf85756d78', - 32, - ), - ), - txId: no0x( - zeroPadValue( - '0x2e3704b180feda25af9dfe50793e292fd99d644aa505c3d170fa69407091dbd3', - 32, - ), - ), + blockId: '7e21ba208ea2a072bad2d011dbc3a9f870c574a66203d84bde926fcf85756d78', + txId: '2e3704b180feda25af9dfe50793e292fd99d644aa505c3d170fa69407091dbd3', nonce: 0, - token: no0x( - zeroPadValue(toBeHex('0x810090f35dfa6b18b5eb59d298e2a2443a2811e2'), 32), - ), - originChainId: no0x(zeroPadValue('0x01', 32)), // EVM mainnet chain id - destinationChainId: no0x( - zeroPadValue( - '0xaca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906', - 32, - ), - ), // EOS chain id - amount: parseUnits('5.87190615', 18).toString(), - sender: no0x( - zeroPadValue('0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', 32), - ), + token: '000000000000000000000000810090f35dfa6b18b5eb59d298e2a2443a2811e2', + originChainId: + '0000000000000000000000000000000000000000000000000000000000000001', // EVM mainnet chain id + destinationChainId: + 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906', // EOS chain id + amount: '5.87190615 XTST', + sender: '000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266', recipient: 'eosrecipient', data: '', }, peginWithUserData: { - blockId: no0x( - zeroPadValue( - '0x8111e4e5e8ce115304d00d3947de97fb4ab73e0e3a3348cc86bae22d36f3572f', - 32, - ), - ), - txId: no0x( - zeroPadValue( - '0xf48d3b1b5ffe7149db8edf667ffc90c5b0035ab143fb2031156a4326f1c00049', - 32, - ), - ), + blockId: '8111e4e5e8ce115304d00d3947de97fb4ab73e0e3a3348cc86bae22d36f3572f', + txId: 'f48d3b1b5ffe7149db8edf667ffc90c5b0035ab143fb2031156a4326f1c00049', nonce: 1, - token: no0x( - zeroPadValue(toBeHex('0x810090f35DFA6B18b5EB59d298e2A2443a2811E2'), 32), - ), - originChainId: no0x(zeroPadValue('0x01', 32)), // ETH chain id - destinationChainId: no0x( - zeroPadValue( - '0xaca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906', - 32, - ), - ), // EOS chain id - amount: parseUnits('0.9974995655625', 18).toString(), - sender: no0x( - zeroPadValue('0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', 32), - ), + token: '000000000000000000000000810090f35dfa6b18b5eb59d298e2a2443a2811e2', + originChainId: + '0000000000000000000000000000000000000000000000000000000000000001', // ETH chain id + destinationChainId: + 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906', // EOS chain id + amount: '0.99749956 XTST', + sender: '000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266', recipient: 'eosrecipient', data: '12345abcdefc0de1337f', },