@exagent/sdk 0.1.5 → 0.1.6

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.d.mts CHANGED
@@ -1337,7 +1337,17 @@ declare class ExagentStaking {
1337
1337
  }
1338
1338
 
1339
1339
  /** SDK version — sent to API for version gating */
1340
- declare const SDK_VERSION = "0.1.4";
1340
+ declare const SDK_VERSION = "0.1.6";
1341
+ /**
1342
+ * Default RPC URL for Base mainnet.
1343
+ * Uses a higher-limit public endpoint to avoid rate-limiting.
1344
+ * Users should set BASE_RPC_URL env var for production use.
1345
+ */
1346
+ declare const DEFAULT_RPC_URL = "https://base-rpc.publicnode.com";
1347
+ /**
1348
+ * Get RPC URL from environment or use default.
1349
+ */
1350
+ declare function getRpcUrl(): string;
1341
1351
  declare const CHAIN_CONFIG: {
1342
1352
  readonly mainnet: {
1343
1353
  blockExplorers: {
@@ -2334,4 +2344,4 @@ declare class ExagentVaultFactory {
2334
2344
  }>;
2335
2345
  }
2336
2346
 
2337
- export { type AgentMetadata, type AgentProfile, type StakingInfo$1 as ApiStakingInfo, CHAIN_CONFIG, CONTRACT_ADDRESSES, type CanCreateVaultResult, type CreateVaultOptions, DEX_ADDRESSES, type DepositInfo, EXAGENT_API_CONFIG, EXAGENT_STAKING_ABI, EXAGENT_VAULT_FACTORY_ABI, type EarningsTierInfo, ExagentClient, type ExagentClientConfig, ExagentRegistry, ExagentStaking, ExagentVault, ExagentVaultFactory, type GlobalAgentId, type LockInfo, type NetworkType, type PerformanceSnapshot, type PriceQuote, type RouteQuote, type RouteStep, type RouterTradeResponse, SDK_VERSION, type ServiceRequest, type StakeInfo, type StakingInfo, type TradeIntent, type TradeResult, type UserVaultPosition, type VaultActivityEntry, type VaultConfig, type VaultCreationRequirements, type VaultInfo, type VaultPosition, type VaultSummary, type VaultTradeEntry, type WithdrawalRequest, ZERO_X_CONFIG, buildGlobalAgentId, parseGlobalAgentId };
2347
+ export { type AgentMetadata, type AgentProfile, type StakingInfo$1 as ApiStakingInfo, CHAIN_CONFIG, CONTRACT_ADDRESSES, type CanCreateVaultResult, type CreateVaultOptions, DEFAULT_RPC_URL, DEX_ADDRESSES, type DepositInfo, EXAGENT_API_CONFIG, EXAGENT_STAKING_ABI, EXAGENT_VAULT_FACTORY_ABI, type EarningsTierInfo, ExagentClient, type ExagentClientConfig, ExagentRegistry, ExagentStaking, ExagentVault, ExagentVaultFactory, type GlobalAgentId, type LockInfo, type NetworkType, type PerformanceSnapshot, type PriceQuote, type RouteQuote, type RouteStep, type RouterTradeResponse, SDK_VERSION, type ServiceRequest, type StakeInfo, type StakingInfo, type TradeIntent, type TradeResult, type UserVaultPosition, type VaultActivityEntry, type VaultConfig, type VaultCreationRequirements, type VaultInfo, type VaultPosition, type VaultSummary, type VaultTradeEntry, type WithdrawalRequest, ZERO_X_CONFIG, buildGlobalAgentId, getRpcUrl, parseGlobalAgentId };
package/dist/index.d.ts CHANGED
@@ -1337,7 +1337,17 @@ declare class ExagentStaking {
1337
1337
  }
1338
1338
 
1339
1339
  /** SDK version — sent to API for version gating */
1340
- declare const SDK_VERSION = "0.1.4";
1340
+ declare const SDK_VERSION = "0.1.6";
1341
+ /**
1342
+ * Default RPC URL for Base mainnet.
1343
+ * Uses a higher-limit public endpoint to avoid rate-limiting.
1344
+ * Users should set BASE_RPC_URL env var for production use.
1345
+ */
1346
+ declare const DEFAULT_RPC_URL = "https://base-rpc.publicnode.com";
1347
+ /**
1348
+ * Get RPC URL from environment or use default.
1349
+ */
1350
+ declare function getRpcUrl(): string;
1341
1351
  declare const CHAIN_CONFIG: {
1342
1352
  readonly mainnet: {
1343
1353
  blockExplorers: {
@@ -2334,4 +2344,4 @@ declare class ExagentVaultFactory {
2334
2344
  }>;
2335
2345
  }
2336
2346
 
2337
- export { type AgentMetadata, type AgentProfile, type StakingInfo$1 as ApiStakingInfo, CHAIN_CONFIG, CONTRACT_ADDRESSES, type CanCreateVaultResult, type CreateVaultOptions, DEX_ADDRESSES, type DepositInfo, EXAGENT_API_CONFIG, EXAGENT_STAKING_ABI, EXAGENT_VAULT_FACTORY_ABI, type EarningsTierInfo, ExagentClient, type ExagentClientConfig, ExagentRegistry, ExagentStaking, ExagentVault, ExagentVaultFactory, type GlobalAgentId, type LockInfo, type NetworkType, type PerformanceSnapshot, type PriceQuote, type RouteQuote, type RouteStep, type RouterTradeResponse, SDK_VERSION, type ServiceRequest, type StakeInfo, type StakingInfo, type TradeIntent, type TradeResult, type UserVaultPosition, type VaultActivityEntry, type VaultConfig, type VaultCreationRequirements, type VaultInfo, type VaultPosition, type VaultSummary, type VaultTradeEntry, type WithdrawalRequest, ZERO_X_CONFIG, buildGlobalAgentId, parseGlobalAgentId };
2347
+ export { type AgentMetadata, type AgentProfile, type StakingInfo$1 as ApiStakingInfo, CHAIN_CONFIG, CONTRACT_ADDRESSES, type CanCreateVaultResult, type CreateVaultOptions, DEFAULT_RPC_URL, DEX_ADDRESSES, type DepositInfo, EXAGENT_API_CONFIG, EXAGENT_STAKING_ABI, EXAGENT_VAULT_FACTORY_ABI, type EarningsTierInfo, ExagentClient, type ExagentClientConfig, ExagentRegistry, ExagentStaking, ExagentVault, ExagentVaultFactory, type GlobalAgentId, type LockInfo, type NetworkType, type PerformanceSnapshot, type PriceQuote, type RouteQuote, type RouteStep, type RouterTradeResponse, SDK_VERSION, type ServiceRequest, type StakeInfo, type StakingInfo, type TradeIntent, type TradeResult, type UserVaultPosition, type VaultActivityEntry, type VaultConfig, type VaultCreationRequirements, type VaultInfo, type VaultPosition, type VaultSummary, type VaultTradeEntry, type WithdrawalRequest, ZERO_X_CONFIG, buildGlobalAgentId, getRpcUrl, parseGlobalAgentId };
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  CHAIN_CONFIG: () => CHAIN_CONFIG,
24
24
  CONTRACT_ADDRESSES: () => CONTRACT_ADDRESSES,
25
+ DEFAULT_RPC_URL: () => DEFAULT_RPC_URL,
25
26
  DEX_ADDRESSES: () => DEX_ADDRESSES,
26
27
  EXAGENT_API_CONFIG: () => EXAGENT_API_CONFIG,
27
28
  EXAGENT_STAKING_ABI: () => EXAGENT_STAKING_ABI,
@@ -34,6 +35,7 @@ __export(index_exports, {
34
35
  SDK_VERSION: () => SDK_VERSION,
35
36
  ZERO_X_CONFIG: () => ZERO_X_CONFIG,
36
37
  buildGlobalAgentId: () => buildGlobalAgentId,
38
+ getRpcUrl: () => getRpcUrl,
37
39
  parseGlobalAgentId: () => parseGlobalAgentId
38
40
  });
39
41
  module.exports = __toCommonJS(index_exports);
@@ -2057,7 +2059,14 @@ var ExagentStaking = class {
2057
2059
 
2058
2060
  // src/constants.ts
2059
2061
  var import_chains = require("viem/chains");
2060
- var SDK_VERSION = "0.1.4";
2062
+ var SDK_VERSION = "0.1.6";
2063
+ var DEFAULT_RPC_URL = "https://base-rpc.publicnode.com";
2064
+ function getRpcUrl() {
2065
+ if (typeof process !== "undefined" && process.env) {
2066
+ return process.env.BASE_RPC_URL || process.env.EXAGENT_RPC_URL || DEFAULT_RPC_URL;
2067
+ }
2068
+ return DEFAULT_RPC_URL;
2069
+ }
2061
2070
  var CHAIN_CONFIG = {
2062
2071
  mainnet: import_chains.base
2063
2072
  };
@@ -2148,9 +2157,10 @@ var ExagentClient = class {
2148
2157
  this.apiKey = config.apiKey;
2149
2158
  validateContractAddresses(this.network);
2150
2159
  const chain = CHAIN_CONFIG[this.network];
2160
+ const rpcUrl = config.rpcUrl || getRpcUrl();
2151
2161
  this.publicClient = (0, import_viem2.createPublicClient)({
2152
2162
  chain,
2153
- transport: (0, import_viem2.http)(config.rpcUrl)
2163
+ transport: (0, import_viem2.http)(rpcUrl)
2154
2164
  });
2155
2165
  if (config.walletClient) {
2156
2166
  this.walletClient = config.walletClient;
@@ -2160,7 +2170,7 @@ var ExagentClient = class {
2160
2170
  this.walletClient = (0, import_viem2.createWalletClient)({
2161
2171
  account: this.account,
2162
2172
  chain,
2163
- transport: (0, import_viem2.http)(config.rpcUrl)
2173
+ transport: (0, import_viem2.http)(rpcUrl)
2164
2174
  });
2165
2175
  } else {
2166
2176
  throw new Error("Either privateKey or walletClient must be provided");
@@ -3014,6 +3024,7 @@ var ExagentVaultFactory = class {
3014
3024
  0 && (module.exports = {
3015
3025
  CHAIN_CONFIG,
3016
3026
  CONTRACT_ADDRESSES,
3027
+ DEFAULT_RPC_URL,
3017
3028
  DEX_ADDRESSES,
3018
3029
  EXAGENT_API_CONFIG,
3019
3030
  EXAGENT_STAKING_ABI,
@@ -3026,5 +3037,6 @@ var ExagentVaultFactory = class {
3026
3037
  SDK_VERSION,
3027
3038
  ZERO_X_CONFIG,
3028
3039
  buildGlobalAgentId,
3040
+ getRpcUrl,
3029
3041
  parseGlobalAgentId
3030
3042
  });
package/dist/index.mjs CHANGED
@@ -2024,7 +2024,14 @@ var ExagentStaking = class {
2024
2024
 
2025
2025
  // src/constants.ts
2026
2026
  import { base } from "viem/chains";
2027
- var SDK_VERSION = "0.1.4";
2027
+ var SDK_VERSION = "0.1.6";
2028
+ var DEFAULT_RPC_URL = "https://base-rpc.publicnode.com";
2029
+ function getRpcUrl() {
2030
+ if (typeof process !== "undefined" && process.env) {
2031
+ return process.env.BASE_RPC_URL || process.env.EXAGENT_RPC_URL || DEFAULT_RPC_URL;
2032
+ }
2033
+ return DEFAULT_RPC_URL;
2034
+ }
2028
2035
  var CHAIN_CONFIG = {
2029
2036
  mainnet: base
2030
2037
  };
@@ -2115,9 +2122,10 @@ var ExagentClient = class {
2115
2122
  this.apiKey = config.apiKey;
2116
2123
  validateContractAddresses(this.network);
2117
2124
  const chain = CHAIN_CONFIG[this.network];
2125
+ const rpcUrl = config.rpcUrl || getRpcUrl();
2118
2126
  this.publicClient = createPublicClient({
2119
2127
  chain,
2120
- transport: http(config.rpcUrl)
2128
+ transport: http(rpcUrl)
2121
2129
  });
2122
2130
  if (config.walletClient) {
2123
2131
  this.walletClient = config.walletClient;
@@ -2127,7 +2135,7 @@ var ExagentClient = class {
2127
2135
  this.walletClient = createWalletClient({
2128
2136
  account: this.account,
2129
2137
  chain,
2130
- transport: http(config.rpcUrl)
2138
+ transport: http(rpcUrl)
2131
2139
  });
2132
2140
  } else {
2133
2141
  throw new Error("Either privateKey or walletClient must be provided");
@@ -2980,6 +2988,7 @@ var ExagentVaultFactory = class {
2980
2988
  export {
2981
2989
  CHAIN_CONFIG,
2982
2990
  CONTRACT_ADDRESSES,
2991
+ DEFAULT_RPC_URL,
2983
2992
  DEX_ADDRESSES,
2984
2993
  EXAGENT_API_CONFIG,
2985
2994
  EXAGENT_STAKING_ABI,
@@ -2992,5 +3001,6 @@ export {
2992
3001
  SDK_VERSION,
2993
3002
  ZERO_X_CONFIG,
2994
3003
  buildGlobalAgentId,
3004
+ getRpcUrl,
2995
3005
  parseGlobalAgentId
2996
3006
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exagent/sdk",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "TypeScript SDK for Exagent",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",