@veridex/sdk 1.0.0-beta.11 → 1.0.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3738,16 +3738,30 @@ var SolanaClient = class {
3738
3738
  // src/chains/aptos/AptosClient.ts
3739
3739
  import { AptosClient as AptosSDK } from "aptos";
3740
3740
  import { sha3_256 } from "js-sha3";
3741
+ function normalizeAptosRpcUrl(rpcUrl) {
3742
+ const trimmed = rpcUrl.trim().replace(/\/+$/, "");
3743
+ const withoutV1 = trimmed.replace(/\/v1$/, "");
3744
+ try {
3745
+ const url = new URL(withoutV1);
3746
+ if (url.protocol === "https:" && !url.port) {
3747
+ url.port = "443";
3748
+ }
3749
+ return url.origin;
3750
+ } catch {
3751
+ return withoutV1;
3752
+ }
3753
+ }
3741
3754
  var AptosClient = class {
3742
3755
  config;
3743
3756
  client;
3744
3757
  moduleAddress;
3745
3758
  constructor(config) {
3759
+ const normalizedRpcUrl = normalizeAptosRpcUrl(config.rpcUrl);
3746
3760
  this.config = {
3747
3761
  name: `Aptos ${config.network || "mainnet"}`,
3748
3762
  chainId: config.wormholeChainId,
3749
3763
  wormholeChainId: config.wormholeChainId,
3750
- rpcUrl: config.rpcUrl,
3764
+ rpcUrl: normalizedRpcUrl,
3751
3765
  explorerUrl: config.network === "testnet" ? "https://explorer.aptoslabs.com?network=testnet" : "https://explorer.aptoslabs.com",
3752
3766
  isEvm: false,
3753
3767
  contracts: {
@@ -3757,7 +3771,7 @@ var AptosClient = class {
3757
3771
  tokenBridge: config.tokenBridge
3758
3772
  }
3759
3773
  };
3760
- this.client = new AptosSDK(config.rpcUrl);
3774
+ this.client = new AptosSDK(normalizedRpcUrl);
3761
3775
  this.moduleAddress = config.moduleAddress;
3762
3776
  }
3763
3777
  getConfig() {