@sodax/sdk 0.0.1-rc.3 → 0.0.1-rc.31
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 +164 -11
- package/dist/index.cjs +16936 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +9866 -0
- package/dist/index.d.ts +9865 -9
- package/dist/index.mjs +16684 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +31 -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 -1154
- 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 -323
- package/dist/services/moneyMarket/MoneyMarketService.d.ts.map +0 -1
- package/dist/services/moneyMarket/MoneyMarketService.js +0 -612
- 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 -196
- package/dist/services/solver/SolverService.d.ts.map +0 -1
- package/dist/services/solver/SolverService.js +0 -329
- 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,38 @@
|
|
|
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) ✅
|
|
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) ✅
|
|
17
|
+
- Sui ✅
|
|
18
|
+
- Stellar ✅
|
|
19
|
+
- ICON ✅
|
|
20
|
+
- Solana ✅
|
|
21
|
+
- Injective ✅
|
|
22
|
+
|
|
23
|
+
### Migration [📖](./docs/MIGRATION.md)
|
|
6
24
|
|
|
7
|
-
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Using npm
|
|
29
|
+
npm install @sodax/sdk
|
|
8
30
|
|
|
9
|
-
|
|
31
|
+
# Using yarn
|
|
32
|
+
yarn add @sodax/sdk
|
|
10
33
|
|
|
11
|
-
|
|
34
|
+
# Using pnpm
|
|
35
|
+
pnpm add @sodax/sdk
|
|
36
|
+
```
|
|
12
37
|
|
|
13
38
|
### Local Installation
|
|
14
39
|
|
|
@@ -36,8 +61,8 @@ How to setup local development
|
|
|
36
61
|
## Intent Solver Endpoints
|
|
37
62
|
|
|
38
63
|
Current Intent Solver API endpoints:
|
|
39
|
-
- **Production (mainnet)**: "
|
|
40
|
-
- **Staging** (mainnet): "https://
|
|
64
|
+
- **Production (mainnet)**: "https://sodax-solver-staging.iconblockchain.xyz"
|
|
65
|
+
- **Staging** (mainnet): "https://sodax-solver-staging.iconblockchain.xyz"
|
|
41
66
|
|
|
42
67
|
**Note** Staging endpoint contains features to be potentially released and is subject to frequent change!
|
|
43
68
|
|
|
@@ -109,7 +134,7 @@ const partnerFeeAmount = {
|
|
|
109
134
|
// example of custom solver config
|
|
110
135
|
const customSolverConfig = {
|
|
111
136
|
intentsContract: '0x6382D6ccD780758C5e8A6123c33ee8F4472F96ef',
|
|
112
|
-
solverApiEndpoint: 'https://
|
|
137
|
+
solverApiEndpoint: 'https://sodax-solver-staging.iconblockchain.xyz',
|
|
113
138
|
partnerFee: partnerFeePercentage, // or partnerFeeAmount
|
|
114
139
|
} satisfies SolverConfigParams;
|
|
115
140
|
|
|
@@ -149,6 +174,8 @@ SDK includes predefined configurations of supported chains, tokens and other rel
|
|
|
149
174
|
|
|
150
175
|
**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
176
|
|
|
177
|
+
Please refer to [SDK constants.ts](https://github.com/icon-project/sodax-frontend/blob/main/packages/sdk/src/constants.ts) for more.
|
|
178
|
+
|
|
152
179
|
```typescript
|
|
153
180
|
import {
|
|
154
181
|
getHubChainConfig,
|
|
@@ -190,28 +217,118 @@ const supportedMoneyMarketTokens: readonly Token[] = getSupportedMoneyMarketToke
|
|
|
190
217
|
|
|
191
218
|
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
219
|
|
|
193
|
-
As part of Sodax suite,
|
|
220
|
+
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.
|
|
221
|
+
|
|
222
|
+
- Supported Wallet Provider Interface (`IWalletProvider`)
|
|
223
|
+
- `IEvmWalletProvider`: EVM (Arbitrum, Avalanche, Base, BSC, Optimism, Polygon) ✅
|
|
224
|
+
- `ISuiWalletProvider`: Sui ✅
|
|
225
|
+
- `IIconWalletProvider`: ICON ✅
|
|
226
|
+
- `IStellarWalletProvider`: Stellar ✅
|
|
227
|
+
- `ISolanaWalletProvider`: Solana ✅
|
|
228
|
+
- `IInjectiveWalletProvider`: Injective ✅
|
|
194
229
|
|
|
195
230
|
### Initialising Spoke Provider
|
|
196
231
|
|
|
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.
|
|
232
|
+
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
233
|
|
|
199
234
|
Spoke is simply a chain you are connecting to and SpokeProvider is a container of relevant wallet provider and chain configuration.
|
|
200
235
|
|
|
236
|
+
**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.
|
|
237
|
+
|
|
201
238
|
EVM Provider example:
|
|
202
239
|
|
|
203
240
|
```typescript
|
|
204
241
|
import { EvmProvider, EvmHubProvider, EvmSpokeProvider, AVALANCHE_MAINNET_CHAIN_ID, SONIC_MAINNET_CHAIN_ID } from "@sodax/sdk"
|
|
205
242
|
|
|
206
|
-
const evmWalletProvider: IEvmWalletProvider = // injected by
|
|
243
|
+
const evmWalletProvider: IEvmWalletProvider = // injected by Wallet SDK or your own implementation
|
|
207
244
|
|
|
208
245
|
// spoke provider represents connection to a specific chain, should be instantiated for each supported chain when user connects wallet
|
|
209
246
|
const bscSpokeProvider: EvmSpokeProvider = new EvmSpokeProvider(
|
|
210
247
|
evmWalletProvider, // user connected wallet
|
|
211
|
-
spokeChainConfig[BSC_MAINNET_CHAIN_ID]
|
|
248
|
+
spokeChainConfig[BSC_MAINNET_CHAIN_ID], // connected chain config
|
|
212
249
|
);
|
|
213
250
|
```
|
|
214
251
|
|
|
252
|
+
### Estimate Gas for Raw Transactions
|
|
253
|
+
|
|
254
|
+
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.
|
|
255
|
+
|
|
256
|
+
The function is available on all service classes:
|
|
257
|
+
- `SolverService.estimateGas()` - for solver/intent operations (reachable through `sodax.solver`)
|
|
258
|
+
- `MoneyMarketService.estimateGas()` - for money market operations (reachable through `sodax.moneyMarket`)
|
|
259
|
+
- `SpokeService.estimateGas()` - for general spoke chain operations
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
import {
|
|
263
|
+
SolverService,
|
|
264
|
+
MoneyMarketService,
|
|
265
|
+
SpokeService,
|
|
266
|
+
MoneyMarketSupplyParams
|
|
267
|
+
} from "@sodax/sdk";
|
|
268
|
+
|
|
269
|
+
// Example: Estimate gas for a solver swap transaction
|
|
270
|
+
const createIntentResult = await sodax.solver.createIntent(
|
|
271
|
+
createIntentParams,
|
|
272
|
+
bscSpokeProvider,
|
|
273
|
+
partnerFeeAmount,
|
|
274
|
+
true, // true = get raw transaction
|
|
275
|
+
);
|
|
276
|
+
|
|
277
|
+
if (createIntentResult.ok) {
|
|
278
|
+
const [rawTx, intent] = createIntentResult.value;
|
|
279
|
+
|
|
280
|
+
// Estimate gas for the raw transaction
|
|
281
|
+
const gasEstimate = await SolverService.estimateGas(rawTx, bscSpokeProvider);
|
|
282
|
+
|
|
283
|
+
if (gasEstimate.ok) {
|
|
284
|
+
console.log('Estimated gas for swap:', gasEstimate.value);
|
|
285
|
+
} else {
|
|
286
|
+
console.error('Failed to estimate gas for swap:', gasEstimate.error);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Example: Estimate gas for a money market supply transaction
|
|
291
|
+
const supplyResult = await sodax.moneyMarket.createSupplyIntent(
|
|
292
|
+
supplyParams,
|
|
293
|
+
bscSpokeProvider,
|
|
294
|
+
true, // true = get raw transaction
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
if (supplyResult.ok) {
|
|
298
|
+
const rawTx = supplyResult.value;
|
|
299
|
+
|
|
300
|
+
// Estimate gas for the raw transaction
|
|
301
|
+
const gasEstimate = await MoneyMarketService.estimateGas(rawTx, bscSpokeProvider);
|
|
302
|
+
|
|
303
|
+
if (gasEstimate.ok) {
|
|
304
|
+
console.log('Estimated gas for supply:', gasEstimate.value);
|
|
305
|
+
} else {
|
|
306
|
+
console.error('Failed to estimate gas for supply:', gasEstimate.error);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Example: Estimate gas for an approval transaction
|
|
311
|
+
const approveResult = await sodax.solver.approve(
|
|
312
|
+
tokenAddress,
|
|
313
|
+
amount,
|
|
314
|
+
bscSpokeProvider,
|
|
315
|
+
true // true = get raw transaction
|
|
316
|
+
);
|
|
317
|
+
|
|
318
|
+
if (approveResult.ok) {
|
|
319
|
+
const rawTx = approveResult.value;
|
|
320
|
+
|
|
321
|
+
// Estimate gas for the approval transaction
|
|
322
|
+
const gasEstimate = await SpokeService.estimateGas(rawTx, bscSpokeProvider);
|
|
323
|
+
|
|
324
|
+
if (gasEstimate.ok) {
|
|
325
|
+
console.log('Estimated gas for approval:', gasEstimate.value);
|
|
326
|
+
} else {
|
|
327
|
+
console.error('Failed to estimate gas for approval:', gasEstimate.error);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
215
332
|
### Accessing Sodax Features
|
|
216
333
|
|
|
217
334
|
Sodax feature set currently contain:
|
|
@@ -222,3 +339,39 @@ Sodax feature set currently contain:
|
|
|
222
339
|
|
|
223
340
|
Intent relay is internally used to relay transaction information from one chain to another.
|
|
224
341
|
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.
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
## Contributing
|
|
345
|
+
|
|
346
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
347
|
+
|
|
348
|
+
## Development
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
# Install dependencies
|
|
352
|
+
pnpm install
|
|
353
|
+
|
|
354
|
+
# Build the package
|
|
355
|
+
pnpm build
|
|
356
|
+
|
|
357
|
+
# Run in development mode
|
|
358
|
+
pnpm dev
|
|
359
|
+
|
|
360
|
+
# Run type checking
|
|
361
|
+
pnpm checkTs
|
|
362
|
+
|
|
363
|
+
# Format code
|
|
364
|
+
pnpm pretty
|
|
365
|
+
|
|
366
|
+
# Lint code
|
|
367
|
+
pnpm lint
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
## License
|
|
371
|
+
|
|
372
|
+
[MIT](LICENSE)
|
|
373
|
+
|
|
374
|
+
## Support
|
|
375
|
+
|
|
376
|
+
- [GitHub Issues](https://github.com/icon-project/sodax-frontend/issues)
|
|
377
|
+
- [Discord Community](https://discord.gg/xM2Nh4S6vN)
|