@exagent/sdk 0.1.19 → 0.1.21

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
@@ -196,6 +196,38 @@ interface RouterTradeResponse {
196
196
  simulationSkipped?: boolean;
197
197
  /** Warning message when simulation failed */
198
198
  simulationWarning?: string;
199
+ /**
200
+ * Raw aggregator params for vault trading.
201
+ * SDK calls vault trade functions directly using these params.
202
+ * Vault adds agentId/configHash; SDK adds deadline at call time.
203
+ */
204
+ vaultParams?: VaultTradeParams;
205
+ }
206
+ /**
207
+ * Vault trade params returned by the API.
208
+ * Discriminated union on `swapType` — each type has different aggregator fields.
209
+ */
210
+ type VaultTradeParams = VaultTradeParamsSimple | VaultTradeParamsSwap | VaultTradeParamsMultihop;
211
+ interface VaultTradeParamsSimple {
212
+ swapType: 'simple';
213
+ target: Address;
214
+ data: `0x${string}`;
215
+ feeConvertAggregator: Address;
216
+ feeSwapData: `0x${string}`;
217
+ }
218
+ interface VaultTradeParamsSwap {
219
+ swapType: 'swap';
220
+ aggregator: Address;
221
+ swapData: `0x${string}`;
222
+ feeConvertAggregator: Address;
223
+ feeSwapData: `0x${string}`;
224
+ }
225
+ interface VaultTradeParamsMultihop {
226
+ swapType: 'multihop';
227
+ aggregator1: Address;
228
+ swapData1: `0x${string}`;
229
+ aggregator2: Address;
230
+ swapData2: `0x${string}`;
199
231
  }
200
232
  /**
201
233
  * Trade execution result
@@ -1087,7 +1119,7 @@ declare class ExagentVault {
1087
1119
  }
1088
1120
 
1089
1121
  /** SDK version — sent to API for version gating */
1090
- declare const SDK_VERSION = "0.1.18";
1122
+ declare const SDK_VERSION = "0.1.21";
1091
1123
  /**
1092
1124
  * Default RPC URL for Base mainnet.
1093
1125
  * Coinbase's official Base RPC — reliable for reads and transactions.
@@ -2096,4 +2128,4 @@ declare class ExagentVaultFactory {
2096
2128
  }>;
2097
2129
  }
2098
2130
 
2099
- export { type AgentMetadata, type AgentProfile, CHAIN_CONFIG, CONTRACT_ADDRESSES, type CanCreateVaultResult, type CreateVaultOptions, DEFAULT_RPC_URL, DEX_ADDRESSES, EXAGENT_API_CONFIG, EXAGENT_REGISTRY_ABI, EXAGENT_ROUTER_ABI, EXAGENT_VAULT_FACTORY_ABI, ExagentClient, type ExagentClientConfig, ExagentRegistry, ExagentVault, ExagentVaultFactory, type GlobalAgentId, type NetworkType, type PerformanceSnapshot, type PriceQuote, type RouteQuote, type RouteStep, type RouterTradeResponse, SDK_VERSION, type ServiceRequest, 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 };
2131
+ export { type AgentMetadata, type AgentProfile, CHAIN_CONFIG, CONTRACT_ADDRESSES, type CanCreateVaultResult, type CreateVaultOptions, DEFAULT_RPC_URL, DEX_ADDRESSES, EXAGENT_API_CONFIG, EXAGENT_REGISTRY_ABI, EXAGENT_ROUTER_ABI, EXAGENT_VAULT_FACTORY_ABI, ExagentClient, type ExagentClientConfig, ExagentRegistry, ExagentVault, ExagentVaultFactory, type GlobalAgentId, type NetworkType, type PerformanceSnapshot, type PriceQuote, type RouteQuote, type RouteStep, type RouterTradeResponse, SDK_VERSION, type ServiceRequest, type TradeIntent, type TradeResult, type UserVaultPosition, type VaultActivityEntry, type VaultConfig, type VaultCreationRequirements, type VaultInfo, type VaultPosition, type VaultSummary, type VaultTradeEntry, type VaultTradeParams, type VaultTradeParamsMultihop, type VaultTradeParamsSimple, type VaultTradeParamsSwap, type WithdrawalRequest, ZERO_X_CONFIG, buildGlobalAgentId, getRpcUrl, parseGlobalAgentId };
package/dist/index.d.ts CHANGED
@@ -196,6 +196,38 @@ interface RouterTradeResponse {
196
196
  simulationSkipped?: boolean;
197
197
  /** Warning message when simulation failed */
