@sodax/wallet-sdk-core 2.0.0-rc.13 → 2.0.0-rc.15

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.
package/dist/index.cjs CHANGED
@@ -9,6 +9,9 @@ var transactions = require('@mysten/sui/transactions');
9
9
  var walletStandard = require('@mysten/wallet-standard');
10
10
  var IconSdkRaw = require('icon-sdk-js');
11
11
  var sdkTs = require('@injectivelabs/sdk-ts');
12
+ var tx_js = require('cosmjs-types/cosmos/tx/v1beta1/tx.js');
13
+ var tx_js$1 = require('cosmjs-types/cosmwasm/wasm/v1/tx.js');
14
+ var networks = require('@injectivelabs/networks');
12
15
  var splToken = require('@solana/spl-token');
13
16
  var web3_js = require('@solana/web3.js');
14
17
  var stellarSdk = require('@stellar/stellar-sdk');
@@ -367,6 +370,15 @@ var SodaTokens = {
367
370
  chainKey: ChainKeys.SONIC_MAINNET,
368
371
  hubAsset: "0x243b0c26c8b38793908d7C64e8510f21B19B4613",
369
372
  vault: "0x243b0c26c8b38793908d7C64e8510f21B19B4613"
373
+ },
374
+ sodaJITOSOL: {
375
+ symbol: "sodaJITOSOL",
376
+ name: "Soda JITOSOL",
377
+ decimals: 18,
378
+ address: "0xe1bad4400d947Bc4fa66f9c0A143D800002083a0",
379
+ chainKey: ChainKeys.SONIC_MAINNET,
380
+ hubAsset: "0xe1bad4400d947Bc4fa66f9c0A143D800002083a0",
381
+ vault: "0xe1bad4400d947Bc4fa66f9c0A143D800002083a0"
370
382
  }
371
383
  };
372
384
  var LsodaTokens = {
@@ -387,6 +399,15 @@ var LsodaTokens = {
387
399
  chainKey: ChainKeys.SONIC_MAINNET,
388
400
  hubAsset: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a",
389
401
  vault: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a"
402
+ },
403
+ lsodaJITOSOL: {
404
+ symbol: "lsodaJITOSOL",
405
+ name: "Leveraged Soda JITOSOL",
406
+ decimals: 18,
407
+ address: "0xD7Ae4853E0f93682F5DaA14734F5D18cBa09Bd78",
408
+ chainKey: ChainKeys.SONIC_MAINNET,
409
+ hubAsset: "0xD7Ae4853E0f93682F5DaA14734F5D18cBa09Bd78",
410
+ vault: "0xD7Ae4853E0f93682F5DaA14734F5D18cBa09Bd78"
390
411
  }
391
412
  };
