Closed jim3333 closed 2 years ago
from ic.candid import decode, Types, encode
if __name__ == '__main__':
a = encode([{"type": Types.Null, "value": None}])
Prin = Types.Null
param = None
res = encode([{'type': Prin, 'value': param}])
print('current :', res.hex())
print('decode Null:', decode(res, Prin))
test code
test code.
It is best to use unittest to automatically test with github actions after committing.
from ic.candid import decode, Types, encode if __name__ == '__main__': a = encode([{"type": Types.Null, "value": None}]) Prin = Types.Null param = None res = encode([{'type': Prin, 'value': param}]) print('current :', res.hex()) print('decode Null:', decode(res, Prin))
Great idea! we'll look into it
@jim3333 @jfb
Hi, guys. Thanks for your code. Today, I am going to write an example to demostrate how to using candid Types and fix some potencial bug.
BTW, 'Prin' in code represents principal, not a standard use for each Type.
fix Null decode & encode failed.