198
198
  simulationWarning?: string;
199
+ /**
200
+ * Raw aggregator params for vault trading.
201
+ * SDK calls vault trade functions directly using these params.
202
+ * Vault adds agentId/configHash; SDK adds deadline at call time.
203
+ */
204
+ vaultParams?: VaultTradeParams;
205
+ }
206
+ /**
207
+ * Vault trade params returned by the API.
208
+ * Discriminated union on `swapType` — each type has different aggregator fields.
209
+ */
210
+ type VaultTradeParams = VaultTradeParamsSimple | VaultTradeParamsSwap | VaultTradeParamsMultihop;
211
+ interface VaultTradeParamsSimple {
212
+ swapType: 'simple';
213
+ target: Address;
214
+ data: `0x${string}`;
215
+ feeConvertAggregator: Address;
216
+ feeSwapData: `0x${string}`;
217
+ }
218
+ interface VaultTradeParamsSwap {
219
+ swapType: 'swap';
220
+ aggregator: Address;
221
+ swapData: `0x${string}`;
222
+ feeConvertAggregator: Address;
223
+ feeSwapData: `0x${string}`;
224
+ }
225
+ interface VaultTradeParamsMultihop {
226
+ swapType: 'multihop';
227
+ aggregator1: Address;
228
+ swapData1: `0x${string}`;
229
+ aggregator2: Address;
230
+ swapData2: `0x${string}`;
199
231
  }
200
232
  /**
201
233
  * Trade execution result
@@ -1087,7 +1119,7 @@ declare class ExagentVault {
1087
1119
  }
1088
1120
 
1089
1121
  /** SDK version — sent to API for version gating */
