@sodax/types 2.1.0-rc.1 → 2.1.0-rc.3

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.
@@ -257,6 +257,13 @@ export interface AllowanceCheckResponseV2 {
257
257
  export interface ApproveResponseV2 {
258
258
  /** Unsigned approval transaction — the `RawTxReturnType` variant for the request's `srcChainKey`. */
259
259
  tx: RawTxReturnType;
260
+ /**
261
+ * Present only when the source token rejects an allowance change from one non-zero value to
262
+ * another — the 2017 TetherToken lineage. Broadcast this first and wait for it to be mined, then
263
+ * broadcast `tx`; the second approve is only valid once the allowance has been zeroed on-chain.
264
+ * Absent for every other token, and for a wallet with nothing approved yet.
265
+ */
266
+ resetTx?: RawTxReturnType;
260
267
  }
261
268
  /** POST /swaps/intents — response body. */
262
269
  export interface CreateIntentResponseV2 {
@@ -519,11 +526,13 @@ export interface SubmitTxStatusResponseV2 {
519
526
  * client sees it: all methods are async and all field types are the
520
527
  * post-serialization wire shapes above (bigint/Date → decimal/ISO `string`).
521
528
  *
522
- * Do NOT `implements` this on the NestJS `SwapsController`. Handlers return
523
- * pre-serialization domain types (`bigint`, `Date`, branded `Hex`/`Address`/
524
- * `SpokeChainKey`) and may be synchronous; the response interceptor serializes
525
- * them into these wire shapes afterwards. A single class cannot be both the
526
- * pre-serialization producer and the post-serialization contract.
529
+ * The backend `SwapsController` `implements` this, which is what keeps the two surfaces from
530
+ * drifting. Two things make that work: handlers are DECLARED with the wire-shaped response DTOs
531
+ * (what they hand back at runtime may still be pre-serialization domain values — `bigint`, `Date`,
532
+ * branded `Hex`/`Address`/`SpokeChainKey` — for the response interceptor to convert), and every
533
+ * handler is `async`. A handler needing a server-only trailing parameter (`@Req`, `@Ip`, …) takes
534
+ * the variadic-generic route of `IStellarSponsoringApi` in `sponsoringApi.ts` rather than dropping
535
+ * the `implements` clause.
527
536
  */
528
537
  export interface ISwapsApiV2 {
529
538
  /** GET /swaps/tokens */
@@ -640,9 +649,8 @@ export type GetRelayChainIdMapResponseV2 = Record<string, string>;
640
649
  * client sees it: all methods are async and all field types are the
641
650
  * post-serialization wire shapes above (bigint → decimal `string`).
642
651
  *
643
- * As with {@link ISwapsApiV2}, do NOT `implements` this on the NestJS controller:
644
- * handlers return pre-serialization domain types (`bigint`, branded values) and the
645
- * response interceptor serializes them into these wire shapes afterwards.
652
+ * As with {@link ISwapsApiV2}, a NestJS controller may `implements` this once its handlers are
653
+ * declared `async` and typed with the wire-shaped DTOs.
646
654
  */
647
655
  export interface IConfigApiV2 {
648
656
  /** GET /config/all */
@@ -0,0 +1,268 @@
1
+ import type { RawTxReturnType } from '../common/index.js';
2
+ import type { BitcoinBoundExtrasV2, PacketDataV2, PartnerFeeV2, RelayExtraDataResponseV2 } from './backendApiV2.js';
3
+ /** A supported bridge token descriptor (`XToken` projected to JSON primitives). */
4
+ export interface BridgeTokenV2 {
5
+ /** Token symbol (e.g. `USDC`). */
6
+ symbol: string;
7
+ /** Token name (e.g. `USD Coin`). */
8
+ name: string;
9
+ /** Token decimals. */
10
+ decimals: number;
11
+ /** Token address on its spoke chain (or hub address for hub tokens). */
12
+ address: string;
13
+ /** SODAX SpokeChainKey identifier (e.g. `0xa4b1.arbitrum`, `solana`). */
14
+ chainKey: string;
15
+ /** Corresponding hub-side asset address on Sonic. */
16
+ hubAsset: string;
17
+ /** Hub vault address that custodies bridged liquidity for this token. */
18
+ vault: string;
19
+ }
20
+ /** GET /bridge/tokens — map of SpokeChainKey → supported bridge tokens. */
21
+ export type GetBridgeTokensResponseV2 = Record<string, readonly BridgeTokenV2[]>;
22
+ /**
23
+ * GET /bridge/tokens/:chainKey — supported bridge tokens for a single chain.
24
+ *
25
+ * The trailing `& _AssertJsonSafe<…>` wires the compile-time JSON-safety guard into
26
+ * the bridge wire surface: if a `bigint` ever leaks into `BridgeTokenV2`, the
27
+ * constraint fails and `pnpm checkTs` / `pnpm build` go red. It is `& unknown` in the
28
+ * happy path, so it does not change the type.
29
+ */
30
+ export type GetBridgeTokensByChainResponseV2 = readonly BridgeTokenV2[] & _AssertJsonSafe<[_ContainsBigint<BridgeTokenV2>] extends [false] ? true : false>;
31
+ /**
32
+ * Shared request body for `/bridge/allowance/check`, `/bridge/approve`, and
33
+ * `/bridge/intents`. Uses the swaps param naming: the SDK maps its domain
34
+ * `CreateBridgeIntentParams` (`srcToken`/`dstToken`/`amount`/`recipient`) onto these
35
+ * wire names before the POST.
36
+ *
37
+ * Carries an optional `partnerFee` per-request override (defaults to the backend's configured
38
+ * `bridgePartnerFee`), mirroring `SwapExtrasV2.partnerFee`. The Bitcoin Bound token is carried as
39
+ * `bound.accessToken`, mirroring the SDK's grouped `extras.bound`.
40
+ */
41
+ export interface CreateBridgeIntentParamsV2 {
42
+ /** Source spoke chain key (SODAX SpokeChainKey). */
43
+ srcChainKey: string;
44
+ /** Destination spoke chain key (SODAX SpokeChainKey). */
45
+ dstChainKey: string;
46
+ /** Input token address on the source spoke chain (SDK domain `srcToken`). */
47
+ inputToken: string;
48
+ /** Output token address on the destination spoke chain (SDK domain `dstToken`). */
49
+ outputToken: string;
50
+ /** Input amount in smallest unit of the input token (SDK domain `amount`; bigint → decimal string). */
51
+ inputAmount: string;
52
+ /** User address on the source spoke chain (chain-specific format). */
53
+ srcAddress: string;
54
+ /** Recipient address on the destination spoke chain (SDK domain `recipient`). */
55
+ dstAddress: string;
56
+ /**
57
+ * Source-chain signer public key (compressed hex), for chains whose address can't
58
+ * yield it (e.g. Stacks). Only used when building a raw intent.
59
+ */
60
+ srcPublicKey?: string;
61
+ /**
62
+ * Bitcoin Bound (Radfi) inputs, grouped so future Bound fields extend one slot.
63
+ * Only used for raw Bitcoin TRADING-mode intents.
64
+ */
65
+ bound?: BitcoinBoundExtrasV2;
66
+ /**
67
+ * Per-request partner-fee override (address + amount|percentage). Defaults to the backend's
68
+ * configured `bridgePartnerFee` when omitted, so an integrator can charge its own fee per request
69
+ * (e.g. route the fee to its own wallet). Mirrors `SwapExtrasV2.partnerFee`.
70
+ */
71
+ partnerFee?: PartnerFeeV2;
72
+ }
73
+ /** POST /bridge/allowance/check — response body. */
74
+ export interface BridgeAllowanceCheckResponseV2 {
75
+ /** True when the source token allowance is already sufficient for the bridge. */
76
+ valid: boolean;
77
+ }
78
+ /** POST /bridge/approve — response body. */
79
+ export interface BridgeApproveResponseV2 {
80
+ /** Unsigned approval transaction — the `RawTxReturnType` variant for the request's `srcChainKey`. */
81
+ tx: RawTxReturnType;
82
+ }
83
+ /**
84
+ * POST /bridge/intents — response body. No `intent` struct (bridge is vault-backed,
85
+ * not solver-based); `createBridgeIntent` returns the unsigned spoke-deposit tx plus
86
+ * the relay envelope.
87
+ */
88
+ export interface CreateBridgeIntentResponseV2 {
89
+ /** Unsigned spoke-deposit transaction — the `RawTxReturnType` variant for the request's `srcChainKey`. */
90
+ tx: RawTxReturnType;
91
+ /** Relay envelope `{ address, payload }` submitted to the intent relay. */
92
+ relayData: RelayExtraDataResponseV2;
93
+ }
94
+ /**
95
+ * POST /bridge/submit-tx — request body. Idempotent on `(txHash, srcChainKey)`.
96
+ *
97
+ * Carries the FULL `relayData { address, payload }` envelope: bridge has no
98
+ * `intent.creator` for the backend to rebuild the relay address, so the client sends it —
99
+ * dropping the address would break split-tx-chain relay (Stellar/Solana/Sui/Stacks…).
100
+ */
101
+ export interface BridgeSubmitTxRequestV2 {
102
+ /** Transaction hash of the spoke-deposit tx that was broadcast (1–127 chars). */
103
+ txHash: string;
104
+ /** Source chain key (spoke chain the tx was submitted from). */
105
+ srcChainKey: string;
106
+ /** Address of the wallet that submitted the tx (1–127 chars). */
107
+ walletAddress: string;
108
+ /** Relay envelope received from createBridgeIntent, submitted to the intent relay. */
109
+ relayData: RelayExtraDataResponseV2;
110
+ }
111
+ /** POST /bridge/submit-tx — response `data` payload. */
112
+ export interface BridgeSubmitTxResponseDataV2 {
113
+ /** Whether the row was newly inserted or matched an existing record. */
114
+ status: 'inserted' | 'duplicate';
115
+ /** Message indicating the result of the submission. */
116
+ message: string;
117
+ }
118
+ /** POST /bridge/submit-tx — response body. */
119
+ export interface BridgeSubmitTxResponseV2 {
120
+ /** True when the submission was accepted (or was a duplicate). */
121
+ success: boolean;
122
+ /** Submission result payload. */
123
+ data: BridgeSubmitTxResponseDataV2;
124
+ }
125
+ /** GET /bridge/submit-tx/status — query params. */
126
+ export interface BridgeSubmitTxStatusQueryV2 {
127
+ /** Transaction hash of the submitted bridge tx (1–127 chars). */
128
+ txHash: string;
129
+ /** Source chain key. */
130
+ srcChainKey: string;
131
+ }
132
+ /**
133
+ * Lifecycle status of a submitted bridge tx. 5-state: drops the swaps-only
134
+ * `'posting_execution'` (bridge has no solver post-execution). The SDK schema stays
135
+ * tolerant of unknown states so a future backend extension never breaks parse.
136
+ */
137
+ export type SubmitBridgeTxStatusV2 = 'pending' | 'relaying' | 'relayed' | 'executed' | 'failed';
138
+ /** Processing result for a submitted bridge tx (present when executed). No `intent_hash` (no solver). */
139
+ export interface BridgeSubmitTxStatusResultV2 {
140
+ /** Destination intent tx hash. */
141
+ dstIntentTxHash: string;
142
+ /** Packet data from the relay. */
143
+ packetData?: PacketDataV2;
144
+ }
145
+ /** Processing state of a submitted bridge tx. */
146
+ export interface BridgeSubmitTxStatusDataV2 {
147
+ /** Transaction hash. */
148
+ txHash: string;
149
+ /** Source chain key. */
150
+ srcChainKey: string;
151
+ /**
152
+ * Current processing status. Typed as `string` (not the {@link SubmitBridgeTxStatusV2} union)
153
+ * because the SDK response schema is deliberately tolerant of unknown states, so a future
154
+ * backend lifecycle addition never breaks response parsing. Compare against the
155
+ * {@link SubmitBridgeTxStatusV2} literals for the known terminal states (`'executed'`/`'failed'`).
156
+ */
157
+ status: string;
158
+ /** Step where processing failed (one of {@link SubmitBridgeTxStatusV2}; tolerant `string`). */
159
+ failedAtStep?: string;
160
+ /** Failure reason. */
161
+ failureReason?: string;
162
+ /** Number of processing attempts (claim-time counter). */
163
+ processingAttempts: number;
164
+ /** ISO 8601 timestamp set when the bridge exhausted its processing budget and was abandoned. */
165
+ abandonedAt?: string;
166
+ /** Processing result (present when executed). */
167
+ result?: BridgeSubmitTxStatusResultV2;
168
+ /** User-facing hint when status is failed or the bridge was abandoned. */
169
+ userMessage?: string;
170
+ }
171
+ /** GET /bridge/submit-tx/status — response body. */
172
+ export interface BridgeSubmitTxStatusResponseV2 {
173
+ /** True when a record was found. */
174
+ success: boolean;
175
+ /** The submit-tx processing state. */
176
+ data: BridgeSubmitTxStatusDataV2;
177
+ }
178
+ /** POST /bridge/fee — request body. */
179
+ export interface BridgeFeeRequestV2 {
180
+ /** Input amount in smallest unit of the input token (bigint → decimal string). */
181
+ inputAmount: string;
182
+ /** Per-request partner-fee override; defaults to the backend's configured `bridgePartnerFee`. */
183
+ partnerFee?: PartnerFeeV2;
184
+ }
185
+ /** POST /bridge/fee — response body. The partner fee is a fixed %/amount of the input (token-independent); it uses the per-request `partnerFee` when supplied, else the configured `bridgePartnerFee`. */
186
+ export interface BridgeFeeResponseV2 {
187
+ /** Partner fee in smallest unit (decimal string; `'0'` when no partner fee is configured). */
188
+ fee: string;
189
+ }
190
+ /**
191
+ * Shared request body for `/bridge/bridgeable-amount` and `/bridge/bridgeable/check` — the (from, to)
192
+ * token pair by `(chainKey, tokenAddress)`. The backend resolves each pair to an XToken from chain config.
193
+ */
194
+ export interface BridgeQuoteRequestV2 {
195
+ /** Source spoke chain key. */
196
+ srcChainKey: string;
197
+ /** Destination spoke chain key. */
198
+ dstChainKey: string;
199
+ /** Input token address on the source spoke chain. */
200
+ inputToken: string;
201
+ /** Output token address on the destination spoke chain. */
202
+ outputToken: string;
203
+ }
204
+ /** A bridge limit (`BridgeLimit` projected to JSON: bigint `amount` → decimal string). */
205
+ export interface BridgeLimitV2 {
206
+ /** Limit amount in smallest unit (bigint → decimal string). */
207
+ amount: string;
208
+ /** Token decimals. */
209
+ decimals: number;
210
+ /** Whether the limit is the deposit capacity or the withdrawal liquidity. */
211
+ type: 'DEPOSIT_LIMIT' | 'WITHDRAWAL_LIMIT';
212
+ }
213
+ /** POST /bridge/bridgeable-amount — response body. */
214
+ export interface BridgeableAmountResponseV2 {
215
+ /** Deposit capacity / withdrawal liquidity limit for the pair. */
216
+ limit: BridgeLimitV2;
217
+ }
218
+ /** POST /bridge/bridgeable/check — response body. */
219
+ export interface BridgeableCheckResponseV2 {
220
+ /** True when the (from, to) token pair is bridgeable. */
221
+ bridgeable: boolean;
222
+ }
223
+ /**
224
+ * Client-side surface for the backend Bridge API v2 — for typed HTTP clients
225
+ * (fetch wrappers / SDK adapters). Each method describes one endpoint as the client
226
+ * sees it: all methods are async and all field types are the post-serialization wire
227
+ * shapes above (bigint/Date → decimal/ISO `string`).
228
+ *
229
+ * As with {@link import('./backendApiV2.js').ISwapsApiV2}, the backend `BridgeController`
230
+ * `implements` this — declaring its handlers `async` and typed with the wire-shaped DTOs — so a
231
+ * request or response shape cannot drift from this contract without failing the build.
232
+ *
233
+ * `getFee`/`getBridgeableAmount`/`isBridgeable` are read-only quotes computable client-side (config +
234
+ * vault math); an SDK consumer should prefer the local `sodax.bridge.*` equivalents (no round-trip).
235
+ * They also have backend endpoints (for non-SDK HTTP clients), mirrored here for client parity.
236
+ */
237
+ export interface IBridgeApiV2 {
238
+ /** POST /bridge/allowance/check */
239
+ checkAllowance(body: CreateBridgeIntentParamsV2): Promise<BridgeAllowanceCheckResponseV2>;
240
+ /** POST /bridge/approve */
241
+ approve(body: CreateBridgeIntentParamsV2): Promise<BridgeApproveResponseV2>;
242
+ /** POST /bridge/intents */
243
+ createBridgeIntent(body: CreateBridgeIntentParamsV2): Promise<CreateBridgeIntentResponseV2>;
244
+ /** POST /bridge/submit-tx */
245
+ submitTx(body: BridgeSubmitTxRequestV2): Promise<BridgeSubmitTxResponseV2>;
246
+ /** GET /bridge/submit-tx/status */
247
+ getSubmitTxStatus(query: BridgeSubmitTxStatusQueryV2): Promise<BridgeSubmitTxStatusResponseV2>;
248
+ /** GET /bridge/tokens */
249
+ getTokens(): Promise<GetBridgeTokensResponseV2>;
250
+ /** GET /bridge/tokens/:chainKey */
251
+ getTokensByChain(chainKey: string): Promise<GetBridgeTokensByChainResponseV2>;
252
+ /** POST /bridge/fee — partner fee for an amount (per-request `body.partnerFee` override or the configured default; computable client-side, here for HTTP parity). */
253
+ getFee(body: BridgeFeeRequestV2): Promise<BridgeFeeResponseV2>;
254
+ /** POST /bridge/bridgeable-amount — deposit capacity / withdrawal liquidity for a pair. */
255
+ getBridgeableAmount(body: BridgeQuoteRequestV2): Promise<BridgeableAmountResponseV2>;
256
+ /** POST /bridge/bridgeable/check — whether a (from, to) pair is bridgeable. */
257
+ isBridgeable(body: BridgeQuoteRequestV2): Promise<BridgeableCheckResponseV2>;
258
+ }
259
+ /** True if `T` contains a `bigint` anywhere in its data shape. Recurses arrays/records/objects. */
260
+ type _ContainsBigint<T> = T extends bigint ? true : T extends string | number | boolean | symbol | null | undefined ? false : T extends readonly (infer U)[] ? _ContainsBigint<U> : T extends object ? true extends {
261
+ [K in keyof T]-?: _ContainsBigint<T[K]>;
262
+ }[keyof T] ? true : false : false;
263
+ /**
264
+ * Resolves to `unknown` (an identity in an intersection) when `Ok` proves JSON-safety;
265
+ * otherwise the `Ok extends true` constraint is violated and compilation fails at the use site.
266
+ */
267
+ type _AssertJsonSafe<_Ok extends true> = unknown;
268
+ export {};
@@ -0,0 +1,23 @@
1
+ // Backend Bridge API v2 — request/response contract types.
2
+ //
3
+ // Mirrors `backendApiV2.ts` (Swaps API v2). One type per request/response of every
4
+ // endpoint in the backend bridge controller (`@Controller('bridge')`, served on the
5
+ // shared swaps host). They favor plain primitives (`string`/`number`/`boolean`/plain
6
+ // objects) over SDK branded types.
7
+ //
8
+ // Same JSON-safety rule as the swaps section: outbound (response) values are pure
9
+ // JSON — every bigint-derived value is a decimal `string`, every `Date` an ISO 8601
10
+ // `string`. A response NEVER contains `bigint` on the wire (the one typed exception
11
+ // is the unsigned `tx`, the SDK domain union `RawTxReturnType`, which the SDK
12
+ // client's response schema rebuilds into `bigint`/`Uint8Array` on parse).
13
+ //
14
+ // Bridge deltas vs swaps:
15
+ // - NO `intent` struct — `createBridgeIntent` returns `{ tx, relayData }`.
16
+ // - NO solver / `intent_hash` / `posting_execution` — terminal success is
17
+ // `status === 'executed' && result.dstIntentTxHash`.
18
+ // - `submit-tx` carries the FULL `relayData { address, payload }` envelope: with no
19
+ // `intent.creator` the backend cannot rebuild the relay address, so the client sends it.
20
+ // - Surface: checkAllowance, approve, createBridgeIntent, submitTx, getSubmitTxStatus,
21
+ // getTokens, getTokensByChain, getFee, getBridgeableAmount, isBridgeable (the last 3
22
+ // are read-only discovery/quote — computable client-side, mirrored here for HTTP parity).
23
+ export {};
@@ -1,3 +1,4 @@
1
1
  export * from './backendApiV1.js';
2
2
  export * from './backendApiV2.js';
3
3
  export * from './sponsoringApi.js';
4
+ export * from './backendBridgeApiV2.js';
@@ -1,3 +1,4 @@
1
1
  export * from './backendApiV1.js';
2
2
  export * from './backendApiV2.js';
3
3
  export * from './sponsoringApi.js';
4
+ export * from './backendBridgeApiV2.js';
@@ -1,4 +1,24 @@
1
1
  import type { ICoreWallet } from '../wallet/wallet.js';
2
+ import type { XToken } from '../chains/tokens.js';
3
+ /**
4
+ * Bitcoin protocol dust limit, in satoshis. Any native-BTC output below this is "dust" — economically
5
+ * unspendable, and nodes/relays reject transactions that create it. Native-BTC deposits (Bitcoin as the
6
+ * source) and deliveries (Bitcoin as the destination) must clear this threshold. Single source of truth
7
+ * for the value; number-based UTXO math converts it with `Number(...)`.
8
+ */
9
+ export declare const BITCOIN_DUST_SATS = 546n;
10
+ /**
11
+ * True when `token` (an address or symbol) is native BTC for the given Bitcoin chain config, matched
12
+ * against the config's own native identifiers — the literal 'btc', its `nativeToken` symbol, and the
13
+ * BTC token address (e.g. '0:0') — all case-insensitively. Single source of truth for native-BTC
14
+ * identity so the deposit-PSBT builder and the swap/bridge dust-limit guard never drift. Note: the
15
+ * generic `isNativeToken` cannot be used here because Bitcoin's `nativeToken` is a symbol, not an
16
+ * on-chain address.
17
+ */
18
+ export declare function isNativeBitcoinToken(chainConfig: {
19
+ nativeToken: string;
20
+ supportedTokens: Partial<Record<string, XToken>>;
21
+ }, token: string): boolean;
2
22
  /** Check whether an AddressType is supported for signing/spending. */
3
23
  export declare function isSupportedBitcoinAddressType(addressType: string): addressType is BtcAddressType;
4
24
  /**
@@ -1,3 +1,24 @@
1
+ /**
2
+ * Bitcoin protocol dust limit, in satoshis. Any native-BTC output below this is "dust" — economically
3
+ * unspendable, and nodes/relays reject transactions that create it. Native-BTC deposits (Bitcoin as the
4
+ * source) and deliveries (Bitcoin as the destination) must clear this threshold. Single source of truth
5
+ * for the value; number-based UTXO math converts it with `Number(...)`.
6
+ */
7
+ export const BITCOIN_DUST_SATS = 546n;
8
+ /**
9
+ * True when `token` (an address or symbol) is native BTC for the given Bitcoin chain config, matched
10
+ * against the config's own native identifiers — the literal 'btc', its `nativeToken` symbol, and the
11
+ * BTC token address (e.g. '0:0') — all case-insensitively. Single source of truth for native-BTC
12
+ * identity so the deposit-PSBT builder and the swap/bridge dust-limit guard never drift. Note: the
13
+ * generic `isNativeToken` cannot be used here because Bitcoin's `nativeToken` is a symbol, not an
14
+ * on-chain address.
15
+ */
16
+ export function isNativeBitcoinToken(chainConfig, token) {
17
+ const nativeBtcTokens = new Set(['btc', chainConfig.nativeToken, chainConfig.supportedTokens.BTC?.address]
18
+ .filter((value) => !!value)
19
+ .map(value => value.toLowerCase()));
20
+ return nativeBtcTokens.has(token.toLowerCase());
21
+ }
1
22
  /** Check whether an AddressType is supported for signing/spending. */
2
23
  export function isSupportedBitcoinAddressType(addressType) {
3
24
  return BTC_ADDRESS_TYPES.includes(addressType);
@@ -755,7 +755,7 @@ export declare const spokeChainConfig: {
755
755
  readonly name: "Soda RBNT";
756
756
  readonly decimals: 18;
757
757
  readonly address: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
758
- readonly chainKey: "redbelly";
758
+ readonly chainKey: "sonic";
759
759
  readonly hubAsset: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
760
760
  readonly vault: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
761
761
  };
@@ -3762,7 +3762,7 @@ export declare const hubConfig: {
3762
3762
  readonly name: "Soda RBNT";
3763
3763
  readonly decimals: 18;
3764
3764
  readonly address: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
3765
- readonly chainKey: "redbelly";
3765
+ readonly chainKey: "sonic";
3766
3766
  readonly hubAsset: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
3767
3767
  readonly vault: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
3768
3768
  };
@@ -205,7 +205,7 @@ export declare const SodaTokens: {
205
205
  readonly name: "Soda RBNT";
206
206
  readonly decimals: 18;
207
207
  readonly address: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
208
- readonly chainKey: "redbelly";
208
+ readonly chainKey: "sonic";
209
209
  readonly hubAsset: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
210
210
  readonly vault: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
211
211
  };
@@ -535,7 +535,7 @@ export declare const sonicSupportedTokens: {
535
535
  readonly name: "Soda RBNT";
536
536
  readonly decimals: 18;
537
537
  readonly address: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
538
- readonly chainKey: "redbelly";
538
+ readonly chainKey: "sonic";
539
539
  readonly hubAsset: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
540
540
  readonly vault: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
541
541
  };
@@ -2886,7 +2886,7 @@ export declare const supportedTokensByChain: {
2886
2886
  readonly name: "Soda RBNT";
2887
2887
  readonly decimals: 18;
2888
2888
  readonly address: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
2889
- readonly chainKey: "redbelly";
2889
+ readonly chainKey: "sonic";
2890
2890
  readonly hubAsset: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
2891
2891
  readonly vault: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
2892
2892
  };
@@ -214,7 +214,7 @@ export const SodaTokens = {
214
214
  name: 'Soda RBNT',
215
215
  decimals: 18,
216
216
  address: '0x4B207114F9118dEAC56436e1aE3c45648783c7Ac',
217
- chainKey: ChainKeys.REDBELLY_MAINNET,
217
+ chainKey: ChainKeys.SONIC_MAINNET,
218
218
  hubAsset: '0x4B207114F9118dEAC56436e1aE3c45648783c7Ac',
219
219
  vault: '0x4B207114F9118dEAC56436e1aE3c45648783c7Ac',
220
220
  },
@@ -3,7 +3,7 @@ import type { ChainKey, ChainKeys, ChainType } from '../chains/chain-keys.js';
3
3
  import type { GetChainType, SpokeChainConfig, spokeChainConfig, SpokeChainKey, IconAddress } from '../chains/chains.js';
4
4
  import type { XToken } from '../chains/tokens.js';
5
5
  import type { EvmRawTransaction, EvmReturnType } from '../evm/evm.js';
6
- import type { BitcoinReturnType } from '../bitcoin/bitcoin.js';
6
+ import type { BitcoinRawTransaction, BitcoinReturnType } from '../bitcoin/bitcoin.js';
7
7
  import type { IconRawTransaction, IconReturnType } from '../icon/icon.js';
8
8
  import type { InjectiveRawTransaction, InjectiveReturnType } from '../injective/injective.js';
9
9
  import type { NearRawTransaction, NearReturnType } from '../near/near.js';
@@ -138,7 +138,18 @@ export declare enum SolverIntentErrorCode {
138
138
  UNKNOWN = -999
139
139
  }
140
140
  export type HashTxReturnType = EvmReturnType<false> | SolanaReturnType<false> | IconReturnType<false> | SuiReturnType<false> | InjectiveReturnType<false> | StellarReturnType<false> | StacksReturnType<false> | NearReturnType<false>;
141
- export type RawTxReturnType = EvmRawTransaction | SolanaRawTransaction | InjectiveRawTransaction | IconRawTransaction | SuiRawTransaction | StellarRawTransaction | StacksRawTransaction | NearRawTransaction;
141
+ /**
142
+ * Fallback raw-tx union for {@link TxReturnType} (which prefers a chain-keyed branch), and the declared
143
+ * shape of the backend APIs' unsigned `tx` response field, where the chain is only known from the
144
+ * request's `srcChainKey` at runtime.
145
+ *
146
+ * `BitcoinRawTransaction` is listed even though it is currently structurally identical to
147
+ * `SolanaRawTransaction` (both `{ from: string; to: string; value: bigint; data: string }`) and so would
148
+ * be absorbed by it: Bitcoin is a supported raw-tx source, and naming it keeps that a stated part of the
149
+ * contract rather than a coincidence that would silently lapse if the Solana member's string aliases were
150
+ * ever branded.
151
+ */
152
+ export type RawTxReturnType = EvmRawTransaction | SolanaRawTransaction | InjectiveRawTransaction | IconRawTransaction | SuiRawTransaction | StellarRawTransaction | StacksRawTransaction | NearRawTransaction | BitcoinRawTransaction;
142
153
  export type GetDefaultTxReturnType<Raw extends boolean> = Raw extends true ? RawTxReturnType : HashTxReturnType;
143
154
  /**
144
155
  * Return type for a transaction based on the given ChainId or ChainType.
@@ -7,6 +7,12 @@ import type { SpokeChainKey } from '../chains/chains.js';
7
7
  export declare const HookKind: {
8
8
  /** Deposits delivered USDC into the recipient's HyperCore perps account (HyperEVM). */
9
9
  readonly HYPERCORE_DEPOSIT: "hyperCoreDeposit";
10
+ /**
11
+ * Requests an ERC-7540 deposit of delivered USDC into the Flint RWA vault (Ethereum), with the
12
+ * recipient as the request's controller. Asynchronous: the request mints no shares — Flint's
13
+ * curator settles a NAV and then claims the shares on the controller's behalf.
14
+ */
15
+ readonly FLINT_DEPOSIT: "flintDeposit";
10
16
  };
11
17
  export type HookKind = (typeof HookKind)[keyof typeof HookKind];
12
18
  export type SpokeHookConfig = {
@@ -13,6 +13,12 @@ import { ChainKeys, spokeChainConfig } from '../chains/chains.js';
13
13
  export const HookKind = {
14
14
  /** Deposits delivered USDC into the recipient's HyperCore perps account (HyperEVM). */
15
15
  HYPERCORE_DEPOSIT: 'hyperCoreDeposit',
16
+ /**
17
+ * Requests an ERC-7540 deposit of delivered USDC into the Flint RWA vault (Ethereum), with the
18
+ * recipient as the request's controller. Asynchronous: the request mints no shares — Flint's
19
+ * curator settles a NAV and then claims the shares on the controller's behalf.
20
+ */
21
+ FLINT_DEPOSIT: 'flintDeposit',
16
22
  };
17
23
  /**
18
24
  * Deployed delivery hooks, keyed by the chain they live on. Many hooks per chain and many chains
@@ -26,6 +32,20 @@ export const spokeHooks = {
26
32
  supportedTokens: [spokeChainConfig[ChainKeys.HYPEREVM_MAINNET].supportedTokens.USDC.address], // USDC on HyperEVM
27
33
  },
28
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.
29
49
  };
30
50
  /** Returns the deployed hook of the given kind on `chainKey`, or `undefined` if none is registered. */
31
51
  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 = 221;
22
+ export declare const CONFIG_VERSION = 223;
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 = 221; // this value should be incremented (inside release/sdk branch) each time @sodax/types package is updated
22
+ export const CONFIG_VERSION = 223; // this value should be incremented (inside release/sdk branch) each time @sodax/types package is updated
@@ -948,7 +948,7 @@ export declare const moneyMarketSupportedTokens: {
948
948
  readonly name: "Soda RBNT";
949
949
  readonly decimals: 18;
950
950
  readonly address: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
951
- readonly chainKey: "redbelly";
951
+ readonly chainKey: "sonic";
952
952
  readonly hubAsset: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
953
953
  readonly vault: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
954
954
  } | {
@@ -2352,7 +2352,7 @@ export declare const moneyMarketConfig: {
2352
2352
  readonly name: "Soda RBNT";
2353
2353
  readonly decimals: 18;
2354
2354
  readonly address: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
2355
- readonly chainKey: "redbelly";
2355
+ readonly chainKey: "sonic";
2356
2356
  readonly hubAsset: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
2357
2357
  readonly vault: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
2358
2358
  } | {
@@ -34,15 +34,35 @@ export type BridgeOptions = {
34
34
  };
35
35
  export type BridgeDefaultConfig = {};
36
36
  export declare const bridgeConfig: {};
37
+ /**
38
+ * RadFi/Bound request signer — a client-side RUNTIME hook (like {@link SodaxOptionalConfig.logger}),
39
+ * deliberately kept OUT of the serializable {@link RadfiConfig} data contract so it is never fetched
40
+ * from or overwritten by the backend config, and so no credential ever lives on the SDK config object.
41
+ *
42
+ * The SDK invokes it once per outbound RadFi `apiUrl` request and merges the returned headers onto that
43
+ * request. The consumer (e.g. a backend) owns the credential and computes the signature; the SDK holds
44
+ * only the function reference. Used to add Bound's `x-api-signature` HMAC header for server-to-server
45
+ * callers (see swaps-api gh-831), keeping the per-user `accessToken` and the backend credential separate.
46
+ */
47
+ export type RadfiSignContext = {
48
+ method: string;
49
+ path: string;
50
+ };
51
+ export type RadfiSigner = (ctx: RadfiSignContext) => Record<string, string> | Promise<Record<string, string>>;
52
+ export type RadfiOptions = {
53
+ signRequest?: RadfiSigner;
54
+ };
37
55
  export type SodaxOptionalConfig = {
38
56
  logger?: SodaxLoggerOption;
39
57
  analytics?: AnalyticsOption;
40
58
  fee?: PartnerFee;
59
+ radfi?: RadfiOptions;
41
60
  swaps?: SwapsOptions;
42
61
  moneyMarket?: MoneyMarketOptions;
43
62
  bridge?: BridgeOptions;
44
63
  leverageYield?: LeverageYieldOptions;
45
64
  swapsOptions?: SwapsClientOptions;
65
+ bridgeOptions?: BridgeClientOptions;
46
66
  };
47
67
  /**
48
68
  * Options (always optional) accepted by `new Sodax(...)`. A deep-partial override of the {@link SodaxDefaultConfig} data
@@ -82,6 +102,19 @@ export type SwapsClientOptions = {
82
102
  */
83
103
  useBackendSubmitTx?: boolean;
84
104
  };
105
+ /**
106
+ * Client-side bridge behavior options. Like {@link SwapsClientOptions}, these are runtime toggles
107
+ * resolved once at construction — NOT part of the backend-fetched {@link SodaxDefaultConfig} data.
108
+ */
109
+ export type BridgeClientOptions = {
110
+ /**
111
+ * Opt-in: route `bridge()` through the backend submit-tx flow (the backend relays the spoke
112
+ * deposit server-side). On ANY non-success the SDK falls back to the client-side
113
+ * `relayTxAndWaitPacket` flow so the bridge still completes. Default `false` (the current fully
114
+ * client-side flow).
115
+ */
116
+ useBackendSubmitTx?: boolean;
117
+ };
85
118
  export declare const sodaxConfig: {
86
119
  chains: {
87
120
  readonly sonic: {
@@ -292,7 +325,7 @@ export declare const sodaxConfig: {
292
325
  readonly name: "Soda RBNT";
293
326
  readonly decimals: 18;
294
327
  readonly address: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
295
- readonly chainKey: "redbelly";
328
+ readonly chainKey: "sonic";
296
329
  readonly hubAsset: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
297
330
  readonly vault: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
298
331
  };
@@ -3241,7 +3274,7 @@ export declare const sodaxConfig: {
3241
3274
  readonly name: "Soda RBNT";
3242
3275
  readonly decimals: 18;
3243
3276
  readonly address: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
3244
- readonly chainKey: "redbelly";
3277
+ readonly chainKey: "sonic";
3245
3278
  readonly hubAsset: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
3246
3279
  readonly vault: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
3247
3280
  } | {
@@ -5819,7 +5852,7 @@ export declare const sodaxConfig: {
5819
5852
  readonly name: "Soda RBNT";
5820
5853
  readonly decimals: 18;
5821
5854
  readonly address: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
5822
- readonly chainKey: "redbelly";
5855
+ readonly chainKey: "sonic";
5823
5856
  readonly hubAsset: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
5824
5857
  readonly vault: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
5825
5858
  } | {
@@ -6642,7 +6675,7 @@ export declare const sodaxConfig: {
6642
6675
  readonly name: "Soda RBNT";
6643
6676
  readonly decimals: 18;
6644
6677
  readonly address: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
6645
- readonly chainKey: "redbelly";
6678
+ readonly chainKey: "sonic";
6646
6679
  readonly hubAsset: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
6647
6680
  readonly vault: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
6648
6681
  };
@@ -191,7 +191,7 @@ export declare const swapSupportedTokens: {
191
191
  readonly name: "Soda RBNT";
192
192
  readonly decimals: 18;
193
193
  readonly address: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
194
- readonly chainKey: "redbelly";
194
+ readonly chainKey: "sonic";
195
195
  readonly hubAsset: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
196
196
  readonly vault: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
197
197
  } | {
@@ -2135,7 +2135,7 @@ export declare const swapsConfig: {
2135
2135
  readonly name: "Soda RBNT";
2136
2136
  readonly decimals: 18;
2137
2137
  readonly address: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
2138
- readonly chainKey: "redbelly";
2138
+ readonly chainKey: "sonic";
2139
2139
  readonly hubAsset: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
2140
2140
  readonly vault: "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac";
2141
2141
  } | {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "2.1.0-rc.1",
7
+ "version": "2.1.0-rc.3",
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",