Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types Issue #64

Open
omniwired opened this issue Mar 5, 2024 · 2 comments
Open

Types Issue #64

omniwired opened this issue Mar 5, 2024 · 2 comments

Comments

@omniwired
Copy link

There is an issue here:

https://github.com/likecoin/iscn-js/blame/19f0dd3ec9f6a4b12020e7bc70b3e6297f035275/src/messages/authz.ts#L175

The type set in formatMsgGrantGenericAuthorization is number.

Because of this mismatch this line will get:

TypeError: expiration.toNumber is not a function

@williamchong
Copy link
Member

Would you mind providing a sample where I can see this error clearly? Relationship between type set in formatMsgGrantGenericAuthorization and amino converters seems not straight forward to me

@omniwired
Copy link
Author

Example:

const timeInFiveYears =  new Date().getTime() + 1000 * 60 * 60 * 24 * 365 * 5,

 const msg = formatMsgGrantGenericAuthorization(
          address,
          botAddress,
          "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward",
          timeInFiveYears
);

The function types are:
formatMsgGrantGenericAuthorization(senderAddress: string, granteeAddress: string, messageTypeUrl: string, expirationDateInMs: number): EncodeObject;

So when the function calls expiration.toNumber here
https://github.com/likecoin/iscn-js/blob/master/src/messages/authz.ts#L175

It fails because expirationDateInMs is of type number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants