@sodax/types 2.1.0-rc.8 → 2.1.0-rc.9

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.
@@ -4,6 +4,7 @@ import type { RelayConfig } from '../common/constants.js';
4
4
  import type { ConcentratedLiquidityConfig, DexDefaultConfig } from '../dex/dex.js';
5
5
  import type { SodaxDefaultConfig } from '../sodax-config/sodax-config.js';
6
6
  import type { RawTxReturnType } from '../common/index.js';
7
+ import type { HookKind } from '../hooks/hooks.js';
7
8
  /** Quote direction. Only exact-input quoting is supported. */
8
9
  export type QuoteTypeV2 = 'exact_input';
9
10
  /**
@@ -47,6 +48,38 @@ export interface SwapExtrasV2 {
47
48
  * top-level field per item. Only used for raw Bitcoin TRADING-mode intents.
48
49
  */
49
50
  bound?: BitcoinBoundExtrasV2;
51
+ /**
52
+ * Route the intent's output through a registered delivery hook instead of transferring it to
53
+ * `dstAddress`. The backend resolves the hook's deployed address (from its pinned SDK's
54
+ * `spokeHooks` registry in `@sodax/types`) and encodes its payload, so `dstAddress` stays the
55
+ * recipient the hook credits, not the delivery target. Omit for a plain transfer.
56
+ *
57
+ * Only used when building an intent: `createIntent`/`createLimitOrderIntent`, or `getQuote` with
58
+ * `includeTxData=true` — a bare quote never builds one, so `hook` is a no-op there without it.
59
+ * `checkAllowance`/`approve` inherit the field too (both extend {@link CreateIntentParamsV2}) but
60
+ * ignore it, same as `partnerFee`: allowance-checking and approval are source-side only and never
61
+ * touch `dstAddress`. Look the registry entry up by *this request's own* destination-chain field,
62
+ * which is **not** spelled the same way on every DTO: `dstChainKey` on
63
+ * {@link CreateIntentParamsV2}/`CreateLimitOrderParamsV2`, but `tokenDstChainKey` on
64
+ * {@link QuoteRequestV2}.
65
+ *
66
+ * The `deliveryData` payload is a per-`HookKind` ABI encoding (see the SDK's `HookService` /
67
+ * `HOOK_DELIVERY_ABI`) — today every registered kind (`hyperCoreDeposit`, `flintDeposit`) encodes
68
+ * `abi.encode(address recipient)`, but that shape is not guaranteed to stay uniform as new kinds
69
+ * are added, so don't hardcode one shared ABI across kinds.
70
+ *
71
+ * A registry entry's `supportedTokens` describes the hook's own on-chain fallback behaviour (which
72
+ * output tokens it actually acts on, vs. passes through as a plain transfer) — it's metadata, not
73
+ * a constraint for the backend to enforce; don't reject a mismatched `outputToken` server-side
74
+ * because of it.
75
+ *
76
+ * Requires a backend new enough to forward this field, and one whose pinned SDK has the hook
77
+ * registered for the destination chain. An unregistered kind is expected to fail the request
78
+ * rather than silently falling back to a plain transfer — that expectation (like `getQuote`
79
+ * forwarding above) describes what this backend needs to implement, not behavior this repo has
80
+ * observed, since the backend lives outside this monorepo.
81
+ */
82
+ hook?: HookRequestV2;
50
83
  }
51
84
  /**
52
85
  * Solver intent status code:
@@ -172,9 +205,11 @@ export type GetSwapTokensResponseV2 = Record<string, readonly SwapTokenV2[]>;
172
205
  /** GET /swaps/tokens/:chainKey — supported swap tokens for a single chain. */
173
206
  export type GetSwapTokensByChainResponseV2 = readonly SwapTokenV2[];
174
207
  /**
175
- * POST /swaps/quote — request body. Inherits the swap extras (`partnerFee`, `srcPublicKey`, `bound`) from
176
- * {@link SwapExtrasV2}; the inherited `srcPublicKey`/`bound` are consumed only by the `includeTxData=true`
177
- * intent-building path (Stacks/Bitcoin sources), mirroring `srcAddress`/`dstAddress` below.
208
+ * POST /swaps/quote — request body. Inherits the swap extras (`partnerFee`, `srcPublicKey`, `bound`,
209
+ * `hook`) from {@link SwapExtrasV2}; the inherited `srcPublicKey`/`bound`/`hook` are consumed only by
210
+ * the `includeTxData=true` intent-building path (Stacks/Bitcoin sources; delivery hooks), mirroring
211
+ * `srcAddress`/`dstAddress` below. Whether a given backend actually forwards `hook` on this endpoint
212
+ * is a deployment question — see `hook`'s own doc comment on {@link SwapExtrasV2}.
178
213
  */
