Closed bodily11 closed 1 year ago
I'm transferring $ghost token using ic-py.
If I pull candid from the canister and use the canister interface, I get an error: "IDL error: illegal type table"
--------------------------------------------------------------------------- Exception Traceback (most recent call last) /var/folders/yg/mzpfyl291vx30knxqlx43d2r0000gn/T/ipykernel_33617/294065910.py in <module> ----> 1 my_canister.transfer( 2 { 3 'amount':int(0.1e8), 4 'from':{'address':'485d6d59c0b58fea568b339dccd63106422c5404f684bcf6d55f4cbccd49ac6d'}, 5 'memo':[], /opt/anaconda3/lib/python3.9/site-packages/ic/canister.py in __call__(self, *args, **kwargs) 63 ) 64 else: ---> 65 res = self.agent.update_raw( 66 self.canister_id, 67 self.name, /opt/anaconda3/lib/python3.9/site-packages/ic/agent.py in update_raw(self, canister_id, method_name, arg, return_type, effective_canister_id, **kwargs) 114 status, result = self.poll(eid, req_id, **kwargs) 115 if status == 'rejected': --> 116 raise Exception('Rejected: ' + result.decode()) 117 elif status == 'replied': 118 return decode(result, return_type) Exception: Rejected: Canister fjbi2-fyaaa-aaaan-qanjq-cai trapped explicitly: IDL error: illegal type table
However, if I define the type table myself, it works just fine.
canister_id = 'fjbi2-fyaaa-aaaan-qanjq-cai' types = Types.Record({ 'amount':Types.Nat, 'from':Types.Variant({ 'address':Types.Text, 'principal':Types.Principal }), 'memo':Types.Vec(Types.Nat8), 'nonce':Types.Opt(Types.Nat), 'notify':Types.Bool, 'subaccount':Types.Opt(Types.Vec(Types.Nat8)), 'to':Types.Variant({ 'address':Types.Text, 'principal':Types.Principal }), 'token':Types.Text }) values = { 'amount':int(0.1e8), 'from':{'address':''}, 'memo':[], 'nonce':[], 'notify':False, 'subaccount':[], 'to':{'address':''}, 'token':'' } params = [{'type':types,'value':values}] params = encode(params) response = agent.update_raw(canister_id,'transfer',params)
So not sure what is wrong here. Maybe it has to do with the "blob" type that is returned in the candid? I can't figure out why it won't work for me to use the candid I get back from the canister when I run __get_candid_interface_tmp_hack
__get_candid_interface_tmp_hack
Would love for you to take a look. Thanks!
I think it should be fixed in #80
I'm transferring $ghost token using ic-py.
If I pull candid from the canister and use the canister interface, I get an error: "IDL error: illegal type table"
However, if I define the type table myself, it works just fine.
So not sure what is wrong here. Maybe it has to do with the "blob" type that is returned in the candid? I can't figure out why it won't work for me to use the candid I get back from the canister when I run
__get_candid_interface_tmp_hack
Would love for you to take a look. Thanks!