@sodax/sdk 0.0.1-rc.4 → 0.0.1-rc.40
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/LICENSE +1 -1
- package/README.md +176 -11
- package/dist/index.cjs +18608 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +11181 -0
- package/dist/index.d.ts +11180 -9
- package/dist/index.mjs +18339 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +32 -32
- package/dist/abis/asset-manager.abi.d.ts +0 -418
- package/dist/abis/asset-manager.abi.d.ts.map +0 -1
- package/dist/abis/asset-manager.abi.js +0 -542
- package/dist/abis/asset-manager.abi.js.map +0 -1
- package/dist/abis/connection.abi.d.ts +0 -72
- package/dist/abis/connection.abi.d.ts.map +0 -1
- package/dist/abis/connection.abi.js +0 -92
- package/dist/abis/connection.abi.js.map +0 -1
- package/dist/abis/erc20.abi.d.ts +0 -236
- package/dist/abis/erc20.abi.d.ts.map +0 -1
- package/dist/abis/erc20.abi.js +0 -311
- package/dist/abis/erc20.abi.js.map +0 -1
- package/dist/abis/index.d.ts +0 -10
- package/dist/abis/index.d.ts.map +0 -1
- package/dist/abis/index.js +0 -10
- package/dist/abis/index.js.map +0 -1
- package/dist/abis/intents.abi.d.ts +0 -901
- package/dist/abis/intents.abi.d.ts.map +0 -1
- package/dist/abis/intents.abi.js +0 -1158
- package/dist/abis/intents.abi.js.map +0 -1
- package/dist/abis/pool.abi.d.ts +0 -626
- package/dist/abis/pool.abi.d.ts.map +0 -1
- package/dist/abis/pool.abi.js +0 -812
- package/dist/abis/pool.abi.js.map +0 -1
- package/dist/abis/spokeAssetManager.abi.d.ts +0 -169
- package/dist/abis/spokeAssetManager.abi.d.ts.map +0 -1
- package/dist/abis/spokeAssetManager.abi.js +0 -217
- package/dist/abis/spokeAssetManager.abi.js.map +0 -1
- package/dist/abis/uiPoolData.abi.d.ts +0 -369
- package/dist/abis/uiPoolData.abi.d.ts.map +0 -1
- package/dist/abis/uiPoolData.abi.js +0 -476
- package/dist/abis/uiPoolData.abi.js.map +0 -1
- package/dist/abis/vaultToken.abi.d.ts +0 -816
- package/dist/abis/vaultToken.abi.d.ts.map +0 -1
- package/dist/abis/vaultToken.abi.js +0 -1062
- package/dist/abis/vaultToken.abi.js.map +0 -1
- package/dist/abis/walletFactory.abi.d.ts +0 -20
- package/dist/abis/walletFactory.abi.d.ts.map +0 -1
- package/dist/abis/walletFactory.abi.js +0 -27
- package/dist/abis/walletFactory.abi.js.map +0 -1
- package/dist/constants.d.ts +0 -550
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -1196
- package/dist/constants.js.map +0 -1
- package/dist/constants.test.d.ts +0 -2
- package/dist/constants.test.d.ts.map +0 -1
- package/dist/constants.test.js +0 -129
- package/dist/constants.test.js.map +0 -1
- package/dist/entities/Providers.d.ts +0 -54
- package/dist/entities/Providers.d.ts.map +0 -1
- package/dist/entities/Providers.js +0 -51
- package/dist/entities/Providers.js.map +0 -1
- package/dist/entities/Sodax.d.ts +0 -23
- package/dist/entities/Sodax.d.ts.map +0 -1
- package/dist/entities/Sodax.js +0 -29
- package/dist/entities/Sodax.js.map +0 -1
- package/dist/entities/Sodax.test.d.ts +0 -2
- package/dist/entities/Sodax.test.d.ts.map +0 -1
- package/dist/entities/Sodax.test.js +0 -392
- package/dist/entities/Sodax.test.js.map +0 -1
- package/dist/entities/cosmos/CW20Token.d.ts +0 -39
- package/dist/entities/cosmos/CW20Token.d.ts.map +0 -1
- package/dist/entities/cosmos/CW20Token.js +0 -65
- package/dist/entities/cosmos/CW20Token.js.map +0 -1
- package/dist/entities/cosmos/CWSpokeProvider.d.ts +0 -92
- package/dist/entities/cosmos/CWSpokeProvider.d.ts.map +0 -1
- package/dist/entities/cosmos/CWSpokeProvider.js +0 -143
- package/dist/entities/cosmos/CWSpokeProvider.js.map +0 -1
- package/dist/entities/cosmos/CosmosWalletProvider.d.ts +0 -28
- package/dist/entities/cosmos/CosmosWalletProvider.d.ts.map +0 -1
- package/dist/entities/cosmos/CosmosWalletProvider.js +0 -102
- package/dist/entities/cosmos/CosmosWalletProvider.js.map +0 -1
- package/dist/entities/cosmos/InjectiveWalletProvider.d.ts +0 -25
- package/dist/entities/cosmos/InjectiveWalletProvider.d.ts.map +0 -1
- package/dist/entities/cosmos/InjectiveWalletProvider.js +0 -76
- package/dist/entities/cosmos/InjectiveWalletProvider.js.map +0 -1
- package/dist/entities/icon/HanaWalletConnector.d.ts +0 -36
- package/dist/entities/icon/HanaWalletConnector.d.ts.map +0 -1
- package/dist/entities/icon/HanaWalletConnector.js +0 -92
- package/dist/entities/icon/HanaWalletConnector.js.map +0 -1
- package/dist/entities/icon/IconSpokeProvider.d.ts +0 -10
- package/dist/entities/icon/IconSpokeProvider.d.ts.map +0 -1
- package/dist/entities/icon/IconSpokeProvider.js +0 -12
- package/dist/entities/icon/IconSpokeProvider.js.map +0 -1
- package/dist/entities/icon/index.d.ts +0 -4
- package/dist/entities/icon/index.d.ts.map +0 -1
- package/dist/entities/icon/index.js +0 -4
- package/dist/entities/icon/index.js.map +0 -1
- package/dist/entities/icon/utils.d.ts +0 -3
- package/dist/entities/icon/utils.d.ts.map +0 -1
- package/dist/entities/icon/utils.js +0 -4
- package/dist/entities/icon/utils.js.map +0 -1
- package/dist/entities/index.d.ts +0 -7
- package/dist/entities/index.d.ts.map +0 -1
- package/dist/entities/index.js +0 -7
- package/dist/entities/index.js.map +0 -1
- package/dist/entities/solana/Configs.d.ts +0 -10
- package/dist/entities/solana/Configs.d.ts.map +0 -1
- package/dist/entities/solana/Configs.js +0 -50
- package/dist/entities/solana/Configs.js.map +0 -1
- package/dist/entities/solana/SolanaSpokeProvider.d.ts +0 -9
- package/dist/entities/solana/SolanaSpokeProvider.d.ts.map +0 -1
- package/dist/entities/solana/SolanaSpokeProvider.js +0 -9
- package/dist/entities/solana/SolanaSpokeProvider.js.map +0 -1
- package/dist/entities/solana/SolanaWalletProvider.d.ts +0 -20
- package/dist/entities/solana/SolanaWalletProvider.d.ts.map +0 -1
- package/dist/entities/solana/SolanaWalletProvider.js +0 -53
- package/dist/entities/solana/SolanaWalletProvider.js.map +0 -1
- package/dist/entities/solana/index.d.ts +0 -4
- package/dist/entities/solana/index.d.ts.map +0 -1
- package/dist/entities/solana/index.js +0 -4
- package/dist/entities/solana/index.js.map +0 -1
- package/dist/entities/solana/pda/pda.d.ts +0 -45
- package/dist/entities/solana/pda/pda.d.ts.map +0 -1
- package/dist/entities/solana/pda/pda.js +0 -44
- package/dist/entities/solana/pda/pda.js.map +0 -1
- package/dist/entities/solana/types/asset_manager.d.ts +0 -919
- package/dist/entities/solana/types/asset_manager.d.ts.map +0 -1
- package/dist/entities/solana/types/asset_manager.js +0 -2
- package/dist/entities/solana/types/asset_manager.js.map +0 -1
- package/dist/entities/solana/types/connection.d.ts +0 -446
- package/dist/entities/solana/types/connection.d.ts.map +0 -1
- package/dist/entities/solana/types/connection.js +0 -2
- package/dist/entities/solana/types/connection.js.map +0 -1
- package/dist/entities/solana/types/rate_limit_contract.d.ts +0 -348
- package/dist/entities/solana/types/rate_limit_contract.d.ts.map +0 -1
- package/dist/entities/solana/types/rate_limit_contract.js +0 -2
- package/dist/entities/solana/types/rate_limit_contract.js.map +0 -1
- package/dist/entities/solana/utils/utils.d.ts +0 -6
- package/dist/entities/solana/utils/utils.d.ts.map +0 -1
- package/dist/entities/solana/utils/utils.js +0 -18
- package/dist/entities/solana/utils/utils.js.map +0 -1
- package/dist/entities/stellar/StellarSpokeProvider.d.ts +0 -17
- package/dist/entities/stellar/StellarSpokeProvider.d.ts.map +0 -1
- package/dist/entities/stellar/StellarSpokeProvider.js +0 -125
- package/dist/entities/stellar/StellarSpokeProvider.js.map +0 -1
- package/dist/entities/sui/SuiSpokeProvider.d.ts +0 -35
- package/dist/entities/sui/SuiSpokeProvider.d.ts.map +0 -1
- package/dist/entities/sui/SuiSpokeProvider.js +0 -145
- package/dist/entities/sui/SuiSpokeProvider.js.map +0 -1
- package/dist/errors.d.ts +0 -2
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -2
- package/dist/errors.js.map +0 -1
- package/dist/guards.d.ts +0 -25
- package/dist/guards.d.ts.map +0 -1
- package/dist/guards.js +0 -110
- package/dist/guards.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -10
- package/dist/index.js.map +0 -1
- package/dist/services/hub/EvmAssetManagerService.d.ts +0 -61
- package/dist/services/hub/EvmAssetManagerService.d.ts.map +0 -1
- package/dist/services/hub/EvmAssetManagerService.js +0 -103
- package/dist/services/hub/EvmAssetManagerService.js.map +0 -1
- package/dist/services/hub/EvmVaultTokenService.d.ts +0 -81
- package/dist/services/hub/EvmVaultTokenService.d.ts.map +0 -1
- package/dist/services/hub/EvmVaultTokenService.js +0 -161
- package/dist/services/hub/EvmVaultTokenService.js.map +0 -1
- package/dist/services/hub/EvmWalletAbstraction.d.ts +0 -9
- package/dist/services/hub/EvmWalletAbstraction.d.ts.map +0 -1
- package/dist/services/hub/EvmWalletAbstraction.js +0 -14
- package/dist/services/hub/EvmWalletAbstraction.js.map +0 -1
- package/dist/services/hub/index.d.ts +0 -4
- package/dist/services/hub/index.d.ts.map +0 -1
- package/dist/services/hub/index.js +0 -4
- package/dist/services/hub/index.js.map +0 -1
- package/dist/services/index.d.ts +0 -7
- package/dist/services/index.d.ts.map +0 -1
- package/dist/services/index.js +0 -7
- package/dist/services/index.js.map +0 -1
- package/dist/services/intentRelay/IntentRelayApiService.d.ts +0 -112
- package/dist/services/intentRelay/IntentRelayApiService.d.ts.map +0 -1
- package/dist/services/intentRelay/IntentRelayApiService.js +0 -160
- package/dist/services/intentRelay/IntentRelayApiService.js.map +0 -1
- package/dist/services/intentRelay/IntentRelayApiService.test.d.ts +0 -2
- package/dist/services/intentRelay/IntentRelayApiService.test.d.ts.map +0 -1
- package/dist/services/intentRelay/IntentRelayApiService.test.js +0 -134
- package/dist/services/intentRelay/IntentRelayApiService.test.js.map +0 -1
- package/dist/services/intentRelay/index.d.ts +0 -2
- package/dist/services/intentRelay/index.d.ts.map +0 -1
- package/dist/services/intentRelay/index.js +0 -2
- package/dist/services/intentRelay/index.js.map +0 -1
- package/dist/services/moneyMarket/MoneyMarketService.d.ts +0 -525
- package/dist/services/moneyMarket/MoneyMarketService.d.ts.map +0 -1
- package/dist/services/moneyMarket/MoneyMarketService.js +0 -814
- package/dist/services/moneyMarket/MoneyMarketService.js.map +0 -1
- package/dist/services/moneyMarket/MoneyMarketService.test.d.ts +0 -2
- package/dist/services/moneyMarket/MoneyMarketService.test.d.ts.map +0 -1
- package/dist/services/moneyMarket/MoneyMarketService.test.js +0 -262
- package/dist/services/moneyMarket/MoneyMarketService.test.js.map +0 -1
- package/dist/services/moneyMarket/index.d.ts +0 -2
- package/dist/services/moneyMarket/index.d.ts.map +0 -1
- package/dist/services/moneyMarket/index.js +0 -2
- package/dist/services/moneyMarket/index.js.map +0 -1
- package/dist/services/shared/Erc20Service.d.ts +0 -42
- package/dist/services/shared/Erc20Service.d.ts.map +0 -1
- package/dist/services/shared/Erc20Service.js +0 -108
- package/dist/services/shared/Erc20Service.js.map +0 -1
- package/dist/services/shared/index.d.ts +0 -2
- package/dist/services/shared/index.d.ts.map +0 -1
- package/dist/services/shared/index.js +0 -2
- package/dist/services/shared/index.js.map +0 -1
- package/dist/services/solver/EvmSolverService.d.ts +0 -125
- package/dist/services/solver/EvmSolverService.d.ts.map +0 -1
- package/dist/services/solver/EvmSolverService.js +0 -166
- package/dist/services/solver/EvmSolverService.js.map +0 -1
- package/dist/services/solver/SolverApiService.d.ts +0 -40
- package/dist/services/solver/SolverApiService.d.ts.map +0 -1
- package/dist/services/solver/SolverApiService.js +0 -157
- package/dist/services/solver/SolverApiService.js.map +0 -1
- package/dist/services/solver/SolverApiService.test.d.ts +0 -2
- package/dist/services/solver/SolverApiService.test.d.ts.map +0 -1
- package/dist/services/solver/SolverApiService.test.js +0 -181
- package/dist/services/solver/SolverApiService.test.js.map +0 -1
- package/dist/services/solver/SolverService.d.ts +0 -295
- package/dist/services/solver/SolverService.d.ts.map +0 -1
- package/dist/services/solver/SolverService.js +0 -429
- package/dist/services/solver/SolverService.js.map +0 -1
- package/dist/services/solver/SolverService.test.d.ts +0 -2
- package/dist/services/solver/SolverService.test.d.ts.map +0 -1
- package/dist/services/solver/SolverService.test.js +0 -439
- package/dist/services/solver/SolverService.test.js.map +0 -1
- package/dist/services/solver/index.d.ts +0 -3
- package/dist/services/solver/index.d.ts.map +0 -1
- package/dist/services/solver/index.js +0 -3
- package/dist/services/solver/index.js.map +0 -1
- package/dist/services/spoke/CWSpokeService.d.ts +0 -67
- package/dist/services/spoke/CWSpokeService.d.ts.map +0 -1
- package/dist/services/spoke/CWSpokeService.js +0 -75
- package/dist/services/spoke/CWSpokeService.js.map +0 -1
- package/dist/services/spoke/EvmSpokeService.d.ts +0 -62
- package/dist/services/spoke/EvmSpokeService.d.ts.map +0 -1
- package/dist/services/spoke/EvmSpokeService.js +0 -120
- package/dist/services/spoke/EvmSpokeService.js.map +0 -1
- package/dist/services/spoke/IconSpokeService.d.ts +0 -56
- package/dist/services/spoke/IconSpokeService.d.ts.map +0 -1
- package/dist/services/spoke/IconSpokeService.js +0 -124
- package/dist/services/spoke/IconSpokeService.js.map +0 -1
- package/dist/services/spoke/SolanaSpokeService.d.ts +0 -46
- package/dist/services/spoke/SolanaSpokeService.d.ts.map +0 -1
- package/dist/services/spoke/SolanaSpokeService.js +0 -170
- package/dist/services/spoke/SolanaSpokeService.js.map +0 -1
- package/dist/services/spoke/SpokeService.d.ts +0 -34
- package/dist/services/spoke/SpokeService.d.ts.map +0 -1
- package/dist/services/spoke/SpokeService.js +0 -102
- package/dist/services/spoke/SpokeService.js.map +0 -1
- package/dist/services/spoke/StellarSpokeService.d.ts +0 -35
- package/dist/services/spoke/StellarSpokeService.d.ts.map +0 -1
- package/dist/services/spoke/StellarSpokeService.js +0 -39
- package/dist/services/spoke/StellarSpokeService.js.map +0 -1
- package/dist/services/spoke/SuiSpokeService.d.ts +0 -69
- package/dist/services/spoke/SuiSpokeService.d.ts.map +0 -1
- package/dist/services/spoke/SuiSpokeService.js +0 -74
- package/dist/services/spoke/SuiSpokeService.js.map +0 -1
- package/dist/services/spoke/index.d.ts +0 -3
- package/dist/services/spoke/index.d.ts.map +0 -1
- package/dist/services/spoke/index.js +0 -3
- package/dist/services/spoke/index.js.map +0 -1
- package/dist/tests/services/hub/EvmAssetManagerService.test.d.ts +0 -2
- package/dist/tests/services/hub/EvmAssetManagerService.test.d.ts.map +0 -1
- package/dist/tests/services/hub/EvmAssetManagerService.test.js +0 -138
- package/dist/tests/services/hub/EvmAssetManagerService.test.js.map +0 -1
- package/dist/tests/services/hub/EvmMoneyMarketService.test.d.ts +0 -2
- package/dist/tests/services/hub/EvmMoneyMarketService.test.d.ts.map +0 -1
- package/dist/tests/services/hub/EvmMoneyMarketService.test.js +0 -121
- package/dist/tests/services/hub/EvmMoneyMarketService.test.js.map +0 -1
- package/dist/tests/services/hub/EvmVaultTokenService.test.d.ts +0 -2
- package/dist/tests/services/hub/EvmVaultTokenService.test.d.ts.map +0 -1
- package/dist/tests/services/hub/EvmVaultTokenService.test.js +0 -98
- package/dist/tests/services/hub/EvmVaultTokenService.test.js.map +0 -1
- package/dist/tests/services/spoke/EvmSpokeService.test.d.ts +0 -2
- package/dist/tests/services/spoke/EvmSpokeService.test.d.ts.map +0 -1
- package/dist/tests/services/spoke/EvmSpokeService.test.js +0 -198
- package/dist/tests/services/spoke/EvmSpokeService.test.js.map +0 -1
- package/dist/types.d.ts +0 -352
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -30
- package/dist/types.js.map +0 -1
- package/dist/utils/evm-utils.d.ts +0 -10
- package/dist/utils/evm-utils.d.ts.map +0 -1
- package/dist/utils/evm-utils.js +0 -15
- package/dist/utils/evm-utils.js.map +0 -1
- package/dist/utils/index.d.ts +0 -3
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -3
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/shared-utils.d.ts +0 -20
- package/dist/utils/shared-utils.d.ts.map +0 -1
- package/dist/utils/shared-utils.js +0 -69
- package/dist/utils/shared-utils.js.map +0 -1
- package/dist/utils/shared-utils.test.d.ts +0 -2
- package/dist/utils/shared-utils.test.d.ts.map +0 -1
- package/dist/utils/shared-utils.test.js +0 -63
- package/dist/utils/shared-utils.test.js.map +0 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -2,13 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
The Sodax SDK provides a comprehensive interface for interacting with the Sodax protocol, enabling cross-chain swaps and money market operations.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
### Swaps (Solver / Intents) [📖](./docs/SOLVER.md)
|
|
8
|
+
- EVM (Arbitrum, Avalanche, Base, BSC, Optimism, Polygon, Sonic, HyperEVM❌, Lightlink) ✅
|
|
9
|
+
- Sui ✅
|
|
10
|
+
- Stellar ✅
|
|
11
|
+
- ICON ✅
|
|
12
|
+
- Solana ✅
|
|
13
|
+
- Injective ✅
|
|
14
|
+
|
|
15
|
+
### Lend and Borrow (Money Market) [📖](./docs/MONEY_MARKET.md)
|
|
16
|
+
- EVM (Arbitrum, Avalanche, Base, BSC, Optimism, Polygon, Sonic, HyperEVM, Lightlink) ✅
|
|
17
|
+
- Sui ✅
|
|
18
|
+
- Stellar ✅
|
|
19
|
+
- ICON ✅
|
|
20
|
+
- Solana ✅
|
|
21
|
+
- Injective ✅
|
|
22
|
+
|
|
23
|
+
### Cross-chain bridging (Bridge) [📖](./docs/BRIDGE.md)
|
|
24
|
+
- EVM (Arbitrum, Avalanche, Base, BSC, Optimism, Polygon, Sonic, HyperEVM, Lightlink) ✅
|
|
25
|
+
- Sui ✅
|
|
26
|
+
- Stellar ✅
|
|
27
|
+
- ICON ✅
|
|
28
|
+
- Solana ✅
|
|
29
|
+
- Injective ✅
|
|
30
|
+
|
|
31
|
+
### Migration [📖](./docs/MIGRATION.md)
|
|
32
|
+
- Legacy bnUSD <> New bnUSD:
|
|
33
|
+
- ICX <> SODA
|
|
34
|
+
- BALN <> SODA
|
|
6
35
|
|
|
7
|
-
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Using npm
|
|
40
|
+
npm install @sodax/sdk
|
|
8
41
|
|
|
9
|
-
|
|
42
|
+
# Using yarn
|
|
43
|
+
yarn add @sodax/sdk
|
|
10
44
|
|
|
11
|
-
|
|
45
|
+
# Using pnpm
|
|
46
|
+
pnpm add @sodax/sdk
|
|
47
|
+
```
|
|
12
48
|
|
|
13
49
|
### Local Installation
|
|
14
50
|
|
|
@@ -36,8 +72,8 @@ How to setup local development
|
|
|
36
72
|
## Intent Solver Endpoints
|
|
37
73
|
|
|
38
74
|
Current Intent Solver API endpoints:
|
|
39
|
-
- **Production (mainnet)**: "
|
|
40
|
-
- **Staging** (mainnet): "https://
|
|
75
|
+
- **Production (mainnet)**: "https://sodax-solver-staging.iconblockchain.xyz"
|
|
76
|
+
- **Staging** (mainnet): "https://sodax-solver-staging.iconblockchain.xyz"
|
|
41
77
|
|
|
42
78
|
**Note** Staging endpoint contains features to be potentially released and is subject to frequent change!
|
|
43
79
|
|
|
@@ -109,7 +145,7 @@ const partnerFeeAmount = {
|
|
|
109
145
|
// example of custom solver config
|
|
110
146
|
const customSolverConfig = {
|
|
111
147
|
intentsContract: '0x6382D6ccD780758C5e8A6123c33ee8F4472F96ef',
|
|
112
|
-
solverApiEndpoint: 'https://
|
|
148
|
+
solverApiEndpoint: 'https://sodax-solver-staging.iconblockchain.xyz',
|
|
113
149
|
partnerFee: partnerFeePercentage, // or partnerFeeAmount
|
|
114
150
|
} satisfies SolverConfigParams;
|
|
115
151
|
|
|
@@ -149,6 +185,8 @@ SDK includes predefined configurations of supported chains, tokens and other rel
|
|
|
149
185
|
|
|
150
186
|
**NOTE** you should generally only use `spokeChains` configuration to retrieve all supported chains and then invoke per spoke chain based configurations. If you are using hub configurations you should know what you are doing.
|
|
151
187
|
|
|
188
|
+
Please refer to [SDK constants.ts](https://github.com/icon-project/sodax-frontend/blob/main/packages/sdk/src/constants.ts) for more.
|
|
189
|
+
|
|
152
190
|
```typescript
|
|
153
191
|
import {
|
|
154
192
|
getHubChainConfig,
|
|
@@ -190,35 +228,162 @@ const supportedMoneyMarketTokens: readonly Token[] = getSupportedMoneyMarketToke
|
|
|
190
228
|
|
|
191
229
|
Sodax SDK does not force the usage of a specific wallet or library, but requires client to provide implementation of `IWalletProvider` interfaces (e.g. for EVM chains `IEvmWalletProvider` has to be implemented).
|
|
192
230
|
|
|
193
|
-
As part of Sodax suite,
|
|
231
|
+
As part of Sodax suite, Wallet SDK is also going to be provided as one example wallet provider implementation. You are free to choose between using our Wallet SDK or implementing your own wallet connectivity for each chain.
|
|
232
|
+
|
|
233
|
+
- Supported Wallet Provider Interface (`IWalletProvider`)
|
|
234
|
+
- `IEvmWalletProvider`: EVM (Arbitrum, Avalanche, Base, BSC, Optimism, Polygon) ✅
|
|
235
|
+
- `ISuiWalletProvider`: Sui ✅
|
|
236
|
+
- `IIconWalletProvider`: ICON ✅
|
|
237
|
+
- `IStellarWalletProvider`: Stellar ✅
|
|
238
|
+
- `ISolanaWalletProvider`: Solana ✅
|
|
239
|
+
- `IInjectiveWalletProvider`: Injective ✅
|
|
194
240
|
|
|
195
241
|
### Initialising Spoke Provider
|
|
196
242
|
|
|
197
|
-
Spoke provider is a main instance used to interact with Sodax features because it contains all the relevant information we need to successfully execute features. You should generally establish SpokeProvider instances for each chain user connects wallet to.
|
|
243
|
+
Spoke provider is a main instance used to interact with Sodax features because it contains all the relevant information we need to successfully execute features. You should generally establish SpokeProvider instances for each chain (e.g. evm, sui, etc..) user connects wallet to.
|
|
198
244
|
|
|
199
245
|
Spoke is simply a chain you are connecting to and SpokeProvider is a container of relevant wallet provider and chain configuration.
|
|
200
246
|
|
|
247
|
+
**IMPORTANT**: Sonic Spoke Provider must be instantiated as `SonicSpokeProvider` instance even though it is of `EVM` chain type. This is due to the fact that Sonic chain is a hub chain of Sodax and needs special handling under the hood.
|
|
248
|
+
|
|
201
249
|
EVM Provider example:
|
|
202
250
|
|
|
203
251
|
```typescript
|
|
204
252
|
import { EvmProvider, EvmHubProvider, EvmSpokeProvider, AVALANCHE_MAINNET_CHAIN_ID, SONIC_MAINNET_CHAIN_ID } from "@sodax/sdk"
|
|
205
253
|
|
|
206
|
-
const evmWalletProvider: IEvmWalletProvider = // injected by
|
|
254
|
+
const evmWalletProvider: IEvmWalletProvider = // injected by Wallet SDK or your own implementation
|
|
207
255
|
|
|
208
256
|
// spoke provider represents connection to a specific chain, should be instantiated for each supported chain when user connects wallet
|
|
209
257
|
const bscSpokeProvider: EvmSpokeProvider = new EvmSpokeProvider(
|
|
210
258
|
evmWalletProvider, // user connected wallet
|
|
211
|
-
spokeChainConfig[BSC_MAINNET_CHAIN_ID]
|
|
259
|
+
spokeChainConfig[BSC_MAINNET_CHAIN_ID], // connected chain config
|
|
212
260
|
);
|
|
213
261
|
```
|
|
214
262
|
|
|
263
|
+
### Estimate Gas for Raw Transactions
|
|
264
|
+
|
|
265
|
+
The `estimateGas` function allows you to estimate the gas cost for raw transactions before executing them. This is particularly useful for all Sodax operations (swaps, money market operations, approvals) to provide users with accurate gas estimates.
|
|
266
|
+
|
|
267
|
+
The function is available on all service classes:
|
|
268
|
+
- `SolverService.estimateGas()` - for solver/intent operations (reachable through `sodax.solver`)
|
|
269
|
+
- `MoneyMarketService.estimateGas()` - for money market operations (reachable through `sodax.moneyMarket`)
|
|
270
|
+
- `SpokeService.estimateGas()` - for general spoke chain operations
|
|
271
|
+
|
|
272
|
+
```typescript
|
|
273
|
+
import {
|
|
274
|
+
SolverService,
|
|
275
|
+
MoneyMarketService,
|
|
276
|
+
SpokeService,
|
|
277
|
+
MoneyMarketSupplyParams
|
|
278
|
+
} from "@sodax/sdk";
|
|
279
|
+
|
|
280
|
+
// Example: Estimate gas for a solver swap transaction
|
|
281
|
+
const createIntentResult = await sodax.solver.createIntent(
|
|
282
|
+
createIntentParams,
|
|
283
|
+
bscSpokeProvider,
|
|
284
|
+
partnerFeeAmount,
|
|
285
|
+
true, // true = get raw transaction
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
if (createIntentResult.ok) {
|
|
289
|
+
const [rawTx, intent] = createIntentResult.value;
|
|
290
|
+
|
|
291
|
+
// Estimate gas for the raw transaction
|
|
292
|
+
const gasEstimate = await SolverService.estimateGas(rawTx, bscSpokeProvider);
|
|
293
|
+
|
|
294
|
+
if (gasEstimate.ok) {
|
|
295
|
+
console.log('Estimated gas for swap:', gasEstimate.value);
|
|
296
|
+
} else {
|
|
297
|
+
console.error('Failed to estimate gas for swap:', gasEstimate.error);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Example: Estimate gas for a money market supply transaction
|
|
302
|
+
const supplyResult = await sodax.moneyMarket.createSupplyIntent(
|
|
303
|
+
supplyParams,
|
|
304
|
+
bscSpokeProvider,
|
|
305
|
+
true, // true = get raw transaction
|
|
306
|
+
);
|
|
307
|
+
|
|
308
|
+
if (supplyResult.ok) {
|
|
309
|
+
const rawTx = supplyResult.value;
|
|
310
|
+
|
|
311
|
+
// Estimate gas for the raw transaction
|
|
312
|
+
const gasEstimate = await MoneyMarketService.estimateGas(rawTx, bscSpokeProvider);
|
|
313
|
+
|
|
314
|
+
if (gasEstimate.ok) {
|
|
315
|
+
console.log('Estimated gas for supply:', gasEstimate.value);
|
|
316
|
+
} else {
|
|
317
|
+
console.error('Failed to estimate gas for supply:', gasEstimate.error);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// Example: Estimate gas for an approval transaction
|
|
322
|
+
const approveResult = await sodax.solver.approve(
|
|
323
|
+
tokenAddress,
|
|
324
|
+
amount,
|
|
325
|
+
bscSpokeProvider,
|
|
326
|
+
true // true = get raw transaction
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
if (approveResult.ok) {
|
|
330
|
+
const rawTx = approveResult.value;
|
|
331
|
+
|
|
332
|
+
// Estimate gas for the approval transaction
|
|
333
|
+
const gasEstimate = await SpokeService.estimateGas(rawTx, bscSpokeProvider);
|
|
334
|
+
|
|
335
|
+
if (gasEstimate.ok) {
|
|
336
|
+
console.log('Estimated gas for approval:', gasEstimate.value);
|
|
337
|
+
} else {
|
|
338
|
+
console.error('Failed to estimate gas for approval:', gasEstimate.error);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
|
|
215
343
|
### Accessing Sodax Features
|
|
216
344
|
|
|
217
345
|
Sodax feature set currently contain:
|
|
218
346
|
- Solver: used for intent based swaps. Please find documentation for Solver part of the SDK in [SOLVER.md](./docs/SOLVER.md)
|
|
219
347
|
- Money Market: used for lending and borowing. Please find documentation for Solver part of the SDK in [MONEY_MARKET.md](./docs/MONEY_MARKET.md)
|
|
348
|
+
- Bridge: provides functionality to bridge tokens between different blockchain chains [BRIDGE.md](./docs/BRIDGE.md)
|
|
220
349
|
|
|
221
350
|
## Intent Relay API
|
|
222
351
|
|
|
223
352
|
Intent relay is internally used to relay transaction information from one chain to another.
|
|
224
353
|
Sodax SDK abstracts the heavy lifting of using the relay, but you can find documentation for Intent Relay API in [INTENT_RELAY_API.md](./docs/INTENT_RELAY_API.md) in case you want to explore it.
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
## Contributing
|
|
357
|
+
|
|
358
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
359
|
+
|
|
360
|
+
## Development
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
# Install dependencies
|
|
364
|
+
pnpm install
|
|
365
|
+
|
|
366
|
+
# Build the package
|
|
367
|
+
pnpm build
|
|
368
|
+
|
|
369
|
+
# Run in development mode
|
|
370
|
+
pnpm dev
|
|
371
|
+
|
|
372
|
+
# Run type checking
|
|
373
|
+
pnpm checkTs
|
|
374
|
+
|
|
375
|
+
# Format code
|
|
376
|
+
pnpm pretty
|
|
377
|
+
|
|
378
|
+
# Lint code
|
|
379
|
+
pnpm lint
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
## License
|
|
383
|
+
|
|
384
|
+
[MIT](LICENSE)
|
|
385
|
+
|
|
386
|
+
## Support
|
|
387
|
+
|
|
388
|
+
- [GitHub Issues](https://github.com/icon-project/sodax-frontend/issues)
|
|
389
|
+
- [Discord Community](https://discord.gg/xM2Nh4S6vN)
|