From a66b8407f0ec362384c2748400a1354d0993b1ec Mon Sep 17 00:00:00 2001 From: Mathieu Hofman <86499+mhofman@users.noreply.github.com> Date: Mon, 16 Sep 2024 11:39:39 -0700 Subject: [PATCH 01/10] test(swingset): use xs-worker to avoid gc flake (#10085) closes: #10071 ## Description I believe #8695 introduced a dependency of the boostrap vat of this test on the gc behavior of the engine, which makes it flaky. Applies the common fix to use an xs-worker instead. ### Security Considerations None ### Scaling Considerations None ### Documentation Considerations None ### Testing Considerations Hopefully the flake is gone ### Upgrade Considerations None --- packages/SwingSet/test/gc-kernel.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/SwingSet/test/gc-kernel.test.js b/packages/SwingSet/test/gc-kernel.test.js index 91b3a0bc26a..ea6fa54b929 100644 --- a/packages/SwingSet/test/gc-kernel.test.js +++ b/packages/SwingSet/test/gc-kernel.test.js @@ -1031,7 +1031,7 @@ test('terminated vat', async t => { bootstrap: { sourceSpec: new URL('gc-dead-vat/bootstrap.js', import.meta.url) .pathname, - creationOptions: { managerType: 'local' }, + creationOptions: { managerType: 'xs-worker' }, }, }, bootstrap: 'bootstrap', From 11a5629bf913aa8282eb60a0c6c8fe024627f48f Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Wed, 11 Sep 2024 11:13:39 -0700 Subject: [PATCH 02/10] chore: gitignore aider --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a4204d8a812..ec596f3ce77 100644 --- a/.gitignore +++ b/.gitignore @@ -77,4 +77,5 @@ _testoutput.txt junit.xml -endo-sha.txt \ No newline at end of file +endo-sha.txt +.aider* From 03ccb8d8cca0dfa726cdd13eb48e350ea89bfabf Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Thu, 12 Sep 2024 11:04:41 -0700 Subject: [PATCH 03/10] build: export {distribution,query} staking --- packages/cosmic-proto/package.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/cosmic-proto/package.json b/packages/cosmic-proto/package.json index 7906091345e..9b7f465c62c 100644 --- a/packages/cosmic-proto/package.json +++ b/packages/cosmic-proto/package.json @@ -36,10 +36,18 @@ "types": "./dist/codegen/cosmos/bank/v1beta1/tx.d.ts", "default": "./dist/codegen/cosmos/bank/v1beta1/tx.js" }, + "./cosmos/distribution/v1beta1/query.js": { + "types": "./dist/codegen/cosmos/distribution/v1beta1/query.d.ts", + "default": "./dist/codegen/cosmos/distribution/v1beta1/query.js" + }, "./cosmos/distribution/v1beta1/tx.js": { "types": "./dist/codegen/cosmos/distribution/v1beta1/tx.d.ts", "default": "./dist/codegen/cosmos/distribution/v1beta1/tx.js" }, + "./cosmos/staking/v1beta1/query.js": { + "types": "./dist/codegen/cosmos/staking/v1beta1/query.d.ts", + "default": "./dist/codegen/cosmos/staking/v1beta1/query.js" + }, "./cosmos/staking/v1beta1/tx.js": { "types": "./dist/codegen/cosmos/staking/v1beta1/tx.d.ts", "default": "./dist/codegen/cosmos/staking/v1beta1/tx.js" From a32320ad5059a9f5776e7cb151fe0e1cb4dd7f59 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Thu, 12 Sep 2024 09:52:09 -0700 Subject: [PATCH 04/10] test: build QueryDelegatorDelegationsResponse --- packages/orchestration/test/ibc-mocks.test.ts | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/packages/orchestration/test/ibc-mocks.test.ts b/packages/orchestration/test/ibc-mocks.test.ts index 0206c793981..6703d7ffa5a 100644 --- a/packages/orchestration/test/ibc-mocks.test.ts +++ b/packages/orchestration/test/ibc-mocks.test.ts @@ -1,18 +1,19 @@ -import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import { QueryBalanceRequest, QueryBalanceResponse, } from '@agoric/cosmic-proto/cosmos/bank/v1beta1/query.js'; +import { QueryDelegatorDelegationsResponse } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/query.js'; import { MsgDelegate, MsgDelegateResponse, } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/tx.js'; +import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import { + buildMsgErrorString, buildMsgResponseString, + buildQueryPacketString, buildQueryResponseString, - buildMsgErrorString, buildTxPacketString, - buildQueryPacketString, } from '../tools/ibc-mocks.js'; test('buildMsgResponseString matches observed values in e2e testing', t => { @@ -74,3 +75,21 @@ test('build Query Packet', t => { 'eyJkYXRhIjoiQ2pvS0ZBb0xZMjl6Ylc5ek1YUmxjM1FTQlhWaGRHOXRFaUl2WTI5emJXOXpMbUpoYm1zdWRqRmlaWFJoTVM1UmRXVnllUzlDWVd4aGJtTmwiLCJtZW1vIjoiIn0=', ); }); + +test('build QueryDelegatorDelegationsResponse', t => { + t.is( + buildQueryResponseString(QueryDelegatorDelegationsResponse, { + delegationResponses: [ + { + delegation: { + delegatorAddress: 'cosmos1test', + validatorAddress: 'cosmosvaloper1test', + shares: '1000000', + }, + balance: { denom: 'uatom', amount: '1000000' }, + }, + ], + }), + 'eyJyZXN1bHQiOiJleUprWVhSaElqb2lRMnhSZVZWbmNGRkRhbmRMUXpKT2RtTXlNWFpqZWtZd1dsaE9NRVZvU21waU0wNTBZak5PTWxsWGVIWmpSMVo1VFZoU2JHTXpVV0ZIVkVWM1RVUkJkMDFFUVhkTlJFRjNUVVJCZDAxRVFYZE5SRUYzVFVSQmQwMUVRVk5GUVc5R1pGZEdNR0l5TUZOQ2VrVjNUVVJCZDAxRVFUMGlmUT09In0=', + ); +}); From 6808b11ccc6d14794df361bdad60beb66360fbfb Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Thu, 12 Sep 2024 09:46:43 -0700 Subject: [PATCH 05/10] fix: encoding Decimal values --- packages/cosmic-proto/package.json | 2 +- packages/cosmic-proto/src/codegen/binary.ts | 14 +- .../src/codegen/google/protobuf/descriptor.ts | 9 +- packages/cosmic-proto/src/codegen/helpers.ts | 72 +- packages/cosmic-proto/src/codegen/index.ts | 2 +- .../cosmic-proto/src/codegen/json-safe.ts | 14 +- .../src/codegen/tendermint/abci/types.ts | 7 +- .../src/codegen/tendermint/types/types.ts | 2 + packages/cosmic-proto/src/codegen/utf8.ts | 2 +- packages/cosmic-proto/src/codegen/varint.ts | 6 +- patches/@cosmology+telescope+1.7.1.patch | 1005 ----------------- yarn.lock | 95 +- 12 files changed, 138 insertions(+), 1092 deletions(-) delete mode 100644 patches/@cosmology+telescope+1.7.1.patch diff --git a/packages/cosmic-proto/package.json b/packages/cosmic-proto/package.json index 9b7f465c62c..1b82434a185 100644 --- a/packages/cosmic-proto/package.json +++ b/packages/cosmic-proto/package.json @@ -144,7 +144,7 @@ "devDependencies": { "@agoric/cosmos": "^0.34.1", "@ava/typescript": "^4.1.0", - "@cosmology/telescope": "^1.7.1", + "@cosmology/telescope": "https://gitpkg.vercel.app/agoric-labs/telescope/packages/telescope?8d2c2f6ba637a5578eead09a7368dc41c262a9d0", "@endo/bundle-source": "^3.4.0", "@endo/import-bundle": "^1.2.2", "ava": "^5.3.1", diff --git a/packages/cosmic-proto/src/codegen/binary.ts b/packages/cosmic-proto/src/codegen/binary.ts index 33c34900cf4..22d542844d2 100644 --- a/packages/cosmic-proto/src/codegen/binary.ts +++ b/packages/cosmic-proto/src/codegen/binary.ts @@ -1,6 +1,6 @@ //@ts-nocheck /** - * This file and any referenced files were automatically generated by @cosmology/telescope@1.7.1 + * This file and any referenced files were automatically generated by @cosmology/telescope@1.8.3 * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ @@ -100,7 +100,7 @@ export class BinaryReader implements IBinaryReader { len: number; assertBounds(): void { - if (this.pos > this.len) throw RangeError('premature EOF'); + if (this.pos > this.len) throw new RangeError('premature EOF'); } constructor(buf?: ArrayLike) { @@ -115,7 +115,7 @@ export class BinaryReader implements IBinaryReader { fieldNo = tag >>> 3, wireType = tag & 7; if (fieldNo <= 0 || wireType < 0 || wireType > 5) - throw Error( + throw new Error( 'illegal tag: field no ' + fieldNo + ' wire type ' + wireType, ); return [fieldNo, wireType, tag]; @@ -214,11 +214,11 @@ export class BinaryReader implements IBinaryReader { } float(): number { - throw Error('float not supported'); + throw new Error('float not supported'); } double(): number { - throw Error('double not supported'); + throw new Error('double not supported'); } bool(): boolean { @@ -466,11 +466,11 @@ export class BinaryWriter implements IBinaryWriter { sfixed32 = BinaryWriter.prototype.fixed32; float(value: number): BinaryWriter { - throw Error('float not supported' + value); + throw new Error('float not supported' + value); } double(value: number): BinaryWriter { - throw Error('double not supported' + value); + throw new Error('double not supported' + value); } bytes(value: Uint8Array): BinaryWriter { diff --git a/packages/cosmic-proto/src/codegen/google/protobuf/descriptor.ts b/packages/cosmic-proto/src/codegen/google/protobuf/descriptor.ts index 3ec3b438f39..a381d00927f 100644 --- a/packages/cosmic-proto/src/codegen/google/protobuf/descriptor.ts +++ b/packages/cosmic-proto/src/codegen/google/protobuf/descriptor.ts @@ -31,6 +31,7 @@ export enum FieldDescriptorProto_Type { * treat group fields as unknown fields. */ TYPE_GROUP = 10, + /** TYPE_MESSAGE - Length-delimited aggregate. */ TYPE_MESSAGE = 11, /** TYPE_BYTES - New in version 2. */ TYPE_BYTES = 12, @@ -198,12 +199,9 @@ export function fieldDescriptorProto_LabelToJSON( } /** Generated classes can be optimized for speed or code size. */ export enum FileOptions_OptimizeMode { - /** - * SPEED - Generate complete code for parsing, serialization, - * etc. - */ + /** SPEED - Generate complete code for parsing, serialization, */ SPEED = 1, - /** CODE_SIZE - Use ReflectionOps to implement these methods. */ + /** CODE_SIZE - etc. */ CODE_SIZE = 2, /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ LITE_RUNTIME = 3, @@ -393,6 +391,7 @@ export interface FileDescriptorSetSDKType { export interface FileDescriptorProto { /** file name, relative to root of source tree */ name: string; + /** e.g. "foo", "foo.bar", etc. */ package: string; /** Names of files imported by this file. */ dependency: string[]; diff --git a/packages/cosmic-proto/src/codegen/helpers.ts b/packages/cosmic-proto/src/codegen/helpers.ts index a5547f7a637..e9674426df1 100644 --- a/packages/cosmic-proto/src/codegen/helpers.ts +++ b/packages/cosmic-proto/src/codegen/helpers.ts @@ -1,6 +1,6 @@ //@ts-nocheck /** - * This file and any referenced files were automatically generated by @cosmology/telescope@1.7.1 + * This file and any referenced files were automatically generated by @cosmology/telescope@1.8.3 * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ @@ -35,7 +35,7 @@ export function omitDefault( return input === BigInt(0) ? undefined : input; } - throw Error(`Got unsupported type ${typeof input}`); + throw new Error(`Got unsupported type ${typeof input}`); } interface Duration { @@ -223,9 +223,10 @@ function numberToLong(number: number) { return BigInt(Math.trunc(number)); } +// START agoric-sdk patch // The largest value we need is 18 (Ether). const maxFractionalDigits = 30; -// Subset of Decimal in @cosmjs/math + /** * A type for arbitrary precision, non-negative decimals. * @@ -241,7 +242,9 @@ export class Decimal { const badCharacter = input.match(/[^0-9.]/); if (badCharacter) { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - throw Error(`Invalid character at position ${badCharacter.index! + 1}`); + throw new Error( + `Invalid character at position ${badCharacter.index! + 1}`, + ); } let whole: string; @@ -250,7 +253,7 @@ export class Decimal { if (input === '') { whole = '0'; fractional = ''; - } else if (input.search(/./) === -1) { + } else if (input.search(/\./) === -1) { // integer format, no separator whole = input; fractional = ''; @@ -259,21 +262,21 @@ export class Decimal { switch (parts.length) { case 0: case 1: - throw Error( + throw new Error( 'Fewer than two elements in split result. This must not happen here.', ); case 2: - if (!parts[1]) throw Error('Fractional part missing'); + if (!parts[1]) throw new Error('Fractional part missing'); whole = parts[0]; fractional = parts[1].replace(/0+$/, ''); break; default: - throw Error('More than one separator found'); + throw new Error('More than one separator found'); } } if (fractional.length > fractionalDigits) { - throw Error('Got more fractional digits than supported'); + throw new Error('Got more fractional digits than supported'); } const quantity = `${whole}${fractional.padEnd(fractionalDigits, '0')}`; @@ -291,11 +294,56 @@ export class Decimal { private static verifyFractionalDigits(fractionalDigits: number): void { if (!Number.isInteger(fractionalDigits)) - throw Error('Fractional digits is not an integer'); + throw new Error('Fractional digits is not an integer'); if (fractionalDigits < 0) - throw Error('Fractional digits must not be negative'); + throw new Error('Fractional digits must not be negative'); if (fractionalDigits > maxFractionalDigits) { - throw Error(`Fractional digits must not exceed ${maxFractionalDigits}`); + throw new Error( + `Fractional digits must not exceed ${maxFractionalDigits}`, + ); + } + } + + public get atomics(): string { + return this.data.atomics.toString(); + } + + public get fractionalDigits(): number { + return this.data.fractionalDigits; + } + + private readonly data: { + readonly atomics: bigint; + readonly fractionalDigits: number; + }; + + private constructor(atomics: string, fractionalDigits: number) { + if (!atomics.match(/^[0-9]+$/)) { + throw new Error( + 'Invalid string format. Only non-negative integers in decimal representation supported.', + ); + } + + this.data = { + atomics: BigInt(atomics), + fractionalDigits: fractionalDigits, + }; + } + + public toString(): string { + const factor = BigInt(10) ** BigInt(this.data.fractionalDigits); + const whole = this.data.atomics / factor; + const fractional = this.data.atomics % factor; + + if (fractional === 0n) { + return whole.toString(); + } else { + const fullFractionalPart = fractional + .toString() + .padStart(this.data.fractionalDigits, '0'); + const trimmedFractionalPart = fullFractionalPart.replace(/0+$/, ''); + return `${whole.toString()}.${trimmedFractionalPart}`; } } } +// END agoric-sdk patch diff --git a/packages/cosmic-proto/src/codegen/index.ts b/packages/cosmic-proto/src/codegen/index.ts index 80dd20e32b1..e6e4d93d04b 100644 --- a/packages/cosmic-proto/src/codegen/index.ts +++ b/packages/cosmic-proto/src/codegen/index.ts @@ -1,6 +1,6 @@ //@ts-nocheck /** - * This file and any referenced files were automatically generated by @cosmology/telescope@1.7.1 + * This file and any referenced files were automatically generated by @cosmology/telescope@1.8.3 * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ diff --git a/packages/cosmic-proto/src/codegen/json-safe.ts b/packages/cosmic-proto/src/codegen/json-safe.ts index a026dbef565..b35e037fe21 100644 --- a/packages/cosmic-proto/src/codegen/json-safe.ts +++ b/packages/cosmic-proto/src/codegen/json-safe.ts @@ -1,12 +1,14 @@ //@ts-nocheck /** - * This file and any referenced files were automatically generated by @cosmology/telescope@1.7.1 + * This file and any referenced files were automatically generated by @cosmology/telescope@1.8.3 * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -export type JsonSafe = { - [Prop in keyof T]: T[Prop] extends Uint8Array | bigint | Date - ? string - : T[Prop]; -}; +export type JsonSafe = T extends Uint8Array | bigint | Date + ? string + : T extends Array + ? Array> + : T extends object + ? { [K in keyof T]: JsonSafe } + : T; diff --git a/packages/cosmic-proto/src/codegen/tendermint/abci/types.ts b/packages/cosmic-proto/src/codegen/tendermint/abci/types.ts index 913c9ee017f..8d1fd3f6eb9 100644 --- a/packages/cosmic-proto/src/codegen/tendermint/abci/types.ts +++ b/packages/cosmic-proto/src/codegen/tendermint/abci/types.ts @@ -849,12 +849,9 @@ export interface TxResultSDKType { } /** Validator */ export interface Validator { - /** - * The first 20 bytes of SHA256(public key) - * PubKey pub_key = 2 [(gogoproto.nullable)=false]; - */ + /** The first 20 bytes of SHA256(public key) */ address: Uint8Array; - /** The voting power */ + /** PubKey pub_key = 2 [(gogoproto.nullable)=false]; */ power: bigint; } export interface ValidatorProtoMsg { diff --git a/packages/cosmic-proto/src/codegen/tendermint/types/types.ts b/packages/cosmic-proto/src/codegen/tendermint/types/types.ts index 52eba4662ac..e34af751bbc 100644 --- a/packages/cosmic-proto/src/codegen/tendermint/types/types.ts +++ b/packages/cosmic-proto/src/codegen/tendermint/types/types.ts @@ -158,6 +158,7 @@ export interface Header { lastBlockId: BlockID; /** hashes of block data */ lastCommitHash: Uint8Array; + /** transactions */ dataHash: Uint8Array; /** hashes from the app output from the prev block */ validatorsHash: Uint8Array; @@ -167,6 +168,7 @@ export interface Header { consensusHash: Uint8Array; /** state after txs from the previous block */ appHash: Uint8Array; + /** root hash of all results from the txs from the previous block */ lastResultsHash: Uint8Array; /** consensus info */ evidenceHash: Uint8Array; diff --git a/packages/cosmic-proto/src/codegen/utf8.ts b/packages/cosmic-proto/src/codegen/utf8.ts index f2d864a1976..d0412e27b6c 100644 --- a/packages/cosmic-proto/src/codegen/utf8.ts +++ b/packages/cosmic-proto/src/codegen/utf8.ts @@ -1,6 +1,6 @@ //@ts-nocheck /** - * This file and any referenced files were automatically generated by @cosmology/telescope@1.7.1 + * This file and any referenced files were automatically generated by @cosmology/telescope@1.8.3 * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ diff --git a/packages/cosmic-proto/src/codegen/varint.ts b/packages/cosmic-proto/src/codegen/varint.ts index 4e82d8337ef..dd800ff82d9 100644 --- a/packages/cosmic-proto/src/codegen/varint.ts +++ b/packages/cosmic-proto/src/codegen/varint.ts @@ -1,6 +1,6 @@ //@ts-nocheck /** - * This file and any referenced files were automatically generated by @cosmology/telescope@1.7.1 + * This file and any referenced files were automatically generated by @cosmology/telescope@1.8.3 * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ @@ -86,7 +86,7 @@ export function varint64read(this: ReaderLike): [number, number] { } } - throw Error('invalid varint'); + throw new Error('invalid varint'); } /** @@ -353,7 +353,7 @@ export function varint32read(this: ReaderLike): number { for (let readBytes = 5; (b & 0x80) !== 0 && readBytes < 10; readBytes++) b = this.buf[this.pos++]; - if ((b & 0x80) != 0) throw Error('invalid varint'); + if ((b & 0x80) != 0) throw new Error('invalid varint'); this.assertBounds(); diff --git a/patches/@cosmology+telescope+1.7.1.patch b/patches/@cosmology+telescope+1.7.1.patch deleted file mode 100644 index dcc4a034512..00000000000 --- a/patches/@cosmology+telescope+1.7.1.patch +++ /dev/null @@ -1,1005 +0,0 @@ -diff --git a/node_modules/@cosmology/telescope/main/helpers/internal-for-bigint.js b/node_modules/@cosmology/telescope/main/helpers/internal-for-bigint.js -index 950827a..9e9214c 100644 ---- a/node_modules/@cosmology/telescope/main/helpers/internal-for-bigint.js -+++ b/node_modules/@cosmology/telescope/main/helpers/internal-for-bigint.js -@@ -5,41 +5,11 @@ const getHelperForBigint = (options) => { - return `${options.aminoEncoding?.customTypes?.useCosmosSDKDec ? `import { Dec } from "@keplr-wallet/unit"; - - ` : ""} --declare var self: any | undefined; --declare var window: any | undefined; --declare var global: any | undefined; --var globalThis: any = (() => { -- if (typeof globalThis !== 'undefined') return globalThis; -- if (typeof self !== 'undefined') return self; -- if (typeof window !== 'undefined') return window; -- if (typeof global !== 'undefined') return global; -- throw 'Unable to locate global object'; --})(); -- --const atob: (b64: string) => string = -- globalThis.atob || -- ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary')); -- --export function bytesFromBase64(b64: string): Uint8Array { -- const bin = atob(b64); -- const arr = new Uint8Array(bin.length); -- for (let i = 0; i < bin.length; ++i) { -- arr[i] = bin.charCodeAt(i); -- } -- return arr; --} -- --const btoa: (bin: string) => string = -- globalThis.btoa || -- ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64')); -+import { encodeBase64, decodeBase64 } from '@endo/base64'; - --export function base64FromBytes(arr: Uint8Array): string { -- const bin: string[] = []; -- arr.forEach((byte) => { -- bin.push(String.fromCharCode(byte)); -- }); -- return btoa(bin.join('')); --} -+// use Endo for broader compatibility -+export const bytesFromBase64: (input: string) => Uint8Array = decodeBase64; -+export const base64FromBytes: (input: Uint8Array) => string = encodeBase64; - - export interface AminoHeight { - readonly revision_number?: string; -@@ -252,6 +222,88 @@ export function fromJsonTimestamp(o: any): Timestamp { - function numberToLong(number: number) { - return BigInt(Math.trunc(number)); - } -+ -+// The largest value we need is 18 (Ether). -+const maxFractionalDigits = 30; -+// Subset of Decimal in @cosmjs/math -+/** -+ * A type for arbitrary precision, non-negative decimals. -+ * -+ * Instances of this class are immutable. -+ */ -+export class Decimal { -+ public static fromUserInput( -+ input: string, -+ fractionalDigits: number, -+ ): Decimal { -+ Decimal.verifyFractionalDigits(fractionalDigits); -+ -+ const badCharacter = input.match(/[^0-9.]/); -+ if (badCharacter) { -+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -+ throw new Error( -+ \`Invalid character at position \${badCharacter.index! + 1}\`, -+ ); -+ } -+ -+ let whole: string; -+ let fractional: string; -+ -+ if (input === '') { -+ whole = '0'; -+ fractional = ''; -+ } else if (input.search(/\./) === -1) { -+ // integer format, no separator -+ whole = input; -+ fractional = ''; -+ } else { -+ const parts = input.split('.'); -+ switch (parts.length) { -+ case 0: -+ case 1: -+ throw new Error( -+ 'Fewer than two elements in split result. This must not happen here.', -+ ); -+ case 2: -+ if (!parts[1]) throw new Error('Fractional part missing'); -+ whole = parts[0]; -+ fractional = parts[1].replace(/0+$/, ''); -+ break; -+ default: -+ throw new Error('More than one separator found'); -+ } -+ } -+ -+ if (fractional.length > fractionalDigits) { -+ throw new Error('Got more fractional digits than supported'); -+ } -+ -+ const quantity = \`\${whole}\${fractional.padEnd(fractionalDigits, '0')}\`; -+ -+ return new Decimal(quantity, fractionalDigits); -+ } -+ -+ public static fromAtomics( -+ atomics: string, -+ fractionalDigits: number, -+ ): Decimal { -+ Decimal.verifyFractionalDigits(fractionalDigits); -+ return new Decimal(atomics, fractionalDigits); -+ } -+ -+ private static verifyFractionalDigits(fractionalDigits: number): void { -+ if (!Number.isInteger(fractionalDigits)) -+ throw new Error('Fractional digits is not an integer'); -+ if (fractionalDigits < 0) -+ throw new Error('Fractional digits must not be negative'); -+ if (fractionalDigits > maxFractionalDigits) { -+ throw new Error( -+ \`Fractional digits must not exceed \${maxFractionalDigits}\`, -+ ); -+ } -+ } -+} -+ - ${options.aminoEncoding?.customTypes?.useCosmosSDKDec ? - ` - export function padDecimal(decStr: string): string{ -diff --git a/node_modules/@cosmology/telescope/main/helpers/internal.js b/node_modules/@cosmology/telescope/main/helpers/internal.js -index b27664f..5cf4c6a 100644 ---- a/node_modules/@cosmology/telescope/main/helpers/internal.js -+++ b/node_modules/@cosmology/telescope/main/helpers/internal.js -@@ -5,6 +5,8 @@ const getHelper = (options) => { - return `import * as _m0 from "protobufjs/minimal"; - import Long from 'long';${options.aminoEncoding?.customTypes?.useCosmosSDKDec ? ` - import { Dec } from "@keplr-wallet/unit"; -+import { encodeBase64, decodeBase64 } from '@endo/base64'; -+ - ` : ""} - - // @ts-ignore -@@ -16,39 +18,9 @@ if (_m0.util.Long !== Long) { - - export { Long }; - --declare var self: any | undefined; --declare var window: any | undefined; --declare var global: any | undefined; --var globalThis: any = (() => { -- if (typeof globalThis !== 'undefined') return globalThis; -- if (typeof self !== 'undefined') return self; -- if (typeof window !== 'undefined') return window; -- if (typeof global !== 'undefined') return global; -- throw 'Unable to locate global object'; --})(); -- --const atob: (b64: string) => string = -- globalThis.atob || ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary')); -- --export function bytesFromBase64(b64: string): Uint8Array { -- const bin = atob(b64); -- const arr = new Uint8Array(bin.length); -- for (let i = 0; i < bin.length; ++i) { -- arr[i] = bin.charCodeAt(i); -- } -- return arr; --} -- --const btoa: (bin: string) => string = -- globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64')); -- --export function base64FromBytes(arr: Uint8Array): string { -- const bin: string[] = []; -- arr.forEach((byte) => { -- bin.push(String.fromCharCode(byte)); -- }); -- return btoa(bin.join('')); --} -+// use Endo for broader compatibility -+export const bytesFromBase64: (input: string) => Uint8Array = decodeBase64; -+export const base64FromBytes: (input: Uint8Array) => string = encodeBase64; - - export interface AminoHeight { - readonly revision_number?: string; -@@ -236,7 +208,91 @@ export function fromJsonTimestamp(o: any): Timestamp { - - function numberToLong(number: number) { - return Long.fromNumber(number); --}${options.aminoEncoding?.customTypes?.useCosmosSDKDec ? ` -+} -+ -+ -+// The largest value we need is 18 (Ether). -+const maxFractionalDigits = 30; -+// Subset of Decimal in @cosmjs/math -+/** -+ * A type for arbitrary precision, non-negative decimals. -+ * -+ * Instances of this class are immutable. -+ */ -+export class Decimal { -+ public static fromUserInput( -+ input: string, -+ fractionalDigits: number, -+ ): Decimal { -+ Decimal.verifyFractionalDigits(fractionalDigits); -+ -+ const badCharacter = input.match(/[^0-9.]/); -+ if (badCharacter) { -+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -+ throw new Error( -+ \`Invalid character at position \${badCharacter.index! + 1}\`, -+ ); -+ } -+ -+ let whole: string; -+ let fractional: string; -+ -+ if (input === '') { -+ whole = '0'; -+ fractional = ''; -+ } else if (input.search(/\./) === -1) { -+ // integer format, no separator -+ whole = input; -+ fractional = ''; -+ } else { -+ const parts = input.split('.'); -+ switch (parts.length) { -+ case 0: -+ case 1: -+ throw new Error( -+ 'Fewer than two elements in split result. This must not happen here.', -+ ); -+ case 2: -+ if (!parts[1]) throw new Error('Fractional part missing'); -+ whole = parts[0]; -+ fractional = parts[1].replace(/0+$/, ''); -+ break; -+ default: -+ throw new Error('More than one separator found'); -+ } -+ } -+ -+ if (fractional.length > fractionalDigits) { -+ throw new Error('Got more fractional digits than supported'); -+ } -+ -+ const quantity = \`\${whole}\${fractional.padEnd(fractionalDigits, '0')}\`; -+ -+ return new Decimal(quantity, fractionalDigits); -+ } -+ -+ public static fromAtomics( -+ atomics: string, -+ fractionalDigits: number, -+ ): Decimal { -+ Decimal.verifyFractionalDigits(fractionalDigits); -+ return new Decimal(atomics, fractionalDigits); -+ } -+ -+ private static verifyFractionalDigits(fractionalDigits: number): void { -+ if (!Number.isInteger(fractionalDigits)) -+ throw new Error('Fractional digits is not an integer'); -+ if (fractionalDigits < 0) -+ throw new Error('Fractional digits must not be negative'); -+ if (fractionalDigits > maxFractionalDigits) { -+ throw new Error( -+ \`Fractional digits must not exceed \${maxFractionalDigits}\`, -+ ); -+ } -+ } -+} -+ -+${options.aminoEncoding?.customTypes?.useCosmosSDKDec ? ` - - export function padDecimal(decStr: string): string{ - return decStr ? new Dec(decStr).toString() : decStr; -diff --git a/node_modules/@cosmology/telescope/main/helpers/internalForBigInt.js b/node_modules/@cosmology/telescope/main/helpers/internalForBigInt.js -index 07b6e47..87c78db 100644 ---- a/node_modules/@cosmology/telescope/main/helpers/internalForBigInt.js -+++ b/node_modules/@cosmology/telescope/main/helpers/internalForBigInt.js -@@ -2,41 +2,11 @@ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.internalForBigInt = void 0; - exports.internalForBigInt = ` --declare var self: any | undefined; --declare var window: any | undefined; --declare var global: any | undefined; --var globalThis: any = (() => { -- if (typeof globalThis !== 'undefined') return globalThis; -- if (typeof self !== 'undefined') return self; -- if (typeof window !== 'undefined') return window; -- if (typeof global !== 'undefined') return global; -- throw 'Unable to locate global object'; --})(); -- --const atob: (b64: string) => string = -- globalThis.atob || -- ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary')); -- --export function bytesFromBase64(b64: string): Uint8Array { -- const bin = atob(b64); -- const arr = new Uint8Array(bin.length); -- for (let i = 0; i < bin.length; ++i) { -- arr[i] = bin.charCodeAt(i); -- } -- return arr; --} -+import { encodeBase64, decodeBase64 } from '@endo/base64'; - --const btoa: (bin: string) => string = -- globalThis.btoa || -- ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64')); -- --export function base64FromBytes(arr: Uint8Array): string { -- const bin: string[] = []; -- arr.forEach((byte) => { -- bin.push(String.fromCharCode(byte)); -- }); -- return btoa(bin.join('')); --} -+// use Endo for broader compatibility -+export const bytesFromBase64: (input: string) => Uint8Array = decodeBase64; -+export const base64FromBytes: (input: Uint8Array) => string = encodeBase64; - - export interface AminoHeight { - readonly revision_number?: string; -diff --git a/node_modules/@cosmology/telescope/main/utils/index.js b/node_modules/@cosmology/telescope/main/utils/index.js -index 998db7f..3301179 100644 ---- a/node_modules/@cosmology/telescope/main/utils/index.js -+++ b/node_modules/@cosmology/telescope/main/utils/index.js -@@ -36,7 +36,7 @@ exports.UTILS = { - bytesFromBase64: '__helpers__', - BrowserHeaders: 'browser-headers', - connectComet: '@cosmjs/tendermint-rpc', -- Decimal: '@cosmjs/math', -+ Decimal: '__helpers__', - padDecimal: '__helpers__', - createProtobufRpcClient: '@cosmjs/stargate', - Pubkey: '@cosmjs/amino', -diff --git a/node_modules/@cosmology/telescope/module/helpers/internal-for-bigint.js b/node_modules/@cosmology/telescope/module/helpers/internal-for-bigint.js -index 1d19b1c..5a9ec29 100644 ---- a/node_modules/@cosmology/telescope/module/helpers/internal-for-bigint.js -+++ b/node_modules/@cosmology/telescope/module/helpers/internal-for-bigint.js -@@ -2,41 +2,11 @@ export const getHelperForBigint = (options) => { - return `${options.aminoEncoding?.customTypes?.useCosmosSDKDec ? `import { Dec } from "@keplr-wallet/unit"; - - ` : ""} --declare var self: any | undefined; --declare var window: any | undefined; --declare var global: any | undefined; --var globalThis: any = (() => { -- if (typeof globalThis !== 'undefined') return globalThis; -- if (typeof self !== 'undefined') return self; -- if (typeof window !== 'undefined') return window; -- if (typeof global !== 'undefined') return global; -- throw 'Unable to locate global object'; --})(); -- --const atob: (b64: string) => string = -- globalThis.atob || -- ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary')); -- --export function bytesFromBase64(b64: string): Uint8Array { -- const bin = atob(b64); -- const arr = new Uint8Array(bin.length); -- for (let i = 0; i < bin.length; ++i) { -- arr[i] = bin.charCodeAt(i); -- } -- return arr; --} -+import { encodeBase64, decodeBase64 } from '@endo/base64'; - --const btoa: (bin: string) => string = -- globalThis.btoa || -- ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64')); -- --export function base64FromBytes(arr: Uint8Array): string { -- const bin: string[] = []; -- arr.forEach((byte) => { -- bin.push(String.fromCharCode(byte)); -- }); -- return btoa(bin.join('')); --} -+// use Endo for broader compatibility -+export const bytesFromBase64: (input: string) => Uint8Array = decodeBase64; -+export const base64FromBytes: (input: Uint8Array) => string = encodeBase64; - - export interface AminoHeight { - readonly revision_number?: string; -@@ -249,11 +219,95 @@ export function fromJsonTimestamp(o: any): Timestamp { - function numberToLong(number: number) { - return BigInt(Math.trunc(number)); - } -+ -+ -+// The largest value we need is 18 (Ether). -+const maxFractionalDigits = 30; -+// Subset of Decimal in @cosmjs/math -+/** -+ * A type for arbitrary precision, non-negative decimals. -+ * -+ * Instances of this class are immutable. -+ */ -+export class Decimal { -+ public static fromUserInput( -+ input: string, -+ fractionalDigits: number, -+ ): Decimal { -+ Decimal.verifyFractionalDigits(fractionalDigits); -+ -+ const badCharacter = input.match(/[^0-9.]/); -+ if (badCharacter) { -+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -+ throw new Error( -+ \`Invalid character at position \${badCharacter.index! + 1}\`, -+ ); -+ } -+ -+ let whole: string; -+ let fractional: string; -+ -+ if (input === '') { -+ whole = '0'; -+ fractional = ''; -+ } else if (input.search(/\./) === -1) { -+ // integer format, no separator -+ whole = input; -+ fractional = ''; -+ } else { -+ const parts = input.split('.'); -+ switch (parts.length) { -+ case 0: -+ case 1: -+ throw new Error( -+ 'Fewer than two elements in split result. This must not happen here.', -+ ); -+ case 2: -+ if (!parts[1]) throw new Error('Fractional part missing'); -+ whole = parts[0]; -+ fractional = parts[1].replace(/0+$/, ''); -+ break; -+ default: -+ throw new Error('More than one separator found'); -+ } -+ } -+ -+ if (fractional.length > fractionalDigits) { -+ throw new Error('Got more fractional digits than supported'); -+ } -+ -+ const quantity = \`\${whole}\${fractional.padEnd(fractionalDigits, '0')}\`; -+ -+ return new Decimal(quantity, fractionalDigits); -+ } -+ -+ public static fromAtomics( -+ atomics: string, -+ fractionalDigits: number, -+ ): Decimal { -+ Decimal.verifyFractionalDigits(fractionalDigits); -+ return new Decimal(atomics, fractionalDigits); -+ } -+ -+ private static verifyFractionalDigits(fractionalDigits: number): void { -+ if (!Number.isInteger(fractionalDigits)) -+ throw new Error('Fractional digits is not an integer'); -+ if (fractionalDigits < 0) -+ throw new Error('Fractional digits must not be negative'); -+ if (fractionalDigits > maxFractionalDigits) { -+ throw new Error( -+ \`Fractional digits must not exceed \${maxFractionalDigits}\`, -+ ); -+ } -+ } -+} -+ - ${options.aminoEncoding?.customTypes?.useCosmosSDKDec ? - ` - export function padDecimal(decStr: string): string{ - return decStr ? new Dec(decStr).toString() : decStr; - } -+ - ` : ""} - `; - }; -diff --git a/node_modules/@cosmology/telescope/module/helpers/internal.js b/node_modules/@cosmology/telescope/module/helpers/internal.js -index 28e50cf..c713941 100644 ---- a/node_modules/@cosmology/telescope/module/helpers/internal.js -+++ b/node_modules/@cosmology/telescope/module/helpers/internal.js -@@ -2,6 +2,7 @@ export const getHelper = (options) => { - return `import * as _m0 from "protobufjs/minimal"; - import Long from 'long';${options.aminoEncoding?.customTypes?.useCosmosSDKDec ? ` - import { Dec } from "@keplr-wallet/unit"; -+import { encodeBase64, decodeBase64 } from '@endo/base64'; - ` : ""} - - // @ts-ignore -@@ -13,39 +14,9 @@ if (_m0.util.Long !== Long) { - - export { Long }; - --declare var self: any | undefined; --declare var window: any | undefined; --declare var global: any | undefined; --var globalThis: any = (() => { -- if (typeof globalThis !== 'undefined') return globalThis; -- if (typeof self !== 'undefined') return self; -- if (typeof window !== 'undefined') return window; -- if (typeof global !== 'undefined') return global; -- throw 'Unable to locate global object'; --})(); -- --const atob: (b64: string) => string = -- globalThis.atob || ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary')); -- --export function bytesFromBase64(b64: string): Uint8Array { -- const bin = atob(b64); -- const arr = new Uint8Array(bin.length); -- for (let i = 0; i < bin.length; ++i) { -- arr[i] = bin.charCodeAt(i); -- } -- return arr; --} -- --const btoa: (bin: string) => string = -- globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64')); -- --export function base64FromBytes(arr: Uint8Array): string { -- const bin: string[] = []; -- arr.forEach((byte) => { -- bin.push(String.fromCharCode(byte)); -- }); -- return btoa(bin.join('')); --} -+// use Endo for broader compatibility -+export const bytesFromBase64: (input: string) => Uint8Array = decodeBase64; -+export const base64FromBytes: (input: Uint8Array) => string = encodeBase64; - - export interface AminoHeight { - readonly revision_number?: string; -@@ -231,6 +202,87 @@ export function fromJsonTimestamp(o: any): Timestamp { - } - } - -+// The largest value we need is 18 (Ether). -+const maxFractionalDigits = 30; -+// Subset of Decimal in @cosmjs/math -+/** -+ * A type for arbitrary precision, non-negative decimals. -+ * -+ * Instances of this class are immutable. -+ */ -+export class Decimal { -+ public static fromUserInput( -+ input: string, -+ fractionalDigits: number, -+ ): Decimal { -+ Decimal.verifyFractionalDigits(fractionalDigits); -+ -+ const badCharacter = input.match(/[^0-9.]/); -+ if (badCharacter) { -+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -+ throw new Error( -+ \`Invalid character at position \${badCharacter.index! + 1}\`, -+ ); -+ } -+ -+ let whole: string; -+ let fractional: string; -+ -+ if (input === '') { -+ whole = '0'; -+ fractional = ''; -+ } else if (input.search(/\./) === -1) { -+ // integer format, no separator -+ whole = input; -+ fractional = ''; -+ } else { -+ const parts = input.split('.'); -+ switch (parts.length) { -+ case 0: -+ case 1: -+ throw new Error( -+ 'Fewer than two elements in split result. This must not happen here.', -+ ); -+ case 2: -+ if (!parts[1]) throw new Error('Fractional part missing'); -+ whole = parts[0]; -+ fractional = parts[1].replace(/0+$/, ''); -+ break; -+ default: -+ throw new Error('More than one separator found'); -+ } -+ } -+ -+ if (fractional.length > fractionalDigits) { -+ throw new Error('Got more fractional digits than supported'); -+ } -+ -+ const quantity = \`\${whole}\${fractional.padEnd(fractionalDigits, '0')}\`; -+ -+ return new Decimal(quantity, fractionalDigits); -+ } -+ -+ public static fromAtomics( -+ atomics: string, -+ fractionalDigits: number, -+ ): Decimal { -+ Decimal.verifyFractionalDigits(fractionalDigits); -+ return new Decimal(atomics, fractionalDigits); -+ } -+ -+ private static verifyFractionalDigits(fractionalDigits: number): void { -+ if (!Number.isInteger(fractionalDigits)) -+ throw new Error('Fractional digits is not an integer'); -+ if (fractionalDigits < 0) -+ throw new Error('Fractional digits must not be negative'); -+ if (fractionalDigits > maxFractionalDigits) { -+ throw new Error( -+ \`Fractional digits must not exceed \${maxFractionalDigits}\`, -+ ); -+ } -+ } -+} -+ - function numberToLong(number: number) { - return Long.fromNumber(number); - }${options.aminoEncoding?.customTypes?.useCosmosSDKDec ? ` -@@ -238,6 +290,7 @@ function numberToLong(number: number) { - export function padDecimal(decStr: string): string{ - return decStr ? new Dec(decStr).toString() : decStr; - } -+ - ` : ""} - `; - }; -diff --git a/node_modules/@cosmology/telescope/module/helpers/internalForBigInt.js b/node_modules/@cosmology/telescope/module/helpers/internalForBigInt.js -index ecb2e3e..4e96aff 100644 ---- a/node_modules/@cosmology/telescope/module/helpers/internalForBigInt.js -+++ b/node_modules/@cosmology/telescope/module/helpers/internalForBigInt.js -@@ -1,39 +1,9 @@ - export const internalForBigInt = ` --declare var self: any | undefined; --declare var window: any | undefined; --declare var global: any | undefined; --var globalThis: any = (() => { -- if (typeof globalThis !== 'undefined') return globalThis; -- if (typeof self !== 'undefined') return self; -- if (typeof window !== 'undefined') return window; -- if (typeof global !== 'undefined') return global; -- throw 'Unable to locate global object'; --})(); -- --const atob: (b64: string) => string = -- globalThis.atob || -- ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary')); -- --export function bytesFromBase64(b64: string): Uint8Array { -- const bin = atob(b64); -- const arr = new Uint8Array(bin.length); -- for (let i = 0; i < bin.length; ++i) { -- arr[i] = bin.charCodeAt(i); -- } -- return arr; --} -+import { encodeBase64, decodeBase64 } from '@endo/base64'; - --const btoa: (bin: string) => string = -- globalThis.btoa || -- ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64')); -- --export function base64FromBytes(arr: Uint8Array): string { -- const bin: string[] = []; -- arr.forEach((byte) => { -- bin.push(String.fromCharCode(byte)); -- }); -- return btoa(bin.join('')); --} -+// use Endo for broader compatibility -+export const bytesFromBase64: (input: string) => Uint8Array = decodeBase64; -+export const base64FromBytes: (input: Uint8Array) => string = encodeBase64; - - export interface AminoHeight { - readonly revision_number?: string; -diff --git a/node_modules/@cosmology/telescope/module/utils/index.js b/node_modules/@cosmology/telescope/module/utils/index.js -index aa561fd..21c4e00 100644 ---- a/node_modules/@cosmology/telescope/module/utils/index.js -+++ b/node_modules/@cosmology/telescope/module/utils/index.js -@@ -18,7 +18,7 @@ export const UTILS = { - bytesFromBase64: '__helpers__', - BrowserHeaders: 'browser-headers', - connectComet: '@cosmjs/tendermint-rpc', -- Decimal: '@cosmjs/math', -+ Decimal: '__helpers__', - padDecimal: '__helpers__', - createProtobufRpcClient: '@cosmjs/stargate', - Pubkey: '@cosmjs/amino', -diff --git a/node_modules/@cosmology/telescope/src/helpers/internal-for-bigint.ts b/node_modules/@cosmology/telescope/src/helpers/internal-for-bigint.ts -index f7daa3d..555ffda 100644 ---- a/node_modules/@cosmology/telescope/src/helpers/internal-for-bigint.ts -+++ b/node_modules/@cosmology/telescope/src/helpers/internal-for-bigint.ts -@@ -4,41 +4,11 @@ export const getHelperForBigint = (options: TelescopeOptions) => { - return `${options.aminoEncoding?.customTypes?.useCosmosSDKDec ? `import { Dec } from "@keplr-wallet/unit"; - - `: ""} --declare var self: any | undefined; --declare var window: any | undefined; --declare var global: any | undefined; --var globalThis: any = (() => { -- if (typeof globalThis !== 'undefined') return globalThis; -- if (typeof self !== 'undefined') return self; -- if (typeof window !== 'undefined') return window; -- if (typeof global !== 'undefined') return global; -- throw 'Unable to locate global object'; --})(); -- --const atob: (b64: string) => string = -- globalThis.atob || -- ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary')); -- --export function bytesFromBase64(b64: string): Uint8Array { -- const bin = atob(b64); -- const arr = new Uint8Array(bin.length); -- for (let i = 0; i < bin.length; ++i) { -- arr[i] = bin.charCodeAt(i); -- } -- return arr; --} -- --const btoa: (bin: string) => string = -- globalThis.btoa || -- ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64')); -+import { encodeBase64, decodeBase64 } from '@endo/base64'; - --export function base64FromBytes(arr: Uint8Array): string { -- const bin: string[] = []; -- arr.forEach((byte) => { -- bin.push(String.fromCharCode(byte)); -- }); -- return btoa(bin.join('')); --} -+// use Endo for broader compatibility -+export const bytesFromBase64: (input: string) => Uint8Array = decodeBase64; -+export const base64FromBytes: (input: Uint8Array) => string = encodeBase64; - - export interface AminoHeight { - readonly revision_number?: string; -@@ -251,6 +221,88 @@ export function fromJsonTimestamp(o: any): Timestamp { - function numberToLong(number: number) { - return BigInt(Math.trunc(number)); - } -+ -+// The largest value we need is 18 (Ether). -+const maxFractionalDigits = 30; -+// Subset of Decimal in @cosmjs/math -+/** -+ * A type for arbitrary precision, non-negative decimals. -+ * -+ * Instances of this class are immutable. -+ */ -+export class Decimal { -+ public static fromUserInput( -+ input: string, -+ fractionalDigits: number, -+ ): Decimal { -+ Decimal.verifyFractionalDigits(fractionalDigits); -+ -+ const badCharacter = input.match(/[^0-9.]/); -+ if (badCharacter) { -+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -+ throw new Error( -+ \`Invalid character at position \${badCharacter.index! + 1}\`, -+ ); -+ } -+ -+ let whole: string; -+ let fractional: string; -+ -+ if (input === '') { -+ whole = '0'; -+ fractional = ''; -+ } else if (input.search(/\./) === -1) { -+ // integer format, no separator -+ whole = input; -+ fractional = ''; -+ } else { -+ const parts = input.split('.'); -+ switch (parts.length) { -+ case 0: -+ case 1: -+ throw new Error( -+ 'Fewer than two elements in split result. This must not happen here.', -+ ); -+ case 2: -+ if (!parts[1]) throw new Error('Fractional part missing'); -+ whole = parts[0]; -+ fractional = parts[1].replace(/0+$/, ''); -+ break; -+ default: -+ throw new Error('More than one separator found'); -+ } -+ } -+ -+ if (fractional.length > fractionalDigits) { -+ throw new Error('Got more fractional digits than supported'); -+ } -+ -+ const quantity = \`\${whole}\${fractional.padEnd(fractionalDigits, '0')}\`; -+ -+ return new Decimal(quantity, fractionalDigits); -+ } -+ -+ public static fromAtomics( -+ atomics: string, -+ fractionalDigits: number, -+ ): Decimal { -+ Decimal.verifyFractionalDigits(fractionalDigits); -+ return new Decimal(atomics, fractionalDigits); -+ } -+ -+ private static verifyFractionalDigits(fractionalDigits: number): void { -+ if (!Number.isInteger(fractionalDigits)) -+ throw new Error('Fractional digits is not an integer'); -+ if (fractionalDigits < 0) -+ throw new Error('Fractional digits must not be negative'); -+ if (fractionalDigits > maxFractionalDigits) { -+ throw new Error( -+ \`Fractional digits must not exceed \${maxFractionalDigits}\`, -+ ); -+ } -+ } -+} -+ - ${ - options.aminoEncoding?.customTypes?.useCosmosSDKDec ? - ` -diff --git a/node_modules/@cosmology/telescope/src/helpers/internal.ts b/node_modules/@cosmology/telescope/src/helpers/internal.ts -index fc58715..98a1582 100644 ---- a/node_modules/@cosmology/telescope/src/helpers/internal.ts -+++ b/node_modules/@cosmology/telescope/src/helpers/internal.ts -@@ -4,6 +4,8 @@ export const getHelper = (options: TelescopeOptions) => { - return `import * as _m0 from "protobufjs/minimal"; - import Long from 'long';${options.aminoEncoding?.customTypes?.useCosmosSDKDec ? ` - import { Dec } from "@keplr-wallet/unit"; -+import { encodeBase64, decodeBase64 } from '@endo/base64'; -+ - `: ""} - - // @ts-ignore -@@ -15,39 +17,9 @@ if (_m0.util.Long !== Long) { - - export { Long }; - --declare var self: any | undefined; --declare var window: any | undefined; --declare var global: any | undefined; --var globalThis: any = (() => { -- if (typeof globalThis !== 'undefined') return globalThis; -- if (typeof self !== 'undefined') return self; -- if (typeof window !== 'undefined') return window; -- if (typeof global !== 'undefined') return global; -- throw 'Unable to locate global object'; --})(); -- --const atob: (b64: string) => string = -- globalThis.atob || ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary')); -- --export function bytesFromBase64(b64: string): Uint8Array { -- const bin = atob(b64); -- const arr = new Uint8Array(bin.length); -- for (let i = 0; i < bin.length; ++i) { -- arr[i] = bin.charCodeAt(i); -- } -- return arr; --} -- --const btoa: (bin: string) => string = -- globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64')); -- --export function base64FromBytes(arr: Uint8Array): string { -- const bin: string[] = []; -- arr.forEach((byte) => { -- bin.push(String.fromCharCode(byte)); -- }); -- return btoa(bin.join('')); --} -+// use Endo for broader compatibility -+export const bytesFromBase64: (input: string) => Uint8Array = decodeBase64; -+export const base64FromBytes: (input: Uint8Array) => string = encodeBase64; - - export interface AminoHeight { - readonly revision_number?: string; -@@ -233,6 +205,87 @@ export function fromJsonTimestamp(o: any): Timestamp { - } - } - -+// The largest value we need is 18 (Ether). -+const maxFractionalDigits = 30; -+// Subset of Decimal in @cosmjs/math -+/** -+ * A type for arbitrary precision, non-negative decimals. -+ * -+ * Instances of this class are immutable. -+ */ -+export class Decimal { -+ public static fromUserInput( -+ input: string, -+ fractionalDigits: number, -+ ): Decimal { -+ Decimal.verifyFractionalDigits(fractionalDigits); -+ -+ const badCharacter = input.match(/[^0-9.]/); -+ if (badCharacter) { -+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -+ throw new Error( -+ \`Invalid character at position \${badCharacter.index! + 1}\`, -+ ); -+ } -+ -+ let whole: string; -+ let fractional: string; -+ -+ if (input === '') { -+ whole = '0'; -+ fractional = ''; -+ } else if (input.search(/\./) === -1) { -+ // integer format, no separator -+ whole = input; -+ fractional = ''; -+ } else { -+ const parts = input.split('.'); -+ switch (parts.length) { -+ case 0: -+ case 1: -+ throw new Error( -+ 'Fewer than two elements in split result. This must not happen here.', -+ ); -+ case 2: -+ if (!parts[1]) throw new Error('Fractional part missing'); -+ whole = parts[0]; -+ fractional = parts[1].replace(/0+$/, ''); -+ break; -+ default: -+ throw new Error('More than one separator found'); -+ } -+ } -+ -+ if (fractional.length > fractionalDigits) { -+ throw new Error('Got more fractional digits than supported'); -+ } -+ -+ const quantity = \`\${whole}\${fractional.padEnd(fractionalDigits, '0')}\`; -+ -+ return new Decimal(quantity, fractionalDigits); -+ } -+ -+ public static fromAtomics( -+ atomics: string, -+ fractionalDigits: number, -+ ): Decimal { -+ Decimal.verifyFractionalDigits(fractionalDigits); -+ return new Decimal(atomics, fractionalDigits); -+ } -+ -+ private static verifyFractionalDigits(fractionalDigits: number): void { -+ if (!Number.isInteger(fractionalDigits)) -+ throw new Error('Fractional digits is not an integer'); -+ if (fractionalDigits < 0) -+ throw new Error('Fractional digits must not be negative'); -+ if (fractionalDigits > maxFractionalDigits) { -+ throw new Error( -+ \`Fractional digits must not exceed \${maxFractionalDigits}\`, -+ ); -+ } -+ } -+} -+ - function numberToLong(number: number) { - return Long.fromNumber(number); - }${options.aminoEncoding?.customTypes?.useCosmosSDKDec ? ` -diff --git a/node_modules/@cosmology/telescope/src/utils/index.ts b/node_modules/@cosmology/telescope/src/utils/index.ts -index 1ed202f..6d2cc38 100644 ---- a/node_modules/@cosmology/telescope/src/utils/index.ts -+++ b/node_modules/@cosmology/telescope/src/utils/index.ts -@@ -21,7 +21,7 @@ export const UTILS = { - bytesFromBase64: '__helpers__', - BrowserHeaders: 'browser-headers', - connectComet: '@cosmjs/tendermint-rpc', -- Decimal: '@cosmjs/math', -+ Decimal: '__helpers__', - padDecimal: '__helpers__', - createProtobufRpcClient: '@cosmjs/stargate', - Pubkey: '@cosmjs/amino', diff --git a/yarn.lock b/yarn.lock index c3eaa17b259..95eef5ed1d8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1296,34 +1296,35 @@ resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.32.3.tgz#5dcaee6dd7cc846cdc073e9a7a7f63242f5f7e31" integrity sha512-WCZK4yksj2hBDz4w7xFZQTRZQ/RJhBX26uFHmmQFIcNUUVAihrLO+RerqJgk0dZqC42wstM9pEUQGtPmLcIYvg== -"@cosmology/ast@^1.7.1": - version "1.7.1" - resolved "https://registry.yarnpkg.com/@cosmology/ast/-/ast-1.7.1.tgz#a93e38d08c1c35d6e209cb04e580cd2b325a1110" - integrity sha512-dLqKUpxy9G8iS4Imd9JRDnP6Ca7EkyiqWWwgZacBLLuFK0mIDed0Fb8JP85pExV26XTC/Un3Nhi8yWiNQlKakQ== +"@cosmology/ast@^1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@cosmology/ast/-/ast-1.8.1.tgz#35a32fc117b007d6f7c9f5dcc82613989d206883" + integrity sha512-wjJDf3qk0SLaJsS6KJJqQpz+0iLl4V8V1cE7HwgwZT3F4nhTLfyK/13NbJcf0MhEfQ7+tNKFnVJIJJGfUxTPKQ== dependencies: "@babel/types" "7.23.6" - "@cosmology/types" "^1.7.0" - "@cosmology/utils" "^1.7.0" + "@cosmology/types" "^1.8.1" + "@cosmology/utils" "^1.8.1" case "1.6.3" dotty "0.1.2" -"@cosmology/proto-parser@^1.7.0": - version "1.7.0" - resolved "https://registry.yarnpkg.com/@cosmology/proto-parser/-/proto-parser-1.7.0.tgz#8d7abd40a91ee26bd1cc0518a84d871216a35434" - integrity sha512-7qJmGNUUaFG6Y2OgpO1x/ro0t5yOs+bILYwV2lYmqqTDqGJU3FTPewxFMx9vTZ2SHeVTVG1iQgdZslmwmRX/iQ== +"@cosmology/proto-parser@^1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@cosmology/proto-parser/-/proto-parser-1.8.1.tgz#2b6d8864b9593e518b20cd5dacbbcc68bd028f16" + integrity sha512-XgvhZH2af/6lJRYO19ozbdKdNziJu4p6HTv4u4CmUAgUpVG/tSA81cXTOMM+nJo1PPrhtqh9Nad9ISwLePvx2A== dependencies: - "@cosmology/protobufjs" "6.11.6" - "@cosmology/types" "^1.7.0" - "@cosmology/utils" "^1.7.0" + "@cosmology/protobufjs" "7.3.2" + "@cosmology/types" "^1.8.1" + "@cosmology/utils" "^1.8.1" dotty "0.1.2" + fast-json-patch "3.1.1" glob "8.0.3" minimatch "5.1.0" mkdirp "3.0.0" -"@cosmology/protobufjs@6.11.6": - version "6.11.6" - resolved "https://registry.yarnpkg.com/@cosmology/protobufjs/-/protobufjs-6.11.6.tgz#6f7bd340ab4a27969b1f75b4bff21a74e03b971a" - integrity sha512-k1opGC9CTX5vD2447pUqLmleVv0Kb8RasBUxkZHudVOvuXs2qAAGONmMIEGRCROKTodhTY9fdTnGU2lCZqAwNw== +"@cosmology/protobufjs@7.3.2": + version "7.3.2" + resolved "https://registry.yarnpkg.com/@cosmology/protobufjs/-/protobufjs-7.3.2.tgz#6c2acdaec9e4b7aab4647bb236da1258e7526a87" + integrity sha512-zHf/yqGQ7QSjIYvv7kvGKY9yXNjqj55kWdRyntrXwnte/tY8uMTuCFD/EWC48LGhGu3P7nbzTlhyCGMc3xm9bw== dependencies: "@protobufjs/aspromise" "^1.1.2" "@protobufjs/base64" "^1.1.2" @@ -1335,23 +1336,22 @@ "@protobufjs/path" "^1.1.2" "@protobufjs/pool" "^1.1.0" "@protobufjs/utf8" "^1.1.0" - "@types/long" "^4.0.1" + "@types/long" "^5.0.0" "@types/node" ">=13.7.0" - long "^4.0.0" + long "^5.0.0" -"@cosmology/telescope@^1.7.1": - version "1.7.1" - resolved "https://registry.yarnpkg.com/@cosmology/telescope/-/telescope-1.7.1.tgz#1d4357bfc49c41a03c5fbe91fe60c028ffbdfcf6" - integrity sha512-mB/h8iGfVNi+ZV3KzEy6xFKVlAe9d9pOTz/Vu+OCMcrEFS/xHgWMs+eNDGAbWuaCp06qYyZSc0pN7rMVojnElg== +"@cosmology/telescope@https://gitpkg.vercel.app/agoric-labs/telescope/packages/telescope?8d2c2f6ba637a5578eead09a7368dc41c262a9d0": + version "1.8.3" + resolved "https://gitpkg.vercel.app/agoric-labs/telescope/packages/telescope?8d2c2f6ba637a5578eead09a7368dc41c262a9d0#6cbf7b95125ced918760fc7382bcf9b52b209923" dependencies: "@babel/generator" "^7.23.6" "@babel/parser" "^7.23.6" "@babel/traverse" "7.23.6" "@babel/types" "7.23.6" - "@cosmology/ast" "^1.7.1" - "@cosmology/proto-parser" "^1.7.0" - "@cosmology/types" "^1.7.0" - "@cosmology/utils" "^1.7.0" + "@cosmology/ast" "^1.8.1" + "@cosmology/proto-parser" "^1.8.1" + "@cosmology/types" "^1.8.1" + "@cosmology/utils" "^1.8.1" "@cosmwasm/ts-codegen" "0.35.7" "@types/parse-package-name" "0.1.0" case "1.6.3" @@ -1369,19 +1369,20 @@ rimraf "5.0.0" yaml "^2.3.4" -"@cosmology/types@^1.7.0": - version "1.7.0" - resolved "https://registry.yarnpkg.com/@cosmology/types/-/types-1.7.0.tgz#089b43227b0ae4e4799be2d2e1f1b71a0091d422" - integrity sha512-BdevNk957uA/I12mgp24Dp4lrfN4lOgb1xoSJTvlmOJuks1q+vcQHiRyVfncxE5aFRNCG6ROHHu9IFckBW07hQ== +"@cosmology/types@^1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@cosmology/types/-/types-1.8.1.tgz#782868b232a214b55f41908353be87afa79c9302" + integrity sha512-M/4HZZu0mNwwzK7ITa5A4biVKGVk8EtaQJlHuuctygKvjKcvmmAglna754o9CdkfPEyUXBzYnLU6q7UIFgcO+g== dependencies: case "1.6.3" + fast-json-patch "3.1.1" -"@cosmology/utils@^1.7.0": - version "1.7.0" - resolved "https://registry.yarnpkg.com/@cosmology/utils/-/utils-1.7.0.tgz#7a09bee4d4fa65f1049dcb5a88939fe55fbbd5d4" - integrity sha512-TLaRenW/CTy8wo8z3mvSq0koM9XwL2aLcmdZEWUqhhVyUA0VOfDloh+3d/oLQxsBBzAiaDauX+wju3dkrY8moA== +"@cosmology/utils@^1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@cosmology/utils/-/utils-1.8.1.tgz#9fd7f0815da726f7a2a11d713f7e8886f94f0a6b" + integrity sha512-PrZffk81GQ0pJHH7kRJi9PZVt4qWa/9V3mbUyc3vXIWqeAk1bQ+5O5MLKirtRj4cEM3zt5WnDUISPCrt4VIQkA== dependencies: - "@cosmology/types" "^1.7.0" + "@cosmology/types" "^1.8.1" dotty "0.1.2" "@cosmwasm/ts-codegen@0.35.7": @@ -3552,10 +3553,12 @@ resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.202.tgz#f09dbd2fb082d507178b2f2a5c7e74bd72ff98f8" integrity sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ== -"@types/long@^4.0.1": - version "4.0.2" - resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a" - integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA== +"@types/long@^5.0.0": + version "5.0.0" + resolved "https://registry.yarnpkg.com/@types/long/-/long-5.0.0.tgz#daaa7b7f74c919c946ff74889d5ca2afe363b2cd" + integrity sha512-eQs9RsucA/LNjnMoJvWG/nXa7Pot/RbBzilF/QRIU/xRl+0ApxrSUFsV5lmf01SvSlqMzJ7Zwxe440wmz2SJGA== + dependencies: + long "*" "@types/mdast@^4.0.0": version "4.0.4" @@ -6354,6 +6357,11 @@ fast-glob@3.2.7: merge2 "^1.3.0" micromatch "^4.0.4" +fast-json-patch@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/fast-json-patch/-/fast-json-patch-3.1.1.tgz#85064ea1b1ebf97a3f7ad01e23f9337e72c66947" + integrity sha512-vf6IHUX2SBcA+5/+4883dsIjpBTqmfBjmYiWK1savxQmFk4JfBMLa7ynTYOs1Rolp/T1betJxHiGD3g1Mn8lUQ== + fast-json-stable-stringify@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" @@ -8188,12 +8196,7 @@ logform@^2.2.0, logform@^2.3.2: safe-stable-stringify "^2.3.1" triple-beam "^1.3.0" -long@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" - integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== - -long@^5.0.0, long@^5.2.0, long@^5.2.1: +long@*, long@^5.0.0, long@^5.2.0, long@^5.2.1: version "5.2.3" resolved "https://registry.yarnpkg.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1" integrity sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q== From cbad08de1be3b9db2a13730945930bfc7d5b87a8 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Thu, 12 Sep 2024 13:07:04 -0700 Subject: [PATCH 06/10] test: ibc-mocks decoding --- packages/orchestration/test/ibc-mocks.test.ts | 92 +++++++++++------- .../test/snapshots/ibc-mocks.test.ts.md | 23 +++++ .../test/snapshots/ibc-mocks.test.ts.snap | Bin 0 -> 602 bytes 3 files changed, 80 insertions(+), 35 deletions(-) create mode 100644 packages/orchestration/test/snapshots/ibc-mocks.test.ts.md create mode 100644 packages/orchestration/test/snapshots/ibc-mocks.test.ts.snap diff --git a/packages/orchestration/test/ibc-mocks.test.ts b/packages/orchestration/test/ibc-mocks.test.ts index 6703d7ffa5a..b970e0511d9 100644 --- a/packages/orchestration/test/ibc-mocks.test.ts +++ b/packages/orchestration/test/ibc-mocks.test.ts @@ -7,6 +7,10 @@ import { MsgDelegate, MsgDelegateResponse, } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/tx.js'; +import { + CosmosQuery, + CosmosResponse, +} from '@agoric/cosmic-proto/icq/v1/packet.js'; import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import { buildMsgErrorString, @@ -14,6 +18,7 @@ import { buildQueryPacketString, buildQueryResponseString, buildTxPacketString, + parseOutgoingTxPacket, } from '../tools/ibc-mocks.js'; test('buildMsgResponseString matches observed values in e2e testing', t => { @@ -49,47 +54,64 @@ test('buildQueryResponseString matches observed values in e2e testing', t => { }); test('build Tx Packet', t => { - t.is( - buildTxPacketString([ - MsgDelegate.toProtoMsg({ - amount: { - denom: 'uatom', - amount: '10', - }, - delegatorAddress: 'cosmos1test', - validatorAddress: 'cosmosvaloper1test', - }), - ]), - 'eyJ0eXBlIjoxLCJkYXRhIjoiQ2xVS0l5OWpiM050YjNNdWMzUmhhMmx1Wnk1Mk1XSmxkR0V4TGsxelowUmxiR1ZuWVhSbEVpNEtDMk52YzIxdmN6RjBaWE4wRWhKamIzTnRiM04yWVd4dmNHVnlNWFJsYzNRYUN3b0ZkV0YwYjIwU0FqRXciLCJtZW1vIjoiIn0=', - ); + const obj = { + amount: { + denom: 'uatom', + amount: '10', + }, + delegatorAddress: 'cosmos1test', + validatorAddress: 'cosmosvaloper1test', + }; + const encoded = buildTxPacketString([MsgDelegate.toProtoMsg(obj)]); + t.snapshot(encoded); + + const parsed = parseOutgoingTxPacket(encoded); + const decoded = MsgDelegate.decode(parsed.messages[0].value); + t.deepEqual(decoded, obj); }); test('build Query Packet', t => { - t.is( - buildQueryPacketString([ - QueryBalanceRequest.toProtoMsg({ - address: 'cosmos1test', - denom: 'uatom', - }), - ]), - 'eyJkYXRhIjoiQ2pvS0ZBb0xZMjl6Ylc5ek1YUmxjM1FTQlhWaGRHOXRFaUl2WTI5emJXOXpMbUpoYm1zdWRqRmlaWFJoTVM1UmRXVnllUzlDWVd4aGJtTmwiLCJtZW1vIjoiIn0=', + const obj = { + address: 'cosmos1test', + denom: 'uatom', + }; + const b64 = buildQueryPacketString([QueryBalanceRequest.toProtoMsg(obj)]); + t.snapshot(b64); + + const { data } = JSON.parse(atob(b64)); + const decodedQuery = CosmosQuery.decode(Buffer.from(data, 'base64')); + const decodedRequest = QueryBalanceRequest.decode( + decodedQuery.requests[0].data, ); + t.deepEqual(decodedRequest, obj); }); -test('build QueryDelegatorDelegationsResponse', t => { - t.is( - buildQueryResponseString(QueryDelegatorDelegationsResponse, { - delegationResponses: [ - { - delegation: { - delegatorAddress: 'cosmos1test', - validatorAddress: 'cosmosvaloper1test', - shares: '1000000', - }, - balance: { denom: 'uatom', amount: '1000000' }, +test('build Query Response', t => { + const obj = { + delegationResponses: [ + { + delegation: { + delegatorAddress: 'cosmos1test', + validatorAddress: 'cosmosvaloper1test', + shares: '1000000', }, - ], - }), - 'eyJyZXN1bHQiOiJleUprWVhSaElqb2lRMnhSZVZWbmNGRkRhbmRMUXpKT2RtTXlNWFpqZWtZd1dsaE9NRVZvU21waU0wNTBZak5PTWxsWGVIWmpSMVo1VFZoU2JHTXpVV0ZIVkVWM1RVUkJkMDFFUVhkTlJFRjNUVVJCZDAxRVFYZE5SRUYzVFVSQmQwMUVRVk5GUVc5R1pGZEdNR0l5TUZOQ2VrVjNUVVJCZDAxRVFUMGlmUT09In0=', + balance: { denom: 'uatom', amount: '1000000' }, + }, + ], + }; + const encoded = buildQueryResponseString( + QueryDelegatorDelegationsResponse, + obj, ); + t.snapshot(encoded); + + const { result } = JSON.parse(atob(encoded)); + const { data } = JSON.parse(atob(result)); + const cosmosResponse = CosmosResponse.decode(Buffer.from(data, 'base64')); + const decodedResponseKey = cosmosResponse.responses[0].key; + + t.deepEqual(QueryDelegatorDelegationsResponse.decode(decodedResponseKey), { + ...obj, + pagination: undefined, + }); }); diff --git a/packages/orchestration/test/snapshots/ibc-mocks.test.ts.md b/packages/orchestration/test/snapshots/ibc-mocks.test.ts.md new file mode 100644 index 00000000000..3c44283847e --- /dev/null +++ b/packages/orchestration/test/snapshots/ibc-mocks.test.ts.md @@ -0,0 +1,23 @@ +# Snapshot report for `test/ibc-mocks.test.ts` + +The actual snapshot is saved in `ibc-mocks.test.ts.snap`. + +Generated by [AVA](https://avajs.dev). + +## build Tx Packet + +> Snapshot 1 + + 'eyJ0eXBlIjoxLCJkYXRhIjoiQ2xVS0l5OWpiM050YjNNdWMzUmhhMmx1Wnk1Mk1XSmxkR0V4TGsxelowUmxiR1ZuWVhSbEVpNEtDMk52YzIxdmN6RjBaWE4wRWhKamIzTnRiM04yWVd4dmNHVnlNWFJsYzNRYUN3b0ZkV0YwYjIwU0FqRXciLCJtZW1vIjoiIn0=' + +## build Query Packet + +> Snapshot 1 + + 'eyJkYXRhIjoiQ2pvS0ZBb0xZMjl6Ylc5ek1YUmxjM1FTQlhWaGRHOXRFaUl2WTI5emJXOXpMbUpoYm1zdWRqRmlaWFJoTVM1UmRXVnllUzlDWVd4aGJtTmwiLCJtZW1vIjoiIn0=' + +## build Query Response + +> Snapshot 1 + + 'eyJyZXN1bHQiOiJleUprWVhSaElqb2lRMnhSZVZWbmNGRkRhbmRMUXpKT2RtTXlNWFpqZWtZd1dsaE9NRVZvU21waU0wNTBZak5PTWxsWGVIWmpSMVo1VFZoU2JHTXpVV0ZIVkVWM1RVUkJkMDFFUVhkTlJFRjNUVVJCZDAxRVFYZE5SRUYzVFVSQmQwMUVRVk5GUVc5R1pGZEdNR0l5TUZOQ2VrVjNUVVJCZDAxRVFUMGlmUT09In0=' diff --git a/packages/orchestration/test/snapshots/ibc-mocks.test.ts.snap b/packages/orchestration/test/snapshots/ibc-mocks.test.ts.snap new file mode 100644 index 0000000000000000000000000000000000000000..0464dbf7c877dfffdac8847030b5dd166065c870 GIT binary patch literal 602 zcmV-g0;T;yRzV{R#lN8Xpc&YSeH)Y%mquO5<} z%KNgbleR0GzWef&Wl5hzzuwL+XVYE0o4tSYbC#cclt&BgRn2&R>#I1Tg;zD@)*2y1 z+TMt^B*;c_6$F_eXKspum=TLwVWMypno&^%bLMtquA70Iv7}f&3Mj&K1#PhEmqgiC zeD=o71lP1$Bw{rms3`6dPn0ogn=!5V5E2*>Z@b3kJrd`OX0fZ`#pyn!QU zPorIVf9v;B;N#TOtI@}Q_`_fP_Ax)4UiE)};r}-IpPAcZh~y$gqa>BSj`hyY6^^+X zD}o)i)rCl0y52<8Nw~HI^X%OC(I#q1%G)M3_?!v4r$#5j@f!vNb3-GjwdQBNoQ#R< z_sk5h8T#i2ns;qeclm#c_~P;fb`(GakOOqBh=#MlWJJYm|9K!d@N z4Y&L?i&_9AJy0MBroff2$kK5*6pCrzp;f>E{9C#FG*WP4xw1pb<1;uAZq0Te94IK; o<*>6UZe6*`0*bWFxZG?lIKaz1C$2V}p_^&8Kl@5E^#KC_01=fc0{{R3 literal 0 HcmV?d00001 From c1c5a6fd2f347b96d1e514bd0bf98550639e349f Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Thu, 12 Sep 2024 12:56:05 -0700 Subject: [PATCH 07/10] chore(types): accomodate new Telescope --- packages/cosmic-proto/test/helpers.test-d.ts | 3 +-- .../orchestration/src/exos/local-orchestration-account.js | 6 ++++-- packages/orchestration/src/typeGuards.js | 5 ++++- packages/vats/tools/fake-bridge.js | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/cosmic-proto/test/helpers.test-d.ts b/packages/cosmic-proto/test/helpers.test-d.ts index 63933043cb8..dbeafd4af4b 100644 --- a/packages/cosmic-proto/test/helpers.test-d.ts +++ b/packages/cosmic-proto/test/helpers.test-d.ts @@ -69,6 +69,5 @@ import type { Timestamp } from '../src/codegen/google/protobuf/timestamp.js'; null as any; expectType(response.completionTime); const responseJson: JsonSafe = null as any; - // FIXME: should be a string. UNTIL: github.com/cosmology-tech/telescope/pull/632 - expectType(responseJson.completionTime.seconds); + expectType(responseJson.completionTime.seconds); } diff --git a/packages/orchestration/src/exos/local-orchestration-account.js b/packages/orchestration/src/exos/local-orchestration-account.js index a17c4d4063c..7fda8a8733b 100644 --- a/packages/orchestration/src/exos/local-orchestration-account.js +++ b/packages/orchestration/src/exos/local-orchestration-account.js @@ -387,8 +387,10 @@ export const prepareLocalOrchestrationAccountKit = ( */ queryBalancesWatcher: { /** - * @param {ResponseTo< - * TypedJson<'/cosmos.bank.v1beta1.QueryAllBalancesRequest'> + * @param {JsonSafe< + * ResponseTo< + * TypedJson<'/cosmos.bank.v1beta1.QueryAllBalancesRequest'> + * > * >} result * @returns {DenomAmount[]} */ diff --git a/packages/orchestration/src/typeGuards.js b/packages/orchestration/src/typeGuards.js index 4c3255dbbdf..deb4ea802c9 100644 --- a/packages/orchestration/src/typeGuards.js +++ b/packages/orchestration/src/typeGuards.js @@ -160,8 +160,11 @@ export const chainFacadeMethods = harden({ /** * for google/protobuf/timestamp.proto, not to be confused with TimestampShape * from `@agoric/time` + * + * `seconds` is a big integer but since it goes through JSON it is encoded as + * string */ -export const TimestampProtoShape = { seconds: M.nat(), nanos: M.number() }; +export const TimestampProtoShape = { seconds: M.string(), nanos: M.number() }; /** * see {@link TxBody} for more details diff --git a/packages/vats/tools/fake-bridge.js b/packages/vats/tools/fake-bridge.js index 32e3ee6575c..36c39af8d37 100644 --- a/packages/vats/tools/fake-bridge.js +++ b/packages/vats/tools/fake-bridge.js @@ -218,7 +218,7 @@ export const fakeLocalChainBridgeTxMsgHandler = (message, sequence) => { case '/cosmos.staking.v1beta1.MsgUndelegate': { return /** @type {JsonSafe} */ ({ // 5 seconds from unix epoch - completionTime: { seconds: 5n, nanos: 0 }, + completionTime: { seconds: '5', nanos: 0 }, }); } // returns one empty object per message unless specified From 3b2612ff72002ac5cd7720c1cf65615e3b56fcff Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 10 Sep 2024 15:46:50 -0700 Subject: [PATCH 08/10] chore: drop node-fetch-shim Node 18 provides it globally --- packages/agoric-cli/src/bin-agops.js | 1 - packages/agoric-cli/src/entrypoint.js | 1 - packages/agoric-cli/test/main.test.js | 1 - packages/casting/README.md | 1 - packages/casting/node-fetch-shim.js | 7 ------- packages/casting/test/lockdown.js | 1 - packages/casting/test/mvp.test.js | 2 +- 7 files changed, 1 insertion(+), 13 deletions(-) delete mode 100644 packages/casting/node-fetch-shim.js diff --git a/packages/agoric-cli/src/bin-agops.js b/packages/agoric-cli/src/bin-agops.js index 7e9841e4c1b..445589a8cb1 100755 --- a/packages/agoric-cli/src/bin-agops.js +++ b/packages/agoric-cli/src/bin-agops.js @@ -6,7 +6,6 @@ import '@endo/init/pre.js'; -import '@agoric/casting/node-fetch-shim.js'; import '@endo/init'; import { E } from '@endo/far'; diff --git a/packages/agoric-cli/src/entrypoint.js b/packages/agoric-cli/src/entrypoint.js index c90ac5f0406..f921a2340ac 100755 --- a/packages/agoric-cli/src/entrypoint.js +++ b/packages/agoric-cli/src/entrypoint.js @@ -5,7 +5,6 @@ import '@endo/init/pre.js'; import 'esm'; -import '@agoric/casting/node-fetch-shim.js'; import '@endo/init/legacy.js'; import path from 'path'; diff --git a/packages/agoric-cli/test/main.test.js b/packages/agoric-cli/test/main.test.js index 88219733fae..d2b17a170a5 100644 --- a/packages/agoric-cli/test/main.test.js +++ b/packages/agoric-cli/test/main.test.js @@ -1,5 +1,4 @@ /* global globalThis */ -import '@agoric/casting/node-fetch-shim.js'; import '@endo/init/pre.js'; import 'esm'; import '@endo/init/debug.js'; diff --git a/packages/casting/README.md b/packages/casting/README.md index a04be102d63..6f7fa9e5f42 100644 --- a/packages/casting/README.md +++ b/packages/casting/README.md @@ -13,7 +13,6 @@ An example of following an on-chain mailbox in code (using this package) is: ```js // First, obtain a Hardened JS environment via Endo. import '@endo/init/pre-remoting.js'; // needed only for the next line -import '@agoric/casting/node-fetch-shim.js'; // needed for Node.js import '@endo/init'; import { diff --git a/packages/casting/node-fetch-shim.js b/packages/casting/node-fetch-shim.js deleted file mode 100644 index 73636b7b9b7..00000000000 --- a/packages/casting/node-fetch-shim.js +++ /dev/null @@ -1,7 +0,0 @@ -// @jessie-check - -/* global globalThis */ -import fetch from 'node-fetch'; - -// @ts-expect-error node-fetch does not exactly match W3C Fetch -globalThis.fetch = fetch; diff --git a/packages/casting/test/lockdown.js b/packages/casting/test/lockdown.js index f597abccf3d..a072eab0b40 100644 --- a/packages/casting/test/lockdown.js +++ b/packages/casting/test/lockdown.js @@ -1,3 +1,2 @@ import '@endo/init/pre-remoting.js'; -import '../node-fetch-shim.js'; import '@endo/init'; diff --git a/packages/casting/test/mvp.test.js b/packages/casting/test/mvp.test.js index 123ba4eda5e..3a05b6abb73 100644 --- a/packages/casting/test/mvp.test.js +++ b/packages/casting/test/mvp.test.js @@ -155,7 +155,7 @@ test('missing rpc server', async t => { jitter: null, }), { - message: /^invalid json response body/, + message: /^Unexpected token/, }, ); }); From 2f31c0063e38cc4c2b243ff5ea9821263bdf6e8b Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 10 Sep 2024 15:49:46 -0700 Subject: [PATCH 09/10] refactor: use Node global fetch --- a3p-integration/proposals/s:stake-bld/test-lib/index.js | 3 +-- multichain-testing/scripts/fetch-starship-chain-info.ts | 4 +--- packages/deployment/src/entrypoint.js | 5 ++--- packages/solo/src/add-chain.js | 3 +-- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/a3p-integration/proposals/s:stake-bld/test-lib/index.js b/a3p-integration/proposals/s:stake-bld/test-lib/index.js index 4e301fd9863..25e8a22265c 100644 --- a/a3p-integration/proposals/s:stake-bld/test-lib/index.js +++ b/a3p-integration/proposals/s:stake-bld/test-lib/index.js @@ -1,5 +1,4 @@ -/* global setTimeout */ -import fetch from 'node-fetch'; +/* eslint-env node */ import { execFileSync } from 'child_process'; import { makeWalletUtils } from './wallet.js'; diff --git a/multichain-testing/scripts/fetch-starship-chain-info.ts b/multichain-testing/scripts/fetch-starship-chain-info.ts index 5ffa1bc79ad..e660039cad2 100755 --- a/multichain-testing/scripts/fetch-starship-chain-info.ts +++ b/multichain-testing/scripts/fetch-starship-chain-info.ts @@ -1,6 +1,6 @@ #!/usr/bin/env tsx +/* eslint-env node */ -import nodeFetch from 'node-fetch'; import fsp from 'node:fs/promises'; import prettier from 'prettier'; @@ -8,8 +8,6 @@ import { convertChainInfo } from '@agoric/orchestration/src/utils/registry.js'; import type { IBCInfo, Chains } from '@chain-registry/types'; -const fetch = nodeFetch.default; - /** * Chain registry running in Starship * diff --git a/packages/deployment/src/entrypoint.js b/packages/deployment/src/entrypoint.js index 2df1b243c84..c5ab08dfd4d 100755 --- a/packages/deployment/src/entrypoint.js +++ b/packages/deployment/src/entrypoint.js @@ -1,5 +1,5 @@ #! /usr/bin/env node -/* global setInterval */ +/* eslint-env node */ import '@endo/init'; @@ -9,7 +9,6 @@ import temp from 'temp'; import process from 'process'; import { exec, spawn } from 'child_process'; import inquirer from 'inquirer'; -import fetch from 'node-fetch'; import { running } from './run.js'; import { setup } from './setup.js'; @@ -22,7 +21,7 @@ deploy(process.argv[1], process.argv.splice(2), { rd: files.reading(fs, path), wr: files.writing(fs, path, temp), setup: setup({ resolve: path.resolve, env: process.env, setInterval }), - running: running(process, { exec, process, spawn }), + running: running(process, { exec, spawn }), inquirer, fetch, }).then( diff --git a/packages/solo/src/add-chain.js b/packages/solo/src/add-chain.js index 39aab2f9b3a..d72095ff007 100644 --- a/packages/solo/src/add-chain.js +++ b/packages/solo/src/add-chain.js @@ -1,5 +1,4 @@ -/* global process */ -import fetch from 'node-fetch'; +/* eslint-env node */ import crypto from 'crypto'; import djson from 'deterministic-json'; import path from 'path'; From ad67dbeb7fc60c35f5d2431ac5c7c52514351f8c Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 10 Sep 2024 15:51:54 -0700 Subject: [PATCH 10/10] chore(deps): remove node-fetch using the Node 18 native one instead --- .../proposals/s:stake-bld/package.json | 3 +- .../proposals/s:stake-bld/yarn.lock | 52 ------------------- multichain-testing/package.json | 1 - multichain-testing/yarn.lock | 8 +-- packages/casting/package.json | 4 +- packages/deployment/package.json | 1 - packages/solo/package.json | 1 - yarn.lock | 19 +------ 8 files changed, 7 insertions(+), 82 deletions(-) diff --git a/a3p-integration/proposals/s:stake-bld/package.json b/a3p-integration/proposals/s:stake-bld/package.json index 190e40882f6..888bc5736f4 100644 --- a/a3p-integration/proposals/s:stake-bld/package.json +++ b/a3p-integration/proposals/s:stake-bld/package.json @@ -18,8 +18,7 @@ "@endo/init": "^1.0.4", "agoric": "0.21.2-dev-5676146.0", "ava": "^5.3.1", - "execa": "^8.0.1", - "node-fetch": "^3.3.2" + "execa": "^8.0.1" }, "ava": { "concurrency": 1 diff --git a/a3p-integration/proposals/s:stake-bld/yarn.lock b/a3p-integration/proposals/s:stake-bld/yarn.lock index 46e7264cf6c..8c9004f426c 100644 --- a/a3p-integration/proposals/s:stake-bld/yarn.lock +++ b/a3p-integration/proposals/s:stake-bld/yarn.lock @@ -2394,13 +2394,6 @@ __metadata: languageName: node linkType: hard -"data-uri-to-buffer@npm:^4.0.0": - version: 4.0.1 - resolution: "data-uri-to-buffer@npm:4.0.1" - checksum: 10c0/20a6b93107597530d71d4cb285acee17f66bcdfc03fd81040921a81252f19db27588d87fc8fc69e1950c55cfb0bf8ae40d0e5e21d907230813eb5d5a7f9eb45b - languageName: node - linkType: hard - "date-time@npm:^3.1.0": version: 3.1.0 resolution: "date-time@npm:3.1.0" @@ -2773,16 +2766,6 @@ __metadata: languageName: node linkType: hard -"fetch-blob@npm:^3.1.2, fetch-blob@npm:^3.1.4": - version: 3.2.0 - resolution: "fetch-blob@npm:3.2.0" - dependencies: - node-domexception: "npm:^1.0.0" - web-streams-polyfill: "npm:^3.0.3" - checksum: 10c0/60054bf47bfa10fb0ba6cb7742acec2f37c1f56344f79a70bb8b1c48d77675927c720ff3191fa546410a0442c998d27ab05e9144c32d530d8a52fbe68f843b69 - languageName: node - linkType: hard - "figures@npm:^3.0.0": version: 3.2.0 resolution: "figures@npm:3.2.0" @@ -2866,15 +2849,6 @@ __metadata: languageName: node linkType: hard -"formdata-polyfill@npm:^4.0.10": - version: 4.0.10 - resolution: "formdata-polyfill@npm:4.0.10" - dependencies: - fetch-blob: "npm:^3.1.2" - checksum: 10c0/5392ec484f9ce0d5e0d52fb5a78e7486637d516179b0eb84d81389d7eccf9ca2f663079da56f761355c0a65792810e3b345dc24db9a8bbbcf24ef3c8c88570c6 - languageName: node - linkType: hard - "fs-constants@npm:^1.0.0": version: 1.0.0 resolution: "fs-constants@npm:1.0.0" @@ -3989,13 +3963,6 @@ __metadata: languageName: node linkType: hard -"node-domexception@npm:^1.0.0": - version: 1.0.0 - resolution: "node-domexception@npm:1.0.0" - checksum: 10c0/5e5d63cda29856402df9472335af4bb13875e1927ad3be861dc5ebde38917aecbf9ae337923777af52a48c426b70148815e890a5d72760f1b4d758cc671b1a2b - languageName: node - linkType: hard - "node-fetch@npm:^2.6.0": version: 2.7.0 resolution: "node-fetch@npm:2.7.0" @@ -4010,17 +3977,6 @@ __metadata: languageName: node linkType: hard -"node-fetch@npm:^3.3.2": - version: 3.3.2 - resolution: "node-fetch@npm:3.3.2" - dependencies: - data-uri-to-buffer: "npm:^4.0.0" - fetch-blob: "npm:^3.1.4" - formdata-polyfill: "npm:^4.0.10" - checksum: 10c0/f3d5e56190562221398c9f5750198b34cf6113aa304e34ee97c94fd300ec578b25b2c2906edba922050fce983338fde0d5d34fcb0fc3336ade5bd0e429ad7538 - languageName: node - linkType: hard - "node-gyp-build@npm:^4.4.0": version: 4.8.0 resolution: "node-gyp-build@npm:4.8.0" @@ -4592,7 +4548,6 @@ __metadata: agoric: "npm:0.21.2-dev-5676146.0" ava: "npm:^5.3.1" execa: "npm:^8.0.1" - node-fetch: "npm:^3.3.2" languageName: unknown linkType: soft @@ -5207,13 +5162,6 @@ __metadata: languageName: node linkType: hard -"web-streams-polyfill@npm:^3.0.3": - version: 3.3.3 - resolution: "web-streams-polyfill@npm:3.3.3" - checksum: 10c0/64e855c47f6c8330b5436147db1c75cb7e7474d924166800e8e2aab5eb6c76aac4981a84261dd2982b3e754490900b99791c80ae1407a9fa0dcff74f82ea3a7f - languageName: node - linkType: hard - "webidl-conversions@npm:^3.0.0": version: 3.0.1 resolution: "webidl-conversions@npm:3.0.1" diff --git a/multichain-testing/package.json b/multichain-testing/package.json index 781b7825dc3..158a9a46829 100644 --- a/multichain-testing/package.json +++ b/multichain-testing/package.json @@ -42,7 +42,6 @@ "typescript": "^5.3.3" }, "resolutions": { - "node-fetch": "2.6.12", "axios": "1.6.7" }, "ava": { diff --git a/multichain-testing/yarn.lock b/multichain-testing/yarn.lock index 37e3e4fd458..0f1b49cdc29 100644 --- a/multichain-testing/yarn.lock +++ b/multichain-testing/yarn.lock @@ -3312,9 +3312,9 @@ __metadata: languageName: node linkType: hard -"node-fetch@npm:2.6.12": - version: 2.6.12 - resolution: "node-fetch@npm:2.6.12" +"node-fetch@npm:^2.6.12, node-fetch@npm:^2.6.7, node-fetch@npm:^2.6.9": + version: 2.7.0 + resolution: "node-fetch@npm:2.7.0" dependencies: whatwg-url: "npm:^5.0.0" peerDependencies: @@ -3322,7 +3322,7 @@ __metadata: peerDependenciesMeta: encoding: optional: true - checksum: 10c0/10372e4b5ee07acadc15e6b2bc6fd8940582eea7b9b2a331f4e3665fdcd968498c1656f79f2fa572080ebb37ea80e1474a6478b3b36057ef901b63f4be8fd899 + checksum: 10c0/b55786b6028208e6fbe594ccccc213cab67a72899c9234eb59dba51062a299ea853210fcf526998eaa2867b0963ad72338824450905679ff0fa304b8c5093ae8 languageName: node linkType: hard diff --git a/packages/casting/package.json b/packages/casting/package.json index 270af2dfd1d..018c146c0ab 100644 --- a/packages/casting/package.json +++ b/packages/casting/package.json @@ -34,13 +34,11 @@ "@endo/init": "^1.1.4", "@endo/lockdown": "^1.0.10", "@endo/marshal": "^1.5.3", - "@endo/promise-kit": "^1.1.5", - "node-fetch": "^2.6.0" + "@endo/promise-kit": "^1.1.5" }, "devDependencies": { "@agoric/cosmic-proto": "^0.4.0", "@endo/ses-ava": "^1.2.5", - "@types/node-fetch": "^2.6.2", "ava": "^5.3.0", "c8": "^9.1.0", "express": "^4.17.1", diff --git a/packages/deployment/package.json b/packages/deployment/package.json index c49d11c185b..1e9c88687f7 100644 --- a/packages/deployment/package.json +++ b/packages/deployment/package.json @@ -27,7 +27,6 @@ "deterministic-json": "^1.0.5", "inquirer": "^8.2.2", "minimist": "^1.2.0", - "node-fetch": "^2.6.0", "temp": "^0.9.0" }, "publishConfig": { diff --git a/packages/solo/package.json b/packages/solo/package.json index 110bd0210d1..f55de934e9e 100644 --- a/packages/solo/package.json +++ b/packages/solo/package.json @@ -50,7 +50,6 @@ "import-meta-resolve": "^2.2.1", "minimist": "^1.2.0", "morgan": "^1.10.0", - "node-fetch": "^2.6.0", "temp": "^0.9.1", "tmp": "^0.2.1", "ws": "^7.2.0" diff --git a/yarn.lock b/yarn.lock index 95eef5ed1d8..ca29a62266d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3609,14 +3609,6 @@ dependencies: "@types/node" "*" -"@types/node-fetch@^2.6.2": - version "2.6.2" - resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.2.tgz#d1a9c5fd049d9415dce61571557104dec3ec81da" - integrity sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A== - dependencies: - "@types/node" "*" - form-data "^3.0.0" - "@types/node@*", "@types/node@>=13.7.0", "@types/node@^18.19.24": version "18.19.24" resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.24.tgz#707d8a4907e55901466e60e8f7a62bc6197ace95" @@ -6538,15 +6530,6 @@ foreground-child@^3.1.0, foreground-child@^3.1.1: cross-spawn "^7.0.0" signal-exit "^4.0.1" -form-data@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" - integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" @@ -9069,7 +9052,7 @@ node-addon-api@^6.1.0: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-6.1.0.tgz#ac8470034e58e67d0c6f1204a18ae6995d9c0d76" integrity sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA== -node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.12, node-fetch@^2.6.7: +node-fetch@^2.6.1, node-fetch@^2.6.12, node-fetch@^2.6.7: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==