@hyperweb/telescope 2.0.3 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,11 +11,11 @@
11
11
  <a href="https://github.com/hyperweb-io/telescope/actions/workflows/run-tests.yaml">
12
12
  <img height="20" src="https://github.com/hyperweb-io/telescope/actions/workflows/run-tests.yaml/badge.svg" />
13
13
  </a>
14
- <a href="https://github.com/hyperweb-io/lib-count">
15
- <img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fhyperweb-io%2Flib-count%2Fmain%2Foutput%2Fbadges%2Fproducts%2Ftelescope%2Ftotal.json"/>
14
+ <a href="https://github.com/constructive-io/lib-count">
15
+ <img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fconstructive-io%2Flib-count%2Fmain%2Foutput%2Fbadges%2Fproducts%2Ftelescope%2Ftotal.json"/>
16
16
  </a>
17
- <a href="https://github.com/hyperweb-io/lib-count">
18
- <img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fhyperweb-io%2Flib-count%2Fmain%2Foutput%2Fbadges%2Fproducts%2Ftelescope%2Fmonthly.json"/>
17
+ <a href="https://github.com/constructive-io/lib-count">
18
+ <img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fconstructive-io%2Flib-count%2Fmain%2Foutput%2Fbadges%2Fproducts%2Ftelescope%2Fmonthly.json"/>
19
19
  </a>
20
20
  <br />
21
21
  <a href="https://github.com/hyperweb-io/telescope/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
@@ -1563,7 +1563,7 @@ A unified toolkit for building applications and smart contracts in the Interchai
1563
1563
 
1564
1564
  ## Credits
1565
1565
 
