@mento-protocol/mento-sdk 2.0.0-beta.8 → 2.0.0-beta.9
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 +177 -0
- package/dist/abis/broker.d.ts.map +1 -1
- package/dist/abis/broker.js +7 -0
- package/dist/abis/broker.js.map +1 -1
- package/dist/abis/index.d.ts +1 -0
- package/dist/abis/index.d.ts.map +1 -1
- package/dist/abis/index.js +1 -0
- package/dist/abis/index.js.map +1 -1
- package/dist/adapters/implementations/ethersAdapter.d.ts +5 -1
- package/dist/adapters/implementations/ethersAdapter.d.ts.map +1 -1
- package/dist/adapters/implementations/ethersAdapter.js +73 -0
- package/dist/adapters/implementations/ethersAdapter.js.map +1 -1
- package/dist/adapters/implementations/ethersV5Adapter.d.ts +5 -1
- package/dist/adapters/implementations/ethersV5Adapter.d.ts.map +1 -1
- package/dist/adapters/implementations/ethersV5Adapter.js +73 -0
- package/dist/adapters/implementations/ethersV5Adapter.js.map +1 -1
- package/dist/adapters/implementations/viemAdapter.d.ts +12 -3
- package/dist/adapters/implementations/viemAdapter.d.ts.map +1 -1
- package/dist/adapters/implementations/viemAdapter.js +101 -1
- package/dist/adapters/implementations/viemAdapter.js.map +1 -1
- package/dist/adapters/proxies/ethersAdapterProxy.d.ts +2 -1
- package/dist/adapters/proxies/ethersAdapterProxy.d.ts.map +1 -1
- package/dist/adapters/proxies/ethersAdapterProxy.js +7 -0
- package/dist/adapters/proxies/ethersAdapterProxy.js.map +1 -1
- package/dist/adapters/proxies/ethersV5AdapterProxy.d.ts +2 -1
- package/dist/adapters/proxies/ethersV5AdapterProxy.d.ts.map +1 -1
- package/dist/adapters/proxies/ethersV5AdapterProxy.js +7 -0
- package/dist/adapters/proxies/ethersV5AdapterProxy.js.map +1 -1
- package/dist/adapters/proxies/viemAdapterProxy.d.ts +7 -3
- package/dist/adapters/proxies/viemAdapterProxy.d.ts.map +1 -1
- package/dist/adapters/proxies/viemAdapterProxy.js +11 -4
- package/dist/adapters/proxies/viemAdapterProxy.js.map +1 -1
- package/dist/index.d.ts +66 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +75 -3
- package/dist/index.js.map +1 -1
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +1 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/swapService.d.ts +70 -0
- package/dist/services/swapService.d.ts.map +1 -0
- package/dist/services/swapService.js +134 -0
- package/dist/services/swapService.js.map +1 -0
- package/dist/types/provider.d.ts +18 -0
- package/dist/types/provider.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethersAdapterProxy.d.ts","sourceRoot":"","sources":["../../../src/adapters/proxies/ethersAdapterProxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"ethersAdapterProxy.d.ts","sourceRoot":"","sources":["../../../src/adapters/proxies/ethersAdapterProxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AAE1D;;;;;;;;;;;;;GAaG;AACH,qBAAa,kBAAmB,YAAW,eAAe;IACxD,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,WAAW,CAAe;gBAEtB,QAAQ,EAAE,gBAAgB;YAIxB,UAAU;IAWlB,YAAY,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IAUjE,aAAa,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAUlG,UAAU;CASjB"}
|
|
@@ -59,6 +59,13 @@ class EthersAdapterProxy {
|
|
|
59
59
|
}
|
|
60
60
|
return this.adapter.readContract(...args);
|
|
61
61
|
}
|
|
62
|
+
async writeContract(...args) {
|
|
63
|
+
await this.initPromise;
|
|
64
|
+
if (!this.adapter) {
|
|
65
|
+
throw new Error('Adapter not initialized. Are you missing ethers v6 dependency?');
|
|
66
|
+
}
|
|
67
|
+
return this.adapter.writeContract(...args);
|
|
68
|
+
}
|
|
62
69
|
async getChainId() {
|
|
63
70
|
await this.initPromise;
|
|
64
71
|
if (!this.adapter) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethersAdapterProxy.js","sourceRoot":"","sources":["../../../src/adapters/proxies/ethersAdapterProxy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;;;;;;;;;GAaG;AACH,MAAa,kBAAkB;IAI7B,YAAY,QAA0B;QAH9B,YAAO,GAA2B,IAAI,CAAA;QAI5C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IAC9C,CAAC;IAEO,KAAK,CAAC,UAAU,CAAC,QAA0B;QACjD,IAAI,CAAC;YACH,MAAM,EAAE,aAAa,EAAE,GAAG,wDAAa,kCAAkC,GAAC,CAAA;YAC1E,IAAI,CAAC,OAAO,GAAG,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAA;QAC5C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAA;QACH,CAAC;IACH,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,GAAG,IAAiD;QACrE,MAAM,IAAI,CAAC,WAAW,CAAA;QACtB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAA;QACH,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,CAAA;IAC3C,CAAC;IAED,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AAO,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAA;QACH,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,CAAA;IAC5C,CAAC;IAED,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,WAAW,CAAA;QACtB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAA;QACH,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAA;IAClC,CAAC;CACF;AAhDD,gDAgDC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProviderAdapter } from '../../types';
|
|
1
|
+
import { ProviderAdapter, TransactionResponse } from '../../types';
|
|
2
2
|
import type { providers as EthersV5Providers } from 'ethers-v5';
|
|
3
3
|
/**
|
|
4
4
|
* Proxy class that implements lazy loading for ethers v5 provider adapter.
|
|
@@ -20,6 +20,7 @@ export declare class EthersV5AdapterProxy implements ProviderAdapter {
|
|
|
20
20
|
constructor(provider: EthersV5Providers.Provider);
|
|
21
21
|
private initialize;
|
|
22
22
|
readContract(...args: Parameters<ProviderAdapter['readContract']>): Promise<unknown>;
|
|
23
|
+
writeContract(...args: Parameters<ProviderAdapter['writeContract']>): Promise<TransactionResponse>;
|
|
23
24
|
getChainId(): Promise<number>;
|
|
24
25
|
}
|
|
25
26
|
//# sourceMappingURL=ethersV5AdapterProxy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethersV5AdapterProxy.d.ts","sourceRoot":"","sources":["../../../src/adapters/proxies/ethersV5AdapterProxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"ethersV5AdapterProxy.d.ts","sourceRoot":"","sources":["../../../src/adapters/proxies/ethersV5AdapterProxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,SAAS,IAAI,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE/D;;;;;;;;;;;;;GAaG;AACH,qBAAa,oBAAqB,YAAW,eAAe;IAC1D,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,WAAW,CAAe;gBAEtB,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;YAIlC,UAAU;IAalB,YAAY,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IAUjE,aAAa,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAUlG,UAAU;CASjB"}
|
|
@@ -59,6 +59,13 @@ class EthersV5AdapterProxy {
|
|
|
59
59
|
}
|
|
60
60
|
return this.adapter.readContract(...args);
|
|
61
61
|
}
|
|
62
|
+
async writeContract(...args) {
|
|
63
|
+
await this.initPromise;
|
|
64
|
+
if (!this.adapter) {
|
|
65
|
+
throw new Error('Adapter not initialized. Are you missing ethers v5 dependency?');
|
|
66
|
+
}
|
|
67
|
+
return this.adapter.writeContract(...args);
|
|
68
|
+
}
|
|
62
69
|
async getChainId() {
|
|
63
70
|
await this.initPromise;
|
|
64
71
|
if (!this.adapter) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethersV5AdapterProxy.js","sourceRoot":"","sources":["../../../src/adapters/proxies/ethersV5AdapterProxy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;;;;;;;;;GAaG;AACH,MAAa,oBAAoB;IAI/B,YAAY,QAAoC;QAHxC,YAAO,GAA2B,IAAI,CAAA;QAI5C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IAC9C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DAC1B,oCAAoC,GACrC,CAAA;YACD,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAA;QAC9C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAA;QACH,CAAC;IACH,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,GAAG,IAAiD;QACrE,MAAM,IAAI,CAAC,WAAW,CAAA;QACtB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAA;QACH,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,CAAA;IAC3C,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,GAAG,IAAkD;QACvE,MAAM,IAAI,CAAC,WAAW,CAAA;QACtB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAA;QACH,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,CAAA;IAC5C,CAAC;IAED,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,WAAW,CAAA;QACtB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAA;QACH,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAA;IAClC,CAAC;CACF;AAlDD,oDAkDC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PublicClient } from 'viem';
|
|
2
|
-
import { ProviderAdapter } from '../../types';
|
|
1
|
+
import type { PublicClient, WalletClient, Account } from 'viem';
|
|
2
|
+
import { ProviderAdapter, TransactionResponse } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Proxy class that implements lazy loading for viem provider adapter.
|
|
5
5
|
*
|
|
@@ -17,9 +17,13 @@ import { ProviderAdapter } from '../../types';
|
|
|
17
17
|
export declare class ViemAdapterProxy implements ProviderAdapter {
|
|
18
18
|
private adapter;
|
|
19
19
|
private initPromise;
|
|
20
|
-
constructor(client: PublicClient
|
|
20
|
+
constructor(client: PublicClient, walletClientConfig?: {
|
|
21
|
+
walletClient: WalletClient;
|
|
22
|
+
account: Account;
|
|
23
|
+
});
|
|
21
24
|
private initialize;
|
|
22
25
|
readContract(...args: Parameters<ProviderAdapter['readContract']>): Promise<unknown>;
|
|
26
|
+
writeContract(...args: Parameters<ProviderAdapter['writeContract']>): Promise<TransactionResponse>;
|
|
23
27
|
getChainId(): Promise<number>;
|
|
24
28
|
}
|
|
25
29
|
//# sourceMappingURL=viemAdapterProxy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viemAdapterProxy.d.ts","sourceRoot":"","sources":["../../../src/adapters/proxies/viemAdapterProxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"viemAdapterProxy.d.ts","sourceRoot":"","sources":["../../../src/adapters/proxies/viemAdapterProxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAElE;;;;;;;;;;;;;GAaG;AACH,qBAAa,gBAAiB,YAAW,eAAe;IACtD,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,WAAW,CAAe;gBAGhC,MAAM,EAAE,YAAY,EACpB,kBAAkB,CAAC,EAAE;QAAE,YAAY,EAAE,YAAY,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE;YAKzD,UAAU;IAclB,YAAY,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IAUjE,aAAa,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAUlG,UAAU;CASjB"}
|
|
@@ -39,14 +39,14 @@ exports.ViemAdapterProxy = void 0;
|
|
|
39
39
|
* ./adapters/proxies/README.md
|
|
40
40
|
*/
|
|
41
41
|
class ViemAdapterProxy {
|
|
42
|
-
constructor(client) {
|
|
42
|
+
constructor(client, walletClientConfig) {
|
|
43
43
|
this.adapter = null;
|
|
44
|
-
this.initPromise = this.initialize(client);
|
|
44
|
+
this.initPromise = this.initialize(client, walletClientConfig);
|
|
45
45
|
}
|
|
46
|
-
async initialize(client) {
|
|
46
|
+
async initialize(client, walletClientConfig) {
|
|
47
47
|
try {
|
|
48
48
|
const { ViemAdapter } = await Promise.resolve().then(() => __importStar(require('../implementations/viemAdapter')));
|
|
49
|
-
this.adapter = new ViemAdapter(client);
|
|
49
|
+
this.adapter = new ViemAdapter(client, walletClientConfig);
|
|
50
50
|
}
|
|
51
51
|
catch (error) {
|
|
52
52
|
throw new Error('viem is not installed. Please install viem to use this adapter');
|
|
@@ -59,6 +59,13 @@ class ViemAdapterProxy {
|
|
|
59
59
|
}
|
|
60
60
|
return this.adapter.readContract(...args);
|
|
61
61
|
}
|
|
62
|
+
async writeContract(...args) {
|
|
63
|
+
await this.initPromise;
|
|
64
|
+
if (!this.adapter) {
|
|
65
|
+
throw new Error('Adapter not initialized. Are you missing viem dependency?');
|
|
66
|
+
}
|
|
67
|
+
return this.adapter.writeContract(...args);
|
|
68
|
+
}
|
|
62
69
|
async getChainId() {
|
|
63
70
|
await this.initPromise;
|
|
64
71
|
if (!this.adapter) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viemAdapterProxy.js","sourceRoot":"","sources":["../../../src/adapters/proxies/viemAdapterProxy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;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a,CAAC,GAAG,IAAI,CAAC,CAAA;IAC5C,CAAC;IAED,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,WAAW,CAAA;QACtB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAA;QACH,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAA;IAClC,CAAC;CACF;AAtDD,4CAsDC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { PublicClient } from 'viem';
|
|
1
|
+
import type { PublicClient, WalletClient, Account } from 'viem';
|
|
2
2
|
import type { Provider as EthersV6Provider } from 'ethers';
|
|
3
3
|
import type { providers as EthersV5Providers } from 'ethers-v5';
|
|
4
|
-
import { CollateralAsset, ContractAddresses, StableToken } from './types';
|
|
4
|
+
import { CollateralAsset, ContractAddresses, StableToken, TransactionResponse, ContractWriteOptions } from './types';
|
|
5
5
|
export type SupportedProvider = EthersV6Provider | PublicClient | EthersV5Providers.Provider;
|
|
6
6
|
export interface MentoConfig {
|
|
7
7
|
/** Provider can be one of:
|
|
@@ -10,6 +10,11 @@ export interface MentoConfig {
|
|
|
10
10
|
* - Viem PublicClient (from 'viem')
|
|
11
11
|
*/
|
|
12
12
|
provider: SupportedProvider;
|
|
13
|
+
/** Optional configuration for Viem wallet client (required for write operations with Viem) */
|
|
14
|
+
viemAdapterConfig?: {
|
|
15
|
+
walletClient: WalletClient;
|
|
16
|
+
account: Account;
|
|
17
|
+
};
|
|
13
18
|
}
|
|
14
19
|
/**
|
|
15
20
|
* @class Mento
|
|
@@ -43,6 +48,7 @@ export declare class Mento {
|
|
|
43
48
|
private provider;
|
|
44
49
|
private stableTokenService;
|
|
45
50
|
private collateralAssetService;
|
|
51
|
+
private swapService;
|
|
46
52
|
private constructor();
|
|
47
53
|
static create(config: MentoConfig): Promise<Mento>;
|
|
48
54
|
getStableTokens(): Promise<StableToken[]>;
|
|
@@ -57,6 +63,64 @@ export declare class Mento {
|
|
|
57
63
|
* @returns The contract address
|
|
58
64
|
*/
|
|
59
65
|
getContractAddress(contractName: keyof ContractAddresses): Promise<string>;
|
|
66
|
+
/**
|
|
67
|
+
* Swap a specified amount of collateral token for stable token.
|
|
68
|
+
*
|
|
69
|
+
* @param tokenIn The address of the input token (collateral token)
|
|
70
|
+
* @param tokenOut The address of the output token (stable token)
|
|
71
|
+
* @param amountIn The amount of input token to swap
|
|
72
|
+
* @param minAmountOut The minimum amount of output token to receive (for slippage protection)
|
|
73
|
+
* @param options Optional parameters for the transaction (gas settings)
|
|
74
|
+
* @returns A transaction response object
|
|
75
|
+
*/
|
|
76
|
+
swapIn(tokenIn: string, tokenOut: string, amountIn: string, minAmountOut: string, options?: Omit<ContractWriteOptions, 'address' | 'abi' | 'functionName' | 'args'>): Promise<TransactionResponse>;
|
|
77
|
+
/**
|
|
78
|
+
* Swap collateral token for a specified amount of stable token.
|
|
79
|
+
*
|
|
80
|
+
* @param tokenIn The address of the input token (collateral token)
|
|
81
|
+
* @param tokenOut The address of the output token (stable token)
|
|
82
|
+
* @param amountOut The exact amount of output token to receive
|
|
83
|
+
* @param maxAmountIn The maximum amount of input token to spend (for slippage protection)
|
|
84
|
+
* @param options Optional parameters for the transaction (gas settings)
|
|
85
|
+
* @returns A transaction response object
|
|
86
|
+
*/
|
|
87
|
+
swapOut(tokenIn: string, tokenOut: string, amountOut: string, maxAmountIn: string, options?: Omit<ContractWriteOptions, 'address' | 'abi' | 'functionName' | 'args'>): Promise<TransactionResponse>;
|
|
88
|
+
/**
|
|
89
|
+
* Calculate the amount of output token that would be received for a given input amount.
|
|
90
|
+
*
|
|
91
|
+
* @param tokenIn The address of the input token
|
|
92
|
+
* @param tokenOut The address of the output token
|
|
93
|
+
* @param amountIn The amount of input token
|
|
94
|
+
* @returns The expected amount of output token as a string
|
|
95
|
+
*/
|
|
96
|
+
getAmountOut(tokenIn: string, tokenOut: string, amountIn: string): Promise<string>;
|
|
97
|
+
/**
|
|
98
|
+
* Calculate the amount of input token required to receive a given output amount.
|
|
99
|
+
*
|
|
100
|
+
* @param tokenIn The address of the input token
|
|
101
|
+
* @param tokenOut The address of the output token
|
|
102
|
+
* @param amountOut The desired amount of output token
|
|
103
|
+
* @returns The required amount of input token as a string
|
|
104
|
+
*/
|
|
105
|
+
getAmountIn(tokenIn: string, tokenOut: string, amountOut: string): Promise<string>;
|
|
106
|
+
/**
|
|
107
|
+
* Estimate the gas needed for a swap transaction.
|
|
108
|
+
*
|
|
109
|
+
* @param methodName The method to call ('swapIn' or 'swapOut')
|
|
110
|
+
* @param args The arguments for the method
|
|
111
|
+
* @returns The estimated gas as a string
|
|
112
|
+
*/
|
|
113
|
+
estimateGas(methodName: 'swapIn' | 'swapOut', args: [string, string, string, string]): Promise<string>;
|
|
114
|
+
/**
|
|
115
|
+
* Calculate the price impact of a swap as a percentage.
|
|
116
|
+
*
|
|
117
|
+
* @param tokenIn The address of the input token
|
|
118
|
+
* @param tokenOut The address of the output token
|
|
119
|
+
* @param amountIn The amount of input token
|
|
120
|
+
* @param amountOut The expected amount of output token
|
|
121
|
+
* @returns The price impact as a percentage string (e.g., "0.5" for 0.5%)
|
|
122
|
+
*/
|
|
123
|
+
calculatePriceImpact(tokenIn: string, tokenOut: string, amountIn: string, amountOut: string): Promise<string>;
|
|
60
124
|
}
|
|
61
125
|
export * from './constants';
|
|
62
126
|
export * from './types';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;A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GACpF,OAAO,CAAC,mBAAmB,CAAC;IAI/B;;;;;;;;;OASG;IACU,OAAO,CAClB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,GAAG,KAAK,GAAG,cAAc,GAAG,MAAM,CAAM,GACpF,OAAO,CAAC,mBAAmB,CAAC;IAI/B;;;;;;;OAOG;IACU,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI/F;;;;;;;OAOG;IACU,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI/F;;;;;;OAMG;IACU,WAAW,CACtB,UAAU,EAAE,QAAQ,GAAG,SAAS,EAChC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GACrC,OAAO,CAAC,MAAM,CAAC;IAIlB;;;;;;;;OAQG;IACU,oBAAoB,CAC/B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC;CAGnB;AAED,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -66,10 +66,11 @@ function isViemProvider(provider) {
|
|
|
66
66
|
* const collateralAssets = await mento.getCollateralAssets();
|
|
67
67
|
*/
|
|
68
68
|
class Mento {
|
|
69
|
-
constructor(provider, stableTokenService, collateralAssetService) {
|
|
69
|
+
constructor(provider, stableTokenService, collateralAssetService, swapService) {
|
|
70
70
|
this.provider = provider;
|
|
71
71
|
this.stableTokenService = stableTokenService;
|
|
72
72
|
this.collateralAssetService = collateralAssetService;
|
|
73
|
+
this.swapService = swapService;
|
|
73
74
|
}
|
|
74
75
|
static async create(config) {
|
|
75
76
|
if (!config.provider) {
|
|
@@ -83,14 +84,15 @@ class Mento {
|
|
|
83
84
|
provider = new adapters_1.EthersAdapter(config.provider);
|
|
84
85
|
}
|
|
85
86
|
else if (isViemProvider(config.provider)) {
|
|
86
|
-
provider = new adapters_1.ViemAdapter(config.provider);
|
|
87
|
+
provider = new adapters_1.ViemAdapter(config.provider, config.viemAdapterConfig);
|
|
87
88
|
}
|
|
88
89
|
else {
|
|
89
90
|
throw new Error('Unsupported provider type');
|
|
90
91
|
}
|
|
91
92
|
const stableTokenService = new services_1.StableTokenService(provider);
|
|
92
93
|
const collateralAssetService = new services_1.CollateralAssetService(provider);
|
|
93
|
-
|
|
94
|
+
const swapService = new services_1.SwapService(provider);
|
|
95
|
+
return new Mento(provider, stableTokenService, collateralAssetService, swapService);
|
|
94
96
|
}
|
|
95
97
|
async getStableTokens() {
|
|
96
98
|
return this.stableTokenService.getStableTokens();
|
|
@@ -111,6 +113,76 @@ class Mento {
|
|
|
111
113
|
const chainId = (await this.provider.getChainId());
|
|
112
114
|
return addresses_1.addresses[chainId][contractName];
|
|
113
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Swap a specified amount of collateral token for stable token.
|
|
118
|
+
*
|
|
119
|
+
* @param tokenIn The address of the input token (collateral token)
|
|
120
|
+
* @param tokenOut The address of the output token (stable token)
|
|
121
|
+
* @param amountIn The amount of input token to swap
|
|
122
|
+
* @param minAmountOut The minimum amount of output token to receive (for slippage protection)
|
|
123
|
+
* @param options Optional parameters for the transaction (gas settings)
|
|
124
|
+
* @returns A transaction response object
|
|
125
|
+
*/
|
|
126
|
+
async swapIn(tokenIn, tokenOut, amountIn, minAmountOut, options = {}) {
|
|
127
|
+
return this.swapService.swapIn(tokenIn, tokenOut, amountIn, minAmountOut, options);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Swap collateral token for a specified amount of stable token.
|
|
131
|
+
*
|
|
132
|
+
* @param tokenIn The address of the input token (collateral token)
|
|
133
|
+
* @param tokenOut The address of the output token (stable token)
|
|
134
|
+
* @param amountOut The exact amount of output token to receive
|
|
135
|
+
* @param maxAmountIn The maximum amount of input token to spend (for slippage protection)
|
|
136
|
+
* @param options Optional parameters for the transaction (gas settings)
|
|
137
|
+
* @returns A transaction response object
|
|
138
|
+
*/
|
|
139
|
+
async swapOut(tokenIn, tokenOut, amountOut, maxAmountIn, options = {}) {
|
|
140
|
+
return this.swapService.swapOut(tokenIn, tokenOut, amountOut, maxAmountIn, options);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Calculate the amount of output token that would be received for a given input amount.
|
|
144
|
+
*
|
|
145
|
+
* @param tokenIn The address of the input token
|
|
146
|
+
* @param tokenOut The address of the output token
|
|
147
|
+
* @param amountIn The amount of input token
|
|
148
|
+
* @returns The expected amount of output token as a string
|
|
149
|
+
*/
|
|
150
|
+
async getAmountOut(tokenIn, tokenOut, amountIn) {
|
|
151
|
+
return this.swapService.getAmountOut(tokenIn, tokenOut, amountIn);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Calculate the amount of input token required to receive a given output amount.
|
|
155
|
+
*
|
|
156
|
+
* @param tokenIn The address of the input token
|
|
157
|
+
* @param tokenOut The address of the output token
|
|
158
|
+
* @param amountOut The desired amount of output token
|
|
159
|
+
* @returns The required amount of input token as a string
|
|
160
|
+
*/
|
|
161
|
+
async getAmountIn(tokenIn, tokenOut, amountOut) {
|
|
162
|
+
return this.swapService.getAmountIn(tokenIn, tokenOut, amountOut);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Estimate the gas needed for a swap transaction.
|
|
166
|
+
*
|
|
167
|
+
* @param methodName The method to call ('swapIn' or 'swapOut')
|
|
168
|
+
* @param args The arguments for the method
|
|
169
|
+
* @returns The estimated gas as a string
|
|
170
|
+
*/
|
|
171
|
+
async estimateGas(methodName, args) {
|
|
172
|
+
return this.swapService.estimateGas(methodName, args);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Calculate the price impact of a swap as a percentage.
|
|
176
|
+
*
|
|
177
|
+
* @param tokenIn The address of the input token
|
|
178
|
+
* @param tokenOut The address of the output token
|
|
179
|
+
* @param amountIn The amount of input token
|
|
180
|
+
* @param amountOut The expected amount of output token
|
|
181
|
+
* @returns The price impact as a percentage string (e.g., "0.5" for 0.5%)
|
|
182
|
+
*/
|
|
183
|
+
async calculatePriceImpact(tokenIn, tokenOut, amountIn, amountOut) {
|
|
184
|
+
return this.swapService.calculatePriceImpact(tokenIn, tokenOut, amountIn, amountOut);
|
|
185
|
+
}
|
|
114
186
|
}
|
|
115
187
|
exports.Mento = Mento;
|
|
116
188
|
__exportStar(require("./constants"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,yCAAwE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,yCAAwE;AASxE,yCAAoF;AAEpF,qDAAiD;AAsBjD,+CAA+C;AAC/C,SAAS,kBAAkB,CACzB,QAA2B;IAE3B,0DAA0D;IAC1D,OAAO,CACL,YAAY,IAAI,QAAQ;QACxB,UAAU,IAAI,QAAQ;QACtB,gCAAgC;QAChC,WAAW,IAAI,QAAQ,CACxB,CAAA;AACH,CAAC;AAED,+CAA+C;AAC/C,SAAS,kBAAkB,CACzB,QAA2B;IAE3B,0DAA0D;IAC1D,OAAO,CACL,YAAY,IAAI,QAAQ;QACxB,sBAAsB;QACtB,sBAAsB,IAAI,QA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C3E,OAAO,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IACnE,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,WAAW,CAAC,OAAe,EAAE,QAAgB,EAAE,SAAiB;QAC3E,OAAO,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAA;IACnE,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,WAAW,CACtB,UAAgC,EAChC,IAAsC;QAEtC,OAAO,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;IACvD,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CAAC,oBAAoB,CAC/B,OAAe,EACf,QAAgB,EAChB,QAAgB,EAChB,SAAiB;QAEjB,OAAO,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAA;IACtF,CAAC;CACF;AAhKD,sBAgKC;AAED,8CAA2B;AAC3B,0CAAuB;AACvB,6CAA0B;AAC1B,6CAA0B;AAC1B,yCAAsB;AACtB,0CAAuB"}
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA"}
|
package/dist/services/index.js
CHANGED
|
@@ -18,5 +18,6 @@ __exportStar(require("./collateralAssetService"), exports);
|
|
|
18
18
|
__exportStar(require("./stableTokenService"), exports);
|
|
19
19
|
__exportStar(require("./supplyAdjustmentService"), exports);
|
|
20
20
|
__exportStar(require("./tokenMetadataService"), exports);
|
|
21
|
+
__exportStar(require("./swapService"), exports);
|
|
21
22
|
__exportStar(require("./supply"), exports);
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAwC;AACxC,uDAAoC;AACpC,4DAAyC;AACzC,yDAAsC;AACtC,2CAAwB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAwC;AACxC,uDAAoC;AACpC,4DAAyC;AACzC,yDAAsC;AACtC,gDAA6B;AAC7B,2CAAwB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ProviderAdapter, TransactionResponse, ContractWriteOptions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* SwapService provides methods for exchanging tokens through the Mento Protocol.
|
|
4
|
+
*
|
|
5
|
+
* This service handles all interactions with the Broker contract and provides
|
|
6
|
+
* methods for swapping tokens and estimating exchange rates.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SwapService {
|
|
9
|
+
private provider;
|
|
10
|
+
constructor(provider: ProviderAdapter);
|
|
11
|
+
/**
|
|
12
|
+
* Swap a specified amount of collateral token for stable token.
|
|
13
|
+
*
|
|
14
|
+
* @param tokenIn The address of the input token (collateral token)
|
|
15
|
+
* @param tokenOut The address of the output token (stable token)
|
|
16
|
+
* @param amountIn The amount of input token to swap
|
|
17
|
+
* @param minAmountOut The minimum amount of output token to receive (for slippage protection)
|
|
18
|
+
* @param options Optional parameters for the transaction (gas settings)
|
|
19
|
+
* @returns A transaction response object
|
|
20
|
+
*/
|
|
21
|
+
swapIn(tokenIn: string, tokenOut: string, amountIn: string, minAmountOut: string, options?: Omit<ContractWriteOptions, 'address' | 'abi' | 'functionName' | 'args'>): Promise<TransactionResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Swap collateral token for a specified amount of stable token.
|
|
24
|
+
*
|
|
25
|
+
* @param tokenIn The address of the input token (collateral token)
|
|
26
|
+
* @param tokenOut The address of the output token (stable token)
|
|
27
|
+
* @param amountOut The exact amount of output token to receive
|
|
28
|
+
* @param maxAmountIn The maximum amount of input token to spend (for slippage protection)
|
|
29
|
+
* @param options Optional parameters for the transaction (gas settings)
|
|
30
|
+
* @returns A transaction response object
|
|
31
|
+
*/
|
|
32
|
+
swapOut(tokenIn: string, tokenOut: string, amountOut: string, maxAmountIn: string, options?: Omit<ContractWriteOptions, 'address' | 'abi' | 'functionName' | 'args'>): Promise<TransactionResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* Calculate the amount of output token that would be received for a given input amount.
|
|
35
|
+
*
|
|
36
|
+
* @param tokenIn The address of the input token
|
|
37
|
+
* @param tokenOut The address of the output token
|
|
38
|
+
* @param amountIn The amount of input token
|
|
39
|
+
* @returns The expected amount of output token as a string
|
|
40
|
+
*/
|
|
41
|
+
getAmountOut(tokenIn: string, tokenOut: string, amountIn: string): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Calculate the amount of input token required to receive a given output amount.
|
|
44
|
+
*
|
|
45
|
+
* @param tokenIn The address of the input token
|
|
46
|
+
* @param tokenOut The address of the output token
|
|
47
|
+
* @param amountOut The desired amount of output token
|
|
48
|
+
* @returns The required amount of input token as a string
|
|
49
|
+
*/
|
|
50
|
+
getAmountIn(tokenIn: string, tokenOut: string, amountOut: string): Promise<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Estimate the gas needed for a swap transaction.
|
|
53
|
+
*
|
|
54
|
+
* @param methodName The method to call ('swapIn' or 'swapOut')
|
|
55
|
+
* @param args The arguments for the method
|
|
56
|
+
* @returns The estimated gas as a string
|
|
57
|
+
*/
|
|
58
|
+
estimateGas(methodName: 'swapIn' | 'swapOut', args: [string, string, string, string]): Promise<string>;
|
|
59
|
+
/**
|
|
60
|
+
* Calculate the price impact of a swap as a percentage.
|
|
61
|
+
*
|
|
62
|
+
* @param tokenIn The address of the input token
|
|
63
|
+
* @param tokenOut The address of the output token
|
|
64
|
+
* @param amountIn The amount of input token
|
|
65
|
+
* @param amountOut The expected amount of output token
|
|
66
|
+
* @returns The price impact as a percentage string (e.g., "0.5" for 0.5%)
|
|
67
|
+
*/
|
|
68
|
+
calculatePriceImpact(tokenIn: string, tokenOut: string, amountIn: string, amountOut: string): Promise<string>;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=swapService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swapService.d.ts","sourceRoot":"","sources":["../../src/services/swapService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAGrF;;;;;GAKG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,eAAe;IAE7C;;;;;;;;;OASG;IACG,MAAM,CACV,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,GAAG,KAAK,GAAG,cAAc,GAAG,MAAM,CAAM,GACpF,OAAO,CAAC,mBAAmB,CAAC;IAa/B;;;;;;;;;OASG;IACG,OAAO,CACX,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,GAAG,KAAK,GAAG,cAAc,GAAG,MAAM,CAAM,GACpF,OAAO,CAAC,mBAAmB,CAAC;IAa/B;;;;;;;OAOG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAgBxF;;;;;;;OAOG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAgBxF;;;;;;OAMG;IACG,WAAW,CACf,UAAU,EAAE,QAAQ,GAAG,SAAS,EAChC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GACrC,OAAO,CAAC,MAAM,CAAC;IAgBlB;;;;;;;;OAQG;IACG,oBAAoB,CACxB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC;CASnB"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwapService = void 0;
|
|
4
|
+
const abis_1 = require("../abis");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
/**
|
|
8
|
+
* SwapService provides methods for exchanging tokens through the Mento Protocol.
|
|
9
|
+
*
|
|
10
|
+
* This service handles all interactions with the Broker contract and provides
|
|
11
|
+
* methods for swapping tokens and estimating exchange rates.
|
|
12
|
+
*/
|
|
13
|
+
class SwapService {
|
|
14
|
+
constructor(provider) {
|
|
15
|
+
this.provider = provider;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Swap a specified amount of collateral token for stable token.
|
|
19
|
+
*
|
|
20
|
+
* @param tokenIn The address of the input token (collateral token)
|
|
21
|
+
* @param tokenOut The address of the output token (stable token)
|
|
22
|
+
* @param amountIn The amount of input token to swap
|
|
23
|
+
* @param minAmountOut The minimum amount of output token to receive (for slippage protection)
|
|
24
|
+
* @param options Optional parameters for the transaction (gas settings)
|
|
25
|
+
* @returns A transaction response object
|
|
26
|
+
*/
|
|
27
|
+
async swapIn(tokenIn, tokenOut, amountIn, minAmountOut, options = {}) {
|
|
28
|
+
const chainId = await this.provider.getChainId();
|
|
29
|
+
const brokerAddress = (0, constants_1.getContractAddress)(chainId, constants_1.BROKER);
|
|
30
|
+
return this.provider.writeContract({
|
|
31
|
+
address: brokerAddress,
|
|
32
|
+
abi: abis_1.BROKER_ABI,
|
|
33
|
+
functionName: 'swapIn',
|
|
34
|
+
args: [tokenIn, tokenOut, amountIn, minAmountOut],
|
|
35
|
+
...options
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Swap collateral token for a specified amount of stable token.
|
|
40
|
+
*
|
|
41
|
+
* @param tokenIn The address of the input token (collateral token)
|
|
42
|
+
* @param tokenOut The address of the output token (stable token)
|
|
43
|
+
* @param amountOut The exact amount of output token to receive
|
|
44
|
+
* @param maxAmountIn The maximum amount of input token to spend (for slippage protection)
|
|
45
|
+
* @param options Optional parameters for the transaction (gas settings)
|
|
46
|
+
* @returns A transaction response object
|
|
47
|
+
*/
|
|
48
|
+
async swapOut(tokenIn, tokenOut, amountOut, maxAmountIn, options = {}) {
|
|
49
|
+
const chainId = await this.provider.getChainId();
|
|
50
|
+
const brokerAddress = (0, constants_1.getContractAddress)(chainId, constants_1.BROKER);
|
|
51
|
+
return this.provider.writeContract({
|
|
52
|
+
address: brokerAddress,
|
|
53
|
+
abi: abis_1.BROKER_ABI,
|
|
54
|
+
functionName: 'swapOut',
|
|
55
|
+
args: [tokenIn, tokenOut, amountOut, maxAmountIn],
|
|
56
|
+
...options
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Calculate the amount of output token that would be received for a given input amount.
|
|
61
|
+
*
|
|
62
|
+
* @param tokenIn The address of the input token
|
|
63
|
+
* @param tokenOut The address of the output token
|
|
64
|
+
* @param amountIn The amount of input token
|
|
65
|
+
* @returns The expected amount of output token as a string
|
|
66
|
+
*/
|
|
67
|
+
async getAmountOut(tokenIn, tokenOut, amountIn) {
|
|
68
|
+
const chainId = await this.provider.getChainId();
|
|
69
|
+
const brokerAddress = (0, constants_1.getContractAddress)(chainId, constants_1.BROKER);
|
|
70
|
+
const result = await (0, utils_1.retryOperation)(() => this.provider.readContract({
|
|
71
|
+
address: brokerAddress,
|
|
72
|
+
abi: abis_1.BROKER_ABI,
|
|
73
|
+
functionName: 'getAmountOut',
|
|
74
|
+
args: [tokenIn, tokenOut, amountIn]
|
|
75
|
+
}));
|
|
76
|
+
return result.toString();
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Calculate the amount of input token required to receive a given output amount.
|
|
80
|
+
*
|
|
81
|
+
* @param tokenIn The address of the input token
|
|
82
|
+
* @param tokenOut The address of the output token
|
|
83
|
+
* @param amountOut The desired amount of output token
|
|
84
|
+
* @returns The required amount of input token as a string
|
|
85
|
+
*/
|
|
86
|
+
async getAmountIn(tokenIn, tokenOut, amountOut) {
|
|
87
|
+
const chainId = await this.provider.getChainId();
|
|
88
|
+
const brokerAddress = (0, constants_1.getContractAddress)(chainId, constants_1.BROKER);
|
|
89
|
+
const result = await (0, utils_1.retryOperation)(() => this.provider.readContract({
|
|
90
|
+
address: brokerAddress,
|
|
91
|
+
abi: abis_1.BROKER_ABI,
|
|
92
|
+
functionName: 'getAmountIn',
|
|
93
|
+
args: [tokenIn, tokenOut, amountOut]
|
|
94
|
+
}));
|
|
95
|
+
return result.toString();
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Estimate the gas needed for a swap transaction.
|
|
99
|
+
*
|
|
100
|
+
* @param methodName The method to call ('swapIn' or 'swapOut')
|
|
101
|
+
* @param args The arguments for the method
|
|
102
|
+
* @returns The estimated gas as a string
|
|
103
|
+
*/
|
|
104
|
+
async estimateGas(methodName, args) {
|
|
105
|
+
const chainId = await this.provider.getChainId();
|
|
106
|
+
const brokerAddress = (0, constants_1.getContractAddress)(chainId, constants_1.BROKER);
|
|
107
|
+
// For now we'll just return a reasonable default gas limit since the actual
|
|
108
|
+
// gas estimation would depend on provider specifics that aren't in the interface
|
|
109
|
+
// In a real implementation, this would interact with provider-specific gas estimation
|
|
110
|
+
// Default values based on method type
|
|
111
|
+
const defaultGas = methodName === 'swapIn' ? '300000' : '350000';
|
|
112
|
+
// TODO: Implement actual gas estimation when provider adapters support it
|
|
113
|
+
return defaultGas;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Calculate the price impact of a swap as a percentage.
|
|
117
|
+
*
|
|
118
|
+
* @param tokenIn The address of the input token
|
|
119
|
+
* @param tokenOut The address of the output token
|
|
120
|
+
* @param amountIn The amount of input token
|
|
121
|
+
* @param amountOut The expected amount of output token
|
|
122
|
+
* @returns The price impact as a percentage string (e.g., "0.5" for 0.5%)
|
|
123
|
+
*/
|
|
124
|
+
async calculatePriceImpact(tokenIn, tokenOut, amountIn, amountOut) {
|
|
125
|
+
// This is a simplified implementation. In a real-world scenario,
|
|
126
|
+
// you would typically compare the execution price to a reference price
|
|
127
|
+
// from an oracle or a small test amount.
|
|
128
|
+
// For now, we'll just return a placeholder
|
|
129
|
+
// TODO: Implement actual price impact calculation
|
|
130
|
+
return "0.5";
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.SwapService = SwapService;
|
|
134
|
+
//# sourceMappingURL=swapService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swapService.js","sourceRoot":"","sources":["../../src/services/swapService.ts"],"names":[],"mappings":";;;AAAA,kCAAoC;AACpC,4CAAyD;AAEzD,oCAAyC;AAEzC;;;;;GAKG;AACH,MAAa,WAAW;IACtB,YAAoB,QAA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