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

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.
@@ -34,8 +34,7 @@ export interface BitcoinBoundExtrasV2 {
34
34
  */
35
35
  export interface SwapExtrasV2 {
36
36
  /**
37
- * Per-request partner-fee override; defaults to the backend's configured fee. Keeps the fee-adjusted
38
- * quote and the built intent consistent with `createIntent`.
37
+ * No default on `/swaps/*` — omit and the swap charges nothing. SDK `fee` / `swaps.partnerFee` does not apply here.
39
38
  */
40
39
  partnerFee?: PartnerFeeV2;
41
40
  /**
@@ -2863,7 +2863,7 @@ export declare const spokeChainConfig: {
2863
2863
  };
2864
2864
  readonly nativeToken: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";
2865
2865
  readonly bnUSD: "0xff4de2b2b57dd7611d2812d231a467d007b702a101fd5c7ad3b278257cddb507::bnusd::BNUSD";
2866
- readonly rpc_url: "https://fullnode.mainnet.sui.io:443";
2866
+ readonly rpc_url: "https://sui-rpc.publicnode.com";
2867
2867
  readonly chain: {
2868
2868
  readonly name: "SUI";
2869
2869
  readonly key: "sui";
@@ -637,7 +637,7 @@ export const spokeChainConfig = {
637
637
  supportedTokens: suiSupportedTokens,
638
638
  nativeToken: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',
639
639
  bnUSD: '0xff4de2b2b57dd7611d2812d231a467d007b702a101fd5c7ad3b278257cddb507::bnusd::BNUSD',
640
- rpc_url: 'https://fullnode.mainnet.sui.io:443',
640
+ rpc_url: 'https://sui-rpc.publicnode.com',
641
641
  chain: baseChainInfo[ChainKeys.SUI_MAINNET],
642
642
  pollingConfig: {
643
643
  pollingIntervalMs: 500,
@@ -7,6 +7,18 @@ export declare const ICON_TX_RESULT_WAIT_MAX_RETRY = 10;
7
7
  export declare const MAX_UINT256: bigint;
8
8
  export declare const FEE_PERCENTAGE_SCALE = 10000n;
9
9
  export declare const DEFAULT_DEADLINE_OFFSET = 300n;
10
+ /**
11
+ * Gateway root shared by every backend API service: origin plus the deployment-owned version
12
+ * prefix. It never contains a service segment — each service appends its own path below it
13
+ * (`/be`, `/swaps`, `/bridge`, `/sponsorships/stellar`).
14
+ */
15
+ export declare const DEFAULT_API_BASE_URL = "https://api.sodax.com/v1";
16
+ /**
17
+ * @deprecated The gateway root plus the backend data API's own mount. Pass
18
+ * {@link DEFAULT_API_BASE_URL} as `baseURL` instead — the SDK appends
19
+ * {@link BACKEND_API_BASE_PATH} itself. A `baseURL` still ending in `/be` keeps working, but the
20
+ * SDK trims it and logs a warning.
21
+ */
10
22
  export declare const DEFAULT_BACKEND_API_ENDPOINT = "https://api.sodax.com/v1/be";
11
23
  export declare const DEFAULT_BACKEND_API_TIMEOUT = 30000;
12
24
  export declare const DEFAULT_BACKEND_API_HEADERS: {
@@ -16,16 +28,29 @@ export declare const DEFAULT_BACKEND_API_HEADERS: {
16
28
  export declare const DEFAULT_RELAYER_API_ENDPOINT = "https://xcall-relay.nw.iconblockchain.xyz";
17
29
  export declare const VAULT_TOKEN_DECIMALS = 18;
18
30
  /**
19
- * Gateway base URL, including its deployment-owned version prefix.
31
+ * Sponsoring gateway base URL. Deliberately a standalone literal, not an alias of
32
+ * {@link DEFAULT_API_BASE_URL}: sponsoring resolves independently, and consumers compare against this
33
+ * value to decide whether a target is real mainnet before spending real XLM — retargeting the shared
34
+ * root must not silently move that guard.
20
35
  */
21
36
  export declare const DEFAULT_SPONSORING_API_ENDPOINT = "https://api.sodax.com/v1";
22
37
  /** Stellar sponsorship route relative to the configured base URL. */
23
38
  export declare const SPONSORING_API_STELLAR_BASE_PATH = "/sponsorships/stellar";
39
+ /** Backend data API mount relative to the configured base URL (`/config/*`, `/intent/*`, `/moneymarket/*`, `/solver/*`). */
40
+ export declare const BACKEND_API_BASE_PATH = "/be";
24
41
  export type BaseApiConfig = {
25
42
  baseURL: HttpUrl;
26
43
  timeout: number;
27
44
  headers: Record<string, string>;
28
45
  };
46
+ /**
47
+ * Backend data API config. `basePath` is the service's mount below `baseURL`, defaulting to
48
+ * {@link BACKEND_API_BASE_PATH} — the gateway's mount. Set it to `''` for a directly addressed
49
+ * service that serves `/config/*`, `/intent/*`, … at the bare origin.
50
+ */
51
+ export type BackendApiConfig = BaseApiConfig & {
52
+ basePath?: string;
53
+ };
29
54
  /** Per-endpoint config for the swaps API. Structurally identical to {@link BaseApiConfig}. */
30
55
  export type SwapsApiConfig = BaseApiConfig;
31
56
  /**
@@ -37,24 +62,24 @@ export type SponsoringApiConfig = BaseApiConfig & {
37
62
  };
38
63
  /**
39
64
  * Independent service configs. At least one slice is required to keep this
40
- * union distinct from flat {@link BaseApiConfig}.
65
+ * union distinct from flat {@link BackendApiConfig}.
41
66
  */
42
67
  export type CustomApiConfig = {
43
- baseApiConfig: BaseApiConfig;
68
+ baseApiConfig: BackendApiConfig;
44
69
  swapsApiConfig?: SwapsApiConfig;
45
70
  sponsoringApiConfig?: SponsoringApiConfig;
46
71
  } | {
47
- baseApiConfig?: BaseApiConfig;
72
+ baseApiConfig?: BackendApiConfig;
48
73
  swapsApiConfig: SwapsApiConfig;
49
74
  sponsoringApiConfig?: SponsoringApiConfig;
50
75
  } | {
51
- baseApiConfig?: BaseApiConfig;
76
+ baseApiConfig?: BackendApiConfig;
52
77
  swapsApiConfig?: SwapsApiConfig;
53
78
  sponsoringApiConfig: SponsoringApiConfig;
54
79
  };
55
- export type ApiConfig = BaseApiConfig | CustomApiConfig;
80
+ export type ApiConfig = BackendApiConfig | CustomApiConfig;
56
81
  export declare const apiConfig: {
57
- baseURL: "https://api.sodax.com/v1/be";
82
+ baseURL: "https://api.sodax.com/v1";
58
83
  timeout: number;
59
84
  headers: {
60
85
  'Content-Type': string;
@@ -6,6 +6,18 @@ export const ICON_TX_RESULT_WAIT_MAX_RETRY = 10;
6
6
  export const MAX_UINT256 = (1n << 256n) - 1n;
7
7
  export const FEE_PERCENTAGE_SCALE = 10000n; // 100% = 10000
8
8
  export const DEFAULT_DEADLINE_OFFSET = 300n; // 5 minutes in seconds
9
+ /**
10
+ * Gateway root shared by every backend API service: origin plus the deployment-owned version
11
+ * prefix. It never contains a service segment — each service appends its own path below it
12
+ * (`/be`, `/swaps`, `/bridge`, `/sponsorships/stellar`).
13
+ */
14
+ export const DEFAULT_API_BASE_URL = 'https://api.sodax.com/v1';
15
+ /**
16
+ * @deprecated The gateway root plus the backend data API's own mount. Pass
17
+ * {@link DEFAULT_API_BASE_URL} as `baseURL` instead — the SDK appends
18
+ * {@link BACKEND_API_BASE_PATH} itself. A `baseURL` still ending in `/be` keeps working, but the
19
+ * SDK trims it and logs a warning.
20
+ */
9
21
  export const DEFAULT_BACKEND_API_ENDPOINT = 'https://api.sodax.com/v1/be';
10
22
  export const DEFAULT_BACKEND_API_TIMEOUT = 30000; // 30 seconds
11
23
  export const DEFAULT_BACKEND_API_HEADERS = {
@@ -15,13 +27,18 @@ export const DEFAULT_BACKEND_API_HEADERS = {
15
27
  export const DEFAULT_RELAYER_API_ENDPOINT = 'https://xcall-relay.nw.iconblockchain.xyz';
16
28
  export const VAULT_TOKEN_DECIMALS = 18;
17
29
  /**
18
- * Gateway base URL, including its deployment-owned version prefix.
30
+ * Sponsoring gateway base URL. Deliberately a standalone literal, not an alias of
31
+ * {@link DEFAULT_API_BASE_URL}: sponsoring resolves independently, and consumers compare against this
32
+ * value to decide whether a target is real mainnet before spending real XLM — retargeting the shared
33
+ * root must not silently move that guard.
19
34
  */
20
35
  export const DEFAULT_SPONSORING_API_ENDPOINT = 'https://api.sodax.com/v1';
21
36
  /** Stellar sponsorship route relative to the configured base URL. */
22
37
  export const SPONSORING_API_STELLAR_BASE_PATH = '/sponsorships/stellar';
38
+ /** Backend data API mount relative to the configured base URL (`/config/*`, `/intent/*`, `/moneymarket/*`, `/solver/*`). */
39
+ export const BACKEND_API_BASE_PATH = '/be';
23
40
  export const apiConfig = {
24
- baseURL: DEFAULT_BACKEND_API_ENDPOINT,
41
+ baseURL: DEFAULT_API_BASE_URL,
25
42
  timeout: DEFAULT_BACKEND_API_TIMEOUT,
26
43
  headers: DEFAULT_BACKEND_API_HEADERS,
27
44
  };
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 = 223;
22
+ export declare const CONFIG_VERSION = 225;
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 = 223; // this value should be incremented (inside release/sdk branch) each time @sodax/types package is updated
22
+ export const CONFIG_VERSION = 225; // this value should be incremented (inside release/sdk branch) each time @sodax/types package is updated
@@ -31,6 +31,12 @@ export type BitcoinSharedChainConfig = TxPollingConfig & {
31
31
  export type BridgeConfig = Prettify<BridgeDefaultConfig & BridgeOptions>;
32
32
  export type BridgeOptions = {
33
33
  partnerFee?: PartnerFee;
34
+ /**
35
+ * Route `bridge()` through the backend submit-tx flow. Default `true`.
36
+ * Set `false` for the fully client-side relay. Client-side only — not part of backend SodaxDefaultConfig.
37
+ * Omitted here means the default, not off: read the effective value via `sodax.config.bridgeUseBackendSubmitTx`.
38
+ */
39
+ useBackendSubmitTx?: boolean;
34
40
  };
35
41
  export type BridgeDefaultConfig = {};
36
42
  export declare const bridgeConfig: {};
@@ -52,6 +58,20 @@ export type RadfiSigner = (ctx: RadfiSignContext) => Record<string, string> | Pr
52
58
  export type RadfiOptions = {
53
59
  signRequest?: RadfiSigner;
54
60
  };
61
+ /**
62
+ * @deprecated in favor of `swaps` property of SodaxOptionalConfig, kept for backward compatibility.
63
+ * Still honoured, but only when `swaps.useBackendSubmitTx` is omitted; the default is now `true`.
64
+ */
65
+ export type SwapsClientOptions = {
66
+ useBackendSubmitTx?: boolean;
67
+ };
68
+ /**
69
+ * @deprecated in favor of `bridge` property of SodaxOptionalConfig, kept for backward compatibility.
70
+ * Still honoured, but only when `bridge.useBackendSubmitTx` is omitted; the default is now `true`.
71
+ */
72
+ export type BridgeClientOptions = {
73
+ useBackendSubmitTx?: boolean;
74
+ };
55
75
  export type SodaxOptionalConfig = {
56
76
  logger?: SodaxLoggerOption;
57
77
  analytics?: AnalyticsOption;
@@ -61,7 +81,9 @@ export type SodaxOptionalConfig = {
61
81
  moneyMarket?: MoneyMarketOptions;
62
82
  bridge?: BridgeOptions;
63
83
  leverageYield?: LeverageYieldOptions;
84
+ /** @deprecated Use `swaps` instead — still honoured, but only when `swaps.useBackendSubmitTx` is absent. */
64
85
  swapsOptions?: SwapsClientOptions;
86
+ /** @deprecated Use `bridge` instead — still honoured, but only when `bridge.useBackendSubmitTx` is absent. */
65
87
  bridgeOptions?: BridgeClientOptions;
66
88
  };
67
89
  /**
@@ -90,31 +112,6 @@ export type SodaxDefaultConfig = {
90
112
  solver: SolverConfig;
91
113
  relay: RelayConfig;
92
114
  };
93
- /**
94
- * Client-side swap behavior options. Like {@link SodaxOptionalConfig.logger}, these are runtime toggles
95
- * resolved once at construction — NOT part of the backend-fetched {@link SodaxDefaultConfig} data.
96
- */
97
- export type SwapsClientOptions = {
98
- /**
99
- * Opt-in: route `swap()` through the backend submit-tx 2-step flow (the backend relays +
100
- * post-executes server-side). On ANY non-success the SDK falls back to the client-side relay so
101
- * the swap still completes. Default `false` (the current fully client-side flow).
102
- */
103
- useBackendSubmitTx?: boolean;
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
- };
118
115
  export declare const sodaxConfig: {
119
116
  chains: {
120
117
  readonly sonic: {
@@ -2433,7 +2430,7 @@ export declare const sodaxConfig: {
2433
2430
  };
2434
2431
  readonly nativeToken: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";
2435
2432
  readonly bnUSD: "0xff4de2b2b57dd7611d2812d231a467d007b702a101fd5c7ad3b278257cddb507::bnusd::BNUSD";
2436
- readonly rpc_url: "https://fullnode.mainnet.sui.io:443";
2433
+ readonly rpc_url: "https://sui-rpc.publicnode.com";
2437
2434
  readonly chain: {
2438
2435
  readonly name: "SUI";
2439
2436
  readonly key: "sui";
@@ -6859,7 +6856,7 @@ export declare const sodaxConfig: {
6859
6856
  readonly rpcUrl: "https://rpc.soniclabs.com";
6860
6857
  };
6861
6858
  api: {
6862
- baseURL: "https://api.sodax.com/v1/be";
6859
+ baseURL: "https://api.sodax.com/v1";
6863
6860
  timeout: number;
6864
6861
  headers: {
6865
6862
  'Content-Type': string;
@@ -1939,6 +1939,12 @@ export declare const stagingSwapSupportedTokens: {
1939
1939
  };
1940
1940
  export type SwapsOptions = {
1941
1941
  partnerFee?: PartnerFee;
1942
+ /**
1943
+ * Route `swap()` through the backend submit-tx 2-step flow. Default `true`.
1944
+ * Set `false` for the fully client-side relay. Client-side only — not part of backend SodaxDefaultConfig.
1945
+ * Omitted here means the default, not off: read the effective value via `sodax.config.swapUseBackendSubmitTx`.
1946
+ */
1947
+ useBackendSubmitTx?: boolean;
1942
1948
  };
1943
1949
  export type SwapsDefaultConfig = {
1944
1950
  supportedTokens: Record<SpokeChainKey, readonly XToken[]>;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "2.1.0-rc.3",
7
+ "version": "2.1.0-rc.5",
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",