392
413
  var sonicSupportedTokens = {
@@ -664,7 +685,7 @@ var solanaSupportedTokens = {
664
685
  address: "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn",
665
686
  chainKey: ChainKeys.SOLANA_MAINNET,
666
687
  hubAsset: "0x942f89a324d2652e447b9fcf08effc9f9776a680",
667
- vault: "0x942f89a324d2652e447b9fcf08effc9f9776a680"
688
+ vault: SodaTokens.sodaJITOSOL.address
668
689
  },
669
690
  mSOL: {
670
691
  symbol: "mSOL",
@@ -1097,6 +1118,15 @@ var baseSupportedTokens = {
1097
1118
  chainKey: ChainKeys.BASE_MAINNET,
1098
1119
  hubAsset: "0xaa81bb5ba3c972ab53605d3ba7e443a3de6d1cb9",
1099
1120
  vault: "0xaa81bb5ba3c972ab53605d3ba7e443a3de6d1cb9"
1121
+ },
1122
+ AERO: {
1123
+ symbol: "AERO",
1124
+ name: "Aerodrome Finance",
1125
+ decimals: 18,
1126
+ address: "0x940181a94A35A4569e4529A3CDfB74e38FD98631",
1127
+ chainKey: ChainKeys.BASE_MAINNET,
1128
+ hubAsset: "0x348e086ab6f424dfc575a325c28624ed23973173",
1129
+ vault: "0x348e086ab6f424dfc575a325c28624ed23973173"
1100
1130
  }
1101
1131
  };
1102
1132
  var optimismSupportedTokens = {
@@ -1779,6 +1809,33 @@ var stellarSupportedTokens = {
1779
1809
  chainKey: ChainKeys.STELLAR_MAINNET,
1780
1810
  hubAsset: "0xD749B5FfFED7cEDaa3239abDd16D677179C29AEc",
1781
1811
  vault: SodaTokens.sodaSODA.address
1812
+ },
1813
+ sodaETH: {
1814
+ symbol: "sodaETH",
1815
+ name: "Soda ETH",
1816
+ decimals: 7,
1817
+ address: "CDK5EWVTZLGSLI6D5OSES7XUKWZUKBXDRNOWUVDNPP5RJRP5EYWCW7SL",
1818
+ chainKey: ChainKeys.STELLAR_MAINNET,
1819
+ hubAsset: "0x4985a4b72ac723723e9ae82382d12d77e9a715de",
1820
+ vault: SodaTokens.sodaETH.address
1821
+ },
1822
+ sodaBTC: {
1823
+ symbol: "sodaBTC",
1824
+ name: "Soda BTC",
1825
+ decimals: 7,
1826
+ address: "CD6XWBW74YVFDQQYUM2GALCULMA5MAWGP6NTCWF3ZYXP4Z7MEVY4JKBX",
1827
+ chainKey: ChainKeys.STELLAR_MAINNET,
1828
+ hubAsset: "0xddee01f63c18843e2bac30cb702864d7632c83a2",
1829
+ vault: SodaTokens.sodaBTC.address
1830
+ },
1831
+ sodaBNB: {
1832
+ symbol: "sodaBNB",
1833
+ name: "Soda BNB",
1834
+ decimals: 7,
1835
+ address: "CCXTXZAFLVNTMORVWYB6BGL7YEW3U3ONDAL2FGBRGDUQH7AGANVQPRS6",
1836
+ chainKey: ChainKeys.STELLAR_MAINNET,
1837
+ hubAsset: "0xa10be5f5c2dea7d272555dc73ea2a7317c3c5b63",
1838
+ vault: SodaTokens.sodaBNB.address
1782
1839
  }
1783
1840
  };
1784
1841
  var suiSupportedTokens = {
@@ -2895,6 +2952,21 @@ var spokeChainConfig = {
2895
2952
  assetCode: "SODA",
2896
2953
  contractId: "CAH5LKJC2ZB4RVUVEVL2QWJWNJLHQE2UF767ILLQ5EQ4O3OURR2XIUGM",
2897
2954
  assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
2955
+ },
2956
+ {
2957
+ assetCode: "sodaETH",
2958
+ contractId: "CDK5EWVTZLGSLI6D5OSES7XUKWZUKBXDRNOWUVDNPP5RJRP5EYWCW7SL",
2959
+ assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
2960
+ },
2961
+ {
2962
+ assetCode: "sodaBTC",
2963
+ contractId: "CD6XWBW74YVFDQQYUM2GALCULMA5MAWGP6NTCWF3ZYXP4Z7MEVY4JKBX",
2964
+ assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
2965
+ },
2966
+ {
2967
+ assetCode: "sodaBNB",
2968
+ contractId: "CCXTXZAFLVNTMORVWYB6BGL7YEW3U3ONDAL2FGBRGDUQH7AGANVQPRS6",
2969
+ assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
2898
2970
  }
2899
2971
  ],
2900
2972
  supportedTokens: stellarSupportedTokens,
@@ -3041,7 +3113,8 @@ var hubConfig = {
3041
3113
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.USDT,
3042
3114
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.wS,
3043
3115
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.SODA,
3044
- ...Object.values(SodaTokens),
3116
+ // sodaUSDS is staging-only — see stagingSwapSupportedTokens
3117
+ ...Object.values(SodaTokens).filter((t) => t !== SodaTokens.sodaUSDS),
3045
3118
  ...Object.values(LsodaTokens)
3046
3119
  ]});
3047
3120
 
@@ -3074,6 +3147,20 @@ var hubConfig = {
3074
3147
  fallbackAprPct: 2.4,
3075
3148
  label: "Lido (stETH)"
3076
3149
  }
3150
+ },
3151
+ {
3152
+ name: LsodaTokens.lsodaJITOSOL.symbol,
3153
+ vault: LsodaTokens.lsodaJITOSOL.vault,
3154
+ asset: SodaTokens.sodaJITOSOL.address,
3155
+ // sodaJITOSOL on Sonic
3156
+ borrowToken: SodaTokens.sodaSOL.address,
3157
+ // sodaSOL on Sonic
3158
+ lsdSource: {
3159
+ // DefiLlama pool for Jito's JitoSOL native staking on Solana (project: 'jito-liquid-staking').
3160
+ poolId: "0e7d0722-9054-4907-8593-567b353c0900",
3161
+ fallbackAprPct: 5.5,
3162
+ label: "Jito (JitoSOL)"
3163
+ }
3077
3164
  }
3078
3165
  ];
3079
3166
 
@@ -3505,13 +3592,32 @@ function txResponseToExecuteResponse(txResult) {
3505
3592
  transactionHash: txResult.txHash
3506
3593
  };
3507
3594
  }
