@lidofinance/lido-csm-sdk 2.0.0-alpha.73 → 2.0.0-alpha.74
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/core-sdk/core-sdk.d.cts +25 -25
- package/dist/core-sdk/core-sdk.d.mts +25 -25
- package/dist/discovery-sdk/discovery-sdk.cjs +27 -7
- package/dist/discovery-sdk/discovery-sdk.cjs.map +1 -1
- package/dist/discovery-sdk/discovery-sdk.d.cts +3 -0
- package/dist/discovery-sdk/discovery-sdk.d.cts.map +1 -1
- package/dist/discovery-sdk/discovery-sdk.d.mts +3 -0
- package/dist/discovery-sdk/discovery-sdk.d.mts.map +1 -1
- package/dist/discovery-sdk/discovery-sdk.mjs +27 -7
- package/dist/discovery-sdk/discovery-sdk.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -99,10 +99,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
99
99
|
v: bigint;
|
|
100
100
|
yParity?: undefined | undefined;
|
|
101
101
|
value: bigint;
|
|
102
|
-
from: Address;
|
|
103
|
-
nonce: number;
|
|
104
102
|
to: Address | null;
|
|
103
|
+
from: Address;
|
|
105
104
|
gas: bigint;
|
|
105
|
+
nonce: number;
|
|
106
106
|
blobVersionedHashes?: undefined | undefined;
|
|
107
107
|
gasPrice: bigint;
|
|
108
108
|
maxFeePerBlobGas?: undefined | undefined;
|
|
@@ -124,10 +124,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
124
124
|
v: bigint;
|
|
125
125
|
yParity: number;
|
|
126
126
|
value: bigint;
|
|
127
|
-
from: Address;
|
|
128
|
-
nonce: number;
|
|
129
127
|
to: Address | null;
|
|
128
|
+
from: Address;
|
|
130
129
|
gas: bigint;
|
|
130
|
+
nonce: number;
|
|
131
131
|
blobVersionedHashes?: undefined | undefined;
|
|
132
132
|
gasPrice: bigint;
|
|
133
133
|
maxFeePerBlobGas?: undefined | undefined;
|
|
@@ -149,10 +149,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
149
149
|
v: bigint;
|
|
150
150
|
yParity: number;
|
|
151
151
|
value: bigint;
|
|
152
|
-
from: Address;
|
|
153
|
-
nonce: number;
|
|
154
152
|
to: Address | null;
|
|
153
|
+
from: Address;
|
|
155
154
|
gas: bigint;
|
|
155
|
+
nonce: number;
|
|
156
156
|
blobVersionedHashes?: undefined | undefined;
|
|
157
157
|
gasPrice?: undefined | undefined;
|
|
158
158
|
maxFeePerBlobGas?: undefined | undefined;
|
|
@@ -174,10 +174,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
174
174
|
v: bigint;
|
|
175
175
|
yParity: number;
|
|
176
176
|
value: bigint;
|
|
177
|
-
from: Address;
|
|
178
|
-
nonce: number;
|
|
179
177
|
to: Address | null;
|
|
178
|
+
from: Address;
|
|
180
179
|
gas: bigint;
|
|
180
|
+
nonce: number;
|
|
181
181
|
blobVersionedHashes: readonly _$viem.Hex[];
|
|
182
182
|
gasPrice?: undefined | undefined;
|
|
183
183
|
maxFeePerBlobGas: bigint;
|
|
@@ -199,10 +199,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
199
199
|
v: bigint;
|
|
200
200
|
yParity: number;
|
|
201
201
|
value: bigint;
|
|
202
|
-
from: Address;
|
|
203
|
-
nonce: number;
|
|
204
202
|
to: Address | null;
|
|
203
|
+
from: Address;
|
|
205
204
|
gas: bigint;
|
|
205
|
+
nonce: number;
|
|
206
206
|
blobVersionedHashes?: undefined | undefined;
|
|
207
207
|
gasPrice?: undefined | undefined;
|
|
208
208
|
maxFeePerBlobGas?: undefined | undefined;
|
|
@@ -250,10 +250,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
250
250
|
v: bigint;
|
|
251
251
|
yParity?: undefined | undefined;
|
|
252
252
|
value: bigint;
|
|
253
|
-
from: Address;
|
|
254
|
-
nonce: number;
|
|
255
253
|
to: Address | null;
|
|
254
|
+
from: Address;
|
|
256
255
|
gas: bigint;
|
|
256
|
+
nonce: number;
|
|
257
257
|
blobVersionedHashes?: undefined | undefined;
|
|
258
258
|
gasPrice: bigint;
|
|
259
259
|
maxFeePerBlobGas?: undefined | undefined;
|
|
@@ -275,10 +275,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
275
275
|
v: bigint;
|
|
276
276
|
yParity: number;
|
|
277
277
|
value: bigint;
|
|
278
|
-
from: Address;
|
|
279
|
-
nonce: number;
|
|
280
278
|
to: Address | null;
|
|
279
|
+
from: Address;
|
|
281
280
|
gas: bigint;
|
|
281
|
+
nonce: number;
|
|
282
282
|
blobVersionedHashes?: undefined | undefined;
|
|
283
283
|
gasPrice: bigint;
|
|
284
284
|
maxFeePerBlobGas?: undefined | undefined;
|
|
@@ -300,10 +300,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
300
300
|
v: bigint;
|
|
301
301
|
yParity: number;
|
|
302
302
|
value: bigint;
|
|
303
|
-
from: Address;
|
|
304
|
-
nonce: number;
|
|
305
303
|
to: Address | null;
|
|
304
|
+
from: Address;
|
|
306
305
|
gas: bigint;
|
|
306
|
+
nonce: number;
|
|
307
307
|
blobVersionedHashes?: undefined | undefined;
|
|
308
308
|
gasPrice?: undefined | undefined;
|
|
309
309
|
maxFeePerBlobGas?: undefined | undefined;
|
|
@@ -325,10 +325,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
325
325
|
v: bigint;
|
|
326
326
|
yParity: number;
|
|
327
327
|
value: bigint;
|
|
328
|
-
from: Address;
|
|
329
|
-
nonce: number;
|
|
330
328
|
to: Address | null;
|
|
329
|
+
from: Address;
|
|
331
330
|
gas: bigint;
|
|
331
|
+
nonce: number;
|
|
332
332
|
blobVersionedHashes: readonly _$viem.Hex[];
|
|
333
333
|
gasPrice?: undefined | undefined;
|
|
334
334
|
maxFeePerBlobGas: bigint;
|
|
@@ -350,10 +350,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
350
350
|
v: bigint;
|
|
351
351
|
yParity: number;
|
|
352
352
|
value: bigint;
|
|
353
|
-
from: Address;
|
|
354
|
-
nonce: number;
|
|
355
353
|
to: Address | null;
|
|
354
|
+
from: Address;
|
|
356
355
|
gas: bigint;
|
|
356
|
+
nonce: number;
|
|
357
357
|
blobVersionedHashes?: undefined | undefined;
|
|
358
358
|
gasPrice?: undefined | undefined;
|
|
359
359
|
maxFeePerBlobGas?: undefined | undefined;
|
|
@@ -3624,7 +3624,7 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
3624
3624
|
authorizationList: _$viem.TransactionSerializableEIP7702["authorizationList"];
|
|
3625
3625
|
} ? "eip7702" : never) | (request["type"] extends string | undefined ? Extract<request["type"], string> : never)>) ? T_12 extends "eip7702" ? _$viem.TransactionRequestEIP7702 : never : never : never)>> & {
|
|
3626
3626
|
chainId?: number | undefined;
|
|
3627
|
-
}, (request["parameters"] extends readonly _$viem.PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "type" | "chainId" | "
|
|
3627
|
+
}, (request["parameters"] extends readonly _$viem.PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "type" | "chainId" | "gas" | "nonce" | "blobVersionedHashes" | "fees") extends infer T_13 ? T_13 extends (request["parameters"] extends readonly _$viem.PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "type" | "chainId" | "gas" | "nonce" | "blobVersionedHashes" | "fees") ? T_13 extends "fees" ? "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" : T_13 : never : never> & (unknown extends request["kzg"] ? {} : Pick<request, "kzg">) & {
|
|
3628
3628
|
_capabilities?: {
|
|
3629
3629
|
[x: string]: any;
|
|
3630
3630
|
} | undefined;
|
|
@@ -3635,7 +3635,7 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
3635
3635
|
simulate: <const calls extends readonly unknown[]>(args: _$viem.SimulateBlocksParameters<calls>) => Promise<_$viem.SimulateBlocksReturnType<calls>>;
|
|
3636
3636
|
simulateBlocks: <const calls extends readonly unknown[]>(args: _$viem.SimulateBlocksParameters<calls>) => Promise<_$viem.SimulateBlocksReturnType<calls>>;
|
|
3637
3637
|
simulateCalls: <const calls extends readonly unknown[]>(args: _$viem.SimulateCallsParameters<calls>) => Promise<_$viem.SimulateCallsReturnType<calls>>;
|
|
3638
|
-
simulateContract: <const abi extends Abi | readonly unknown[], functionName extends _$viem.ContractFunctionName<abi, "
|
|
3638
|
+
simulateContract: <const abi extends Abi | readonly unknown[], functionName extends _$viem.ContractFunctionName<abi, "nonpayable" | "payable">, const args_1 extends _$viem.ContractFunctionArgs<abi, "nonpayable" | "payable", functionName>, chainOverride extends Chain | undefined, accountOverride extends _$viem.Account | Address | undefined = undefined>(args: _$viem.SimulateContractParameters<abi, functionName, args_1, Chain | undefined, chainOverride, accountOverride>) => Promise<_$viem.SimulateContractReturnType<abi, functionName, args_1, Chain | undefined, _$viem.Account | undefined, chainOverride, accountOverride>>;
|
|
3639
3639
|
verifyHash: (args: _$viem.VerifyHashActionParameters) => Promise<_$viem.VerifyHashActionReturnType>;
|
|
3640
3640
|
verifyMessage: (args: _$viem.VerifyMessageActionParameters) => Promise<_$viem.VerifyMessageActionReturnType>;
|
|
3641
3641
|
verifySiweMessage: (args: {
|
|
@@ -6955,7 +6955,7 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
6955
6955
|
authorizationList: _$viem.TransactionSerializableEIP7702["authorizationList"];
|
|
6956
6956
|
} ? "eip7702" : never) | (request["type"] extends string | undefined ? Extract<request["type"], string> : never)>) ? T_12 extends "eip7702" ? _$viem.TransactionRequestEIP7702 : never : never : never)>> & {
|
|
6957
6957
|
chainId?: number | undefined;
|
|
6958
|
-
}, (request["parameters"] extends readonly _$viem.PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "type" | "chainId" | "
|
|
6958
|
+
}, (request["parameters"] extends readonly _$viem.PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "type" | "chainId" | "gas" | "nonce" | "blobVersionedHashes" | "fees") extends infer T_13 ? T_13 extends (request["parameters"] extends readonly _$viem.PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "type" | "chainId" | "gas" | "nonce" | "blobVersionedHashes" | "fees") ? T_13 extends "fees" ? "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" : T_13 : never : never> & (unknown extends request["kzg"] ? {} : Pick<request, "kzg">) & {
|
|
6959
6959
|
_capabilities?: {
|
|
6960
6960
|
[x: string]: any;
|
|
6961
6961
|
} | undefined;
|
|
@@ -8092,8 +8092,8 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
8092
8092
|
switchChain: (args: _$viem.SwitchChainParameters) => Promise<void>;
|
|
8093
8093
|
waitForCallsStatus: (parameters: _$viem.WaitForCallsStatusParameters) => Promise<_$viem.WaitForCallsStatusReturnType>;
|
|
8094
8094
|
watchAsset: (args: _$viem.WatchAssetParameters) => Promise<_$viem.WatchAssetReturnType>;
|
|
8095
|
-
writeContract: <const abi extends Abi | readonly unknown[], functionName extends _$viem.ContractFunctionName<abi, "
|
|
8096
|
-
writeContractSync: <const abi extends Abi | readonly unknown[], functionName extends _$viem.ContractFunctionName<abi, "
|
|
8095
|
+
writeContract: <const abi extends Abi | readonly unknown[], functionName extends _$viem.ContractFunctionName<abi, "nonpayable" | "payable">, args_1 extends _$viem.ContractFunctionArgs<abi, "nonpayable" | "payable", functionName>, chainOverride extends Chain | undefined = undefined>(args: _$viem.WriteContractParameters<abi, functionName, args_1, Chain | undefined, _$viem.Account | undefined, chainOverride>) => Promise<_$viem.WriteContractReturnType>;
|
|
8096
|
+
writeContractSync: <const abi extends Abi | readonly unknown[], functionName extends _$viem.ContractFunctionName<abi, "nonpayable" | "payable">, args_1 extends _$viem.ContractFunctionArgs<abi, "nonpayable" | "payable", functionName>, chainOverride extends Chain | undefined = undefined>(args: _$viem.WriteContractSyncParameters<abi, functionName, args_1, Chain | undefined, _$viem.Account | undefined, chainOverride>) => Promise<_$viem.WriteContractSyncReturnType>;
|
|
8097
8097
|
extend: <const client extends {
|
|
8098
8098
|
[x: string]: unknown;
|
|
8099
8099
|
account?: undefined;
|
|
@@ -99,10 +99,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
99
99
|
v: bigint;
|
|
100
100
|
yParity?: undefined | undefined;
|
|
101
101
|
value: bigint;
|
|
102
|
-
from: Address;
|
|
103
|
-
nonce: number;
|
|
104
102
|
to: Address | null;
|
|
103
|
+
from: Address;
|
|
105
104
|
gas: bigint;
|
|
105
|
+
nonce: number;
|
|
106
106
|
blobVersionedHashes?: undefined | undefined;
|
|
107
107
|
gasPrice: bigint;
|
|
108
108
|
maxFeePerBlobGas?: undefined | undefined;
|
|
@@ -124,10 +124,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
124
124
|
v: bigint;
|
|
125
125
|
yParity: number;
|
|
126
126
|
value: bigint;
|
|
127
|
-
from: Address;
|
|
128
|
-
nonce: number;
|
|
129
127
|
to: Address | null;
|
|
128
|
+
from: Address;
|
|
130
129
|
gas: bigint;
|
|
130
|
+
nonce: number;
|
|
131
131
|
blobVersionedHashes?: undefined | undefined;
|
|
132
132
|
gasPrice: bigint;
|
|
133
133
|
maxFeePerBlobGas?: undefined | undefined;
|
|
@@ -149,10 +149,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
149
149
|
v: bigint;
|
|
150
150
|
yParity: number;
|
|
151
151
|
value: bigint;
|
|
152
|
-
from: Address;
|
|
153
|
-
nonce: number;
|
|
154
152
|
to: Address | null;
|
|
153
|
+
from: Address;
|
|
155
154
|
gas: bigint;
|
|
155
|
+
nonce: number;
|
|
156
156
|
blobVersionedHashes?: undefined | undefined;
|
|
157
157
|
gasPrice?: undefined | undefined;
|
|
158
158
|
maxFeePerBlobGas?: undefined | undefined;
|
|
@@ -174,10 +174,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
174
174
|
v: bigint;
|
|
175
175
|
yParity: number;
|
|
176
176
|
value: bigint;
|
|
177
|
-
from: Address;
|
|
178
|
-
nonce: number;
|
|
179
177
|
to: Address | null;
|
|
178
|
+
from: Address;
|
|
180
179
|
gas: bigint;
|
|
180
|
+
nonce: number;
|
|
181
181
|
blobVersionedHashes: readonly _$viem.Hex[];
|
|
182
182
|
gasPrice?: undefined | undefined;
|
|
183
183
|
maxFeePerBlobGas: bigint;
|
|
@@ -199,10 +199,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
199
199
|
v: bigint;
|
|
200
200
|
yParity: number;
|
|
201
201
|
value: bigint;
|
|
202
|
-
from: Address;
|
|
203
|
-
nonce: number;
|
|
204
202
|
to: Address | null;
|
|
203
|
+
from: Address;
|
|
205
204
|
gas: bigint;
|
|
205
|
+
nonce: number;
|
|
206
206
|
blobVersionedHashes?: undefined | undefined;
|
|
207
207
|
gasPrice?: undefined | undefined;
|
|
208
208
|
maxFeePerBlobGas?: undefined | undefined;
|
|
@@ -250,10 +250,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
250
250
|
v: bigint;
|
|
251
251
|
yParity?: undefined | undefined;
|
|
252
252
|
value: bigint;
|
|
253
|
-
from: Address;
|
|
254
|
-
nonce: number;
|
|
255
253
|
to: Address | null;
|
|
254
|
+
from: Address;
|
|
256
255
|
gas: bigint;
|
|
256
|
+
nonce: number;
|
|
257
257
|
blobVersionedHashes?: undefined | undefined;
|
|
258
258
|
gasPrice: bigint;
|
|
259
259
|
maxFeePerBlobGas?: undefined | undefined;
|
|
@@ -275,10 +275,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
275
275
|
v: bigint;
|
|
276
276
|
yParity: number;
|
|
277
277
|
value: bigint;
|
|
278
|
-
from: Address;
|
|
279
|
-
nonce: number;
|
|
280
278
|
to: Address | null;
|
|
279
|
+
from: Address;
|
|
281
280
|
gas: bigint;
|
|
281
|
+
nonce: number;
|
|
282
282
|
blobVersionedHashes?: undefined | undefined;
|
|
283
283
|
gasPrice: bigint;
|
|
284
284
|
maxFeePerBlobGas?: undefined | undefined;
|
|
@@ -300,10 +300,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
300
300
|
v: bigint;
|
|
301
301
|
yParity: number;
|
|
302
302
|
value: bigint;
|
|
303
|
-
from: Address;
|
|
304
|
-
nonce: number;
|
|
305
303
|
to: Address | null;
|
|
304
|
+
from: Address;
|
|
306
305
|
gas: bigint;
|
|
306
|
+
nonce: number;
|
|
307
307
|
blobVersionedHashes?: undefined | undefined;
|
|
308
308
|
gasPrice?: undefined | undefined;
|
|
309
309
|
maxFeePerBlobGas?: undefined | undefined;
|
|
@@ -325,10 +325,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
325
325
|
v: bigint;
|
|
326
326
|
yParity: number;
|
|
327
327
|
value: bigint;
|
|
328
|
-
from: Address;
|
|
329
|
-
nonce: number;
|
|
330
328
|
to: Address | null;
|
|
329
|
+
from: Address;
|
|
331
330
|
gas: bigint;
|
|
331
|
+
nonce: number;
|
|
332
332
|
blobVersionedHashes: readonly _$viem.Hex[];
|
|
333
333
|
gasPrice?: undefined | undefined;
|
|
334
334
|
maxFeePerBlobGas: bigint;
|
|
@@ -350,10 +350,10 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
350
350
|
v: bigint;
|
|
351
351
|
yParity: number;
|
|
352
352
|
value: bigint;
|
|
353
|
-
from: Address;
|
|
354
|
-
nonce: number;
|
|
355
353
|
to: Address | null;
|
|
354
|
+
from: Address;
|
|
356
355
|
gas: bigint;
|
|
356
|
+
nonce: number;
|
|
357
357
|
blobVersionedHashes?: undefined | undefined;
|
|
358
358
|
gasPrice?: undefined | undefined;
|
|
359
359
|
maxFeePerBlobGas?: undefined | undefined;
|
|
@@ -3624,7 +3624,7 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
3624
3624
|
authorizationList: _$viem.TransactionSerializableEIP7702["authorizationList"];
|
|
3625
3625
|
} ? "eip7702" : never) | (request["type"] extends string | undefined ? Extract<request["type"], string> : never)>) ? T_12 extends "eip7702" ? _$viem.TransactionRequestEIP7702 : never : never : never)>> & {
|
|
3626
3626
|
chainId?: number | undefined;
|
|
3627
|
-
}, (request["parameters"] extends readonly _$viem.PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "type" | "chainId" | "
|
|
3627
|
+
}, (request["parameters"] extends readonly _$viem.PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "type" | "chainId" | "gas" | "nonce" | "blobVersionedHashes" | "fees") extends infer T_13 ? T_13 extends (request["parameters"] extends readonly _$viem.PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "type" | "chainId" | "gas" | "nonce" | "blobVersionedHashes" | "fees") ? T_13 extends "fees" ? "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" : T_13 : never : never> & (unknown extends request["kzg"] ? {} : Pick<request, "kzg">) & {
|
|
3628
3628
|
_capabilities?: {
|
|
3629
3629
|
[x: string]: any;
|
|
3630
3630
|
} | undefined;
|
|
@@ -3635,7 +3635,7 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
3635
3635
|
simulate: <const calls extends readonly unknown[]>(args: _$viem.SimulateBlocksParameters<calls>) => Promise<_$viem.SimulateBlocksReturnType<calls>>;
|
|
3636
3636
|
simulateBlocks: <const calls extends readonly unknown[]>(args: _$viem.SimulateBlocksParameters<calls>) => Promise<_$viem.SimulateBlocksReturnType<calls>>;
|
|
3637
3637
|
simulateCalls: <const calls extends readonly unknown[]>(args: _$viem.SimulateCallsParameters<calls>) => Promise<_$viem.SimulateCallsReturnType<calls>>;
|
|
3638
|
-
simulateContract: <const abi extends Abi | readonly unknown[], functionName extends _$viem.ContractFunctionName<abi, "
|
|
3638
|
+
simulateContract: <const abi extends Abi | readonly unknown[], functionName extends _$viem.ContractFunctionName<abi, "nonpayable" | "payable">, const args_1 extends _$viem.ContractFunctionArgs<abi, "nonpayable" | "payable", functionName>, chainOverride extends Chain | undefined, accountOverride extends _$viem.Account | Address | undefined = undefined>(args: _$viem.SimulateContractParameters<abi, functionName, args_1, Chain | undefined, chainOverride, accountOverride>) => Promise<_$viem.SimulateContractReturnType<abi, functionName, args_1, Chain | undefined, _$viem.Account | undefined, chainOverride, accountOverride>>;
|
|
3639
3639
|
verifyHash: (args: _$viem.VerifyHashActionParameters) => Promise<_$viem.VerifyHashActionReturnType>;
|
|
3640
3640
|
verifyMessage: (args: _$viem.VerifyMessageActionParameters) => Promise<_$viem.VerifyMessageActionReturnType>;
|
|
3641
3641
|
verifySiweMessage: (args: {
|
|
@@ -6955,7 +6955,7 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
6955
6955
|
authorizationList: _$viem.TransactionSerializableEIP7702["authorizationList"];
|
|
6956
6956
|
} ? "eip7702" : never) | (request["type"] extends string | undefined ? Extract<request["type"], string> : never)>) ? T_12 extends "eip7702" ? _$viem.TransactionRequestEIP7702 : never : never : never)>> & {
|
|
6957
6957
|
chainId?: number | undefined;
|
|
6958
|
-
}, (request["parameters"] extends readonly _$viem.PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "type" | "chainId" | "
|
|
6958
|
+
}, (request["parameters"] extends readonly _$viem.PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "type" | "chainId" | "gas" | "nonce" | "blobVersionedHashes" | "fees") extends infer T_13 ? T_13 extends (request["parameters"] extends readonly _$viem.PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "type" | "chainId" | "gas" | "nonce" | "blobVersionedHashes" | "fees") ? T_13 extends "fees" ? "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" : T_13 : never : never> & (unknown extends request["kzg"] ? {} : Pick<request, "kzg">) & {
|
|
6959
6959
|
_capabilities?: {
|
|
6960
6960
|
[x: string]: any;
|
|
6961
6961
|
} | undefined;
|
|
@@ -8092,8 +8092,8 @@ declare class CoreSDK extends CsmSDKCacheable {
|
|
|
8092
8092
|
switchChain: (args: _$viem.SwitchChainParameters) => Promise<void>;
|
|
8093
8093
|
waitForCallsStatus: (parameters: _$viem.WaitForCallsStatusParameters) => Promise<_$viem.WaitForCallsStatusReturnType>;
|
|
8094
8094
|
watchAsset: (args: _$viem.WatchAssetParameters) => Promise<_$viem.WatchAssetReturnType>;
|
|
8095
|
-
writeContract: <const abi extends Abi | readonly unknown[], functionName extends _$viem.ContractFunctionName<abi, "
|
|
8096
|
-
writeContractSync: <const abi extends Abi | readonly unknown[], functionName extends _$viem.ContractFunctionName<abi, "
|
|
8095
|
+
writeContract: <const abi extends Abi | readonly unknown[], functionName extends _$viem.ContractFunctionName<abi, "nonpayable" | "payable">, args_1 extends _$viem.ContractFunctionArgs<abi, "nonpayable" | "payable", functionName>, chainOverride extends Chain | undefined = undefined>(args: _$viem.WriteContractParameters<abi, functionName, args_1, Chain | undefined, _$viem.Account | undefined, chainOverride>) => Promise<_$viem.WriteContractReturnType>;
|
|
8096
|
+
writeContractSync: <const abi extends Abi | readonly unknown[], functionName extends _$viem.ContractFunctionName<abi, "nonpayable" | "payable">, args_1 extends _$viem.ContractFunctionArgs<abi, "nonpayable" | "payable", functionName>, chainOverride extends Chain | undefined = undefined>(args: _$viem.WriteContractSyncParameters<abi, functionName, args_1, Chain | undefined, _$viem.Account | undefined, chainOverride>) => Promise<_$viem.WriteContractSyncReturnType>;
|
|
8097
8097
|
extend: <const client extends {
|
|
8098
8098
|
[x: string]: unknown;
|
|
8099
8099
|
account?: undefined;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
require("../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_contract_names = require("../common/constants/contract-names.cjs");
|
|
3
|
+
const require_sdk_error = require("../common/utils/sdk-error.cjs");
|
|
3
4
|
const require_csm_sdk_module = require("../common/class-primitives/csm-sdk-module.cjs");
|
|
4
5
|
const require_on_error = require("../common/utils/on-error.cjs");
|
|
6
|
+
const require_operator_types = require("../common/constants/operator-types.cjs");
|
|
5
7
|
const require_roles = require("../common/constants/roles.cjs");
|
|
8
|
+
const require_operator_type_utils = require("../common/utils/operator-type-utils.cjs");
|
|
6
9
|
const require_error_handler = require("../common/decorators/error-handler.cjs");
|
|
7
10
|
const require_logger = require("../common/decorators/logger.cjs");
|
|
8
11
|
const require_iterate_pages = require("./iterate-pages.cjs");
|
|
@@ -90,8 +93,8 @@ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError("Cannot use
|
|
|
90
93
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
91
94
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
92
95
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
93
|
-
var _getOperatorsWithLockedBond_dec, _getAllNodeOperators_dec, _getNodeOperatorsByProposedAddress_dec, _getNodeOperatorsByAddress_dec, _getNodeOperatorIds_dec, _a, _init;
|
|
94
|
-
var DiscoverySDK = class extends (_a = require_csm_sdk_module.CsmSDKModule, _getNodeOperatorIds_dec = [require_logger.Logger("Views:"), require_error_handler.ErrorHandler()], _getNodeOperatorsByAddress_dec = [require_logger.Logger("Views:"), require_error_handler.ErrorHandler()], _getNodeOperatorsByProposedAddress_dec = [require_logger.Logger("Views:"), require_error_handler.ErrorHandler()], _getAllNodeOperators_dec = [require_logger.Logger("Views:"), require_error_handler.ErrorHandler()], _getOperatorsWithLockedBond_dec = [require_logger.Logger("Views:"), require_error_handler.ErrorHandler()], _a) {
|
|
96
|
+
var _getOperatorsWithLockedBond_dec, _getAllNodeOperators_dec, _getNodeOperatorsByProposedAddress_dec, _getOperatorsByType_dec, _getOperatorsByCurveId_dec, _getNodeOperatorsByAddress_dec, _getNodeOperatorIds_dec, _a, _init;
|
|
97
|
+
var DiscoverySDK = class extends (_a = require_csm_sdk_module.CsmSDKModule, _getNodeOperatorIds_dec = [require_logger.Logger("Views:"), require_error_handler.ErrorHandler()], _getNodeOperatorsByAddress_dec = [require_logger.Logger("Views:"), require_error_handler.ErrorHandler()], _getOperatorsByCurveId_dec = [require_logger.Logger("Views:"), require_error_handler.ErrorHandler()], _getOperatorsByType_dec = [require_logger.Logger("Views:"), require_error_handler.ErrorHandler()], _getNodeOperatorsByProposedAddress_dec = [require_logger.Logger("Views:"), require_error_handler.ErrorHandler()], _getAllNodeOperators_dec = [require_logger.Logger("Views:"), require_error_handler.ErrorHandler()], _getOperatorsWithLockedBond_dec = [require_logger.Logger("Views:"), require_error_handler.ErrorHandler()], _a) {
|
|
95
98
|
constructor() {
|
|
96
99
|
super(...arguments);
|
|
97
100
|
__runInitializers(_init, 5, this);
|
|
@@ -135,11 +138,21 @@ var DiscoverySDK = class extends (_a = require_csm_sdk_module.CsmSDKModule, _get
|
|
|
135
138
|
address,
|
|
136
139
|
p.offset,
|
|
137
140
|
p.limit
|
|
138
|
-
]), pagination)).map(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
]), pagination)).map(toShortInfo);
|
|
142
|
+
}
|
|
143
|
+
async getOperatorsByCurveId(curveId, pagination) {
|
|
144
|
+
return (await this.paginateOperators((p) => this.discoveryContract.read.getOperatorsByCurveId([
|
|
145
|
+
this.core.moduleId,
|
|
146
|
+
curveId,
|
|
147
|
+
p.offset,
|
|
148
|
+
p.limit
|
|
149
|
+
]), pagination)).map(toShortInfo);
|
|
150
|
+
}
|
|
151
|
+
async getOperatorsByType(operatorType, pagination) {
|
|
152
|
+
require_sdk_error.invariantArgument(require_operator_types.OPERATOR_TYPE_MODULE[operatorType] === this.core.moduleName, `Operator type "${operatorType}" does not belong to the current module (${this.core.moduleName})`);
|
|
153
|
+
const curveId = require_operator_type_utils.getCurveIdByOperatorType(this.core.chainId, operatorType);
|
|
154
|
+
require_sdk_error.invariantArgument(curveId !== void 0, `Operator type "${operatorType}" has no curve id for the current chain`);
|
|
155
|
+
return this.getOperatorsByCurveId(curveId, pagination);
|
|
143
156
|
}
|
|
144
157
|
async getNodeOperatorsByProposedAddress(address, pagination) {
|
|
145
158
|
return (await this.paginateOperators((p) => this.discoveryContract.read.getNodeOperatorsByProposedAddress([
|
|
@@ -182,10 +195,17 @@ var DiscoverySDK = class extends (_a = require_csm_sdk_module.CsmSDKModule, _get
|
|
|
182
195
|
_init = __decoratorStart(_a);
|
|
183
196
|
__decorateElement(_init, 1, "getNodeOperatorIds", _getNodeOperatorIds_dec, DiscoverySDK);
|
|
184
197
|
__decorateElement(_init, 1, "getNodeOperatorsByAddress", _getNodeOperatorsByAddress_dec, DiscoverySDK);
|
|
198
|
+
__decorateElement(_init, 1, "getOperatorsByCurveId", _getOperatorsByCurveId_dec, DiscoverySDK);
|
|
199
|
+
__decorateElement(_init, 1, "getOperatorsByType", _getOperatorsByType_dec, DiscoverySDK);
|
|
185
200
|
__decorateElement(_init, 1, "getNodeOperatorsByProposedAddress", _getNodeOperatorsByProposedAddress_dec, DiscoverySDK);
|
|
186
201
|
__decorateElement(_init, 1, "getAllNodeOperators", _getAllNodeOperators_dec, DiscoverySDK);
|
|
187
202
|
__decorateElement(_init, 1, "getOperatorsWithLockedBond", _getOperatorsWithLockedBond_dec, DiscoverySDK);
|
|
188
203
|
__decoratorMetadata(_init, DiscoverySDK);
|
|
204
|
+
const toShortInfo = (operator) => ({
|
|
205
|
+
...operator,
|
|
206
|
+
rewardsAddress: operator.rewardAddress,
|
|
207
|
+
nodeOperatorId: operator.id
|
|
208
|
+
});
|
|
189
209
|
//#endregion
|
|
190
210
|
exports.DiscoverySDK = DiscoverySDK;
|
|
191
211
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery-sdk.cjs","names":[],"sources":["../../src/discovery-sdk/discovery-sdk.ts"],"sourcesContent":["import { Address, isAddressEqual } from 'viem';\nimport { CsmSDKModule } from '../common/class-primitives/csm-sdk-module';\nimport { CONTRACT_NAMES } from '../common/constants/index';\nimport { ROLES } from '../common/constants/roles';\nimport { ErrorHandler, Logger } from '../common/decorators/index';\nimport {\n NodeOperatorId,\n NodeOperatorInviteInfo,\n NodeOperatorShortInfo,\n} from '../common/types';\nimport { onRevertEmptyList } from '../common/utils/on-error';\nimport { ModuleSDK } from '../module-sdk/module-sdk';\nimport { byTotalCount, iteratePages, onePage } from './iterate-pages';\nimport {\n NodeOperatorDiscoveryInfo,\n NodeOperatorLockedBond,\n Pagination,\n SearchMode,\n} from './types';\n\nexport class DiscoverySDK extends CsmSDKModule<{ module: ModuleSDK }> {\n private get discoveryContract() {\n return this.core.getContract(CONTRACT_NAMES.smDiscovery);\n }\n\n /**\n * Paginates through operators using the provided fetch function.\n *\n * Behavior:\n * - Without pagination parameter: Fetches ALL operators by querying total count and iterating through all pages\n * - With pagination parameter: Fetches ONLY ONE PAGE at the specified offset/limit\n *\n * @param fetchPage - Function to fetch a page of operators\n * @param pagination - Optional pagination parameters (offset, limit)\n * @param defaultLimit - Optional default limit when pagination is not provided (defaults to 1000)\n * @returns Array of all fetched operators\n */\n private async paginateOperators<T>(\n fetchPage: (p: Pagination) => Promise<readonly T[] | T[]>,\n pagination?: Pagination,\n defaultLimit = 1000n,\n ): Promise<T[]> {\n const limit = pagination?.limit ?? defaultLimit;\n const offset = pagination?.offset ?? 0n;\n\n const getNextOffset = pagination\n ? onePage\n : byTotalCount(await this.bus.module.getOperatorsCount());\n\n return iteratePages(fetchPage, { offset, limit }, getNextOffset).catch(\n onRevertEmptyList<T>,\n );\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getNodeOperatorIds(\n address: Address,\n searchMode: SearchMode = SearchMode.CURRENT_ADDRESSES,\n pagination?: Pagination,\n ): Promise<NodeOperatorId[]> {\n return this.paginateOperators(\n (p) =>\n this.discoveryContract.read.findNodeOperatorsByAddress([\n this.core.moduleId,\n address,\n p.offset,\n p.limit,\n searchMode,\n ]),\n pagination,\n );\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getNodeOperatorsByAddress(\n address: Address,\n pagination?: Pagination,\n ): Promise<NodeOperatorShortInfo[]> {\n const operators = await this.paginateOperators(\n (p) =>\n this.discoveryContract.read.getNodeOperatorsByAddress([\n this.core.moduleId,\n address,\n p.offset,\n p.limit,\n ]),\n pagination,\n );\n\n return operators.map((operator) => ({\n ...operator,\n rewardsAddress: operator.rewardAddress,\n nodeOperatorId: operator.id,\n }));\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getNodeOperatorsByProposedAddress(\n address: Address,\n pagination?: Pagination,\n ): Promise<NodeOperatorInviteInfo[]> {\n const operators = await this.paginateOperators(\n (p) =>\n this.discoveryContract.read.getNodeOperatorsByProposedAddress([\n this.core.moduleId,\n address,\n p.offset,\n p.limit,\n ]),\n pagination,\n );\n\n return operators.flatMap((operator) =>\n [\n { address: operator.proposedManagerAddress, role: ROLES.MANAGER },\n { address: operator.proposedRewardAddress, role: ROLES.REWARDS },\n ]\n .filter((item) => isAddressEqual(item.address, address))\n .map((item) => ({\n nodeOperatorId: operator.id,\n extendedManagerPermissions: operator.extendedManagerPermissions,\n curveId: operator.curveId,\n role: item.role,\n })),\n );\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getAllNodeOperators(\n pagination?: Pagination,\n ): Promise<NodeOperatorDiscoveryInfo[]> {\n return this.paginateOperators(\n (p) =>\n this.discoveryContract.read.getAllNodeOperators([\n this.core.moduleId,\n p.offset,\n p.limit,\n ]),\n pagination,\n 500n, // Custom default limit for bulk fetching\n ) as Promise<NodeOperatorDiscoveryInfo[]>;\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getOperatorsWithLockedBond(\n pagination?: Pagination,\n ): Promise<NodeOperatorLockedBond[]> {\n const entries = await this.paginateOperators(\n (p) =>\n this.discoveryContract.read.getOperatorsWithLockedBond([\n this.core.moduleId,\n p.offset,\n p.limit,\n ]),\n pagination,\n );\n\n return entries.map((e) => ({\n nodeOperatorId: e.id,\n locked: e.amount,\n until: Number(e.until),\n }));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IA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
|
|
1
|
+
{"version":3,"file":"discovery-sdk.cjs","names":[],"sources":["../../src/discovery-sdk/discovery-sdk.ts"],"sourcesContent":["import { Address, isAddressEqual } from 'viem';\nimport { CsmSDKModule } from '../common/class-primitives/csm-sdk-module';\nimport {\n CONTRACT_NAMES,\n OPERATOR_TYPE,\n OPERATOR_TYPE_MODULE,\n} from '../common/constants/index';\nimport { ROLES } from '../common/constants/roles';\nimport { ErrorHandler, Logger } from '../common/decorators/index';\nimport {\n NodeOperatorId,\n NodeOperatorInviteInfo,\n NodeOperatorShortInfo,\n} from '../common/types';\nimport { getCurveIdByOperatorType } from '../common/utils/operator-type-utils';\nimport { onRevertEmptyList } from '../common/utils/on-error';\nimport { invariantArgument } from '../common/utils/sdk-error';\nimport { ModuleSDK } from '../module-sdk/module-sdk';\nimport { byTotalCount, iteratePages, onePage } from './iterate-pages';\nimport {\n NodeOperatorDiscoveryInfo,\n NodeOperatorLockedBond,\n Pagination,\n SearchMode,\n} from './types';\n\nexport class DiscoverySDK extends CsmSDKModule<{ module: ModuleSDK }> {\n private get discoveryContract() {\n return this.core.getContract(CONTRACT_NAMES.smDiscovery);\n }\n\n /**\n * Paginates through operators using the provided fetch function.\n *\n * Behavior:\n * - Without pagination parameter: Fetches ALL operators by querying total count and iterating through all pages\n * - With pagination parameter: Fetches ONLY ONE PAGE at the specified offset/limit\n *\n * @param fetchPage - Function to fetch a page of operators\n * @param pagination - Optional pagination parameters (offset, limit)\n * @param defaultLimit - Optional default limit when pagination is not provided (defaults to 1000)\n * @returns Array of all fetched operators\n */\n private async paginateOperators<T>(\n fetchPage: (p: Pagination) => Promise<readonly T[] | T[]>,\n pagination?: Pagination,\n defaultLimit = 1000n,\n ): Promise<T[]> {\n const limit = pagination?.limit ?? defaultLimit;\n const offset = pagination?.offset ?? 0n;\n\n const getNextOffset = pagination\n ? onePage\n : byTotalCount(await this.bus.module.getOperatorsCount());\n\n return iteratePages(fetchPage, { offset, limit }, getNextOffset).catch(\n onRevertEmptyList<T>,\n );\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getNodeOperatorIds(\n address: Address,\n searchMode: SearchMode = SearchMode.CURRENT_ADDRESSES,\n pagination?: Pagination,\n ): Promise<NodeOperatorId[]> {\n return this.paginateOperators(\n (p) =>\n this.discoveryContract.read.findNodeOperatorsByAddress([\n this.core.moduleId,\n address,\n p.offset,\n p.limit,\n searchMode,\n ]),\n pagination,\n );\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getNodeOperatorsByAddress(\n address: Address,\n pagination?: Pagination,\n ): Promise<NodeOperatorShortInfo[]> {\n const operators = await this.paginateOperators(\n (p) =>\n this.discoveryContract.read.getNodeOperatorsByAddress([\n this.core.moduleId,\n address,\n p.offset,\n p.limit,\n ]),\n pagination,\n );\n\n return operators.map(toShortInfo);\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getOperatorsByCurveId(\n curveId: bigint,\n pagination?: Pagination,\n ): Promise<NodeOperatorShortInfo[]> {\n const operators = await this.paginateOperators(\n (p) =>\n this.discoveryContract.read.getOperatorsByCurveId([\n this.core.moduleId,\n curveId,\n p.offset,\n p.limit,\n ]),\n pagination,\n );\n\n return operators.map(toShortInfo);\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getOperatorsByType(\n operatorType: OPERATOR_TYPE,\n pagination?: Pagination,\n ): Promise<NodeOperatorShortInfo[]> {\n invariantArgument(\n OPERATOR_TYPE_MODULE[operatorType] === this.core.moduleName,\n `Operator type \"${operatorType}\" does not belong to the current module (${this.core.moduleName})`,\n );\n\n const curveId = getCurveIdByOperatorType(this.core.chainId, operatorType);\n\n // Belt-and-suspenders: with the module check above this should always be\n // defined, but guard against a chain/type combo missing from the curve\n // id table (e.g. a newly added OPERATOR_TYPE not yet backfilled).\n invariantArgument(\n curveId !== undefined,\n `Operator type \"${operatorType}\" has no curve id for the current chain`,\n );\n\n return this.getOperatorsByCurveId(curveId, pagination);\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getNodeOperatorsByProposedAddress(\n address: Address,\n pagination?: Pagination,\n ): Promise<NodeOperatorInviteInfo[]> {\n const operators = await this.paginateOperators(\n (p) =>\n this.discoveryContract.read.getNodeOperatorsByProposedAddress([\n this.core.moduleId,\n address,\n p.offset,\n p.limit,\n ]),\n pagination,\n );\n\n return operators.flatMap((operator) =>\n [\n { address: operator.proposedManagerAddress, role: ROLES.MANAGER },\n { address: operator.proposedRewardAddress, role: ROLES.REWARDS },\n ]\n .filter((item) => isAddressEqual(item.address, address))\n .map((item) => ({\n nodeOperatorId: operator.id,\n extendedManagerPermissions: operator.extendedManagerPermissions,\n curveId: operator.curveId,\n role: item.role,\n })),\n );\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getAllNodeOperators(\n pagination?: Pagination,\n ): Promise<NodeOperatorDiscoveryInfo[]> {\n return this.paginateOperators(\n (p) =>\n this.discoveryContract.read.getAllNodeOperators([\n this.core.moduleId,\n p.offset,\n p.limit,\n ]),\n pagination,\n 500n, // Custom default limit for bulk fetching\n ) as Promise<NodeOperatorDiscoveryInfo[]>;\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getOperatorsWithLockedBond(\n pagination?: Pagination,\n ): Promise<NodeOperatorLockedBond[]> {\n const entries = await this.paginateOperators(\n (p) =>\n this.discoveryContract.read.getOperatorsWithLockedBond([\n this.core.moduleId,\n p.offset,\n p.limit,\n ]),\n pagination,\n );\n\n return entries.map((e) => ({\n nodeOperatorId: e.id,\n locked: e.amount,\n until: Number(e.until),\n }));\n }\n}\n\n/** Shape of the `NodeOperatorShort` struct shared by SMDiscovery ABI methods. */\ntype NodeOperatorShort = {\n id: bigint;\n managerAddress: Address;\n rewardAddress: Address;\n extendedManagerPermissions: boolean;\n curveId: bigint;\n};\n\nconst toShortInfo = (operator: NodeOperatorShort): NodeOperatorShortInfo => ({\n ...operator,\n rewardsAddress: operator.rewardAddress,\n nodeOperatorId: operator.id,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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MACC,KAAK,kBAAkB,KAAK,oBAAoB;GAC9C,KAAK,KAAK;GACV,EAAE;GACF,EAAE;GACH,CAAA,EACH,YACA,KACF;;CAKF,MAAa,2BACX,YACmC;AAWnC,UAVgB,MAAM,KAAK,mBACxB,MACC,KAAK,kBAAkB,KAAK,2BAA2B;GACrD,KAAK,KAAK;GACV,EAAE;GACF,EAAE;GACH,CAAA,EACH,WACF,EAEe,KAAK,OAAO;GACzB,gBAAgB,EAAE;GAClB,QAAQ,EAAE;GACV,OAAO,OAAO,EAAE,MAAK;GACvB,EAAE;;;AA1LC,QAAA,iBAAA,GAAA;AAoCL,kBAAA,OAAA,GAAa,sBAFb,yBAlCW,aAAA;AAwDX,kBAAA,OAAA,GAAa,6BAFb,gCAtDW,aAAA;AA4EX,kBAAA,OAAA,GAAa,yBAFb,4BA1EW,aAAA;AAgGX,kBAAA,OAAA,GAAa,sBAFb,yBA9FW,aAAA;AAwHX,kBAAA,OAAA,GAAa,qCAFb,wCAtHW,aAAA;AAwJX,kBAAA,OAAA,GAAa,uBAFb,0BAtJW,aAAA;AAyKX,kBAAA,OAAA,GAAa,8BAFb,iCAvKW,aAAA;AAAN,oBAAA,OAAM,aAAA;AAuMb,MAAM,eAAe,cAAwD;CAC3E,GAAG;CACH,gBAAgB,SAAS;CACzB,gBAAgB,SAAS;CAC3B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OPERATOR_TYPE } from "../common/constants/operator-types.cjs";
|
|
1
2
|
import { NodeOperatorId, NodeOperatorInviteInfo, NodeOperatorShortInfo } from "../common/types.cjs";
|
|
2
3
|
import { CsmSDKModule } from "../common/class-primitives/csm-sdk-module.cjs";
|
|
3
4
|
import { ModuleSDK } from "../module-sdk/module-sdk.cjs";
|
|
@@ -24,6 +25,8 @@ declare class DiscoverySDK extends CsmSDKModule<{
|
|
|
24
25
|
private paginateOperators;
|
|
25
26
|
getNodeOperatorIds(address: Address, searchMode?: SearchMode, pagination?: Pagination): Promise<NodeOperatorId[]>;
|
|
26
27
|
getNodeOperatorsByAddress(address: Address, pagination?: Pagination): Promise<NodeOperatorShortInfo[]>;
|
|
28
|
+
getOperatorsByCurveId(curveId: bigint, pagination?: Pagination): Promise<NodeOperatorShortInfo[]>;
|
|
29
|
+
getOperatorsByType(operatorType: OPERATOR_TYPE, pagination?: Pagination): Promise<NodeOperatorShortInfo[]>;
|
|
27
30
|
getNodeOperatorsByProposedAddress(address: Address, pagination?: Pagination): Promise<NodeOperatorInviteInfo[]>;
|
|
28
31
|
getAllNodeOperators(pagination?: Pagination): Promise<NodeOperatorDiscoveryInfo[]>;
|
|
29
32
|
getOperatorsWithLockedBond(pagination?: Pagination): Promise<NodeOperatorLockedBond[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery-sdk.d.cts","names":[],"sources":["../../src/discovery-sdk/discovery-sdk.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"discovery-sdk.d.cts","names":[],"sources":["../../src/discovery-sdk/discovery-sdk.ts"],"mappings":";;;;;;;;cA0Ba,YAAA,SAAqB,YAAA;EAAe,MAAA,EAAQ,SAAA;AAAA;EAAA,YAC3C,iBAAA,CAAA;EADY;;;;;;;;;;;;EAAA,QAiBV,iBAAA;EAmBD,kBAAA,CACX,OAAA,EAAS,OAAA,EACT,UAAA,GAAY,UAAA,EACZ,UAAA,GAAa,UAAA,GACZ,OAAA,CAAQ,cAAA;EAgBE,yBAAA,CACX,OAAA,EAAS,OAAA,EACT,UAAA,GAAa,UAAA,GACZ,OAAA,CAAQ,qBAAA;EAiBE,qBAAA,CACX,OAAA,UACA,UAAA,GAAa,UAAA,GACZ,OAAA,CAAQ,qBAAA;EAiBE,kBAAA,CACX,YAAA,EAAc,aAAA,EACd,UAAA,GAAa,UAAA,GACZ,OAAA,CAAQ,qBAAA;EAqBE,iCAAA,CACX,OAAA,EAAS,OAAA,EACT,UAAA,GAAa,UAAA,GACZ,OAAA,CAAQ,sBAAA;EA6BE,mBAAA,CACX,UAAA,GAAa,UAAA,GACZ,OAAA,CAAQ,yBAAA;EAeE,0BAAA,CACX,UAAA,GAAa,UAAA,GACZ,OAAA,CAAQ,sBAAA;AAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OPERATOR_TYPE } from "../common/constants/operator-types.mjs";
|
|
1
2
|
import { NodeOperatorId, NodeOperatorInviteInfo, NodeOperatorShortInfo } from "../common/types.mjs";
|
|
2
3
|
import { CsmSDKModule } from "../common/class-primitives/csm-sdk-module.mjs";
|
|
3
4
|
import { ModuleSDK } from "../module-sdk/module-sdk.mjs";
|
|
@@ -24,6 +25,8 @@ declare class DiscoverySDK extends CsmSDKModule<{
|
|
|
24
25
|
private paginateOperators;
|
|
25
26
|
getNodeOperatorIds(address: Address, searchMode?: SearchMode, pagination?: Pagination): Promise<NodeOperatorId[]>;
|
|
26
27
|
getNodeOperatorsByAddress(address: Address, pagination?: Pagination): Promise<NodeOperatorShortInfo[]>;
|
|
28
|
+
getOperatorsByCurveId(curveId: bigint, pagination?: Pagination): Promise<NodeOperatorShortInfo[]>;
|
|
29
|
+
getOperatorsByType(operatorType: OPERATOR_TYPE, pagination?: Pagination): Promise<NodeOperatorShortInfo[]>;
|
|
27
30
|
getNodeOperatorsByProposedAddress(address: Address, pagination?: Pagination): Promise<NodeOperatorInviteInfo[]>;
|
|
28
31
|
getAllNodeOperators(pagination?: Pagination): Promise<NodeOperatorDiscoveryInfo[]>;
|
|
29
32
|
getOperatorsWithLockedBond(pagination?: Pagination): Promise<NodeOperatorLockedBond[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery-sdk.d.mts","names":[],"sources":["../../src/discovery-sdk/discovery-sdk.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"discovery-sdk.d.mts","names":[],"sources":["../../src/discovery-sdk/discovery-sdk.ts"],"mappings":";;;;;;;;cA0Ba,YAAA,SAAqB,YAAA;EAAe,MAAA,EAAQ,SAAA;AAAA;EAAA,YAC3C,iBAAA,CAAA;EADY;;;;;;;;;;;;EAAA,QAiBV,iBAAA;EAmBD,kBAAA,CACX,OAAA,EAAS,OAAA,EACT,UAAA,GAAY,UAAA,EACZ,UAAA,GAAa,UAAA,GACZ,OAAA,CAAQ,cAAA;EAgBE,yBAAA,CACX,OAAA,EAAS,OAAA,EACT,UAAA,GAAa,UAAA,GACZ,OAAA,CAAQ,qBAAA;EAiBE,qBAAA,CACX,OAAA,UACA,UAAA,GAAa,UAAA,GACZ,OAAA,CAAQ,qBAAA;EAiBE,kBAAA,CACX,YAAA,EAAc,aAAA,EACd,UAAA,GAAa,UAAA,GACZ,OAAA,CAAQ,qBAAA;EAqBE,iCAAA,CACX,OAAA,EAAS,OAAA,EACT,UAAA,GAAa,UAAA,GACZ,OAAA,CAAQ,sBAAA;EA6BE,mBAAA,CACX,UAAA,GAAa,UAAA,GACZ,OAAA,CAAQ,yBAAA;EAeE,0BAAA,CACX,UAAA,GAAa,UAAA,GACZ,OAAA,CAAQ,sBAAA;AAAA"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { CONTRACT_NAMES } from "../common/constants/contract-names.mjs";
|
|
2
|
+
import { invariantArgument } from "../common/utils/sdk-error.mjs";
|
|
2
3
|
import { CsmSDKModule } from "../common/class-primitives/csm-sdk-module.mjs";
|
|
3
4
|
import { onRevertEmptyList } from "../common/utils/on-error.mjs";
|
|
5
|
+
import { OPERATOR_TYPE_MODULE } from "../common/constants/operator-types.mjs";
|
|
4
6
|
import { ROLES } from "../common/constants/roles.mjs";
|
|
7
|
+
import { getCurveIdByOperatorType } from "../common/utils/operator-type-utils.mjs";
|
|
5
8
|
import { ErrorHandler } from "../common/decorators/error-handler.mjs";
|
|
6
9
|
import { Logger } from "../common/decorators/logger.mjs";
|
|
7
10
|
import { byTotalCount, iteratePages, onePage } from "./iterate-pages.mjs";
|
|
@@ -89,8 +92,8 @@ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError("Cannot use
|
|
|
89
92
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
90
93
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
91
94
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
92
|
-
var _getOperatorsWithLockedBond_dec, _getAllNodeOperators_dec, _getNodeOperatorsByProposedAddress_dec, _getNodeOperatorsByAddress_dec, _getNodeOperatorIds_dec, _a, _init;
|
|
93
|
-
var DiscoverySDK = class extends (_a = CsmSDKModule, _getNodeOperatorIds_dec = [Logger("Views:"), ErrorHandler()], _getNodeOperatorsByAddress_dec = [Logger("Views:"), ErrorHandler()], _getNodeOperatorsByProposedAddress_dec = [Logger("Views:"), ErrorHandler()], _getAllNodeOperators_dec = [Logger("Views:"), ErrorHandler()], _getOperatorsWithLockedBond_dec = [Logger("Views:"), ErrorHandler()], _a) {
|
|
95
|
+
var _getOperatorsWithLockedBond_dec, _getAllNodeOperators_dec, _getNodeOperatorsByProposedAddress_dec, _getOperatorsByType_dec, _getOperatorsByCurveId_dec, _getNodeOperatorsByAddress_dec, _getNodeOperatorIds_dec, _a, _init;
|
|
96
|
+
var DiscoverySDK = class extends (_a = CsmSDKModule, _getNodeOperatorIds_dec = [Logger("Views:"), ErrorHandler()], _getNodeOperatorsByAddress_dec = [Logger("Views:"), ErrorHandler()], _getOperatorsByCurveId_dec = [Logger("Views:"), ErrorHandler()], _getOperatorsByType_dec = [Logger("Views:"), ErrorHandler()], _getNodeOperatorsByProposedAddress_dec = [Logger("Views:"), ErrorHandler()], _getAllNodeOperators_dec = [Logger("Views:"), ErrorHandler()], _getOperatorsWithLockedBond_dec = [Logger("Views:"), ErrorHandler()], _a) {
|
|
94
97
|
constructor() {
|
|
95
98
|
super(...arguments);
|
|
96
99
|
__runInitializers(_init, 5, this);
|
|
@@ -134,11 +137,21 @@ var DiscoverySDK = class extends (_a = CsmSDKModule, _getNodeOperatorIds_dec = [
|
|
|
134
137
|
address,
|
|
135
138
|
p.offset,
|
|
136
139
|
p.limit
|
|
137
|
-
]), pagination)).map(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
]), pagination)).map(toShortInfo);
|
|
141
|
+
}
|
|
142
|
+
async getOperatorsByCurveId(curveId, pagination) {
|
|
143
|
+
return (await this.paginateOperators((p) => this.discoveryContract.read.getOperatorsByCurveId([
|
|
144
|
+
this.core.moduleId,
|
|
145
|
+
curveId,
|
|
146
|
+
p.offset,
|
|
147
|
+
p.limit
|
|
148
|
+
]), pagination)).map(toShortInfo);
|
|
149
|
+
}
|
|
150
|
+
async getOperatorsByType(operatorType, pagination) {
|
|
151
|
+
invariantArgument(OPERATOR_TYPE_MODULE[operatorType] === this.core.moduleName, `Operator type "${operatorType}" does not belong to the current module (${this.core.moduleName})`);
|
|
152
|
+
const curveId = getCurveIdByOperatorType(this.core.chainId, operatorType);
|
|
153
|
+
invariantArgument(curveId !== void 0, `Operator type "${operatorType}" has no curve id for the current chain`);
|
|
154
|
+
return this.getOperatorsByCurveId(curveId, pagination);
|
|
142
155
|
}
|
|
143
156
|
async getNodeOperatorsByProposedAddress(address, pagination) {
|
|
144
157
|
return (await this.paginateOperators((p) => this.discoveryContract.read.getNodeOperatorsByProposedAddress([
|
|
@@ -181,10 +194,17 @@ var DiscoverySDK = class extends (_a = CsmSDKModule, _getNodeOperatorIds_dec = [
|
|
|
181
194
|
_init = __decoratorStart(_a);
|
|
182
195
|
__decorateElement(_init, 1, "getNodeOperatorIds", _getNodeOperatorIds_dec, DiscoverySDK);
|
|
183
196
|
__decorateElement(_init, 1, "getNodeOperatorsByAddress", _getNodeOperatorsByAddress_dec, DiscoverySDK);
|
|
197
|
+
__decorateElement(_init, 1, "getOperatorsByCurveId", _getOperatorsByCurveId_dec, DiscoverySDK);
|
|
198
|
+
__decorateElement(_init, 1, "getOperatorsByType", _getOperatorsByType_dec, DiscoverySDK);
|
|
184
199
|
__decorateElement(_init, 1, "getNodeOperatorsByProposedAddress", _getNodeOperatorsByProposedAddress_dec, DiscoverySDK);
|
|
185
200
|
__decorateElement(_init, 1, "getAllNodeOperators", _getAllNodeOperators_dec, DiscoverySDK);
|
|
186
201
|
__decorateElement(_init, 1, "getOperatorsWithLockedBond", _getOperatorsWithLockedBond_dec, DiscoverySDK);
|
|
187
202
|
__decoratorMetadata(_init, DiscoverySDK);
|
|
203
|
+
const toShortInfo = (operator) => ({
|
|
204
|
+
...operator,
|
|
205
|
+
rewardsAddress: operator.rewardAddress,
|
|
206
|
+
nodeOperatorId: operator.id
|
|
207
|
+
});
|
|
188
208
|
//#endregion
|
|
189
209
|
export { DiscoverySDK };
|
|
190
210
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery-sdk.mjs","names":[],"sources":["../../src/discovery-sdk/discovery-sdk.ts"],"sourcesContent":["import { Address, isAddressEqual } from 'viem';\nimport { CsmSDKModule } from '../common/class-primitives/csm-sdk-module';\nimport {
|
|
1
|
+
{"version":3,"file":"discovery-sdk.mjs","names":[],"sources":["../../src/discovery-sdk/discovery-sdk.ts"],"sourcesContent":["import { Address, isAddressEqual } from 'viem';\nimport { CsmSDKModule } from '../common/class-primitives/csm-sdk-module';\nimport {\n CONTRACT_NAMES,\n OPERATOR_TYPE,\n OPERATOR_TYPE_MODULE,\n} from '../common/constants/index';\nimport { ROLES } from '../common/constants/roles';\nimport { ErrorHandler, Logger } from '../common/decorators/index';\nimport {\n NodeOperatorId,\n NodeOperatorInviteInfo,\n NodeOperatorShortInfo,\n} from '../common/types';\nimport { getCurveIdByOperatorType } from '../common/utils/operator-type-utils';\nimport { onRevertEmptyList } from '../common/utils/on-error';\nimport { invariantArgument } from '../common/utils/sdk-error';\nimport { ModuleSDK } from '../module-sdk/module-sdk';\nimport { byTotalCount, iteratePages, onePage } from './iterate-pages';\nimport {\n NodeOperatorDiscoveryInfo,\n NodeOperatorLockedBond,\n Pagination,\n SearchMode,\n} from './types';\n\nexport class DiscoverySDK extends CsmSDKModule<{ module: ModuleSDK }> {\n private get discoveryContract() {\n return this.core.getContract(CONTRACT_NAMES.smDiscovery);\n }\n\n /**\n * Paginates through operators using the provided fetch function.\n *\n * Behavior:\n * - Without pagination parameter: Fetches ALL operators by querying total count and iterating through all pages\n * - With pagination parameter: Fetches ONLY ONE PAGE at the specified offset/limit\n *\n * @param fetchPage - Function to fetch a page of operators\n * @param pagination - Optional pagination parameters (offset, limit)\n * @param defaultLimit - Optional default limit when pagination is not provided (defaults to 1000)\n * @returns Array of all fetched operators\n */\n private async paginateOperators<T>(\n fetchPage: (p: Pagination) => Promise<readonly T[] | T[]>,\n pagination?: Pagination,\n defaultLimit = 1000n,\n ): Promise<T[]> {\n const limit = pagination?.limit ?? defaultLimit;\n const offset = pagination?.offset ?? 0n;\n\n const getNextOffset = pagination\n ? onePage\n : byTotalCount(await this.bus.module.getOperatorsCount());\n\n return iteratePages(fetchPage, { offset, limit }, getNextOffset).catch(\n onRevertEmptyList<T>,\n );\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getNodeOperatorIds(\n address: Address,\n searchMode: SearchMode = SearchMode.CURRENT_ADDRESSES,\n pagination?: Pagination,\n ): Promise<NodeOperatorId[]> {\n return this.paginateOperators(\n (p) =>\n this.discoveryContract.read.findNodeOperatorsByAddress([\n this.core.moduleId,\n address,\n p.offset,\n p.limit,\n searchMode,\n ]),\n pagination,\n );\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getNodeOperatorsByAddress(\n address: Address,\n pagination?: Pagination,\n ): Promise<NodeOperatorShortInfo[]> {\n const operators = await this.paginateOperators(\n (p) =>\n this.discoveryContract.read.getNodeOperatorsByAddress([\n this.core.moduleId,\n address,\n p.offset,\n p.limit,\n ]),\n pagination,\n );\n\n return operators.map(toShortInfo);\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getOperatorsByCurveId(\n curveId: bigint,\n pagination?: Pagination,\n ): Promise<NodeOperatorShortInfo[]> {\n const operators = await this.paginateOperators(\n (p) =>\n this.discoveryContract.read.getOperatorsByCurveId([\n this.core.moduleId,\n curveId,\n p.offset,\n p.limit,\n ]),\n pagination,\n );\n\n return operators.map(toShortInfo);\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getOperatorsByType(\n operatorType: OPERATOR_TYPE,\n pagination?: Pagination,\n ): Promise<NodeOperatorShortInfo[]> {\n invariantArgument(\n OPERATOR_TYPE_MODULE[operatorType] === this.core.moduleName,\n `Operator type \"${operatorType}\" does not belong to the current module (${this.core.moduleName})`,\n );\n\n const curveId = getCurveIdByOperatorType(this.core.chainId, operatorType);\n\n // Belt-and-suspenders: with the module check above this should always be\n // defined, but guard against a chain/type combo missing from the curve\n // id table (e.g. a newly added OPERATOR_TYPE not yet backfilled).\n invariantArgument(\n curveId !== undefined,\n `Operator type \"${operatorType}\" has no curve id for the current chain`,\n );\n\n return this.getOperatorsByCurveId(curveId, pagination);\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getNodeOperatorsByProposedAddress(\n address: Address,\n pagination?: Pagination,\n ): Promise<NodeOperatorInviteInfo[]> {\n const operators = await this.paginateOperators(\n (p) =>\n this.discoveryContract.read.getNodeOperatorsByProposedAddress([\n this.core.moduleId,\n address,\n p.offset,\n p.limit,\n ]),\n pagination,\n );\n\n return operators.flatMap((operator) =>\n [\n { address: operator.proposedManagerAddress, role: ROLES.MANAGER },\n { address: operator.proposedRewardAddress, role: ROLES.REWARDS },\n ]\n .filter((item) => isAddressEqual(item.address, address))\n .map((item) => ({\n nodeOperatorId: operator.id,\n extendedManagerPermissions: operator.extendedManagerPermissions,\n curveId: operator.curveId,\n role: item.role,\n })),\n );\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getAllNodeOperators(\n pagination?: Pagination,\n ): Promise<NodeOperatorDiscoveryInfo[]> {\n return this.paginateOperators(\n (p) =>\n this.discoveryContract.read.getAllNodeOperators([\n this.core.moduleId,\n p.offset,\n p.limit,\n ]),\n pagination,\n 500n, // Custom default limit for bulk fetching\n ) as Promise<NodeOperatorDiscoveryInfo[]>;\n }\n\n @Logger('Views:')\n @ErrorHandler()\n public async getOperatorsWithLockedBond(\n pagination?: Pagination,\n ): Promise<NodeOperatorLockedBond[]> {\n const entries = await this.paginateOperators(\n (p) =>\n this.discoveryContract.read.getOperatorsWithLockedBond([\n this.core.moduleId,\n p.offset,\n p.limit,\n ]),\n pagination,\n );\n\n return entries.map((e) => ({\n nodeOperatorId: e.id,\n locked: e.amount,\n until: Number(e.until),\n }));\n }\n}\n\n/** Shape of the `NodeOperatorShort` struct shared by SMDiscovery ABI methods. */\ntype NodeOperatorShort = {\n id: bigint;\n managerAddress: Address;\n rewardAddress: Address;\n extendedManagerPermissions: boolean;\n curveId: bigint;\n};\n\nconst toShortInfo = (operator: NodeOperatorShort): NodeOperatorShortInfo => ({\n ...operator,\n rewardsAddress: operator.rewardAddress,\n nodeOperatorId: operator.id,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,iCAAA,0BAAA,wCAAA,yBAAA,4BAAA,gCAAA,yBAAA,IAAA;AA0BO,IAAM,eAAN,eAA2B,KAAA,cAkChC,0BAAA,CAAC,OAAO,SAAQ,EACf,cAAa,CAAA,EAmBd,iCAAA,CAAC,OAAO,SAAQ,EACf,cAAa,CAAA,EAmBd,6BAAA,CAAC,OAAO,SAAQ,EACf,cAAa,CAAA,EAmBd,0BAAA,CAAC,OAAO,SAAQ,EACf,cAAa,CAAA,EAuBd,yCAAA,CAAC,OAAO,SAAQ,EACf,cAAa,CAAA,EA+Bd,2BAAA,CAAC,OAAO,SAAQ,EACf,cAAa,CAAA,EAgBd,kCAAA,CAAC,OAAO,SAAQ,EACf,cAAa,CAAA,EAxKkB,IAAoC;CAA/D,cAAA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