Prechádzať zdrojové kódy

fix: fixed a lot of TSC builds

benduran 3 týždňov pred
rodič
commit
741e22485b
52 zmenil súbory, kde vykonal 715 pridanie a 225 odobranie
  1. 54 3
      apps/hermes/client/js/package.json
  2. 2 2
      apps/hermes/client/js/src/HermesClient.ts
  3. 1 0
      apps/hermes/client/js/src/index.ts
  4. 3 1
      apps/hermes/client/js/src/utils.ts
  5. 3 2
      apps/hermes/client/js/tsconfig.build.json
  6. 3 0
      apps/hermes/client/js/tsconfig.json
  7. 195 5
      governance/pyth_staking_sdk/package.json
  8. 2 1
      governance/pyth_staking_sdk/tsconfig.build.json
  9. 24 4
      price_service/client/js/package.json
  10. 14 14
      price_service/client/js/src/PriceServiceConnection.ts
  11. 1 1
      price_service/client/js/src/ResillientWebSocket.ts
  12. 6 6
      price_service/client/js/src/index.ts
  13. 1 1
      price_service/client/js/src/utils.ts
  14. 3 2
      price_service/client/js/tsconfig.build.json
  15. 5 0
      price_service/client/js/tsconfig.json
  16. 37 3
      price_service/sdk/js/package.json
  17. 20 20
      price_service/sdk/js/src/index.ts
  18. 5 13
      price_service/sdk/js/src/schemas/PriceFeed.ts
  19. 2 1
      price_service/sdk/js/tsconfig.build.json
  20. 15 4
      target_chains/aptos/sdk/js/package.json
  21. 1 1
      target_chains/aptos/sdk/js/src/AptosPriceServiceConnection.ts
  22. 4 4
      target_chains/aptos/sdk/js/src/index.ts
  23. 3 2
      target_chains/aptos/sdk/js/tsconfig.build.json
  24. 4 0
      target_chains/aptos/sdk/js/tsconfig.json
  25. 67 3
      target_chains/ethereum/sdk/js/package.json
  26. 13 12
      target_chains/ethereum/sdk/js/src/filler.ts
  27. 3 3
      target_chains/ethereum/sdk/js/src/index.ts
  28. 1 1
      target_chains/ethereum/sdk/js/src/multicall3-bundler.ts
  29. 10 9
      target_chains/ethereum/sdk/js/src/tracer/debug-trace-call.ts
  30. 10 9
      target_chains/ethereum/sdk/js/src/tracer/trace-call-many.ts
  31. 2 1
      target_chains/ethereum/sdk/js/tsconfig.build.json
  32. 40 4
      target_chains/solana/sdk/js/pyth_solana_receiver/package.json
  33. 19 12
      target_chains/solana/sdk/js/pyth_solana_receiver/src/PythSolanaReceiver.ts
  34. 3 3
      target_chains/solana/sdk/js/pyth_solana_receiver/src/index.ts
  35. 6 3
      target_chains/solana/sdk/js/pyth_solana_receiver/src/vaa.ts
  36. 2 1
      target_chains/solana/sdk/js/pyth_solana_receiver/tsconfig.build.json
  37. 4 0
      target_chains/solana/sdk/js/pyth_solana_receiver/tsconfig.json
  38. 9 27
      target_chains/solana/sdk/js/solana_utils/package.json
  39. 20 4
      target_chains/sui/sdk/js-iota/package.json
  40. 1 1
      target_chains/sui/sdk/js-iota/src/IotaPriceServiceConnection.ts
  41. 10 10
      target_chains/sui/sdk/js-iota/src/client.ts
  42. 4 4
      target_chains/sui/sdk/js-iota/src/index.ts
  43. 3 2
      target_chains/sui/sdk/js-iota/tsconfig.build.json
  44. 4 0
      target_chains/sui/sdk/js-iota/tsconfig.json
  45. 37 3
      target_chains/sui/sdk/js/package.json
  46. 2 2
      target_chains/sui/sdk/js/src/SuiPriceServiceConnection.ts
  47. 8 8
      target_chains/sui/sdk/js/src/client.ts
  48. 3 3
      target_chains/sui/sdk/js/src/index.ts
  49. 3 2
      target_chains/sui/sdk/js/tsconfig.build.json
  50. 17 3
      target_chains/ton/sdk/js/package.json
  51. 4 4
      target_chains/ton/sdk/js/src/index.ts
  52. 2 1
      target_chains/ton/sdk/js/tsconfig.build.json

+ 54 - 3
apps/hermes/client/js/package.json

@@ -6,8 +6,6 @@
     "name": "Pyth Data Association"
   },
   "homepage": "https://pyth.network",
-  "main": "lib/HermesClient.js",
-  "types": "lib/HermesClient.d.ts",
   "files": [
     "dist/**/*"
   ],
@@ -61,5 +59,58 @@
     "pnpm": ">=10.19.0"
   },
   "packageManager": "pnpm@10.19.0",
-  "type": "module"
+  "type": "module",
+  "exports": {
+    "./HermesClient": {
+      "require": {
+        "default": "./dist/cjs/HermesClient.js",
+        "types": "./dist/cjs/HermesClient.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/HermesClient.js",
+        "types": "./dist/esm/HermesClient.d.ts"
+      }
+    },
+    "./examples/HermesClient": {
+      "require": {},
+      "import": {
+        "default": "./dist/esm/examples/HermesClient.js",
+        "types": "./dist/esm/examples/HermesClient.d.ts"
+      }
+    },
+    ".": {
+      "require": {
+        "default": "./dist/cjs/index.js",
+        "types": "./dist/cjs/index.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/index.js",
+        "types": "./dist/esm/index.d.ts"
+      }
+    },
+    "./utils": {
+      "require": {
+        "default": "./dist/cjs/utils.js",
+        "types": "./dist/cjs/utils.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/utils.js",
+        "types": "./dist/esm/utils.d.ts"
+      }
+    },
+    "./zodSchemas": {
+      "require": {
+        "default": "./dist/cjs/zodSchemas.js",
+        "types": "./dist/cjs/zodSchemas.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/zodSchemas.js",
+        "types": "./dist/esm/zodSchemas.d.ts"
+      }
+    },
+    "./package.json": "./package.json"
+  },
+  "module": "./dist/esm/index.js",
+  "types": "./dist/cjs/index.d.ts",
+  "main": "./dist/cjs/index.js"
 }

+ 2 - 2
apps/hermes/client/js/src/HermesClient.ts

@@ -1,7 +1,7 @@
 import { EventSource } from "eventsource";
-import { schemas } from "./zodSchemas";
+import { schemas } from "./zodSchemas.js";
 import { z } from "zod";
-import { camelToSnakeCaseObject } from "./utils";
+import { camelToSnakeCaseObject } from "./utils.js";
 
 // Accessing schema objects
 export type AssetType = z.infer<typeof schemas.AssetType>;

+ 1 - 0
apps/hermes/client/js/src/index.ts

@@ -0,0 +1 @@
+export * from './HermesClient.js';

+ 3 - 1
apps/hermes/client/js/src/utils.ts

