From 1745c3dd079a0462dfbc4bfd22d32f836d009409 Mon Sep 17 00:00:00 2001 From: Paul Noel Date: Thu, 23 May 2024 11:59:12 -0500 Subject: [PATCH] clients/js: upgrade typescript version --- clients/js/package-lock.json | 75 ++++---------------------------- clients/js/package.json | 2 +- clients/js/src/cmds/sui/setup.ts | 2 +- clients/js/src/injective.ts | 20 ++++++--- clients/js/tsconfig.json | 1 + 5 files changed, 24 insertions(+), 76 deletions(-) diff --git a/clients/js/package-lock.json b/clients/js/package-lock.json index 382f563528..0c7e07ec29 100644 --- a/clients/js/package-lock.json +++ b/clients/js/package-lock.json @@ -56,7 +56,7 @@ "copy-dir": "^1.3.0", "jest": "^29.7.0", "ts-jest": "^29.1.2", - "typescript": "^4.6" + "typescript": "^5.4.5" } }, "node_modules/@0no-co/graphql.web": { @@ -6921,19 +6921,6 @@ "typescript": "^4.9.4 || ^5.0.0" } }, - "node_modules/@wormhole-foundation/sdk-sui-core/node_modules/typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/@wormhole-foundation/sdk-sui-tokenbridge": { "version": "0.6.7", "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-sui-tokenbridge/-/sdk-sui-tokenbridge-0.6.7.tgz", @@ -7107,19 +7094,6 @@ "typescript": "^4.9.4 || ^5.0.0" } }, - "node_modules/@wormhole-foundation/sdk-sui-tokenbridge/node_modules/typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/@wormhole-foundation/sdk-sui/node_modules/@0no-co/graphqlsp": { "version": "1.12.3", "resolved": "https://registry.npmjs.org/@0no-co/graphqlsp/-/graphqlsp-1.12.3.tgz", @@ -7279,19 +7253,6 @@ "typescript": "^4.9.4 || ^5.0.0" } }, - "node_modules/@wormhole-foundation/sdk-sui/node_modules/typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/@wry/context": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/@wry/context/-/context-0.7.0.tgz", @@ -14350,16 +14311,15 @@ "integrity": "sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g==" }, "node_modules/typescript": { - "version": "4.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", - "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", - "devOptional": true, + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, "node_modules/u3": { @@ -20414,12 +20374,6 @@ "dedent-js": "^1.0.1", "pascal-case": "^3.1.1" } - }, - "typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", - "peer": true } } }, @@ -20550,12 +20504,6 @@ "dedent-js": "^1.0.1", "pascal-case": "^3.1.1" } - }, - "typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", - "peer": true } } }, @@ -20687,12 +20635,6 @@ "dedent-js": "^1.0.1", "pascal-case": "^3.1.1" } - }, - "typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", - "peer": true } } }, @@ -26306,10 +26248,9 @@ "integrity": "sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g==" }, "typescript": { - "version": "4.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", - "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", - "devOptional": true + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==" }, "u3": { "version": "0.1.1", diff --git a/clients/js/package.json b/clients/js/package.json index 1ac87fb4c8..abb05751b1 100644 --- a/clients/js/package.json +++ b/clients/js/package.json @@ -73,6 +73,6 @@ "copy-dir": "^1.3.0", "jest": "^29.7.0", "ts-jest": "^29.1.2", - "typescript": "^4.6" + "typescript": "^5.4.5" } } diff --git a/clients/js/src/cmds/sui/setup.ts b/clients/js/src/cmds/sui/setup.ts index 572f98e6f2..e73dcba650 100644 --- a/clients/js/src/cmds/sui/setup.ts +++ b/clients/js/src/cmds/sui/setup.ts @@ -196,7 +196,7 @@ export const addSetupCommands: YargsAddCommandsFn = (y: typeof yargs) => dotenv.config({ path: envPath }); const tx = new TransactionBlock(); - setMaxGasBudgetDevnet("DEVNET", tx); + setMaxGasBudgetDevnet("Devnet", tx); const registrations: { chain: Chain; module: string }[] = []; for (const key in process.env) { if (/^REGISTER_(.+)_TOKEN_BRIDGE_VAA$/.test(key)) { diff --git a/clients/js/src/injective.ts b/clients/js/src/injective.ts index 68dcc9c437..f33cc3f62b 100644 --- a/clients/js/src/injective.ts +++ b/clients/js/src/injective.ts @@ -17,7 +17,13 @@ import { NETWORKS } from "./consts"; import { impossible, Payload } from "./vaa"; import { transferFromInjective } from "@certusone/wormhole-sdk/lib/esm/token_bridge/injective"; import { tryNativeToUint8Array } from "@certusone/wormhole-sdk/lib/esm/utils"; -import { Chain, contracts, Network } from "@wormhole-foundation/sdk-base"; +import { + Chain, + chainToChainId, + contracts, + Network, +} from "@wormhole-foundation/sdk-base"; +import { chains } from "@wormhole-foundation/sdk/dist/cjs"; export async function execute_injective( payload: Payload, @@ -188,8 +194,8 @@ export async function transferInjective( token_bridge, tokenAddress, amount, - dstChain, - tryNativeToUint8Array(dstAddress, dstChain) + chainToChainId(dstChain), + tryNativeToUint8Array(dstAddress, chainToChainId(dstChain)) ); await signAndSendTx(walletPK, network, msgs); @@ -291,14 +297,14 @@ export async function queryRegistrationsInjective( // Query the bridge registration for all the chains in parallel. const registrations: (any | null)[][] = await Promise.all( - Object.entries(CHAINS) - .filter(([cname, _]) => cname !== chain && cname !== "unset") - .map(async ([cname, cid]) => [ + chains + .filter((cname) => cname !== chain) + .map(async (cname) => [ cname, await (async () => { let query_msg = { chain_registration: { - chain: cid, + chain: chainToChainId(cname), }, }; diff --git a/clients/js/tsconfig.json b/clients/js/tsconfig.json index 7805542035..ce7a76b2bb 100644 --- a/clients/js/tsconfig.json +++ b/clients/js/tsconfig.json @@ -6,6 +6,7 @@ "outDir": "./build", "moduleResolution": "node", "esModuleInterop": true, + "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "strict": true },