@gearbox-protocol/sdk 14.1.1 → 14.2.1
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/cjs/dev/claimDSToken.js +208 -0
- package/dist/cjs/plugins/accounts/AccountsPlugin.js +1 -2
- package/dist/cjs/sdk/OnchainSDK.js +12 -0
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +1448 -23
- package/dist/cjs/sdk/accounts/index.js +0 -4
- package/dist/cjs/sdk/market/credit/CreditFacadeV310Contract.js +6 -0
- package/dist/cjs/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +19 -2
- package/dist/cjs/sdk/market/kyc/securitize/types.js +20 -0
- package/dist/cjs/sdk/market/oracle/PriceOracleV310Contract.js +26 -0
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -0
- package/dist/esm/dev/claimDSToken.js +187 -0
- package/dist/esm/plugins/accounts/AccountsPlugin.js +2 -7
- package/dist/esm/sdk/OnchainSDK.js +14 -0
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +1466 -23
- package/dist/esm/sdk/accounts/index.js +0 -2
- package/dist/esm/sdk/accounts/multicall-utils.js +1 -5
- package/dist/esm/sdk/market/credit/CreditFacadeV310Contract.js +6 -0
- package/dist/esm/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +21 -2
- package/dist/esm/sdk/market/kyc/securitize/types.js +12 -0
- package/dist/esm/sdk/market/oracle/PriceOracleV310Contract.js +26 -0
- package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -0
- package/dist/types/dev/claimDSToken.d.ts +34 -0
- package/dist/types/sdk/OnchainSDK.d.ts +10 -0
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +181 -3
- package/dist/types/sdk/accounts/index.d.ts +0 -2
- package/dist/types/sdk/accounts/types.d.ts +56 -0
- package/dist/types/sdk/market/credit/CreditFacadeV310Contract.d.ts +2 -0
- package/dist/types/sdk/market/kyc/securitize/SecuritizeKYCFactory.d.ts +1 -1
- package/dist/types/sdk/market/kyc/securitize/types.d.ts +37 -22
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +5 -0
- package/dist/types/sdk/market/oracle/PriceOracleV310Contract.d.ts +4 -0
- package/dist/types/sdk/market/oracle/types.d.ts +9 -0
- package/dist/types/sdk/pools/types.d.ts +19 -0
- package/package.json +1 -1
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +0 -1411
- package/dist/cjs/sdk/accounts/createCreditAccountService.js +0 -35
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +0 -1405
- package/dist/esm/sdk/accounts/createCreditAccountService.js +0 -11
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +0 -226
- package/dist/types/sdk/accounts/createCreditAccountService.d.ts +0 -9
|
@@ -15,14 +15,10 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
15
15
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
16
|
var accounts_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(accounts_exports);
|
|
18
|
-
__reExport(accounts_exports, require("./AbstractCreditAccountsService.js"), module.exports);
|
|
19
18
|
__reExport(accounts_exports, require("./CreditAccountsServiceV310.js"), module.exports);
|
|
20
|
-
__reExport(accounts_exports, require("./createCreditAccountService.js"), module.exports);
|
|
21
19
|
__reExport(accounts_exports, require("./types.js"), module.exports);
|
|
22
20
|
// Annotate the CommonJS export names for ESM import in node:
|
|
23
21
|
0 && (module.exports = {
|
|
24
|
-
...require("./AbstractCreditAccountsService.js"),
|
|
25
22
|
...require("./CreditAccountsServiceV310.js"),
|
|
26
|
-
...require("./createCreditAccountService.js"),
|
|
27
23
|
...require("./types.js")
|
|
28
24
|
});
|
|
@@ -79,6 +79,12 @@ class CreditFacadeV310Contract extends import_CreditFacadeV310BaseContract.Credi
|
|
|
79
79
|
args: lossPolicyData ? [ca, to, calls, lossPolicyData] : [ca, to, calls]
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
+
partiallyLiquidateCreditAccount(ca, token, repaidAmount, minSeizedAmount, to, updates) {
|
|
83
|
+
return this.createRawTx({
|
|
84
|
+
functionName: "partiallyLiquidateCreditAccount",
|
|
85
|
+
args: [ca, token, repaidAmount, minSeizedAmount, to, updates]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
82
88
|
closeCreditAccount(ca, calls) {
|
|
83
89
|
return this.createRawTx({
|
|
84
90
|
functionName: "closeCreditAccount",
|
|
@@ -26,6 +26,7 @@ var import_iSecuritizeKYCFactory = require("../../../../abi/kyc/iSecuritizeKYCFa
|
|
|
26
26
|
var import_base = require("../../../base/index.js");
|
|
27
27
|
var import_utils = require("../../../utils/index.js");
|
|
28
28
|
var import_constants = require("./constants.js");
|
|
29
|
+
var import_types = require("./types.js");
|
|
29
30
|
const abi = import_iSecuritizeKYCFactory.iSecuritizeKYCFactoryAbi;
|
|
30
31
|
class SecuritizeKYCFactory extends import_base.BaseContract {
|
|
31
32
|
#sdk;
|
|
@@ -93,7 +94,23 @@ class SecuritizeKYCFactory extends import_base.BaseContract {
|
|
|
93
94
|
type: import_constants.KYC_FACTORY_SECURITIZE,
|
|
94
95
|
factory: this.address,
|
|
95
96
|
cachedSignatures: [...cachedSignatures],
|
|
96
|
-
registerVaultMessages:
|
|
97
|
+
registerVaultMessages: registerVaultMessages.map((m) => ({
|
|
98
|
+
types: import_types.SECURITIZE_REGISTER_VAULT_TYPES,
|
|
99
|
+
primaryType: "RegisterVault",
|
|
100
|
+
domain: {
|
|
101
|
+
name: m.domain.name,
|
|
102
|
+
version: m.domain.version,
|
|
103
|
+
chainId: m.domain.chainId,
|
|
104
|
+
verifyingContract: m.domain.verifyingContract
|
|
105
|
+
},
|
|
106
|
+
message: {
|
|
107
|
+
investor: m.investor,
|
|
108
|
+
operator: m.operator,
|
|
109
|
+
token: m.token,
|
|
110
|
+
nonce: m.nonce,
|
|
111
|
+
deadline: m.deadline
|
|
112
|
+
}
|
|
113
|
+
})),
|
|
97
114
|
registeredTokens: [...registeredTokens],
|
|
98
115
|
creditAccounts: creditAccounts.map((ca) => {
|
|
99
116
|
const [registeredTokens2] = (0, import_viem.decodeAbiParameters)(
|
|
@@ -163,7 +180,7 @@ class SecuritizeKYCFactory extends import_base.BaseContract {
|
|
|
163
180
|
const unsignedTokens = tokensToRegister.difference(signedTokens);
|
|
164
181
|
const securitizeTokensToRegister = tokensToRegister.difference(registredTokens);
|
|
165
182
|
const requiredSignatures = investorData.registerVaultMessages.filter(
|
|
166
|
-
(m) => unsignedTokens.has(m.token)
|
|
183
|
+
(m) => unsignedTokens.has(m.message.token)
|
|
167
184
|
);
|
|
168
185
|
return {
|
|
169
186
|
type: import_constants.KYC_FACTORY_SECURITIZE,
|
|
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
6
10
|
var __copyProps = (to, from, except, desc) => {
|
|
7
11
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
12
|
for (let key of __getOwnPropNames(from))
|
|
@@ -13,4 +17,20 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
17
|
};
|
|
14
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
19
|
var types_exports = {};
|
|
20
|
+
__export(types_exports, {
|
|
21
|
+
SECURITIZE_REGISTER_VAULT_TYPES: () => SECURITIZE_REGISTER_VAULT_TYPES
|
|
22
|
+
});
|
|
16
23
|
module.exports = __toCommonJS(types_exports);
|
|
24
|
+
const SECURITIZE_REGISTER_VAULT_TYPES = {
|
|
25
|
+
RegisterVault: [
|
|
26
|
+
{ name: "investor", type: "address" },
|
|
27
|
+
{ name: "operator", type: "address" },
|
|
28
|
+
{ name: "token", type: "address" },
|
|
29
|
+
{ name: "nonce", type: "uint256" },
|
|
30
|
+
{ name: "deadline", type: "uint256" }
|
|
31
|
+
]
|
|
32
|
+
};
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
SECURITIZE_REGISTER_VAULT_TYPES
|
|
36
|
+
});
|
|
@@ -23,6 +23,7 @@ __export(PriceOracleV310Contract_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(PriceOracleV310Contract_exports);
|
|
24
24
|
var import_viem = require("viem");
|
|
25
25
|
var import_generated = require("../../../abi/310/generated.js");
|
|
26
|
+
var import_simulateWithPriceUpdates = require("../../utils/viem/simulateWithPriceUpdates.js");
|
|
26
27
|
var import_pricefeeds = require("../pricefeeds/index.js");
|
|
27
28
|
var import_PriceOracleBaseContract = require("./PriceOracleBaseContract.js");
|
|
28
29
|
const abi = import_generated.iPriceOracleV310Abi;
|
|
@@ -64,6 +65,31 @@ class PriceOracleV310Contract extends import_PriceOracleBaseContract.PriceOracle
|
|
|
64
65
|
]
|
|
65
66
|
};
|
|
66
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* {@inheritDoc IPriceOracleContract.updateAndConvert}
|
|
70
|
+
**/
|
|
71
|
+
async updateAndConvert(from, to, amount) {
|
|
72
|
+
const fromFeed = this.mainPriceFeeds.mustGet(from).priceFeed;
|
|
73
|
+
const toFeed = this.mainPriceFeeds.mustGet(to).priceFeed;
|
|
74
|
+
const updates = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs([
|
|
75
|
+
fromFeed,
|
|
76
|
+
toFeed
|
|
77
|
+
]);
|
|
78
|
+
const [result] = await (0, import_simulateWithPriceUpdates.simulateWithPriceUpdates)(this.sdk.client, {
|
|
79
|
+
priceUpdates: updates.txs,
|
|
80
|
+
contracts: [
|
|
81
|
+
{
|
|
82
|
+
abi: this.contract.abi,
|
|
83
|
+
functionName: "convert",
|
|
84
|
+
args: [amount, from, to],
|
|
85
|
+
address: this.contract.address
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
strictPrices: true,
|
|
89
|
+
gas: this.sdk.gasLimit
|
|
90
|
+
});
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
67
93
|
processLog(log) {
|
|
68
94
|
switch (log.eventName) {
|
|
69
95
|
case "SetPriceFeed":
|
|
@@ -101,6 +101,9 @@ class PriceFeedRegister extends import_base.SDKConstruct {
|
|
|
101
101
|
updateables = this.sdk.marketRegister.priceOracles.flatMap((o) => o.reservePriceFeeds.values()).flatMap((pf) => pf.priceFeed.updatableDependencies());
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
+
if (updateables.length === 0) {
|
|
105
|
+
return { txs: [], timestamp: 0 };
|
|
106
|
+
}
|
|
104
107
|
const txs = [];
|
|
105
108
|
const latestUpdate = {
|
|
106
109
|
updates: [],
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import {
|
|
2
|
+
erc20Abi
|
|
3
|
+
} from "viem";
|
|
4
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
5
|
+
import { iDSRegistryServiceAbi } from "../abi/kyc/iDSRegistryService.js";
|
|
6
|
+
import { iDSTokenAbi } from "../abi/kyc/iDSToken.js";
|
|
7
|
+
import {
|
|
8
|
+
MAX_UINT256,
|
|
9
|
+
OnchainSDK
|
|
10
|
+
} from "../sdk/index.js";
|
|
11
|
+
async function writeAndWait(anvil, params) {
|
|
12
|
+
const hash = await anvil.writeContract(params);
|
|
13
|
+
await anvil.mine({ blocks: 1 });
|
|
14
|
+
await anvil.waitForTransactionReceipt({
|
|
15
|
+
hash,
|
|
16
|
+
pollingInterval: 100
|
|
17
|
+
});
|
|
18
|
+
return hash;
|
|
19
|
+
}
|
|
20
|
+
async function registerInvestor(props) {
|
|
21
|
+
const { claimer, anvil, token, adminPrivateKey, logger } = props;
|
|
22
|
+
const account = privateKeyToAccount(adminPrivateKey);
|
|
23
|
+
const registryServiceId = await anvil.readContract({
|
|
24
|
+
address: token,
|
|
25
|
+
abi: iDSTokenAbi,
|
|
26
|
+
functionName: "REGISTRY_SERVICE"
|
|
27
|
+
});
|
|
28
|
+
const registryService = await anvil.readContract({
|
|
29
|
+
address: token,
|
|
30
|
+
abi: iDSTokenAbi,
|
|
31
|
+
functionName: "getDSService",
|
|
32
|
+
args: [registryServiceId]
|
|
33
|
+
});
|
|
34
|
+
logger?.debug(`Registry service: ${registryService} (${registryServiceId})`);
|
|
35
|
+
const [isRegistered, ACCREDITED, APPROVED] = await anvil.multicall({
|
|
36
|
+
contracts: [
|
|
37
|
+
{
|
|
38
|
+
address: registryService,
|
|
39
|
+
abi: iDSRegistryServiceAbi,
|
|
40
|
+
functionName: "isWallet",
|
|
41
|
+
args: [claimer]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
address: registryService,
|
|
45
|
+
abi: iDSRegistryServiceAbi,
|
|
46
|
+
functionName: "ACCREDITED",
|
|
47
|
+
args: []
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
address: registryService,
|
|
51
|
+
abi: iDSRegistryServiceAbi,
|
|
52
|
+
functionName: "APPROVED",
|
|
53
|
+
args: []
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
allowFailure: false
|
|
57
|
+
});
|
|
58
|
+
if (!isRegistered) {
|
|
59
|
+
logger?.debug(
|
|
60
|
+
`Claimer ${claimer} is not a registered wallet, registering...`
|
|
61
|
+
);
|
|
62
|
+
const investorId = `investor-${claimer.toLowerCase()}`;
|
|
63
|
+
const investorExists = await anvil.readContract({
|
|
64
|
+
address: registryService,
|
|
65
|
+
abi: iDSRegistryServiceAbi,
|
|
66
|
+
functionName: "isInvestor",
|
|
67
|
+
args: [investorId]
|
|
68
|
+
});
|
|
69
|
+
if (!investorExists) {
|
|
70
|
+
await writeAndWait(anvil, {
|
|
71
|
+
account,
|
|
72
|
+
chain: anvil.chain,
|
|
73
|
+
address: registryService,
|
|
74
|
+
abi: iDSRegistryServiceAbi,
|
|
75
|
+
functionName: "registerInvestor",
|
|
76
|
+
args: [investorId, investorId]
|
|
77
|
+
});
|
|
78
|
+
logger?.debug(`Registered investor "${investorId}"`);
|
|
79
|
+
}
|
|
80
|
+
await writeAndWait(anvil, {
|
|
81
|
+
account,
|
|
82
|
+
chain: anvil.chain,
|
|
83
|
+
address: registryService,
|
|
84
|
+
abi: iDSRegistryServiceAbi,
|
|
85
|
+
functionName: "addWallet",
|
|
86
|
+
args: [claimer, investorId]
|
|
87
|
+
});
|
|
88
|
+
logger?.debug(`Added wallet ${claimer} for investor "${investorId}"`);
|
|
89
|
+
try {
|
|
90
|
+
await writeAndWait(anvil, {
|
|
91
|
+
account,
|
|
92
|
+
chain: anvil.chain,
|
|
93
|
+
address: registryService,
|
|
94
|
+
abi: iDSRegistryServiceAbi,
|
|
95
|
+
functionName: "setCountry",
|
|
96
|
+
args: [investorId, "US"]
|
|
97
|
+
});
|
|
98
|
+
logger?.debug(`Set country for investor "${investorId}" to "US"`);
|
|
99
|
+
await writeAndWait(anvil, {
|
|
100
|
+
account,
|
|
101
|
+
chain: anvil.chain,
|
|
102
|
+
address: registryService,
|
|
103
|
+
abi: iDSRegistryServiceAbi,
|
|
104
|
+
functionName: "setAttribute",
|
|
105
|
+
args: [
|
|
106
|
+
investorId,
|
|
107
|
+
ACCREDITED,
|
|
108
|
+
BigInt(APPROVED),
|
|
109
|
+
MAX_UINT256,
|
|
110
|
+
"fake proof"
|
|
111
|
+
]
|
|
112
|
+
});
|
|
113
|
+
logger?.debug(`Set attributes for investor "${investorId}"`);
|
|
114
|
+
} catch (e) {
|
|
115
|
+
logger?.error(e);
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
logger?.debug(`Claimer ${claimer} is already a registered wallet`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async function claimDSToken(props) {
|
|
122
|
+
const {
|
|
123
|
+
anvil,
|
|
124
|
+
claimer,
|
|
125
|
+
adminPrivateKey,
|
|
126
|
+
token,
|
|
127
|
+
marketConfigurators,
|
|
128
|
+
kycFactories,
|
|
129
|
+
usdAmount: usdAmountProp = "100000"
|
|
130
|
+
} = props;
|
|
131
|
+
const account = privateKeyToAccount(adminPrivateKey);
|
|
132
|
+
const symbol = await anvil.readContract({
|
|
133
|
+
address: token,
|
|
134
|
+
abi: erc20Abi,
|
|
135
|
+
functionName: "symbol",
|
|
136
|
+
args: []
|
|
137
|
+
});
|
|
138
|
+
const logger = props.logger?.child?.({ symbol });
|
|
139
|
+
const usdAmount = BigInt(usdAmountProp) * 10n ** 8n;
|
|
140
|
+
const sdk = new OnchainSDK(anvil.chain.network, {
|
|
141
|
+
client: anvil,
|
|
142
|
+
timeout: 12e4
|
|
143
|
+
});
|
|
144
|
+
await sdk.attach({ marketConfigurators, kycFactories });
|
|
145
|
+
let amount = 0n;
|
|
146
|
+
for (const market of sdk.marketRegister.markets) {
|
|
147
|
+
try {
|
|
148
|
+
amount = market.priceOracle.convertFromUSD(token, usdAmount);
|
|
149
|
+
} catch {
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (amount === 0n) {
|
|
153
|
+
throw new Error(`No market found for token ${token}`);
|
|
154
|
+
}
|
|
155
|
+
logger?.debug(`${usdAmountProp} USD === ${amount} ${symbol}`);
|
|
156
|
+
await registerInvestor({ ...props, logger });
|
|
157
|
+
logger?.debug(`Issuing ${amount} tokens to ${claimer}...`);
|
|
158
|
+
const mintHash = await writeAndWait(anvil, {
|
|
159
|
+
account,
|
|
160
|
+
chain: anvil.chain,
|
|
161
|
+
address: token,
|
|
162
|
+
abi: iDSTokenAbi,
|
|
163
|
+
functionName: "issueTokens",
|
|
164
|
+
args: [claimer, amount]
|
|
165
|
+
});
|
|
166
|
+
logger?.debug(`Done! tx: ${mintHash}`);
|
|
167
|
+
const balance = await anvil.readContract({
|
|
168
|
+
address: token,
|
|
169
|
+
abi: erc20Abi,
|
|
170
|
+
functionName: "balanceOf",
|
|
171
|
+
args: [claimer]
|
|
172
|
+
});
|
|
173
|
+
logger?.debug(
|
|
174
|
+
`Balance of ${claimer}: ${sdk.tokensMeta.formatBN(token, balance)}`
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
async function claimDSTokens(props) {
|
|
178
|
+
const { tokens, ...rest } = props;
|
|
179
|
+
for (const token of tokens) {
|
|
180
|
+
await claimDSToken({ ...rest, token });
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
export {
|
|
184
|
+
claimDSToken,
|
|
185
|
+
claimDSTokens,
|
|
186
|
+
registerInvestor
|
|
187
|
+
};
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AddressMap,
|
|
3
|
-
BasePlugin,
|
|
4
|
-
createCreditAccountService
|
|
5
|
-
} from "../../sdk/index.js";
|
|
1
|
+
import { AddressMap, BasePlugin } from "../../sdk/index.js";
|
|
6
2
|
class AccountsPlugin extends BasePlugin {
|
|
7
3
|
#accounts;
|
|
8
4
|
#byCreditManager;
|
|
@@ -31,8 +27,7 @@ class AccountsPlugin extends BasePlugin {
|
|
|
31
27
|
if (!force && this.loaded) {
|
|
32
28
|
return this.state;
|
|
33
29
|
}
|
|
34
|
-
const
|
|
35
|
-
const accounts = await service.getCreditAccounts(
|
|
30
|
+
const accounts = await this.sdk.accounts.getCreditAccounts(
|
|
36
31
|
this.#options,
|
|
37
32
|
this.sdk.currentBlock
|
|
38
33
|
);
|
|
@@ -4,6 +4,9 @@ import {
|
|
|
4
4
|
http,
|
|
5
5
|
parseEventLogs
|
|
6
6
|
} from "viem";
|
|
7
|
+
import {
|
|
8
|
+
CreditAccountsServiceV310
|
|
9
|
+
} from "./accounts/index.js";
|
|
7
10
|
import { ChainContractsRegister } from "./base/index.js";
|
|
8
11
|
import { getChain } from "./chain/index.js";
|
|
9
12
|
import {
|
|
@@ -26,6 +29,7 @@ import { KYCRegistry } from "./market/index.js";
|
|
|
26
29
|
import { MarketRegister } from "./market/MarketRegister.js";
|
|
27
30
|
import { PriceFeedRegister } from "./market/pricefeeds/index.js";
|
|
28
31
|
import { PluginStateVersionError } from "./plugins/index.js";
|
|
32
|
+
import { PoolService } from "./pools/index.js";
|
|
29
33
|
import { createRouter } from "./router/index.js";
|
|
30
34
|
import { formatTimestamp, TypedObjectUtils, toAddress } from "./utils/index.js";
|
|
31
35
|
import {
|
|
@@ -70,6 +74,14 @@ class OnchainSDK extends ChainContractsRegister {
|
|
|
70
74
|
* When `true`, the SDK throws on unrecognised contract types.
|
|
71
75
|
**/
|
|
72
76
|
strictContractTypes;
|
|
77
|
+
/**
|
|
78
|
+
* Namespace for credit accounts operations.
|
|
79
|
+
*/
|
|
80
|
+
accounts;
|
|
81
|
+
/**
|
|
82
|
+
* Namespace for pool operations.
|
|
83
|
+
*/
|
|
84
|
+
pools;
|
|
73
85
|
/**
|
|
74
86
|
* @param network - Gearbox network type (e.g. `"Mainnet"`, `"Monad"`).
|
|
75
87
|
* @param clientOptions - Connection options (RPC URLs, transport, or client).
|
|
@@ -94,6 +106,8 @@ class OnchainSDK extends ChainContractsRegister {
|
|
|
94
106
|
if (options?.gasLimit !== null) {
|
|
95
107
|
this.gasLimit = options?.gasLimit ?? getChain(this.networkType).gasLimit;
|
|
96
108
|
}
|
|
109
|
+
this.accounts = new CreditAccountsServiceV310(this);
|
|
110
|
+
this.pools = new PoolService(this);
|
|
97
111
|
}
|
|
98
112
|
/**
|
|
99
113
|
* Initialises the SDK by reading live on-chain state.
|