@@ -7,7 +7,9 @@ export function camelToSnakeCaseObject(
 ): Record<string, string | boolean> {
   const result: Record<string, string | boolean> = {};
   Object.keys(obj).forEach((key) => {
-    result[camelToSnakeCase(key)] = obj[key];
+    const newKey = camelToSnakeCase(key);
+    const val = obj[key];
+    result[newKey] = val!;
   });
   return result;
 }

+ 3 - 2
apps/hermes/client/js/tsconfig.build.json

@@ -3,12 +3,13 @@
   "compilerOptions": {
     "noEmit": false,
     "incremental": false,
-    "declaration": true
+    "declaration": true,
+    "isolatedModules": false
   },
   "exclude": [
     "node_modules",
     "dist",
-    "examples/",
+    "src/examples/",
     "**/__tests__/*"
   ]
 }

+ 3 - 0
apps/hermes/client/js/tsconfig.json

@@ -1,5 +1,8 @@
 {
   "extends": "@cprussin/tsconfig/base.json",
   "include": ["src"],
+  "compilerOptions": {
+    "lib": ["DOM", "ESNext"]
+  },
   "exclude": ["node_modules"]
 }

+ 195 - 5
governance/pyth_staking_sdk/package.json

@@ -4,10 +4,197 @@
   "description": "Pyth staking SDK",
   "type": "module",
   "exports": {
-    "import": {
-      "types": "./dist/index.d.ts",
-      "default": "./dist/index.js"
-    }
+    "./constants": {
+      "require": {
+        "default": "./dist/cjs/constants.js",
+        "types": "./dist/cjs/constants.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/constants.js",
+        "types": "./dist/esm/constants.d.ts"
+      }
+    },
+    ".": {
+      "require": {
+        "default": "./dist/cjs/index.js",
+        "types": "./dist/cjs/index.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/index.js",
+        "types": "./dist/esm/index.d.ts"
+      }
+    },
+    "./pdas": {
+      "require": {
+        "default": "./dist/cjs/pdas.js",
+        "types": "./dist/cjs/pdas.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/pdas.js",
+        "types": "./dist/esm/pdas.d.ts"
+      }
+    },
+    "./pyth-staking-client": {
+      "require": {
+        "default": "./dist/cjs/pyth-staking-client.js",
+        "types": "./dist/cjs/pyth-staking-client.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/pyth-staking-client.js",
+        "types": "./dist/esm/pyth-staking-client.d.ts"
+      }
+    },
+    "./pythnet-client": {
+      "require": {
+        "default": "./dist/cjs/pythnet-client.js",
+        "types": "./dist/cjs/pythnet-client.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/pythnet-client.js",
+        "types": "./dist/esm/pythnet-client.d.ts"
+      }
+    },
+    "./types": {
+      "require": {
+        "default": "./dist/cjs/types.js",
+        "types": "./dist/cjs/types.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/types.js",
+        "types": "./dist/esm/types.d.ts"
+      }
+    },
+    "./types/integrity-pool": {
+      "require": {
+        "default": "./dist/cjs/types/integrity-pool.js",
+        "types": "./dist/cjs/types/integrity-pool.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/types/integrity-pool.js",
+        "types": "./dist/esm/types/integrity-pool.d.ts"
+      }
+    },
+    "./types/publisher-caps": {
+      "require": {
+        "default": "./dist/cjs/types/publisher-caps.js",
+        "types": "./dist/cjs/types/publisher-caps.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/types/publisher-caps.js",
+        "types": "./dist/esm/types/publisher-caps.d.ts"
+      }
+    },
+    "./types/stake-caps-parameters": {
+      "require": {
+        "default": "./dist/cjs/types/stake-caps-parameters.js",
+        "types": "./dist/cjs/types/stake-caps-parameters.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/types/stake-caps-parameters.js",
+        "types": "./dist/esm/types/stake-caps-parameters.d.ts"
+      }
+    },
+    "./types/staking": {
+      "require": {
+        "default": "./dist/cjs/types/staking.js",
+        "types": "./dist/cjs/types/staking.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/types/staking.js",
+        "types": "./dist/esm/types/staking.d.ts"
+      }
+    },
+    "./utils/apy": {
+      "require": {
+        "default": "./dist/cjs/utils/apy.js",
+        "types": "./dist/cjs/utils/apy.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/utils/apy.js",
+        "types": "./dist/esm/utils/apy.d.ts"
+      }
+    },
+    "./utils/bigint": {
+      "require": {
+        "default": "./dist/cjs/utils/bigint.js",
+        "types": "./dist/cjs/utils/bigint.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/utils/bigint.js",
+        "types": "./dist/esm/utils/bigint.d.ts"
+      }
+    },
+    "./utils/bn": {
+      "require": {
+        "default": "./dist/cjs/utils/bn.js",
+        "types": "./dist/cjs/utils/bn.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/utils/bn.js",
+        "types": "./dist/esm/utils/bn.d.ts"
+      }
+    },
+    "./utils/clock": {
+      "require": {
+        "default": "./dist/cjs/utils/clock.js",
+        "types": "./dist/cjs/utils/clock.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/utils/clock.js",
+        "types": "./dist/esm/utils/clock.d.ts"
+      }
+    },
+    "./utils/pool": {
+      "require": {
+        "default": "./dist/cjs/utils/pool.js",
+        "types": "./dist/cjs/utils/pool.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/utils/pool.js",
+        "types": "./dist/esm/utils/pool.d.ts"
+      }
+    },
+    "./utils/position": {
+      "require": {
+        "default": "./dist/cjs/utils/position.js",
+        "types": "./dist/cjs/utils/position.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/utils/position.js",
+        "types": "./dist/esm/utils/position.d.ts"
+      }
+    },
+    "./utils/transaction": {
+      "require": {
+        "default": "./dist/cjs/utils/transaction.js",
+        "types": "./dist/cjs/utils/transaction.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/utils/transaction.js",
+        "types": "./dist/esm/utils/transaction.d.ts"
+      }
+    },
+    "./utils/vesting": {
+      "require": {
+        "default": "./dist/cjs/utils/vesting.js",
+        "types": "./dist/cjs/utils/vesting.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/utils/vesting.js",
+        "types": "./dist/esm/utils/vesting.d.ts"
+      }
+    },
+    "./utils/wallet": {
+      "require": {
+        "default": "./dist/cjs/utils/wallet.js",
+        "types": "./dist/cjs/utils/wallet.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/utils/wallet.js",
+        "types": "./dist/esm/utils/wallet.d.ts"
+      }
+    },
+    "./package.json": "./package.json"
   },
   "files": [
     "dist/**/*"
@@ -50,5 +237,8 @@
     "@streamparser/json": "^0.0.22",
     "zod": "catalog:"
   },
-  "packageManager": "pnpm@10.19.0"
+  "packageManager": "pnpm@10.19.0",
+  "module": "./dist/esm/index.js",
+  "types": "./dist/cjs/index.d.ts",
+  "main": "./dist/cjs/index.js"
 }

+ 2 - 1
governance/pyth_staking_sdk/tsconfig.build.json

@@ -3,7 +3,8 @@
   "compilerOptions": {
     "noEmit": false,
     "incremental": false,
-    "declaration": true
+    "declaration": true,
+    "isolatedModules": false
   },
   "exclude": [
     "node_modules",

+ 24 - 4
price_service/client/js/package.json

@@ -7,8 +7,8 @@
     "name": "Pyth Data Association"
   },
   "homepage": "https://pyth.network",