3595
+ var COSMWASM_MSG_EXECUTE_CONTRACT_TYPE_URL = "/cosmwasm.wasm.v1.MsgExecuteContract";
3596
+ function decodeInjectiveExecuteMsgs(bodyBytes) {
3597
+ const { messages } = tx_js.TxBody.decode(bodyBytes);
3598
+ return messages.map((message) => {
3599
+ if (message.typeUrl !== COSMWASM_MSG_EXECUTE_CONTRACT_TYPE_URL) {
3600
+ throw new Error(`Injective: cannot rebuild message type ${message.typeUrl} for browser signing.`);
3601
+ }
3602
+ const { sender, contract, msg, funds } = tx_js$1.MsgExecuteContract.decode(message.value);
3603
+ return sdkTs.MsgExecuteContractCompat.fromJSON({
3604
+ contractAddress: contract,
3605
+ sender,
3606
+ msg: JSON.parse(Buffer.from(msg).toString("utf8")),
3607
+ funds: funds.map((coin) => ({ denom: coin.denom, amount: coin.amount }))
3608
+ });
3609
+ });
3610
+ }
3508
3611
  var InjectiveWalletProvider = class extends BaseWalletProvider {
3509
3612
  chainType = "INJECTIVE";
3510
3613
  wallet;
3614
+ /** Network endpoints used to broadcast a signed `TxRaw` via {@link sendTransaction}. */
3615
+ endpoints;
3511
3616
  constructor(config) {
3512
3617
  super(config.defaults);
3513
3618
  if (isBrowserExtensionInjectiveWalletConfig(config)) {
3514
3619
  this.wallet = { msgBroadcaster: config.msgBroadcaster };
3620
+ this.endpoints = config.msgBroadcaster.endpoints;
3515
3621
  return;
3516
3622
  }
3517
3623
  if (isSecretInjectiveWalletConfig(config)) {
@@ -3524,6 +3630,7 @@ var InjectiveWalletProvider = class extends BaseWalletProvider {
3524
3630
  throw new Error("Invalid Secret Injective wallet config");
3525
3631
  }
3526
3632
  this.wallet = { msgBroadcaster: new sdkTs.MsgBroadcasterWithPk({ privateKey, network: config.network }) };
3633
+ this.endpoints = networks.getNetworkEndpoints(config.network);
3527
3634
  return;
3528
3635
  }
3529
3636
  throw new Error("Invalid Injective wallet config");
@@ -3616,6 +3723,53 @@ var InjectiveWalletProvider = class extends BaseWalletProvider {
3616
3723
  }
3617
3724
  return txResponseToExecuteResponse(txResult);
3618
3725
  }
3726
+ /**
3727
+ * Broadcasts an already-signed, proto-encoded Cosmos `TxRaw` via the configured gRPC endpoint.
3728
+ * @param signedTxRaw - The signed transaction, encoded with `TxRaw.encode(...).finish()`.
3729
+ * @returns The transaction hash.
3730
+ * @throws {Error} if the node rejects the transaction (non-zero result code).
3731
+ */
3732
+ async sendTransaction(signedTxRaw) {
3733
+ const txRaw = tx_js.TxRaw.decode(signedTxRaw);
3734
+ const res = await new sdkTs.TxGrpcApi(this.endpoints.grpc).broadcast(txRaw);
3735
+ if (res.code !== 0) {
3736
+ throw new Error(`Injective broadcast failed (code ${res.code}): ${res.rawLog}`);
3737
+ }
3738
+ return res.txHash;
3739
+ }
3740
+ /**
3741
+ * Signs and broadcasts an unsigned `InjectiveRawTransaction` (e.g. from the Swaps API).
3742
+ *
3743
+ * - **PK (secret) mode**: signs the exact unsigned `SignDoc` (`bodyBytes`/`authInfoBytes`) and
3744
+ * broadcasts it as-is, preserving the precise fee/account the Swaps API built.
3745
+ * - **Browser mode (Keplr/Leap/Metamask)**: an EVM wallet can't sign a raw Cosmos `SignDoc`, so we
3746
+ * recover the messages from `bodyBytes` and broadcast them through the fee-delegation path (same as
3747
+ * {@link execute}). The broadcaster builds the wallet-appropriate sign payload (DIRECT for Cosmos
3748
+ * wallets, EIP-712 for Metamask). Trade-off: the broadcaster recomputes gas/fee rather than using
3749
+ * the exact fee in the raw tx; the on-chain effect (the execute message) is unchanged.
3750
+ *
3751
+ * @returns The transaction hash.
3752
+ */
3753
+ async signAndSendTransaction(tx) {
3754
+ const { bodyBytes, authInfoBytes, chainId, accountNumber } = tx.signedDoc;
3755
+ const signerAddress = await this.getWalletAddress();
3756
+ if (tx.from !== signerAddress) {
3757
+ throw new Error(`Injective: cannot sign transaction for ${tx.from} with wallet ${signerAddress}.`);
3758
+ }
3759
+ if (this.wallet.msgBroadcaster instanceof sdkTs.MsgBroadcasterWithPk) {
3760
+ const signDoc = tx_js.SignDoc.fromPartial({ bodyBytes, authInfoBytes, chainId, accountNumber });
3761
+ const signBytes = tx_js.SignDoc.encode(signDoc).finish();
3762
+ const signature = this.wallet.msgBroadcaster.privateKey.sign(Buffer.from(signBytes));
3763
+ const signedTxRaw = tx_js.TxRaw.fromPartial({ bodyBytes, authInfoBytes, signatures: [signature] });
3764
+ return this.sendTransaction(tx_js.TxRaw.encode(signedTxRaw).finish());
3765
+ }
3766
+ const msgs = decodeInjectiveExecuteMsgs(bodyBytes);
3767
+ const txResult = await this.wallet.msgBroadcaster.broadcastWithFeeDelegation({
3768
+ msgs,
3769
+ injectiveAddress: signerAddress
3770
+ });
3771
+ return txResult.txHash;
3772
+ }
3619
3773
  };