1090
- declare const SDK_VERSION = "0.1.18";
1122
+ declare const SDK_VERSION = "0.1.21";
1091
1123
  /**
1092
1124
  * Default RPC URL for Base mainnet.
1093
1125
  * Coinbase's official Base RPC — reliable for reads and transactions.
@@ -2096,4 +2128,4 @@ declare class ExagentVaultFactory {
2096
2128
  }>;
2097
2129
  }
2098
2130
 
2099
- export { type AgentMetadata, type AgentProfile, CHAIN_CONFIG, CONTRACT_ADDRESSES, type CanCreateVaultResult, type CreateVaultOptions, DEFAULT_RPC_URL, DEX_ADDRESSES, EXAGENT_API_CONFIG, EXAGENT_REGISTRY_ABI, EXAGENT_ROUTER_ABI, EXAGENT_VAULT_FACTORY_ABI, ExagentClient, type ExagentClientConfig, ExagentRegistry, ExagentVault, ExagentVaultFactory, type GlobalAgentId, type NetworkType, type PerformanceSnapshot, type PriceQuote, type RouteQuote, type RouteStep, type RouterTradeResponse, SDK_VERSION, type ServiceRequest, 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 };
2131
+ export { type AgentMetadata, type AgentProfile, CHAIN_CONFIG, CONTRACT_ADDRESSES, type CanCreateVaultResult, type CreateVaultOptions, DEFAULT_RPC_URL, DEX_ADDRESSES, EXAGENT_API_CONFIG, EXAGENT_REGISTRY_ABI, EXAGENT_ROUTER_ABI, EXAGENT_VAULT_FACTORY_ABI, ExagentClient, type ExagentClientConfig, ExagentRegistry, ExagentVault, ExagentVaultFactory, type GlobalAgentId, type NetworkType, type PerformanceSnapshot, type PriceQuote, type RouteQuote, type RouteStep, type RouterTradeResponse, SDK_VERSION, type ServiceRequest, type TradeIntent, type TradeResult, type UserVaultPosition, type VaultActivityEntry, type VaultConfig, type VaultCreationRequirements, type VaultInfo, type VaultPosition, type VaultSummary, type VaultTradeEntry, type VaultTradeParams, type VaultTradeParamsMultihop, type VaultTradeParamsSimple, type VaultTradeParamsSwap, type WithdrawalRequest, ZERO_X_CONFIG, buildGlobalAgentId, getRpcUrl, parseGlobalAgentId };
package/dist/index.js CHANGED
@@ -1199,7 +1199,7 @@ var ExagentVault = class {
1199
1199
 
1200
1200
  // src/constants.ts
1201
1201
  var import_chains = require("viem/chains");
1202
- var SDK_VERSION = "0.1.18";
1202
+ var SDK_VERSION = "0.1.21";
1203
1203
  var DEFAULT_RPC_URL = "https://mainnet.base.org";
1204
1204
  function getRpcUrl() {
1205
1205
  if (typeof process !== "undefined" && process.env) {
@@ -1213,8 +1213,8 @@ var CHAIN_CONFIG = {
1213
1213
  var CONTRACT_ADDRESSES = {
1214
1214
  mainnet: {
1215
1215
  agentRegistry: "0x2261706C751F8ac5cdDb481B7b56EA2137d4A723",
1216
- router: "0x20feB3054750970773Fe7370c391732EE0559743",
1217
- vaultFactory: "0x1E0e4E445A9fda2e7aBBfFEcA80392ABb0921554",
1216
+ router: "0xBfE186E2Bba9B730c8732917AE36E7AC143420d3",
1217
+ vaultFactory: "0x3312f7C0059C03b47Df63DA4f73B79A63a874ef5",
1218
1218
  feeCollector: "0x00Ab9847049b5496619dFDd1A7bd36FA49eB7195",
1219
1219
  serviceEscrow: "0x63A4d1dA774422EFC2cc57d71F948231BD812516"
1220
1220
  }
@@ -1533,6 +1533,21 @@ var ExagentClient = class {
1533
1533
  }
1534
1534
  }
1535
1535
  const hash = await this.walletClient.sendTransaction(txParams);
1536
+ if (routerTrade.route && routerTrade.route.length > 0) {
1537
+ const dexSource = [...new Set(routerTrade.route.map((r) => r.dex))].join(", ");
1538
+ const routeApiUrl = EXAGENT_API_CONFIG[this.network];
1539
+ fetch(`${routeApiUrl}/v1/router/trade-route`, {
1540
+ method: "POST",
1541
+ headers: this.apiHeaders("application/json"),
1542
+ body: JSON.stringify({
1543
+ txHash: hash,
1544
+ agentId: Number(agentId),
1545
+ dexSource,
1546
+ route: routerTrade.route
1547
+ })
1548
+ }).catch(() => {
1549
+ });
1550
+ }
1536
1551
  return {
1537
1552
  hash,
1538
1553
  agentId,
package/dist/index.mjs CHANGED
@@ -1168,7 +1168,7 @@ var ExagentVault = class {
1168
1168
 
1169
1169
  // src/constants.ts
1170
1170
  import { base } from "viem/chains";
1171
- var SDK_VERSION = "0.1.18";
1171
+ var SDK_VERSION = "0.1.21";
1172
1172
  var DEFAULT_RPC_URL = "https://mainnet.base.org";
1173
1173
  function getRpcUrl() {
1174
1174
  if (typeof process !== "undefined" && process.env) {
@@ -1182,8 +1182,8 @@ var CHAIN_CONFIG = {
1182
1182
  var CONTRACT_ADDRESSES = {
1183
1183
  mainnet: {
1184
1184
  agentRegistry: "0x2261706C751F8ac5cdDb481B7b56EA2137d4A723",
1185
- router: "0x20feB3054750970773Fe7370c391732EE0559743",
1186
- vaultFactory: "0x1E0e4E445A9fda2e7aBBfFEcA80392ABb0921554",
1185
+ router: "0xBfE186E2Bba9B730c8732917AE36E7AC143420d3",
1186
+ vaultFactory: "0x3312f7C0059C03b47Df63DA4f73B79A63a874ef5",
1187
1187
  feeCollector: "0x00Ab9847049b5496619dFDd1A7bd36FA49eB7195",
1188
1188
  serviceEscrow: "0x63A4d1dA774422EFC2cc57d71F948231BD812516"
1189
1189
  }
@@ -1502,6 +1502,21 @@ var ExagentClient = class {
1502
1502
  }
1503
1503
  }
1504
1504
  const hash = await this.walletClient.sendTransaction(txParams);
1505
+ if (routerTrade.route && routerTrade.route.length > 0) {
1506
+ const dexSource = [...new Set(routerTrade.route.map((r) => r.dex))].join(", ");
1507
+ const routeApiUrl = EXAGENT_API_CONFIG[this.network];
1508
+ fetch(`${routeApiUrl}/v1/router/trade-route`, {
1509
+ method: "POST",
1510
+ headers: this.apiHeaders("application/json"),
1511
+ body: JSON.stringify({
1512
+ txHash: hash,
1513
+ agentId: Number(agentId),
1514
+ dexSource,
1515
+ route: routerTrade.route
1516
+ })
1517
+ }).catch(() => {
1518
+ });
1519
+ }
1505
1520
  return {
1506
1521
  hash,
1507
1522
  agentId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exagent/sdk",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "TypeScript SDK for Exagent",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",