@gearbox-protocol/sdk 14.7.0 → 14.8.0-next.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/abi/compressors/{kycCompressor.js → rwaCompressor.js} +13 -13
- package/dist/cjs/abi/compressors/subcompressors/{kyc/onDemandKYCUnderlyingSubcompressor.js → rwa/onDemandRWAUnderlyingSubcompressor.js} +6 -6
- package/dist/cjs/abi/compressors/subcompressors/{kyc/securitizeKYCFactorySubcompressor.js → rwa/securitizeRWAFactorySubcompressor.js} +6 -6
- package/dist/cjs/abi/{kyc/iKYCCompressor.js → rwa/iRWACompressor.js} +13 -13
- package/dist/cjs/abi/{kyc/iKYCFactory.js → rwa/iRWAFactory.js} +6 -6
- package/dist/cjs/abi/{kyc/iKYCUnderlying.js → rwa/iRWAUnderlying.js} +7 -7
- package/dist/cjs/abi/{kyc/iSecuritizeKYCFactory.js → rwa/iSecuritizeRWAFactory.js} +7 -7
- package/dist/cjs/dev/claimDSToken.js +4 -4
- package/dist/cjs/sdk/OnchainSDK.js +12 -12
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +59 -59
- package/dist/cjs/sdk/base/TokensMeta.js +6 -6
- package/dist/cjs/sdk/base/token-types.js +11 -11
- package/dist/cjs/sdk/chain/chains.js +16 -16
- package/dist/cjs/sdk/constants/address-provider.js +3 -3
- package/dist/cjs/sdk/market/MarketSuite.js +2 -2
- package/dist/cjs/sdk/market/index.js +2 -2
- package/dist/cjs/sdk/market/pool/PoolSuite.js +2 -2
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +3 -3
- package/dist/cjs/sdk/market/{kyc/KYCRegistry.js → rwa/RWARegistry.js} +48 -48
- package/dist/cjs/sdk/market/{kyc → rwa}/index.js +6 -6
- package/dist/cjs/sdk/market/{kyc → rwa}/securitize/SecuritizeDegenNFT.js +1 -1
- package/dist/cjs/sdk/market/{kyc/securitize/SecuritizeKYCFactory.js → rwa/securitize/SecuritizeRWAFactory.js} +20 -20
- package/dist/cjs/sdk/market/{kyc → rwa}/securitize/constants.js +3 -3
- package/dist/cjs/sdk/market/{kyc → rwa}/securitize/index.js +2 -2
- package/dist/cjs/sdk/market/{kyc → rwa}/types.js +6 -6
- package/dist/cjs/sdk/options.js +4 -4
- package/dist/cjs/sdk/pools/PoolService.js +26 -26
- package/dist/esm/abi/compressors/{kycCompressor.js → rwaCompressor.js} +9 -9
- package/dist/esm/abi/compressors/subcompressors/{kyc/onDemandKYCUnderlyingSubcompressor.js → rwa/onDemandRWAUnderlyingSubcompressor.js} +2 -2
- package/dist/esm/abi/compressors/subcompressors/{kyc/securitizeKYCFactorySubcompressor.js → rwa/securitizeRWAFactorySubcompressor.js} +2 -2
- package/dist/esm/abi/{kyc/iKYCCompressor.js → rwa/iRWACompressor.js} +9 -9
- package/dist/esm/abi/{kyc/iKYCFactory.js → rwa/iRWAFactory.js} +2 -2
- package/dist/esm/abi/{kyc/iKYCUnderlying.js → rwa/iRWAUnderlying.js} +3 -3
- package/dist/esm/abi/{kyc/iSecuritizeKYCFactory.js → rwa/iSecuritizeRWAFactory.js} +3 -3
- package/dist/esm/dev/claimDSToken.js +4 -4
- package/dist/esm/sdk/OnchainSDK.js +13 -13
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +59 -59
- package/dist/esm/sdk/base/TokensMeta.js +6 -6
- package/dist/esm/sdk/base/token-types.js +7 -7
- package/dist/esm/sdk/chain/chains.js +16 -16
- package/dist/esm/sdk/constants/address-provider.js +2 -2
- package/dist/esm/sdk/market/MarketSuite.js +2 -2
- package/dist/esm/sdk/market/index.js +1 -1
- package/dist/esm/sdk/market/pool/PoolSuite.js +2 -2
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +3 -3
- package/dist/esm/sdk/market/{kyc/KYCRegistry.js → rwa/RWARegistry.js} +50 -50
- package/dist/esm/sdk/market/{kyc → rwa}/index.js +1 -1
- package/dist/esm/sdk/market/{kyc → rwa}/securitize/SecuritizeDegenNFT.js +1 -1
- package/dist/esm/sdk/market/{kyc/securitize/SecuritizeKYCFactory.js → rwa/securitize/SecuritizeRWAFactory.js} +17 -17
- package/dist/esm/sdk/market/rwa/securitize/constants.js +4 -0
- package/dist/esm/sdk/market/{kyc → rwa}/securitize/index.js +1 -1
- package/dist/esm/sdk/market/rwa/types.js +9 -0
- package/dist/esm/sdk/options.js +4 -4
- package/dist/esm/sdk/pools/PoolService.js +28 -28
- package/dist/types/abi/compressors/{kycCompressor.d.ts → rwaCompressor.d.ts} +8 -8
- package/dist/types/abi/compressors/subcompressors/{kyc/onDemandKYCUnderlyingSubcompressor.d.ts → rwa/onDemandRWAUnderlyingSubcompressor.d.ts} +1 -1
- package/dist/types/abi/compressors/subcompressors/{kyc/securitizeKYCFactorySubcompressor.d.ts → rwa/securitizeRWAFactorySubcompressor.d.ts} +1 -1
- package/dist/types/abi/{kyc/iKYCCompressor.d.ts → rwa/iRWACompressor.d.ts} +8 -8
- package/dist/types/abi/{kyc/iKYCFactory.d.ts → rwa/iRWAFactory.d.ts} +1 -1
- package/dist/types/abi/{kyc/iKYCUnderlying.d.ts → rwa/iRWAUnderlying.d.ts} +2 -2
- package/dist/types/abi/{kyc/iSecuritizeKYCFactory.d.ts → rwa/iSecuritizeRWAFactory.d.ts} +2 -2
- package/dist/types/dev/claimDSToken.d.ts +1 -1
- package/dist/types/sdk/OnchainSDK.d.ts +5 -5
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +19 -19
- package/dist/types/sdk/accounts/types.d.ts +26 -26
- package/dist/types/sdk/base/TokensMeta.d.ts +5 -5
- package/dist/types/sdk/base/token-types.d.ts +17 -17
- package/dist/types/sdk/base/types.d.ts +2 -2
- package/dist/types/sdk/chain/chains.d.ts +2 -2
- package/dist/types/sdk/constants/address-provider.d.ts +1 -1
- package/dist/types/sdk/market/MarketSuite.d.ts +2 -2
- package/dist/types/sdk/market/index.d.ts +1 -1
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +2 -2
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +2 -2
- package/dist/types/sdk/market/rwa/RWARegistry.d.ts +52 -0
- package/dist/types/sdk/market/{kyc → rwa}/index.d.ts +1 -1
- package/dist/types/sdk/market/{kyc/securitize/SecuritizeKYCFactory.d.ts → rwa/securitize/SecuritizeRWAFactory.d.ts} +16 -16
- package/dist/types/sdk/market/rwa/securitize/constants.d.ts +1 -0
- package/dist/types/sdk/market/{kyc → rwa}/securitize/index.d.ts +1 -1
- package/dist/types/sdk/market/{kyc → rwa}/securitize/types.d.ts +12 -12
- package/dist/types/sdk/market/{kyc → rwa}/types.d.ts +48 -48
- package/dist/types/sdk/market/types.d.ts +1 -1
- package/dist/types/sdk/options.d.ts +1 -1
- package/dist/types/sdk/pools/types.d.ts +4 -4
- package/dist/types/sdk/types/state-human.d.ts +2 -2
- package/dist/types/sdk/types/state.d.ts +3 -3
- package/package.json +1 -1
- package/dist/esm/sdk/market/kyc/securitize/constants.js +0 -4
- package/dist/esm/sdk/market/kyc/types.js +0 -9
- package/dist/types/sdk/market/kyc/KYCRegistry.d.ts +0 -52
- package/dist/types/sdk/market/kyc/securitize/constants.d.ts +0 -1
- /package/dist/cjs/abi/{kyc → rwa}/iDSRegistryService.js +0 -0
- /package/dist/cjs/abi/{kyc → rwa}/iDSToken.js +0 -0
- /package/dist/cjs/abi/{kyc → rwa}/iSecuritizeDegenNFT.js +0 -0
- /package/dist/cjs/sdk/market/{kyc → rwa}/securitize/types.js +0 -0
- /package/dist/esm/abi/{kyc → rwa}/iDSRegistryService.js +0 -0
- /package/dist/esm/abi/{kyc → rwa}/iDSToken.js +0 -0
- /package/dist/esm/abi/{kyc → rwa}/iSecuritizeDegenNFT.js +0 -0
- /package/dist/esm/sdk/market/{kyc → rwa}/securitize/types.js +0 -0
- /package/dist/types/abi/{kyc → rwa}/iDSRegistryService.d.ts +0 -0
- /package/dist/types/abi/{kyc → rwa}/iDSToken.d.ts +0 -0
- /package/dist/types/abi/{kyc → rwa}/iSecuritizeDegenNFT.d.ts +0 -0
- /package/dist/types/sdk/market/{kyc → rwa}/securitize/SecuritizeDegenNFT.d.ts +0 -0
|
@@ -16,51 +16,51 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var RWARegistry_exports = {};
|
|
20
|
+
__export(RWARegistry_exports, {
|
|
21
|
+
RWARegistry: () => RWARegistry
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(RWARegistry_exports);
|
|
24
24
|
var import_viem = require("viem");
|
|
25
|
-
var
|
|
25
|
+
var import_iRWACompressor = require("../../../abi/rwa/iRWACompressor.js");
|
|
26
26
|
var import_base = require("../../base/index.js");
|
|
27
27
|
var import_constants = require("../../constants/index.js");
|
|
28
28
|
var import_utils = require("../../utils/index.js");
|
|
29
29
|
var import_securitize = require("./securitize/index.js");
|
|
30
|
-
class
|
|
30
|
+
class RWARegistry extends import_base.SDKConstruct {
|
|
31
31
|
#state;
|
|
32
32
|
#factories = new import_utils.AddressMap();
|
|
33
33
|
/**
|
|
34
34
|
* @internal
|
|
35
35
|
*
|
|
36
|
-
* Returns delegated multicalls for loading all
|
|
36
|
+
* Returns delegated multicalls for loading all RWA underlying tokens from the on-chain RWA compressor.
|
|
37
37
|
* Used by the SDK to compose batched RPC calls.
|
|
38
38
|
*
|
|
39
39
|
* @param configurators - Market configurators to query.
|
|
40
|
-
* @param
|
|
40
|
+
* @param rwaFactories - RWA factory contracts to query.
|
|
41
41
|
*/
|
|
42
|
-
getLoadMulticalls(configurators,
|
|
43
|
-
if (!
|
|
42
|
+
getLoadMulticalls(configurators, rwaFactories = []) {
|
|
43
|
+
if (!rwaFactories.length) {
|
|
44
44
|
return [];
|
|
45
45
|
}
|
|
46
|
-
const [
|
|
47
|
-
import_constants.
|
|
46
|
+
const [rwaCompressorAddress] = this.sdk.addressProvider.mustGetLatest(
|
|
47
|
+
import_constants.AP_RWA_COMPRESSOR,
|
|
48
48
|
import_constants.VERSION_RANGE_310
|
|
49
49
|
);
|
|
50
50
|
return [
|
|
51
51
|
{
|
|
52
52
|
call: {
|
|
53
|
-
abi:
|
|
54
|
-
address:
|
|
55
|
-
functionName: "
|
|
56
|
-
args: [configurators,
|
|
53
|
+
abi: import_iRWACompressor.iRWACompressorAbi,
|
|
54
|
+
address: rwaCompressorAddress,
|
|
55
|
+
functionName: "getRWAMarketsData",
|
|
56
|
+
args: [configurators, rwaFactories]
|
|
57
57
|
},
|
|
58
58
|
onResult: (resp) => this.setState(resp)
|
|
59
59
|
}
|
|
60
60
|
];
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
* Fetches decoded investor data from the on-chain
|
|
63
|
+
* Fetches decoded investor data from the on-chain RWA compressor.
|
|
64
64
|
*
|
|
65
65
|
* Each factory produces its own investor data (e.g. registered tokens,
|
|
66
66
|
* cached signatures, EIP-712 messages to sign).
|
|
@@ -77,14 +77,14 @@ class KYCRegistry extends import_base.SDKConstruct {
|
|
|
77
77
|
if (!factories.length) {
|
|
78
78
|
return [];
|
|
79
79
|
}
|
|
80
|
-
const [
|
|
81
|
-
import_constants.
|
|
80
|
+
const [rwaCompressorAddress] = this.sdk.addressProvider.mustGetLatest(
|
|
81
|
+
import_constants.AP_RWA_COMPRESSOR,
|
|
82
82
|
import_constants.VERSION_RANGE_310
|
|
83
83
|
);
|
|
84
84
|
const resp = await this.client.readContract({
|
|
85
|
-
abi:
|
|
86
|
-
address:
|
|
87
|
-
functionName: "
|
|
85
|
+
abi: import_iRWACompressor.iRWACompressorAbi,
|
|
86
|
+
address: rwaCompressorAddress,
|
|
87
|
+
functionName: "getRWAInvestorData",
|
|
88
88
|
args: [investor, factories.map((f) => f.address)]
|
|
89
89
|
});
|
|
90
90
|
const result = [];
|
|
@@ -96,16 +96,16 @@ class KYCRegistry extends import_base.SDKConstruct {
|
|
|
96
96
|
}
|
|
97
97
|
return result;
|
|
98
98
|
}
|
|
99
|
-
/** All loaded
|
|
99
|
+
/** All loaded RWA factory instances. */
|
|
100
100
|
get factories() {
|
|
101
101
|
return this.#factories.values();
|
|
102
102
|
}
|
|
103
|
-
/** Raw
|
|
103
|
+
/** Raw RWA compressor response, or `undefined` before attach/hydrate. */
|
|
104
104
|
get state() {
|
|
105
105
|
return this.#state;
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
|
-
* Returns a human-readable snapshot of the
|
|
108
|
+
* Returns a human-readable snapshot of the RWA state.
|
|
109
109
|
*/
|
|
110
110
|
stateHuman(raw) {
|
|
111
111
|
return {
|
|
@@ -115,8 +115,8 @@ class KYCRegistry extends import_base.SDKConstruct {
|
|
|
115
115
|
/**
|
|
116
116
|
* @internal
|
|
117
117
|
*
|
|
118
|
-
* Replaces the internal state with a new
|
|
119
|
-
* Rebuilds token metadata for
|
|
118
|
+
* Replaces the internal state with a new RWA compressor response.
|
|
119
|
+
* Rebuilds token metadata for RWA underlyings and re-instantiates factory
|
|
120
120
|
* wrappers.
|
|
121
121
|
*/
|
|
122
122
|
setState(resp) {
|
|
@@ -126,7 +126,7 @@ class KYCRegistry extends import_base.SDKConstruct {
|
|
|
126
126
|
}
|
|
127
127
|
this.#factories.clear();
|
|
128
128
|
for (const f of resp?.[1] ?? []) {
|
|
129
|
-
this.#
|
|
129
|
+
this.#loadRWAFactoryData(f);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
#loadUnderlyingTokenData(u) {
|
|
@@ -134,24 +134,24 @@ class KYCRegistry extends import_base.SDKConstruct {
|
|
|
134
134
|
const meta = this.tokensMeta.get(u.baseParams.addr);
|
|
135
135
|
if (!meta) {
|
|
136
136
|
throw new Error(
|
|
137
|
-
`
|
|
137
|
+
`RWA underlying token ${contractType} (${u.baseParams.addr}) not found in tokensMeta`
|
|
138
138
|
);
|
|
139
139
|
}
|
|
140
140
|
switch (contractType) {
|
|
141
|
-
case import_base.
|
|
142
|
-
this.#
|
|
141
|
+
case import_base.RWA_UNDERLYING_DEFAULT:
|
|
142
|
+
this.#loadRWAUnderlyingDefault(meta, u);
|
|
143
143
|
break;
|
|
144
|
-
case import_base.
|
|
145
|
-
this.#
|
|
144
|
+
case import_base.RWA_UNDERLYING_ON_DEMAND:
|
|
145
|
+
this.#loadRWAUnderlyingOnDemand(meta, u);
|
|
146
146
|
break;
|
|
147
147
|
default:
|
|
148
148
|
if (this.sdk.strictContractTypes) {
|
|
149
|
-
throw new Error(`Unknown
|
|
149
|
+
throw new Error(`Unknown RWA underlying type: ${contractType}`);
|
|
150
150
|
}
|
|
151
|
-
this.logger?.warn(`unknown
|
|
151
|
+
this.logger?.warn(`unknown RWA underlying type: ${contractType}`);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
#
|
|
154
|
+
#loadRWAUnderlyingDefault(meta, data) {
|
|
155
155
|
const decoded = (0, import_viem.decodeAbiParameters)(
|
|
156
156
|
[
|
|
157
157
|
{ name: "factory", type: "address" },
|
|
@@ -161,12 +161,12 @@ class KYCRegistry extends import_base.SDKConstruct {
|
|
|
161
161
|
);
|
|
162
162
|
this.tokensMeta.upsert(data.baseParams.addr, {
|
|
163
163
|
...meta,
|
|
164
|
-
contractType: import_base.
|
|
165
|
-
|
|
164
|
+
contractType: import_base.RWA_UNDERLYING_DEFAULT,
|
|
165
|
+
rwaFactory: decoded[0],
|
|
166
166
|
asset: decoded[1]
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
|
-
#
|
|
169
|
+
#loadRWAUnderlyingOnDemand(meta, data) {
|
|
170
170
|
const decoded = (0, import_viem.decodeAbiParameters)(
|
|
171
171
|
[
|
|
172
172
|
{ name: "factory", type: "address" },
|
|
@@ -186,8 +186,8 @@ class KYCRegistry extends import_base.SDKConstruct {
|
|
|
186
186
|
}
|
|
187
187
|
this.tokensMeta.upsert(data.baseParams.addr, {
|
|
188
188
|
...meta,
|
|
189
|
-
contractType: import_base.
|
|
190
|
-
|
|
189
|
+
contractType: import_base.RWA_UNDERLYING_ON_DEMAND,
|
|
190
|
+
rwaFactory: decoded[0],
|
|
191
191
|
asset: decoded[1],
|
|
192
192
|
pool: decoded[2],
|
|
193
193
|
marketConfigurator: decoded[4],
|
|
@@ -214,7 +214,7 @@ class KYCRegistry extends import_base.SDKConstruct {
|
|
|
214
214
|
);
|
|
215
215
|
const contractType = (0, import_utils.bytes32ToString)(decoded.contractType);
|
|
216
216
|
switch (contractType) {
|
|
217
|
-
case import_base.
|
|
217
|
+
case import_base.RWA_ON_DEMAND_LP_MONOPOLIZED:
|
|
218
218
|
return this.#getOnDemandLPMonopolizedMeta(
|
|
219
219
|
decoded.addr,
|
|
220
220
|
decoded.version,
|
|
@@ -246,29 +246,29 @@ class KYCRegistry extends import_base.SDKConstruct {
|
|
|
246
246
|
return {
|
|
247
247
|
addr,
|
|
248
248
|
version,
|
|
249
|
-
contractType: import_base.
|
|
249
|
+
contractType: import_base.RWA_ON_DEMAND_LP_MONOPOLIZED,
|
|
250
250
|
marketConfigurator,
|
|
251
251
|
depositor,
|
|
252
252
|
pools: [...pools]
|
|
253
253
|
};
|
|
254
254
|
}
|
|
255
|
-
#
|
|
255
|
+
#loadRWAFactoryData(data) {
|
|
256
256
|
const contractType = (0, import_utils.bytes32ToString)(data.baseParams.contractType);
|
|
257
257
|
switch (contractType) {
|
|
258
|
-
case import_securitize.
|
|
258
|
+
case import_securitize.RWA_FACTORY_SECURITIZE:
|
|
259
259
|
this.#factories.upsert(
|
|
260
260
|
data.baseParams.addr,
|
|
261
|
-
new import_securitize.
|
|
261
|
+
new import_securitize.SecuritizeRWAFactory(this.sdk, data)
|
|
262
262
|
);
|
|
263
263
|
break;
|
|
264
264
|
default:
|
|
265
265
|
throw new Error(
|
|
266
|
-
`Unknown
|
|
266
|
+
`Unknown RWA factory type: ${contractType} for ${data.baseParams.addr}`
|
|
267
267
|
);
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
// Annotate the CommonJS export names for ESM import in node:
|
|
272
272
|
0 && (module.exports = {
|
|
273
|
-
|
|
273
|
+
RWARegistry
|
|
274
274
|
});
|
|
@@ -13,14 +13,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
13
|
};
|
|
14
14
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
15
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var
|
|
17
|
-
module.exports = __toCommonJS(
|
|
18
|
-
__reExport(
|
|
19
|
-
__reExport(
|
|
20
|
-
__reExport(
|
|
16
|
+
var rwa_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(rwa_exports);
|
|
18
|
+
__reExport(rwa_exports, require("./RWARegistry.js"), module.exports);
|
|
19
|
+
__reExport(rwa_exports, require("./securitize/index.js"), module.exports);
|
|
20
|
+
__reExport(rwa_exports, require("./types.js"), module.exports);
|
|
21
21
|
// Annotate the CommonJS export names for ESM import in node:
|
|
22
22
|
0 && (module.exports = {
|
|
23
|
-
...require("./
|
|
23
|
+
...require("./RWARegistry.js"),
|
|
24
24
|
...require("./securitize/index.js"),
|
|
25
25
|
...require("./types.js")
|
|
26
26
|
});
|
|
@@ -21,7 +21,7 @@ __export(SecuritizeDegenNFT_exports, {
|
|
|
21
21
|
SecuritizeDegenNFT: () => SecuritizeDegenNFT
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(SecuritizeDegenNFT_exports);
|
|
24
|
-
var import_iSecuritizeDegenNFT = require("../../../../abi/
|
|
24
|
+
var import_iSecuritizeDegenNFT = require("../../../../abi/rwa/iSecuritizeDegenNFT.js");
|
|
25
25
|
var import_base = require("../../../base/index.js");
|
|
26
26
|
const abi = import_iSecuritizeDegenNFT.iSecuritizeDegenNFTAbi;
|
|
27
27
|
class SecuritizeDegenNFT extends import_base.BaseContract {
|
|
@@ -16,30 +16,30 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var SecuritizeRWAFactory_exports = {};
|
|
20
|
+
__export(SecuritizeRWAFactory_exports, {
|
|
21
|
+
SecuritizeRWAFactory: () => SecuritizeRWAFactory
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(SecuritizeRWAFactory_exports);
|
|
24
24
|
var import_viem = require("viem");
|
|
25
|
-
var
|
|
25
|
+
var import_iSecuritizeRWAFactory = require("../../../../abi/rwa/iSecuritizeRWAFactory.js");
|
|
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
29
|
var import_SecuritizeDegenNFT = require("./SecuritizeDegenNFT.js");
|
|
30
30
|
var import_types = require("./types.js");
|
|
31
|
-
const abi =
|
|
32
|
-
class
|
|
31
|
+
const abi = import_iSecuritizeRWAFactory.iSecuritizeRWAFactoryAbi;
|
|
32
|
+
class SecuritizeRWAFactory extends import_base.BaseContract {
|
|
33
33
|
#sdk;
|
|
34
34
|
#investorCache = new import_utils.AddressMap();
|
|
35
35
|
degenNFT;
|
|
36
36
|
owner;
|
|
37
37
|
dsTokens;
|
|
38
|
-
contractType = import_constants.
|
|
38
|
+
contractType = import_constants.RWA_FACTORY_SECURITIZE;
|
|
39
39
|
constructor(sdk, data) {
|
|
40
40
|
super(sdk, {
|
|
41
41
|
...data.baseParams,
|
|
42
|
-
name: "
|
|
42
|
+
name: "SecuritizeRWAFactory",
|
|
43
43
|
abi
|
|
44
44
|
});
|
|
45
45
|
this.#sdk = sdk;
|
|
@@ -71,7 +71,7 @@ class SecuritizeKYCFactory extends import_base.BaseContract {
|
|
|
71
71
|
}));
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
|
-
* {@inheritDoc
|
|
74
|
+
* {@inheritDoc IRWAFactory.decodeInvestorData}
|
|
75
75
|
*/
|
|
76
76
|
decodeInvestorData(data) {
|
|
77
77
|
const { creditAccounts, extraDetails } = data;
|
|
@@ -92,7 +92,7 @@ class SecuritizeKYCFactory extends import_base.BaseContract {
|
|
|
92
92
|
extraDetails
|
|
93
93
|
);
|
|
94
94
|
return {
|
|
95
|
-
type: import_constants.
|
|
95
|
+
type: import_constants.RWA_FACTORY_SECURITIZE,
|
|
96
96
|
factory: this.address,
|
|
97
97
|
cachedSignatures: [...cachedSignatures],
|
|
98
98
|
registerVaultMessages: registerVaultMessages.map((m) => ({
|
|
@@ -126,7 +126,7 @@ class SecuritizeKYCFactory extends import_base.BaseContract {
|
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
/**
|
|
129
|
-
* {@inheritDoc
|
|
129
|
+
* {@inheritDoc IRWAFactory.getInvestor}
|
|
130
130
|
*/
|
|
131
131
|
async getInvestor(creditAccount, fromCache) {
|
|
132
132
|
if (fromCache && this.#investorCache.has(creditAccount)) {
|
|
@@ -139,7 +139,7 @@ class SecuritizeKYCFactory extends import_base.BaseContract {
|
|
|
139
139
|
return investor;
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
|
-
* {@inheritDoc
|
|
142
|
+
* {@inheritDoc IRWAFactory.getApprovalAddress}
|
|
143
143
|
*/
|
|
144
144
|
async getApprovalAddress(options) {
|
|
145
145
|
if ("creditAccount" in options) {
|
|
@@ -151,13 +151,13 @@ class SecuritizeKYCFactory extends import_base.BaseContract {
|
|
|
151
151
|
);
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
|
-
* {@inheritDoc
|
|
154
|
+
* {@inheritDoc IRWAFactory.getWallet}
|
|
155
155
|
*/
|
|
156
156
|
async getWallet(creditAccount) {
|
|
157
157
|
return this.contract.read.getWallet([creditAccount]);
|
|
158
158
|
}
|
|
159
159
|
/**
|
|
160
|
-
* {@inheritDoc
|
|
160
|
+
* {@inheritDoc IRWAFactory.multicall}
|
|
161
161
|
*/
|
|
162
162
|
multicall(creditAccount, calls, options) {
|
|
163
163
|
const { tokensToRegister = [], signaturesToCache = [] } = options ?? {};
|
|
@@ -167,10 +167,10 @@ class SecuritizeKYCFactory extends import_base.BaseContract {
|
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
170
|
-
* {@inheritDoc
|
|
170
|
+
* {@inheritDoc IRWAFactory.getOpenAccountRequirements}
|
|
171
171
|
*/
|
|
172
172
|
async getOpenAccountRequirements(investor, props) {
|
|
173
|
-
const [investorData] = await this.#sdk.
|
|
173
|
+
const [investorData] = await this.#sdk.rwa.getInvestorData(investor, [
|
|
174
174
|
this.address
|
|
175
175
|
]);
|
|
176
176
|
const tokensToRegister = new import_utils.AddressSet([props.tokenOutAddress]);
|
|
@@ -184,14 +184,14 @@ class SecuritizeKYCFactory extends import_base.BaseContract {
|
|
|
184
184
|
(m) => unsignedTokens.has(m.message.token)
|
|
185
185
|
);
|
|
186
186
|
return {
|
|
187
|
-
type: import_constants.
|
|
187
|
+
type: import_constants.RWA_FACTORY_SECURITIZE,
|
|
188
188
|
securitizeTokensToRegister: Array.from(securitizeTokensToRegister),
|
|
189
189
|
tokensToRegister: Array.from(tokensToRegister),
|
|
190
190
|
requiredSignatures
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
193
|
/**
|
|
194
|
-
* {@inheritDoc
|
|
194
|
+
* {@inheritDoc IRWAFactory.openCreditAccount}
|
|
195
195
|
*/
|
|
196
196
|
openCreditAccount(creditManager, calls, options) {
|
|
197
197
|
const { tokensToRegister = [], signaturesToCache = [] } = options ?? {};
|
|
@@ -256,5 +256,5 @@ const registerVaultMessageTuple = [
|
|
|
256
256
|
];
|
|
257
257
|
// Annotate the CommonJS export names for ESM import in node:
|
|
258
258
|
0 && (module.exports = {
|
|
259
|
-
|
|
259
|
+
SecuritizeRWAFactory
|
|
260
260
|
});
|
|
@@ -18,11 +18,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var constants_exports = {};
|
|
20
20
|
__export(constants_exports, {
|
|
21
|
-
|
|
21
|
+
RWA_FACTORY_SECURITIZE: () => RWA_FACTORY_SECURITIZE
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(constants_exports);
|
|
24
|
-
const
|
|
24
|
+
const RWA_FACTORY_SECURITIZE = "RWA_FACTORY::SECURITIZE";
|
|
25
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
26
|
0 && (module.exports = {
|
|
27
|
-
|
|
27
|
+
RWA_FACTORY_SECURITIZE
|
|
28
28
|
});
|
|
@@ -16,11 +16,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
16
16
|
var securitize_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(securitize_exports);
|
|
18
18
|
__reExport(securitize_exports, require("./constants.js"), module.exports);
|
|
19
|
-
__reExport(securitize_exports, require("./
|
|
19
|
+
__reExport(securitize_exports, require("./SecuritizeRWAFactory.js"), module.exports);
|
|
20
20
|
__reExport(securitize_exports, require("./types.js"), module.exports);
|
|
21
21
|
// Annotate the CommonJS export names for ESM import in node:
|
|
22
22
|
0 && (module.exports = {
|
|
23
23
|
...require("./constants.js"),
|
|
24
|
-
...require("./
|
|
24
|
+
...require("./SecuritizeRWAFactory.js"),
|
|
25
25
|
...require("./types.js")
|
|
26
26
|
});
|
|
@@ -18,17 +18,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var types_exports = {};
|
|
20
20
|
__export(types_exports, {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
RWA_FACTORY_TYPES: () => RWA_FACTORY_TYPES,
|
|
22
|
+
isRWAFactory: () => isRWAFactory
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(types_exports);
|
|
25
25
|
var import_securitize = require("./securitize/index.js");
|
|
26
|
-
const
|
|
27
|
-
function
|
|
26
|
+
const RWA_FACTORY_TYPES = [import_securitize.RWA_FACTORY_SECURITIZE];
|
|
27
|
+
function isRWAFactory(factory, type) {
|
|
28
28
|
return factory.contractType === type;
|
|
29
29
|
}
|
|
30
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
31
31
|
0 && (module.exports = {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
RWA_FACTORY_TYPES,
|
|
33
|
+
isRWAFactory
|
|
34
34
|
});
|
package/dist/cjs/sdk/options.js
CHANGED
|
@@ -45,11 +45,11 @@ const AttachOptionsSchema = import_v4.z.object({
|
|
|
45
45
|
/** Addresses of market configurator contracts to load. */
|
|
46
46
|
marketConfigurators: import_v4.z.array((0, import_utils.ZodAddress)()).optional(),
|
|
47
47
|
/**
|
|
48
|
-
* Addresses of
|
|
49
|
-
* If not set, all default
|
|
50
|
-
* (from {@link GearboxChain.
|
|
48
|
+
* Addresses of RWA factory contracts to load.
|
|
49
|
+
* If not set, all default RWA factories for the chain are loaded
|
|
50
|
+
* (from {@link GearboxChain.rwaFactories})
|
|
51
51
|
**/
|
|
52
|
-
|
|
52
|
+
rwaFactories: import_v4.z.array((0, import_utils.ZodAddress)()).optional(),
|
|
53
53
|
/** Pin SDK to a specific block number during attach. */
|
|
54
54
|
blockNumber: import_v4.z.union([import_v4.z.bigint().nonnegative(), import_v4.z.number().int().nonnegative()]).optional(),
|
|
55
55
|
/** Skip fetching updatable price feeds on attach and sync. */
|
|
@@ -35,11 +35,11 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
35
35
|
*/
|
|
36
36
|
getDepositTokensIn(pool) {
|
|
37
37
|
const underlying = this.#describeUnderlying(pool);
|
|
38
|
-
if (this.sdk.tokensMeta.
|
|
38
|
+
if (this.sdk.tokensMeta.isRWAUnderlying(underlying)) {
|
|
39
39
|
switch (underlying.contractType) {
|
|
40
|
-
case import_base.
|
|
40
|
+
case import_base.RWA_UNDERLYING_DEFAULT:
|
|
41
41
|
return this.#depositTokensIn(pool, false);
|
|
42
|
-
case import_base.
|
|
42
|
+
case import_base.RWA_UNDERLYING_ON_DEMAND:
|
|
43
43
|
return [underlying.asset];
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -50,11 +50,11 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
50
50
|
*/
|
|
51
51
|
getDepositTokensOut(pool, tokenIn) {
|
|
52
52
|
const underlying = this.#describeUnderlying(pool);
|
|
53
|
-
if (this.sdk.tokensMeta.
|
|
53
|
+
if (this.sdk.tokensMeta.isRWAUnderlying(underlying)) {
|
|
54
54
|
switch (underlying.contractType) {
|
|
55
|
-
case import_base.
|
|
55
|
+
case import_base.RWA_UNDERLYING_DEFAULT:
|
|
56
56
|
return this.#depositTokensOut(pool, tokenIn, false);
|
|
57
|
-
case import_base.
|
|
57
|
+
case import_base.RWA_UNDERLYING_ON_DEMAND:
|
|
58
58
|
return [];
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -65,23 +65,23 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
65
65
|
*/
|
|
66
66
|
getDepositMetadata(pool, tokenIn, tokenOut) {
|
|
67
67
|
const underlying = this.#describeUnderlying(pool);
|
|
68
|
-
if (this.sdk.tokensMeta.
|
|
68
|
+
if (this.sdk.tokensMeta.isRWAUnderlying(underlying)) {
|
|
69
69
|
switch (underlying.contractType) {
|
|
70
|
-
case import_base.
|
|
70
|
+
case import_base.RWA_UNDERLYING_DEFAULT: {
|
|
71
71
|
return this.#depositMetadata(
|
|
72
|
-
"
|
|
72
|
+
"rwa-default",
|
|
73
73
|
pool,
|
|
74
74
|
tokenIn,
|
|
75
75
|
tokenOut,
|
|
76
76
|
false
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
|
-
case import_base.
|
|
79
|
+
case import_base.RWA_UNDERLYING_ON_DEMAND:
|
|
80
80
|
return {
|
|
81
81
|
zapper: void 0,
|
|
82
82
|
approveTarget: underlying.liquidityProvider.addr,
|
|
83
83
|
permissible: false,
|
|
84
|
-
type: "
|
|
84
|
+
type: "rwa-on-demand"
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -93,8 +93,8 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
93
93
|
addLiquidity(props) {
|
|
94
94
|
const { collateral, meta, permit, referralCode, pool, wallet } = props;
|
|
95
95
|
const underlying = this.#describeUnderlying(pool);
|
|
96
|
-
if (this.sdk.tokensMeta.
|
|
97
|
-
if (underlying.contractType === import_base.
|
|
96
|
+
if (this.sdk.tokensMeta.isRWAUnderlying(underlying)) {
|
|
97
|
+
if (underlying.contractType === import_base.RWA_UNDERLYING_ON_DEMAND) {
|
|
98
98
|
return void 0;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -141,11 +141,11 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
141
141
|
*/
|
|
142
142
|
getWithdrawalTokensIn(pool) {
|
|
143
143
|
const underlying = this.#describeUnderlying(pool);
|
|
144
|
-
if (this.sdk.tokensMeta.
|
|
144
|
+
if (this.sdk.tokensMeta.isRWAUnderlying(underlying)) {
|
|
145
145
|
switch (underlying.contractType) {
|
|
146
|
-
case import_base.
|
|
146
|
+
case import_base.RWA_UNDERLYING_DEFAULT:
|
|
147
147
|
return this.#withdrawalTokensIn(pool, false);
|
|
148
|
-
case import_base.
|
|
148
|
+
case import_base.RWA_UNDERLYING_ON_DEMAND:
|
|
149
149
|
return [];
|
|
150
150
|
}
|
|
151
151
|
}
|
|
@@ -156,11 +156,11 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
156
156
|
*/
|
|
157
157
|
getWithdrawalTokensOut(pool, tokenIn) {
|
|
158
158
|
const underlying = this.#describeUnderlying(pool);
|
|
159
|
-
if (this.sdk.tokensMeta.
|
|
159
|
+
if (this.sdk.tokensMeta.isRWAUnderlying(underlying)) {
|
|
160
160
|
switch (underlying.contractType) {
|
|
161
|
-
case import_base.
|
|
161
|
+
case import_base.RWA_UNDERLYING_DEFAULT:
|
|
162
162
|
return this.#withdrawalTokensOut(pool, tokenIn, false);
|
|
163
|
-
case import_base.
|
|
163
|
+
case import_base.RWA_UNDERLYING_ON_DEMAND:
|
|
164
164
|
return [underlying.asset];
|
|
165
165
|
}
|
|
166
166
|
}
|
|
@@ -172,8 +172,8 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
172
172
|
removeLiquidity(props) {
|
|
173
173
|
const { pool, amount, meta, wallet, permit } = props;
|
|
174
174
|
const underlying = this.#describeUnderlying(pool);
|
|
175
|
-
if (this.sdk.tokensMeta.
|
|
176
|
-
if (underlying.contractType === import_base.
|
|
175
|
+
if (this.sdk.tokensMeta.isRWAUnderlying(underlying)) {
|
|
176
|
+
if (underlying.contractType === import_base.RWA_UNDERLYING_ON_DEMAND) {
|
|
177
177
|
return {
|
|
178
178
|
abi: import_iERC20.ierc20Abi,
|
|
179
179
|
functionName: "approve",
|
|
@@ -214,23 +214,23 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
214
214
|
*/
|
|
215
215
|
getWithdrawalMetadata(pool, tokenIn, tokenOut) {
|
|
216
216
|
const underlying = this.#describeUnderlying(pool);
|
|
217
|
-
if (this.sdk.tokensMeta.
|
|
217
|
+
if (this.sdk.tokensMeta.isRWAUnderlying(underlying)) {
|
|
218
218
|
switch (underlying.contractType) {
|
|
219
|
-
case import_base.
|
|
219
|
+
case import_base.RWA_UNDERLYING_DEFAULT: {
|
|
220
220
|
return this.#withdrawalMetadata(
|
|
221
|
-
"
|
|
221
|
+
"rwa-default",
|
|
222
222
|
pool,
|
|
223
223
|
tokenIn,
|
|
224
224
|
tokenOut,
|
|
225
225
|
false
|
|
226
226
|
);
|
|
227
227
|
}
|
|
228
|
-
case import_base.
|
|
228
|
+
case import_base.RWA_UNDERLYING_ON_DEMAND:
|
|
229
229
|
return {
|
|
230
230
|
zapper: void 0,
|
|
231
231
|
approveTarget: void 0,
|
|
232
232
|
permissible: false,
|
|
233
|
-
type: "
|
|
233
|
+
type: "rwa-on-demand"
|
|
234
234
|
};
|
|
235
235
|
}
|
|
236
236
|
}
|