rocklabs-io / ic-py

Python Agent Library for the DFINITY Internet Computer
MIT License
125 stars 25 forks source link

ValueError: Missing type index for text #66

Closed letmejustputthishere closed 1 year ago

letmejustputthishere commented 2 years ago

I have the following did file

type Canister = 
  service {
    tokens: (AccountIdentifier__1) -> (Result_1) query;
 };
type CommonError = 
  variant {
   InvalidToken: TokenIdentifier;
   Other: text;
};
type AccountIdentifier__1 = text;
type TokenIndex = nat32;
type TokenIdentifier = text;
type Result_1 = 
 variant {
   err: CommonError;
   ok: vec TokenIndex;
 };
service : () -> Canister

I setup the canister like this

# create agent
iden = Identity()
client = Client()
agent = Agent(iden, client)

ext_did = open("ext.did").read()

ext = Canister(
    agent, canister['canisterId'], candid=ext_did)

But making a call to ext.tokens(account) fails with the error mentioned above. Is this a bug or am I doing something wrong?

Myse1f commented 2 years ago

There is a bug in candid parsing.

You can change did into

type CommonError = 
  variant {
   InvalidToken: TokenIdentifier;
   Other: text;
};
type AccountIdentifier__1 = text;
type TokenIndex = nat32;
type TokenIdentifier = text;
type Result_1 = 
 variant {
   err: CommonError;
   ok: vec TokenIndex;
 };
service : () ->{
    tokens: (AccountIdentifier__1) -> (Result_1) query;
};

I think this should work.

Myse1f commented 2 years ago

fix in #67

letmejustputthishere commented 1 year ago

are you expecting use to close issues that have been resolved ourselves? or are you waiting for some internal process before you close them? i see a couple of issues that have been resolved but they are still open