Kaynağa Gözat

fix(pyth-iota-js): fixed build

benduran 4 hafta önce
ebeveyn
işleme
26ef3b2b22

+ 5 - 5
apps/hermes/client/js/package.json

@@ -65,7 +65,7 @@
   "exports": {
     "./HermesClient": {
       "import": "./dist/esm/HermesClient.js",
-      "types": "./dist/cjs/HermesClient.d.ts",
+      "types": "./dist/esm/HermesClient.d.ts",
       "require": "./dist/cjs/HermesClient.js"
     },
     "./examples/HermesClient": {
@@ -74,22 +74,22 @@
     },
     ".": {
       "import": "./dist/esm/index.js",
-      "types": "./dist/cjs/index.d.ts",
+      "types": "./dist/esm/index.d.ts",
       "require": "./dist/cjs/index.js"
     },
     "./utils": {
       "import": "./dist/esm/utils.js",
-      "types": "./dist/cjs/utils.d.ts",
+      "types": "./dist/esm/utils.d.ts",
       "require": "./dist/cjs/utils.js"
     },
     "./zodSchemas": {
       "import": "./dist/esm/zodSchemas.js",
-      "types": "./dist/cjs/zodSchemas.d.ts",
+      "types": "./dist/esm/zodSchemas.d.ts",
       "require": "./dist/cjs/zodSchemas.js"
     },
     "./package.json": "./package.json"
   },
-  "types": "./esm/index.d.ts",
+  "types": "./cjs/index.d.ts",
   "module": "./esm/index.js",
   "main": "./cjs/index.js"
 }

+ 10 - 26
pnpm-lock.yaml

@@ -3312,7 +3312,7 @@ importers:
     dependencies:
       '@iota/iota-sdk':
         specifier: ^0.5.0
-        version: 0.5.0(typescript@5.8.2)
+        version: 0.5.0(typescript@5.9.3)
       '@pythnetwork/price-service-client':
         specifier: workspace:*
         version: link:../../../../price_service/client/js
@@ -3320,6 +3320,9 @@ importers:
         specifier: ^6.0.3
         version: 6.0.3
     devDependencies:
+      '@cprussin/tsconfig':
+        specifier: 'catalog:'
+        version: 3.1.2(typescript@5.9.3)
       '@truffle/hdwallet-provider':
         specifier: ^2.1.5
         version: 2.1.15(@babel/core@7.27.1)(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10)
@@ -3340,25 +3343,25 @@ importers:
         version: 17.0.33
       '@typescript-eslint/eslint-plugin':
         specifier: ^6.0.0
-        version: 6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.56.0)(typescript@5.8.2))(eslint@8.56.0)(typescript@5.8.2)
+        version: 6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.56.0)(typescript@5.9.3))(eslint@8.56.0)(typescript@5.9.3)
       '@typescript-eslint/parser':
         specifier: ^6.0.0
-        version: 6.21.0(eslint@8.56.0)(typescript@5.8.2)
+        version: 6.21.0(eslint@8.56.0)(typescript@5.9.3)
       eslint:
         specifier: ^8.14.0
         version: 8.56.0
       jest:
         specifier: ^29.4.1
-        version: 29.7.0(@types/node@18.19.86)(ts-node@10.9.2(@swc/core@1.13.2)(@types/node@18.19.86)(typescript@5.8.2))
+        version: 29.7.0(@types/node@18.19.86)(ts-node@10.9.2(@swc/core@1.13.2)(@types/node@18.19.86)(typescript@5.9.3))
       prettier:
         specifier: 'catalog:'
         version: 3.5.3
       ts-jest:
         specifier: ^29.0.5
-        version: 29.3.1(@babel/core@7.27.1)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.27.1))(jest@29.7.0(@types/node@18.19.86)(ts-node@10.9.2(@swc/core@1.13.2)(@types/node@18.19.86)(typescript@5.8.2)))(typescript@5.8.2)
+        version: 29.3.1(@babel/core@7.27.1)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.27.1))(jest@29.7.0(@types/node@18.19.86)(ts-node@10.9.2(@swc/core@1.13.2)(@types/node@18.19.86)(typescript@5.9.3)))(typescript@5.9.3)
       typescript:
