@sodax/types 2.0.0-rc.11 → 2.0.0-rc.13

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,6 +6,17 @@ export declare function isSupportedBitcoinAddressType(addressType: string): addr
6
6
  * Shared utility — use this instead of duplicating prefix checks.
7
7
  */
8
8
  export declare function detectBitcoinAddressType(address: string): BtcAddressType;
9
+ /**
10
+ * Off-chain message-signing scheme a Bitcoin address type must use: BIP-322 vs ECDSA (BIP-137).
11
+ *
12
+ * - **P2WPKH / P2TR → BIP-322.** Taproot keys are Schnorr/x-only, so ECDSA cannot sign for them
13
+ * (and wallets like Xverse default to Taproot).
14
+ * - **P2SH / P2PKH → ECDSA (BIP-137).** Browser wallets (UniSat/OKX) reject BIP-322 on
15
+ * nested-segwit/legacy addresses — they throw "Not support address type to sign".
16
+ *
17
+ * No single scheme works for every address type, so signers AND verifiers must branch on this.
18
+ */
19
+ export declare function usesBip322MessageSigning(addressType: BtcAddressType): boolean;
9
20
  export declare const BTC_WALLET_ADDRESS_TYPES: readonly ["taproot", "segwit"];
10
21
  /** User-friendly Bitcoin address type for wallet connection. */
11
22
  export type BtcWalletAddressType = (typeof BTC_WALLET_ADDRESS_TYPES)[number];