-  "main": "lib/index.js",
-  "types": "lib/index.d.ts",
+  "main": "./dist/index.js",
+  "types": "./dist/index.d.ts",
   "files": [
     "dist/**/*"
   ],
@@ -22,7 +22,7 @@
   },
   "scripts": {
     "test:e2e": "jest --testPathPattern=.*.e2e.test.ts",
-    "build": "ts-duality",
+    "build": "ts-duality --noEsm",
     "example": "pnpm run build && node lib/examples/PriceServiceClient.js",
     "fix:format": "prettier --write \"src/**/*.ts\"",
     "fix:lint": "eslint src/ --fix --max-warnings 0",
@@ -63,5 +63,25 @@
     "pnpm": ">=10.19.0"
   },
   "packageManager": "pnpm@10.19.0",
-  "type": "module"
+  "type": "module",
+  "exports": {
+    "./PriceServiceConnection": {
+      "default": "./dist/PriceServiceConnection.js",
+      "types": "./dist/PriceServiceConnection.d.ts"
+    },
+    "./ResillientWebSocket": {
+      "default": "./dist/ResillientWebSocket.js",
+      "types": "./dist/ResillientWebSocket.d.ts"
+    },
+    ".": {
+      "default": "./dist/index.js",
+      "types": "./dist/index.d.ts"
+    },
+    "./utils": {
+      "default": "./dist/utils.js",
+      "types": "./dist/utils.d.ts"
+    },
+    "./package.json": "./package.json"
+  },
+  "module": "./dist/esm/index.js"
 }

+ 14 - 14
price_service/client/js/src/PriceServiceConnection.ts

@@ -1,8 +1,8 @@
-import { HexString, PriceFeed } from "@pythnetwork/price-service-sdk";
-import axios, { AxiosInstance } from "axios";
+import { type HexString, PriceFeed } from "@pythnetwork/price-service-sdk";
+import axios, { type AxiosInstance } from "axios";
 import axiosRetry from "axios-retry";
 import * as WebSocket from "isomorphic-ws";
-import { Logger } from "ts-log";
+import { type Logger } from "ts-log";
 import { ResilientWebSocket } from "./ResillientWebSocket";
 import { makeWebsocketUrl, removeLeading0xIfExists } from "./utils";
 
@@ -10,37 +10,37 @@ export type DurationInMs = number;
 
 export type PriceFeedRequestConfig = {
   /* Optional verbose to request for verbose information from the service */
-  verbose?: boolean;
+  verbose?: boolean | undefined;
   /* Optional binary to include the price feeds binary update data */
-  binary?: boolean;
+  binary?: boolean | undefined;
   /* Optional config for the websocket subscription to receive out of order updates */
-  allowOutOfOrder?: boolean;
+  allowOutOfOrder?: boolean | undefined;
 };
 
 export type PriceServiceConnectionConfig = {
   /* Timeout of each request (for all of retries). Default: 5000ms */
-  timeout?: DurationInMs;
+  timeout?: DurationInMs | undefined;
   /**
    * Number of times a HTTP request will be retried before the API returns a failure. Default: 3.
    *
    * The connection uses exponential back-off for the delay between retries. However,
    * it will timeout regardless of the retries at the configured `timeout` time.
    */
-  httpRetries?: number;
+  httpRetries?: number | undefined;
   /* Optional logger (e.g: console or any logging library) to log internal events */
-  logger?: Logger;
+  logger?: Logger | undefined;
   /* Deprecated: please use priceFeedRequestConfig.verbose instead */
-  verbose?: boolean;
+  verbose?: boolean | undefined;
   /* Configuration for the price feed requests */
-  priceFeedRequestConfig?: PriceFeedRequestConfig;
+  priceFeedRequestConfig?: PriceFeedRequestConfig | undefined;
 };
 
 type ClientMessage = {
   type: "subscribe" | "unsubscribe";
   ids: HexString[];
-  verbose?: boolean;
-  binary?: boolean;
-  allow_out_of_order?: boolean;
+  verbose?: boolean | undefined;
+  binary?: boolean | undefined;
+  allow_out_of_order?: boolean | undefined;
 };
 
 type ServerResponse = {

+ 1 - 1
price_service/client/js/src/ResillientWebSocket.ts

@@ -1,5 +1,5 @@
 import WebSocket from "isomorphic-ws";
-import { Logger } from "ts-log";
+import { type Logger } from "ts-log";
 
 const PING_TIMEOUT_DURATION = 30000 + 3000; // It is 30s on the server and 3s is added for delays
 

+ 6 - 6
price_service/client/js/src/index.ts

@@ -1,16 +1,16 @@
 export {
-  DurationInMs,
+  type DurationInMs,
   PriceServiceConnection,
-  PriceServiceConnectionConfig,
-} from "./PriceServiceConnection";
+  type PriceServiceConnectionConfig,
+} from "./PriceServiceConnection.js";
 
 export {
-  HexString,
+  type HexString,
   PriceFeedMetadata,
   PriceFeed,
   Price,
-  UnixTimestamp,
+  type UnixTimestamp,
   isAccumulatorUpdateData,
   parseAccumulatorUpdateData,
-  AccumulatorUpdateData,
+  type AccumulatorUpdateData,
 } from "@pythnetwork/price-service-sdk";

+ 1 - 1
price_service/client/js/src/utils.ts

@@ -1,4 +1,4 @@
-import { HexString } from "@pythnetwork/price-service-sdk";
+import { type HexString } from "@pythnetwork/price-service-sdk";
 
 /**
  * Convert http(s) endpoint to ws(s) endpoint.

+ 3 - 2
price_service/client/js/tsconfig.build.json

@@ -3,12 +3,13 @@
   "compilerOptions": {
     "noEmit": false,
     "incremental": false,
-    "declaration": true
+    "declaration": true,
+    "isolatedModules": false
   },
   "exclude": [
     "node_modules",
     "dist",
-    "examples/",
+    "src/examples/",
     "**/__tests__/*"
   ]
 }

+ 5 - 0
price_service/client/js/tsconfig.json

@@ -1,4 +1,9 @@
 {
   "extends": "@cprussin/tsconfig/base.json",
+  "compilerOptions": {
+    "lib": ["DOM", "ESNext"],
+    "moduleResolution": "bundler",
+    "module": "preserve"
+  },
   "exclude": ["dist", "node_modules"]
 }

+ 37 - 3
price_service/sdk/js/package.json

@@ -3,8 +3,8 @@
   "version": "1.8.0",
   "description": "Pyth price service SDK",
   "homepage": "https://pyth.network",
-  "main": "lib/index.js",
-  "types": "lib/index.d.ts",
+  "main": "./dist/cjs/index.js",
+  "types": "./dist/cjs/index.d.ts",
   "files": [
     "dist/**/*"
   ],
@@ -52,5 +52,39 @@
     "pnpm": ">=10.19.0"
   },
   "packageManager": "pnpm@10.19.0",
