cosmos / cosmjs

The Swiss Army knife to power JavaScript based client solutions ranging from Web apps/explorers over browser extensions to server-side clients like faucets/scrapers.
https://cosmos.github.io/cosmjs/
Apache License 2.0
645 stars 330 forks source link

Can't change Authz expiration past block time #1483

Open triccs opened 11 months ago

triccs commented 11 months ago

image

No matter what date I input, I can't get the expiration past the blocktime. If I leave it empty the time is 0'd so it's reading something.

image

leonlolly commented 9 months ago

It seems something broke in 0.9.0. I can't pin down the exact line that breaks it but for me 0.8.0 works image

webmaster128 commented 9 months ago

expiration is of type Timestamp:

export interface Timestamp {
  /**
   * Represents seconds of UTC time since Unix epoch
   * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
   * 9999-12-31T23:59:59Z inclusive.
   */
  seconds: bigint;
  /**
   * Non-negative fractions of a second at nanosecond resolution. Negative
   * second values with fractions must still have non-negative nanos values
   * that count forward in time. Must be from 0 to 999,999,999
   * inclusive.
   */
  nanos: number;
}

To create a Timestamp, use Timestamp.fromPartial. The change that happened between 0.8.0 and 0.9.0 was that the seconds field changed from Long to bigint.

Hope this helps

leonlolly commented 9 months ago

thx for naming the change, but even using from partial or creating the object manual. The encoding dos not work correctly, or at least that is my guess. So it does not work on 9.0 for me.

If you could test it out and publish a working code snipped in version 9.0 that would be super helpful. ( full MsgGrand not just {seconds: 5n, nano: 0} )