@underscore-finance/sdk 0.3.2 → 0.3.3
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/AddyRegistry.d.ts +3 -1
- package/dist/contracts/AddyRegistry.d.ts.map +1 -1
- package/dist/contracts/AddyRegistry.js +50 -48
- package/dist/contracts/AddyRegistry_v1.d.ts +2 -0
- package/dist/contracts/AddyRegistry_v1.d.ts.map +1 -1
- package/dist/contracts/AddyRegistry_v1.js +2 -0
- package/dist/contracts/AddyRegistry_v2.d.ts +2 -0
- package/dist/contracts/AddyRegistry_v2.d.ts.map +1 -1
- package/dist/contracts/AddyRegistry_v2.js +2 -0
- package/dist/contracts/Agent.d.ts +3 -1
- package/dist/contracts/Agent.d.ts.map +1 -1
- package/dist/contracts/Agent.js +33 -31
- package/dist/contracts/AgentFactory.d.ts +3 -1
- package/dist/contracts/AgentFactory.d.ts.map +1 -1
- package/dist/contracts/AgentFactory.js +83 -81
- package/dist/contracts/AgentFactory_v1.d.ts +2 -0
- package/dist/contracts/AgentFactory_v1.d.ts.map +1 -1
- package/dist/contracts/AgentFactory_v1.js +2 -0
- package/dist/contracts/AgentFactory_v2.d.ts +2 -0
- package/dist/contracts/AgentFactory_v2.d.ts.map +1 -1
- package/dist/contracts/AgentFactory_v2.js +2 -0
- package/dist/contracts/Agent_v1.d.ts +3 -1
- package/dist/contracts/Agent_v1.d.ts.map +1 -1
- package/dist/contracts/Agent_v1.js +33 -31
- package/dist/contracts/Agent_v2.d.ts +3 -1
- package/dist/contracts/Agent_v2.d.ts.map +1 -1
- package/dist/contracts/Agent_v2.js +33 -31
- package/dist/contracts/ChainlinkFeeds.d.ts +2 -0
- package/dist/contracts/ChainlinkFeeds.d.ts.map +1 -1
- package/dist/contracts/ChainlinkFeeds.js +2 -0
- package/dist/contracts/ERC20.d.ts +3 -1
- package/dist/contracts/ERC20.d.ts.map +1 -1
- package/dist/contracts/ERC20.js +15 -13
- package/dist/contracts/LegoAaveV3.d.ts +2 -0
- package/dist/contracts/LegoAaveV3.d.ts.map +1 -1
- package/dist/contracts/LegoAaveV3.js +2 -0
- package/dist/contracts/LegoAeroClassic.d.ts +2 -0
- package/dist/contracts/LegoAeroClassic.d.ts.map +1 -1
- package/dist/contracts/LegoAeroClassic.js +2 -0
- package/dist/contracts/LegoAeroSlipstream.d.ts +2 -0
- package/dist/contracts/LegoAeroSlipstream.d.ts.map +1 -1
- package/dist/contracts/LegoAeroSlipstream.js +2 -0
- package/dist/contracts/LegoCommon.d.ts +3 -1
- package/dist/contracts/LegoCommon.d.ts.map +1 -1
- package/dist/contracts/LegoCommon.js +10 -8
- package/dist/contracts/LegoCompoundV3.d.ts +2 -0
- package/dist/contracts/LegoCompoundV3.d.ts.map +1 -1
- package/dist/contracts/LegoCompoundV3.js +2 -0
- package/dist/contracts/LegoCredit.d.ts +3 -1
- package/dist/contracts/LegoCredit.d.ts.map +1 -1
- package/dist/contracts/LegoCredit.js +5 -3
- package/dist/contracts/LegoCurve.d.ts +2 -0
- package/dist/contracts/LegoCurve.d.ts.map +1 -1
- package/dist/contracts/LegoCurve.js +2 -0
- package/dist/contracts/LegoDex.d.ts +3 -1
- package/dist/contracts/LegoDex.d.ts.map +1 -1
- package/dist/contracts/LegoDex.js +16 -14
- package/dist/contracts/LegoEuler.d.ts +2 -0
- package/dist/contracts/LegoEuler.d.ts.map +1 -1
- package/dist/contracts/LegoEuler.js +2 -0
- package/dist/contracts/LegoFluid.d.ts +2 -0
- package/dist/contracts/LegoFluid.d.ts.map +1 -1
- package/dist/contracts/LegoFluid.js +2 -0
- package/dist/contracts/LegoHelper.d.ts +3 -1
- package/dist/contracts/LegoHelper.d.ts.map +1 -1
- package/dist/contracts/LegoHelper.js +56 -54
- package/dist/contracts/LegoMoonwell.d.ts +2 -0
- package/dist/contracts/LegoMoonwell.d.ts.map +1 -1
- package/dist/contracts/LegoMoonwell.js +2 -0
- package/dist/contracts/LegoMorpho.d.ts +2 -0
- package/dist/contracts/LegoMorpho.d.ts.map +1 -1
- package/dist/contracts/LegoMorpho.js +2 -0
- package/dist/contracts/LegoRegistry.d.ts +3 -1
- package/dist/contracts/LegoRegistry.d.ts.map +1 -1
- package/dist/contracts/LegoRegistry.js +50 -48
- package/dist/contracts/LegoSky.d.ts +2 -0
- package/dist/contracts/LegoSky.d.ts.map +1 -1
- package/dist/contracts/LegoSky.js +2 -0
- package/dist/contracts/LegoUniswapV2.d.ts +2 -0
- package/dist/contracts/LegoUniswapV2.d.ts.map +1 -1
- package/dist/contracts/LegoUniswapV2.js +2 -0
- package/dist/contracts/LegoUniswapV3.d.ts +2 -0
- package/dist/contracts/LegoUniswapV3.d.ts.map +1 -1
- package/dist/contracts/LegoUniswapV3.js +2 -0
- package/dist/contracts/LegoYield.d.ts +3 -1
- package/dist/contracts/LegoYield.d.ts.map +1 -1
- package/dist/contracts/LegoYield.js +15 -13
- package/dist/contracts/OracleParser.d.ts +3 -1
- package/dist/contracts/OracleParser.d.ts.map +1 -1
- package/dist/contracts/OracleParser.js +9 -7
- package/dist/contracts/OracleRegistry.d.ts +3 -1
- package/dist/contracts/OracleRegistry.d.ts.map +1 -1
- package/dist/contracts/OracleRegistry.js +55 -53
- package/dist/contracts/PriceSheets.d.ts +3 -1
- package/dist/contracts/PriceSheets.d.ts.map +1 -1
- package/dist/contracts/PriceSheets.js +47 -45
- package/dist/contracts/PythFeeds.d.ts +2 -0
- package/dist/contracts/PythFeeds.d.ts.map +1 -1
- package/dist/contracts/PythFeeds.js +2 -0
- package/dist/contracts/StorkFeeds.d.ts +2 -0
- package/dist/contracts/StorkFeeds.d.ts.map +1 -1
- package/dist/contracts/StorkFeeds.js +2 -0
- package/dist/contracts/UserWallet.d.ts +3 -1
- package/dist/contracts/UserWallet.d.ts.map +1 -1
- package/dist/contracts/UserWallet.js +26 -24
- package/dist/contracts/UserWalletConfig.d.ts +3 -1
- package/dist/contracts/UserWalletConfig.d.ts.map +1 -1
- package/dist/contracts/UserWalletConfig.js +65 -63
- package/dist/contracts/UserWalletConfig_v1.d.ts +3 -1
- package/dist/contracts/UserWalletConfig_v1.d.ts.map +1 -1
- package/dist/contracts/UserWalletConfig_v1.js +43 -41
- package/dist/contracts/UserWalletConfig_v2.d.ts +3 -1
- package/dist/contracts/UserWalletConfig_v2.d.ts.map +1 -1
- package/dist/contracts/UserWalletConfig_v2.js +47 -45
- package/dist/contracts/UserWallet_v1.d.ts +3 -1
- package/dist/contracts/UserWallet_v1.d.ts.map +1 -1
- package/dist/contracts/UserWallet_v1.js +26 -24
- package/dist/contracts/UserWallet_v2.d.ts +3 -1
- package/dist/contracts/UserWallet_v2.d.ts.map +1 -1
- package/dist/contracts/UserWallet_v2.js +24 -22
- package/dist/contracts/sdk.d.ts +6 -6
- package/dist/contracts/sdk.d.ts.map +1 -1
- package/dist/contracts/sdk.js +6 -6
- package/dist/index.d.ts +363 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -8
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
import { createPublicClient, http } from 'viem';
|
|
2
|
-
import { base } from 'viem/chains';
|
|
2
|
+
import { base, baseSepolia } from 'viem/chains';
|
|
3
|
+
import { AddyRegistry, AgentFactory, LegoRegistry, OracleRegistry, PriceSheets } from './contracts/index.js';
|
|
3
4
|
import * as LegoHelper from './contracts/LegoHelper.js';
|
|
4
5
|
import createSdk from './contracts/sdk.js';
|
|
5
6
|
export * from './contracts/index.js';
|
|
7
|
+
const TESTNET_ADDRESSES = {
|
|
8
|
+
AddyRegistry: '0xa89a59E14333187829528C50eBAaE6EC12Bae95d',
|
|
9
|
+
AgentFactory: '0x50d08c554b0F7F4784B7108103e586eccb522b8E',
|
|
10
|
+
UserWalletTemplate: '0x5081a0ff1F3518aE7D3c6E5106CC820EB5d472a5',
|
|
11
|
+
UserWalletConfigTemplate: '0xC12152418FDF2daE2A45C3D07AdFf9f6f1249BbA',
|
|
12
|
+
AgentTemplate: '0xfd1255e086b0E045EfBFa9E3e99aE9A450BDc486',
|
|
13
|
+
LegoRegistry: '0xf6a8bE55c84b94Fe071575EF52F095A23c282eea',
|
|
14
|
+
OracleRegistry: '0x2c794b3864480fAfF791cD46400E061f818cE42f',
|
|
15
|
+
PriceSheets: '0x155d0ECd672D7a1050d34eC0a1006d67823C3123',
|
|
16
|
+
LegoHelper: '0x98dD9D8591D826E285052f23F450c8d702f07a18',
|
|
17
|
+
};
|
|
6
18
|
class Underscore {
|
|
7
19
|
constructor(config) {
|
|
8
20
|
this.publicClient =
|
|
9
21
|
config?.publicClient ||
|
|
10
22
|
createPublicClient({
|
|
11
|
-
chain: base,
|
|
23
|
+
chain: config?.isTestnet ? baseSepolia : base,
|
|
12
24
|
transport: http(config?.rpcUrl),
|
|
13
25
|
});
|
|
14
26
|
this.walletClient = config?.walletClient;
|
|
15
27
|
this.contracts = createSdk(this.publicClient, this.walletClient);
|
|
28
|
+
this.isTestnet = config?.isTestnet ?? false;
|
|
16
29
|
}
|
|
17
30
|
setWalletClient(walletClient) {
|
|
18
31
|
this.walletClient = walletClient;
|
|
@@ -43,7 +56,11 @@ class Underscore {
|
|
|
43
56
|
return instructions.result;
|
|
44
57
|
}
|
|
45
58
|
get Registry() {
|
|
46
|
-
|
|
59
|
+
const deployAddress = this.isTestnet ? TESTNET_ADDRESSES.AddyRegistry : AddyRegistry.deployAddress;
|
|
60
|
+
return {
|
|
61
|
+
...this.contracts.AddyRegistry(deployAddress),
|
|
62
|
+
deployAddress,
|
|
63
|
+
};
|
|
47
64
|
}
|
|
48
65
|
/**
|
|
49
66
|
* @deprecated Use `Registry` instead. This version is for legacy compatibility.
|
|
@@ -58,7 +75,11 @@ class Underscore {
|
|
|
58
75
|
return this.contracts.AddyRegistry_v2;
|
|
59
76
|
}
|
|
60
77
|
get Factory() {
|
|
61
|
-
|
|
78
|
+
const deployAddress = this.isTestnet ? TESTNET_ADDRESSES.AgentFactory : AgentFactory.deployAddress;
|
|
79
|
+
return {
|
|
80
|
+
...this.contracts.AgentFactory(deployAddress),
|
|
81
|
+
deployAddress,
|
|
82
|
+
};
|
|
62
83
|
}
|
|
63
84
|
/**
|
|
64
85
|
* @deprecated Use `Factory` instead. This version is for legacy compatibility.
|
|
@@ -73,16 +94,32 @@ class Underscore {
|
|
|
73
94
|
return this.contracts.AgentFactory_v1;
|
|
74
95
|
}
|
|
75
96
|
get OracleRegistry() {
|
|
76
|
-
|
|
97
|
+
const deployAddress = this.isTestnet ? TESTNET_ADDRESSES.OracleRegistry : OracleRegistry.deployAddress;
|
|
98
|
+
return {
|
|
99
|
+
...this.contracts.OracleRegistry(deployAddress),
|
|
100
|
+
deployAddress,
|
|
101
|
+
};
|
|
77
102
|
}
|
|
78
103
|
get LegoRegistry() {
|
|
79
|
-
|
|
104
|
+
const deployAddress = this.isTestnet ? TESTNET_ADDRESSES.LegoRegistry : LegoRegistry.deployAddress;
|
|
105
|
+
return {
|
|
106
|
+
...this.contracts.LegoRegistry(deployAddress),
|
|
107
|
+
deployAddress,
|
|
108
|
+
};
|
|
80
109
|
}
|
|
81
110
|
get LegoHelper() {
|
|
82
|
-
|
|
111
|
+
const deployAddress = this.isTestnet ? TESTNET_ADDRESSES.LegoHelper : LegoHelper.deployAddress;
|
|
112
|
+
return {
|
|
113
|
+
...this.contracts.LegoHelper(deployAddress),
|
|
114
|
+
deployAddress,
|
|
115
|
+
};
|
|
83
116
|
}
|
|
84
117
|
get PriceSheets() {
|
|
85
|
-
|
|
118
|
+
const deployAddress = this.isTestnet ? TESTNET_ADDRESSES.PriceSheets : PriceSheets.deployAddress;
|
|
119
|
+
return {
|
|
120
|
+
...this.contracts.PriceSheets(deployAddress),
|
|
121
|
+
deployAddress,
|
|
122
|
+
};
|
|
86
123
|
}
|
|
87
124
|
get Agent() {
|
|
88
125
|
return { at: (address) => this.contracts.Agent(address) };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@underscore-finance/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
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,6 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@dappql/async": "^1.0.3",
|
|
33
|
+
"dappql": "^2.0.29",
|
|
33
34
|
"viem": "^2.23.7"
|
|
34
35
|
}
|
|
35
36
|
}
|