-  "type": "module"
+  "type": "module",
+  "exports": {
+    "./AccumulatorUpdateData": {
+      "require": {
+        "default": "./dist/cjs/AccumulatorUpdateData.js",
+        "types": "./dist/cjs/AccumulatorUpdateData.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/AccumulatorUpdateData.js",
+        "types": "./dist/esm/AccumulatorUpdateData.d.ts"
+      }
+    },
+    ".": {
+      "require": {
+        "default": "./dist/cjs/index.js",
+        "types": "./dist/cjs/index.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/index.js",
+        "types": "./dist/esm/index.d.ts"
+      }
+    },
+    "./schemas/PriceFeed": {
+      "require": {
+        "default": "./dist/cjs/schemas/PriceFeed.js",
+        "types": "./dist/cjs/schemas/PriceFeed.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/schemas/PriceFeed.js",
+        "types": "./dist/esm/schemas/PriceFeed.d.ts"
+      }
+    },
+    "./package.json": "./package.json"
+  },
+  "module": "./dist/esm/index.js"
 }

+ 20 - 20
price_service/sdk/js/src/index.ts

@@ -1,9 +1,9 @@
 import {
   Convert,
-  Price as JsonPrice,
-  PriceFeed as JsonPriceFeed,
-  PriceFeedMetadata as JsonPriceFeedMetadata,
-} from "./schemas/PriceFeed";
+  type Price as JsonPrice,
+  type PriceFeed as JsonPriceFeed,
+  type PriceFeedMetadata as JsonPriceFeedMetadata,
+} from "./schemas/PriceFeed.js";
 
 export type UnixTimestamp = number;
 export type DurationInSeconds = number;
@@ -13,10 +13,10 @@ export {
   isAccumulatorUpdateData,
   sliceAccumulatorUpdateData,
   parseAccumulatorUpdateData,
-  AccumulatorUpdateData,
+  type AccumulatorUpdateData,
   parsePriceFeedMessage,
   parseTwapMessage,
-} from "./AccumulatorUpdateData";
+} from "./AccumulatorUpdateData.js";
 
 /**
  * A Pyth Price represented as `${price} ± ${conf} * 10^${expo}` published at `publishTime`.
@@ -92,7 +92,7 @@ export class PriceFeedMetadata {
   /**
    * Attestation time of the price
    */
-  attestationTime?: number;
+  attestationTime?: number | undefined;
   /**
    * Chain of the emitter
    */
