@hightop/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/client.js CHANGED
@@ -230,6 +230,7 @@ export class HightopAgentClient {
230
230
  while (Date.now() <= deadline) {
231
231
  const remainingMs = Math.max(1, deadline - Date.now());
232
232
  const pollRequestTimeoutMs = Math.min(this.timeoutMs, remainingMs);
233
+ const pollBoundByWaitDeadline = pollRequestTimeoutMs === remainingMs;
233
234
  let response;
234
235
  try {
235
236
  response = await this.operations.get(id, undefined, {
@@ -239,7 +240,9 @@ export class HightopAgentClient {
239
240
  });
240
241
  }
241
242
  catch (error) {
242
- if (Date.now() >= deadline && error instanceof HightopAgentSDKError && error.code === 'request_timeout') {
243
+ if (error instanceof HightopAgentSDKError &&
244
+ error.code === 'request_timeout' &&
245
+ (pollBoundByWaitDeadline || Date.now() >= deadline)) {
243
246
  break;
244
247
  }
245
248
  throw error;
@@ -1,4 +1,4 @@
1
- export declare const AGENT_API_CONTRACT_VERSION = "1.6.0";
1
+ export declare const AGENT_API_CONTRACT_VERSION = "1.7.0";
2
2
  export type EthAddress = `0x${string}`;
3
3
  export type AgentErrorDetailsByCode = {
4
4
  idempotency_request_in_progress: {
@@ -121,6 +121,32 @@ export type AgentApiSelfUsageResponse = {
121
121
  operations_submitted_today?: number;
122
122
  };
123
123
  };
124
+ export type AgentApiSelfLimitsResponse = {
125
+ ok: true;
126
+ spend_limits: {
127
+ per_tx_usd: string | null;
128
+ per_period_usd: string | null;
129
+ lifetime_usd: string | null;
130
+ max_txs_per_period: number | null;
131
+ tx_cooldown_blocks: number | null;
132
+ fail_on_zero_price: boolean;
133
+ };
134
+ swap_limits: {
135
+ max_slippage_bps: number | null;
136
+ max_swaps_per_period: number | null;
137
+ };
138
+ permissions: {
139
+ operation_types: Array<'payment' | 'conversion' | 'earn.deposit' | 'earn.withdraw' | 'earn.move' | 'earn.rewards_claim' | 'debt.borrow' | 'debt.repay' | 'debt.deleverage' | 'collateral.add' | 'collateral.remove' | 'trusted_destination.confirm' | 'trusted_destination.cancel' | 'trusted_destination.remove' | 'withdrawal.bank' | 'withdrawal.crypto' | 'one_off_payment.create'>;
140
+ cannot: Array<'payment' | 'conversion' | 'earn.deposit' | 'earn.withdraw' | 'earn.move' | 'earn.rewards_claim' | 'debt.borrow' | 'debt.repay' | 'debt.deleverage' | 'collateral.add' | 'collateral.remove' | 'trusted_destination.confirm' | 'trusted_destination.cancel' | 'trusted_destination.remove' | 'withdrawal.bank' | 'withdrawal.crypto' | 'one_off_payment.create'>;
141
+ };
142
+ current_usage: {
143
+ txs_in_period: number;
144
+ spent_in_period_usd: string;
145
+ swaps_in_period: number;
146
+ total_txs: number;
147
+ total_spent_usd: string;
148
+ };
149
+ };
124
150
  export type AgentApiCapabilitiesResponse = {
125
151
  ok: true;
126
152
  api_version: '1.0';
@@ -698,6 +724,7 @@ export type AgentApiSimulateRequest = {
698
724
  method: 'POST' | 'PATCH' | 'DELETE';
699
725
  path: string;
700
726
  body: unknown;
727
+ depth?: 'static' | 'policy' | 'onchain';
701
728
  };
702
729
  export type AgentApiSimulateResponse = {
703
730
  ok: true;
@@ -1044,6 +1071,21 @@ export declare const agentApiEndpoints: readonly [{
1044
1071
  readonly idempotencyRequired: false;
1045
1072
  readonly routeClass: "read";
1046
1073
  readonly description: "Return current Agent API rate-limit and usage state.";
1074
+ }, {
1075
+ readonly key: "GET /v1/agent/self/limits";
1076
+ readonly method: "GET";
1077
+ readonly path: "/v1/agent/self/limits";
1078
+ readonly pathParams: readonly [];
1079
+ readonly queryParams: readonly [];
1080
+ readonly bodyParams: readonly [];
1081
+ readonly requestSchema: null;
1082
+ readonly bodySchema: null;
1083
+ readonly responseSchema: "agentApiSelfLimitsResponse";
1084
+ readonly requestType: null;
1085
+ readonly responseType: "AgentApiSelfLimitsResponse";
1086
+ readonly idempotencyRequired: false;
1087
+ readonly routeClass: "read";
1088
+ readonly description: "Return the authenticated agent's configured spend limits and current-period usage.";
1047
1089
  }, {
1048
1090
  readonly key: "GET /v1/agent/capabilities";
1049
1091
  readonly method: "GET";
@@ -1830,7 +1872,7 @@ export declare const agentApiEndpoints: readonly [{
1830
1872
  readonly path: "/v1/agent/simulate";
1831
1873
  readonly pathParams: readonly [];
1832
1874
  readonly queryParams: readonly [];
1833
- readonly bodyParams: readonly ["method", "path", "body"];
1875
+ readonly bodyParams: readonly ["method", "path", "body", "depth"];
1834
1876
  readonly requestSchema: "agentApiSimulateRequest";
1835
1877
  readonly bodySchema: "agentApiSimulateRequest";
1836
1878
  readonly responseSchema: "agentApiSimulateResponse";
@@ -2013,6 +2055,7 @@ export type AgentApiPathParams = Record<string, AgentApiPathParamValue>;
2013
2055
  export type AgentApiEndpointRequestMap = {
2014
2056
  readonly 'GET /v1/agent/self': undefined;
2015
2057
  readonly 'GET /v1/agent/self/usage': undefined;
2058
+ readonly 'GET /v1/agent/self/limits': undefined;
2016
2059
  readonly 'GET /v1/agent/capabilities': undefined;
2017
2060
  readonly 'GET /v1/agent/capabilities.json': undefined;
2018
2061
  readonly 'GET /v1/agent/account': undefined;
@@ -2117,6 +2160,7 @@ export type AgentApiEndpointRequestMap = {
2117
2160
  export type AgentApiEndpointResponseMap = {
2118
2161
  readonly 'GET /v1/agent/self': AgentApiSelfResponse;
2119
2162
  readonly 'GET /v1/agent/self/usage': AgentApiSelfUsageResponse;
2163
+ readonly 'GET /v1/agent/self/limits': AgentApiSelfLimitsResponse;
2120
2164
  readonly 'GET /v1/agent/capabilities': AgentApiCapabilitiesResponse;
2121
2165
  readonly 'GET /v1/agent/capabilities.json': AgentApiCapabilitiesResponse;
2122
2166
  readonly 'GET /v1/agent/account': AgentApiAccountResponse;
@@ -3,7 +3,7 @@
3
3
  // Generated by scripts/generateAgentPackageSdk.ts
4
4
  // ═══════════════════════════════════════════════════════════════════════════
5
5
  /* eslint-disable */
6
- export const AGENT_API_CONTRACT_VERSION = '1.6.0';
6
+ export const AGENT_API_CONTRACT_VERSION = '1.7.0';
7
7
  function isAgentSdkRecord(value) {
8
8
  return typeof value === 'object' && value !== null && !Array.isArray(value);
9
9
  }
@@ -135,6 +135,22 @@ export const agentApiEndpoints = [
135
135
  routeClass: 'read',
136
136
  description: 'Return current Agent API rate-limit and usage state.',
137
137
  },
138
+ {
139
+ key: 'GET /v1/agent/self/limits',
140
+ method: 'GET',
141
+ path: '/v1/agent/self/limits',
142
+ pathParams: [],
143
+ queryParams: [],
144
+ bodyParams: [],
145
+ requestSchema: null,
146
+ bodySchema: null,
147
+ responseSchema: 'agentApiSelfLimitsResponse',
148
+ requestType: null,
149
+ responseType: 'AgentApiSelfLimitsResponse',
150
+ idempotencyRequired: false,
151
+ routeClass: 'read',
152
+ description: "Return the authenticated agent's configured spend limits and current-period usage.",
153
+ },
138
154
  {
139
155
  key: 'GET /v1/agent/capabilities',
140
156
  method: 'GET',
@@ -988,7 +1004,7 @@ export const agentApiEndpoints = [
988
1004
  path: '/v1/agent/simulate',
989
1005
  pathParams: [],
990
1006
  queryParams: [],
991
- bodyParams: ['method', 'path', 'body'],
1007
+ bodyParams: ['method', 'path', 'body', 'depth'],
992
1008
  requestSchema: 'agentApiSimulateRequest',
993
1009
  bodySchema: 'agentApiSimulateRequest',
994
1010
  responseSchema: 'agentApiSimulateResponse',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hightop/sdk",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",