-        specifier: ^5.3.3
-        version: 5.8.2
+        specifier: 'catalog:'
+        version: 5.9.3
       web3:
         specifier: ^1.8.2
         version: 1.10.4(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10)
@@ -27880,25 +27883,6 @@ snapshots:
     dependencies:
       bs58: 6.0.0
 
-  '@iota/iota-sdk@0.5.0(typescript@5.8.2)':
-    dependencies:
-      '@graphql-typed-document-node/core': 3.2.0(graphql@16.10.0)
-      '@iota/bcs': 0.2.1
-      '@noble/curves': 1.8.1
-      '@noble/hashes': 1.7.1
-      '@scure/bip32': 1.6.2
-      '@scure/bip39': 1.5.4
-      '@suchipi/femver': 1.0.0
-      bech32: 2.0.0
-      gql.tada: 1.8.10(graphql@16.10.0)(typescript@5.8.2)
-      graphql: 16.10.0
-      tweetnacl: 1.0.3
-      valibot: 0.36.0
-    transitivePeerDependencies:
-      - '@gql.tada/svelte-support'
-      - '@gql.tada/vue-support'
-      - typescript
-
   '@iota/iota-sdk@0.5.0(typescript@5.9.3)':
     dependencies:
       '@graphql-typed-document-node/core': 3.2.0(graphql@16.10.0)

+ 25 - 8
target_chains/sui/sdk/js-iota/package.json

@@ -6,8 +6,8 @@
   "author": {
     "name": "Pyth Data Association"
   },
-  "main": "./dist/cjs/index.js",
-  "types": "./dist/esm/index.d.mts",
+  "main": "./cjs/index.js",
+  "types": "./cjs/index.d.ts",
   "files": [
     "lib/**/*",
     "dist/**/*"
@@ -38,6 +38,7 @@
   ],
   "license": "Apache-2.0",
   "devDependencies": {
+    "@cprussin/tsconfig": "catalog:",
     "@truffle/hdwallet-provider": "^2.1.5",
     "@types/ethereum-protocol": "^1.0.2",
     "@types/jest": "^29.4.0",
@@ -50,7 +51,7 @@
     "jest": "^29.4.1",
     "prettier": "catalog:",
     "ts-jest": "^29.0.5",
-    "typescript": "^5.3.3",
+    "typescript": "catalog:",
     "web3": "^1.8.2",
     "yargs": "^17.0.20"
   },
@@ -64,12 +65,28 @@
     "pnpm": ">=10.19.0"
   },
   "packageManager": "pnpm@10.19.0",
-  "module": "./dist/esm/index.mjs",
+  "module": "./esm/index.js",
   "exports": {
-    ".": "./src/index.ts",
-    "./client": "./src/client.ts",
-    "./examples/IotaRelay": "./src/examples/IotaRelay.ts",
-    "./IotaPriceServiceConnection": "./src/IotaPriceServiceConnection.ts",
+    "./IotaPriceServiceConnection": {
+      "import": "./dist/esm/IotaPriceServiceConnection.js",
+      "types": "./dist/esm/IotaPriceServiceConnection.d.ts",
+      "require": "./dist/cjs/IotaPriceServiceConnection.js"
+    },
+    "./client": {
+      "import": "./dist/esm/client.js",
+      "types": "./dist/esm/client.d.ts",
+      "require": "./dist/cjs/client.js"
+    },
+    "./examples/IotaRelay": {
+      "import": "./dist/esm/examples/IotaRelay.js",
+      "types": "./dist/esm/examples/IotaRelay.d.ts",
+      "require": "./dist/cjs/examples/IotaRelay.js"
+    },
+    ".": {
+      "import": "./dist/esm/index.js",
+      "types": "./dist/esm/index.d.ts",
+      "require": "./dist/cjs/index.js"
+    },
     "./package.json": "./package.json"
   }
 }

+ 10 - 10
target_chains/sui/sdk/js-iota/src/client.ts

@@ -2,7 +2,7 @@ import { IotaClient } from "@iota/iota-sdk/client";
 import { IOTA_CLOCK_OBJECT_ID } from "@iota/iota-sdk/utils";
 import { Transaction } from "@iota/iota-sdk/transactions";
 import { bcs } from "@iota/iota-sdk/bcs";