@@ -100,27 +100,27 @@ export class PriceFeedMetadata {
   /**
    * The time that the price service received the price
    */
-  priceServiceReceiveTime?: number;
+  priceServiceReceiveTime?: number | undefined;
   /**
    * Sequence number of the price
    */
-  sequenceNumber?: number;
+  sequenceNumber?: number | undefined;
   /**
    * Pythnet slot number of the price
    */
-  slot?: number;
+  slot?: number | undefined;
   /**
    * The time that the previous price was published
    */
-  prevPublishTime?: number;
+  prevPublishTime?: number | undefined;
 
   constructor(metadata: {
-    attestationTime?: number;
+    attestationTime?: number | undefined;
     emitterChain: number;
-    receiveTime?: number;
-    sequenceNumber?: number;
-    slot?: number;
-    prevPublishTime?: number;
+    receiveTime?: number | undefined;
+    sequenceNumber?: number | undefined;
+    slot?: number | undefined;
+    prevPublishTime?: number | undefined;
   }) {
     this.attestationTime = metadata.attestationTime;
     this.emitterChain = metadata.emitterChain;
@@ -177,11 +177,11 @@ export class PriceFeed {
   /**
    * Metadata of the price
    */
-  metadata?: PriceFeedMetadata;
+  metadata?: PriceFeedMetadata | undefined;
   /**
    * VAA of the price
    */
-  vaa?: string;
+  vaa?: string | undefined;
   /**
    * Price
    */
@@ -190,8 +190,8 @@ export class PriceFeed {
   constructor(rawFeed: {
     emaPrice: Price;
     id: HexString;
-    metadata?: PriceFeedMetadata;
-    vaa?: string;
+    metadata?: PriceFeedMetadata | undefined;
+    vaa?: string | undefined;
     price: Price;
   }) {
     this.emaPrice = rawFeed.emaPrice;

+ 5 - 13
price_service/sdk/js/src/schemas/PriceFeed.ts

@@ -68,7 +68,7 @@ export interface PriceFeedMetadata {
   /**
    * Attestation time of the price
    */
-  attestation_time?: number;
+  attestation_time?: number | undefined;
   /**
    * Chain of the emitter
    */
@@ -76,19 +76,19 @@ export interface PriceFeedMetadata {
   /**
    * The time that the previous price was published
    */
-  prev_publish_time?: number;
+  prev_publish_time?: number | undefined;
   /**
    * The time that the price service received the price
    */
-  price_service_receive_time?: number;
+  price_service_receive_time?: number | undefined;
   /**
    * Sequence number of the price
    */
-  sequence_number?: number;
+  sequence_number?: number | undefined;
   /**
    * Pythnet slot number of the price
    */
-  slot?: number;
+  slot?: number | undefined;
 }
 
 // Converts JSON types to/from your types
@@ -246,10 +246,6 @@ function uncast<T>(val: T, typ: any): any {
   return transform(val, typ, jsToJSONProps);
 }
 
-function a(typ: any) {
-  return { arrayItems: typ };
-}
-
 function u(...typs: any[]) {
   return { unionMembers: typs };
 }
@@ -258,10 +254,6 @@ function o(props: any[], additional: any) {
   return { props, additional };
 }
 
-function m(additional: any) {
-  return { props: [], additional };
-}
-
 function r(name: string) {
   return { ref: name };
 }

+ 2 - 1
price_service/sdk/js/tsconfig.build.json

@@ -3,7 +3,8 @@
   "compilerOptions": {
     "noEmit": false,
     "incremental": false,
-    "declaration": true
+    "declaration": true,
+    "isolatedModules": false
   },
   "exclude": [
     "node_modules",

+ 15 - 4
target_chains/aptos/sdk/js/package.json

@@ -6,8 +6,8 @@
   "author": {
     "name": "Pyth Data Association"
   },
-  "main": "lib/index.js",
-  "types": "lib/index.d.ts",
+  "main": "./dist/index.js",
+  "types": "./dist/index.d.ts",
   "files": [
     "dist/**/*"
   ],
@@ -20,7 +20,7 @@
     "access": "public"
   },
   "scripts": {
-    "build": "ts-duality",
+    "build": "ts-duality --noEsm",
     "example-relay": "pnpm run build && node lib/examples/AptosRelay.js",
     "fix:format": "prettier --write \"src/**/*.ts\"",
     "fix:lint": "eslint src/ --fix --max-warnings 0",
@@ -62,5 +62,16 @@
     "pnpm": ">=10.19.0"
   },
   "packageManager": "pnpm@10.19.0",
-  "type": "module"
+  "type": "module",
+  "exports": {
+    "./AptosPriceServiceConnection": {
+      "default": "./dist/AptosPriceServiceConnection.js",
+      "types": "./dist/AptosPriceServiceConnection.d.ts"
+    },
+    ".": {
+      "default": "./dist/index.js",
+      "types": "./dist/index.d.ts"
+    },
+    "./package.json": "./package.json"
+  }
 }

+ 1 - 1
target_chains/aptos/sdk/js/src/AptosPriceServiceConnection.ts

@@ -1,6 +1,6 @@
 import {
   PriceServiceConnection,
-  HexString,
+  type HexString,
 } from "@pythnetwork/price-service-client";
 import { BCS } from "aptos";
 import { Buffer } from "buffer";

+ 4 - 4
target_chains/aptos/sdk/js/src/index.ts

@@ -1,10 +1,10 @@
 export { AptosPriceServiceConnection } from "./AptosPriceServiceConnection";
 
 export {
-  DurationInMs,
-  HexString,
+  type DurationInMs,
+  type HexString,
   Price,
   PriceFeed,
-  PriceServiceConnectionConfig,
-  UnixTimestamp,
+  type PriceServiceConnectionConfig,
+  type UnixTimestamp,
 } from "@pythnetwork/price-service-client";

+ 3 - 2
target_chains/aptos/sdk/js/tsconfig.build.json

@@ -3,12 +3,13 @@
   "compilerOptions": {
     "noEmit": false,
     "incremental": false,
-    "declaration": true
+    "declaration": true,
+    "isolatedModules": false
   },
   "exclude": [
     "node_modules",
     "dist",
-    "examples/",
+    "src/examples/",
     "**/__tests__/*"
   ]
 }

+ 4 - 0
target_chains/aptos/sdk/js/tsconfig.json

@@ -1,4 +1,8 @@
 {
   "extends": "@cprussin/tsconfig/base.json",
+  "compilerOptions": {
+    "moduleResolution": "bundler",
+    "module": "preserve"
+  },
   "exclude": ["dist", "node_modules"]
 }

+ 67 - 3
target_chains/ethereum/sdk/js/package.json

@@ -6,8 +6,8 @@
   "author": {
     "name": "Pyth Data Association"
   },
-  "main": "lib/index.js",
-  "types": "lib/index.d.ts",
+  "main": "./dist/cjs/index.js",
+  "types": "./dist/cjs/index.d.ts",
   "files": [
     "dist/**/*"
   ],
@@ -58,5 +58,69 @@
     "pnpm": ">=10.19.0"
   },
   "packageManager": "pnpm@10.19.0",
-  "type": "module"
+  "type": "module",
+  "exports": {
+    "./filler": {
+      "require": {
+        "default": "./dist/cjs/filler.js",
+        "types": "./dist/cjs/filler.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/filler.js",
+        "types": "./dist/esm/filler.d.ts"
+      }
+    },
+    ".": {
+      "require": {
+        "default": "./dist/cjs/index.js",
+        "types": "./dist/cjs/index.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/index.js",
+        "types": "./dist/esm/index.d.ts"
+      }
+    },
+    "./multicall3-bundler": {
+      "require": {
+        "default": "./dist/cjs/multicall3-bundler.js",
+        "types": "./dist/cjs/multicall3-bundler.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/multicall3-bundler.js",
+        "types": "./dist/esm/multicall3-bundler.d.ts"
+      }
+    },
+    "./pyth-abi": {
+      "require": {
+        "default": "./dist/cjs/pyth-abi.js",
+        "types": "./dist/cjs/pyth-abi.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/pyth-abi.js",
+        "types": "./dist/esm/pyth-abi.d.ts"
+      }
+    },
+    "./tracer/debug-trace-call": {
+      "require": {
+        "default": "./dist/cjs/tracer/debug-trace-call.js",
+        "types": "./dist/cjs/tracer/debug-trace-call.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/tracer/debug-trace-call.js",
+        "types": "./dist/esm/tracer/debug-trace-call.d.ts"
+      }
+    },
+    "./tracer/trace-call-many": {
+      "require": {
+        "default": "./dist/cjs/tracer/trace-call-many.js",
+        "types": "./dist/cjs/tracer/trace-call-many.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/tracer/trace-call-many.js",
+        "types": "./dist/esm/tracer/trace-call-many.d.ts"
+      }
+    },
+    "./package.json": "./package.json"
+  },
+  "module": "./dist/esm/index.js"
 }

+ 13 - 12
target_chains/ethereum/sdk/js/src/filler.ts

@@ -1,35 +1,36 @@
 import { HermesClient } from "@pythnetwork/hermes-client";
+import type {Address, PublicClient, Hex, Transport, Chain} from "viem";
 import {
-  Address,
-  PublicClient,
-  encodeFunctionData,
-  Hex,
-  Transport,
-  Chain,
+  
+  
+  encodeFunctionData
+  
+  
+  
 } from "viem";
 
-import { IPythAbi } from "./pyth-abi";
+import { IPythAbi } from "./pyth-abi.js";
 import {
   debugTraceCallAction,
   extractPythPriceFeedsFromDebugTraceCall,
-} from "./tracer/debug-trace-call";
+} from "./tracer/debug-trace-call.js";
 import {
   extractPythPriceFeedsFromTraceCallMany,
   traceCallManyAction,
-} from "./tracer/trace-call-many";
+} from "./tracer/trace-call-many.js";
 
 /**
  * Represents a call request to be executed on the blockchain
  */
 export type CallRequest = {
   /** The address making the call (optional) */
-  from?: Address;
+  from?: Address | undefined;
   /** The target contract address */
   to: Address;
   /** The encoded function call data (optional) */
-  data?: Hex;
+  data?: Hex | undefined;
   /** The amount of ETH to send with the call (optional) */
-  value?: bigint;
+  value?: bigint | undefined;
 };
 
 /**

+ 3 - 3
target_chains/ethereum/sdk/js/src/index.ts

@@ -1,3 +1,3 @@
-export * from "./filler";
-export * from "./multicall3-bundler";
-export * from "./pyth-abi";
+export * from "./filler.js";
+export * from "./multicall3-bundler.js";
+export * from "./pyth-abi.js";

+ 1 - 1
target_chains/ethereum/sdk/js/src/multicall3-bundler.ts

@@ -1,6 +1,6 @@
 import { encodeFunctionData } from "viem";
 
-import { CallRequest, PythUpdate } from "./filler";
+import type { CallRequest, PythUpdate } from "./filler.js";
 
 // Multicall3 contract address (deployed on most chains)
 export const MULTICALL3_ADDRESS = "0xcA11bde05977b3631167028862bE2a173976CA11";

+ 10 - 9
target_chains/ethereum/sdk/js/src/tracer/debug-trace-call.ts

@@ -1,17 +1,18 @@
+import type {Address, BlockTag, CallParameters, Client, ExactPartial, Hex, RpcTransactionRequest} from "viem";
 import {
-  Address,
-  BlockTag,
-  CallParameters,
-  Client,
+  
+  
+  
+  
   decodeFunctionData,
-  ExactPartial,
+  
   formatTransactionRequest,
-  Hex,
-  isAddressEqual,
-  RpcTransactionRequest,
+  
+  isAddressEqual
+  
 } from "viem";
 
-import { IPythAbi } from "../pyth-abi";
+import { IPythAbi } from "../pyth-abi.js";
 
 /**
  * Extract Pyth price feed IDs from a transaction call trace.

+ 10 - 9
target_chains/ethereum/sdk/js/src/tracer/trace-call-many.ts

@@ -1,17 +1,18 @@
+import type {Address, BlockTag, RpcTransactionRequest, ExactPartial, Hex, Client, CallParameters} from "viem";
 import {
-  Address,
-  BlockTag,
+  
+  
   decodeFunctionData,
-  RpcTransactionRequest,
-  ExactPartial,
-  Hex,
-  Client,
+  
+  
+  
+  
   formatTransactionRequest,
-  CallParameters,
-  isAddressEqual,
+  
+  isAddressEqual
 } from "viem";
 
-import { IPythAbi } from "../pyth-abi";
+import { IPythAbi } from "../pyth-abi.js";
 
 /**
  * Extract Pyth price feed IDs from a transaction call trace.

+ 2 - 1
target_chains/ethereum/sdk/js/tsconfig.build.json

@@ -3,7 +3,8 @@
   "compilerOptions": {
     "noEmit": false,
     "incremental": false,
-    "declaration": true
+    "declaration": true,
+    "isolatedModules": false
   },
   "exclude": [
     "node_modules",

+ 40 - 4
target_chains/solana/sdk/js/pyth_solana_receiver/package.json

@@ -3,8 +3,8 @@
   "version": "0.12.0",
   "description": "Pyth solana receiver SDK",
   "homepage": "https://pyth.network",
-  "main": "lib/index.js",
-  "types": "lib/index.d.ts",
+  "main": "./dist/index.js",
+  "types": "./dist/index.d.ts",
   "files": [
     "dist/**/*"
   ],