3620
3774
  var DEFAULT_CONNECTION_COMMITMENT = "confirmed";
3621
3775
  var DEFAULT_CONFIRM_COMMITMENT = "finalized";
package/dist/index.d.cts CHANGED
@@ -410,6 +410,8 @@ declare function isSecretInjectiveWalletConfig(config: InjectiveWalletConfig): c
410
410
  declare class InjectiveWalletProvider extends BaseWalletProvider<InjectiveWalletDefaults> implements IInjectiveWalletProvider {
411
411
  readonly chainType: "INJECTIVE";
412
412
  wallet: InjectiveWallet;
413
+ /** Network endpoints used to broadcast a signed `TxRaw` via {@link sendTransaction}. */
414
+ private readonly endpoints;
413
415
  constructor(config: InjectiveWalletConfig);
414
416
  /**
415
417
  * Builds a signed-but-unbroadcast Injective transaction for a CosmWasm contract call.
@@ -428,6 +430,27 @@ declare class InjectiveWalletProvider extends BaseWalletProvider<InjectiveWallet
428
430
  getWalletAddress(): Promise<InjectiveEoaAddress>;
429
431
  getWalletPubKey(): Promise<string>;
430
432
  execute(senderAddress: string, contractAddress: string, msg: JsonObject, funds?: InjectiveCoin[], options?: InjectiveWalletDefaults): Promise<InjectiveExecuteResponse>;
433
+ /**
434
+ * Broadcasts an already-signed, proto-encoded Cosmos `TxRaw` via the configured gRPC endpoint.
435
+ * @param signedTxRaw - The signed transaction, encoded with `TxRaw.encode(...).finish()`.
436
+ * @returns The transaction hash.
437
+ * @throws {Error} if the node rejects the transaction (non-zero result code).
438
+ */
439
+ sendTransaction(signedTxRaw: Uint8Array): Promise<string>;
440
+ /**
441
+ * Signs and broadcasts an unsigned `InjectiveRawTransaction` (e.g. from the Swaps API).
442
+ *
443
+ * - **PK (secret) mode**: signs the exact unsigned `SignDoc` (`bodyBytes`/`authInfoBytes`) and
444
+ * broadcasts it as-is, preserving the precise fee/account the Swaps API built.
445
+ * - **Browser mode (Keplr/Leap/Metamask)**: an EVM wallet can't sign a raw Cosmos `SignDoc`, so we
446
+ * recover the messages from `bodyBytes` and broadcast them through the fee-delegation path (same as
447
+ * {@link execute}). The broadcaster builds the wallet-appropriate sign payload (DIRECT for Cosmos
448
+ * wallets, EIP-712 for Metamask). Trade-off: the broadcaster recomputes gas/fee rather than using
449
+ * the exact fee in the raw tx; the on-chain effect (the execute message) is unchanged.
450
+ *
451
+ * @returns The transaction hash.
452
+ */
453
+ signAndSendTransaction(tx: InjectiveRawTransaction): Promise<string>;
431
454
  }
432
455
 