179
214
  export interface QuoteRequestV2 extends SwapExtrasV2 {
180
215
  /** Source token address on the source spoke chain. */
@@ -218,8 +253,9 @@ export interface DeadlineResponseV2 {
218
253
  }
219
254
  /**
220
255
  * Shared request body for `/swaps/allowance/check`, `/swaps/approve`, and `/swaps/intents`. Inherits the
221
- * swap extras (`partnerFee`, `srcPublicKey`, `bound`) from {@link SwapExtrasV2}; the Bitcoin Bound token
222
- * is carried as `bound.accessToken` (not a flat `accessToken`), mirroring the SDK's grouped `extras.bound`.
256
+ * swap extras (`partnerFee`, `srcPublicKey`, `bound`, `hook`) from {@link SwapExtrasV2}; the Bitcoin Bound
257
+ * token is carried as `bound.accessToken` (not a flat `accessToken`), mirroring the SDK's grouped
258
+ * `extras.bound`.
223
259
  */
224
260
  export interface CreateIntentParamsV2 extends SwapExtrasV2 {
225
261
  /** Source spoke chain key (SODAX SpokeChainKey). */
@@ -247,6 +283,10 @@ export interface CreateIntentParamsV2 extends SwapExtrasV2 {
247
283
  /** Arbitrary calldata hex string. Defaults to `0x`. */
248
284
  data?: string;
249
285
  }
286
+ /** Selects a delivery hook by kind. Mirrors the SDK's own `HookRequest`. */
287
+ export interface HookRequestV2 {
288
+ kind: HookKind;
289
+ }
250
290
  /** POST /swaps/allowance/check — response body. */
251
291
  export interface AllowanceCheckResponseV2 {
252
292
  /** True when the source token allowance is already sufficient for the intent. */
@@ -36,6 +36,11 @@ export declare const spokeHooks: {
36
36
  readonly address: "0xc79224a4DEE653C9a26572B941149d95a88432c4";
37
37
  readonly supportedTokens: readonly ["0xb88339CB7199b77E23DB6E890353E22632Ba630f"];
38
38
  }];
39
+ readonly ethereum: readonly [{
40
+ readonly kind: "flintDeposit";
41
+ readonly address: "0xDf376dE34e9f1474A025Dfe411b7EB5541793C5d";
42
+ readonly supportedTokens: readonly ["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"];
43
+ }];
39
44
  };
40
45
  /** Returns the deployed hook of the given kind on `chainKey`, or `undefined` if none is registered. */
41
46
  export declare const getSpokeHook: (chainKey: SpokeChainKey, kind: HookKind) => SpokeHookConfig | undefined;
@@ -32,20 +32,15 @@ export const spokeHooks = {
32
32
  supportedTokens: [spokeChainConfig[ChainKeys.HYPEREVM_MAINNET].supportedTokens.USDC.address], // USDC on HyperEVM
33
33
  },
34
34
  ],
35
- // HookKind.FLINT_DEPOSIT is not registered yet: FlintDepositHook is not deployed to Ethereum
36
- // mainnet (icon-project/sodax-contracts#693). Registering it with a placeholder address would
37
- // route real intent output to that address, so the entry lands with the deployment:
38
- //
39
- // [ChainKeys.ETHEREUM_MAINNET]: [
40
- // {
41
- // kind: HookKind.FLINT_DEPOSIT,
42
- // address: '0x…',
43
- // supportedTokens: [spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.USDC.address],
44
- // },
45
- // ],
46
- //
47
- // Until then `getSpokeHook` returns undefined and `resolveDeliveryHook` throws, which is the
48
- // correct behaviour for a hook that does not exist on chain.
35
+ [ChainKeys.ETHEREUM_MAINNET]: [
36
+ {
37
+ kind: HookKind.FLINT_DEPOSIT,
38
+ // FlintDepositHook, deployed 2026-08-10 (icon-project/sodax-contracts#693). USDC only: any
39
+ // other delivered token is handed to the recipient as a plain transfer by the hook itself.
40
+ address: '0xDf376dE34e9f1474A025Dfe411b7EB5541793C5d',
41
+ supportedTokens: [spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.USDC.address], // USDC on Ethereum
42
+ },
43
+ ],
49
44
  };
50
45
  /** Returns the deployed hook of the given kind on `chainKey`, or `undefined` if none is registered. */
51
46
  export const getSpokeHook = (chainKey, kind) => spokeHooks[chainKey]?.find(h => h.kind === kind);
package/dist/index.d.ts CHANGED
@@ -19,4 +19,4 @@ export * from './sui/index.js';
19
19
  export * from './swap/index.js';
20
20
  export * from './utils/index.js';
21
21
  export * from './wallet/index.js';
22
- export declare const CONFIG_VERSION = 228;
22
+ export declare const CONFIG_VERSION = 229;
package/dist/index.js CHANGED
@@ -19,4 +19,4 @@ export * from './sui/index.js';
19
19
  export * from './swap/index.js';
20
20
  export * from './utils/index.js';
21
21
  export * from './wallet/index.js';
22
- export const CONFIG_VERSION = 228; // this value should be incremented (inside release/sdk branch) each time @sodax/types package is updated
22
+ export const CONFIG_VERSION = 229; // this value should be incremented (inside release/sdk branch) each time @sodax/types package is updated
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "2.1.0-rc.8",
7
+ "version": "2.1.0-rc.9",
8
8
  "description": "Sodax Common Types",
9
9
  "main": "dist/index.js",
10
10
  "homepage": "https://github.com/icon-project/sodax-sdks/tree/main/packages/types",