Ext outputs to list
This commit is contained in:
parent
33f173f0c9
commit
5f126d8d59
@ -6,5 +6,9 @@
|
||||
"token_index": {
|
||||
"reference": null,
|
||||
"key_account": null
|
||||
},
|
||||
"address_declarator": {
|
||||
"reference": null,
|
||||
"key_account": null
|
||||
}
|
||||
}
|
||||
|
@ -24,9 +24,7 @@ class CICEth:
|
||||
self.nonce_oracle = nonce_oracle
|
||||
self.fee_oracle = fee_oracle
|
||||
self.token_address = None
|
||||
self.outputs = {}
|
||||
for k in resources.keys():
|
||||
self.outputs[k] = None
|
||||
self.outputs = []
|
||||
self.tx_format = TxFormat.RAW_ARGS
|
||||
if self.rpc != None:
|
||||
self.tx_format = TxFormat.JSONRPC
|
||||
@ -44,15 +42,16 @@ class CICEth:
|
||||
contract_address = self.resources['token_index']['reference']
|
||||
signer_address = self.resources['token_index']['key_address']
|
||||
o = c.register(contract_address, signer_address, self.token_address, tx_format=self.tx_format)
|
||||
r = None
|
||||
if self.rpc != None:
|
||||
r = self.rpc.do(o[1])
|
||||
self.outputs['token_index'] = r
|
||||
elif self.signer != None:
|
||||
self.outputs['token_index'] = o[1]
|
||||
r = o[1]
|
||||
else:
|
||||
self.outputs['token_index'] = o
|
||||
r = o
|
||||
|
||||
return self.outputs['token_index']
|
||||
self.outputs.append(r)
|
||||
return r
|
||||
|
||||
|
||||
def process(self):
|
||||
|
@ -39,5 +39,3 @@ class TestCICEthBase(EthTesterCase):
|
||||
self.proofs = []
|
||||
for i in range(3):
|
||||
self.proofs.append(random.randbytes(32).hex())
|
||||
|
||||
|
||||
|
@ -17,8 +17,12 @@ class TestCICEthOffline(TestCICEthBase):
|
||||
def test_offline_token_index(self):
|
||||
self.adapter.token_address = self.token_address
|
||||
v = self.adapter.process_token_index()
|
||||
self.assertEqual(self.adapter.outputs['token_index'][:8], '4420e486')
|
||||
self.assertEqual(self.adapter.outputs[0], v)
|
||||
self.assertEqual(self.adapter.outputs[0][:8], '4420e486')
|
||||
|
||||
|
||||
def test_offline_address_declarator(self):
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
@ -38,7 +38,7 @@ class TestCICEthRPC(TestCICEthBase):
|
||||
adapter_norpc.token_address = self.token_address
|
||||
vv = adapter_norpc.process_token_index()
|
||||
|
||||
tx_raw = bytes.fromhex(strip_0x(adapter_norpc.outputs['token_index']))
|
||||
tx_raw = bytes.fromhex(strip_0x(vv))
|
||||
tx = unpack(tx_raw, self.chain_spec)
|
||||
self.assertEqual(strip_0x(tx['hash']), strip_0x(v))
|
||||
|
||||
|
@ -29,7 +29,7 @@ class TestCICEthSign(TestCICEthBase):
|
||||
def test_sign_token_index(self):
|
||||
self.adapter.token_address = self.token_address
|
||||
v = self.adapter.process_token_index()
|
||||
tx_raw = bytes.fromhex(strip_0x(self.adapter.outputs['token_index']))
|
||||
tx_raw = bytes.fromhex(strip_0x(self.adapter.outputs[0]))
|
||||
tx = unpack(tx_raw, self.chain_spec)
|
||||
self.assertEqual(strip_0x(tx['data'])[:8], '4420e486')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user