@@ -17,7 +17,7 @@
     "access": "public"
   },
   "scripts": {
-    "build": "ts-duality",
+    "build": "ts-duality --noEsm",
     "test:lint": "eslint src/ --max-warnings 0",
     "test:format": "prettier --check \"src/**/*.ts\"",
     "fix:lint": "eslint src/ --fix --max-warnings 0",
@@ -57,5 +57,41 @@
     "pnpm": ">=10.19.0"
   },
   "packageManager": "pnpm@10.19.0",
-  "type": "module"
+  "type": "module",
+  "exports": {
+    "./PythSolanaReceiver": {
+      "default": "./dist/PythSolanaReceiver.js",
+      "types": "./dist/PythSolanaReceiver.d.ts"
+    },
+    "./address": {
+      "default": "./dist/address.js",
+      "types": "./dist/address.d.ts"
+    },
+    "./compute_budget": {
+      "default": "./dist/compute_budget.js",
+      "types": "./dist/compute_budget.d.ts"
+    },
+    "./idl/pyth_push_oracle": {
+      "default": "./dist/idl/pyth_push_oracle.js",
+      "types": "./dist/idl/pyth_push_oracle.d.ts"
+    },
+    "./idl/pyth_solana_receiver": {
+      "default": "./dist/idl/pyth_solana_receiver.js",
+      "types": "./dist/idl/pyth_solana_receiver.d.ts"
+    },
+    "./idl/wormhole_core_bridge_solana": {
+      "default": "./dist/idl/wormhole_core_bridge_solana.js",
+      "types": "./dist/idl/wormhole_core_bridge_solana.d.ts"
+    },
+    ".": {
+      "default": "./dist/index.js",
+      "types": "./dist/index.d.ts"
+    },
+    "./vaa": {
+      "default": "./dist/vaa.js",
+      "types": "./dist/vaa.d.ts"
+    },
+    "./package.json": "./package.json"
+  },
+  "module": "./dist/esm/index.js"
 }

+ 19 - 12
target_chains/solana/sdk/js/pyth_solana_receiver/src/PythSolanaReceiver.ts

