@sodax/types 2.0.0 → 2.1.0-rc.2

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.
@@ -6,4 +6,4 @@
6
6
  * per-feature analytics toggles). It lives in `@sodax/types`, the lowest layer, so every package
7
7
  * shares one source of truth instead of redefining the list; `@sodax/sdk` re-exports it.
8
8
  */
9
- export type SodaxFeature = 'swap' | 'moneyMarket' | 'bridge' | 'staking' | 'migration' | 'dex' | 'partner' | 'recovery' | 'backend' | 'leverageYield';
9
+ export type SodaxFeature = 'swap' | 'moneyMarket' | 'bridge' | 'staking' | 'migration' | 'dex' | 'partner' | 'recovery' | 'backend' | 'sponsoring' | 'leverageYield';
@@ -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
  };
@@ -90,7 +90,13 @@ export type StellarRawTransaction = {
90
90
  export type StellarReturnType<Raw extends boolean> = Raw extends true ? StellarRawTransaction : Raw extends false ? string : StellarRawTransaction | string;
91
91
  export interface IStellarWalletProvider extends ICoreWallet {
92
92
  readonly chainType: 'STELLAR';
93
- signTransaction: (tx: XDR) => Promise<XDR>;
93
+ /**
94
+ * Sign without broadcasting. Pass `options.address` when a specific
95
+ * account must sign; browser wallets otherwise use their active account.
96
+ */
97
+ signTransaction: (tx: XDR, options?: {
98
+ address?: string;
99
+ }) => Promise<XDR>;
94
100
  waitForTransactionReceipt: (txHash: string) => Promise<StellarRawTransactionReceipt>;
95
101
  /** Broadcast an already-signed XDR transaction via the Soroban RPC server. Returns the tx hash. */
96
102
  sendTransaction?: (signedTx: XDR) => Promise<string>;
@@ -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
  } | {
@@ -86,7 +86,7 @@ export function isLegacybnUSDToken(token) {
86
86
  return bnUSDLegacyTokens.some(t => t.address.toLowerCase() === token.address.toLowerCase());
87
87
  }
88
88
  export function getbnUSDToken(chainId) {
89
- if ("bnUSD" in spokeChainConfig[chainId].supportedTokens) {
89
+ if ('bnUSD' in spokeChainConfig[chainId].supportedTokens) {
90
90
  return spokeChainConfig[chainId].supportedTokens.bnUSD;
91
91
  }
92
92
  return undefined;
@@ -1,5 +1,5 @@
1
- import type { ChainType } from "../chains/chain-keys.js";
2
- import type { XToken } from "../chains/tokens.js";
1
+ import type { ChainType } from '../chains/chain-keys.js';
2
+ import type { XToken } from '../chains/tokens.js';
3
3
  export interface WalletAddressProvider {
4
4
  getWalletAddress(): Promise<string>;
5
5
  getPublicKey?: () => Promise<string>;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "2.0.0",
7
+ "version": "2.1.0-rc.2",
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",
@@ -61,7 +61,7 @@
61
61
  ],
62
62
  "license": "MIT",
63
63
  "scripts": {
64
- "build": "tsc",
64
+ "build": "rm -rf dist && tsc",
65
65
  "dev": "tsc --watch",
66
66
  "ci": "pnpm run pretty && pnpm run build && pnpm run test",
67
67
  "checkTs": "tsc",