433
456
  interface WalletContextState {
package/dist/index.d.ts CHANGED
@@ -410,6 +410,8 @@ declare function isSecretInjectiveWalletConfig(config: InjectiveWalletConfig): c
410
410
  declare class InjectiveWalletProvider extends BaseWalletProvider<InjectiveWalletDefaults> implements IInjectiveWalletProvider {
411
411
  readonly chainType: "INJECTIVE";
412
412
  wallet: InjectiveWallet;
413
+ /** Network endpoints used to broadcast a signed `TxRaw` via {@link sendTransaction}. */
414
+ private readonly endpoints;
413
415
  constructor(config: InjectiveWalletConfig);
414
416
  /**
415
417
  * Builds a signed-but-unbroadcast Injective transaction for a CosmWasm contract call.
@@ -428,6 +430,27 @@ declare class InjectiveWalletProvider extends BaseWalletProvider<InjectiveWallet
428
430
  getWalletAddress(): Promise<InjectiveEoaAddress>;
429
431
  getWalletPubKey(): Promise<string>;
430
432
  execute(senderAddress: string, contractAddress: string, msg: JsonObject, funds?: InjectiveCoin[], options?: InjectiveWalletDefaults): Promise<InjectiveExecuteResponse>;
433
+ /**
434
+ * Broadcasts an already-signed, proto-encoded Cosmos `TxRaw` via the configured gRPC endpoint.
435
+ * @param signedTxRaw - The signed transaction, encoded with `TxRaw.encode(...).finish()`.
436
+ * @returns The transaction hash.
437
+ * @throws {Error} if the node rejects the transaction (non-zero result code).
438
+ */
439
+ sendTransaction(signedTxRaw: Uint8Array): Promise<string>;
440
+ /**
441
+ * Signs and broadcasts an unsigned `InjectiveRawTransaction` (e.g. from the Swaps API).
442
+ *
443
+ * - **PK (secret) mode**: signs the exact unsigned `SignDoc` (`bodyBytes`/`authInfoBytes`) and
444
+ * broadcasts it as-is, preserving the precise fee/account the Swaps API built.
445
+ * - **Browser mode (Keplr/Leap/Metamask)**: an EVM wallet can't sign a raw Cosmos `SignDoc`, so we
446
+ * recover the messages from `bodyBytes` and broadcast them through the fee-delegation path (same as
447
+ * {@link execute}). The broadcaster builds the wallet-appropriate sign payload (DIRECT for Cosmos
448
+ * wallets, EIP-712 for Metamask). Trade-off: the broadcaster recomputes gas/fee rather than using
449
+ * the exact fee in the raw tx; the on-chain effect (the execute message) is unchanged.
450
+ *
451
+ * @returns The transaction hash.
452
+ */
453
+ signAndSendTransaction(tx: InjectiveRawTransaction): Promise<string>;
431
454
  }
432
455
 
433
456
  interface WalletContextState {
package/dist/index.mjs CHANGED
@@ -6,7 +6,10 @@ import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
6
6
  import { Transaction as Transaction$1 } from '@mysten/sui/transactions';
7
7
  import { signTransaction } from '@mysten/wallet-standard';
8
8
  import * as IconSdkRaw from 'icon-sdk-js';
9
- import { PrivateKey, MsgBroadcasterWithPk, MsgExecuteContract, createTransaction, getInjectiveSignerAddress, MsgExecuteContractCompat } from '@injectivelabs/sdk-ts';
9
+ import { PrivateKey, MsgBroadcasterWithPk, MsgExecuteContract, createTransaction, getInjectiveSignerAddress, MsgExecuteContractCompat, TxGrpcApi } from '@injectivelabs/sdk-ts';
10
+ import { TxRaw, SignDoc, TxBody } from 'cosmjs-types/cosmos/tx/v1beta1/tx.js';
11
+ import { MsgExecuteContract as MsgExecuteContract$1 } from 'cosmjs-types/cosmwasm/wasm/v1/tx.js';
12
+ import { getNetworkEndpoints } from '@injectivelabs/networks';
10
13
  import { getAssociatedTokenAddress } from '@solana/spl-token';
11
14
  import { Keypair, Connection, TransactionMessage, VersionedTransaction, PublicKey, TransactionInstruction } from '@solana/web3.js';
12
15
  import { Networks, Keypair as Keypair$1, Horizon, Transaction } from '@stellar/stellar-sdk';
@@ -341,6 +344,15 @@ var SodaTokens = {
341
344
  chainKey: ChainKeys.SONIC_MAINNET,
342
345
  hubAsset: "0x243b0c26c8b38793908d7C64e8510f21B19B4613",
343
346
  vault: "0x243b0c26c8b38793908d7C64e8510f21B19B4613"
347
+ },
348
+ sodaJITOSOL: {
349
+ symbol: "sodaJITOSOL",
350
+ name: "Soda JITOSOL",
351
+ decimals: 18,
352
+ address: "0xe1bad4400d947Bc4fa66f9c0A143D800002083a0",
353
+ chainKey: ChainKeys.SONIC_MAINNET,
354
+ hubAsset: "0xe1bad4400d947Bc4fa66f9c0A143D800002083a0",
355
+ vault: "0xe1bad4400d947Bc4fa66f9c0A143D800002083a0"
344
356
  }
345
357
  };
346
358
  var LsodaTokens = {
@@ -361,6 +373,15 @@ var LsodaTokens = {
361
373
  chainKey: ChainKeys.SONIC_MAINNET,
362
374
  hubAsset: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a",
363
375
  vault: "0x136E5D1CEC5db1829E24941Eddd9C8640E02Ce7a"
376
+ },
377
+ lsodaJITOSOL: {
378
+ symbol: "lsodaJITOSOL",
379
+ name: "Leveraged Soda JITOSOL",
380
+ decimals: 18,
381
+ address: "0xD7Ae4853E0f93682F5DaA14734F5D18cBa09Bd78",
382
+ chainKey: ChainKeys.SONIC_MAINNET,
383
+ hubAsset: "0xD7Ae4853E0f93682F5DaA14734F5D18cBa09Bd78",
384
+ vault: "0xD7Ae4853E0f93682F5DaA14734F5D18cBa09Bd78"
364
385
  }
365
386
  };
366
387
  var sonicSupportedTokens = {
@@ -638,7 +659,7 @@ var solanaSupportedTokens = {
638
659
  address: "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn",
639
660
  chainKey: ChainKeys.SOLANA_MAINNET,
640
661
  hubAsset: "0x942f89a324d2652e447b9fcf08effc9f9776a680",
641
- vault: "0x942f89a324d2652e447b9fcf08effc9f9776a680"
662
+ vault: SodaTokens.sodaJITOSOL.address
642
663
  },
643
664
  mSOL: {
644
665
  symbol: "mSOL",
@@ -1071,6 +1092,15 @@ var baseSupportedTokens = {
1071
1092
  chainKey: ChainKeys.BASE_MAINNET,
1072
1093
  hubAsset: "0xaa81bb5ba3c972ab53605d3ba7e443a3de6d1cb9",
1073
1094
  vault: "0xaa81bb5ba3c972ab53605d3ba7e443a3de6d1cb9"
1095
+ },
1096
+ AERO: {
1097
+ symbol: "AERO",
1098
+ name: "Aerodrome Finance",
1099
+ decimals: 18,
1100
+ address: "0x940181a94A35A4569e4529A3CDfB74e38FD98631",
1101
+ chainKey: ChainKeys.BASE_MAINNET,
1102
+ hubAsset: "0x348e086ab6f424dfc575a325c28624ed23973173",
1103
+ vault: "0x348e086ab6f424dfc575a325c28624ed23973173"
1074
1104
  }
1075
1105
  };
1076
1106
  var optimismSupportedTokens = {
@@ -1753,6 +1783,33 @@ var stellarSupportedTokens = {
1753
1783
  chainKey: ChainKeys.STELLAR_MAINNET,
1754
1784
  hubAsset: "0xD749B5FfFED7cEDaa3239abDd16D677179C29AEc",
1755
1785
  vault: SodaTokens.sodaSODA.address
1786
+ },
1787
+ sodaETH: {
1788
+ symbol: "sodaETH",
1789
+ name: "Soda ETH",
1790
+ decimals: 7,
1791
+ address: "CDK5EWVTZLGSLI6D5OSES7XUKWZUKBXDRNOWUVDNPP5RJRP5EYWCW7SL",
1792
+ chainKey: ChainKeys.STELLAR_MAINNET,
1793
+ hubAsset: "0x4985a4b72ac723723e9ae82382d12d77e9a715de",
1794
+ vault: SodaTokens.sodaETH.address
1795
+ },
1796
+ sodaBTC: {
1797
+ symbol: "sodaBTC",
1798
+ name: "Soda BTC",
1799
+ decimals: 7,
1800
+ address: "CD6XWBW74YVFDQQYUM2GALCULMA5MAWGP6NTCWF3ZYXP4Z7MEVY4JKBX",
1801
+ chainKey: ChainKeys.STELLAR_MAINNET,
1802
+ hubAsset: "0xddee01f63c18843e2bac30cb702864d7632c83a2",
1803
+ vault: SodaTokens.sodaBTC.address
1804
+ },
1805
+ sodaBNB: {
1806
+ symbol: "sodaBNB",
1807
+ name: "Soda BNB",
1808
+ decimals: 7,
1809
+ address: "CCXTXZAFLVNTMORVWYB6BGL7YEW3U3ONDAL2FGBRGDUQH7AGANVQPRS6",
1810
+ chainKey: ChainKeys.STELLAR_MAINNET,
1811
+ hubAsset: "0xa10be5f5c2dea7d272555dc73ea2a7317c3c5b63",
1812
+ vault: SodaTokens.sodaBNB.address
1756
1813
  }
1757
1814
  };
1758
1815
  var suiSupportedTokens = {
@@ -2869,6 +2926,21 @@ var spokeChainConfig = {
2869
2926
  assetCode: "SODA",
2870
2927
  contractId: "CAH5LKJC2ZB4RVUVEVL2QWJWNJLHQE2UF767ILLQ5EQ4O3OURR2XIUGM",
2871
2928
  assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
2929
+ },
2930
+ {
2931
+ assetCode: "sodaETH",
2932
+ contractId: "CDK5EWVTZLGSLI6D5OSES7XUKWZUKBXDRNOWUVDNPP5RJRP5EYWCW7SL",
2933
+ assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
2934
+ },
2935
+ {
2936
+ assetCode: "sodaBTC",
2937
+ contractId: "CD6XWBW74YVFDQQYUM2GALCULMA5MAWGP6NTCWF3ZYXP4Z7MEVY4JKBX",
2938
+ assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
2939
+ },
2940
+ {
2941
+ assetCode: "sodaBNB",
2942
+ contractId: "CCXTXZAFLVNTMORVWYB6BGL7YEW3U3ONDAL2FGBRGDUQH7AGANVQPRS6",
2943
+ assetIssuer: "GDYUTHY75A7WUZJQDPOP66FB32BOYGZRXHWTWO4Q6LQTANT5X3V5HNFA"
2872
2944
  }
2873
2945
  ],
2874
2946
  supportedTokens: stellarSupportedTokens,
@@ -3015,7 +3087,8 @@ var hubConfig = {
3015
3087
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.USDT,
3016
3088
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.wS,
3017
3089
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.SODA,
3018
- ...Object.values(SodaTokens),
3090
+ // sodaUSDS is staging-only — see stagingSwapSupportedTokens
3091
+ ...Object.values(SodaTokens).filter((t) => t !== SodaTokens.sodaUSDS),
3019
3092
  ...Object.values(LsodaTokens)
3020
3093
  ]});
