@underscore-finance/sdk 1.2.20-next.1 → 1.2.20-next.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/AGENTS.md +172 -0
- package/README.md +17 -116
- package/abis.json +193056 -0
- package/addresses.json +76 -0
- package/dist/contracts/AaveV3.d.ts +2594 -0
- package/dist/contracts/AaveV3.d.ts.map +1 -0
- package/dist/contracts/AaveV3.js +3272 -0
- package/dist/contracts/Addys.d.ts +124 -0
- package/dist/contracts/Addys.d.ts.map +1 -0
- package/dist/contracts/Addys.js +134 -0
- package/dist/contracts/AeroClassic.d.ts +2118 -0
- package/dist/contracts/AeroClassic.d.ts.map +1 -0
- package/dist/contracts/AeroClassic.js +2679 -0
- package/dist/contracts/AeroSlipstream.d.ts +2256 -0
- package/dist/contracts/AeroSlipstream.d.ts.map +1 -0
- package/dist/contracts/AeroSlipstream.js +2848 -0
- package/dist/contracts/AgentSenderGeneric.d.ts +4771 -0
- package/dist/contracts/AgentSenderGeneric.d.ts.map +1 -0
- package/dist/contracts/AgentSenderGeneric.js +6192 -0
- package/dist/contracts/AgentSenderSpecial.d.ts +2124 -0
- package/dist/contracts/AgentSenderSpecial.d.ts.map +1 -0
- package/dist/contracts/AgentSenderSpecial.js +2671 -0
- package/dist/contracts/AgentSenderSpecialAdmin.d.ts +984 -0
- package/dist/contracts/AgentSenderSpecialAdmin.d.ts.map +1 -0
- package/dist/contracts/AgentSenderSpecialAdmin.js +1185 -0
- package/dist/contracts/AgentSenderSpecialSigHelper.d.ts +3180 -0
- package/dist/contracts/AgentSenderSpecialSigHelper.d.ts.map +1 -0
- package/dist/contracts/AgentSenderSpecialSigHelper.js +4211 -0
- package/dist/contracts/AgentWrapper.d.ts +2678 -0
- package/dist/contracts/AgentWrapper.d.ts.map +1 -0
- package/dist/contracts/AgentWrapper.js +3602 -0
- package/dist/contracts/AgentWrapperV1.d.ts +3789 -0
- package/dist/contracts/AgentWrapperV1.d.ts.map +1 -0
- package/dist/contracts/AgentWrapperV1.js +4945 -0
- package/dist/contracts/AgentWrapperV2.d.ts +2494 -0
- package/dist/contracts/AgentWrapperV2.d.ts.map +1 -0
- package/dist/contracts/AgentWrapperV2.js +3354 -0
- package/dist/contracts/Appraiser.d.ts +577 -0
- package/dist/contracts/Appraiser.d.ts.map +1 -0
- package/dist/contracts/Appraiser.js +735 -0
- package/dist/contracts/Avantis.d.ts +2606 -0
- package/dist/contracts/Avantis.d.ts.map +1 -0
- package/dist/contracts/Avantis.js +3282 -0
- package/dist/contracts/Billing.d.ts +381 -0
- package/dist/contracts/Billing.d.ts.map +1 -0
- package/dist/contracts/Billing.js +451 -0
- package/dist/contracts/ChequeBook.d.ts +1860 -0
- package/dist/contracts/ChequeBook.d.ts.map +1 -0
- package/dist/contracts/ChequeBook.js +2131 -0
- package/dist/contracts/CompoundV3.d.ts +2622 -0
- package/dist/contracts/CompoundV3.d.ts.map +1 -0
- package/dist/contracts/CompoundV3.js +3304 -0
- package/dist/contracts/ConvertVaultToken.d.ts +64 -0
- package/dist/contracts/ConvertVaultToken.d.ts.map +1 -0
- package/dist/contracts/ConvertVaultToken.js +75 -0
- package/dist/contracts/Curve.d.ts +1107 -0
- package/dist/contracts/Curve.d.ts.map +1 -0
- package/dist/contracts/Curve.js +1379 -0
- package/dist/contracts/DefaultsBase.d.ts +306 -0
- package/dist/contracts/DefaultsBase.d.ts.map +1 -0
- package/dist/contracts/DefaultsBase.js +331 -0
- package/dist/contracts/DefaultsLocal.d.ts +320 -0
- package/dist/contracts/DefaultsLocal.d.ts.map +1 -0
- package/dist/contracts/DefaultsLocal.js +350 -0
- package/dist/contracts/ERC20.d.ts +813 -0
- package/dist/contracts/ERC20.d.ts.map +1 -0
- package/dist/contracts/ERC20.js +1006 -0
- package/dist/contracts/EarnVault.d.ts +1762 -0
- package/dist/contracts/EarnVault.d.ts.map +1 -0
- package/dist/contracts/EarnVault.js +2267 -0
- package/dist/contracts/EarnVaultAgent.d.ts +1160 -0
- package/dist/contracts/EarnVaultAgent.d.ts.map +1 -0
- package/dist/contracts/EarnVaultAgent.js +1435 -0
- package/dist/contracts/EarnVaultAgentSigHelper.d.ts +905 -0
- package/dist/contracts/EarnVaultAgentSigHelper.d.ts.map +1 -0
- package/dist/contracts/EarnVaultAgentSigHelper.js +1198 -0
- package/dist/contracts/EarnVaultWallet.d.ts +777 -0
- package/dist/contracts/EarnVaultWallet.d.ts.map +1 -0
- package/dist/contracts/EarnVaultWallet.js +987 -0
- package/dist/contracts/Erc20Token.d.ts +813 -0
- package/dist/contracts/Erc20Token.d.ts.map +1 -0
- package/dist/contracts/Erc20Token.js +1006 -0
- package/dist/contracts/Euler.d.ts +2662 -0
- package/dist/contracts/Euler.d.ts.map +1 -0
- package/dist/contracts/Euler.js +3350 -0
- package/dist/contracts/ExtraFi.d.ts +2637 -0
- package/dist/contracts/ExtraFi.d.ts.map +1 -0
- package/dist/contracts/ExtraFi.js +3323 -0
- package/dist/contracts/Fluid.d.ts +2634 -0
- package/dist/contracts/Fluid.d.ts.map +1 -0
- package/dist/contracts/Fluid.js +3318 -0
- package/dist/contracts/FortyAcres.d.ts +2620 -0
- package/dist/contracts/FortyAcres.d.ts.map +1 -0
- package/dist/contracts/FortyAcres.js +3300 -0
- package/dist/contracts/Hatchery.d.ts +392 -0
- package/dist/contracts/Hatchery.d.ts.map +1 -0
- package/dist/contracts/Hatchery.js +472 -0
- package/dist/contracts/Helpers.d.ts +1463 -0
- package/dist/contracts/Helpers.d.ts.map +1 -0
- package/dist/contracts/Helpers.js +1763 -0
- package/dist/contracts/HighCommand.d.ts +2169 -0
- package/dist/contracts/HighCommand.d.ts.map +1 -0
- package/dist/contracts/HighCommand.js +2474 -0
- package/dist/contracts/Kernel.d.ts +391 -0
- package/dist/contracts/Kernel.d.ts.map +1 -0
- package/dist/contracts/Kernel.js +446 -0
- package/dist/contracts/Ledger.d.ts +637 -0
- package/dist/contracts/Ledger.d.ts.map +1 -0
- package/dist/contracts/Ledger.js +759 -0
- package/dist/contracts/LegoBook.d.ts +1463 -0
- package/dist/contracts/LegoBook.d.ts.map +1 -0
- package/dist/contracts/LegoBook.js +1763 -0
- package/dist/contracts/LegoTools.d.ts +1913 -0
- package/dist/contracts/LegoTools.d.ts.map +1 -0
- package/dist/contracts/LegoTools.js +2402 -0
- package/dist/contracts/LevgVault.d.ts +2115 -0
- package/dist/contracts/LevgVault.d.ts.map +1 -0
- package/dist/contracts/LevgVault.js +2733 -0
- package/dist/contracts/LevgVaultAgent.d.ts +2013 -0
- package/dist/contracts/LevgVaultAgent.d.ts.map +1 -0
- package/dist/contracts/LevgVaultAgent.js +2563 -0
- package/dist/contracts/LevgVaultAgentSigHelper.d.ts +2221 -0
- package/dist/contracts/LevgVaultAgentSigHelper.d.ts.map +1 -0
- package/dist/contracts/LevgVaultAgentSigHelper.js +2963 -0
- package/dist/contracts/LevgVaultHelper.d.ts +977 -0
- package/dist/contracts/LevgVaultHelper.d.ts.map +1 -0
- package/dist/contracts/LevgVaultHelper.js +1289 -0
- package/dist/contracts/LevgVaultTools.d.ts +2629 -0
- package/dist/contracts/LevgVaultTools.d.ts.map +1 -0
- package/dist/contracts/LevgVaultTools.js +3560 -0
- package/dist/contracts/LevgVaultWallet.d.ts +1119 -0
- package/dist/contracts/LevgVaultWallet.d.ts.map +1 -0
- package/dist/contracts/LevgVaultWallet.js +1439 -0
- package/dist/contracts/LocalGov.d.ts +427 -0
- package/dist/contracts/LocalGov.d.ts.map +1 -0
- package/dist/contracts/LocalGov.js +507 -0
- package/dist/contracts/LootDistributor.d.ts +1053 -0
- package/dist/contracts/LootDistributor.d.ts.map +1 -0
- package/dist/contracts/LootDistributor.js +1291 -0
- package/dist/contracts/Migrator.d.ts +449 -0
- package/dist/contracts/Migrator.d.ts.map +1 -0
- package/dist/contracts/Migrator.js +535 -0
- package/dist/contracts/MissionControl.d.ts +1405 -0
- package/dist/contracts/MissionControl.d.ts.map +1 -0
- package/dist/contracts/MissionControl.js +1592 -0
- package/dist/contracts/Moonwell.d.ts +2623 -0
- package/dist/contracts/Moonwell.d.ts.map +1 -0
- package/dist/contracts/Moonwell.js +3304 -0
- package/dist/contracts/Morpho.d.ts +2662 -0
- package/dist/contracts/Morpho.d.ts.map +1 -0
- package/dist/contracts/Morpho.js +3350 -0
- package/dist/contracts/Ownership.d.ts +414 -0
- package/dist/contracts/Ownership.d.ts.map +1 -0
- package/dist/contracts/Ownership.js +472 -0
- package/dist/contracts/Paymaster.d.ts +1511 -0
- package/dist/contracts/Paymaster.d.ts.map +1 -0
- package/dist/contracts/Paymaster.js +1812 -0
- package/dist/contracts/RipeLego.d.ts +2913 -0
- package/dist/contracts/RipeLego.d.ts.map +1 -0
- package/dist/contracts/RipeLego.js +3643 -0
- package/dist/contracts/Sentinel.d.ts +2067 -0
- package/dist/contracts/Sentinel.d.ts.map +1 -0
- package/dist/contracts/Sentinel.js +2480 -0
- package/dist/contracts/SignatureHelper.d.ts +4250 -0
- package/dist/contracts/SignatureHelper.d.ts.map +1 -0
- package/dist/contracts/SignatureHelper.js +5714 -0
- package/dist/contracts/SignatureHelperV1.d.ts +4250 -0
- package/dist/contracts/SignatureHelperV1.d.ts.map +1 -0
- package/dist/contracts/SignatureHelperV1.js +5714 -0
- package/dist/contracts/SkyPsm.d.ts +2667 -0
- package/dist/contracts/SkyPsm.d.ts.map +1 -0
- package/dist/contracts/SkyPsm.js +3356 -0
- package/dist/contracts/Switchboard.d.ts +1483 -0
- package/dist/contracts/Switchboard.d.ts.map +1 -0
- package/dist/contracts/Switchboard.js +1790 -0
- package/dist/contracts/SwitchboardAlpha.d.ts +3161 -0
- package/dist/contracts/SwitchboardAlpha.d.ts.map +1 -0
- package/dist/contracts/SwitchboardAlpha.js +3771 -0
- package/dist/contracts/SwitchboardBravo.d.ts +1591 -0
- package/dist/contracts/SwitchboardBravo.d.ts.map +1 -0
- package/dist/contracts/SwitchboardBravo.js +1872 -0
- package/dist/contracts/SwitchboardCharlie.d.ts +3172 -0
- package/dist/contracts/SwitchboardCharlie.d.ts.map +1 -0
- package/dist/contracts/SwitchboardCharlie.js +3713 -0
- package/dist/contracts/UnderscoreLego.d.ts +2592 -0
- package/dist/contracts/UnderscoreLego.d.ts.map +1 -0
- package/dist/contracts/UnderscoreLego.js +3264 -0
- package/dist/contracts/UndyAero.d.ts +1733 -0
- package/dist/contracts/UndyAero.d.ts.map +1 -0
- package/dist/contracts/UndyAero.js +2235 -0
- package/dist/contracts/UndyBtc.d.ts +1733 -0
- package/dist/contracts/UndyBtc.d.ts.map +1 -0
- package/dist/contracts/UndyBtc.js +2235 -0
- package/dist/contracts/UndyCbeth.d.ts +1733 -0
- package/dist/contracts/UndyCbeth.d.ts.map +1 -0
- package/dist/contracts/UndyCbeth.js +2235 -0
- package/dist/contracts/UndyEth.d.ts +1733 -0
- package/dist/contracts/UndyEth.d.ts.map +1 -0
- package/dist/contracts/UndyEth.js +2235 -0
- package/dist/contracts/UndyEurc.d.ts +1733 -0
- package/dist/contracts/UndyEurc.d.ts.map +1 -0
- package/dist/contracts/UndyEurc.js +2235 -0
- package/dist/contracts/UndyGho.d.ts +1733 -0
- package/dist/contracts/UndyGho.d.ts.map +1 -0
- package/dist/contracts/UndyGho.js +2235 -0
- package/dist/contracts/UndyHq.d.ts +1677 -0
- package/dist/contracts/UndyHq.d.ts.map +1 -0
- package/dist/contracts/UndyHq.js +2026 -0
- package/dist/contracts/UndyRewardsLego.d.ts +1572 -0
- package/dist/contracts/UndyRewardsLego.d.ts.map +1 -0
- package/dist/contracts/UndyRewardsLego.js +1994 -0
- package/dist/contracts/UndyToken.d.ts +821 -0
- package/dist/contracts/UndyToken.d.ts.map +1 -0
- package/dist/contracts/UndyToken.js +1017 -0
- package/dist/contracts/UndyUsd.d.ts +1733 -0
- package/dist/contracts/UndyUsd.d.ts.map +1 -0
- package/dist/contracts/UndyUsd.js +2235 -0
- package/dist/contracts/UndyUsdV2.d.ts +1762 -0
- package/dist/contracts/UndyUsdV2.d.ts.map +1 -0
- package/dist/contracts/UndyUsdV2.js +2267 -0
- package/dist/contracts/UndyUsds.d.ts +1733 -0
- package/dist/contracts/UndyUsds.d.ts.map +1 -0
- package/dist/contracts/UndyUsds.js +2235 -0
- package/dist/contracts/UndyVirtual.d.ts +1762 -0
- package/dist/contracts/UndyVirtual.d.ts.map +1 -0
- package/dist/contracts/UndyVirtual.js +2267 -0
- package/dist/contracts/UniswapV2.d.ts +2118 -0
- package/dist/contracts/UniswapV2.d.ts.map +1 -0
- package/dist/contracts/UniswapV2.js +2679 -0
- package/dist/contracts/UniswapV3.d.ts +2256 -0
- package/dist/contracts/UniswapV3.d.ts.map +1 -0
- package/dist/contracts/UniswapV3.js +2848 -0
- package/dist/contracts/UserWallet.d.ts +2650 -0
- package/dist/contracts/UserWallet.d.ts.map +1 -0
- package/dist/contracts/UserWallet.js +3520 -0
- package/dist/contracts/UserWalletConfig.d.ts +3918 -0
- package/dist/contracts/UserWalletConfig.d.ts.map +1 -0
- package/dist/contracts/UserWalletConfig.js +4527 -0
- package/dist/contracts/UserWalletConfigV1.d.ts +3692 -0
- package/dist/contracts/UserWalletConfigV1.d.ts.map +1 -0
- package/dist/contracts/UserWalletConfigV1.js +4276 -0
- package/dist/contracts/UserWalletSignatureHelper.d.ts +5558 -0
- package/dist/contracts/UserWalletSignatureHelper.d.ts.map +1 -0
- package/dist/contracts/UserWalletSignatureHelper.js +7480 -0
- package/dist/contracts/UserWalletV1.d.ts +2650 -0
- package/dist/contracts/UserWalletV1.d.ts.map +1 -0
- package/dist/contracts/UserWalletV1.js +3520 -0
- package/dist/contracts/VaultErc20Token.d.ts +522 -0
- package/dist/contracts/VaultErc20Token.d.ts.map +1 -0
- package/dist/contracts/VaultErc20Token.js +658 -0
- package/dist/contracts/VaultRegistry.d.ts +3162 -0
- package/dist/contracts/VaultRegistry.d.ts.map +1 -0
- package/dist/contracts/VaultRegistry.js +3893 -0
- package/dist/contracts/WalletBackpack.d.ts +1248 -0
- package/dist/contracts/WalletBackpack.d.ts.map +1 -0
- package/dist/contracts/WalletBackpack.js +1519 -0
- package/dist/contracts/Wasabi.d.ts +2620 -0
- package/dist/contracts/Wasabi.d.ts.map +1 -0
- package/dist/contracts/Wasabi.js +3300 -0
- package/dist/contracts/index.d.ts +86 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +89 -0
- package/dist/contracts/sdk.d.ts +176 -0
- package/dist/contracts/sdk.d.ts.map +1 -0
- package/dist/contracts/sdk.js +178 -0
- package/dist/getSwapInstructions.d.ts +34 -0
- package/dist/getSwapInstructions.d.ts.map +1 -0
- package/dist/getSwapInstructions.js +21 -0
- package/dist/index.d.ts +135 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +137 -0
- package/package.json +44 -17
- package/.claude/settings.local.json +0 -31
- package/.eslintrc.json +0 -27
- package/.prettierrc +0 -9
- package/.tool-versions +0 -1
- package/LICENSE +0 -41
- package/LICENSE_DATE.md +0 -34
- package/LICENSE_GRANTS.md +0 -33
- package/LICENSE_INFO.md +0 -90
- package/dapp.config.js +0 -154
- package/src/getSwapInstructions.ts +0 -55
- package/src/index.ts +0 -192
- package/tsconfig.json +0 -18
package/dapp.config.js
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'
|
|
2
|
-
|
|
3
|
-
const require = createRequire(import.meta.url)
|
|
4
|
-
const Manifest = require('../underscore-protocol/migration_history/base-mainnet/v1.1/current-manifest.json')
|
|
5
|
-
|
|
6
|
-
// These manifest-only entries are not part of the generated SDK surface.
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8
|
-
const { LevgVaultHelper, '40Acres': FortyAcres, Yo, Tokemak, ...rest } = Manifest.contracts
|
|
9
|
-
|
|
10
|
-
const PROTOCOL_ABI_ALIASES = {
|
|
11
|
-
ERC20: 'Erc20Token',
|
|
12
|
-
FortyAcres: '40Acres',
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function protocolAbiPath(name) {
|
|
16
|
-
return `../underscore-protocol/scripts/abis/${name}.json`
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function protocolAbi(name) {
|
|
20
|
-
return require(protocolAbiPath(name))
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function protocolAbiNameFor(contractName) {
|
|
24
|
-
const protocolName = PROTOCOL_ABI_ALIASES[contractName] ?? contractName
|
|
25
|
-
try {
|
|
26
|
-
require.resolve(protocolAbiPath(protocolName))
|
|
27
|
-
return protocolName
|
|
28
|
-
} catch {
|
|
29
|
-
return undefined
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function withProtocolAbi(contractName, baseContract = {}, protocolName = protocolAbiNameFor(contractName)) {
|
|
34
|
-
if (!protocolName) return baseContract
|
|
35
|
-
return {
|
|
36
|
-
...baseContract,
|
|
37
|
-
abi: protocolAbi(protocolName),
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function withCurrentProtocolAbis(contracts) {
|
|
42
|
-
return Object.fromEntries(
|
|
43
|
-
Object.entries(contracts).map(([contractName, contract]) => [
|
|
44
|
-
contractName,
|
|
45
|
-
withProtocolAbi(contractName, contract),
|
|
46
|
-
]),
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function protocolTemplate(name) {
|
|
51
|
-
return {
|
|
52
|
-
isTemplate: true,
|
|
53
|
-
abi: protocolAbi(name),
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export default {
|
|
58
|
-
name: 'Underscore Finance',
|
|
59
|
-
description: 'Underscore Finance',
|
|
60
|
-
targetPath: './src/contracts',
|
|
61
|
-
chainId: 8453,
|
|
62
|
-
isModule: true,
|
|
63
|
-
isSdk: true,
|
|
64
|
-
package: {
|
|
65
|
-
source: './src',
|
|
66
|
-
protocol: {
|
|
67
|
-
name: 'Underscore Finance',
|
|
68
|
-
description: 'SDK for interacting with Underscore Finance smart contracts',
|
|
69
|
-
website: 'https://underscore.finance',
|
|
70
|
-
repo: 'https://github.com/underscore-finance/typescript-sdk',
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
contracts: {
|
|
74
|
-
...withCurrentProtocolAbis(rest),
|
|
75
|
-
Addys: protocolTemplate('Addys'),
|
|
76
|
-
AgentSenderSpecialAdmin: protocolTemplate('AgentSenderSpecialAdmin'),
|
|
77
|
-
DefaultsLocal: protocolTemplate('DefaultsLocal'),
|
|
78
|
-
EarnVaultWallet: protocolTemplate('EarnVaultWallet'),
|
|
79
|
-
Erc20Token: protocolTemplate('Erc20Token'),
|
|
80
|
-
FortyAcres: withProtocolAbi('FortyAcres', FortyAcres),
|
|
81
|
-
LevgVaultWallet: protocolTemplate('LevgVaultWallet'),
|
|
82
|
-
LocalGov: protocolTemplate('LocalGov'),
|
|
83
|
-
Ownership: protocolTemplate('Ownership'),
|
|
84
|
-
UndyToken: protocolTemplate('UndyToken'),
|
|
85
|
-
VaultErc20Token: protocolTemplate('VaultErc20Token'),
|
|
86
|
-
|
|
87
|
-
// Keep the historical SDK export name while sourcing the current protocol ABI.
|
|
88
|
-
ERC20: protocolTemplate('Erc20Token'),
|
|
89
|
-
|
|
90
|
-
UserWallet: withProtocolAbi('UserWallet', {
|
|
91
|
-
isTemplate: true,
|
|
92
|
-
address: Manifest.contracts.UserWallet.address,
|
|
93
|
-
}),
|
|
94
|
-
UserWalletConfig: withProtocolAbi('UserWalletConfig', {
|
|
95
|
-
isTemplate: true,
|
|
96
|
-
address: Manifest.contracts.UserWalletConfig.address,
|
|
97
|
-
}),
|
|
98
|
-
ChequeBook: withProtocolAbi('ChequeBook', Manifest.contracts.ChequeBook),
|
|
99
|
-
|
|
100
|
-
UserWalletV1: {
|
|
101
|
-
isTemplate: true,
|
|
102
|
-
address: '0x880E453Ec494FB17bffba537BeaB4Cc6CD1B7C12',
|
|
103
|
-
},
|
|
104
|
-
UserWalletConfigV1: {
|
|
105
|
-
isTemplate: true,
|
|
106
|
-
address: '0x0E7064202c4F906Adc4D9F6D3C92470b62F624F1',
|
|
107
|
-
},
|
|
108
|
-
AgentWrapperV1: {
|
|
109
|
-
isTemplate: true,
|
|
110
|
-
address: '0x9d3F593380875860cC18F5736373ae4B084Ba2F9',
|
|
111
|
-
},
|
|
112
|
-
AgentWrapperV2: {
|
|
113
|
-
isTemplate: true,
|
|
114
|
-
address: '0x761fCDFfF8B187901eA11415237632A3F7E0203B',
|
|
115
|
-
},
|
|
116
|
-
AgentWrapper: withProtocolAbi('AgentWrapper', {
|
|
117
|
-
isTemplate: true,
|
|
118
|
-
...Manifest.contracts.AgentWrapper,
|
|
119
|
-
}),
|
|
120
|
-
SignatureHelperV1: {
|
|
121
|
-
address: '0x7a938DEd840172e89ef3B90039959E51C1dC6893',
|
|
122
|
-
isTemplate: true,
|
|
123
|
-
...Manifest.contracts.SignatureHelper,
|
|
124
|
-
},
|
|
125
|
-
UserWalletSignatureHelper: withProtocolAbi('UserWalletSignatureHelper', {
|
|
126
|
-
isTemplate: true,
|
|
127
|
-
...Manifest.contracts.UserWalletSignatureHelper,
|
|
128
|
-
}),
|
|
129
|
-
AgentSenderSpecialSigHelper: withProtocolAbi('AgentSenderSpecialSigHelper', {
|
|
130
|
-
isTemplate: true,
|
|
131
|
-
...Manifest.contracts.AgentSenderSpecialSigHelper,
|
|
132
|
-
}),
|
|
133
|
-
AgentSenderSpecial: withProtocolAbi('AgentSenderSpecial', {
|
|
134
|
-
isTemplate: true,
|
|
135
|
-
...Manifest.contracts.AgentSenderSpecial,
|
|
136
|
-
}),
|
|
137
|
-
AgentSenderGeneric: withProtocolAbi('AgentSenderGeneric', {
|
|
138
|
-
isTemplate: true,
|
|
139
|
-
...Manifest.contracts.AgentSenderGeneric,
|
|
140
|
-
}),
|
|
141
|
-
EarnVault: withProtocolAbi('EarnVault', {
|
|
142
|
-
isTemplate: true,
|
|
143
|
-
address: Manifest.contracts.UndyUsd.address,
|
|
144
|
-
}),
|
|
145
|
-
LevgVault: withProtocolAbi('LevgVault', {
|
|
146
|
-
isTemplate: true,
|
|
147
|
-
address: '0x936c3C493Dc45D0f4D2FA36C7640f3BCABd64B4B',
|
|
148
|
-
}),
|
|
149
|
-
LevgVaultHelper: withProtocolAbi('LevgVaultHelper', {
|
|
150
|
-
...LevgVaultHelper,
|
|
151
|
-
isTemplate: true,
|
|
152
|
-
}),
|
|
153
|
-
},
|
|
154
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { AddressResolverFunction } from '@dappql/async'
|
|
2
|
-
import { Address, PublicClient } from 'viem'
|
|
3
|
-
|
|
4
|
-
import { LegoTools } from './contracts/index.js'
|
|
5
|
-
|
|
6
|
-
type DeepMutable<T> = {
|
|
7
|
-
-readonly [P in keyof T]: T[P] extends object ? DeepMutable<T[P]> : T[P]
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export async function getSwapInstructionsAmountOut(
|
|
11
|
-
publicClient: PublicClient,
|
|
12
|
-
payload: {
|
|
13
|
-
tokenIn: Address
|
|
14
|
-
tokenOut: Address
|
|
15
|
-
amountIn: bigint
|
|
16
|
-
slippage: bigint
|
|
17
|
-
includeLegoIds?: bigint[]
|
|
18
|
-
},
|
|
19
|
-
addressResolver?: AddressResolverFunction,
|
|
20
|
-
) {
|
|
21
|
-
const { tokenIn, tokenOut, amountIn, slippage, includeLegoIds } = payload
|
|
22
|
-
|
|
23
|
-
const instructions = await publicClient.simulateContract({
|
|
24
|
-
address: addressResolver ? addressResolver('LegoTools') : LegoTools.deployAddress!,
|
|
25
|
-
abi: LegoTools.abi,
|
|
26
|
-
functionName: 'getRoutesAndSwapInstructionsAmountOut',
|
|
27
|
-
args: [tokenIn, tokenOut, amountIn, slippage, includeLegoIds ?? []],
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
return instructions.result as DeepMutable<typeof instructions.result>
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export async function getSwapInstructionsAmountIn(
|
|
34
|
-
publicClient: PublicClient,
|
|
35
|
-
payload: {
|
|
36
|
-
tokenIn: Address
|
|
37
|
-
tokenOut: Address
|
|
38
|
-
amountOut: bigint
|
|
39
|
-
amountInAvailable: bigint
|
|
40
|
-
slippage: bigint
|
|
41
|
-
includeLegoIds?: bigint[]
|
|
42
|
-
},
|
|
43
|
-
addressResolver?: AddressResolverFunction,
|
|
44
|
-
) {
|
|
45
|
-
const { tokenIn, tokenOut, amountOut, amountInAvailable, slippage, includeLegoIds } = payload
|
|
46
|
-
|
|
47
|
-
const instructions = await publicClient.simulateContract({
|
|
48
|
-
address: addressResolver ? addressResolver('LegoTools') : LegoTools.deployAddress!,
|
|
49
|
-
abi: LegoTools.abi,
|
|
50
|
-
functionName: 'getRoutesAndSwapInstructionsAmountIn',
|
|
51
|
-
args: [tokenIn, tokenOut, amountOut, amountInAvailable, slippage, includeLegoIds ?? []],
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
return instructions.result as DeepMutable<typeof instructions.result>
|
|
55
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { GetItemCallFunction, iteratorQuery, query, RequestCollection } from '@dappql/async'
|
|
2
|
-
import { Address, createPublicClient, http, PublicClient, WalletClient } from 'viem'
|
|
3
|
-
import { base } from 'viem/chains'
|
|
4
|
-
|
|
5
|
-
import * as CONTRACTS from './contracts/index.js'
|
|
6
|
-
import createSdk, { SDK } from './contracts/sdk.js'
|
|
7
|
-
import { getSwapInstructionsAmountIn, getSwapInstructionsAmountOut } from './getSwapInstructions.js'
|
|
8
|
-
export * from './contracts/index.js'
|
|
9
|
-
|
|
10
|
-
export type Contracts = SDK
|
|
11
|
-
export type ContractsNames = keyof typeof CONTRACTS
|
|
12
|
-
|
|
13
|
-
export const DEPARTMENT_IDS = {
|
|
14
|
-
LEDGER: 1n,
|
|
15
|
-
MISSION_CONTROL: 2n,
|
|
16
|
-
LEGO_BOOK: 3n,
|
|
17
|
-
SWITCHBOARD: 4n,
|
|
18
|
-
HATCHERY: 5n,
|
|
19
|
-
LOOT_DISTRIBUTOR: 6n,
|
|
20
|
-
APPRAISER: 7n,
|
|
21
|
-
WALLET_BACKPACK: 8n,
|
|
22
|
-
BILLING: 9n,
|
|
23
|
-
VAULT_REGISTRY: 10n,
|
|
24
|
-
HELPERS: 11n,
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const LEGOS_IDS = {
|
|
28
|
-
RIPE: 1n,
|
|
29
|
-
AAVE_V3: 2n,
|
|
30
|
-
COMPOUND_V3: 3n,
|
|
31
|
-
EULER: 4n,
|
|
32
|
-
FLUID: 5n,
|
|
33
|
-
MOONWELL: 6n,
|
|
34
|
-
MORPHO: 7n,
|
|
35
|
-
AERO_CLASSIC: 8n,
|
|
36
|
-
AERO_SLIPSTREAM: 9n,
|
|
37
|
-
CURVE: 10n,
|
|
38
|
-
UNISWAP_V2: 11n,
|
|
39
|
-
UNISWAP_V3: 12n,
|
|
40
|
-
UNDERSCORE: 13n,
|
|
41
|
-
FORTY_ACRES: 14n,
|
|
42
|
-
WASABI: 15n,
|
|
43
|
-
AVANTIS: 16n,
|
|
44
|
-
SKY_PSM: 17n,
|
|
45
|
-
EXTRA_FI: 18n,
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export const HELPERS_IDS = {
|
|
49
|
-
LEGO_TOOLS: 1n,
|
|
50
|
-
LEVG_VAULT_TOOLS: 2n,
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export type UnderscoreConfig = {
|
|
54
|
-
rpcUrl?: string
|
|
55
|
-
publicClient?: PublicClient
|
|
56
|
-
walletClient?: WalletClient
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
class Underscore {
|
|
60
|
-
public publicClient: PublicClient
|
|
61
|
-
public walletClient: WalletClient | undefined
|
|
62
|
-
public contracts: SDK
|
|
63
|
-
public addresses: Partial<Record<ContractsNames, `0x${string}`>>
|
|
64
|
-
constructor(config?: UnderscoreConfig) {
|
|
65
|
-
this.publicClient =
|
|
66
|
-
config?.publicClient ||
|
|
67
|
-
(createPublicClient({
|
|
68
|
-
chain: base,
|
|
69
|
-
transport: http(config?.rpcUrl),
|
|
70
|
-
}) as unknown as PublicClient)
|
|
71
|
-
this.addresses = {}
|
|
72
|
-
this.walletClient = config?.walletClient
|
|
73
|
-
this.contracts = createSdk(this.publicClient, this.walletClient, this.addressResolver)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
async loadAddresses() {
|
|
77
|
-
const departments = await this.multicall((contracts) => {
|
|
78
|
-
return {
|
|
79
|
-
Ledger: contracts.UndyHq.call.getAddr(DEPARTMENT_IDS.LEDGER),
|
|
80
|
-
MissionControl: contracts.UndyHq.call.getAddr(DEPARTMENT_IDS.MISSION_CONTROL),
|
|
81
|
-
LegoBook: contracts.UndyHq.call.getAddr(DEPARTMENT_IDS.LEGO_BOOK),
|
|
82
|
-
Switchboard: contracts.UndyHq.call.getAddr(DEPARTMENT_IDS.SWITCHBOARD),
|
|
83
|
-
Hatchery: contracts.UndyHq.call.getAddr(DEPARTMENT_IDS.HATCHERY),
|
|
84
|
-
LootDistributor: contracts.UndyHq.call.getAddr(DEPARTMENT_IDS.LOOT_DISTRIBUTOR),
|
|
85
|
-
Appraiser: contracts.UndyHq.call.getAddr(DEPARTMENT_IDS.APPRAISER),
|
|
86
|
-
WalletBackpack: contracts.UndyHq.call.getAddr(DEPARTMENT_IDS.WALLET_BACKPACK),
|
|
87
|
-
Billing: contracts.UndyHq.call.getAddr(DEPARTMENT_IDS.BILLING),
|
|
88
|
-
VaultRegistry: contracts.UndyHq.call.getAddr(DEPARTMENT_IDS.VAULT_REGISTRY),
|
|
89
|
-
Helpers: contracts.UndyHq.call.getAddr(DEPARTMENT_IDS.HELPERS),
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
const children = await this.multicall((contracts) => {
|
|
93
|
-
return {
|
|
94
|
-
RipeLego: contracts.LegoBook.call.getAddr(LEGOS_IDS.RIPE).at(departments.LegoBook),
|
|
95
|
-
AaveV3: contracts.LegoBook.call.getAddr(LEGOS_IDS.AAVE_V3).at(departments.LegoBook),
|
|
96
|
-
CompoundV3: contracts.LegoBook.call.getAddr(LEGOS_IDS.COMPOUND_V3).at(departments.LegoBook),
|
|
97
|
-
Euler: contracts.LegoBook.call.getAddr(LEGOS_IDS.EULER).at(departments.LegoBook),
|
|
98
|
-
Fluid: contracts.LegoBook.call.getAddr(LEGOS_IDS.FLUID).at(departments.LegoBook),
|
|
99
|
-
Moonwell: contracts.LegoBook.call.getAddr(LEGOS_IDS.MOONWELL).at(departments.LegoBook),
|
|
100
|
-
Morpho: contracts.LegoBook.call.getAddr(LEGOS_IDS.MORPHO).at(departments.LegoBook),
|
|
101
|
-
AeroClassic: contracts.LegoBook.call.getAddr(LEGOS_IDS.AERO_CLASSIC).at(departments.LegoBook),
|
|
102
|
-
AeroSlipstream: contracts.LegoBook.call.getAddr(LEGOS_IDS.AERO_SLIPSTREAM).at(departments.LegoBook),
|
|
103
|
-
Curve: contracts.LegoBook.call.getAddr(LEGOS_IDS.CURVE).at(departments.LegoBook),
|
|
104
|
-
UniswapV2: contracts.LegoBook.call.getAddr(LEGOS_IDS.UNISWAP_V2).at(departments.LegoBook),
|
|
105
|
-
UniswapV3: contracts.LegoBook.call.getAddr(LEGOS_IDS.UNISWAP_V3).at(departments.LegoBook),
|
|
106
|
-
UnderscoreLego: contracts.LegoBook.call.getAddr(LEGOS_IDS.UNDERSCORE).at(departments.LegoBook),
|
|
107
|
-
FortyAcres: contracts.LegoBook.call.getAddr(LEGOS_IDS.FORTY_ACRES).at(departments.LegoBook),
|
|
108
|
-
Wasabi: contracts.LegoBook.call.getAddr(LEGOS_IDS.WASABI).at(departments.LegoBook),
|
|
109
|
-
Avantis: contracts.LegoBook.call.getAddr(LEGOS_IDS.AVANTIS).at(departments.LegoBook),
|
|
110
|
-
SkyPsm: contracts.LegoBook.call.getAddr(LEGOS_IDS.SKY_PSM).at(departments.LegoBook),
|
|
111
|
-
ExtraFi: contracts.LegoBook.call.getAddr(LEGOS_IDS.EXTRA_FI).at(departments.LegoBook),
|
|
112
|
-
|
|
113
|
-
SwitchboardAlpha: contracts.Switchboard.call.getAddr(1n).at(departments.Switchboard),
|
|
114
|
-
SwitchboardBravo: contracts.Switchboard.call.getAddr(2n).at(departments.Switchboard),
|
|
115
|
-
SwitchboardCharlie: contracts.Switchboard.call.getAddr(3n).at(departments.Switchboard),
|
|
116
|
-
|
|
117
|
-
LegoTools: contracts.Helpers.call.getAddr(1n).at(departments.Helpers),
|
|
118
|
-
LevgVaultTools: contracts.Helpers.call.getAddr(2n).at(departments.Helpers),
|
|
119
|
-
}
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
this.addresses = {
|
|
123
|
-
...departments,
|
|
124
|
-
...children,
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
addressResolver = (name: string) => {
|
|
129
|
-
return this.addresses[name as ContractsNames]!
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
setWalletClient(walletClient: WalletClient) {
|
|
133
|
-
this.walletClient = walletClient
|
|
134
|
-
this.contracts = createSdk(this.publicClient, this.walletClient)
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
setPublicClient(publicClient: PublicClient) {
|
|
138
|
-
this.publicClient = publicClient
|
|
139
|
-
this.contracts = createSdk(this.publicClient, this.walletClient)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
async multicall<T extends RequestCollection>(
|
|
143
|
-
cb: (contracts: typeof CONTRACTS) => T,
|
|
144
|
-
options: { blockNumber?: bigint } = {},
|
|
145
|
-
) {
|
|
146
|
-
const request = cb(CONTRACTS)
|
|
147
|
-
return (query as any)(this.publicClient, request, options, this.addressResolver) as ReturnType<typeof query<T>>
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
async iterate<T>(
|
|
151
|
-
cb: (contracts: typeof CONTRACTS) => {
|
|
152
|
-
total: bigint
|
|
153
|
-
getItem: GetItemCallFunction<T>
|
|
154
|
-
},
|
|
155
|
-
options: {
|
|
156
|
-
blockNumber?: bigint
|
|
157
|
-
firstIndex?: bigint
|
|
158
|
-
} = {},
|
|
159
|
-
) {
|
|
160
|
-
const { total, getItem } = cb(CONTRACTS)
|
|
161
|
-
return (iteratorQuery as any)(this.publicClient, total, getItem, options, this.addressResolver) as ReturnType<
|
|
162
|
-
typeof iteratorQuery<T>
|
|
163
|
-
>
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
async getSwapInstructionsAmountOut(payload: {
|
|
167
|
-
tokenIn: Address
|
|
168
|
-
tokenOut: Address
|
|
169
|
-
amountIn: bigint
|
|
170
|
-
slippage: bigint
|
|
171
|
-
includeLegoIds?: bigint[]
|
|
172
|
-
}) {
|
|
173
|
-
return getSwapInstructionsAmountOut(this.publicClient, payload, this.addressResolver)
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
async getSwapInstructionsAmountIn(payload: {
|
|
177
|
-
tokenIn: Address
|
|
178
|
-
tokenOut: Address
|
|
179
|
-
amountOut: bigint
|
|
180
|
-
amountInAvailable: bigint
|
|
181
|
-
slippage: bigint
|
|
182
|
-
includeLegoIds?: bigint[]
|
|
183
|
-
}) {
|
|
184
|
-
return getSwapInstructionsAmountIn(this.publicClient, payload)
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
DEPARTMENT_IDS = DEPARTMENT_IDS
|
|
188
|
-
|
|
189
|
-
LEGOS_IDS = LEGOS_IDS
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export default Underscore
|
package/tsconfig.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"jsx": "react-jsx",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"moduleResolution": "NodeNext",
|
|
6
|
-
"target": "ES2021",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"outDir": "dist",
|
|
9
|
-
"rootDir": "src",
|
|
10
|
-
"declaration": true,
|
|
11
|
-
"declarationMap": true,
|
|
12
|
-
"esModuleInterop": true,
|
|
13
|
-
"skipLibCheck": true,
|
|
14
|
-
"resolveJsonModule": true
|
|
15
|
-
},
|
|
16
|
-
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
17
|
-
"exclude": ["node_modules"]
|
|
18
|
-
}
|