Skip to content

Commit

Permalink
Update try script
Browse files Browse the repository at this point in the history
  • Loading branch information
neithanmo committed Dec 27, 2024
1 parent c065697 commit ce2bc8d
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions tests_zemu/try.mjs
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
import TransportNodeHid from '@ledgerhq/hw-transport-node-hid'
import ledger_logs from '@ledgerhq/logs'
import AvalancheApp from '@zondax/ledger-icp'
import InternetComputerApp from '@zondax/ledger-icp'

const APP_DERIVATION = "m/44'/223'/0'/0/0"

async function get_icp_address(app) {
// const resp = await app.getAddressAndPubKey(APP_DERIVATION, true)
const resp = await app.getAddressAndPubKey(APP_DERIVATION)

console.log(resp)
}

async function bls_verify(app) {
// const resp = await app.getAddressAndPubKey(APP_DERIVATION, true)
let consent_request =
'd9d9f7a167636f6e74656e74a763617267586b4449444c076d7b6c01d880c6d007716c02cbaeb581017ab183e7f1077a6b028beabfc2067f8ef1c1ee0d026e036c02efcee7800401c4fbf2db05046c03d6fca70200e1edeb4a7184f7fee80a0501060c4449444c00017104746f626905677265657402656e01011e0003006b63616e69737465725f69644a00000000006000fd01016e696e67726573735f657870697279c24817c49d49c5a920806b6d6574686f645f6e616d6578246963726332315f63616e69737465725f63616c6c5f636f6e73656e745f6d657373616765656e6f6e636550a3788c1805553fb69b20f08e87e23b136c726571756573745f747970656463616c6c6673656e6465724104'
'd9d9f7a167636f6e74656e74a76361726758d84449444c086d7b6e766c02aeaeb1cc0501d880c6d007716c02cbaeb581017ab183e7f1077a6b028beabfc2067f8ef1c1ee0d036e046c02efcee7800402c4fbf2db05056c03d6fca70200e1edeb4a7184f7fee80a060107684449444c066e7d6d7b6e016e786c02b3b0dac30368ad86ca8305026c08c6fcb60200ba89e5c20402a2de94eb060282f3f3910c03d8a38ca80d7d919c9cbf0d00dea7f7da0d03cb96dcb40e04010501904e0000008094ebdc030000010a00000000000000070101000d69637263325f617070726f76650002656e0101230003006b63616e69737465725f69644a000000000000000201016e696e67726573735f6578706972791b18150c3b3dc330006b6d6574686f645f6e616d6578246963726332315f63616e69737465725f63616c6c5f636f6e73656e745f6d657373616765656e6f6e636550b85af2a8a93d368101dfb945a4bfaa056c726571756573745f747970656463616c6c6673656e6465724104'
let canister_call =
'd9d9f7a167636f6e74656e74a6636172674c4449444c00017104746f62696b63616e69737465725f69644a00000000006000fd01016e696e67726573735f657870697279c24817c49db0b64dfb806b6d6574686f645f6e616d656567726565746c726571756573745f747970656571756572796673656e6465724104'
'd9d9f7a167636f6e74656e74a76361726758684449444c066e7d6d7b6e016e786c02b3b0dac30368ad86ca8305026c08c6fcb60200ba89e5c20402a2de94eb060282f3f3910c03d8a38ca80d7d919c9cbf0d00dea7f7da0d03cb96dcb40e04010501904e0000008094ebdc030000010a00000000000000070101006b63616e69737465725f69644a000000000000000201016e696e67726573735f6578706972791b18150c3b3dc330006b6d6574686f645f6e616d656d69637263325f617070726f7665656e6f6e6365506dce3e5808515edca41a94e4c2a480d06c726571756573745f747970656463616c6c6673656e646572581d052c5f6f270fc4a3a882a8075732cba90ad4bd25d30bd2cf7b0bfe7c02'
let certificate =
'd9d9f7a3647472656583018301820458200bbcc71092da3ce262b8154d398b9a6114bee87f1c0b72e16912757aa023626a8301820458200628a8e00432e8657ad99c4d1bf167dd54ace9199609bfc5d57d89f48d97565f83024e726571756573745f737461747573830258204ea057c46292fedb573d35319dd1ccab3fb5d6a2b106b785d1f7757cfa5a254283018302457265706c79820358b44449444c0b6b02bc8a0101c5fed201086c02efcee7800402e29fdcc806036c01d880c6d007716b02d9e5b0980404fcdfd79a0f716c01c4d6b4ea0b056d066c01ffbb87a807076d716b04d1c4987c09a3f2efe6020a9a8597e6030ae3c581900f0a6c02fc91f4f80571c498b1b50d7d6c01fc91f4f8057101000002656e0001021e50726f647563652074686520666f6c6c6f77696e67206772656574696e6714746578743a202248656c6c6f2c20746f626921228302467374617475738203477265706c696564830182045820891af3e8982f1ac3d295c29b9fdfedc52301c03fbd4979676c01059184060b0583024474696d65820349cbf7dd8ca1a2a7e217697369676e6174757265583088078c6fe75f32594bf4e322b14d47e5c849cf24a370e3bab0cab5daffb7ab6a2c49de18b7f2d631893217d0c716cd656a64656c65676174696f6ea2697375626e65745f6964581d2c55b347ecf2686c83781d6c59d1b43e7b4cba8deb6c1b376107f2cd026b6365727469666963617465590294d9d9f7a264747265658301820458200b0d62dc7b9d7de735bb9a6393b59c9f32ff7c4d2aacdfc9e6ffc70e341fb6f783018301820458204468514ca4af8224c055c386e3f7b0bfe018c2d9cfd5837e427b43e1ab0934f98302467375626e65748301830183018301820458208739fbbedd3dedaa8fef41870367c0905bde376b63dd37e2b176fb08b582052f830182045820f8c3eae0377ee00859223bf1c6202f5885c4dcdc8fd13b1d48c3c838688919bc83018302581d2c55b347ecf2686c83781d6c59d1b43e7b4cba8deb6c1b376107f2cd02830183024f63616e69737465725f72616e67657382035832d9d9f782824a000000000060000001014a00000000006000ae0101824a00000000006000b001014a00000000006fffff010183024a7075626c69635f6b657982035885308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c0503020103610090075120778eb21a530a02bcc763e7f4a192933506966af7b54c10a4d2b24de6a86b200e3440bae6267bf4c488d9a11d0472c38c1b6221198f98e4e6882ba38a5a4e3aa5afce899b7f825ed95adfa12629688073556f2747527213e8d73e40ce8204582036f3cd257d90fb38e42597f193a5e031dbd585b6292793bb04db4794803ce06e82045820028fc5e5f70868254e7215e7fc630dbd29eefc3619af17ce231909e1faf97e9582045820696179fceb777eaed283265dd690241999eb3ede594091748b24456160edc1278204582081398069f9684da260cfb002eac42211d0dbf22c62d49aee61617d62650e793183024474696d65820349a5948992aaa195e217697369676e6174757265583094e5f544a7681b0c2c3c5dbf97950c96fd837f2d19342f1050d94d3068371b0a95a5ee20c36c4395c2dbb4204f2b4742'
'd9d9f7a264747265658301830182045820b4b214b4daf257d7313e5f029cc55c514806b73578d2c6a8b34c456062b2fcca83018204582012d3bf7eb1c51eee0b021c8eb2f545ac6b6319f6d02610f6fd8d4a4a285d8f2183024e726571756573745f73746174757383018301820458201e8ff50918e5246325a1a24856a30b2db91b8d72dbd7fd1bb7d6345dbb33d5c1830182045820a4b38b70584077412bdbf594799f6973d3cd311c8f0c5e273f6ccbcb038b4e4f8301830182045820137c7e4f8801755bd96a3542a5948a2ad1d141f44e9b60f38d49f7718bf1e03683018301820458203c8bf754339883c7525829c0e21c5234cce654869079802b8175d3bbf6e264e8830182045820abec4914cb21aea85a381d607711d638900b28d316bfafd05d18792e28437d4f8301820458205c2a68619fcfedd660383e0330525f398771b5de56e8361eb29f5d08c74e66628301830182045820b4af5a98eafab04c4f1c86b7cc2125be7be04dc92cda06eee68a2ecbd2b474cd830183025820d43ea96d58d742990b277b60875a485361efd0f80868ef8025f25239065fa8f683018302457265706c7982035903304449444c0c6b02bc8a0101c5fed201096c02efcee7800402e29fdcc806046c02aeaeb1cc0503d880c6d007716e766b02d9e5b0980405fcdfd79a0f716c01c4d6b4ea0b066d076c01ffbb87a807086d716b04d1c4987c0aa3f2efe6020b9a8597e6030be3c581900f0b6c02fc91f4f80571c498b1b50d7d6c01fc91f4f805710100000002656e0007031e2320417574686f72697a6520616e6f74686572206164647265737320746f2077697468647261772066726f6d20796f7572206163636f756e74202a2a5468651f666f6c6c6f77696e67206164647265737320697320616c6c6f77656420746f031d77697468647261772066726f6d20796f7572206163636f756e743a2a2a2272646d78362d6a616161612d61616161612d61616164712d636169202a2a596f75720d7375626163636f756e743a2a2a032330303030303030303030303030303030303030303030303030303030303030303030301d3030303030303030303030303030303030303030303030303030303030232a2a526571756573746564207769746864726177616c20616c6c6f77616e63653a2a2a032031302049435020e29aa02054686520616c6c6f77616e63652077696c6c2062652273657420746f2031302049435020696e646570656e64656e746c79206f6620616e791e70726576696f757320616c6c6f77616e63652e20556e74696c207468697303217472616e73616374696f6e20686173206265656e206578656375746564207468651e7370656e6465722063616e207374696c6c206578657263697365207468652370726576696f757320616c6c6f77616e63652028696620616e792920746f2069742773032166756c6c20616d6f756e742e202a2a45787069726174696f6e20646174653a2a2a204e6f2065787069726174696f6e2e202a2a417070726f76616c206665653a2a2a23302e3030303120494350202a2a5472616e73616374696f6e206665657320746f206265031a7061696420627920796f7572207375626163636f756e743a2a2a2330303030303030303030303030303030303030303030303030303030303030303030301d30303030303030303030303030303030303030303030303030303030308302467374617475738203477265706c696564820458201bec75e20d0c3f6021b3200774ddaf3dc8a110f205a09e82e0d7b9d24363998382045820d1c75859aefa34353f19e442a1ea39108ccdf1bb63dd92fa5972e402f9d9b1a682045820d9ded99e671ff3a6b57e4163682f3230f5c4c71feba54cac754463dc639a6fa182045820807cc02385aa89ff4100c9d8074746ad71ae0eea3bd0cfadda4695f2ba9b0f9e8204582075160808a4dafab7a6b818fd73475daf0888aaa80dc1634910bc3d15cc882503830182045820cfa7e97fa9ab19a491938689465bf33142082e4d95061b6e1ce4e865a6571cf383024474696d65820349cafdf2acc980c38a18697369676e61747572655830b40e48a11d3c82b199e694276f5e7128f5a82ff1ecff3cab388bdeaea8a97300ac02334967b27c47a3c3d7ed323482b3'

const resp = await app.signBls("m/44'/223'/0'/0/0", consent_request, canister_call, certificate)
const resp = await app.signBls(APP_DERIVATION, consent_request, canister_call, certificate)

console.log(resp)
}
Expand All @@ -30,7 +23,7 @@ async function main() {
ledger_logs.listen(log => {
console.log(`${log.type} ${log.message}`)
})
const app = new AvalancheApp.default(transport)
const app = new InternetComputerApp(transport)

console.time('bls_verify Duration')
const resp = await bls_verify(app)
Expand Down

0 comments on commit ce2bc8d

Please sign in to comment.