-import { HexString } from "@pythnetwork/price-service-client";
+import { type HexString } from "@pythnetwork/price-service-client";
 import { Buffer } from "buffer";
 
 const MAX_ARGUMENT_SIZE = 16 * 1024;
@@ -123,7 +123,7 @@ export class IotaPythClient {
         "SDK does not support sending multiple accumulator messages in a single transaction",
       );
     }
-    const vaa = this.extractVaaBytesFromAccumulatorMessage(updates[0]);
+    const vaa = this.extractVaaBytesFromAccumulatorMessage(updates[0]!);
     const verifiedVaas = await this.verifyVaas([vaa], tx);
     [priceUpdatesHotPotato] = tx.moveCall({
       target: `${packageId}::pyth::create_authenticated_price_infos_using_accumulator`,
@@ -132,12 +132,12 @@ export class IotaPythClient {
         tx.pure(
           bcs
             .vector(bcs.U8)
-            .serialize(Array.from(updates[0]), {
+            .serialize(Array.from(updates[0]!), {
               maxSize: MAX_ARGUMENT_SIZE,
             })
             .toBytes(),
         ),
-        verifiedVaas[0],
+        verifiedVaas[0]!,
         tx.object(IOTA_CLOCK_OBJECT_ID),
       ],
     });
@@ -161,9 +161,9 @@ export class IotaPythClient {
         target: `${packageId}::pyth::update_single_price_feed`,
         arguments: [
           tx.object(this.pythStateId),
-          priceUpdatesHotPotato,
+          priceUpdatesHotPotato!,
           tx.object(priceInfoObjectId),
-          coins[coinId],
+          coins[coinId]!,
           tx.object(IOTA_CLOCK_OBJECT_ID),
         ],
       });
@@ -171,7 +171,7 @@ export class IotaPythClient {
     }
     tx.moveCall({
       target: `${packageId}::hot_potato_vector::destroy`,
-      arguments: [priceUpdatesHotPotato],
+      arguments: [priceUpdatesHotPotato!],
       typeArguments: [`${packageId}::price_info::PriceInfo`],
     });
     return priceInfoObjects;
@@ -183,7 +183,7 @@ export class IotaPythClient {
         "SDK does not support sending multiple accumulator messages in a single transaction",
       );
     }
-    const vaa = this.extractVaaBytesFromAccumulatorMessage(updates[0]);
+    const vaa = this.extractVaaBytesFromAccumulatorMessage(updates[0]!);
     const verifiedVaas = await this.verifyVaas([vaa], tx);
     tx.moveCall({
       target: `${packageId}::pyth::create_price_feeds_using_accumulator`,
@@ -192,12 +192,12 @@ export class IotaPythClient {
         tx.pure(
           bcs
             .vector(bcs.U8)
-            .serialize(Array.from(updates[0]), {
+            .serialize(Array.from(updates[0]!), {
               maxSize: MAX_ARGUMENT_SIZE,
             })
             .toBytes(),
         ),
-        verifiedVaas[0],
+        verifiedVaas[0]!,
         tx.object(IOTA_CLOCK_OBJECT_ID),
       ],
     });

+ 10 - 0
target_chains/sui/sdk/js-iota/tsconfig.build.json

@@ -0,0 +1,10 @@
+{
+  "extends": "./tsconfig.json",
+  "compilerOptions": {
+    "declaration": true,
+    "incremental": false,
+    "noEmit": false,
+    "verbatimModuleSyntax": false,
+  },
+  "exclude": ["dist", "node_modules"]
+}

+ 2 - 11
target_chains/sui/sdk/js-iota/tsconfig.json

@@ -1,14 +1,5 @@
 {
-  "extends": "../../../../tsconfig.base.json",
-  "compilerOptions": {
-    "target": "esnext",
-    "module": "commonjs",
-    "declaration": true,
-    "outDir": "./lib",
-    "rootDir": "src/",
-    "strict": true,
-    "esModuleInterop": true
-  },
+  "extends": "@cprussin/tsconfig/nextjs.json",
   "include": ["src"],
-  "exclude": ["node_modules", "**/__tests__/*"]
+  "exclude": ["dist", "node_modules"]
 }