3021
3094
 
@@ -3048,6 +3121,20 @@ var hubConfig = {
3048
3121
  fallbackAprPct: 2.4,
3049
3122
  label: "Lido (stETH)"
3050
3123
  }
3124
+ },
3125
+ {
3126
+ name: LsodaTokens.lsodaJITOSOL.symbol,
3127
+ vault: LsodaTokens.lsodaJITOSOL.vault,
3128
+ asset: SodaTokens.sodaJITOSOL.address,
3129
+ // sodaJITOSOL on Sonic
3130
+ borrowToken: SodaTokens.sodaSOL.address,
3131
+ // sodaSOL on Sonic
3132
+ lsdSource: {
3133
+ // DefiLlama pool for Jito's JitoSOL native staking on Solana (project: 'jito-liquid-staking').
3134
+ poolId: "0e7d0722-9054-4907-8593-567b353c0900",
3135
+ fallbackAprPct: 5.5,
3136
+ label: "Jito (JitoSOL)"
3137
+ }
3051
3138
  }
3052
3139
  ];
3053
3140
 
@@ -3479,13 +3566,32 @@ function txResponseToExecuteResponse(txResult) {
3479
3566
  transactionHash: txResult.txHash
3480
3567
  };
3481
3568
  }
3569
+ var COSMWASM_MSG_EXECUTE_CONTRACT_TYPE_URL = "/cosmwasm.wasm.v1.MsgExecuteContract";
3570
+ function decodeInjectiveExecuteMsgs(bodyBytes) {
3571
+ const { messages } = TxBody.decode(bodyBytes);
3572
+ return messages.map((message) => {
3573
+ if (message.typeUrl !== COSMWASM_MSG_EXECUTE_CONTRACT_TYPE_URL) {
3574
+ throw new Error(`Injective: cannot rebuild message type ${message.typeUrl} for browser signing.`);
3575
+ }
3576
+ const { sender, contract, msg, funds } = MsgExecuteContract$1.decode(message.value);
3577
+ return MsgExecuteContractCompat.fromJSON({
3578
+ contractAddress: contract,
3579
+ sender,
3580
+ msg: JSON.parse(Buffer.from(msg).toString("utf8")),
3581
+ funds: funds.map((coin) => ({ denom: coin.denom, amount: coin.amount }))
3582
+ });
3583
+ });
3584
+ }
3482
3585
  var InjectiveWalletProvider = class extends BaseWalletProvider {
3483
3586
  chainType = "INJECTIVE";
3484
3587
  wallet;
3588
+ /** Network endpoints used to broadcast a signed `TxRaw` via {@link sendTransaction}. */
3589
+ endpoints;
3485
3590
  constructor(config) {
3486
3591
  super(config.defaults);
3487
3592
  if (isBrowserExtensionInjectiveWalletConfig(config)) {
3488
3593
  this.wallet = { msgBroadcaster: config.msgBroadcaster };
3594
+ this.endpoints = config.msgBroadcaster.endpoints;
3489
3595
  return;
3490
3596
  }
3491
3597
  if (isSecretInjectiveWalletConfig(config)) {
@@ -3498,6 +3604,7 @@ var InjectiveWalletProvider = class extends BaseWalletProvider {
3498
3604
  throw new Error("Invalid Secret Injective wallet config");
3499
3605
  }
3500
3606
  this.wallet = { msgBroadcaster: new MsgBroadcasterWithPk({ privateKey, network: config.network }) };
3607
+ this.endpoints = getNetworkEndpoints(config.network);
3501
3608
  return;
3502
3609
  }
3503
3610
  throw new Error("Invalid Injective wallet config");
@@ -3590,6 +3697,53 @@ var InjectiveWalletProvider = class extends BaseWalletProvider {
3590
3697
  }
3591
3698
  return txResponseToExecuteResponse(txResult);
3592
3699
  }
3700
+ /**
3701
+ * Broadcasts an already-signed, proto-encoded Cosmos `TxRaw` via the configured gRPC endpoint.
3702
+ * @param signedTxRaw - The signed transaction, encoded with `TxRaw.encode(...).finish()`.
3703
+ * @returns The transaction hash.
3704
+ * @throws {Error} if the node rejects the transaction (non-zero result code).
3705
+ */
3706
+ async sendTransaction(signedTxRaw) {
3707
+ const txRaw = TxRaw.decode(signedTxRaw);
3708
+ const res = await new TxGrpcApi(this.endpoints.grpc).broadcast(txRaw);
3709
+ if (res.code !== 0) {
3710
+ throw new Error(`Injective broadcast failed (code ${res.code}): ${res.rawLog}`);
3711
+ }
3712
+ return res.txHash;
3713
+ }
3714
+ /**
3715
+ * Signs and broadcasts an unsigned `InjectiveRawTransaction` (e.g. from the Swaps API).
3716
+ *
3717
+ * - **PK (secret) mode**: signs the exact unsigned `SignDoc` (`bodyBytes`/`authInfoBytes`) and
3718
+ * broadcasts it as-is, preserving the precise fee/account the Swaps API built.
3719
+ * - **Browser mode (Keplr/Leap/Metamask)**: an EVM wallet can't sign a raw Cosmos `SignDoc`, so we
3720
+ * recover the messages from `bodyBytes` and broadcast them through the fee-delegation path (same as
3721
+ * {@link execute}). The broadcaster builds the wallet-appropriate sign payload (DIRECT for Cosmos
3722
+ * wallets, EIP-712 for Metamask). Trade-off: the broadcaster recomputes gas/fee rather than using
3723
+ * the exact fee in the raw tx; the on-chain effect (the execute message) is unchanged.
3724
+ *
3725
+ * @returns The transaction hash.
3726
+ */
3727
+ async signAndSendTransaction(tx) {
3728
+ const { bodyBytes, authInfoBytes, chainId, accountNumber } = tx.signedDoc;
3729
+ const signerAddress = await this.getWalletAddress();
3730
+ if (tx.from !== signerAddress) {
3731
+ throw new Error(`Injective: cannot sign transaction for ${tx.from} with wallet ${signerAddress}.`);
3732
+ }
3733
+ if (this.wallet.msgBroadcaster instanceof MsgBroadcasterWithPk) {
3734
+ const signDoc = SignDoc.fromPartial({ bodyBytes, authInfoBytes, chainId, accountNumber });
3735
+ const signBytes = SignDoc.encode(signDoc).finish();
3736
+ const signature = this.wallet.msgBroadcaster.privateKey.sign(Buffer.from(signBytes));
3737
+ const signedTxRaw = TxRaw.fromPartial({ bodyBytes, authInfoBytes, signatures: [signature] });
3738
+ return this.sendTransaction(TxRaw.encode(signedTxRaw).finish());
3739
+ }
3740
+ const msgs = decodeInjectiveExecuteMsgs(bodyBytes);
3741
+ const txResult = await this.wallet.msgBroadcaster.broadcastWithFeeDelegation({
3742
+ msgs,
3743
+ injectiveAddress: signerAddress
3744
+ });
3745
+ return txResult.txHash;
3746
+ }
3593
3747
  };