@@ -86,6 +97,13 @@ export interface IBitcoinWalletProvider extends ICoreWallet {
86
97
  signTransaction(psbt: string, finalize?: boolean): Promise<string>;
87
98
  signEcdsaMessage(message: string): Promise<string>;
88
99
  signBip322Message(message: string): Promise<string>;
100
+ /**
101
+ * Get the signer's public key as a hex string. Optional capability: required only for the
102
+ * money-market on-demand (borrow/withdraw) flow, where the relay needs the key to verify a
103
+ * BIP-322 (Schnorr/Taproot) signature — which is not public-key-recoverable. Wallets that
104
+ * cannot expose it omit this method; callers guard before use.
105
+ */
106
+ getPublicKey?(): Promise<string>;
89
107
  /**
90
108
  * Send Bitcoin to an address
91
109
  * @param toAddress - Destination Bitcoin address
@@ -17,6 +17,19 @@ export function detectBitcoinAddressType(address) {
17
17
  return 'P2PKH';
18
18
  throw new Error(`Unknown Bitcoin address type: ${address}`);
19
19
  }
20
+ /**
21
+ * Off-chain message-signing scheme a Bitcoin address type must use: BIP-322 vs ECDSA (BIP-137).
22
+ *
23
+ * - **P2WPKH / P2TR → BIP-322.** Taproot keys are Schnorr/x-only, so ECDSA cannot sign for them
24
+ * (and wallets like Xverse default to Taproot).
25
+ * - **P2SH / P2PKH → ECDSA (BIP-137).** Browser wallets (UniSat/OKX) reject BIP-322 on
26
+ * nested-segwit/legacy addresses — they throw "Not support address type to sign".
27
+ *
28
+ * No single scheme works for every address type, so signers AND verifiers must branch on this.
29
+ */
30
+ export function usesBip322MessageSigning(addressType) {
31
+ return addressType === 'P2WPKH' || addressType === 'P2TR';
32
+ }
20
33
  export const BTC_WALLET_ADDRESS_TYPES = ['taproot', 'segwit'];
21
34
  /** Address types that Sodax supports for transactions. */
22
35
  const BTC_ADDRESS_TYPES = ['P2PKH', 'P2SH', 'P2WPKH', 'P2TR'];
@@ -526,6 +526,24 @@ export declare const spokeChainConfig: {
526
526
  readonly nativeToken: "0x0000000000000000000000000000000000000000";
527
527
  readonly bnUSD: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131";
528
528
  readonly supportedTokens: {
529
+ readonly lsodaWEETH: {
530
+ readonly symbol: "lsodaWEETH";
531
+ readonly name: "Leveraged Soda weETH";
532
+ readonly decimals: 18;
533
+ readonly address: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
534
+ readonly chainKey: "sonic";
535
+ readonly hubAsset: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
536
+ readonly vault: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
537
+ };
538
+ readonly lsodaWSTETH: {
539
+ readonly symbol: "lsodaWSTETH";
540
+ readonly name: "Leveraged Soda wstETH";
541
+ readonly decimals: 18;
542
+ readonly address: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
543
+ readonly chainKey: "sonic";
544
+ readonly hubAsset: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
545
+ readonly vault: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
546
+ };
529
547
  readonly sodaBNB: {
530
548
  readonly symbol: "sodaBNB";
531
549
  readonly name: "Soda BNB";
@@ -2417,9 +2435,9 @@ export declare const spokeChainConfig: {
2417
2435
  };
2418
2436
  readonly radfi: {
2419
2437
  readonly walletMode: "TRADING";
2420
- readonly apiUrl: "https://api.radfi.co/api";
2438
+ readonly apiUrl: "https://api.bound.exchange/api";
2421
2439
  readonly apiKey: "";
2422
- readonly umsUrl: "https://ums.radfi.co/api";
2440
+ readonly umsUrl: "https://api.ums.bound.exchange/api";
2423
2441
  readonly accessToken: "";
2424
2442
  readonly refreshToken: "";
2425
2443
  };
@@ -3302,6 +3320,24 @@ export declare const hubConfig: {
3302
3320
  readonly nativeToken: "0x0000000000000000000000000000000000000000";
3303
3321
  readonly wrappedNativeToken: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38";
3304
3322
  readonly supportedTokens: {
3323
+ readonly lsodaWEETH: {
3324
+ readonly symbol: "lsodaWEETH";
3325
+ readonly name: "Leveraged Soda weETH";
3326
+ readonly decimals: 18;
3327
+ readonly address: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
3328
+ readonly chainKey: "sonic";
3329
+ readonly hubAsset: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
3330
+ readonly vault: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
3331
+ };
3332
+ readonly lsodaWSTETH: {
3333
+ readonly symbol: "lsodaWSTETH";
3334
+ readonly name: "Leveraged Soda wstETH";
3335
+ readonly decimals: 18;
3336
+ readonly address: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
3337
+ readonly chainKey: "sonic";
3338
+ readonly hubAsset: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
3339
+ readonly vault: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
3340
+ };
3305
3341
  readonly sodaBNB: {
3306
3342
  readonly symbol: "sodaBNB";
3307
3343
  readonly name: "Soda BNB";
@@ -519,9 +519,9 @@ export const spokeChainConfig = {
519
519
  supportedTokens: bitcoinSupportedTokens,
520
520
  radfi: {
521
521
  walletMode: 'TRADING',
522
- apiUrl: 'https://api.radfi.co/api',
522
+ apiUrl: 'https://api.bound.exchange/api',
523
523
  apiKey: '',
524
- umsUrl: 'https://ums.radfi.co/api',
524
+ umsUrl: 'https://api.ums.bound.exchange/api',
525
525
  accessToken: '',
526
526
  refreshToken: '',
527
527
  },
@@ -259,7 +259,56 @@ export declare const SodaTokens: {
259
259
  readonly vault: "0x243b0c26c8b38793908d7C64e8510f21B19B4613";
260
260
  };
261
261
  };
262
+ /**
263
+ * Leverage-yield vault share tokens on Sonic. Each entry is the ERC-4626 share token
264
+ * issued by a deployed `LeverageYieldVault` (see `leverageYield.leverageYieldVaults` for
265
+ * the matching vault metadata). Spread into `sonicSupportedTokens` and the swap registry
266
+ * so they're discoverable in token selectors and swappable via the solver.
267
+ *
268
+ * `address`, `hubAsset`, and `vault` are all the leverage-vault proxy address — these
269
+ * tokens live on the hub and aren't further wrapped.
270
+ */
271
+ export declare const LsodaSymbols: readonly ["lsodaWEETH", "lsodaWSTETH"];
272
+ export type LsodaSymbol = (typeof LsodaSymbols)[number];
273
+ export declare const LsodaTokens: {
274
+ readonly lsodaWEETH: {
275
+ readonly symbol: "lsodaWEETH";
276
+ readonly name: "Leveraged Soda weETH";
277
+ readonly decimals: 18;
278
+ readonly address: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
279
+ readonly chainKey: "sonic";
280
+ readonly hubAsset: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
281
+ readonly vault: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
282
+ };
283
+ readonly lsodaWSTETH: {
284
+ readonly symbol: "lsodaWSTETH";
285
+ readonly name: "Leveraged Soda wstETH";
286
+ readonly decimals: 18;
287
+ readonly address: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
288
+ readonly chainKey: "sonic";
289
+ readonly hubAsset: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
290
+ readonly vault: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
291
+ };
292
+ };
262
293
  export declare const sonicSupportedTokens: {
294
+ readonly lsodaWEETH: {
295
+ readonly symbol: "lsodaWEETH";
296
+ readonly name: "Leveraged Soda weETH";
297
+ readonly decimals: 18;
298
+ readonly address: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
299
+ readonly chainKey: "sonic";
300
+ readonly hubAsset: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
301
+ readonly vault: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
302
+ };
303
+ readonly lsodaWSTETH: {
304
+ readonly symbol: "lsodaWSTETH";
305
+ readonly name: "Leveraged Soda wstETH";
306
+ readonly decimals: 18;
307
+ readonly address: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
308
+ readonly chainKey: "sonic";
309
+ readonly hubAsset: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
310
+ readonly vault: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
311
+ };
263
312
  readonly sodaBNB: {
264
313
  readonly symbol: "sodaBNB";
265
314
  readonly name: "Soda BNB";
@@ -2438,6 +2487,24 @@ export declare const stacksSupportedTokens: {
2438
2487
  };
2439
2488
  export declare const supportedTokensByChain: {
2440
2489
  readonly sonic: {
2490
+ readonly lsodaWEETH: {
2491
+ readonly symbol: "lsodaWEETH";
2492
+ readonly name: "Leveraged Soda weETH";
2493
+ readonly decimals: 18;
2494
+ readonly address: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
2495
+ readonly chainKey: "sonic";
2496
+ readonly hubAsset: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
2497
+ readonly vault: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
2498
+ };
2499
+ readonly lsodaWSTETH: {
2500
+ readonly symbol: "lsodaWSTETH";
2501
+ readonly name: "Leveraged Soda wstETH";
2502
+ readonly decimals: 18;
2503
+ readonly address: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
2504
+ readonly chainKey: "sonic";
2505
+ readonly hubAsset: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
2506
+ readonly vault: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
2507
+ };
2441
2508
  readonly sodaBNB: {
2442
2509
  readonly symbol: "sodaBNB";
2443
2510
  readonly name: "Soda BNB";
@@ -261,6 +261,36 @@ export const SodaTokens = {
261
261
  vault: '0x243b0c26c8b38793908d7C64e8510f21B19B4613',
262
262
  }
263
263
  };
264
+ /**
265
+ * Leverage-yield vault share tokens on Sonic. Each entry is the ERC-4626 share token
266
+ * issued by a deployed `LeverageYieldVault` (see `leverageYield.leverageYieldVaults` for
267
+ * the matching vault metadata). Spread into `sonicSupportedTokens` and the swap registry
268
+ * so they're discoverable in token selectors and swappable via the solver.
269
+ *
270
+ * `address`, `hubAsset`, and `vault` are all the leverage-vault proxy address — these
271
+ * tokens live on the hub and aren't further wrapped.
272
+ */
273
+ export const LsodaSymbols = ['lsodaWEETH', 'lsodaWSTETH'];
274
+ export const LsodaTokens = {
275
+ lsodaWEETH: {
276
+ symbol: 'lsodaWEETH',
277
+ name: 'Leveraged Soda weETH',
278
+ decimals: 18,
279
+ address: '0xD09de2f5070699A909c0FD32fb5A909d3886701D',
280
+ chainKey: ChainKeys.SONIC_MAINNET,
281
+ hubAsset: '0xD09de2f5070699A909c0FD32fb5A909d3886701D',
282
+ vault: '0xD09de2f5070699A909c0FD32fb5A909d3886701D',
283
+ },
284
+ lsodaWSTETH: {
285
+ symbol: 'lsodaWSTETH',
286
+ name: 'Leveraged Soda wstETH',
287
+ decimals: 18,
288
+ address: '0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a',
289
+ chainKey: ChainKeys.SONIC_MAINNET,
290
+ hubAsset: '0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a',
291
+ vault: '0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a',
292
+ },
293
+ };
264
294
  // --- Per-chain supported tokens ---
265
295
  export const sonicSupportedTokens = {
266
296
  S: {
@@ -327,6 +357,7 @@ export const sonicSupportedTokens = {
327
357
  vault: SodaTokens.sodaSODA.address,
328
358
  },
329
359
  ...SodaTokens,
360
+ ...LsodaTokens,
330
361
  };
331
362
  export const redbellySupportedTokens = {
332
363
  RBNT: {
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from './evm/index.js';
9
9
  export * from './icon/index.js';
10
10
  export * from './injective/index.js';
11
11
  export * from './moneyMarket/index.js';
12
+ export * from './leverageYield/index.js';
12
13
  export * from './near/index.js';
13
14
  export * from './solana/index.js';
14
15
  export * from './stacks/index.js';
@@ -17,4 +18,4 @@ export * from './sui/index.js';
17
18
  export * from './swap/index.js';
18
19
  export * from './utils/index.js';
19
20
  export * from './wallet/index.js';
20
- export declare const CONFIG_VERSION = 209;
21
+ export declare const CONFIG_VERSION = 211;
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ export * from './evm/index.js';
9
9
  export * from './icon/index.js';
10
10
  export * from './injective/index.js';
11
11
  export * from './moneyMarket/index.js';
12
+ export * from './leverageYield/index.js';
12
13
  export * from './near/index.js';
13
14
  export * from './solana/index.js';
14
15
  export * from './stacks/index.js';
@@ -17,4 +18,4 @@ export * from './sui/index.js';
17
18
  export * from './swap/index.js';
18
19
  export * from './utils/index.js';
19
20
  export * from './wallet/index.js';
20
- export const CONFIG_VERSION = 209; // this value should be incremented (inside release/sdk branch) each time @sodax/types package is updated
21
+ export const CONFIG_VERSION = 211; // this value should be incremented (inside release/sdk branch) each time @sodax/types package is updated
@@ -0,0 +1 @@
1
+ export * from './leverageYield.js';
@@ -0,0 +1 @@
1
+ export * from './leverageYield.js';
@@ -0,0 +1,127 @@
1
+ import type { Address } from '../shared/shared.js';
2
+ /**
3
+ * A single deployed LeverageYieldVault.
4
+ *
5
+ * The vault is an ERC-4626 wrapper on the Sonic hub. It accepts deposits of `asset` (a
6
+ * Sodax vault token like sodaWEETH), borrows `borrowToken` from the Sodax-forked AAVE
7
+ * pool, swaps the borrowed amount back into the asset, and re-supplies — yielding a
8
+ * leveraged long on the asset / borrowToken peg.
9
+ *
10
+ * The fields here are static descriptors of the deployed vault. Cross-chain deposits and
11
+ * withdrawals route by the user's spoke-side token (e.g. weETH on Arbitrum); the hub-side
12
+ * AssetToken and Sodax vault token are resolved at call time by `ConfigService`. This
13
+ * registry exists for vault discovery and UI display, not for routing.
14
+ */
15
+ export type LeverageYieldVault = {
16
+ /**
17
+ * Stable lookup key — by convention the leverage-vault share-token symbol
18
+ * (e.g. `'lsodaWEETH'`, `'lsodaWSTETH'`). Used by `LeverageYieldService.getVault(name)`.
19
+ */
20
+ name: string;
21
+ /** Deployed `LeverageYieldVault` proxy address on the Sonic hub. */
22
+ vault: Address;
23
+ /**
24
+ * The vault's underlying asset on the hub — the ERC-20 a depositor effectively holds via
25
+ * vault shares. Always a Sodax vault-token wrapper (e.g. sodaWEETH), since user deposits
26
+ * are bridged in as the underlying hub asset and wrapped before the leverage vault deposit.
27
+ */
28
+ asset: Address;
29
+ /**
30
+ * The token the vault borrows from the Sodax-forked AAVE pool against `asset` collateral.
31
+ * Always a Sodax vault-token wrapper (e.g. sodaETH), matching the asset side. Drives the
32
+ * leverage direction: the position is a long on the `asset` / `borrowToken` peg.
33
+ */
34
+ borrowToken: Address;
35
+ /**
36
+ * LSD staking-APR source for the underlying asset. When present, callers can use
37
+ * `LeverageYieldService.getEffectiveApr(vault)` to combine AAVE rates with the LSD's
38
+ * native staking yield — the primary yield source for LSD-backed strategies. Omit for
39
+ * non-LSD vaults; the SDK then treats the LSD yield as 0%.
40
+ */
41
+ lsdSource?: LeverageYieldLsdSource;
42
+ };
43
+ /**
44
+ * Off-chain LSD staking-APR source for a leverage-yield vault. The vault's underlying asset
45
+ * is an LSD (weETH, wstETH, …) that appreciates against its base asset (ETH) at the LSD's
46
+ * native staking rate — yield that does **not** appear in AAVE's `currentLiquidityRate` and
47
+ * that the SDK must therefore fetch off-chain to report an honest effective APR.
48
+ *
49
+ * The SDK fetches all LSD APRs from DefiLlama's per-pool endpoint
50
+ * (`https://yields.llama.fi/chart/<poolId>`) — one CORS-friendly source that already
51
+ * aggregates rates across LSD issuers, so no provider-specific dispatch is needed in the
52
+ * service. Pure data — no functions — so the registry stays serialisable.
53
+ */
54
+ export type LeverageYieldLsdSource = {
55
+ /**
56
+ * DefiLlama pool ID (UUID) for the LSD's staking pool. Find via the bulk `/pools`
57
+ * endpoint, e.g. `data.filter(p => p.symbol === 'STETH' && p.project === 'lido')`.
58
+ * Examples:
59
+ * - Lido stETH: `747c1d2a-c668-4682-b9f9-296708a3dd90`
60
+ * - EtherFi weETH: `46bd2bdf-6d92-4066-b482-e885ee172264`
61
+ */
62
+ poolId: string;
63
+ /**
64
+ * Hardcoded APR (percentage, e.g. `3.2` for 3.2%) used when the DefiLlama fetch errors.
65
+ * Should reflect the trailing 30-day yield from the issuer's dashboard; update via PR if
66
+ * it drifts >50 bp from reality.
67
+ */
68
+ fallbackAprPct: number;
69
+ /** Human label for UI display, e.g. `'Lido (stETH)'` or `'EtherFi (weETH)'`. */
70
+ label: string;
71
+ };
72
+ /**
73
+ * SDK-wide registry of known leverage vaults. Add an entry here when a vault is promoted
74
+ * to a default; callers can also override per-instance via the `Sodax({ leverageYield:
75
+ * { vaults: [...] } })` config slot.
76
+ *
77
+ * Addresses are sourced from the canonical token registries — the proxy/share-token address
78
+ * from {@link LsodaTokens} and the hub-side `asset` / `borrowToken` from {@link SodaTokens} —
79
+ * so a deployment-address change lives in exactly one place.
80
+ */
81
+ export declare const leverageYieldVaults: readonly [{
82
+ readonly name: "lsodaWEETH";
83
+ readonly vault: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
84
+ readonly asset: "0xCb6B152D3a943f25157381aFcA7fEFCD2ef5a357";
85
+ readonly borrowToken: "0x4effB5813271699683C25c734F4daBc45B363709";
86
+ readonly lsdSource: {
87
+ readonly poolId: "46bd2bdf-6d92-4066-b482-e885ee172264";
88
+ readonly fallbackAprPct: 3;
89
+ readonly label: "EtherFi (weETH)";
90
+ };
91
+ }, {
92
+ readonly name: "lsodaWSTETH";
93
+ readonly vault: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
94
+ readonly asset: "0x58b0538D7EEaeE69EF32f9F1dE5cbF32A10a977B";
95
+ readonly borrowToken: "0x4effB5813271699683C25c734F4daBc45B363709";
96
+ readonly lsdSource: {
97
+ readonly poolId: "747c1d2a-c668-4682-b9f9-296708a3dd90";
98
+ readonly fallbackAprPct: 2.4;
99
+ readonly label: "Lido (stETH)";
100
+ };
101
+ }];
102
+ export type LeverageYieldConfig = {
103
+ vaults: readonly LeverageYieldVault[];
104
+ };
105
+ export declare const leverageYieldConfig: {
106
+ readonly vaults: readonly [{
107
+ readonly name: "lsodaWEETH";
108
+ readonly vault: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
109
+ readonly asset: "0xCb6B152D3a943f25157381aFcA7fEFCD2ef5a357";
110
+ readonly borrowToken: "0x4effB5813271699683C25c734F4daBc45B363709";
111
+ readonly lsdSource: {
112
+ readonly poolId: "46bd2bdf-6d92-4066-b482-e885ee172264";
113
+ readonly fallbackAprPct: 3;
114
+ readonly label: "EtherFi (weETH)";
115
+ };
116
+ }, {
117
+ readonly name: "lsodaWSTETH";
118
+ readonly vault: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
119
+ readonly asset: "0x58b0538D7EEaeE69EF32f9F1dE5cbF32A10a977B";
120
+ readonly borrowToken: "0x4effB5813271699683C25c734F4daBc45B363709";
121
+ readonly lsdSource: {
122
+ readonly poolId: "747c1d2a-c668-4682-b9f9-296708a3dd90";
123
+ readonly fallbackAprPct: 2.4;
124
+ readonly label: "Lido (stETH)";
125
+ };
126
+ }];
127
+ };
@@ -0,0 +1,39 @@
1
+ import { LsodaTokens, SodaTokens } from '../chains/tokens.js';
2
+ /**
3
+ * SDK-wide registry of known leverage vaults. Add an entry here when a vault is promoted
4
+ * to a default; callers can also override per-instance via the `Sodax({ leverageYield:
5
+ * { vaults: [...] } })` config slot.
6
+ *
7
+ * Addresses are sourced from the canonical token registries — the proxy/share-token address
8
+ * from {@link LsodaTokens} and the hub-side `asset` / `borrowToken` from {@link SodaTokens} —
9
+ * so a deployment-address change lives in exactly one place.
10
+ */
11
+ export const leverageYieldVaults = [
12
+ {
13
+ name: LsodaTokens.lsodaWEETH.symbol,
14
+ vault: LsodaTokens.lsodaWEETH.vault,
15
+ asset: SodaTokens.sodaWEETH.address, // sodaWEETH on Sonic
16
+ borrowToken: SodaTokens.sodaETH.address, // sodaETH on Sonic
17
+ lsdSource: {
18
+ // DefiLlama pool for EtherFi's weETH on Ethereum (project: 'ether.fi-stake').
19
+ poolId: '46bd2bdf-6d92-4066-b482-e885ee172264',
20
+ fallbackAprPct: 3.0,
21
+ label: 'EtherFi (weETH)',
22
+ },
23
+ },
24
+ {
25
+ name: LsodaTokens.lsodaWSTETH.symbol,
26
+ vault: LsodaTokens.lsodaWSTETH.vault,
27
+ asset: SodaTokens.sodaWSTETH.address, // sodaWSTETH on Sonic
28
+ borrowToken: SodaTokens.sodaETH.address, // sodaETH on Sonic
29
+ lsdSource: {
30
+ // DefiLlama pool for Lido's stETH on Ethereum (wstETH inherits this rate via redeem).
31
+ poolId: '747c1d2a-c668-4682-b9f9-296708a3dd90',
32
+ fallbackAprPct: 2.4,
33
+ label: 'Lido (stETH)',
34
+ },
35
+ },
36
+ ];
37
+ export const leverageYieldConfig = {
38
+ vaults: leverageYieldVaults,
39
+ };
@@ -37,6 +37,10 @@ export interface FTTransferCallArgs {
37
37
  memo?: string;
38
38
  msg?: string;
39
39
  }
40
+ export interface StorageDepositArgs {
41
+ account_id: string;
42
+ registration_only?: boolean;
43
+ }
40
44
  export interface NearTransferArgs {
41
45
  to: Array<number>;
42
46
  amount: string;
@@ -52,7 +56,7 @@ export interface SetHubConfig {
52
56
  hub_chain_id: number;
53
57
  hub_asset_manager: number[];
54
58
  }
55
- export type ContractArgs = TransferArgs | InitArgs | SetHubConfig | FTTransferCallArgs | NearTransferArgs | SendMsgArgs | FillIntentArgs;
59
+ export type ContractArgs = TransferArgs | InitArgs | SetHubConfig | FTTransferCallArgs | StorageDepositArgs | NearTransferArgs | SendMsgArgs | FillIntentArgs;
56
60
  export interface CallContractParams {
57
61
  contractId: string;
58
62
  method: string;
@@ -1 +1,2 @@
1
1
  export * from './shared.js';
2
+ export * from './logger.js';
@@ -1 +1,2 @@
1
1
  export * from './shared.js';
2
+ export * from './logger.js';
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Unified logging interface for the SDK.
3
+ *
4
+ * The SDK routes all of its internal diagnostics through a `SodaxLogger` instead of
5
+ * calling `console.*` directly, so consumers can redirect or silence SDK output and
6
+ * forward it to a structured sink (Sentry, Pino, Datadog, etc.).
7
+ *
8
+ * Pass one to `new Sodax({ logger })` via {@link SodaxLoggerOption}:
9
+ * - `'console'` — default; mirrors the SDK's historical `console.*` behavior.
10
+ * - `'silent'` — drop all SDK logs.
11
+ * - a custom `SodaxLogger` — forward to your own sink.
12
+ *
13
+ * `error()` receives the thrown value separately from structured `data` so adapters
14
+ * can attach it as the exception (e.g. `Sentry.captureException(error, { extra: data })`).
15
+ * SDK errors are `SodaxError` instances whose `toJSON()` is the canonical serialization surface.
16
+ */
17
+ export interface SodaxLogger {
18
+ debug(message: string, data?: Record<string, unknown>): void;
19
+ info(message: string, data?: Record<string, unknown>): void;
20
+ warn(message: string, data?: Record<string, unknown>): void;
21
+ error(message: string, error?: unknown, data?: Record<string, unknown>): void;
22
+ }
23
+ /**
24
+ * Logger configuration accepted by `new Sodax(...)`. Either a built-in preset name or a
25
+ * custom {@link SodaxLogger} implementation. Resolved to a concrete `SodaxLogger` by the SDK.
26
+ */
27
+ export type SodaxLoggerOption = SodaxLogger | 'console' | 'silent';
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,11 @@
1
1
  import type { TxPollingConfig } from '../shared/shared.js';
2
+ import type { SodaxLoggerOption } from '../shared/logger.js';
3
+ import type { DeepPartial } from '../utils/deep-partial.js';
2
4
  import { type ApiConfig, type SolverConfig, type RelayConfig } from '../common/constants.js';
3
5
  import type { MoneyMarketConfig, PartnerFee } from '../common/common.js';
4
6
  import { type DexConfig } from '../dex/dex.js';
5
7
  import { type SwapsConfig } from '../swap/swap.js';
8
+ import { type LeverageYieldConfig } from '../leverageYield/leverageYield.js';
6
9
  import { type HubConfig, type SpokeChainConfig, type SpokeChainKey } from '../chains/chains.js';
7
10
  export type EvmSharedChainConfig = TxPollingConfig & {
8
11
  rpcUrl: string;
@@ -37,11 +40,24 @@ export type SodaxConfig = {
37
40
  moneyMarket: MoneyMarketConfig;
38
41
  bridge: BridgeConfig;
39
42
  dex: DexConfig;
43
+ leverageYield: LeverageYieldConfig;
40
44
  hub: HubConfig;
41
45
  api: ApiConfig;
42
46
  solver: SolverConfig;
43
47
  relay: RelayConfig;
44
48
  };
49
+ /**
50
+ * Options accepted by `new Sodax(...)`. A deep-partial override of the {@link SodaxConfig} data
51
+ * contract, plus the client-side `logger` runtime option which is deliberately kept OUT of
52
+ * `SodaxConfig` itself: `SodaxConfig` is the data shape fetched from / merged with the backend,
53
+ * whereas `logger` is a local sink that is resolved once and never fetched or overwritten.
54
+ *
55
+ * Keeping `logger` here (rather than on `SodaxConfig`) means `DeepPartial<SodaxConfig>` no longer
56
+ * makes the logger's methods optional, so the SDK can resolve `options.logger` without casting.
57
+ */
58
+ export type SodaxOptions = DeepPartial<SodaxConfig> & {
59
+ logger?: SodaxLoggerOption;
60
+ };
45
61
  export declare const sodaxConfig: {
46
62
  fee: undefined;
47
63
  chains: {
@@ -67,6 +83,24 @@ export declare const sodaxConfig: {
67
83
  readonly nativeToken: "0x0000000000000000000000000000000000000000";
68
84
  readonly bnUSD: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131";
69
85
  readonly supportedTokens: {
86
+ readonly lsodaWEETH: {
87
+ readonly symbol: "lsodaWEETH";
88
+ readonly name: "Leveraged Soda weETH";
89
+ readonly decimals: 18;
90
+ readonly address: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
91
+ readonly chainKey: "sonic";
92
+ readonly hubAsset: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
93
+ readonly vault: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
94
+ };
95
+ readonly lsodaWSTETH: {
96
+ readonly symbol: "lsodaWSTETH";
97
+ readonly name: "Leveraged Soda wstETH";
98
+ readonly decimals: 18;
99
+ readonly address: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
100
+ readonly chainKey: "sonic";
101
+ readonly hubAsset: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
102
+ readonly vault: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
103
+ };
70
104
  readonly sodaBNB: {
71
105
  readonly symbol: "sodaBNB";
72
106
  readonly name: "Soda BNB";
@@ -1958,9 +1992,9 @@ export declare const sodaxConfig: {
1958
1992
  };
1959
1993
  readonly radfi: {
1960
1994
  readonly walletMode: "TRADING";
1961
- readonly apiUrl: "https://api.radfi.co/api";
1995
+ readonly apiUrl: "https://api.bound.exchange/api";
1962
1996
  readonly apiKey: "";
1963
- readonly umsUrl: "https://ums.radfi.co/api";
1997
+ readonly umsUrl: "https://api.ums.bound.exchange/api";
1964
1998
  readonly accessToken: "";
1965
1999
  readonly refreshToken: "";
1966
2000
  };
@@ -3031,6 +3065,22 @@ export declare const sodaxConfig: {
3031
3065
  readonly chainKey: "sonic";
3032
3066
  readonly hubAsset: "0x243b0c26c8b38793908d7C64e8510f21B19B4613";
3033
3067
  readonly vault: "0x243b0c26c8b38793908d7C64e8510f21B19B4613";
3068
+ } | {
3069
+ readonly symbol: "lsodaWEETH";
3070
+ readonly name: "Leveraged Soda weETH";
3071
+ readonly decimals: 18;
3072
+ readonly address: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
3073
+ readonly chainKey: "sonic";
3074
+ readonly hubAsset: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
3075
+ readonly vault: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
3076
+ } | {
3077
+ readonly symbol: "lsodaWSTETH";
3078
+ readonly name: "Leveraged Soda wstETH";
3079
+ readonly decimals: 18;
3080
+ readonly address: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
3081
+ readonly chainKey: "sonic";
3082
+ readonly hubAsset: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
3083
+ readonly vault: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
3034
3084
  })[]];
3035
3085
  readonly "0xa86a.avax": [{
3036
3086
  readonly symbol: "AVAX";
@@ -5940,6 +5990,29 @@ export declare const sodaxConfig: {
5940
5990
  readonly '0x3e102c7d9b46c92abcd4c2e1c70f362b47a201a6': "0x4effB5813271699683C25c734F4daBc45B363709";
5941
5991
  };
5942
5992
  };
5993
+ leverageYield: {
5994
+ readonly vaults: readonly [{
5995
+ readonly name: "lsodaWEETH";
5996
+ readonly vault: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
5997
+ readonly asset: "0xCb6B152D3a943f25157381aFcA7fEFCD2ef5a357";
5998
+ readonly borrowToken: "0x4effB5813271699683C25c734F4daBc45B363709";
5999
+ readonly lsdSource: {
6000
+ readonly poolId: "46bd2bdf-6d92-4066-b482-e885ee172264";
6001
+ readonly fallbackAprPct: 3;
6002
+ readonly label: "EtherFi (weETH)";
6003
+ };
6004
+ }, {
6005
+ readonly name: "lsodaWSTETH";
6006
+ readonly vault: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
6007
+ readonly asset: "0x58b0538D7EEaeE69EF32f9F1dE5cbF32A10a977B";
6008
+ readonly borrowToken: "0x4effB5813271699683C25c734F4daBc45B363709";
6009
+ readonly lsdSource: {
6010
+ readonly poolId: "747c1d2a-c668-4682-b9f9-296708a3dd90";
6011
+ readonly fallbackAprPct: 2.4;
6012
+ readonly label: "Lido (stETH)";
6013
+ };
6014
+ }];
6015
+ };
5943
6016
  hub: {
5944
6017
  readonly chain: {
5945
6018
  readonly name: "Sonic";
@@ -5970,6 +6043,24 @@ export declare const sodaxConfig: {
5970
6043
  readonly nativeToken: "0x0000000000000000000000000000000000000000";
5971
6044
  readonly wrappedNativeToken: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38";
5972
6045
  readonly supportedTokens: {
6046
+ readonly lsodaWEETH: {
6047
+ readonly symbol: "lsodaWEETH";
6048
+ readonly name: "Leveraged Soda weETH";
6049
+ readonly decimals: 18;
6050
+ readonly address: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
6051
+ readonly chainKey: "sonic";
6052
+ readonly hubAsset: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
6053
+ readonly vault: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
6054
+ };
6055
+ readonly lsodaWSTETH: {
6056
+ readonly symbol: "lsodaWSTETH";
6057
+ readonly name: "Leveraged Soda wstETH";
6058
+ readonly decimals: 18;
6059
+ readonly address: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
6060
+ readonly chainKey: "sonic";
6061
+ readonly hubAsset: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
6062
+ readonly vault: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
6063
+ };
5973
6064
  readonly sodaBNB: {
5974
6065
  readonly symbol: "sodaBNB";
5975
6066
  readonly name: "Soda BNB";
@@ -2,6 +2,7 @@ import { apiConfig, solverConfig, relayConfig, } from '../common/constants.js';
2
2
  import { moneyMarketConfig } from '../moneyMarket/moneyMarket.js';
3
3
  import { dexConfig } from '../dex/dex.js';
4
4
  import { swapsConfig } from '../swap/swap.js';
5
+ import { leverageYieldConfig } from '../leverageYield/leverageYield.js';
5
6
  import { spokeChainConfig, hubConfig, } from '../chains/chains.js';
6
7
  export const bridgeConfig = {
7
8
  partnerFee: undefined,
@@ -14,6 +15,7 @@ export const sodaxConfig = {
14
15
  moneyMarket: moneyMarketConfig,
15
16
  bridge: bridgeConfig,
16
17
  dex: dexConfig,
18
+ leverageYield: leverageYieldConfig,
17
19
  hub: hubConfig,
18
20
  api: apiConfig,
19
21
  solver: solverConfig,
package/dist/sui/sui.d.ts CHANGED
@@ -1,11 +1,12 @@
1
- import type { Base64String, Hex } from '../shared/shared.js';
1
+ import type { Hex } from '../shared/shared.js';
2
2
  import type { ICoreWallet } from '../wallet/wallet.js';
3
3
  export type SuiReturnType<Raw extends boolean> = Raw extends true ? SuiRawTransaction : Raw extends false ? string : SuiRawTransaction | string;
4
4
  export type SuiRawTransaction = {
5
5
  from: Hex;
6
6
  to: string;
7
7
  value: bigint;
8
- data: Base64String;
8
+ /** The @mysten/sui Transaction JSON from `Transaction#serialize()`; reconstruct with `Transaction.from()`. */
9
+ data: string;
9
10
  };
10
11
  export type SuiTransaction = {
11
12
  toJSON: () => Promise<string>;
@@ -250,6 +250,22 @@ export declare const swapSupportedTokens: {
250
250
  readonly chainKey: "sonic";
251
251
  readonly hubAsset: "0x243b0c26c8b38793908d7C64e8510f21B19B4613";
252
252
  readonly vault: "0x243b0c26c8b38793908d7C64e8510f21B19B4613";
253
+ } | {
254
+ readonly symbol: "lsodaWEETH";
255
+ readonly name: "Leveraged Soda weETH";
256
+ readonly decimals: 18;
257
+ readonly address: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
258
+ readonly chainKey: "sonic";
259
+ readonly hubAsset: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
260
+ readonly vault: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
261
+ } | {
262
+ readonly symbol: "lsodaWSTETH";
263
+ readonly name: "Leveraged Soda wstETH";
264
+ readonly decimals: 18;
265
+ readonly address: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
266
+ readonly chainKey: "sonic";
267
+ readonly hubAsset: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
268
+ readonly vault: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
253
269
  })[]];
254
270
  readonly "0xa86a.avax": [{
255
271
  readonly symbol: "AVAX";
@@ -2000,6 +2016,22 @@ export declare const swapsConfig: {
2000
2016
  readonly chainKey: "sonic";
2001
2017
  readonly hubAsset: "0x243b0c26c8b38793908d7C64e8510f21B19B4613";
2002
2018
  readonly vault: "0x243b0c26c8b38793908d7C64e8510f21B19B4613";
2019
+ } | {
2020
+ readonly symbol: "lsodaWEETH";
2021
+ readonly name: "Leveraged Soda weETH";
2022
+ readonly decimals: 18;
2023
+ readonly address: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
2024
+ readonly chainKey: "sonic";
2025
+ readonly hubAsset: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
2026
+ readonly vault: "0xD09de2f5070699A909c0FD32fb5A909d3886701D";
2027
+ } | {
2028
+ readonly symbol: "lsodaWSTETH";
2029
+ readonly name: "Leveraged Soda wstETH";
2030
+ readonly decimals: 18;
2031
+ readonly address: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
2032
+ readonly chainKey: "sonic";
2033
+ readonly hubAsset: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
2034
+ readonly vault: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a";
2003
2035
  })[]];
2004
2036
  readonly "0xa86a.avax": [{
2005
2037
  readonly symbol: "AVAX";
package/dist/swap/swap.js CHANGED
@@ -1,4 +1,4 @@
1
- import { SodaTokens } from '../chains/tokens.js';
1
+ import { SodaTokens, LsodaTokens } from '../chains/tokens.js';
2
2
  import { spokeChainConfig, ChainKeys } from '../chains/chains.js';
3
3
  export const swapSupportedTokens = {
4
4
  [ChainKeys.SONIC_MAINNET]: [
@@ -9,6 +9,7 @@ export const swapSupportedTokens = {
9
9
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.wS,
10
10
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.SODA,
11
11
  ...Object.values(SodaTokens),
12
+ ...Object.values(LsodaTokens),
12
13
  ],
13
14
  [ChainKeys.AVALANCHE_MAINNET]: [
14
15
  spokeChainConfig[ChainKeys.AVALANCHE_MAINNET].supportedTokens.AVAX,
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "2.0.0-rc.11",
7
+ "version": "2.0.0-rc.13",
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",