rocklabs-io / ic-py

Python Agent Library for the DFINITY Internet Computer
MIT License
127 stars 26 forks source link

candid can't decode `opt principal` #16

Closed jim3333 closed 2 years ago

jim3333 commented 2 years ago

test data

4449444c016e68010001011d779590d2cd339802981dfd935d9a3dbb085cafe6ad19b87229a016d602

use didc

>didc.exe decode 4449444c016e68010001011d779590d2cd339802981dfd935d9a3dbb085cafe6ad19b87229a016d602
(
  opt principal "expmt-gtxsw-inftj-ttabj-qhp5s-nozup-n3bbo-k7zvn-dg4he-knac3-lae",
)

use ic-py

raise "Cannot decode principal"
TypeError: exceptions must derive from BaseException

version: 0.0.8

Myse1f commented 2 years ago

Can you provide your test code here?

jim3333 commented 2 years ago

@Myse1f

from ic.candid import decode

if __name__ == '__main__':
    r = decode(bytes.fromhex("4449444c016e68010001011d779590d2cd339802981dfd935d9a3dbb085cafe6ad19b87229a016d602"))
    print(r)
mircial commented 2 years ago

@jim3333

Fixed! You can try again...

jim3333 commented 2 years ago

@mircial

Thank you very much, it has been fixed