3594
3748
  var DEFAULT_CONNECTION_COMMITMENT = "confirmed";
3595
3749
  var DEFAULT_CONFIRM_COMMITMENT = "finalized";
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "2.0.0-rc.13",
7
+ "version": "2.0.0-rc.15",
8
8
  "license": "MIT",
9
9
  "description": "Sodax Wallet SDK Core",
10
10
  "keywords": [
@@ -61,13 +61,14 @@
61
61
  "@stellar/stellar-sdk": "15.1.0",
62
62
  "bip322-js": "^3.0.0",
63
63
  "bitcoinjs-lib": "^6.1.5",
64
+ "cosmjs-types": "0.9.0",
64
65
  "ecpair": "^2.0.1",
65
66
  "icon-sdk-js": "1.5.3",
66
67
  "near-api-js": "7.2.0",
67
68
  "secp256k1": "^5.0.1",
68
69
  "viem": "2.29.2",
69
- "@sodax/libs": "2.0.0-rc.13",
70
- "@sodax/types": "2.0.0-rc.13"
70
+ "@sodax/libs": "2.0.0-rc.15",
71
+ "@sodax/types": "2.0.0-rc.15"
71
72
  },
72
73
  "devDependencies": {
73
74
  "@arethetypeswrong/cli": "0.17.4",
@@ -78,7 +79,7 @@
78
79
  "knip": "5.30.5",
79
80
  "tsup": "8.5.0",
80
81
  "typescript": "5.5.4",
81
- "vitest": "3.2.4"
82
+ "vitest": "3.2.6"
82
83
  },
83
84
  "scripts": {
84
85
  "build": "tsup",