@sodax/sdk 0.0.1-rc.2 → 0.0.1-rc.4
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/README.md +2 -0
- package/dist/constants.d.ts +17 -32
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +67 -67
- package/dist/constants.js.map +1 -1
- package/dist/constants.test.js +3 -2
- package/dist/constants.test.js.map +1 -1
- package/dist/entities/Providers.d.ts +3 -10
- package/dist/entities/Providers.d.ts.map +1 -1
- package/dist/entities/Providers.js +2 -2
- package/dist/entities/Providers.js.map +1 -1
- package/dist/entities/Sodax.test.js +120 -104
- package/dist/entities/Sodax.test.js.map +1 -1
- package/dist/entities/cosmos/CWSpokeProvider.d.ts +2 -1
- package/dist/entities/cosmos/CWSpokeProvider.d.ts.map +1 -1
- package/dist/entities/cosmos/CWSpokeProvider.js.map +1 -1
- package/dist/entities/cosmos/CosmosWalletProvider.d.ts +2 -2
- package/dist/entities/cosmos/CosmosWalletProvider.d.ts.map +1 -1
- package/dist/entities/cosmos/CosmosWalletProvider.js +4 -4
- package/dist/entities/cosmos/CosmosWalletProvider.js.map +1 -1
- package/dist/entities/cosmos/InjectiveWalletProvider.d.ts +2 -2
- package/dist/entities/cosmos/InjectiveWalletProvider.d.ts.map +1 -1
- package/dist/entities/cosmos/InjectiveWalletProvider.js +4 -4
- package/dist/entities/cosmos/InjectiveWalletProvider.js.map +1 -1
- package/dist/entities/icon/IconSpokeProvider.d.ts +5 -3
- package/dist/entities/icon/IconSpokeProvider.d.ts.map +1 -1
- package/dist/entities/icon/IconSpokeProvider.js +4 -1
- package/dist/entities/icon/IconSpokeProvider.js.map +1 -1
- package/dist/entities/icon/index.d.ts +0 -1
- package/dist/entities/icon/index.d.ts.map +1 -1
- package/dist/entities/icon/index.js +0 -1
- package/dist/entities/icon/index.js.map +1 -1
- package/dist/entities/index.d.ts +0 -1
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +0 -1
- package/dist/entities/index.js.map +1 -1
- package/dist/entities/solana/SolanaWalletProvider.d.ts +3 -3
- package/dist/entities/solana/SolanaWalletProvider.d.ts.map +1 -1
- package/dist/entities/solana/SolanaWalletProvider.js +3 -3
- package/dist/entities/solana/SolanaWalletProvider.js.map +1 -1
- package/dist/entities/solana/utils/utils.js +2 -1
- package/dist/entities/solana/utils/utils.js.map +1 -1
- package/dist/entities/stellar/StellarSpokeProvider.d.ts +4 -11
- package/dist/entities/stellar/StellarSpokeProvider.d.ts.map +1 -1
- package/dist/entities/stellar/StellarSpokeProvider.js +27 -31
- package/dist/entities/stellar/StellarSpokeProvider.js.map +1 -1
- package/dist/entities/sui/SuiSpokeProvider.d.ts +6 -5
- package/dist/entities/sui/SuiSpokeProvider.d.ts.map +1 -1
- package/dist/entities/sui/SuiSpokeProvider.js +9 -7
- package/dist/entities/sui/SuiSpokeProvider.js.map +1 -1
- package/dist/guards.js +8 -8
- package/dist/guards.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/services/hub/EvmAssetManagerService.d.ts +2 -1
- package/dist/services/hub/EvmAssetManagerService.d.ts.map +1 -1
- package/dist/services/hub/EvmAssetManagerService.js.map +1 -1
- package/dist/services/hub/EvmVaultTokenService.d.ts.map +1 -1
- package/dist/services/hub/EvmVaultTokenService.js +4 -2
- package/dist/services/hub/EvmVaultTokenService.js.map +1 -1
- package/dist/services/hub/EvmWalletAbstraction.d.ts +2 -1
- package/dist/services/hub/EvmWalletAbstraction.d.ts.map +1 -1
- package/dist/services/hub/EvmWalletAbstraction.js.map +1 -1
- package/dist/services/intentRelay/IntentRelayApiService.d.ts +2 -1
- package/dist/services/intentRelay/IntentRelayApiService.d.ts.map +1 -1
- package/dist/services/intentRelay/IntentRelayApiService.js.map +1 -1
- package/dist/services/moneyMarket/MoneyMarketService.d.ts +267 -63
- package/dist/services/moneyMarket/MoneyMarketService.d.ts.map +1 -1
- package/dist/services/moneyMarket/MoneyMarketService.js +283 -73
- package/dist/services/moneyMarket/MoneyMarketService.js.map +1 -1
- package/dist/services/moneyMarket/MoneyMarketService.test.js +36 -19
- package/dist/services/moneyMarket/MoneyMarketService.test.js.map +1 -1
- package/dist/services/shared/Erc20Service.d.ts +6 -5
- package/dist/services/shared/Erc20Service.d.ts.map +1 -1
- package/dist/services/shared/Erc20Service.js +7 -6
- package/dist/services/shared/Erc20Service.js.map +1 -1
- package/dist/services/solver/SolverApiService.test.js +2 -1
- package/dist/services/solver/SolverApiService.test.js.map +1 -1
- package/dist/services/solver/SolverService.d.ts +138 -37
- package/dist/services/solver/SolverService.d.ts.map +1 -1
- package/dist/services/solver/SolverService.js +146 -41
- package/dist/services/solver/SolverService.js.map +1 -1
- package/dist/services/solver/SolverService.test.js +89 -143
- package/dist/services/solver/SolverService.test.js.map +1 -1
- package/dist/services/spoke/CWSpokeService.d.ts +1 -1
- package/dist/services/spoke/CWSpokeService.d.ts.map +1 -1
- package/dist/services/spoke/CWSpokeService.js +2 -2
- package/dist/services/spoke/CWSpokeService.js.map +1 -1
- package/dist/services/spoke/EvmSpokeService.d.ts +3 -2
- package/dist/services/spoke/EvmSpokeService.d.ts.map +1 -1
- package/dist/services/spoke/EvmSpokeService.js +4 -2
- package/dist/services/spoke/EvmSpokeService.js.map +1 -1
- package/dist/services/spoke/IconSpokeService.d.ts +4 -3
- package/dist/services/spoke/IconSpokeService.d.ts.map +1 -1
- package/dist/services/spoke/IconSpokeService.js +28 -15
- package/dist/services/spoke/IconSpokeService.js.map +1 -1
- package/dist/services/spoke/SolanaSpokeService.d.ts +3 -2
- package/dist/services/spoke/SolanaSpokeService.d.ts.map +1 -1
- package/dist/services/spoke/SolanaSpokeService.js.map +1 -1
- package/dist/services/spoke/SpokeService.d.ts +2 -1
- package/dist/services/spoke/SpokeService.d.ts.map +1 -1
- package/dist/services/spoke/SpokeService.js.map +1 -1
- package/dist/services/spoke/StellarSpokeService.d.ts +1 -1
- package/dist/services/spoke/StellarSpokeService.d.ts.map +1 -1
- package/dist/services/spoke/SuiSpokeService.d.ts +1 -1
- package/dist/services/spoke/SuiSpokeService.d.ts.map +1 -1
- package/dist/tests/services/hub/EvmAssetManagerService.test.js +45 -30
- package/dist/tests/services/hub/EvmAssetManagerService.test.js.map +1 -1
- package/dist/tests/services/spoke/EvmSpokeService.test.js +7 -6
- package/dist/tests/services/spoke/EvmSpokeService.test.js.map +1 -1
- package/dist/types.d.ts +28 -71
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/evm-utils.d.ts +2 -2
- package/dist/utils/evm-utils.d.ts.map +1 -1
- package/dist/utils/shared-utils.d.ts +2 -1
- package/dist/utils/shared-utils.d.ts.map +1 -1
- package/dist/utils/shared-utils.js +3 -0
- package/dist/utils/shared-utils.js.map +1 -1
- package/package.json +3 -3
- package/dist/entities/icon/IconWalletProvider.d.ts +0 -12
- package/dist/entities/icon/IconWalletProvider.d.ts.map +0 -1
- package/dist/entities/icon/IconWalletProvider.js +0 -34
- package/dist/entities/icon/IconWalletProvider.js.map +0 -1
- package/dist/entities/sui/SuiWalletProvider.d.ts +0 -15
- package/dist/entities/sui/SuiWalletProvider.d.ts.map +0 -1
- package/dist/entities/sui/SuiWalletProvider.js +0 -43
- package/dist/entities/sui/SuiWalletProvider.js.map +0 -1
- package/dist/interfaces.d.ts +0 -8
- package/dist/interfaces.d.ts.map +0 -1
- package/dist/interfaces.js +0 -2
- package/dist/interfaces.js.map +0 -1
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Address, type Hex, type PublicClient } from 'viem';
|
|
2
2
|
import type { EvmHubProvider } from '../../entities/Providers.js';
|
|
3
|
-
import type { AssetInfo, EvmContractCall
|
|
3
|
+
import type { AssetInfo, EvmContractCall } from '../../types.js';
|
|
4
|
+
import type { SpokeChainId } from '@sodax/types';
|
|
4
5
|
export type EvmDepositToDataParams = {
|
|
5
6
|
token: Hex | string;
|
|
6
7
|
to: Address;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EvmAssetManagerService.d.ts","sourceRoot":"","sources":["../../../src/services/hub/EvmAssetManagerService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,YAAY,EAAsB,MAAM,MAAM,CAAC;AAGrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"EvmAssetManagerService.d.ts","sourceRoot":"","sources":["../../../src/services/hub/EvmAssetManagerService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,YAAY,EAAsB,MAAM,MAAM,CAAC;AAGrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAIjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,GAAG,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,EAAE,GAAG,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,GAAG,CAAC;IACR,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,qBAAa,sBAAsB;IACjC,OAAO;IAEP;;;;;;OAMG;WACiB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC;IAcjH;;;;;;;OAOG;WACW,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,eAAe;IAYjH;;;;;;OAMG;WACW,aAAa,CAAC,MAAM,EAAE,sBAAsB,EAAE,YAAY,EAAE,YAAY,GAAG,GAAG;IAmB5F;;;;;;;OAOG;WACW,iBAAiB,CAC7B,MAAM,EAAE,0BAA0B,EAClC,WAAW,EAAE,cAAc,EAC3B,YAAY,EAAE,YAAY,GACzB,GAAG;IAsBN;;;;;;;OAOG;IACG,eAAe,CACnB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,OAAO,CAAC;CAQpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EvmAssetManagerService.js","sourceRoot":"","sources":["../../../src/services/hub/EvmAssetManagerService.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,kBAAkB,EAAE,MAAM,MAAM,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"EvmAssetManagerService.js","sourceRoot":"","sources":["../../../src/services/hub/EvmAssetManagerService.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,kBAAkB,EAAE,MAAM,MAAM,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EA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ACd,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,kBAAkB,GAC3B,OAAO,CAAC,IAAI,CAAC;IAchB;;;;;;OAMG;IACH,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe;IAYrF;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe;IAYtF;;;;;OAKG;WACW,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAOjF;;;;;OAKG;WACW,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAMlF"}
|
|
@@ -64,8 +64,9 @@ export class EvmVaultTokenService {
|
|
|
64
64
|
* @returns Transaction hash
|
|
65
65
|
*/
|
|
66
66
|
static async deposit(vault, token, amount, walletProvider) {
|
|
67
|
+
const from = (await walletProvider.getWalletAddress());
|
|
67
68
|
return walletProvider.sendTransaction({
|
|
68
|
-
from
|
|
69
|
+
from,
|
|
69
70
|
to: vault,
|
|
70
71
|
value: 0n,
|
|
71
72
|
data: encodeFunctionData({
|
|
@@ -84,8 +85,9 @@ export class EvmVaultTokenService {
|
|
|
84
85
|
* @returns Transaction hash
|
|
85
86
|
*/
|
|
86
87
|
static async withdraw(vault, token, amount, provider) {
|
|
88
|
+
const from = (await provider.getWalletAddress());
|
|
87
89
|
return provider.sendTransaction({
|
|
88
|
-
from
|
|
90
|
+
from,
|
|
89
91
|
to: vault,
|
|
90
92
|
value: 0n,
|
|
91
93
|
data: encodeFunctionData({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EvmVaultTokenService.js","sourceRoot":"","sources":["../../../src/services/hub/EvmVaultTokenService.ts"],"names":[],"mappings":"AA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AC;IACJ,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,KAAK,CAAC,OAAO,CACzB,KAAc,EACd,KAAc,EACd,MAAc,EACd,cAAkC;QAElC,
|
|
1
|
+
{"version":3,"file":"EvmVaultTokenService.js","sourceRoot":"","sources":["../../../src/services/hub/EvmVaultTokenService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAC1G,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpD,MAAM,OAAO,oBAAoB;IAC/B,gBAAuB,CAAC;IAExB;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,YAAY,CAC9B,KAAc,EACd,KAAc,EACd,YAAyC;QAEzC,MAAM,CAAC,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,CAAC,GAAG,MAAM,YAAY,CAAC,YAAY,CAAC;YACrG,OAAO,EAAE,KAAK;YACd,GAAG,EAAE,aAAa;YAClB,YAAY,EAAE,WAAW;YACzB,IAAI,EAAE,CAAC,KAAK,CAAC;SACd,CAAC,CAAC;QAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;IAC1E,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAClC,KAAc,EACd,YAAyC;QAEzC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,MAAM,YAAY,CAAC,YAAY,CAAC;YACzD,OAAO,EAAE,KAAK;YACd,GAAG,EAAE,aAAa;YAClB,YAAY,EAAE,kBAAkB;YAChC,IAAI,EAAE,EAAE;SACT,CAAC,CAAC;QAEH,OAAO;YACL,MAAM;YACN,QAAQ;SACT,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,eAAe,CACnB,KAAc,EACd,YAAyC;QAMzC,MAAM,CAAC,MAAM,EAAE,KAAK,E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
|
-
import { type Hex
|
|
3
|
+
import { type Hex } from '../../index.js';
|
|
4
|
+
import type { SpokeChainId } from '@sodax/types';
|
|
4
5
|
export declare class EvmWalletAbstraction {
|
|
5
6
|
private constructor();
|
|
6
7
|
static getUserHubWalletAddress(chainId: SpokeChainId, address: Hex, hubProvider: EvmHubProvider): Promise<Address>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EvmWalletAbstraction.d.ts","sourceRoot":"","sources":["../../../src/services/hub/EvmWalletAbstraction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"EvmWalletAbstraction.d.ts","sourceRoot":"","sources":["../../../src/services/hub/EvmWalletAbstraction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,KAAK,GAAG,EAAyB,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,qBAAa,oBAAoB;IAC/B,OAAO;WAEa,uBAAuB,CACzC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,GAAG,EACZ,WAAW,EAAE,cAAc,GAC1B,OAAO,CAAC,OAAO,CAAC;CAQpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EvmWalletAbstraction.js","sourceRoot":"","sources":["../../../src/services/hub/EvmWalletAbstraction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,
|
|
1
|
+
{"version":3,"file":"EvmWalletAbstraction.js","sourceRoot":"","sources":["../../../src/services/hub/EvmWalletAbstraction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAY,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGjE,MAAM,OAAO,oBAAoB;IAC/B,gBAAuB,CAAC;IAEjB,MAAM,CAAC,KAAK,CAAC,uBAAuB,CACzC,OAAqB,EACrB,OAAY,EACZ,WAA2B;QAE3B,OAAO,WAAW,CAAC,YAAY,CAAC,YAAY,CAAC;YAC3C,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,SAAS;YACpD,GAAG,EAAE,gBAAgB;YACrB,YAAY,EAAE,oBAAoB;YAClC,IAAI,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC;SACxD,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HttpUrl, Result } from '../../types.js';
|
|
2
|
+
import type { Hex } from '@sodax/types';
|
|
2
3
|
import type { IntentSubmitError } from '../solver/SolverService.js';
|
|
3
4
|
import type { SpokeProvider } from '../../entities/Providers.js';
|
|
4
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntentRelayApiService.d.ts","sourceRoot":"","sources":["../../../src/services/intentRelay/IntentRelayApiService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"IntentRelayApiService.d.ts","sourceRoot":"","sources":["../../../src/services/intentRelay/IntentRelayApiService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,KAAK,EAAE,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CACzC,OAAO,EAAE,kBAAkB,CAAC,yBAAyB,CAAC,EACtD,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,gBAAgB,CAAC,yBAAyB,CAAC,CAAC,CAKtD;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,kBAAkB,CAAC,YAAY,CAAC,EACzC,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAMzC;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,CA6D3D;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,SAAS,aAAa,EAChE,WAAW,EAAE,GAAG,EAChB,aAAa,EAAE,CAAC,EAChB,kBAAkB,EAAE,OAAO,EAC3B,OAAO,SAA2B,GACjC,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAsDzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntentRelayApiService.js","sourceRoot":"","sources":["../../../src/services/intentRelay/IntentRelayApiService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IntentRelayApiService.js","sourceRoot":"","sources":["../../../src/services/intentRelay/IntentRelayApiService.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEpD,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AA8GrF,KAAK,UAAU,WAAW,CACxB,OAA8B,EAC9B,MAAc;IAEd,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,CAChC,KAAK,CAAC,MAAM,EAAE;QACZ,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAA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C3B,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACf,OAAO;gBACL,EAAE,EAAE,KAAK;gBACT,KAAK,EAAE;oBACL,IAAI,EAAE,SAAS;oBACf,KAAK,EAAE,MAAM,CAAC,KAAK;iBACpB;aACF,CAAC;QACJ,CAAC;QAED,OAAO;YACL,EAAE,EAAE,IAAI;YACR,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE;gBACL,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,KAAK;aACb;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type Address, type Hex } from 'viem';
|
|
2
2
|
import type { EvmHubProvider, SpokeProvider } from '../../entities/index.js';
|
|
3
3
|
import { type RelayErrorCode } from '../../index.js';
|
|
4
|
-
import type { EvmContractCall,
|
|
4
|
+
import type { EvmContractCall, HttpUrl, MoneyMarketConfigParams, Result, TxReturnType } from '../../types.js';
|
|
5
|
+
import type { EvmRawTransactionReceipt } from '@sodax/types';
|
|
6
|
+
import { type SpokeChainId, type Token } from '@sodax/types';
|
|
5
7
|
export type AggregatedReserveData = {
|
|
6
8
|
underlyingAsset: Address;
|
|
7
9
|
name: string;
|
|
@@ -112,139 +114,341 @@ export declare class MoneyMarketService {
|
|
|
112
114
|
private readonly hubProvider;
|
|
113
115
|
constructor(config: MoneyMarketConfigParams | undefined, hubProvider: EvmHubProvider, relayerApiEndpoint?: HttpUrl);
|
|
114
116
|
/**
|
|
115
|
-
* Check
|
|
116
|
-
* @param {MoneyMarketRepayParams | MoneyMarketSupplyParams} params - Money market params
|
|
117
|
-
* @param {SpokeProvider} spokeProvider - The spoke provider
|
|
118
|
-
* @return {Promise<Result<boolean>>} -
|
|
117
|
+
* Check if allowance is sufficient for supply or repay operations (currently required for EVM only)
|
|
118
|
+
* @param {MoneyMarketRepayParams | MoneyMarketSupplyParams} params - Money market params containing token address and amount
|
|
119
|
+
* @param {SpokeProvider} spokeProvider - The spoke provider instance
|
|
120
|
+
* @return {Promise<Result<boolean>>} - Returns true if allowance is sufficient, false otherwise
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* const allowanceValid = await isAllowanceValid({
|
|
124
|
+
* token: '0x...', // Address of the token (spoke chain) to supply
|
|
125
|
+
* amount: 1000n, // Amount to supply (in token decimals)
|
|
126
|
+
* }, spokeProvider);
|
|
127
|
+
*
|
|
128
|
+
* if (!allowanceValid.ok) {
|
|
129
|
+
* // Handle error
|
|
130
|
+
* }
|
|
131
|
+
*
|
|
132
|
+
* if (!allowanceValid.value) {
|
|
133
|
+
* // Need to approve
|
|
134
|
+
* }
|
|
119
135
|
*/
|
|
120
136
|
isAllowanceValid<S extends SpokeProvider>(params: MoneyMarketRepayParams | MoneyMarketSupplyParams, spokeProvider: S): Promise<Result<boolean>>;
|
|
121
137
|
/**
|
|
122
|
-
* Approve
|
|
138
|
+
* Approve amount spending (currently required for EVM only)
|
|
123
139
|
* @param token - ERC20 token address
|
|
124
140
|
* @param amount - Amount to approve
|
|
125
|
-
* @param
|
|
141
|
+
* @param spender - Spender address
|
|
126
142
|
* @param spokeProvider - Spoke provider
|
|
143
|
+
* @returns {Promise<Result<EvmRawTransactionReceipt>>} - Returns the transaction receipt
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* const approveResult = await approve(
|
|
147
|
+
* '0x...', // ERC20 token address
|
|
148
|
+
* 1000n, // Amount to approve (in token decimals)
|
|
149
|
+
* '0x...', // Spender address (usually the asset manager contract: spokeProvider.chainConfig.addresses.assetManager)
|
|
150
|
+
* spokeProvider
|
|
151
|
+
* );
|
|
152
|
+
*
|
|
153
|
+
* if (!approveResult.ok) {
|
|
154
|
+
* // Handle error
|
|
155
|
+
* }
|
|
156
|
+
*
|
|
157
|
+
* const txReceipt = approveResult.value;
|
|
127
158
|
*/
|
|
128
|
-
approve<S extends SpokeProvider>(token: Address, amount: bigint,
|
|
159
|
+
approve<S extends SpokeProvider>(token: Address, amount: bigint, spender: Address, spokeProvider: S): Promise<Result<EvmRawTransactionReceipt>>;
|
|
129
160
|
/**
|
|
130
|
-
* Supply tokens to the money market pool and submit the intent to the Solver API
|
|
161
|
+
* Supply tokens to the money market pool, relay the transaction to the hub and submit the intent to the Solver API
|
|
131
162
|
* @param params - The parameters for the supply transaction.
|
|
132
163
|
* @param spokeProvider - The spoke provider.
|
|
133
|
-
* @param timeout - The timeout in milliseconds for the transaction. Default is
|
|
134
|
-
* @returns [
|
|
164
|
+
* @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
|
|
165
|
+
* @returns {Promise<Result<[Hex, Hex], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* const result = await moneyMarketService.supplyAndSubmit(
|
|
169
|
+
* {
|
|
170
|
+
* token: '0x...', // Address of the token (spoke chain address) to supply
|
|
171
|
+
* amount: 1000n, // Amount to supply (in token decimals)
|
|
172
|
+
* },
|
|
173
|
+
* spokeProvider,
|
|
174
|
+
* 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
|
|
175
|
+
* );
|
|
176
|
+
*
|
|
177
|
+
* if (!result.ok) {
|
|
178
|
+
* // Handle error
|
|
179
|
+
* }
|
|
180
|
+
*
|
|
181
|
+
* const [
|
|
182
|
+
* spokeTxHash, // transaction hash on the spoke chain
|
|
183
|
+
* hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
|
|
184
|
+
* ] = result.value;
|
|
185
|
+
* console.log('Supply transaction hashes:', { spokeTxHash, hubTxHash });
|
|
135
186
|
*/
|
|
136
187
|
supplyAndSubmit<S extends SpokeProvider>(params: MoneyMarketSupplyParams, spokeProvider: S, timeout?: number): Promise<Result<[Hex, Hex], MoneyMarketError>>;
|
|
137
188
|
/**
|
|
138
|
-
* Supply tokens to the money market pool
|
|
139
|
-
* NOTE: This method does not submit the intent to the Solver API
|
|
189
|
+
* Supply tokens to the money market pool without submitting the intent to the Solver API
|
|
190
|
+
* NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
|
|
191
|
+
* In order to successfully supply tokens, you need to:
|
|
192
|
+
* 1. Check if the allowance is sufficient
|
|
193
|
+
* 2. Approve the asset manager contract to spend the tokens
|
|
194
|
+
* 3. Supply the tokens
|
|
195
|
+
* 4. Submit the intent to the Solver API and await it using relayTxAndWaitPacket method
|
|
196
|
+
*
|
|
140
197
|
* @param params - The parameters for the supply transaction.
|
|
141
198
|
* @param spokeProvider - The spoke provider.
|
|
142
199
|
* @param raw - Whether to return the raw transaction data.
|
|
143
|
-
* @returns
|
|
200
|
+
* @returns {Promise<Result<TxReturnType<S, R>, MoneyMarketErrorCode>>} - Returns the transaction result.
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* const moneyMarketService = new MoneyMarketService(config);
|
|
204
|
+
* const result = await moneyMarketService.supply(
|
|
205
|
+
* {
|
|
206
|
+
* token: "0x123...", // token address
|
|
207
|
+
* amount: 1000000000000000000n // 1 token in wei
|
|
208
|
+
* },
|
|
209
|
+
* spokeProvider,
|
|
210
|
+
* raw // Optional: true = return the raw transaction data, false = exeute and return the transaction hash (default: false)
|
|
211
|
+
* );
|
|
212
|
+
*
|
|
213
|
+
* if (result.ok) {
|
|
214
|
+
* const txHash = result.value;
|
|
215
|
+
* console.log('Supply transaction hash:', txHash);
|
|
216
|
+
* } else {
|
|
217
|
+
* console.error('Supply failed:', result.error);
|
|
218
|
+
* }
|
|
144
219
|
*/
|
|
145
220
|
supply<S extends SpokeProvider = SpokeProvider, R extends boolean = false>(params: MoneyMarketSupplyParams, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>, MoneyMarketError>>;
|
|
146
221
|
/**
|
|
147
|
-
* Borrow tokens from the money market pool and submit the intent to the Solver API
|
|
222
|
+
* Borrow tokens from the money market pool, relay the transaction to the hub and submit the intent to the Solver API
|
|
148
223
|
* @param params - The parameters for the borrow transaction.
|
|
149
224
|
* @param spokeProvider - The spoke provider.
|
|
150
|
-
* @param timeout - The timeout in milliseconds for the transaction. Default is
|
|
151
|
-
* @returns [
|
|
225
|
+
* @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
|
|
226
|
+
* @returns {Promise<Result<[Hex, Hex], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* const result = await moneyMarketService.borrowAndSubmit(
|
|
230
|
+
* {
|
|
231
|
+
* token: '0x...', // Address of the token (spoke chain address) to borrow
|
|
232
|
+
* amount: 1000n, // Amount to borrow (in token decimals)
|
|
233
|
+
* },
|
|
234
|
+
* spokeProvider,
|
|
235
|
+
* 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
|
|
236
|
+
* );
|
|
237
|
+
*
|
|
238
|
+
* if (!result.ok) {
|
|
239
|
+
* // Handle error
|
|
240
|
+
* }
|
|
241
|
+
*
|
|
242
|
+
* const [
|
|
243
|
+
* spokeTxHash, // transaction hash on the spoke chain
|
|
244
|
+
* hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
|
|
245
|
+
* ] = result.value;
|
|
246
|
+
* console.log('Borrow transaction hashes:', { spokeTxHash, hubTxHash });
|
|
152
247
|
*/
|
|
153
248
|
borrowAndSubmit<S extends SpokeProvider>(params: MoneyMarketSupplyParams, spokeProvider: S, timeout?: number): Promise<Result<[Hex, Hex], MoneyMarketError>>;
|
|
154
249
|
/**
|
|
155
|
-
* Borrow tokens from the money market pool
|
|
156
|
-
* NOTE: This method does not submit the intent to the Solver API
|
|
250
|
+
* Borrow tokens from the money market pool without submitting the intent to the Solver API
|
|
251
|
+
* NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
|
|
252
|
+
* In order to successfully borrow tokens, you need to:
|
|
253
|
+
* 1. Execute the borrow transaction on the spoke chain
|
|
254
|
+
* 2. Submit the intent to the Solver API and await it using relayTxAndWaitPacket method
|
|
255
|
+
*
|
|
157
256
|
* @param params - The parameters for the borrow transaction.
|
|
158
257
|
* @param spokeProvider - The spoke provider.
|
|
159
258
|
* @param raw - Whether to return the raw transaction data.
|
|
160
|
-
* @returns
|
|
259
|
+
* @returns {Promise<Result<TxReturnType<S, R>, MoneyMarketErrorCode>>} - Returns the transaction result (raw transaction data or transaction hash).
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* const moneyMarketService = new MoneyMarketService(config);
|
|
263
|
+
* const result = await moneyMarketService.borrow(
|
|
264
|
+
* {
|
|
265
|
+
* token: "0x123...", // token address
|
|
266
|
+
* amount: 1000000000000000000n // 1 token in wei
|
|
267
|
+
* },
|
|
268
|
+
* spokeProvider,
|
|
269
|
+
* raw // Optional: true = return the raw transaction data, false = exeute and return the transaction hash (default: false)
|
|
270
|
+
* );
|
|
271
|
+
*
|
|
272
|
+
* if (result.ok) {
|
|
273
|
+
* const txHash = result.value;
|
|
274
|
+
* console.log('Borrow transaction hash:', txHash);
|
|
275
|
+
* } else {
|
|
276
|
+
* console.error('Borrow failed:', result.error);
|
|
277
|
+
* }
|
|
161
278
|
*/
|
|
162
279
|
borrow<S extends SpokeProvider = SpokeProvider, R extends boolean = false>(params: MoneyMarketBorrowParams, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>, MoneyMarketErrorCode>>;
|
|
163
280
|
/**
|
|
164
|
-
* Withdraw tokens from the money market pool and submit the intent to the Solver API
|
|
281
|
+
* Withdraw tokens from the money market pool, relay the transaction to the hub and submit the intent to the Solver API
|
|
282
|
+
*
|
|
165
283
|
* @param params - The parameters for the withdraw transaction.
|
|
166
284
|
* @param spokeProvider - The spoke provider.
|
|
167
|
-
* @param timeout - The timeout in milliseconds for the transaction. Default is
|
|
168
|
-
* @returns [
|
|
285
|
+
* @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
|
|
286
|
+
* @returns {Promise<Result<[Hex, Hex], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* const result = await moneyMarketService.withdrawAndSubmit(
|
|
290
|
+
* {
|
|
291
|
+
* token: '0x...', // Address of the token (spoke chain address) to withdraw
|
|
292
|
+
* amount: 1000n, // Amount to withdraw (in token decimals)
|
|
293
|
+
* },
|
|
294
|
+
* spokeProvider,
|
|
295
|
+
* 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
|
|
296
|
+
* );
|
|
297
|
+
*
|
|
298
|
+
* if (!result.ok) {
|
|
299
|
+
* // Handle error
|
|
300
|
+
* }
|
|
301
|
+
*
|
|
302
|
+
* const [
|
|
303
|
+
* spokeTxHash, // transaction hash on the spoke chain
|
|
304
|
+
* hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
|
|
305
|
+
* ] = result.value;
|
|
306
|
+
* console.log('Withdraw transaction hashes:', { spokeTxHash, hubTxHash });
|
|
169
307
|
*/
|
|
170
308
|
withdrawAndSubmit<S extends SpokeProvider>(params: MoneyMarketWithdrawParams, spokeProvider: S, timeout?: number): Promise<Result<[Hex, Hex], MoneyMarketError>>;
|
|
171
309
|
/**
|
|
172
|
-
* Withdraw tokens from the money market pool
|
|
173
|
-
* NOTE: This method does not submit the intent to the Solver API
|
|
310
|
+
* Withdraw tokens from the money market pool without submitting the intent to the Solver API
|
|
311
|
+
* NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
|
|
312
|
+
* In order to successfully withdraw tokens, you need to:
|
|
313
|
+
* 1. Execute the withdraw transaction on the spoke chain
|
|
314
|
+
* 2. Submit the intent to the Solver API and await it using relayTxAndWaitPacket method
|
|
315
|
+
*
|
|
174
316
|
* @param params - The parameters for the withdraw transaction.
|
|
175
317
|
* @param spokeProvider - The spoke provider.
|
|
176
318
|
* @param raw - Whether to return the raw transaction data.
|
|
177
|
-
* @returns
|
|
319
|
+
* @returns {Promise<Result<TxReturnType<S, R>, MoneyMarketErrorCode>>} - Returns the transaction result (raw transaction data or transaction hash).
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* const moneyMarketService = new MoneyMarketService(config);
|
|
323
|
+
* const result = await moneyMarketService.withdraw(
|
|
324
|
+
* {
|
|
325
|
+
* token: "0x123...", // token address
|
|
326
|
+
* amount: 1000000000000000000n // 1 token in wei
|
|
327
|
+
* },
|
|
328
|
+
* spokeProvider,
|
|
329
|
+
* raw // Optional: true = return the raw transaction data, false = exeute and return the transaction hash (default: false)
|
|
330
|
+
* );
|
|
331
|
+
*
|
|
332
|
+
* if (result.ok) {
|
|
333
|
+
* const txHash = result.value;
|
|
334
|
+
* console.log('Withdraw transaction hash:', txHash);
|
|
335
|
+
* } else {
|
|
336
|
+
* console.error('Withdraw failed:', result.error);
|
|
337
|
+
* }
|
|
178
338
|
*/
|
|
179
339
|
withdraw<S extends SpokeProvider = SpokeProvider, R extends boolean = false>(params: MoneyMarketWithdrawParams, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>, MoneyMarketErrorCode>>;
|
|
180
340
|
/**
|
|
181
|
-
* Repay tokens to the money market pool and submit the intent to the Solver API
|
|
341
|
+
* Repay tokens to the money market pool, relay the transaction to the hub and submit the intent to the Solver API
|
|
342
|
+
*
|
|
182
343
|
* @param params - The parameters for the repay transaction.
|
|
183
344
|
* @param spokeProvider - The spoke provider.
|
|
184
|
-
* @param timeout - The timeout in milliseconds for the transaction. Default is
|
|
185
|
-
* @returns [
|
|
345
|
+
* @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
|
|
346
|
+
* @returns {Promise<Result<[Hex, Hex], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* const result = await moneyMarketService.repayAndSubmit(
|
|
350
|
+
* {
|
|
351
|
+
* token: '0x...', // Address of the token (spoke chain address) to repay
|
|
352
|
+
* amount: 1000n, // Amount to repay (in token decimals)
|
|
353
|
+
* },
|
|
354
|
+
* spokeProvider,
|
|
355
|
+
* 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
|
|
356
|
+
* );
|
|
357
|
+
*
|
|
358
|
+
* if (!result.ok) {
|
|
359
|
+
* // Handle error
|
|
360
|
+
* }
|
|
361
|
+
*
|
|
362
|
+
* const [
|
|
363
|
+
* spokeTxHash, // transaction hash on the spoke chain
|
|
364
|
+
* hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
|
|
365
|
+
* ] = result.value;
|
|
366
|
+
* console.log('Repay transaction hashes:', { spokeTxHash, hubTxHash });
|
|
186
367
|
*/
|
|
187
368
|
repayAndSubmit<S extends SpokeProvider>(params: MoneyMarketRepayParams, spokeProvider: S, timeout?: number): Promise<Result<[Hex, Hex], MoneyMarketError>>;
|
|
188
369
|
/**
|
|
189
|
-
* Repay tokens to the money market pool
|
|
190
|
-
* NOTE: This method does not submit the intent to the Solver API
|
|
370
|
+
* Repay tokens to the money market pool without submitting the intent to the Solver API
|
|
371
|
+
* NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
|
|
372
|
+
* In order to successfully repay tokens, you need to:
|
|
373
|
+
* 1. Check if the allowance is sufficient
|
|
374
|
+
* 2. Approve the asset manager contract to spend the tokens
|
|
375
|
+
* 3. Execute the repay transaction on the spoke chain
|
|
376
|
+
* 4. Submit the intent to the Solver API and await it using relayTxAndWaitPacket method
|
|
377
|
+
*
|
|
191
378
|
* @param params - The parameters for the repay transaction.
|
|
192
379
|
* @param spokeProvider - The spoke provider.
|
|
193
380
|
* @param raw - Whether to return the raw transaction data.
|
|
194
|
-
* @returns The transaction result (raw transaction data or transaction hash).
|
|
381
|
+
* @returns {Promise<Result<TxReturnType<S, R>, MoneyMarketErrorCode>>} The transaction result (raw transaction data or transaction hash) or error.
|
|
382
|
+
*
|
|
383
|
+
* @example
|
|
384
|
+
* const moneyMarketService = new MoneyMarketService(config);
|
|
385
|
+
* const result = await moneyMarketService.repay(
|
|
386
|
+
* {
|
|
387
|
+
* token: "0x123...", // token address
|
|
388
|
+
* amount: 1000000000000000000n // 1 token in wei
|
|
389
|
+
* },
|
|
390
|
+
* spokeProvider,
|
|
391
|
+
* raw // Optional: true = return the raw transaction data, false = exeute and return the transaction hash (default: false)
|
|
392
|
+
* );
|
|
393
|
+
*
|
|
394
|
+
* if (result.ok) {
|
|
395
|
+
* const txHash = result.value;
|
|
396
|
+
* console.log('Repay transaction hash:', txHash);
|
|
397
|
+
* } else {
|
|
398
|
+
* console.error('Repay failed:', result.error);
|
|
399
|
+
* }
|
|
195
400
|
*/
|
|
196
401
|
repay<S extends SpokeProvider = SpokeProvider, R extends boolean = false>(params: MoneyMarketRepayParams, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>, MoneyMarketErrorCode>>;
|
|
197
402
|
/**
|
|
198
|
-
*
|
|
403
|
+
* Build transaction data for supplying to the money market pool
|
|
199
404
|
* @param token - The address of the token on spoke chain
|
|
200
|
-
* @param to The user wallet address on the hub chain
|
|
201
|
-
* @param amount The amount to deposit
|
|
202
|
-
* @param spokeChainId The chain ID of the spoke chain
|
|
203
|
-
* @returns The transaction
|
|
405
|
+
* @param to - The user wallet address on the hub chain
|
|
406
|
+
* @param amount - The amount to deposit
|
|
407
|
+
* @param spokeChainId - The chain ID of the spoke chain
|
|
408
|
+
* @returns {Hex} The transaction data.
|
|
204
409
|
*/
|
|
205
410
|
supplyData(token: string, to: Address, amount: bigint, spokeChainId: SpokeChainId): Hex;
|
|
206
411
|
/**
|
|
207
|
-
*
|
|
208
|
-
* @param from The user wallet address on the hub chain
|
|
209
|
-
* @param to The user wallet address on the spoke chain
|
|
210
|
-
* @param token The address of the token to borrow
|
|
211
|
-
* @param amount The amount to borrow in hub chain decimals
|
|
212
|
-
* @param spokeChainId The chain ID of the spoke chain
|
|
213
|
-
* @returns
|
|
412
|
+
* Build transaction data for borrowing from the money market pool
|
|
413
|
+
* @param from - The user wallet address on the hub chain
|
|
414
|
+
* @param to - The user wallet address on the spoke chain
|
|
415
|
+
* @param token - The address of the token to borrow
|
|
416
|
+
* @param amount - The amount to borrow in hub chain decimals
|
|
417
|
+
* @param spokeChainId - The chain ID of the spoke chain
|
|
418
|
+
* @returns {Hex} The transaction data.
|
|
214
419
|
*/
|
|
215
420
|
borrowData(from: Address, to: Address | Hex, token: string, amount: bigint, spokeChainId: SpokeChainId): Hex;
|
|
216
421
|
/**
|
|
217
|
-
*
|
|
218
|
-
* @param from The user wallet address on the hub chain
|
|
219
|
-
* @param to The user wallet address on the spoke chain
|
|
220
|
-
* @param token The address of the token to borrow
|
|
221
|
-
* @param amount The amount to borrow in hub chain decimals
|
|
222
|
-
* @param spokeChainId The chain ID of the spoke chain
|
|
223
|
-
* @returns
|
|
422
|
+
* Build transaction data for withdrawing from the money market pool
|
|
423
|
+
* @param from - The user wallet address on the hub chain
|
|
424
|
+
* @param to - The user wallet address on the spoke chain
|
|
425
|
+
* @param token - The address of the token to borrow
|
|
426
|
+
* @param amount - The amount to borrow in hub chain decimals
|
|
427
|
+
* @param spokeChainId - The chain ID of the spoke chain
|
|
428
|
+
* @returns {Hex} The transaction data.
|
|
224
429
|
*/
|
|
225
430
|
withdrawData(from: Address, to: Address, token: string, amount: bigint, spokeChainId: SpokeChainId): Hex;
|
|
226
431
|
/**
|
|
227
|
-
*
|
|
228
|
-
* @param token The address of the token to repay
|
|
229
|
-
* @param to The user wallet address on the hub chain
|
|
230
|
-
* @param amount The amount to repay
|
|
231
|
-
* @param spokeChainId The chain ID of the spoke chain
|
|
232
|
-
* @
|
|
233
|
-
* @returns Transaction object
|
|
432
|
+
* Build transaction data for repaying to the money market pool
|
|
433
|
+
* @param token - The address of the token to repay
|
|
434
|
+
* @param to - The user wallet address on the hub chain
|
|
435
|
+
* @param amount - The amount to repay
|
|
436
|
+
* @param spokeChainId - The chain ID of the spoke chain
|
|
437
|
+
* @returns {Hex} The transaction data.
|
|
234
438
|
*/
|
|
235
439
|
repayData(token: string, to: Address, amount: bigint, spokeChainId: SpokeChainId): Hex;
|
|
236
440
|
/**
|
|
237
441
|
* Get the list of all reserves in the pool
|
|
238
442
|
* @param uiPoolDataProvider - The address of the UI Pool Data Provider
|
|
239
443
|
* @param poolAddressesProvider - The address of the Pool Addresses Provider
|
|
240
|
-
* @returns Array of reserve addresses
|
|
444
|
+
* @returns {Promise<readonly Address[]>} - Array of reserve addresses
|
|
241
445
|
*/
|
|
242
446
|
getReservesList(uiPoolDataProvider: Address, poolAddressesProvider: Address): Promise<readonly Address[]>;
|
|
243
447
|
/**
|
|
244
448
|
* Get detailed data for all reserves in the pool
|
|
245
449
|
* @param uiPoolDataProvider - The address of the UI Pool Data Provider
|
|
246
450
|
* @param poolAddressesProvider - The address of the Pool Addresses Provider
|
|
247
|
-
* @returns Tuple containing array of reserve data and base currency info
|
|
451
|
+
* @returns {Promise<readonly [readonly AggregatedReserveData[], BaseCurrencyInfo]>} - Tuple containing array of reserve data and base currency info
|
|
248
452
|
*/
|
|
249
453
|
getReservesData(uiPoolDataProvider: Address, poolAddressesProvider: Address): Promise<readonly [readonly AggregatedReserveData[], BaseCurrencyInfo]>;
|
|
250
454
|
/**
|
|
@@ -252,7 +456,7 @@ export declare class MoneyMarketService {
|
|
|
252
456
|
* @param userAddress Address of the user
|
|
253
457
|
* @param uiPoolDataProvider - The address of the UI Pool Data Provider
|
|
254
458
|
* @param poolAddressesProvider - The address of the Pool Addresses Provider
|
|
255
|
-
* @returns Tuple containing array of user reserve data and eMode category ID
|
|
459
|
+
* @returns {Promise<readonly [readonly UserReserveData[], number]>} - Tuple containing array of user reserve data and eMode category ID
|
|
256
460
|
*/
|
|
257
461
|
getUserReservesData(userAddress: Address, uiPoolDataProvider: Address, poolAddressesProvider: Address): Promise<readonly [readonly UserReserveData[], number]>;
|
|
258
462
|
/**
|
|
@@ -308,13 +512,13 @@ export declare class MoneyMarketService {
|
|
|
308
512
|
/**
|
|
309
513
|
* Get the list of all supported money market tokens (supply / borrow tokens) for a given spoke chain ID
|
|
310
514
|
* @param chainId The chain ID
|
|
311
|
-
* @returns Array of supported tokens
|
|
515
|
+
* @returns {readonly Token[]} - Array of supported tokens
|
|
312
516
|
*/
|
|
313
517
|
getSupportedTokens(chainId: SpokeChainId): readonly Token[];
|
|
314
518
|
/**
|
|
315
519
|
* Get the list of all supported money market reserves (supply / borrow reserves)
|
|
316
520
|
* NOTE: reserve addresses are on the hub chain and can be of type vault, erc20, etc.
|
|
317
|
-
* @returns Array of supported reserves
|
|
521
|
+
* @returns {readonly Address[]} - Array of supported reserves
|
|
318
522
|
*/
|
|
319
523
|
getSupportedReserves(): readonly Address[];
|
|
320
524
|
}
|