@underscore-finance/sdk 0.3.5 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contracts/AaveV3.d.ts +2120 -0
- package/dist/contracts/AaveV3.d.ts.map +1 -0
- package/dist/contracts/AaveV3.js +2714 -0
- package/dist/contracts/AeroClassic.d.ts +2017 -0
- package/dist/contracts/AeroClassic.d.ts.map +1 -0
- package/dist/contracts/AeroClassic.js +2567 -0
- package/dist/contracts/AeroSlipstream.d.ts +2113 -0
- package/dist/contracts/AeroSlipstream.d.ts.map +1 -0
- package/dist/contracts/AeroSlipstream.js +2692 -0
- package/dist/contracts/Agent.d.ts +2189 -1138
- package/dist/contracts/Agent.d.ts.map +1 -1
- package/dist/contracts/Agent.js +2807 -1343
- package/dist/contracts/AgentWrapper.d.ts +3760 -0
- package/dist/contracts/AgentWrapper.d.ts.map +1 -0
- package/dist/contracts/AgentWrapper.js +4922 -0
- package/dist/contracts/Appraiser.d.ts +997 -0
- package/dist/contracts/Appraiser.d.ts.map +1 -0
- package/dist/contracts/Appraiser.js +1285 -0
- package/dist/contracts/Billing.d.ts +420 -0
- package/dist/contracts/Billing.d.ts.map +1 -0
- package/dist/contracts/Billing.js +506 -0
- package/dist/contracts/ChequeBook.d.ts +1184 -0
- package/dist/contracts/ChequeBook.d.ts.map +1 -0
- package/dist/contracts/ChequeBook.js +1352 -0
- package/dist/contracts/CompoundV3.d.ts +2158 -0
- package/dist/contracts/CompoundV3.d.ts.map +1 -0
- package/dist/contracts/CompoundV3.js +2764 -0
- package/dist/contracts/Curve.d.ts +1077 -0
- package/dist/contracts/Curve.d.ts.map +1 -0
- package/dist/contracts/Curve.js +1357 -0
- package/dist/contracts/DefaultsBase.d.ts +290 -0
- package/dist/contracts/DefaultsBase.d.ts.map +1 -0
- package/dist/contracts/DefaultsBase.js +316 -0
- package/dist/contracts/Euler.d.ts +2172 -0
- package/dist/contracts/Euler.d.ts.map +1 -0
- package/dist/contracts/Euler.js +2782 -0
- package/dist/contracts/Fluid.d.ts +2106 -0
- package/dist/contracts/Fluid.d.ts.map +1 -0
- package/dist/contracts/Fluid.js +2696 -0
- package/dist/contracts/Hatchery.d.ts +541 -0
- package/dist/contracts/Hatchery.d.ts.map +1 -0
- package/dist/contracts/Hatchery.js +671 -0
- package/dist/contracts/HighCommand.d.ts +1868 -0
- package/dist/contracts/HighCommand.d.ts.map +1 -0
- package/dist/contracts/HighCommand.js +2149 -0
- package/dist/contracts/Kernel.d.ts +354 -0
- package/dist/contracts/Kernel.d.ts.map +1 -0
- package/dist/contracts/Kernel.js +412 -0
- package/dist/contracts/Ledger.d.ts +694 -0
- package/dist/contracts/Ledger.d.ts.map +1 -0
- package/dist/contracts/Ledger.js +834 -0
- package/dist/contracts/LegoBook.d.ts +1424 -0
- package/dist/contracts/LegoBook.d.ts.map +1 -0
- package/dist/contracts/LegoBook.js +1783 -0
- package/dist/contracts/LegoTools.d.ts +1898 -0
- package/dist/contracts/LegoTools.d.ts.map +1 -0
- package/dist/contracts/LegoTools.js +2378 -0
- package/dist/contracts/LegoUniswapV0_2.d.ts +1204 -0
- package/dist/contracts/LegoUniswapV0_2.d.ts.map +1 -0
- package/dist/contracts/LegoUniswapV0_2.js +1546 -0
- package/dist/contracts/LootDistributor.d.ts +996 -0
- package/dist/contracts/LootDistributor.d.ts.map +1 -0
- package/dist/contracts/LootDistributor.js +1255 -0
- package/dist/contracts/Migrator.d.ts +268 -0
- package/dist/contracts/Migrator.d.ts.map +1 -0
- package/dist/contracts/Migrator.js +324 -0
- package/dist/contracts/MissionControl.d.ts +1331 -0
- package/dist/contracts/MissionControl.d.ts.map +1 -0
- package/dist/contracts/MissionControl.js +1485 -0
- package/dist/contracts/Moonwell.d.ts +2137 -0
- package/dist/contracts/Moonwell.d.ts.map +1 -0
- package/dist/contracts/Moonwell.js +2737 -0
- package/dist/contracts/Morpho.d.ts +2172 -0
- package/dist/contracts/Morpho.d.ts.map +1 -0
- package/dist/contracts/Morpho.js +2782 -0
- package/dist/contracts/Paymaster.d.ts +1679 -0
- package/dist/contracts/Paymaster.d.ts.map +1 -0
- package/dist/contracts/Paymaster.js +2077 -0
- package/dist/contracts/RipeLego.d.ts +2263 -0
- package/dist/contracts/RipeLego.d.ts.map +1 -0
- package/dist/contracts/RipeLego.js +2891 -0
- package/dist/contracts/Sentinel.d.ts +1804 -0
- package/dist/contracts/Sentinel.d.ts.map +1 -0
- package/dist/contracts/Sentinel.js +2152 -0
- package/dist/contracts/Switchboard.d.ts +1395 -0
- package/dist/contracts/Switchboard.d.ts.map +1 -0
- package/dist/contracts/Switchboard.js +1746 -0
- package/dist/contracts/SwitchboardAlpha.d.ts +2228 -0
- package/dist/contracts/SwitchboardAlpha.d.ts.map +1 -0
- package/dist/contracts/SwitchboardAlpha.js +2743 -0
- package/dist/contracts/SwitchboardBravo.d.ts +1498 -0
- package/dist/contracts/SwitchboardBravo.d.ts.map +1 -0
- package/dist/contracts/SwitchboardBravo.js +1855 -0
- package/dist/contracts/UndyHq.d.ts +1580 -0
- package/dist/contracts/UndyHq.d.ts.map +1 -0
- package/dist/contracts/UndyHq.js +1986 -0
- package/dist/contracts/UniswapV2.d.ts +2017 -0
- package/dist/contracts/UniswapV2.d.ts.map +1 -0
- package/dist/contracts/UniswapV2.js +2567 -0
- package/dist/contracts/UniswapV3.d.ts +2113 -0
- package/dist/contracts/UniswapV3.d.ts.map +1 -0
- package/dist/contracts/UniswapV3.js +2692 -0
- package/dist/contracts/UserWallet.d.ts +1438 -784
- package/dist/contracts/UserWallet.d.ts.map +1 -1
- package/dist/contracts/UserWallet.js +1854 -935
- package/dist/contracts/UserWalletConfig.d.ts +3034 -1231
- package/dist/contracts/UserWalletConfig.d.ts.map +1 -1
- package/dist/contracts/UserWalletConfig.js +3395 -1407
- package/dist/contracts/WalletBackpack.d.ts +1183 -0
- package/dist/contracts/WalletBackpack.d.ts.map +1 -0
- package/dist/contracts/WalletBackpack.js +1484 -0
- package/dist/contracts/index.d.ts +33 -36
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +33 -36
- package/dist/contracts/sdk.d.ts +66 -72
- package/dist/contracts/sdk.d.ts.map +1 -1
- package/dist/contracts/sdk.js +66 -72
- package/dist/contracts/v0_1_AddyRegistry.d.ts +473 -0
- package/dist/contracts/v0_1_AddyRegistry.d.ts.map +1 -0
- package/dist/contracts/v0_1_AddyRegistry.js +594 -0
- package/dist/contracts/v0_1_Agent.d.ts +2631 -0
- package/dist/contracts/v0_1_Agent.d.ts.map +1 -0
- package/dist/contracts/v0_1_Agent.js +3372 -0
- package/dist/contracts/v0_1_AgentFactory.d.ts +1054 -0
- package/dist/contracts/v0_1_AgentFactory.d.ts.map +1 -0
- package/dist/contracts/v0_1_AgentFactory.js +1336 -0
- package/dist/contracts/v0_1_UserWallet.d.ts +1980 -0
- package/dist/contracts/v0_1_UserWallet.d.ts.map +1 -0
- package/dist/contracts/v0_1_UserWallet.js +2581 -0
- package/dist/contracts/v0_1_UserWalletConfig.d.ts +1400 -0
- package/dist/contracts/v0_1_UserWalletConfig.d.ts.map +1 -0
- package/dist/contracts/v0_1_UserWalletConfig.js +1676 -0
- package/dist/contracts/v0_2_AddyRegistry.d.ts +1050 -0
- package/dist/contracts/v0_2_AddyRegistry.d.ts.map +1 -0
- package/dist/contracts/v0_2_AddyRegistry.js +1313 -0
- package/dist/contracts/v0_2_Agent.d.ts +2709 -0
- package/dist/contracts/v0_2_Agent.d.ts.map +1 -0
- package/dist/contracts/v0_2_Agent.js +3458 -0
- package/dist/contracts/v0_2_AgentFactory.d.ts +1275 -0
- package/dist/contracts/v0_2_AgentFactory.d.ts.map +1 -0
- package/dist/contracts/v0_2_AgentFactory.js +1609 -0
- package/dist/contracts/v0_2_UserWallet.d.ts +1958 -0
- package/dist/contracts/v0_2_UserWallet.d.ts.map +1 -0
- package/dist/contracts/v0_2_UserWallet.js +2553 -0
- package/dist/contracts/v0_2_UserWalletConfig.d.ts +1468 -0
- package/dist/contracts/v0_2_UserWalletConfig.d.ts.map +1 -0
- package/dist/contracts/v0_2_UserWalletConfig.js +1764 -0
- package/dist/contracts/v0_3_AddyRegistry.d.ts +1109 -0
- package/dist/contracts/v0_3_AddyRegistry.d.ts.map +1 -0
- package/dist/contracts/v0_3_AddyRegistry.js +1392 -0
- package/dist/contracts/v0_3_Agent.d.ts +2709 -0
- package/dist/contracts/v0_3_Agent.d.ts.map +1 -0
- package/dist/contracts/v0_3_Agent.js +3458 -0
- package/dist/contracts/v0_3_AgentFactory.d.ts +1665 -0
- package/dist/contracts/v0_3_AgentFactory.d.ts.map +1 -0
- package/dist/contracts/v0_3_AgentFactory.js +2078 -0
- package/dist/contracts/v0_3_ChainlinkFeeds.d.ts +706 -0
- package/dist/contracts/v0_3_ChainlinkFeeds.d.ts.map +1 -0
- package/dist/contracts/v0_3_ChainlinkFeeds.js +900 -0
- package/dist/contracts/v0_3_LegoAaveV3.d.ts +1033 -0
- package/dist/contracts/v0_3_LegoAaveV3.d.ts.map +1 -0
- package/dist/contracts/v0_3_LegoAaveV3.js +1330 -0
- package/dist/contracts/v0_3_LegoAeroClassic.d.ts +1204 -0
- package/dist/contracts/v0_3_LegoAeroClassic.d.ts.map +1 -0
- package/dist/contracts/v0_3_LegoAeroClassic.js +1546 -0
- package/dist/contracts/v0_3_LegoAeroSlipstream.d.ts +1300 -0
- package/dist/contracts/v0_3_LegoAeroSlipstream.d.ts.map +1 -0
- package/dist/contracts/v0_3_LegoAeroSlipstream.js +1671 -0
- package/dist/contracts/v0_3_LegoCommon.d.ts +164 -0
- package/dist/contracts/v0_3_LegoCommon.d.ts.map +1 -0
- package/dist/contracts/v0_3_LegoCommon.js +202 -0
- package/dist/contracts/v0_3_LegoCompoundV3.d.ts +1060 -0
- package/dist/contracts/v0_3_LegoCompoundV3.d.ts.map +1 -0
- package/dist/contracts/v0_3_LegoCompoundV3.js +1365 -0
- package/dist/contracts/v0_3_LegoCredit.d.ts +140 -0
- package/dist/contracts/v0_3_LegoCredit.d.ts.map +1 -0
- package/dist/contracts/v0_3_LegoCredit.js +179 -0
- package/dist/contracts/v0_3_LegoCurve.d.ts +1189 -0
- package/dist/contracts/v0_3_LegoCurve.d.ts.map +1 -0
- package/dist/contracts/v0_3_LegoCurve.js +1519 -0
- package/dist/contracts/v0_3_LegoDex.d.ts +587 -0
- package/dist/contracts/v0_3_LegoDex.d.ts.map +1 -0
- package/dist/contracts/v0_3_LegoDex.js +774 -0
- package/dist/contracts/v0_3_LegoEuler.d.ts +1074 -0
- package/dist/contracts/v0_3_LegoEuler.d.ts.map +1 -0
- package/dist/contracts/v0_3_LegoEuler.js +1383 -0
- package/dist/contracts/v0_3_LegoFluid.d.ts +1025 -0
- package/dist/contracts/v0_3_LegoFluid.d.ts.map +1 -0
- package/dist/contracts/v0_3_LegoFluid.js +1320 -0
- package/dist/contracts/v0_3_LegoHelper.d.ts +1563 -0
- package/dist/contracts/v0_3_LegoHelper.d.ts.map +1 -0
- package/dist/contracts/v0_3_LegoHelper.js +1947 -0
- package/dist/contracts/v0_3_LegoMoonwell.d.ts +1042 -0
- package/dist/contracts/v0_3_LegoMoonwell.d.ts.map +1 -0
- package/dist/contracts/v0_3_LegoMoonwell.js +1342 -0
- package/dist/contracts/v0_3_LegoMorpho.d.ts +1074 -0
- package/dist/contracts/v0_3_LegoMorpho.d.ts.map +1 -0
- package/dist/contracts/v0_3_LegoMorpho.js +1383 -0
- package/dist/contracts/v0_3_LegoRegistry.d.ts +1079 -0
- package/dist/contracts/v0_3_LegoRegistry.d.ts.map +1 -0
- package/dist/contracts/v0_3_LegoRegistry.js +1368 -0
- package/dist/contracts/v0_3_LegoSky.d.ts +923 -0
- package/dist/contracts/v0_3_LegoSky.d.ts.map +1 -0
- package/dist/contracts/v0_3_LegoSky.js +1180 -0
- package/dist/contracts/v0_3_LegoUniswapV3.d.ts +1338 -0
- package/dist/contracts/v0_3_LegoUniswapV3.d.ts.map +1 -0
- package/dist/contracts/v0_3_LegoUniswapV3.js +1718 -0
- package/dist/contracts/v0_3_LegoYield.d.ts +390 -0
- package/dist/contracts/v0_3_LegoYield.d.ts.map +1 -0
- package/dist/contracts/v0_3_LegoYield.js +511 -0
- package/dist/contracts/v0_3_OracleParser.d.ts +207 -0
- package/dist/contracts/v0_3_OracleParser.d.ts.map +1 -0
- package/dist/contracts/v0_3_OracleParser.js +264 -0
- package/dist/contracts/v0_3_OracleRegistry.d.ts +1221 -0
- package/dist/contracts/v0_3_OracleRegistry.d.ts.map +1 -0
- package/dist/contracts/v0_3_OracleRegistry.js +1562 -0
- package/dist/contracts/v0_3_PriceSheets.d.ts +1127 -0
- package/dist/contracts/v0_3_PriceSheets.d.ts.map +1 -0
- package/dist/contracts/v0_3_PriceSheets.js +1383 -0
- package/dist/contracts/v0_3_PythFeeds.d.ts +640 -0
- package/dist/contracts/v0_3_PythFeeds.d.ts.map +1 -0
- package/dist/contracts/v0_3_PythFeeds.js +813 -0
- package/dist/contracts/v0_3_StorkFeeds.d.ts +640 -0
- package/dist/contracts/v0_3_StorkFeeds.d.ts.map +1 -0
- package/dist/contracts/v0_3_StorkFeeds.js +813 -0
- package/dist/contracts/v0_3_UserWallet.d.ts +1975 -0
- package/dist/contracts/v0_3_UserWallet.d.ts.map +1 -0
- package/dist/contracts/v0_3_UserWallet.js +2577 -0
- package/dist/contracts/v0_3_UserWalletConfig.d.ts +1852 -0
- package/dist/contracts/v0_3_UserWalletConfig.d.ts.map +1 -0
- package/dist/contracts/v0_3_UserWalletConfig.js +2263 -0
- package/dist/getContracts.d.ts +75 -0
- package/dist/getContracts.d.ts.map +1 -0
- package/dist/getContracts.js +62 -0
- package/dist/getLegacyContracts.d.ts +69 -0
- package/dist/getLegacyContracts.d.ts.map +1 -0
- package/dist/getLegacyContracts.js +55 -0
- package/dist/getSwapInstructions.d.ts +33 -0
- package/dist/getSwapInstructions.d.ts.map +1 -0
- package/dist/getSwapInstructions.js +21 -0
- package/dist/index.d.ts +3 -475
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -182
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,209 +1,35 @@
|
|
|
1
1
|
import { iteratorQuery, query } from '@dappql/async';
|
|
2
2
|
import { createPublicClient, http } from 'viem';
|
|
3
|
-
import { base
|
|
3
|
+
import { base } from 'viem/chains';
|
|
4
4
|
import * as CONTRACTS from './contracts/index.js';
|
|
5
|
-
import
|
|
6
|
-
import createSdk from './contracts/sdk.js';
|
|
5
|
+
import getContracts from './getContracts.js';
|
|
7
6
|
export * from './contracts/index.js';
|
|
8
|
-
const TESTNET_ADDRESSES = {
|
|
9
|
-
AddyRegistry: '0xa89a59E14333187829528C50eBAaE6EC12Bae95d',
|
|
10
|
-
AgentFactory: '0x50d08c554b0F7F4784B7108103e586eccb522b8E',
|
|
11
|
-
UserWalletTemplate: '0x5081a0ff1F3518aE7D3c6E5106CC820EB5d472a5',
|
|
12
|
-
UserWalletConfigTemplate: '0xC12152418FDF2daE2A45C3D07AdFf9f6f1249BbA',
|
|
13
|
-
AgentTemplate: '0xfd1255e086b0E045EfBFa9E3e99aE9A450BDc486',
|
|
14
|
-
LegoRegistry: '0xf6a8bE55c84b94Fe071575EF52F095A23c282eea',
|
|
15
|
-
OracleRegistry: '0x2c794b3864480fAfF791cD46400E061f818cE42f',
|
|
16
|
-
PriceSheets: '0x155d0ECd672D7a1050d34eC0a1006d67823C3123',
|
|
17
|
-
LegoHelper: '0x98dD9D8591D826E285052f23F450c8d702f07a18',
|
|
18
|
-
};
|
|
19
7
|
class Underscore {
|
|
20
8
|
constructor(config) {
|
|
21
9
|
this.publicClient =
|
|
22
10
|
config?.publicClient ||
|
|
23
11
|
createPublicClient({
|
|
24
|
-
chain:
|
|
12
|
+
chain: base,
|
|
25
13
|
transport: http(config?.rpcUrl),
|
|
26
14
|
});
|
|
27
15
|
this.walletClient = config?.walletClient;
|
|
28
|
-
this.contracts =
|
|
29
|
-
this.isTestnet = config?.isTestnet ?? false;
|
|
16
|
+
this.contracts = getContracts(this.publicClient, this.walletClient);
|
|
30
17
|
}
|
|
31
18
|
setWalletClient(walletClient) {
|
|
32
19
|
this.walletClient = walletClient;
|
|
33
|
-
this.contracts =
|
|
20
|
+
this.contracts = getContracts(this.publicClient, this.walletClient);
|
|
34
21
|
}
|
|
35
22
|
setPublicClient(publicClient) {
|
|
36
23
|
this.publicClient = publicClient;
|
|
37
|
-
this.contracts =
|
|
38
|
-
}
|
|
39
|
-
async getSwapInstructionsAmountOut(payload) {
|
|
40
|
-
const { tokenIn, tokenOut, amountIn, slippage, includeLegoIds } = payload;
|
|
41
|
-
const instructions = await this.publicClient.simulateContract({
|
|
42
|
-
address: this.LegoHelper.deployAddress,
|
|
43
|
-
abi: LegoHelper.abi,
|
|
44
|
-
functionName: 'getRoutesAndSwapInstructionsAmountOut',
|
|
45
|
-
args: [tokenIn, tokenOut, amountIn, slippage, includeLegoIds ?? []],
|
|
46
|
-
});
|
|
47
|
-
return instructions.result;
|
|
48
|
-
}
|
|
49
|
-
async getSwapInstructionsAmountIn(payload) {
|
|
50
|
-
const { tokenIn, tokenOut, amountOut, amountInAvailable, slippage, includeLegoIds } = payload;
|
|
51
|
-
const instructions = await this.publicClient.simulateContract({
|
|
52
|
-
address: this.LegoHelper.deployAddress,
|
|
53
|
-
abi: LegoHelper.abi,
|
|
54
|
-
functionName: 'getRoutesAndSwapInstructionsAmountIn',
|
|
55
|
-
args: [tokenIn, tokenOut, amountOut, amountInAvailable, slippage, includeLegoIds ?? []],
|
|
56
|
-
});
|
|
57
|
-
return instructions.result;
|
|
58
|
-
}
|
|
59
|
-
get AddyRegistry() {
|
|
60
|
-
const deployAddress = this.isTestnet ? TESTNET_ADDRESSES.AddyRegistry : CONTRACTS.AddyRegistry.deployAddress;
|
|
61
|
-
return {
|
|
62
|
-
...this.contracts.AddyRegistry(deployAddress),
|
|
63
|
-
deployAddress,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* @deprecated Use `Registry` instead. This version is for legacy compatibility.
|
|
68
|
-
*/
|
|
69
|
-
get AddyRegistry_v1() {
|
|
70
|
-
return this.contracts.AddyRegistry_v1;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* @deprecated Use `Registry` instead. This version is for legacy compatibility.
|
|
74
|
-
*/
|
|
75
|
-
get AddyRegistry_v2() {
|
|
76
|
-
return this.contracts.AddyRegistry_v2;
|
|
77
|
-
}
|
|
78
|
-
get AgentFactory() {
|
|
79
|
-
const deployAddress = this.isTestnet ? TESTNET_ADDRESSES.AgentFactory : CONTRACTS.AgentFactory.deployAddress;
|
|
80
|
-
return {
|
|
81
|
-
...this.contracts.AgentFactory(deployAddress),
|
|
82
|
-
deployAddress,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* @deprecated Use `Factory` instead. This version is for legacy compatibility.
|
|
87
|
-
*/
|
|
88
|
-
get AgentFactory_v2() {
|
|
89
|
-
return this.contracts.AgentFactory_v2;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* @deprecated Use `Factory` instead. This version is for legacy compatibility.
|
|
93
|
-
*/
|
|
94
|
-
get AgentFactory_v1() {
|
|
95
|
-
return this.contracts.AgentFactory_v1;
|
|
96
|
-
}
|
|
97
|
-
get OracleRegistry() {
|
|
98
|
-
const deployAddress = this.isTestnet ? TESTNET_ADDRESSES.OracleRegistry : CONTRACTS.OracleRegistry.deployAddress;
|
|
99
|
-
return {
|
|
100
|
-
...this.contracts.OracleRegistry(deployAddress),
|
|
101
|
-
deployAddress,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
get LegoRegistry() {
|
|
105
|
-
const deployAddress = this.isTestnet ? TESTNET_ADDRESSES.LegoRegistry : CONTRACTS.LegoRegistry.deployAddress;
|
|
106
|
-
return {
|
|
107
|
-
...this.contracts.LegoRegistry(deployAddress),
|
|
108
|
-
deployAddress,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
get LegoHelper() {
|
|
112
|
-
const deployAddress = this.isTestnet ? TESTNET_ADDRESSES.LegoHelper : LegoHelper.deployAddress;
|
|
113
|
-
return {
|
|
114
|
-
...this.contracts.LegoHelper(deployAddress),
|
|
115
|
-
deployAddress,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
get PriceSheets() {
|
|
119
|
-
const deployAddress = this.isTestnet ? TESTNET_ADDRESSES.PriceSheets : CONTRACTS.PriceSheets.deployAddress;
|
|
120
|
-
return {
|
|
121
|
-
...this.contracts.PriceSheets(deployAddress),
|
|
122
|
-
deployAddress,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
get Agent() {
|
|
126
|
-
return { at: (address) => this.contracts.Agent(address) };
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* @deprecated Use `Agent` instead. This version is for legacy compatibility.
|
|
130
|
-
*/
|
|
131
|
-
get Agent_v1() {
|
|
132
|
-
return { at: (address) => this.contracts.Agent_v1(address) };
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* @deprecated Use `Agent` instead. This version is for legacy compatibility.
|
|
136
|
-
*/
|
|
137
|
-
get Agent_v2() {
|
|
138
|
-
return { at: (address) => this.contracts.Agent_v2(address) };
|
|
139
|
-
}
|
|
140
|
-
get UserWallet() {
|
|
141
|
-
return { at: (address) => this.contracts.UserWallet(address) };
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* @deprecated Use `UserWallet` instead. This version is for legacy compatibility.
|
|
145
|
-
*/
|
|
146
|
-
get UserWallet_v1() {
|
|
147
|
-
return { at: (address) => this.contracts.UserWallet_v1(address) };
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* @deprecated Use `UserWallet` instead. This version is for legacy compatibility.
|
|
151
|
-
*/
|
|
152
|
-
get UserWallet_v2() {
|
|
153
|
-
return { at: (address) => this.contracts.UserWallet_v2(address) };
|
|
154
|
-
}
|
|
155
|
-
get UserWalletConfig() {
|
|
156
|
-
return { at: (address) => this.contracts.UserWalletConfig(address) };
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* @deprecated Use `UserWalletConfig` instead. This version is for legacy compatibility.
|
|
160
|
-
*/
|
|
161
|
-
get UserWalletConfig_v1() {
|
|
162
|
-
return { at: (address) => this.contracts.UserWalletConfig_v1(address) };
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* @deprecated Use `UserWalletConfig` instead. This version is for legacy compatibility.
|
|
166
|
-
*/
|
|
167
|
-
get UserWalletConfig_v2() {
|
|
168
|
-
return { at: (address) => this.contracts.UserWalletConfig_v2(address) };
|
|
169
|
-
}
|
|
170
|
-
get ERC20() {
|
|
171
|
-
return { at: (address) => this.contracts.ERC20(address) };
|
|
172
|
-
}
|
|
173
|
-
get LegoCommon() {
|
|
174
|
-
return { at: (address) => this.contracts.LegoCommon(address) };
|
|
175
|
-
}
|
|
176
|
-
get LegoCredit() {
|
|
177
|
-
return { at: (address) => this.contracts.LegoCredit(address) };
|
|
178
|
-
}
|
|
179
|
-
get LegoDex() {
|
|
180
|
-
return { at: (address) => this.contracts.LegoDex(address) };
|
|
181
|
-
}
|
|
182
|
-
get LegoYield() {
|
|
183
|
-
return { at: (address) => this.contracts.LegoYield(address) };
|
|
184
|
-
}
|
|
185
|
-
get OracleParser() {
|
|
186
|
-
return { at: (address) => this.contracts.OracleParser(address) };
|
|
187
|
-
}
|
|
188
|
-
get addressResolver() {
|
|
189
|
-
return (contractName) => {
|
|
190
|
-
if (this.isTestnet) {
|
|
191
|
-
const address = TESTNET_ADDRESSES[contractName];
|
|
192
|
-
if (!address) {
|
|
193
|
-
throw new Error(`Address for ${contractName} not found`);
|
|
194
|
-
}
|
|
195
|
-
return address;
|
|
196
|
-
}
|
|
197
|
-
return CONTRACTS[contractName].deployAddress;
|
|
198
|
-
};
|
|
24
|
+
this.contracts = getContracts(this.publicClient, this.walletClient);
|
|
199
25
|
}
|
|
200
26
|
async multicall(cb, options = {}) {
|
|
201
27
|
const request = cb(CONTRACTS);
|
|
202
|
-
return query(this.publicClient, request, options
|
|
28
|
+
return query(this.publicClient, request, options);
|
|
203
29
|
}
|
|
204
30
|
async iterate(cb, options = {}) {
|
|
205
31
|
const { total, getItem } = cb(CONTRACTS);
|
|
206
|
-
return iteratorQuery(this.publicClient, total, getItem, options
|
|
32
|
+
return iteratorQuery(this.publicClient, total, getItem, options);
|
|
207
33
|
}
|
|
208
34
|
}
|
|
209
35
|
export default Underscore;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@underscore-finance/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "SDK for interacting with Underscore Finance Smart Contracts with TypeScript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@dappql/async": "^1.0.3",
|
|
33
|
-
"dappql": "^2.0.
|
|
33
|
+
"dappql": "^2.0.30",
|
|
34
34
|
"viem": "^2.23.7"
|
|
35
35
|
}
|
|
36
36
|
}
|