@@ -1,17 +1,17 @@
-import { AnchorProvider, IdlAccounts, Program } from "@coral-xyz/anchor";
+import { AnchorProvider, type IdlAccounts, Program } from "@coral-xyz/anchor";
 import {
   AddressLookupTableAccount,
   Connection,
-  Signer,
+  type Signer,
   Transaction,
   VersionedTransaction,
 } from "@solana/web3.js";
 import {
-  PythSolanaReceiver as PythSolanaReceiverProgram,
+  type PythSolanaReceiver as PythSolanaReceiverProgram,
   IDL as Idl,
 } from "./idl/pyth_solana_receiver";
 import {
-  WormholeCoreBridgeSolana,
+  type WormholeCoreBridgeSolana,
   IDL as WormholeCoreBridgeSolanaIdl,
 } from "./idl/wormhole_core_bridge_solana";
 import {
@@ -46,11 +46,11 @@ import {
 } from "./vaa";
 import {
   TransactionBuilder,
-  InstructionWithEphemeralSigners,
-  PriorityFeeConfig,
+  type InstructionWithEphemeralSigners,
+  type PriorityFeeConfig,
 } from "@pythnetwork/solana-utils";
 import {
-  PythPushOracle,
+  type PythPushOracle,
   IDL as PythPushOracleIdl,
 } from "./idl/pyth_push_oracle";
 
@@ -374,7 +374,7 @@ export class PythTransactionBuilder extends TransactionBuilder {
   /**
    * Returns all the added instructions batched into versioned transactions, plus for each transaction the ephemeral signers that need to sign it
    */
-  async buildVersionedTransactions(
+  override async buildVersionedTransactions(
     args: PriorityFeeConfig,
   ): Promise<{ tx: VersionedTransaction; signers: Signer[] }[]> {
     if (this.closeUpdateAccounts) {
@@ -386,7 +386,7 @@ export class PythTransactionBuilder extends TransactionBuilder {
   /**
    * Returns all the added instructions batched into transactions, plus for each transaction the ephemeral signers that need to sign it
    */
-  buildLegacyTransactions(
+  override buildLegacyTransactions(
     args: PriorityFeeConfig,
   ): { tx: Transaction; signers: Signer[] }[] {
     if (this.closeUpdateAccounts) {
@@ -439,7 +439,7 @@ export class PythSolanaReceiver {
   readonly receiver: Program<PythSolanaReceiverProgram>;
   readonly wormhole: Program<WormholeCoreBridgeSolana>;
   readonly pushOracle: Program<PythPushOracle>;
-  readonly treasuryId?: number;
+  readonly treasuryId?: number | undefined;
   constructor({
     connection,
     wallet,
@@ -668,6 +668,13 @@ export class PythSolanaReceiver {
       parseAccumulatorUpdateData(Buffer.from(data, "base64")),
     );
 
+    if (!startUpdateData) {
+      throw new Error('startUpdateData is undefined. this is a bug 🐛');
+    }
+    if (!endUpdateData) {
+      throw new Error('startUpdateData is undefined. this is a bug 🐛');
+    }
+
     // Validate that the start and end updates contain the same number of price feeds
     if (startUpdateData.updates.length !== endUpdateData.updates.length) {
       throw new Error(
@@ -691,8 +698,8 @@ export class PythSolanaReceiver {
 
     // Post a TWAP update to the receiver contract for each price feed
     for (let i = 0; i < startUpdateData.updates.length; i++) {
-      const startUpdate = startUpdateData.updates[i];
-      const endUpdate = endUpdateData.updates[i];
+      const startUpdate = startUpdateData.updates[i]!;
+      const endUpdate = endUpdateData.updates[i]!;
 
       const twapUpdateKeypair = new Keypair();
       postInstructions.push({

+ 3 - 3
target_chains/solana/sdk/js/pyth_solana_receiver/src/index.ts

@@ -5,7 +5,7 @@ export {
 } from "./PythSolanaReceiver";
 export {
   TransactionBuilder,
-  InstructionWithEphemeralSigners,
+  type InstructionWithEphemeralSigners,
 } from "@pythnetwork/solana-utils";
 export {
   getConfigPda,
@@ -15,10 +15,10 @@ export {
 
 export {
   IDL as pythSolanaReceiverIdl,
-  PythSolanaReceiver as PythSolanaReceiverProgram,
+  type PythSolanaReceiver as PythSolanaReceiverProgram,
 } from "./idl/pyth_solana_receiver";
 
 export {
   IDL as wormholeCoreBridgeIdl,
-  WormholeCoreBridgeSolana as WormholeCoreBridgeProgram,
+  type WormholeCoreBridgeSolana as WormholeCoreBridgeProgram,
 } from "./idl/wormhole_core_bridge_solana";

+ 6 - 3
target_chains/solana/sdk/js/pyth_solana_receiver/src/vaa.ts

@@ -1,7 +1,7 @@
 import { Connection, Keypair, PublicKey } from "@solana/web3.js";
-import { WormholeCoreBridgeSolana } from "./idl/wormhole_core_bridge_solana";
+import { type WormholeCoreBridgeSolana } from "./idl/wormhole_core_bridge_solana";
 import { Program } from "@coral-xyz/anchor";
-import { InstructionWithEphemeralSigners } from "@pythnetwork/solana-utils";
+import { type InstructionWithEphemeralSigners } from "@pythnetwork/solana-utils";
 import {
   CLOSE_ENCODED_VAA_COMPUTE_BUDGET,
   INIT_ENCODED_VAA_COMPUTE_BUDGET,
@@ -10,7 +10,7 @@ import {
 } from "./compute_budget";
 import { sha256 } from "@noble/hashes/sha256";
 import { bs58 } from "@coral-xyz/anchor/dist/cjs/utils/bytes";
-import { AccumulatorUpdateData } from "@pythnetwork/price-service-sdk";
+import { type AccumulatorUpdateData } from "@pythnetwork/price-service-sdk";
 import { getGuardianSetPda } from "./address";
 /**
  * Get the index of the guardian set that signed a VAA
@@ -61,6 +61,9 @@ export function trimSignatures(
   n = DEFAULT_REDUCED_GUARDIAN_SET_SIZE,
 ): Buffer {
   const currentNumSignatures = vaa[5];
+  if (currentNumSignatures === undefined) {
+    throw new Error('vaa[5] is undefined');
+  }
   if (n > currentNumSignatures) {
     throw new Error(
       "Resulting VAA can't have more signatures than the original VAA",

+ 2 - 1
target_chains/solana/sdk/js/pyth_solana_receiver/tsconfig.build.json

@@ -3,7 +3,8 @@
   "compilerOptions": {
     "noEmit": false,
     "incremental": false,
-    "declaration": true
+    "declaration": true,
+    "isolatedModules": false
   },
   "exclude": [
     "node_modules",

+ 4 - 0
target_chains/solana/sdk/js/pyth_solana_receiver/tsconfig.json

@@ -1,4 +1,8 @@
 {
   "extends": "@cprussin/tsconfig/base.json",
+  "compilerOptions": {
+    "module": "preserve",
+    "moduleResolution": "node"
+  },
   "exclude": ["dist", "node_modules"]
 }

+ 9 - 27
target_chains/solana/sdk/js/solana_utils/package.json

@@ -3,8 +3,8 @@
   "version": "0.5.0",
   "description": "Utility functions for Solana",
   "homepage": "https://pyth.network",
-  "main": "./dist/cjs/index.js",
-  "types": "./dist/cjs/index.d.ts",
+  "main": "./dist/index.js",
+  "types": "./dist/index.d.ts",
   "files": [
     "dist/**/*"
   ],
@@ -17,7 +17,7 @@
     "access": "public"
   },
   "scripts": {
-    "build": "ts-duality",
+    "build": "ts-duality --noEsm",
     "test:unit": "jest",
     "test:lint": "eslint src/ --max-warnings 0",
     "test:format": "prettier --check \"src/**/*.ts\"",
@@ -60,34 +60,16 @@
   "type": "module",
   "exports": {
     ".": {
-      "require": {
-        "default": "./dist/cjs/index.js",
-        "types": "./dist/cjs/index.d.ts"
-      },
-      "import": {
-        "default": "./dist/esm/index.js",
-        "types": "./dist/esm/index.d.ts"
-      }
+      "default": "./dist/index.js",
+      "types": "./dist/index.d.ts"
     },
     "./jito": {
-      "require": {
-        "default": "./dist/cjs/jito.js",
-        "types": "./dist/cjs/jito.d.ts"
-      },
-      "import": {
-        "default": "./dist/esm/jito.js",
-        "types": "./dist/esm/jito.d.ts"
-      }
+      "default": "./dist/jito.js",
+      "types": "./dist/jito.d.ts"
     },
     "./transaction": {
-      "require": {
-        "default": "./dist/cjs/transaction.js",
-        "types": "./dist/cjs/transaction.d.ts"
-      },
-      "import": {
-        "default": "./dist/esm/transaction.js",
-        "types": "./dist/esm/transaction.d.ts"
-      }
+      "default": "./dist/transaction.js",
+      "types": "./dist/transaction.d.ts"
     },
     "./package.json": "./package.json"
   },

+ 20 - 4
target_chains/sui/sdk/js-iota/package.json

@@ -6,8 +6,8 @@
   "author": {
     "name": "Pyth Data Association"
   },
-  "main": "lib/index.js",
-  "types": "lib/index.d.ts",
+  "main": "./dist/index.js",
+  "types": "./dist/index.d.ts",
   "files": [
     "dist/**/*"
   ],
@@ -20,7 +20,7 @@
     "access": "public"
   },
   "scripts": {
-    "build": "ts-duality",
+    "build": "ts-duality --noEsm",
     "example-relay": "pnpm run build && node lib/examples/SuiRelay.js",
     "test:lint": "eslint src/",
     "test:format": "prettier --check \"src/**/*.ts\"",
@@ -63,5 +63,21 @@
     "pnpm": ">=10.19.0"
   },
   "packageManager": "pnpm@10.19.0",
-  "type": "module"
+  "type": "module",
+  "exports": {
+    "./IotaPriceServiceConnection": {
+      "default": "./dist/IotaPriceServiceConnection.js",
+      "types": "./dist/IotaPriceServiceConnection.d.ts"
+    },
+    "./client": {
+      "default": "./dist/client.js",
+      "types": "./dist/client.d.ts"
+    },
+    ".": {
+      "default": "./dist/index.js",
+      "types": "./dist/index.d.ts"
+    },
+    "./package.json": "./package.json"
+  },
+  "module": "./dist/esm/index.js"
 }

+ 1 - 1
target_chains/sui/sdk/js-iota/src/IotaPriceServiceConnection.ts

@@ -1,6 +1,6 @@
 import {
   PriceServiceConnection,
-  HexString,
+  type HexString,
 } from "@pythnetwork/price-service-client";
 import { Buffer } from "buffer";
 

+ 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),
       ],
     });

+ 4 - 4
target_chains/sui/sdk/js-iota/src/index.ts

@@ -2,10 +2,10 @@ export { IotaPriceServiceConnection } from "./IotaPriceServiceConnection";
 export { IotaPythClient } from "./client";
 
 export {
-  DurationInMs,
-  HexString,
+  type DurationInMs,
+  type HexString,
   Price,
   PriceFeed,
-  PriceServiceConnectionConfig,
-  UnixTimestamp,
+  type PriceServiceConnectionConfig,
+  type UnixTimestamp,
 } from "@pythnetwork/price-service-client";

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

@@ -3,12 +3,13 @@
   "compilerOptions": {
     "noEmit": false,
     "incremental": false,
-    "declaration": true
+    "declaration": true,
+    "isolatedModules": false
   },
   "exclude": [
     "node_modules",
     "dist",
-    "examples/",
+    "src/examples/",
     "**/__tests__/*"
   ]
 }

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

@@ -1,4 +1,8 @@
 {
   "extends": "@cprussin/tsconfig/base.json",
+  "compilerOptions": {
+    "moduleResolution": "node",
+    "module": "preserve"
+  },
   "exclude": ["dist", "node_modules"]
 }

+ 37 - 3
target_chains/sui/sdk/js/package.json

@@ -6,8 +6,9 @@
   "author": {
     "name": "Pyth Data Association"
   },
-  "main": "lib/index.js",
-  "types": "lib/index.d.ts",
+  "main": "./dist/cjs/index.js",
+  "types": "./dist/cjs/index.d.ts",
+  "type": "module",
   "files": [
     "dist/**/*"
   ],
@@ -63,5 +64,38 @@
     "pnpm": ">=10.19.0"
   },
   "packageManager": "pnpm@10.19.0",
-  "type": "module"
+  "exports": {
+    "./SuiPriceServiceConnection": {
+      "require": {
+        "default": "./dist/cjs/SuiPriceServiceConnection.js",
+        "types": "./dist/cjs/SuiPriceServiceConnection.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/SuiPriceServiceConnection.js",
+        "types": "./dist/esm/SuiPriceServiceConnection.d.ts"
+      }
+    },
+    "./client": {
+      "require": {
+        "default": "./dist/cjs/client.js",
+        "types": "./dist/cjs/client.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/client.js",
+        "types": "./dist/esm/client.d.ts"
+      }
+    },
+    ".": {
+      "require": {
+        "default": "./dist/cjs/index.js",
+        "types": "./dist/cjs/index.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/index.js",
+        "types": "./dist/esm/index.d.ts"
+      }
+    },
+    "./package.json": "./package.json"
+  },
+  "module": "./dist/esm/index.js"
 }

+ 2 - 2
target_chains/sui/sdk/js/src/SuiPriceServiceConnection.ts

@@ -1,7 +1,7 @@
 import {
   HermesClient,
-  HexString,
-  PriceUpdate,
+  type HexString,
+  type PriceUpdate,
 } from "@pythnetwork/hermes-client";
 import { Buffer } from "buffer";
 

+ 8 - 8
target_chains/sui/sdk/js/src/client.ts

@@ -2,7 +2,7 @@ import { SuiClient } from "@mysten/sui/client";
 import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
 import { Transaction } from "@mysten/sui/transactions";
 import { bcs } from "@mysten/sui/bcs";
-import { HexString } from "@pythnetwork/hermes-client";
+import { type HexString } from "@pythnetwork/hermes-client";
 import { Buffer } from "buffer";
 
 const MAX_ARGUMENT_SIZE = 16 * 1024;
@@ -118,7 +118,7 @@ export class SuiPythClient {
         "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);
     const [priceUpdatesHotPotato] = tx.moveCall({
       target: `${packageId}::pyth::create_authenticated_price_infos_using_accumulator`,
@@ -127,16 +127,16 @@ export class SuiPythClient {
         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(SUI_CLOCK_OBJECT_ID),
       ],
     });
-    return priceUpdatesHotPotato;
+    return priceUpdatesHotPotato!;
   }
 
   async executePriceFeedUpdates(
@@ -245,7 +245,7 @@ export class SuiPythClient {
         "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`,
@@ -254,12 +254,12 @@ export class SuiPythClient {
         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(SUI_CLOCK_OBJECT_ID),
       ],
     });

+ 3 - 3
target_chains/sui/sdk/js/src/index.ts

@@ -1,7 +1,7 @@
-export { SuiPriceServiceConnection } from "./SuiPriceServiceConnection";
-export { SuiPythClient } from "./client";
+export { SuiPriceServiceConnection } from "./SuiPriceServiceConnection.js";
+export { SuiPythClient } from "./client.js";
 
-export {
+export type {
   AssetType,
   BinaryPriceUpdate,
   DurationInMs,

+ 3 - 2
target_chains/sui/sdk/js/tsconfig.build.json

@@ -3,12 +3,13 @@
   "compilerOptions": {
     "noEmit": false,
     "incremental": false,
-    "declaration": true
+    "declaration": true,
+    "isolatedModules": false
   },
   "exclude": [
     "node_modules",
     "dist",
-    "examples/",
+    "src/examples/",
     "**/__tests__/*"
   ]
 }

+ 17 - 3
target_chains/ton/sdk/js/package.json

@@ -6,8 +6,8 @@
   "author": {
     "name": "Pyth Data Association"
   },
-  "main": "lib/index.js",
-  "types": "lib/index.d.ts",
+  "main": "./dist/cjs/index.js",
+  "types": "./dist/cjs/index.d.ts",
   "files": [
     "dist/**/*"
   ],
@@ -53,5 +53,19 @@
     "pnpm": ">=10.19.0"
   },
   "packageManager": "pnpm@10.19.0",
-  "type": "module"
+  "type": "module",
+  "exports": {
+    ".": {
+      "require": {
+        "default": "./dist/cjs/index.js",
+        "types": "./dist/cjs/index.d.ts"
+      },
+      "import": {
+        "default": "./dist/esm/index.js",
+        "types": "./dist/esm/index.d.ts"
+      }
+    },
+    "./package.json": "./package.json"
+  },
+  "module": "./dist/esm/index.js"
 }

+ 4 - 4
target_chains/ton/sdk/js/src/index.ts

@@ -2,13 +2,13 @@ import {
   Address,
   beginCell,
   Cell,
-  Contract,
+  type Contract,
   Dictionary,
-  Sender,
+  type Sender,
   SendMode,
   toNano,
 } from "@ton/core";
-import { ContractProvider } from "@ton/ton";
+import type { ContractProvider } from "@ton/ton";
 
 export const PYTH_CONTRACT_ADDRESS_MAINNET =
   "EQBgtfuGIzWLiOzpZO48_psYvco4xRtkAbdbmTwy0_o95LtZ";
@@ -253,7 +253,7 @@ export function createCellChain(buffer: Buffer): Cell {
   let lastCell: Cell | null = null;
   // Iterate through chunks in reverse order
   for (let i = chunks.length - 1; i >= 0; i--) {
-    const chunk = chunks[i];
+    const chunk = chunks[i]!;
     const cellBuilder = beginCell();
     const buffer = Buffer.from(chunk);
     cellBuilder.storeBuffer(buffer);

+ 2 - 1
target_chains/ton/sdk/js/tsconfig.build.json

@@ -3,7 +3,8 @@
   "compilerOptions": {
     "noEmit": false,
     "incremental": false,
-    "declaration": true
+    "declaration": true,
+    "isolatedModules": false
   },
   "exclude": [
     "node_modules",