hermes-swap 0.6.6 → 0.6.7

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.
@@ -1,7 +1,7 @@
1
- import type { HermesTxRequest, IBatchMultiSwapParams, IBatchExpectParams, ISwapByPathParams, IExpectSplitOrderParams, IExpectSplitOrderResp, IBridgeParams, IBatchReceipt, IMultiSwapParams, IBatchMultiSwapAndBridgeParams, ISwapAndBridgeParams, IReceipt, IConfig, IBuilderConfig, IExpectPayload, IRouterPath, SupportContracts, IExpectByPathParams, IHermesSignalResponse, IHermesSignalRoute } from './types.js';
1
+ import type { HermesTxRequest, IBatchMultiSwapParams, IBatchExpectParams, ISwapByPathParams, IExpectSplitOrderParams, IExpectSplitOrderResp, IBridgeParams, IBatchReceipt, IMultiSwapParams, IBatchMultiSwapAndBridgeParams, ISwapAndBridgeParams, IReceipt, IConfig, IBuilderConfig, IExpectPayload, IRouterPath, SupportContracts, IExpectByPathParams, IHermesSignalResponse, IHermesSignalQuoteBestData, IHermesSignalRoute } from './types.js';
2
2
  import { ChainNameEnum, AddressConst, DexType, BridgeType, IEstimateType, LayerZeroV1ChainIdMap, LayerZeroV1ChainNameMap, LayerZeroV2ChainIdMap, LayerZeroV2ChainNameMap } from './types.js';
3
3
  import { TransactionRequest } from 'ethers';
4
- export type { HermesTxRequest, IBatchMultiSwapAndBridgeParams, IExpectSplitOrderParams, IExpectSplitOrderResp, IMultiSwapParams, IBatchMultiSwapParams, IBatchExpectParams, IBatchReceipt, ISwapByPathParams as ISwapParams, IBridgeParams, ISwapAndBridgeParams, IReceipt, IConfig, IBuilderConfig, IExpectPayload, IRouterPath, SupportContracts, IHermesSignalResponse, IHermesSignalRoute, };
4
+ export type { HermesTxRequest, IBatchMultiSwapAndBridgeParams, IExpectSplitOrderParams, IExpectSplitOrderResp, IMultiSwapParams, IBatchMultiSwapParams, IBatchExpectParams, IBatchReceipt, ISwapByPathParams as ISwapParams, IBridgeParams, ISwapAndBridgeParams, IReceipt, IConfig, IBuilderConfig, IExpectPayload, IRouterPath, SupportContracts, IHermesSignalResponse, IHermesSignalQuoteBestData, IHermesSignalRoute, };
5
5
  import { BundleNotIncludedError, TransactionRevertedError } from './types.js';
6
6
  export { ChainNameEnum, AddressConst, DexType, BridgeType, IEstimateType, LayerZeroV1ChainIdMap, LayerZeroV1ChainNameMap, LayerZeroV2ChainIdMap, LayerZeroV2ChainNameMap, BundleNotIncludedError, TransactionRevertedError };
