-
Notifications
You must be signed in to change notification settings - Fork 11
/
test_symbol.py
executable file
·120 lines (94 loc) · 13.9 KB
/
test_symbol.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/usr/bin/env python
# *******************************************************************************
# * Symbol Wallet
# * (c) 2020 Ledger
# * (c) 2020 FDS
# *
# * Licensed under the Apache License, Version 2.0 (the "License");
# * you may not use this file except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# ********************************************************************************
from ledgerblue.comm import getDongle
from ledgerblue.commException import CommException
bipp32_path = (
"8000002C"
+ "80000001"
+ "80000000"
+ "80000000"
+ "80000000")
test_net_network_type = "98"
dongle = getDongle(True)
# Get public key
publicKey = dongle.exchange(bytes(bytearray.fromhex("E00201801605" + bipp32_path + test_net_network_type)))
publicKeyLen = int(publicKey[:1].hex(), 16)
print("publicKey respond [" + str(publicKeyLen) + "] " + publicKey[1:publicKeyLen+1].hex().upper())
# Note: P1_FIRST: 0x80, P1_MORE: 0x81; P1_LAST: 0x00
# transfer tx
transferTx = "E004008090058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC11550198544180841E0000000000F6A98B390600000098F2A5E8E063AD1A9085EF5B5167E2F1A5645C48FA2C024917000100000000003CE19A057E831F0940A5AE0200000000005468697320697320612074657374206D657373616765"
transferTxNotXYM = "E004008090058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC11550198544180841E0000000000F6A98B390600000098F2A5E8E063AD1A9085EF5B5167E2F1A5645C48FA2C024917000100000000001AB2C5CA0D99625E40A5AE0200000000005468697320697320612074657374206D657373616765"
createMosaic1 = "E0048081FF058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC11550198414180841E0000000000F9BD913906000000E5F37FE3F83F4F0A2F21E7CF25F75CF29A20D7929CBEB7EB552EDA846969281F9000000000000000460000000000000017140D44583C4BAD44C0A9DB963E315E1C425A7495271738B8F81938DDE75C400000000001984D4171243F1123B82C530A00000000000000EADF0D4407000000410000000000000017140D44583C4BAD44C0A9DB963E315E1C425A7495271738B8F81938DDE75C400000000001984D4271243F1123B82C5340420F0000000000010000000000"
createMosaic2 = "E0040180020000"
createNamespace = "E00400806C058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC115501984E4180841E0000000000128838C40600000000A3020000000000C880D8EBBA4A85A90011666F6F35373673676E6C78646E66626478"
createSubNamespace = "E00400806C058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC115501984E4180841E0000000000128838C40600000000A3020000000000C880D8EBBA4A85A90111666F6F35373673676E6C78646E66626478"
supplyChangeMosaic = "E00400805A058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC115501984D4280841E00000000001F2A933906000000CC403C7A113BDF7C40420F000000000001"
linkNamespaceToMosaic = "E00400805A058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC115501984E4380841E00000000009B5096390600000054C07E58ACD1A982CC403C7A113BDF7C00"
linkNamespaceToAddress = "E00400806A058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC115501984E4280841E0000000000A92B97390600000054C07E58ACD1A98298F2A5E8E063AD1A9085EF5B5167E2F1A5645C48FA2C024901"
accountAddressRestriction = "E004008069058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC1155019850410071020000000000D1A0495608000000018001000000000098F2A5E8E063AD1A9085EF5B5167E2F1A5645C48FA2C0249"
accountMosaicRestriction = "E004008059058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC11550198504280320200000000005FED4F6F080000000280010000000000BC482B8B8512A25B"
accountOperationRestriction = "E004008053058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC115501985043101B0200000000002B7DCB700800000004C00100000000004C41"
accountMultisig = "E0040080D9058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC11550198414280841E000000000077769F5906000000043D6F6E851CAE4ED2B975AEEF61DFDF00B85BBB2503AC23DD7586E3C0B079566800000000000000680000000000000017140D44583C4BAD44C0A9DB963E315E1C425A7495271738B8F81938DDE75C40000000000198554101010200000000009817259A942F6AE0EA32B01E368687405536E61125ECF701984B730EA3B726CC12A9FAF78B4D37354FF8722DBB950137"
hashLockAccountMultisig = "E004008081058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC11550198484180841E0000000000D58B993906000000A84582052890A9518096980000000000E0010000000000002B51EBCBC3E40EFE8AF68A0408F5A72474B1327A64E3E3B47D9B139230C7833B"
multisigTransaferTx = "E0040080E1058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC1155019841422076000000000000E73BE96B060000004941C270B56778E01629FC82EDDC622668F076CE1583AFCCA3F6DE7FE03615BB70000000000000006D000000000000007299D0308AA442C6EB7885B74BD7049A8B2236E6A3E0CC6FDD4036F543A3C6E40000000001985441985507CA7F3D1C9069E16E1A0FCE7C5AD4607421ED31E6730D000100000000003CE19A057E831F0980969800000000000054657374206D657373616765000000"
multisigCreateMosaic1 = "E0048081FF058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC115501984142A0830000000000007C0FED6B06000000705B456E99A2FA7DA3D4F02ABB1993774426B8095705C2116E6FB59E95A2587D900000000000000046000000000000007299D0308AA442C6EB7885B74BD7049A8B2236E6A3E0CC6FDD4036F543A3C6E40000000001984D41645AC697472FCA780000000000000000E65EF6F70300000041000000000000007299D0308AA442C6EB7885B74BD7049A8B2236E6A3E0CC6FDD4036F543A3C6E40000000001984D42645AC697472FCA780065CD1D00000000010000000000"
multisigCreateMosaic2 = "E0040180020000"
multisigCreateNamespace = "E0040080C1058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC115501984142A0680000000000006A87F06B06000000B96E1C08F8434BFDC4D1F292EB3F911B1A3C5B3EE102887A8ACDD75A79A4BB6250000000000000004A000000000000007299D0308AA442C6EB7885B74BD7049A8B2236E6A3E0CC6FDD4036F543A3C6E40000000001984E4100A30200000000004F870552748FEBB000086D756C7469736967000000000000"
hashLockMultisigCreateNamespace = "E004008081058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC115501984841A04D00000000000052C3F06B060000003CE19A057E831F098096980000000000E803000000000000E019A4A92002505B8B5029AE556958ADCDFBEDAC26C2F79DE1668C5BC588EDF7"
multisigCreateSubNamespace = "E004008071058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC115501984E41E0460000000000005632F36B060000001409CC7609AC4FD6952019898F84F5A401167375625F6E616D6573706163655F6D756C7469736967"
multisigTransaferCosignatureTx = "E0040080D9058000002C800000018000000080000000800000000EFE6E4A881D312984767CABBE53DAC00419E179932A5C784B51132FBE5F7C880198414200530700000000008949E54608000000A84E5976D0D9DC79D07A3FFCB7D9EBD34C46C39058C243DF963400D9FEAFFD5368000000000000006400000000000000A1855B7D18FC1EE2AB5BB01098ACA8C0B8B6B3FA8819309066795E064E79B625000000000198544198F2A5E8E063AD1A9085EF5B5167E2F1A5645C48FA2C024904000100000000003CE19A057E831F0980969800000000000053445600000000"
accountMetadataTx = "E0040080F1058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC1155019841414084040000000000CFEA4287070000005F221AD2C6D297E683692CE332B24157057E6FB43A832F18C13495EC49544E0880000000000000007F0000000000000017140D44583C4BAD44C0A9DB963E315E1C425A7495271738B8F81938DDE75C40000000000198444198F2A5E8E063AD1A9085EF5B5167E2F1A5645C48FA2C02497AEAFC0DA38583AB2B002B0074686973206973207468652076616C7565206669656C64206F66206163636F756E74206D6574616461746100"
mosaicMetadataTx = "E0040080F9058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC11550198414180A3040000000000320B4D8707000000FD62E4D107693B6B0A7D862F2BBE49695565764AE41AE0D0344C47AE82DCB00C8800000000000000830000000000000017140D44583C4BAD44C0A9DB963E315E1C425A7495271738B8F81938DDE75C40000000000198444298F2A5E8E063AD1A9085EF5B5167E2F1A5645C48FA2C02499FFAB5EF750B0CD096C5210420F5326E270027005468697320697320746865206D6F73616963206D657461646174612076616C7565206669656C640000000000"
namespaceMetadataTx = "E0040080F1058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC1155019841414084040000000000AFBB538707000000668FE1351AC31C35536EE3A368F2C2310DD3D7E67A8345050548AE8B6596015D80000000000000007A0000000000000017140D44583C4BAD44C0A9DB963E315E1C425A7495271738B8F81938DDE75C40000000000198444398F2A5E8E063AD1A9085EF5B5167E2F1A5645C48FA2C02496D9D7CA7FA8F829ED62A3CC68F5247851E001E004E616D657370616365206D657461646174612076616C7565206669656C64000000000000"
startDelegatedHarvestingTransaction1 = "E0048081FF058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC115501984141C0A8000000000000C237012C080000000C8666CEF61F61B78515149A1414455C77A0CCD7C9AD5F39DFE46761AB6556DF0801000000000000510000000000000017140D44583C4BAD44C0A9DB963E315E1C425A7495271738B8F81938DDE75C400000000001984C4100278C080D6B149902E1576723DA6362065D3A134BEE6383827353540492B9110100000000000000510000000000000017140D44583C4BAD44C0A9DB963E315E1C425A7495271738B8F81938DDE75C400000000001984342C1A714313258"
startDelegatedHarvestingTransaction2 = "E0040180F473D83894977C68C783A4EED7A3391EAFD704BF8500361EC321DB0100000000000000510000000000000017140D44583C4BAD44C0A9DB963E315E1C425A7495271738B8F81938DDE75C400000000001984C4281890592F960AAEBDA7612C8917FA9C267A845D78D74D4B3651AF093E67750010100000000000000"
persistentHarvestingDelegationTransferTx = "E0040080ED058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC115501985441A07404000000000090125640080000009863E0511468632BA77C8C8597266AE1A0DA8C9420C4F6238400000000000000FE2A8061577301E28AEC26D42EFCE832BE498BB8CFCC7687BC5BC6B22A82F4BA415A7DF13E1DEA994EAD70125CA250DD6CD8AEA8BAE26AD9A8FC9CB45A996E59BD8894E3D618043887E2383A6BB161A18AB58F406D7DFF384CBD6A669FD152E5AD84B372425212CAAECCB712674AA6C737894BB14FADFE93A3E3AF73A34187D49740891C"
votingKeyLink = "E004008072058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC115501984341CBA9E70A000000005AA89F2B0A0000008706D44BB1387FC0145EFDAC85FF19B3A022B86C84D3F60C967F4F450C52634D64000000C800000000"
vrfKeyLink = "E00400806A058000002C800000018000000080000000800000003B5E1FA6445653C971A50687E75E6D09FB30481055E3990C84B25E9222DC115501984342CBA9E70A000000005AA89F2B0A0000008706D44BB1387FC0145EFDAC85FF19B3A022B86C84D3F60C967F4F450C52634D00"
transferTxRespode = dongle.exchange(bytes(bytearray.fromhex(transferTx)))
transferTxNotXYMRespode = dongle.exchange(bytes(bytearray.fromhex(transferTxNotXYM)))
## 2 transactions needed for mosaic creation and mosaic supply change transaction
# createMosaicRespode = dongle.exchange(bytes(bytearray.fromhex(createMosaic1)))
# createMosaicRespode2 = dongle.exchange(bytes(bytearray.fromhex(createMosaic2)))
# createNamespaceRespode = dongle.exchange(bytes(bytearray.fromhex(createNamespace)))
# createSubNamespaceRespode = dongle.exchange(bytes(bytearray.fromhex(createSubNamespace)))
# supplyChangeMosaicRespode = dongle.exchange(bytes(bytearray.fromhex(supplyChangeMosaic)))
# linkNamespaceToMosaicTxRespode = dongle.exchange(bytes(bytearray.fromhex(linkNamespaceToMosaic)))
# linkNamespaceToAdresssRespode = dongle.exchange(bytes(bytearray.fromhex(linkNamespaceToAddress)))
# accountAddressRestrictionRespode = dongle.exchange(bytes(bytearray.fromhex(accountAddressRestriction)))
# accountMosaicRestrictionRespode = dongle.exchange(bytes(bytearray.fromhex(accountMosaicRestriction)))
# accountOperationRestrictionRespode = dongle.exchange(bytes(bytearray.fromhex(accountOperationRestriction)))
# accountMultisig = dongle.exchange(bytes(bytearray.fromhex(accountMultisig)))
# hashLockAccountMultisig = dongle.exchange(bytes(bytearray.fromhex(hashLockAccountMultisig)))
# multisigTransaferTxRespode = dongle.exchange(bytes(bytearray.fromhex(multisigTransaferTx)))
# multisigCreateMosaic1Respode = dongle.exchange(bytes(bytearray.fromhex(multisigCreateMosaic1)))
# multisigCreateMosaic2Respode = dongle.exchange(bytes(bytearray.fromhex(multisigCreateMosaic2)))
# multisigCreateNamespaceRespode = dongle.exchange(bytes(bytearray.fromhex(multisigCreateNamespace)))
# hashLockMultisigCreateNamespaceRespode = dongle.exchange(bytes(bytearray.fromhex(hashLockMultisigCreateNamespace)))
# multisigCreateSubNamespaceRespode = dongle.exchange(bytes(bytearray.fromhex(multisigCreateSubNamespace)))
# multisigTransaferCosignatureTxRespode = dongle.exchange(bytes(bytearray.fromhex(multisigTransaferCosignatureTx)))
# accountMetadataRespode = dongle.exchange(bytes(bytearray.fromhex(accountMetadataTx)))
# mosaicMetadataRespode = dongle.exchange(bytes(bytearray.fromhex(mosaicMetadataTx)))
# namespaceMetadataRespode = dongle.exchange(bytes(bytearray.fromhex(namespaceMetadataTx)))
## 2 transactions needed for start delegate harvesting transaction
# startDelegatedHarvestingRespode1 = dongle.exchange(bytes(bytearray.fromhex(startDelegatedHarvestingTransaction1)))
# startDelegatedHarvestingRespode2 = dongle.exchange(bytes(bytearray.fromhex(startDelegatedHarvestingTransaction2)))
# persistentHarvestingDelegationTransferResponde = dongle.exchange(bytes(bytearray.fromhex(persistentHarvestingDelegationTransferTx)))
# vrfKeyLinkResponde = dongle.exchange(bytes(bytearray.fromhex(vrfKeyLink)))
# votingKeyLinkResponde = dongle.exchange(bytes(bytearray.fromhex(votingKeyLink)))