1566
- 🛠 Built by [Interweb](https://interweb.co) — if you like our tools, please checkout and contribute [https://interweb.co](https://interweb.co)
1566
+ 🛠 Built by the [Constructive](https://constructive.io) team makers of [Hyperweb](https://hyperweb.io)
1567
1567
 
1568
1568
 
1569
1569
  Thanks to these engineers, teams and projects for inspiring Telescope:
@@ -7,7 +7,7 @@ const getHelperForBigint = (options) => {
7
7
  `declare var self: any | undefined;
8
8
  declare var window: any | undefined;
9
9
  declare var global: any | undefined;
10
- var globalThis: any = (() => {
10
+ const _globalThis: any = (() => {
11
11
  if (typeof globalThis !== 'undefined') return globalThis;
12
12
  if (typeof self !== 'undefined') return self;
13
13
  if (typeof window !== 'undefined') return window;
@@ -16,8 +16,8 @@ var globalThis: any = (() => {
16
16
  })();
17
17
 
18
18
  const atob: (b64: string) => string =
19
- globalThis.atob ||
20
- ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));
19
+ _globalThis.atob ||
20
+ ((b64) => _globalThis.Buffer.from(b64, 'base64').toString('binary'));
21
21
 
22
22
  export function bytesFromBase64(b64: string): Uint8Array {
23
23
  const bin = atob(b64);
@@ -29,8 +29,8 @@ export function bytesFromBase64(b64: string): Uint8Array {
29
29
  }
30
30
 
31
31
  const btoa: (bin: string) => string =
32
- globalThis.btoa ||
33
- ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));
32
+ _globalThis.btoa ||
33
+ ((bin) => _globalThis.Buffer.from(bin, 'binary').toString('base64'));
34
34
 
35
35
  export function base64FromBytes(arr: Uint8Array): string {
36
36
  const bin: string[] = [];
@@ -19,7 +19,7 @@ ${options.useInterchainJs ?
19
19
  `declare var self: any | undefined;
20
20
  declare var window: any | undefined;
21
21
  declare var global: any | undefined;
22
- var globalThis: any = (() => {
22
+ const _globalThis: any = (() => {
23
23
  if (typeof globalThis !== 'undefined') return globalThis;
24
24
  if (typeof self !== 'undefined') return self;
25
25
  if (typeof window !== 'undefined') return window;
@@ -28,7 +28,7 @@ var globalThis: any = (() => {
28
28
  })();
29
29
 
30
30
  const atob: (b64: string) => string =
31
- globalThis.atob || ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));
31
+ _globalThis.atob || ((b64) => _globalThis.Buffer.from(b64, 'base64').toString('binary'));
32
32
 
33
33
  export function bytesFromBase64(b64: string): Uint8Array {
34
34
  const bin = atob(b64);
@@ -40,7 +40,7 @@ export function bytesFromBase64(b64: string): Uint8Array {
40
40
  }
41
41
 
42
42
  const btoa: (bin: string) => string =
43
- globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));
43
+ _globalThis.btoa || ((bin) => _globalThis.Buffer.from(bin, 'binary').toString('base64'));
44
44
 
45
45
  export function base64FromBytes(arr: Uint8Array): string {
46
46
  const bin: string[] = [];
@@ -4,7 +4,7 @@ export const getHelperForBigint = (options) => {
4
4
  `declare var self: any | undefined;
5
5
  declare var window: any | undefined;
6
6
  declare var global: any | undefined;
7
- var globalThis: any = (() => {
7
+ const _globalThis: any = (() => {
8
8
  if (typeof globalThis !== 'undefined') return globalThis;
9
9
  if (typeof self !== 'undefined') return self;
10
10
  if (typeof window !== 'undefined') return window;
@@ -13,8 +13,8 @@ var globalThis: any = (() => {
13
13
  })();
14
14
 
15
15
  const atob: (b64: string) => string =
16
- globalThis.atob ||
17
- ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));
16
+ _globalThis.atob ||
17
+ ((b64) => _globalThis.Buffer.from(b64, 'base64').toString('binary'));
18
18
 
19
19
  export function bytesFromBase64(b64: string): Uint8Array {
20
20
  const bin = atob(b64);
@@ -26,8 +26,8 @@ export function bytesFromBase64(b64: string): Uint8Array {
26
26
  }
27
27
 
28
28
  const btoa: (bin: string) => string =
29
- globalThis.btoa ||
30
- ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));
29
+ _globalThis.btoa ||
30
+ ((bin) => _globalThis.Buffer.from(bin, 'binary').toString('base64'));
31
31
 
32
32
  export function base64FromBytes(arr: Uint8Array): string {
33
33
  const bin: string[] = [];
@@ -16,7 +16,7 @@ ${options.useInterchainJs ?
16
16
  `declare var self: any | undefined;
17
17
  declare var window: any | undefined;
18
18
  declare var global: any | undefined;
19
- var globalThis: any = (() => {
19
+ const _globalThis: any = (() => {
20
20
  if (typeof globalThis !== 'undefined') return globalThis;
21
21
  if (typeof self !== 'undefined') return self;
22
22
  if (typeof window !== 'undefined') return window;
@@ -25,7 +25,7 @@ var globalThis: any = (() => {
25
25
  })();
26
26
 
27
27
  const atob: (b64: string) => string =
28
- globalThis.atob || ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));
28
+ _globalThis.atob || ((b64) => _globalThis.Buffer.from(b64, 'base64').toString('binary'));
29
29
 
30
30
  export function bytesFromBase64(b64: string): Uint8Array {
31
31
  const bin = atob(b64);
@@ -37,7 +37,7 @@ export function bytesFromBase64(b64: string): Uint8Array {
37
37
  }
38
38
 
39
39
  const btoa: (bin: string) => string =
40
- globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));
40
+ _globalThis.btoa || ((bin) => _globalThis.Buffer.from(bin, 'binary').toString('base64'));
41
41
 
42
42
  export function base64FromBytes(arr: Uint8Array): string {
43
43
  const bin: string[] = [];
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@hyperweb/telescope",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "description": "A TypeScript Transpiler for Cosmos Protobufs",
5
- "author": "Dan Lynch <pyramation@gmail.com>",
5
+ "author": "Constructive <developers@constructive.io>",
6
6
  "homepage": "https://github.com/hyperweb-io/telescope/tree/master/packages/telescope#readme",
7
- "license": "SEE LICENSE IN LICENSE",
7
+ "license": "MIT",
8
8
  "main": "main/index.js",
9
9
  "module": "module/index.js",
10
10
  "typings": "types/index.d.ts",
@@ -90,10 +90,10 @@
90
90
  "@babel/parser": "^7.23.6",
91
91
  "@babel/traverse": "7.23.6",
92
92
  "@babel/types": "7.23.6",
93
- "@cosmology/ast": "^2.0.2",
94
- "@cosmology/proto-parser": "^2.0.2",
95
- "@cosmology/types": "^2.0.2",
96
- "@cosmology/utils": "^2.0.2",
93
+ "@cosmology/ast": "^2.1.0",
94
+ "@cosmology/proto-parser": "^2.1.0",
95
+ "@cosmology/types": "^2.1.0",
96
+ "@cosmology/utils": "^2.1.0",
97
97
  "@types/parse-package-name": "0.1.0",
98
98
  "case": "1.6.3",
99
99
  "dargs": "7.0.0",
@@ -110,5 +110,5 @@
110
110
  "rimraf": "5.0.0",
111
111
  "yaml": "^2.3.4"
112
112
  },
113
- "gitHead": "eaae9e070119fe97bd63b781e070ef50ad4a35b9"
113
+ "gitHead": "405b79c604bfa4abbad4ab47ebfa28c70e2740aa"
114
114
  }
@@ -6,7 +6,7 @@ export const getHelperForBigint = (options: TelescopeOptions) => {
6
6
  `declare var self: any | undefined;
7
7
  declare var window: any | undefined;
8
8
  declare var global: any | undefined;
9
- var globalThis: any = (() => {
9
+ const _globalThis: any = (() => {
10
10
  if (typeof globalThis !== 'undefined') return globalThis;
11
11
  if (typeof self !== 'undefined') return self;
12
12
  if (typeof window !== 'undefined') return window;
@@ -15,8 +15,8 @@ var globalThis: any = (() => {
15
15
  })();
16
16
 
17
17
  const atob: (b64: string) => string =
18
- globalThis.atob ||
19
- ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));
18
+ _globalThis.atob ||
19
+ ((b64) => _globalThis.Buffer.from(b64, 'base64').toString('binary'));
20
20
 
21
21
  export function bytesFromBase64(b64: string): Uint8Array {
22
22
  const bin = atob(b64);
@@ -28,8 +28,8 @@ export function bytesFromBase64(b64: string): Uint8Array {
28
28
  }
29
29
 
30
30
  const btoa: (bin: string) => string =
31
- globalThis.btoa ||
32
- ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));
31
+ _globalThis.btoa ||
32
+ ((bin) => _globalThis.Buffer.from(bin, 'binary').toString('base64'));
33
33
 
34
34
  export function base64FromBytes(arr: Uint8Array): string {
35
35
  const bin: string[] = [];
@@ -18,7 +18,7 @@ ${options.useInterchainJs ?
18
18
  `declare var self: any | undefined;
19
19
  declare var window: any | undefined;
20
20
  declare var global: any | undefined;
21
- var globalThis: any = (() => {
21
+ const _globalThis: any = (() => {
22
22
  if (typeof globalThis !== 'undefined') return globalThis;
23
23
  if (typeof self !== 'undefined') return self;
24
24
  if (typeof window !== 'undefined') return window;
@@ -27,7 +27,7 @@ var globalThis: any = (() => {
27
27
  })();
28
28
 
29
29
  const atob: (b64: string) => string =
30
- globalThis.atob || ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));
30
+ _globalThis.atob || ((b64) => _globalThis.Buffer.from(b64, 'base64').toString('binary'));
31
31
 
32
32
  export function bytesFromBase64(b64: string): Uint8Array {
33
33
  const bin = atob(b64);
@@ -39,7 +39,7 @@ export function bytesFromBase64(b64: string): Uint8Array {
39
39
  }
40
40
 
41
41
  const btoa: (bin: string) => string =
42
- globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));
42
+ _globalThis.btoa || ((bin) => _globalThis.Buffer.from(bin, 'binary').toString('base64'));
43
43
 
44
44
  export function base64FromBytes(arr: Uint8Array): string {
45
45
  const bin: string[] = [];
@@ -1 +1 @@
1
- export declare const internalForBigInt = "\ndeclare var self: any | undefined;\ndeclare var window: any | undefined;\ndeclare var global: any | undefined;\nvar globalThis: any = (() => {\n if (typeof globalThis !== 'undefined') return globalThis;\n if (typeof self !== 'undefined') return self;\n if (typeof window !== 'undefined') return window;\n if (typeof global !== 'undefined') return global;\n throw 'Unable to locate global object';\n})();\n\nconst atob: (b64: string) => string =\n globalThis.atob ||\n ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));\n\nexport function bytesFromBase64(b64: string): Uint8Array {\n const bin = atob(b64);\n const arr = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; ++i) {\n arr[i] = bin.charCodeAt(i);\n }\n return arr;\n}\n\nconst btoa: (bin: string) => string =\n globalThis.btoa ||\n ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));\n\nexport function base64FromBytes(arr: Uint8Array): string {\n const bin: string[] = [];\n arr.forEach((byte) => {\n bin.push(String.fromCharCode(byte));\n });\n return btoa(bin.join(''));\n}\n\nexport interface AminoHeight {\n readonly revision_number?: string;\n readonly revision_height?: string;\n}\n\nexport function omitDefault<T extends string | number | bigint>(\n input: T\n): T | undefined {\n if (typeof input === 'string') {\n return input === '' ? undefined : input;\n }\n\n if (typeof input === 'number') {\n return input === 0 ? undefined : input;\n }\n\n if (typeof input === 'bigint') {\n return input === BigInt(0) ? undefined : input;\n }\n\n throw new Error(`Got unsupported type ${typeof input}`);\n}\n\ninterface Duration {\n /**\n * Signed seconds of the span of time. Must be from -315,576,000,000\n * to +315,576,000,000 inclusive. Note: these bounds are computed from:\n * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years\n */\n seconds: bigint;\n /**\n * Signed fractions of a second at nanosecond resolution of the span\n * of time. Durations less than one second are represented with a 0\n * `seconds` field and a positive or negative `nanos` field. For durations\n * of one second or more, a non-zero value for the `nanos` field must be\n * of the same sign as the `seconds` field. Must be from -999,999,999\n * to +999,999,999 inclusive.\n */\n\n nanos: number;\n}\n\nexport function toDuration(duration: string): Duration {\n return {\n seconds: BigInt(Math.floor(parseInt(duration) / 1000000000)),\n nanos: parseInt(duration) % 1000000000\n };\n}\n\nexport function fromDuration(duration: Duration): string {\n return (\n parseInt(duration.seconds.toString()) * 1000000000 +\n duration.nanos\n ).toString();\n}\n\nexport function isSet(value: any): boolean {\n return value !== null && value !== undefined;\n}\n\nexport function isObject(value: any): boolean {\n return typeof value === 'object' && value !== null;\n}\n\nexport interface PageRequest {\n key: Uint8Array;\n offset: bigint;\n limit: bigint;\n countTotal: boolean;\n reverse: boolean;\n}\n\nexport interface PageRequestParams {\n 'pagination.key'?: string;\n 'pagination.offset'?: string;\n 'pagination.limit'?: string;\n 'pagination.count_total'?: boolean;\n 'pagination.reverse'?: boolean;\n}\n\nexport interface Params {\n params: PageRequestParams;\n}\n\nexport const setPaginationParams = (\n options: Params,\n pagination?: PageRequest\n) => {\n if (!pagination) {\n return options;\n }\n\n if (typeof pagination?.countTotal !== 'undefined') {\n options.params['pagination.count_total'] = pagination.countTotal;\n }\n if (typeof pagination?.key !== 'undefined') {\n // String to Uint8Array\n // let uint8arr = new Uint8Array(Buffer.from(data,'base64'));\n\n // Uint8Array to String\n options.params['pagination.key'] = Buffer.from(pagination.key).toString(\n 'base64'\n );\n }\n if (typeof pagination?.limit !== 'undefined') {\n options.params['pagination.limit'] = pagination.limit.toString();\n }\n if (typeof pagination?.offset !== 'undefined') {\n options.params['pagination.offset'] = pagination.offset.toString();\n }\n if (typeof pagination?.reverse !== 'undefined') {\n options.params['pagination.reverse'] = pagination.reverse;\n }\n\n return options;\n};\n\ntype Builtin =\n | Date\n | Function\n | Uint8Array\n | string\n | number\n | bigint\n | boolean\n | undefined;\n\nexport type DeepPartial<T> = T extends Builtin\n ? T\n : T extends Array<infer U>\n ? Array<DeepPartial<U>>\n : T extends ReadonlyArray<infer U>\n ? ReadonlyArray<DeepPartial<U>>\n : T extends {}\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : Partial<T>;\n\ntype KeysOfUnion<T> = T extends T ? keyof T : never;\nexport type Exact<P, I extends P> = P extends Builtin\n ? P\n : P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<\n Exclude<keyof I, KeysOfUnion<P>>,\n never\n >;\n\nexport interface Rpc {\n request(\n service: string,\n method: string,\n data: Uint8Array\n ): Promise<Uint8Array>;\n}\n\ninterface Timestamp {\n /**\n * Represents seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n */\n seconds: bigint;\n /**\n * Non-negative fractions of a second at nanosecond resolution. Negative\n * second values with fractions must still have non-negative nanos values\n * that count forward in time. Must be from 0 to 999,999,999\n * inclusive.\n */\n\n nanos: number;\n}\n\nexport function toTimestamp(date: Date): Timestamp {\n const seconds = numberToLong(date.getTime() / 1_000);\n const nanos = (date.getTime() % 1000) * 1000000;\n return {\n seconds,\n nanos\n };\n}\n\nexport function fromTimestamp(t: Timestamp): Date {\n let millis = Number(t.seconds) * 1000;\n millis += t.nanos / 1000000;\n return new Date(millis);\n}\n\nconst timestampFromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds)\n ? BigInt(object.seconds.toString())\n : BigInt(0),\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0\n };\n};\n\nexport function fromJsonTimestamp(o: any): Timestamp {\n if (o instanceof Date) {\n return toTimestamp(o);\n } else if (typeof o === 'string') {\n return toTimestamp(new Date(o));\n } else {\n return timestampFromJSON(o);\n }\n}\n\nfunction numberToLong(number: number) {\n return BigInt(Math.trunc(number));\n}\n";
1
+ export declare const internalForBigInt = "\ndeclare var self: any | undefined;\ndeclare var window: any | undefined;\ndeclare var global: any | undefined;\nvar _globalThis: any = (() => {\n if (typeof globalThis !== 'undefined') return globalThis;\n if (typeof self !== 'undefined') return self;\n if (typeof window !== 'undefined') return window;\n if (typeof global !== 'undefined') return global;\n throw 'Unable to locate global object';\n})();\n\nconst atob: (b64: string) => string =\n _globalThis.atob ||\n ((b64) => _globalThis.Buffer.from(b64, 'base64').toString('binary'));\n\nexport function bytesFromBase64(b64: string): Uint8Array {\n const bin = atob(b64);\n const arr = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; ++i) {\n arr[i] = bin.charCodeAt(i);\n }\n return arr;\n}\n\nconst btoa: (bin: string) => string =\n _globalThis.btoa ||\n ((bin) => _globalThis.Buffer.from(bin, 'binary').toString('base64'));\n\nexport function base64FromBytes(arr: Uint8Array): string {\n const bin: string[] = [];\n arr.forEach((byte) => {\n bin.push(String.fromCharCode(byte));\n });\n return btoa(bin.join(''));\n}\n\nexport interface AminoHeight {\n readonly revision_number?: string;\n readonly revision_height?: string;\n}\n\nexport function omitDefault<T extends string | number | bigint>(\n input: T\n): T | undefined {\n if (typeof input === 'string') {\n return input === '' ? undefined : input;\n }\n\n if (typeof input === 'number') {\n return input === 0 ? undefined : input;\n }\n\n if (typeof input === 'bigint') {\n return input === BigInt(0) ? undefined : input;\n }\n\n throw new Error(`Got unsupported type ${typeof input}`);\n}\n\ninterface Duration {\n /**\n * Signed seconds of the span of time. Must be from -315,576,000,000\n * to +315,576,000,000 inclusive. Note: these bounds are computed from:\n * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years\n */\n seconds: bigint;\n /**\n * Signed fractions of a second at nanosecond resolution of the span\n * of time. Durations less than one second are represented with a 0\n * `seconds` field and a positive or negative `nanos` field. For durations\n * of one second or more, a non-zero value for the `nanos` field must be\n * of the same sign as the `seconds` field. Must be from -999,999,999\n * to +999,999,999 inclusive.\n */\n\n nanos: number;\n}\n\nexport function toDuration(duration: string): Duration {\n return {\n seconds: BigInt(Math.floor(parseInt(duration) / 1000000000)),\n nanos: parseInt(duration) % 1000000000\n };\n}\n\nexport function fromDuration(duration: Duration): string {\n return (\n parseInt(duration.seconds.toString()) * 1000000000 +\n duration.nanos\n ).toString();\n}\n\nexport function isSet(value: any): boolean {\n return value !== null && value !== undefined;\n}\n\nexport function isObject(value: any): boolean {\n return typeof value === 'object' && value !== null;\n}\n\nexport interface PageRequest {\n key: Uint8Array;\n offset: bigint;\n limit: bigint;\n countTotal: boolean;\n reverse: boolean;\n}\n\nexport interface PageRequestParams {\n 'pagination.key'?: string;\n 'pagination.offset'?: string;\n 'pagination.limit'?: string;\n 'pagination.count_total'?: boolean;\n 'pagination.reverse'?: boolean;\n}\n\nexport interface Params {\n params: PageRequestParams;\n}\n\nexport const setPaginationParams = (\n options: Params,\n pagination?: PageRequest\n) => {\n if (!pagination) {\n return options;\n }\n\n if (typeof pagination?.countTotal !== 'undefined') {\n options.params['pagination.count_total'] = pagination.countTotal;\n }\n if (typeof pagination?.key !== 'undefined') {\n // String to Uint8Array\n // let uint8arr = new Uint8Array(Buffer.from(data,'base64'));\n\n // Uint8Array to String\n options.params['pagination.key'] = Buffer.from(pagination.key).toString(\n 'base64'\n );\n }\n if (typeof pagination?.limit !== 'undefined') {\n options.params['pagination.limit'] = pagination.limit.toString();\n }\n if (typeof pagination?.offset !== 'undefined') {\n options.params['pagination.offset'] = pagination.offset.toString();\n }\n if (typeof pagination?.reverse !== 'undefined') {\n options.params['pagination.reverse'] = pagination.reverse;\n }\n\n return options;\n};\n\ntype Builtin =\n | Date\n | Function\n | Uint8Array\n | string\n | number\n | bigint\n | boolean\n | undefined;\n\nexport type DeepPartial<T> = T extends Builtin\n ? T\n : T extends Array<infer U>\n ? Array<DeepPartial<U>>\n : T extends ReadonlyArray<infer U>\n ? ReadonlyArray<DeepPartial<U>>\n : T extends {}\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : Partial<T>;\n\ntype KeysOfUnion<T> = T extends T ? keyof T : never;\nexport type Exact<P, I extends P> = P extends Builtin\n ? P\n : P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<\n Exclude<keyof I, KeysOfUnion<P>>,\n never\n >;\n\nexport interface Rpc {\n request(\n service: string,\n method: string,\n data: Uint8Array\n ): Promise<Uint8Array>;\n}\n\ninterface Timestamp {\n /**\n * Represents seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n */\n seconds: bigint;\n /**\n * Non-negative fractions of a second at nanosecond resolution. Negative\n * second values with fractions must still have non-negative nanos values\n * that count forward in time. Must be from 0 to 999,999,999\n * inclusive.\n */\n\n nanos: number;\n}\n\nexport function toTimestamp(date: Date): Timestamp {\n const seconds = numberToLong(date.getTime() / 1_000);\n const nanos = (date.getTime() % 1000) * 1000000;\n return {\n seconds,\n nanos\n };\n}\n\nexport function fromTimestamp(t: Timestamp): Date {\n let millis = Number(t.seconds) * 1000;\n millis += t.nanos / 1000000;\n return new Date(millis);\n}\n\nconst timestampFromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds)\n ? BigInt(object.seconds.toString())\n : BigInt(0),\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0\n };\n};\n\nexport function fromJsonTimestamp(o: any): Timestamp {\n if (o instanceof Date) {\n return toTimestamp(o);\n } else if (typeof o === 'string') {\n return toTimestamp(new Date(o));\n } else {\n return timestampFromJSON(o);\n }\n}\n\nfunction numberToLong(number: number) {\n return BigInt(Math.trunc(number));\n}\n";