7
7
  declare class Hermes {
@@ -88,7 +88,7 @@ var Quoter = class {
88
88
  if (raw.code !== 200) {
89
89
  throw new Error(`Hermes Signal API 错误 [${raw.code}]`);
90
90
  }
91
- const allocations = (_a = raw.data) == null ? void 0 : _a.allocations;
91
+ const allocations = (_a = raw.data) == null ? void 0 : _a.route_allocation;
92
92
  if (!Array.isArray(allocations)) {
93
93
  throw new Error(`Invalid response data: ${JSON.stringify(raw.data)}`);
94
94
  }
@@ -149,10 +149,11 @@ export interface IHermesSignalResponse<T> {
149
149
  data: T;
150
150
  }
151
151
  export interface IHermesSignalRoute {
152
- chain: 'ETH';
152
+ chain: string;
153
153
  poolStepConfig: Array<{
154
154
  dexType: string;
155
155
  poolAddress: string;
156
+ poolId?: string;
156
157
  fromCoinAddress: string;
157
158
  toCoinAddress: string;
158
159
  extra?: string;
@@ -161,6 +162,13 @@ export interface IHermesSignalRoute {
161
162
  amountOutWei: string;
162
163
  blockNumber: number;
163
164
  }
165
+ export interface IHermesSignalQuoteBestData {
166
+ amount_in: string;
167
+ amount_out: string;
168
+ route_allocation: IHermesSignalRoute[];
169
+ allocations: IHermesSignalRoute[];
170
+ elapsed_ms: number;
171
+ }
164
172
  export declare enum DexType {
165
173
  FX = "f(x)",
166
174
  UNISWAPV2 = "uniswapv2",
@@ -1,7 +1,7 @@
1
- import type { HermesTxRequest, IBatchMultiSwapParams, IBatchExpectParams, ISwapByPathParams, IExpectSplitOrderParams, IExpectSplitOrderResp, IBridgeParams, IBatchReceipt, IMultiSwapParams, IBatchMultiSwapAndBridgeParams, ISwapAndBridgeParams, IReceipt, IConfig, IBuilderConfig, IExpectPayload, IRouterPath, SupportContracts, IExpectByPathParams, IHermesSignalResponse, IHermesSignalRoute } from './types.js';
1
+ import type { HermesTxRequest, IBatchMultiSwapParams, IBatchExpectParams, ISwapByPathParams, IExpectSplitOrderParams, IExpectSplitOrderResp, IBridgeParams, IBatchReceipt, IMultiSwapParams, IBatchMultiSwapAndBridgeParams, ISwapAndBridgeParams, IReceipt, IConfig, IBuilderConfig, IExpectPayload, IRouterPath, SupportContracts, IExpectByPathParams, IHermesSignalResponse, IHermesSignalQuoteBestData, IHermesSignalRoute } from './types.js';
2
2
  import { ChainNameEnum, AddressConst, DexType, BridgeType, IEstimateType, LayerZeroV1ChainIdMap, LayerZeroV1ChainNameMap, LayerZeroV2ChainIdMap, LayerZeroV2ChainNameMap } from './types.js';
3
3
  import { TransactionRequest } from 'ethers';
4
- export type { HermesTxRequest, IBatchMultiSwapAndBridgeParams, IExpectSplitOrderParams, IExpectSplitOrderResp, IMultiSwapParams, IBatchMultiSwapParams, IBatchExpectParams, IBatchReceipt, ISwapByPathParams as ISwapParams, IBridgeParams, ISwapAndBridgeParams, IReceipt, IConfig, IBuilderConfig, IExpectPayload, IRouterPath, SupportContracts, IHermesSignalResponse, IHermesSignalRoute, };
4
+ export type { HermesTxRequest, IBatchMultiSwapAndBridgeParams, IExpectSplitOrderParams, IExpectSplitOrderResp, IMultiSwapParams, IBatchMultiSwapParams, IBatchExpectParams, IBatchReceipt, ISwapByPathParams as ISwapParams, IBridgeParams, ISwapAndBridgeParams, IReceipt, IConfig, IBuilderConfig, IExpectPayload, IRouterPath, SupportContracts, IHermesSignalResponse, IHermesSignalQuoteBestData, IHermesSignalRoute, };
5
5
  import { BundleNotIncludedError, TransactionRevertedError } from './types.js';
6
6
  export { ChainNameEnum, AddressConst, DexType, BridgeType, IEstimateType, LayerZeroV1ChainIdMap, LayerZeroV1ChainNameMap, LayerZeroV2ChainIdMap, LayerZeroV2ChainNameMap, BundleNotIncludedError, TransactionRevertedError };
7
7
  declare class Hermes {
@@ -125,7 +125,7 @@ var Quoter = /*#__PURE__*/function () {
125
125
  }
126
126
  throw new Error("Hermes Signal API \u9519\u8BEF [".concat(raw.code, "]"));
127
127
  case 7:
128
- allocations = (_raw$data = raw.data) === null || _raw$data === void 0 ? void 0 : _raw$data.allocations;
128
+ allocations = (_raw$data = raw.data) === null || _raw$data === void 0 ? void 0 : _raw$data.route_allocation;
129
129
  if (Array.isArray(allocations)) {
130
130
  _context2.next = 10;
131
131
  break;
@@ -149,10 +149,11 @@ export interface IHermesSignalResponse<T> {
149
149
  data: T;
150
150
  }
151
151
  export interface IHermesSignalRoute {
152
- chain: 'ETH';
152
+ chain: string;
153
153
  poolStepConfig: Array<{
154
154
  dexType: string;
155
155
  poolAddress: string;
156
+ poolId?: string;
156
157
  fromCoinAddress: string;
157
158
  toCoinAddress: string;
158
159
  extra?: string;
@@ -161,6 +162,13 @@ export interface IHermesSignalRoute {
161
162
  amountOutWei: string;
162
163
  blockNumber: number;
163
164
  }
165
+ export interface IHermesSignalQuoteBestData {
166
+ amount_in: string;
167
+ amount_out: string;
168
+ route_allocation: IHermesSignalRoute[];
169
+ allocations: IHermesSignalRoute[];
170
+ elapsed_ms: number;
171
+ }
164
172
  export declare enum DexType {
165
173
  FX = "f(x)",
166
174
  UNISWAPV2 = "uniswapv2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hermes-swap",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
4
4
  "description": "A TypeScript utility library for swap and bridge",
5
5
  "main": "dist/cjs/index.cjs",
6
6
  "module": "dist/esm/index.mjs",