Skip to content

Commit

Permalink
fix: optimize hardware example
Browse files Browse the repository at this point in the history
  • Loading branch information
wabicai committed Dec 10, 2024
1 parent d76e7fe commit 02a8945
Show file tree
Hide file tree
Showing 40 changed files with 501 additions and 135 deletions.
5 changes: 2 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"extends": [
"wesbos/typescript"
],
"extends": ["wesbos/typescript"],
"env": {
"jest": true
},
"root": true,
"plugins": ["jest"],
"rules": {
"no-console": "off",
Expand Down
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

# Run tests
yarn test

# Run lint:fix
yarn lint:staged

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"rollup": "^2.73.0",
"rollup-plugin-dts": "^4.2.1",
"shelljs": "0.8.5",
"source-map-loader": "^5.0.0",
"tsconfig-paths": "^4.0.0",
"typescript": "5.1.6"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,112 +37,116 @@ const testCase: MnemonicAddressTestCase = {
name: 'Mnemonic Address Test',
description: 'Test Mnemonic Address',
data: [
// {
// id: 'btcGetAddress',
// method: 'btcGetAddress',
// },
// {
// id: 'btcGetAddress-Neurai',
// method: 'btcGetAddress',
// params: {
// path: `m/44'/1900'/${INDEX_MARK}'/${CHANGE_MARK}/${ADDRESS_INDEX_MARK}`,
// coin: 'neurai',
// },
// },
// {
// id: 'evmGetAddress',
// method: 'evmGetAddress',
// },
// {
// id: 'alephiumGetAddress',
// method: 'alephiumGetAddress',
// },
// {
// id: 'algoGetAddress',
// method: 'algoGetAddress',
// },
// {
// id: 'dnxGetAddress',
// method: 'dnxGetAddress',
// },
// {
// id: 'tonGetAddress',
// method: 'tonGetAddress',
// },
// {
// id: 'nervosGetAddress',
// method: 'nervosGetAddress',
// },
// {
// id: 'nexaGetAddress',
// method: 'nexaGetAddress',
// },
// {
// id: 'polkadotGetAddress-polkadot',
// method: 'polkadotGetAddress',
// },
// {
// id: 'polkadotGetAddress-kusama',
// method: 'polkadotGetAddress',
// params: {
// network: 'kusama',
// prefix: '2',
// },
// },
// {
// id: 'polkadotGetAddress-astar',
// method: 'polkadotGetAddress',
// params: {
// network: 'astar',
// prefix: '5',
// },
// },
// {
// id: 'polkadotGetAddress-westend',
// method: 'polkadotGetAddress',
// params: {
// network: 'westend',
// prefix: '42',
// },
// },
// {
// id: 'polkadotGetAddress-manta',
// method: 'polkadotGetAddress',
// params: {
// network: 'manta',
// prefix: '77',
// },
// },
// {
// id: 'polkadotGetAddress-joystream',
// method: 'polkadotGetAddress',
// params: {
// network: 'joystream',
// prefix: '126',
// },
// },
// {
// id: 'scdoGetAddress',
// method: 'scdoGetAddress',
// },
// {
// id: 'suiGetAddress',
// method: 'suiGetAddress',
// },
// {
// id: 'xrpGetAddress',
// method: 'xrpGetAddress',
// },
// {
// id: 'cosmosGetAddress',
// method: 'cosmosGetAddress',
// },
// {
// id: 'cosmosGetAddress-cosmos',
// method: 'cosmosGetAddress',
// params: {
// hrp: 'osmosis',
// },
// },
{
id: 'btcGetAddress',
method: 'btcGetAddress',
},
{
id: 'btcGetAddress-Neurai',
method: 'btcGetAddress',
params: {
path: `m/44'/1900'/${INDEX_MARK}'/${CHANGE_MARK}/${ADDRESS_INDEX_MARK}`,
coin: 'neurai',
},
},
{
id: 'evmGetAddress',
method: 'evmGetAddress',
},
{
id: 'alephiumGetAddress',
method: 'alephiumGetAddress',
},
{
id: 'algoGetAddress',
method: 'algoGetAddress',
},
{
id: 'dnxGetAddress',
method: 'dnxGetAddress',
},
{
id: 'tonGetAddress',
method: 'tonGetAddress',
},
{
id: 'nervosGetAddress',
method: 'nervosGetAddress',
},
{
id: 'nexaGetAddress',
method: 'nexaGetAddress',
},
{
id: 'polkadotGetAddress-polkadot',
method: 'polkadotGetAddress',
},
{
id: 'polkadotGetAddress-kusama',
method: 'polkadotGetAddress',
params: {
network: 'kusama',
prefix: '2',
},
},
{
id: 'polkadotGetAddress-astar',
method: 'polkadotGetAddress',
params: {
network: 'astar',
prefix: '5',
},
},
{
id: 'polkadotGetAddress-westend',
method: 'polkadotGetAddress',
params: {
network: 'westend',
prefix: '42',
},
},
{
id: 'polkadotGetAddress-manta',
method: 'polkadotGetAddress',
params: {
network: 'manta',
prefix: '77',
},
},
{
id: 'polkadotGetAddress-joystream',
method: 'polkadotGetAddress',
params: {
network: 'joystream',
prefix: '126',
},
},
{
id: 'scdoGetAddress',
method: 'scdoGetAddress',
},
{
id: 'suiGetAddress',
method: 'suiGetAddress',
},
{
id: 'xrpGetAddress',
method: 'xrpGetAddress',
},
{
id: 'cosmosGetAddress',
method: 'cosmosGetAddress',
},
{
id: 'cosmosGetAddress-cosmos',
method: 'cosmosGetAddress',
params: {
hrp: 'osmosis',
},
id: 'benfenGetaddress',
method: 'benfenGetaddress',
},
],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,8 @@ export const baseParams = {
path: `m/44'/195'/0'/0/${INDEX_MARK}`,
showOnOneKey: false,
},
benfenGetAddress: {
path: `m/44'/728'/${INDEX_MARK}'/0'/0'`,
showOnOneKey: false,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -562,5 +562,15 @@ export default {
'2147483647': 'TBnXbdxn35DuECbDdr2uppdTYDHJLSGA3h',
},
},
{
method: 'benfenGetAddress',
expectedAddress: {
'0': 'BFCdd98e1e3b1d9e019c82374bc82bc6b5d653d0bcbb1eb1bfccd8d25ddd6f83a5db214',
'1': 'BFC92f4902024981228033ed15b26cdc6930fcf319c14ad0e95edd25bfde0d172d70569',
'25': 'BFC40c1e4c622c3356845bb9f2eee09aefb5261ebfc1e16fa7590cb1c1057b6582bcb41',
'2147483646': 'BFCab460b81e58239d806fb671bc7700e7142b61c6500fccae190e8dc8174587dac197f',
'2147483647': 'BFC5ff2b3a34047f48caad8962a5a1baf237953db19e4b6c6867fe6994c078d8443e735',
},
},
],
} as AddressTestCaseData;
Original file line number Diff line number Diff line change
Expand Up @@ -561,5 +561,15 @@ export default {
'2147483647': 'TTpd2BUBaCuMqHtBhTCJe9dgXVnHBtbqXf',
},
},
{
method: 'benfenGetAddress',
expectedAddress: {
'0': 'BFCf0544bfaea4439a347834b19f513ba833083715d1904e4ddd37f7af8b1736cd50a0a',
'1': 'BFCe6d2d32fc97c3bede6215d069e6fd33fe11c1dbc7894727eff9a18516480dfbddcf2',
'25': 'BFCa9e0144e421bea592796f99e34e3edb555bdc5f3848870cc4f05cc0fca8768b1f1ac',
'2147483646': 'BFC87c31999cb11b361372198e60e5d39509767d48c79db65efacb805b83822848cf21d',
'2147483647': 'BFCbfccaaa7c3e488af03164d2d7d1a20cc2ee7a008505d36bd60b74ad70c4588569018',
},
},
],
} as AddressTestCaseData;
Original file line number Diff line number Diff line change
Expand Up @@ -561,5 +561,15 @@ export default {
'2147483647': 'TUKjDFGmLHw6NLbYuy4bpt2d6MBpKYtiYR',
},
},
{
method: 'benfenGetAddress',
expectedAddress: {
'0': 'BFC1c5404fc4c215d1f9d0630c61691b588bbd88fd4a2bcdc2fd74689720bb6cfb84820',
'1': 'BFCff2d2498ce365a4ba6b5e90edf54bb174798540493c15af1910375d958f1ddf8f3f4',
'25': 'BFC7774cf91db3f17c19ccb8783654191c2519a7041057ca5c5aaa192c715a3018dbec3',
'2147483646': 'BFCf0960edd2ef00bd36e6b4190d1cd8e98ad4a37a90fe1ec7ef8964b223cda3a6d50fd',
'2147483647': 'BFC28834bfc0be1b5eed1583b814fb4a698e56850ce3a603eafbd91c57542b6f17ec0f6',
},
},
],
} as AddressTestCaseData;
Original file line number Diff line number Diff line change
Expand Up @@ -563,5 +563,15 @@ export default {
'2147483647': 'TLJQqC8iAMVXsCDZxqSraTTFz7KU9CvfTx',
},
},
{
method: 'benfenGetAddress',
expectedAddress: {
'0': 'BFC5996d4c6a609a4046a55de8cf69adc17b3d8b34eea8fe908a684df69f8d238c4c57f',
'1': 'BFCfd971b4be078ba5a8fbdfedbd9683dbc637ce70f90b29c05510b90cc12ba71174654',
'21234567': 'BFC0751e3c028b24b6f0468ec1d4a6ca8faac3dfe902990eab63b2554bfa4a21efe06e6',
'2147483646': 'BFC451eb6959283fb3e7e1815e3e82d12c54029f8894129c15b9643fc3ff17d63144e58',
'2147483647': 'BFC6552ce65776890a22cd85d878a18dc3bfbcd0475433d63fe4f6e48ab3d62144dd16a',
},
},
],
} as AddressTestCaseData;
Original file line number Diff line number Diff line change
Expand Up @@ -563,5 +563,15 @@ export default {
'2147483647': 'TS8C5VCCCR83yqRvrLx2sj23k9EHsnbnC6',
},
},
{
method: 'benfenGetAddress',
expectedAddress: {
'0': 'BFCc3f6d4edd2c00125fb4aeb58c54d1b06626b685bf1be2a16a600e29713a2f67ea7e8',
'1': 'BFCc1f9138bdc1d03cc47ab9cc909c6ec704b09444ee7610dedd0ed0dd7a39f4869596b',
'21234567': 'BFCa16113164db28e788422fb265dc08ae0a30b647602714f59da188c024a392d396fe6',
'2147483646': 'BFC8ff609bf6e3b87965f4d2e8dd3f57d19d4c65ad71133c4e7a8348bade49c0f695831',
'2147483647': 'BFC5b8bdd12050906421fde23d116e702f0dbd6362c92f4b0e77a3b227fba2ac2475439',
},
},
],
} as AddressTestCaseData;
Original file line number Diff line number Diff line change
Expand Up @@ -563,5 +563,15 @@ export default {
'2147483647': 'TZGDfP18VzGXFseZzF4LAgKrEXXBvhmbXb',
},
},
{
method: 'benfenGetAddress',
expectedAddress: {
'0': 'BFC9a7a4db1fa7347ad924fdce215badaef6f0d03717a3c0dc68e85a006fb137aea325d',
'1': 'BFC97c73d847bc5d544988e5f5667d86d42660111f1ade5606b2453d19f57fbda1142b7',
'21234567': 'BFC5fad91679c71ef7e4514164bef941bfc042034b479c980cf480eb71f3edef66c5d36',
'2147483646': 'BFC1208c96e3a449aa4c2d704152d08df20b75d6e1c27750f4d9dc69dc1d7298b18ffbf',
'2147483647': 'BFCa893f9639eb206c4631e2edbcb23e24a1d3cf0ff5f9391c821c59e99129262a79052',
},
},
],
} as AddressTestCaseData;
Original file line number Diff line number Diff line change
Expand Up @@ -561,5 +561,15 @@ export default {
'2147483647': 'TPu6YTHSMkUtLvh1Rs6k47NtTx1c1JyLhY',
},
},
{
method: 'benfenGetAddress',
expectedAddress: {
'0': 'BFC54b56e9154ddfef6b5c24cd3dc6c27d47e4ca0009aff7539de26e9a29b39082bdf53',
'1': 'BFCd7390848080ed9eb8abf26b8a7fc1642362747e44dbf0ec7ba21b8a6a81ab772baaf',
'35': 'BFCc5bb39f5af2d76c1a856fbab810f47fd8099db3c038e0ab8cf8e27bb1a4212bce39d',
'2147483646': 'BFCa49bf90d5deaf2376e80540029f27107fae8435f982ac7c2e0e054df4b1321c70a2f',
'2147483647': 'BFC914ac4146474c24667b2ce5fc6d32e3b81903e0554244c84fcac804531c63cb61d2b',
},
},
],
} as AddressTestCaseData;
Original file line number Diff line number Diff line change
Expand Up @@ -561,5 +561,15 @@ export default {
'2147483647': 'TEePSjxw7nRVSK1h7UomM3EemD2XDNtrWu',
},
},
{
method: 'benfenGetAddress',
expectedAddress: {
'0': 'BFCa32b60d9a0b34ef459fa7793ab9f5aed9612938685125e35a9108edaa407079f5705',
'1': 'BFC4e45a44f602b492fe9911d05a244005f552e453c3ae23662cec070c2d95d10a9cad0',
'35': 'BFC65b4573af540203ec787e89b83f9109967087ebef6fa0b7dcf09aa76db30e3d4d8cc',
'2147483646': 'BFC8de6066df665b2db260a04f9a1e62a8cdc13d1adb726da3f5367f02d1dde1c8e053c',
'2147483647': 'BFCe1c2bbeb28573fcbe001d1406395eda3b942d51bcc3f914b8272f120e58388b0dd50',
},
},
],
} as AddressTestCaseData;
Loading

0 comments on commit 02a8945

Please sign in to comment.