@4mica/sdk 1.2.17 → 1.3.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/README.md +59 -25
- package/dist/index.cjs +5513 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2730 -0
- package/dist/{src/abi/core4mica.d.ts → index.d.ts} +1032 -1
- package/dist/index.js +5439 -0
- package/dist/index.js.map +1 -0
- package/dist/models-B15ouNYG.d.cts +386 -0
- package/dist/models-B15ouNYG.d.ts +386 -0
- package/dist/server.cjs +172 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +119 -0
- package/dist/server.d.ts +119 -0
- package/dist/server.js +165 -0
- package/dist/server.js.map +1 -0
- package/package.json +52 -43
- package/dist/package.json +0 -80
- package/dist/src/abi/core4mica.js +0 -2200
- package/dist/src/abi/erc20.d.ts +0 -151
- package/dist/src/abi/erc20.js +0 -201
- package/dist/src/auth.d.ts +0 -62
- package/dist/src/auth.js +0 -218
- package/dist/src/bls.d.ts +0 -6
- package/dist/src/bls.js +0 -247
- package/dist/src/chain.d.ts +0 -2
- package/dist/src/chain.js +0 -26
- package/dist/src/client/index.d.ts +0 -71
- package/dist/src/client/index.js +0 -120
- package/dist/src/client/recipient.d.ts +0 -129
- package/dist/src/client/recipient.js +0 -257
- package/dist/src/client/shared.d.ts +0 -11
- package/dist/src/client/shared.js +0 -17
- package/dist/src/client/user.d.ts +0 -109
- package/dist/src/client/user.js +0 -151
- package/dist/src/config.d.ts +0 -103
- package/dist/src/config.js +0 -197
- package/dist/src/constants.d.ts +0 -4
- package/dist/src/constants.js +0 -7
- package/dist/src/contract.d.ts +0 -55
- package/dist/src/contract.js +0 -312
- package/dist/src/debug.d.ts +0 -2
- package/dist/src/debug.js +0 -5
- package/dist/src/errors.d.ts +0 -58
- package/dist/src/errors.js +0 -81
- package/dist/src/guarantee.d.ts +0 -25
- package/dist/src/guarantee.js +0 -272
- package/dist/src/http.d.ts +0 -11
- package/dist/src/http.js +0 -57
- package/dist/src/index.d.ts +0 -17
- package/dist/src/index.js +0 -33
- package/dist/src/models.d.ts +0 -261
- package/dist/src/models.js +0 -360
- package/dist/src/networks.d.ts +0 -40
- package/dist/src/networks.js +0 -57
- package/dist/src/payment.d.ts +0 -82
- package/dist/src/payment.js +0 -67
- package/dist/src/rpc.d.ts +0 -38
- package/dist/src/rpc.js +0 -161
- package/dist/src/serde.d.ts +0 -5
- package/dist/src/serde.js +0 -33
- package/dist/src/signing.d.ts +0 -170
- package/dist/src/signing.js +0 -311
- package/dist/src/utils.d.ts +0 -11
- package/dist/src/utils.js +0 -90
- package/dist/src/validation.d.ts +0 -32
- package/dist/src/validation.js +0 -84
- package/dist/src/wallet/cdp.d.ts +0 -13
- package/dist/src/wallet/cdp.js +0 -78
- package/dist/src/wallet/index.d.ts +0 -2
- package/dist/src/wallet/index.js +0 -5
- package/dist/src/x402/index.d.ts +0 -90
- package/dist/src/x402/index.js +0 -243
- package/dist/src/x402/models.d.ts +0 -75
- package/dist/src/x402/models.js +0 -2
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,2730 @@
|
|
|
1
|
+
import * as viem from 'viem';
|
|
2
|
+
import { Account, createPublicClient, WalletClient, HttpTransport, Chain, GetContractReturnType, Hex } from 'viem';
|
|
3
|
+
import { C as CorePublicParameters, S as SupportedTokensResponse, a as ClearingSettlementActionKind, U as UserSuspensionStatus, A as AdminApiKeySecret, b as AdminApiKeyInfo, P as PaymentGuaranteeRequestClaims, c as PaymentGuaranteeRequestClaimsV2, d as SigningScheme, B as BLSCert, e as PaymentGuaranteeClaims, f as ClearingParticipantProof, g as ClearingSettlementActionResponse, R as RecipientPaymentInfo, h as AssetBalanceInfo, i as UserInfo, j as PaymentSignature, k as PaymentPayload, l as PaymentPayloadClaims, m as PaymentPayloadClaimsV2, n as PaymentRequirementsV1, X as X402SignedPayment, o as X402PaymentRequired, p as PaymentRequirementsV2, q as X402SettledPayment, r as X402ResourceInfo, T as TabResponse } from './models-B15ouNYG.cjs';
|
|
4
|
+
export { s as ClearingParticipantRole, t as PaymentGuaranteeValidationPolicyV2, u as PaymentRequirements, v as PaymentRequirementsExtra, w as SupportedTokenInfo, x as X402PaymentEnvelopeV1, y as X402PaymentEnvelopeV2, z as X402PaymentPayload, D as X402PaymentPayloadClaims } from './models-B15ouNYG.cjs';
|
|
5
|
+
import { Account as Account$1 } from 'viem/accounts';
|
|
6
|
+
|
|
7
|
+
type AuthTokens = {
|
|
8
|
+
accessToken: string;
|
|
9
|
+
refreshToken: string;
|
|
10
|
+
expiresIn: number;
|
|
11
|
+
};
|
|
12
|
+
type SiweTemplate = {
|
|
13
|
+
domain: string;
|
|
14
|
+
uri: string;
|
|
15
|
+
chainId: number;
|
|
16
|
+
statement: string;
|
|
17
|
+
expiration: string;
|
|
18
|
+
issuedAt: string;
|
|
19
|
+
};
|
|
20
|
+
type AuthNonceResponse = {
|
|
21
|
+
nonce: string;
|
|
22
|
+
siwe: SiweTemplate;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
declare const ADMIN_API_KEY_HEADER = "x-api-key";
|
|
26
|
+
declare const ADMIN_API_KEY_PREFIX = "ak_";
|
|
27
|
+
declare const ADMIN_SCOPE_SUSPEND_USERS = "user_suspension:write";
|
|
28
|
+
declare const ADMIN_SCOPE_MANAGE_KEYS = "admin_api_keys:manage";
|
|
29
|
+
|
|
30
|
+
type FetchFn$1 = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
31
|
+
|
|
32
|
+
type FetchFn = FetchFn$1;
|
|
33
|
+
type BearerTokenProvider = () => string | Promise<string>;
|
|
34
|
+
|
|
35
|
+
declare class RpcProxy {
|
|
36
|
+
private baseUrl;
|
|
37
|
+
private adminApiKey?;
|
|
38
|
+
private bearerToken?;
|
|
39
|
+
private bearerTokenProvider?;
|
|
40
|
+
private fetchFn;
|
|
41
|
+
constructor(endpoint: string, adminApiKey?: string, fetchFn?: FetchFn);
|
|
42
|
+
aclose(): Promise<void>;
|
|
43
|
+
withBearerToken(token: string): RpcProxy;
|
|
44
|
+
withTokenProvider(provider: BearerTokenProvider): RpcProxy;
|
|
45
|
+
private headers;
|
|
46
|
+
private resolveBearerToken;
|
|
47
|
+
private get;
|
|
48
|
+
private post;
|
|
49
|
+
getPublicParams(): Promise<CorePublicParameters>;
|
|
50
|
+
getSupportedTokens(): Promise<SupportedTokensResponse>;
|
|
51
|
+
issueGuarantee(body: unknown): Promise<Record<string, unknown>>;
|
|
52
|
+
/**
|
|
53
|
+
* Fetch a participant's committed position + Merkle proof for a settlement cycle.
|
|
54
|
+
*
|
|
55
|
+
* @param cycleId - On-chain `bytes32` cycle identifier.
|
|
56
|
+
* @param participant - Participant address.
|
|
57
|
+
*/
|
|
58
|
+
getClearingParticipantProof(cycleId: string, participant: string): Promise<Record<string, unknown>>;
|
|
59
|
+
/**
|
|
60
|
+
* Fetch a prepared ClearingHouse settlement action for a participant.
|
|
61
|
+
*
|
|
62
|
+
* @param cycleId - On-chain `bytes32` cycle identifier.
|
|
63
|
+
* @param participant - Participant address.
|
|
64
|
+
* @param action - `pay_net_debit`, `claim_net_credit`, or `mark_defaulted`.
|
|
65
|
+
*/
|
|
66
|
+
getClearingSettlementAction(cycleId: string, participant: string, action: ClearingSettlementActionKind): Promise<Record<string, unknown>>;
|
|
67
|
+
/** Prepared `payNetDebit` action for a net-debtor participant. */
|
|
68
|
+
getClearingPayNetDebitAction(cycleId: string, debtor: string): Promise<Record<string, unknown>>;
|
|
69
|
+
/** Prepared `claimNetCredit` action for a net-creditor participant. */
|
|
70
|
+
getClearingClaimNetCreditAction(cycleId: string, creditor: string): Promise<Record<string, unknown>>;
|
|
71
|
+
/** Prepared `markDefaulted` action for a debtor past the payment deadline. */
|
|
72
|
+
getClearingMarkDefaultedAction(cycleId: string, debtor: string): Promise<Record<string, unknown>>;
|
|
73
|
+
listRecipientPayments(recipientAddress: string): Promise<Record<string, unknown>[]>;
|
|
74
|
+
getUserAssetBalance(userAddress: string, assetAddress: string): Promise<Record<string, unknown> | null>;
|
|
75
|
+
updateUserSuspension(userAddress: string, suspended: boolean): Promise<UserSuspensionStatus>;
|
|
76
|
+
createAdminApiKey(body: unknown): Promise<AdminApiKeySecret>;
|
|
77
|
+
listAdminApiKeys(): Promise<AdminApiKeyInfo[]>;
|
|
78
|
+
revokeAdminApiKey(keyId: string): Promise<AdminApiKeyInfo>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
declare function buildSiweMessage(input: {
|
|
82
|
+
domain: string;
|
|
83
|
+
address: string;
|
|
84
|
+
statement: string;
|
|
85
|
+
uri: string;
|
|
86
|
+
chainId: number | string;
|
|
87
|
+
nonce: string;
|
|
88
|
+
issuedAt: string;
|
|
89
|
+
expiration: string;
|
|
90
|
+
}): string;
|
|
91
|
+
declare class AuthClient {
|
|
92
|
+
private baseUrl;
|
|
93
|
+
private fetchFn;
|
|
94
|
+
constructor(endpoint: string, fetchFn?: FetchFn);
|
|
95
|
+
getNonce(address: string): Promise<AuthNonceResponse>;
|
|
96
|
+
verify(address: string, message: string, signature: string): Promise<AuthTokens>;
|
|
97
|
+
refresh(refreshToken: string): Promise<AuthTokens>;
|
|
98
|
+
logout(refreshToken: string): Promise<void>;
|
|
99
|
+
private post;
|
|
100
|
+
private request;
|
|
101
|
+
}
|
|
102
|
+
declare class AuthSession {
|
|
103
|
+
private authClient;
|
|
104
|
+
private signer;
|
|
105
|
+
private refreshMarginSecs;
|
|
106
|
+
private tokens?;
|
|
107
|
+
private inFlight?;
|
|
108
|
+
private loginPromise?;
|
|
109
|
+
constructor(options: {
|
|
110
|
+
authUrl: string;
|
|
111
|
+
signer: Account;
|
|
112
|
+
refreshMarginSecs?: number;
|
|
113
|
+
fetchFn?: FetchFn;
|
|
114
|
+
});
|
|
115
|
+
accessToken(): Promise<string>;
|
|
116
|
+
login(): Promise<AuthTokens>;
|
|
117
|
+
logout(): Promise<void>;
|
|
118
|
+
private refreshOrLogin;
|
|
119
|
+
private performLogin;
|
|
120
|
+
private refreshTokens;
|
|
121
|
+
private cacheTokens;
|
|
122
|
+
private isExpiringSoon;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Expand a compressed G2 signature into the tuple expected by the contract.
|
|
127
|
+
* This mirrors the Python helper and requires the optional `@noble/curves` dependency.
|
|
128
|
+
*
|
|
129
|
+
* Synchronous variant: usable only after {@link signatureToWordsAsync} (or any
|
|
130
|
+
* async remuneration path) has loaded `@noble/curves`. Prefer
|
|
131
|
+
* {@link signatureToWordsAsync}, which is runtime-neutral and used internally.
|
|
132
|
+
*
|
|
133
|
+
* @throws {@link VerificationError} if `@noble/curves` has not been loaded yet.
|
|
134
|
+
*/
|
|
135
|
+
declare function signatureToWords(signatureHex: string): Uint8Array[];
|
|
136
|
+
declare function signatureToWordsAsync(signatureHex: string): Promise<Uint8Array[]>;
|
|
137
|
+
|
|
138
|
+
declare const core4micaAbi: readonly [{
|
|
139
|
+
readonly type: "constructor";
|
|
140
|
+
readonly inputs: readonly [{
|
|
141
|
+
readonly name: "manager";
|
|
142
|
+
readonly type: "address";
|
|
143
|
+
readonly internalType: "address";
|
|
144
|
+
}, {
|
|
145
|
+
readonly name: "verificationKey";
|
|
146
|
+
readonly type: "tuple";
|
|
147
|
+
readonly internalType: "struct BLS.G1Point";
|
|
148
|
+
readonly components: readonly [{
|
|
149
|
+
readonly name: "x_a";
|
|
150
|
+
readonly type: "bytes32";
|
|
151
|
+
readonly internalType: "bytes32";
|
|
152
|
+
}, {
|
|
153
|
+
readonly name: "x_b";
|
|
154
|
+
readonly type: "bytes32";
|
|
155
|
+
readonly internalType: "bytes32";
|
|
156
|
+
}, {
|
|
157
|
+
readonly name: "y_a";
|
|
158
|
+
readonly type: "bytes32";
|
|
159
|
+
readonly internalType: "bytes32";
|
|
160
|
+
}, {
|
|
161
|
+
readonly name: "y_b";
|
|
162
|
+
readonly type: "bytes32";
|
|
163
|
+
readonly internalType: "bytes32";
|
|
164
|
+
}];
|
|
165
|
+
}, {
|
|
166
|
+
readonly name: "stablecoins_";
|
|
167
|
+
readonly type: "address[]";
|
|
168
|
+
readonly internalType: "address[]";
|
|
169
|
+
}];
|
|
170
|
+
readonly stateMutability: "nonpayable";
|
|
171
|
+
}, {
|
|
172
|
+
readonly type: "fallback";
|
|
173
|
+
readonly stateMutability: "payable";
|
|
174
|
+
}, {
|
|
175
|
+
readonly type: "receive";
|
|
176
|
+
readonly stateMutability: "payable";
|
|
177
|
+
}, {
|
|
178
|
+
readonly type: "function";
|
|
179
|
+
readonly name: "GUARANTEE_VERIFICATION_KEY";
|
|
180
|
+
readonly inputs: readonly [];
|
|
181
|
+
readonly outputs: readonly [{
|
|
182
|
+
readonly name: "x_a";
|
|
183
|
+
readonly type: "bytes32";
|
|
184
|
+
readonly internalType: "bytes32";
|
|
185
|
+
}, {
|
|
186
|
+
readonly name: "x_b";
|
|
187
|
+
readonly type: "bytes32";
|
|
188
|
+
readonly internalType: "bytes32";
|
|
189
|
+
}, {
|
|
190
|
+
readonly name: "y_a";
|
|
191
|
+
readonly type: "bytes32";
|
|
192
|
+
readonly internalType: "bytes32";
|
|
193
|
+
}, {
|
|
194
|
+
readonly name: "y_b";
|
|
195
|
+
readonly type: "bytes32";
|
|
196
|
+
readonly internalType: "bytes32";
|
|
197
|
+
}];
|
|
198
|
+
readonly stateMutability: "view";
|
|
199
|
+
}, {
|
|
200
|
+
readonly type: "function";
|
|
201
|
+
readonly name: "INITIAL_GUARANTEE_VERSION";
|
|
202
|
+
readonly inputs: readonly [];
|
|
203
|
+
readonly outputs: readonly [{
|
|
204
|
+
readonly name: "";
|
|
205
|
+
readonly type: "uint64";
|
|
206
|
+
readonly internalType: "uint64";
|
|
207
|
+
}];
|
|
208
|
+
readonly stateMutability: "view";
|
|
209
|
+
}, {
|
|
210
|
+
readonly type: "function";
|
|
211
|
+
readonly name: "MAX_YIELD_FEE_BPS";
|
|
212
|
+
readonly inputs: readonly [];
|
|
213
|
+
readonly outputs: readonly [{
|
|
214
|
+
readonly name: "";
|
|
215
|
+
readonly type: "uint256";
|
|
216
|
+
readonly internalType: "uint256";
|
|
217
|
+
}];
|
|
218
|
+
readonly stateMutability: "view";
|
|
219
|
+
}, {
|
|
220
|
+
readonly type: "function";
|
|
221
|
+
readonly name: "RECONCILIATION_DUST_TOLERANCE_SCALED";
|
|
222
|
+
readonly inputs: readonly [];
|
|
223
|
+
readonly outputs: readonly [{
|
|
224
|
+
readonly name: "";
|
|
225
|
+
readonly type: "uint256";
|
|
226
|
+
readonly internalType: "uint256";
|
|
227
|
+
}];
|
|
228
|
+
readonly stateMutability: "view";
|
|
229
|
+
}, {
|
|
230
|
+
readonly type: "function";
|
|
231
|
+
readonly name: "aaveAddressesProvider";
|
|
232
|
+
readonly inputs: readonly [];
|
|
233
|
+
readonly outputs: readonly [{
|
|
234
|
+
readonly name: "";
|
|
235
|
+
readonly type: "address";
|
|
236
|
+
readonly internalType: "contract IPoolAddressesProvider";
|
|
237
|
+
}];
|
|
238
|
+
readonly stateMutability: "view";
|
|
239
|
+
}, {
|
|
240
|
+
readonly type: "function";
|
|
241
|
+
readonly name: "authority";
|
|
242
|
+
readonly inputs: readonly [];
|
|
243
|
+
readonly outputs: readonly [{
|
|
244
|
+
readonly name: "";
|
|
245
|
+
readonly type: "address";
|
|
246
|
+
readonly internalType: "address";
|
|
247
|
+
}];
|
|
248
|
+
readonly stateMutability: "view";
|
|
249
|
+
}, {
|
|
250
|
+
readonly type: "function";
|
|
251
|
+
readonly name: "cancelWithdrawal";
|
|
252
|
+
readonly inputs: readonly [];
|
|
253
|
+
readonly outputs: readonly [];
|
|
254
|
+
readonly stateMutability: "nonpayable";
|
|
255
|
+
}, {
|
|
256
|
+
readonly type: "function";
|
|
257
|
+
readonly name: "cancelWithdrawal";
|
|
258
|
+
readonly inputs: readonly [{
|
|
259
|
+
readonly name: "asset";
|
|
260
|
+
readonly type: "address";
|
|
261
|
+
readonly internalType: "address";
|
|
262
|
+
}];
|
|
263
|
+
readonly outputs: readonly [];
|
|
264
|
+
readonly stateMutability: "nonpayable";
|
|
265
|
+
}, {
|
|
266
|
+
readonly type: "function";
|
|
267
|
+
readonly name: "claimProtocolYield";
|
|
268
|
+
readonly inputs: readonly [{
|
|
269
|
+
readonly name: "asset";
|
|
270
|
+
readonly type: "address";
|
|
271
|
+
readonly internalType: "address";
|
|
272
|
+
}, {
|
|
273
|
+
readonly name: "to";
|
|
274
|
+
readonly type: "address";
|
|
275
|
+
readonly internalType: "address";
|
|
276
|
+
}, {
|
|
277
|
+
readonly name: "amount";
|
|
278
|
+
readonly type: "uint256";
|
|
279
|
+
readonly internalType: "uint256";
|
|
280
|
+
}];
|
|
281
|
+
readonly outputs: readonly [];
|
|
282
|
+
readonly stateMutability: "nonpayable";
|
|
283
|
+
}, {
|
|
284
|
+
readonly type: "function";
|
|
285
|
+
readonly name: "claimSurplusATokens";
|
|
286
|
+
readonly inputs: readonly [{
|
|
287
|
+
readonly name: "asset";
|
|
288
|
+
readonly type: "address";
|
|
289
|
+
readonly internalType: "address";
|
|
290
|
+
}, {
|
|
291
|
+
readonly name: "to";
|
|
292
|
+
readonly type: "address";
|
|
293
|
+
readonly internalType: "address";
|
|
294
|
+
}, {
|
|
295
|
+
readonly name: "scaledAmount";
|
|
296
|
+
readonly type: "uint256";
|
|
297
|
+
readonly internalType: "uint256";
|
|
298
|
+
}];
|
|
299
|
+
readonly outputs: readonly [];
|
|
300
|
+
readonly stateMutability: "nonpayable";
|
|
301
|
+
}, {
|
|
302
|
+
readonly type: "function";
|
|
303
|
+
readonly name: "collateral";
|
|
304
|
+
readonly inputs: readonly [{
|
|
305
|
+
readonly name: "userAddr";
|
|
306
|
+
readonly type: "address";
|
|
307
|
+
readonly internalType: "address";
|
|
308
|
+
}];
|
|
309
|
+
readonly outputs: readonly [{
|
|
310
|
+
readonly name: "";
|
|
311
|
+
readonly type: "uint256";
|
|
312
|
+
readonly internalType: "uint256";
|
|
313
|
+
}];
|
|
314
|
+
readonly stateMutability: "view";
|
|
315
|
+
}, {
|
|
316
|
+
readonly type: "function";
|
|
317
|
+
readonly name: "collateral";
|
|
318
|
+
readonly inputs: readonly [{
|
|
319
|
+
readonly name: "userAddr";
|
|
320
|
+
readonly type: "address";
|
|
321
|
+
readonly internalType: "address";
|
|
322
|
+
}, {
|
|
323
|
+
readonly name: "asset";
|
|
324
|
+
readonly type: "address";
|
|
325
|
+
readonly internalType: "address";
|
|
326
|
+
}];
|
|
327
|
+
readonly outputs: readonly [{
|
|
328
|
+
readonly name: "";
|
|
329
|
+
readonly type: "uint256";
|
|
330
|
+
readonly internalType: "uint256";
|
|
331
|
+
}];
|
|
332
|
+
readonly stateMutability: "view";
|
|
333
|
+
}, {
|
|
334
|
+
readonly type: "function";
|
|
335
|
+
readonly name: "configureAave";
|
|
336
|
+
readonly inputs: readonly [{
|
|
337
|
+
readonly name: "poolAddressesProvider";
|
|
338
|
+
readonly type: "address";
|
|
339
|
+
readonly internalType: "address";
|
|
340
|
+
}, {
|
|
341
|
+
readonly name: "aTokens";
|
|
342
|
+
readonly type: "address[]";
|
|
343
|
+
readonly internalType: "address[]";
|
|
344
|
+
}];
|
|
345
|
+
readonly outputs: readonly [];
|
|
346
|
+
readonly stateMutability: "nonpayable";
|
|
347
|
+
}, {
|
|
348
|
+
readonly type: "function";
|
|
349
|
+
readonly name: "configureGuaranteeVersion";
|
|
350
|
+
readonly inputs: readonly [{
|
|
351
|
+
readonly name: "version";
|
|
352
|
+
readonly type: "uint64";
|
|
353
|
+
readonly internalType: "uint64";
|
|
354
|
+
}, {
|
|
355
|
+
readonly name: "verificationKey";
|
|
356
|
+
readonly type: "tuple";
|
|
357
|
+
readonly internalType: "struct BLS.G1Point";
|
|
358
|
+
readonly components: readonly [{
|
|
359
|
+
readonly name: "x_a";
|
|
360
|
+
readonly type: "bytes32";
|
|
361
|
+
readonly internalType: "bytes32";
|
|
362
|
+
}, {
|
|
363
|
+
readonly name: "x_b";
|
|
364
|
+
readonly type: "bytes32";
|
|
365
|
+
readonly internalType: "bytes32";
|
|
366
|
+
}, {
|
|
367
|
+
readonly name: "y_a";
|
|
368
|
+
readonly type: "bytes32";
|
|
369
|
+
readonly internalType: "bytes32";
|
|
370
|
+
}, {
|
|
371
|
+
readonly name: "y_b";
|
|
372
|
+
readonly type: "bytes32";
|
|
373
|
+
readonly internalType: "bytes32";
|
|
374
|
+
}];
|
|
375
|
+
}, {
|
|
376
|
+
readonly name: "domainSeparator";
|
|
377
|
+
readonly type: "bytes32";
|
|
378
|
+
readonly internalType: "bytes32";
|
|
379
|
+
}, {
|
|
380
|
+
readonly name: "decoder";
|
|
381
|
+
readonly type: "address";
|
|
382
|
+
readonly internalType: "address";
|
|
383
|
+
}, {
|
|
384
|
+
readonly name: "enabled";
|
|
385
|
+
readonly type: "bool";
|
|
386
|
+
readonly internalType: "bool";
|
|
387
|
+
}];
|
|
388
|
+
readonly outputs: readonly [];
|
|
389
|
+
readonly stateMutability: "nonpayable";
|
|
390
|
+
}, {
|
|
391
|
+
readonly type: "function";
|
|
392
|
+
readonly name: "contractScaledATokenBalance";
|
|
393
|
+
readonly inputs: readonly [{
|
|
394
|
+
readonly name: "asset";
|
|
395
|
+
readonly type: "address";
|
|
396
|
+
readonly internalType: "address";
|
|
397
|
+
}];
|
|
398
|
+
readonly outputs: readonly [{
|
|
399
|
+
readonly name: "";
|
|
400
|
+
readonly type: "uint256";
|
|
401
|
+
readonly internalType: "uint256";
|
|
402
|
+
}];
|
|
403
|
+
readonly stateMutability: "view";
|
|
404
|
+
}, {
|
|
405
|
+
readonly type: "function";
|
|
406
|
+
readonly name: "deposit";
|
|
407
|
+
readonly inputs: readonly [];
|
|
408
|
+
readonly outputs: readonly [];
|
|
409
|
+
readonly stateMutability: "payable";
|
|
410
|
+
}, {
|
|
411
|
+
readonly type: "function";
|
|
412
|
+
readonly name: "depositStablecoin";
|
|
413
|
+
readonly inputs: readonly [{
|
|
414
|
+
readonly name: "asset";
|
|
415
|
+
readonly type: "address";
|
|
416
|
+
readonly internalType: "address";
|
|
417
|
+
}, {
|
|
418
|
+
readonly name: "amount";
|
|
419
|
+
readonly type: "uint256";
|
|
420
|
+
readonly internalType: "uint256";
|
|
421
|
+
}];
|
|
422
|
+
readonly outputs: readonly [];
|
|
423
|
+
readonly stateMutability: "nonpayable";
|
|
424
|
+
}, {
|
|
425
|
+
readonly type: "function";
|
|
426
|
+
readonly name: "finalizeWithdrawal";
|
|
427
|
+
readonly inputs: readonly [{
|
|
428
|
+
readonly name: "asset";
|
|
429
|
+
readonly type: "address";
|
|
430
|
+
readonly internalType: "address";
|
|
431
|
+
}];
|
|
432
|
+
readonly outputs: readonly [];
|
|
433
|
+
readonly stateMutability: "nonpayable";
|
|
434
|
+
}, {
|
|
435
|
+
readonly type: "function";
|
|
436
|
+
readonly name: "finalizeWithdrawal";
|
|
437
|
+
readonly inputs: readonly [];
|
|
438
|
+
readonly outputs: readonly [];
|
|
439
|
+
readonly stateMutability: "nonpayable";
|
|
440
|
+
}, {
|
|
441
|
+
readonly type: "function";
|
|
442
|
+
readonly name: "getERC20Tokens";
|
|
443
|
+
readonly inputs: readonly [];
|
|
444
|
+
readonly outputs: readonly [{
|
|
445
|
+
readonly name: "";
|
|
446
|
+
readonly type: "address[]";
|
|
447
|
+
readonly internalType: "address[]";
|
|
448
|
+
}];
|
|
449
|
+
readonly stateMutability: "view";
|
|
450
|
+
}, {
|
|
451
|
+
readonly type: "function";
|
|
452
|
+
readonly name: "getGuaranteeVersionConfig";
|
|
453
|
+
readonly inputs: readonly [{
|
|
454
|
+
readonly name: "version";
|
|
455
|
+
readonly type: "uint64";
|
|
456
|
+
readonly internalType: "uint64";
|
|
457
|
+
}];
|
|
458
|
+
readonly outputs: readonly [{
|
|
459
|
+
readonly name: "verificationKey";
|
|
460
|
+
readonly type: "tuple";
|
|
461
|
+
readonly internalType: "struct BLS.G1Point";
|
|
462
|
+
readonly components: readonly [{
|
|
463
|
+
readonly name: "x_a";
|
|
464
|
+
readonly type: "bytes32";
|
|
465
|
+
readonly internalType: "bytes32";
|
|
466
|
+
}, {
|
|
467
|
+
readonly name: "x_b";
|
|
468
|
+
readonly type: "bytes32";
|
|
469
|
+
readonly internalType: "bytes32";
|
|
470
|
+
}, {
|
|
471
|
+
readonly name: "y_a";
|
|
472
|
+
readonly type: "bytes32";
|
|
473
|
+
readonly internalType: "bytes32";
|
|
474
|
+
}, {
|
|
475
|
+
readonly name: "y_b";
|
|
476
|
+
readonly type: "bytes32";
|
|
477
|
+
readonly internalType: "bytes32";
|
|
478
|
+
}];
|
|
479
|
+
}, {
|
|
480
|
+
readonly name: "domainSeparator";
|
|
481
|
+
readonly type: "bytes32";
|
|
482
|
+
readonly internalType: "bytes32";
|
|
483
|
+
}, {
|
|
484
|
+
readonly name: "decoder";
|
|
485
|
+
readonly type: "address";
|
|
486
|
+
readonly internalType: "address";
|
|
487
|
+
}, {
|
|
488
|
+
readonly name: "enabled";
|
|
489
|
+
readonly type: "bool";
|
|
490
|
+
readonly internalType: "bool";
|
|
491
|
+
}];
|
|
492
|
+
readonly stateMutability: "view";
|
|
493
|
+
}, {
|
|
494
|
+
readonly type: "function";
|
|
495
|
+
readonly name: "getPaymentStatus";
|
|
496
|
+
readonly inputs: readonly [{
|
|
497
|
+
readonly name: "tabId";
|
|
498
|
+
readonly type: "uint256";
|
|
499
|
+
readonly internalType: "uint256";
|
|
500
|
+
}];
|
|
501
|
+
readonly outputs: readonly [{
|
|
502
|
+
readonly name: "paid";
|
|
503
|
+
readonly type: "uint256";
|
|
504
|
+
readonly internalType: "uint256";
|
|
505
|
+
}, {
|
|
506
|
+
readonly name: "remunerated";
|
|
507
|
+
readonly type: "bool";
|
|
508
|
+
readonly internalType: "bool";
|
|
509
|
+
}, {
|
|
510
|
+
readonly name: "asset";
|
|
511
|
+
readonly type: "address";
|
|
512
|
+
readonly internalType: "address";
|
|
513
|
+
}];
|
|
514
|
+
readonly stateMutability: "view";
|
|
515
|
+
}, {
|
|
516
|
+
readonly type: "function";
|
|
517
|
+
readonly name: "getUser";
|
|
518
|
+
readonly inputs: readonly [{
|
|
519
|
+
readonly name: "userAddr";
|
|
520
|
+
readonly type: "address";
|
|
521
|
+
readonly internalType: "address";
|
|
522
|
+
}];
|
|
523
|
+
readonly outputs: readonly [{
|
|
524
|
+
readonly name: "assetCollateral";
|
|
525
|
+
readonly type: "uint256";
|
|
526
|
+
readonly internalType: "uint256";
|
|
527
|
+
}, {
|
|
528
|
+
readonly name: "withdrawalRequestTimestamp";
|
|
529
|
+
readonly type: "uint256";
|
|
530
|
+
readonly internalType: "uint256";
|
|
531
|
+
}, {
|
|
532
|
+
readonly name: "withdrawalRequestAmount";
|
|
533
|
+
readonly type: "uint256";
|
|
534
|
+
readonly internalType: "uint256";
|
|
535
|
+
}];
|
|
536
|
+
readonly stateMutability: "view";
|
|
537
|
+
}, {
|
|
538
|
+
readonly type: "function";
|
|
539
|
+
readonly name: "getUser";
|
|
540
|
+
readonly inputs: readonly [{
|
|
541
|
+
readonly name: "userAddr";
|
|
542
|
+
readonly type: "address";
|
|
543
|
+
readonly internalType: "address";
|
|
544
|
+
}, {
|
|
545
|
+
readonly name: "asset";
|
|
546
|
+
readonly type: "address";
|
|
547
|
+
readonly internalType: "address";
|
|
548
|
+
}];
|
|
549
|
+
readonly outputs: readonly [{
|
|
550
|
+
readonly name: "assetCollateral";
|
|
551
|
+
readonly type: "uint256";
|
|
552
|
+
readonly internalType: "uint256";
|
|
553
|
+
}, {
|
|
554
|
+
readonly name: "withdrawalRequestTimestamp";
|
|
555
|
+
readonly type: "uint256";
|
|
556
|
+
readonly internalType: "uint256";
|
|
557
|
+
}, {
|
|
558
|
+
readonly name: "withdrawalRequestAmount";
|
|
559
|
+
readonly type: "uint256";
|
|
560
|
+
readonly internalType: "uint256";
|
|
561
|
+
}];
|
|
562
|
+
readonly stateMutability: "view";
|
|
563
|
+
}, {
|
|
564
|
+
readonly type: "function";
|
|
565
|
+
readonly name: "getUserAllAssets";
|
|
566
|
+
readonly inputs: readonly [{
|
|
567
|
+
readonly name: "userAddr";
|
|
568
|
+
readonly type: "address";
|
|
569
|
+
readonly internalType: "address";
|
|
570
|
+
}];
|
|
571
|
+
readonly outputs: readonly [{
|
|
572
|
+
readonly name: "";
|
|
573
|
+
readonly type: "tuple[]";
|
|
574
|
+
readonly internalType: "struct Core4Mica.UserAssetInfo[]";
|
|
575
|
+
readonly components: readonly [{
|
|
576
|
+
readonly name: "asset";
|
|
577
|
+
readonly type: "address";
|
|
578
|
+
readonly internalType: "address";
|
|
579
|
+
}, {
|
|
580
|
+
readonly name: "collateral";
|
|
581
|
+
readonly type: "uint256";
|
|
582
|
+
readonly internalType: "uint256";
|
|
583
|
+
}, {
|
|
584
|
+
readonly name: "withdrawalRequestTimestamp";
|
|
585
|
+
readonly type: "uint256";
|
|
586
|
+
readonly internalType: "uint256";
|
|
587
|
+
}, {
|
|
588
|
+
readonly name: "withdrawalRequestAmount";
|
|
589
|
+
readonly type: "uint256";
|
|
590
|
+
readonly internalType: "uint256";
|
|
591
|
+
}];
|
|
592
|
+
}];
|
|
593
|
+
readonly stateMutability: "view";
|
|
594
|
+
}, {
|
|
595
|
+
readonly type: "function";
|
|
596
|
+
readonly name: "grossYield";
|
|
597
|
+
readonly inputs: readonly [{
|
|
598
|
+
readonly name: "user";
|
|
599
|
+
readonly type: "address";
|
|
600
|
+
readonly internalType: "address";
|
|
601
|
+
}, {
|
|
602
|
+
readonly name: "asset";
|
|
603
|
+
readonly type: "address";
|
|
604
|
+
readonly internalType: "address";
|
|
605
|
+
}];
|
|
606
|
+
readonly outputs: readonly [{
|
|
607
|
+
readonly name: "";
|
|
608
|
+
readonly type: "uint256";
|
|
609
|
+
readonly internalType: "uint256";
|
|
610
|
+
}];
|
|
611
|
+
readonly stateMutability: "view";
|
|
612
|
+
}, {
|
|
613
|
+
readonly type: "function";
|
|
614
|
+
readonly name: "guaranteeCapacity";
|
|
615
|
+
readonly inputs: readonly [{
|
|
616
|
+
readonly name: "user";
|
|
617
|
+
readonly type: "address";
|
|
618
|
+
readonly internalType: "address";
|
|
619
|
+
}, {
|
|
620
|
+
readonly name: "asset";
|
|
621
|
+
readonly type: "address";
|
|
622
|
+
readonly internalType: "address";
|
|
623
|
+
}];
|
|
624
|
+
readonly outputs: readonly [{
|
|
625
|
+
readonly name: "";
|
|
626
|
+
readonly type: "uint256";
|
|
627
|
+
readonly internalType: "uint256";
|
|
628
|
+
}];
|
|
629
|
+
readonly stateMutability: "view";
|
|
630
|
+
}, {
|
|
631
|
+
readonly type: "function";
|
|
632
|
+
readonly name: "guaranteeDomainSeparator";
|
|
633
|
+
readonly inputs: readonly [];
|
|
634
|
+
readonly outputs: readonly [{
|
|
635
|
+
readonly name: "";
|
|
636
|
+
readonly type: "bytes32";
|
|
637
|
+
readonly internalType: "bytes32";
|
|
638
|
+
}];
|
|
639
|
+
readonly stateMutability: "view";
|
|
640
|
+
}, {
|
|
641
|
+
readonly type: "function";
|
|
642
|
+
readonly name: "isConsumingScheduledOp";
|
|
643
|
+
readonly inputs: readonly [];
|
|
644
|
+
readonly outputs: readonly [{
|
|
645
|
+
readonly name: "";
|
|
646
|
+
readonly type: "bytes4";
|
|
647
|
+
readonly internalType: "bytes4";
|
|
648
|
+
}];
|
|
649
|
+
readonly stateMutability: "view";
|
|
650
|
+
}, {
|
|
651
|
+
readonly type: "function";
|
|
652
|
+
readonly name: "pause";
|
|
653
|
+
readonly inputs: readonly [];
|
|
654
|
+
readonly outputs: readonly [];
|
|
655
|
+
readonly stateMutability: "nonpayable";
|
|
656
|
+
}, {
|
|
657
|
+
readonly type: "function";
|
|
658
|
+
readonly name: "paused";
|
|
659
|
+
readonly inputs: readonly [];
|
|
660
|
+
readonly outputs: readonly [{
|
|
661
|
+
readonly name: "";
|
|
662
|
+
readonly type: "bool";
|
|
663
|
+
readonly internalType: "bool";
|
|
664
|
+
}];
|
|
665
|
+
readonly stateMutability: "view";
|
|
666
|
+
}, {
|
|
667
|
+
readonly type: "function";
|
|
668
|
+
readonly name: "payTabInERC20Token";
|
|
669
|
+
readonly inputs: readonly [{
|
|
670
|
+
readonly name: "tabId";
|
|
671
|
+
readonly type: "uint256";
|
|
672
|
+
readonly internalType: "uint256";
|
|
673
|
+
}, {
|
|
674
|
+
readonly name: "asset";
|
|
675
|
+
readonly type: "address";
|
|
676
|
+
readonly internalType: "address";
|
|
677
|
+
}, {
|
|
678
|
+
readonly name: "amount";
|
|
679
|
+
readonly type: "uint256";
|
|
680
|
+
readonly internalType: "uint256";
|
|
681
|
+
}, {
|
|
682
|
+
readonly name: "recipient";
|
|
683
|
+
readonly type: "address";
|
|
684
|
+
readonly internalType: "address";
|
|
685
|
+
}];
|
|
686
|
+
readonly outputs: readonly [];
|
|
687
|
+
readonly stateMutability: "nonpayable";
|
|
688
|
+
}, {
|
|
689
|
+
readonly type: "function";
|
|
690
|
+
readonly name: "payments";
|
|
691
|
+
readonly inputs: readonly [{
|
|
692
|
+
readonly name: "";
|
|
693
|
+
readonly type: "uint256";
|
|
694
|
+
readonly internalType: "uint256";
|
|
695
|
+
}];
|
|
696
|
+
readonly outputs: readonly [{
|
|
697
|
+
readonly name: "paid";
|
|
698
|
+
readonly type: "uint256";
|
|
699
|
+
readonly internalType: "uint256";
|
|
700
|
+
}, {
|
|
701
|
+
readonly name: "remunerated";
|
|
702
|
+
readonly type: "bool";
|
|
703
|
+
readonly internalType: "bool";
|
|
704
|
+
}, {
|
|
705
|
+
readonly name: "asset";
|
|
706
|
+
readonly type: "address";
|
|
707
|
+
readonly internalType: "address";
|
|
708
|
+
}];
|
|
709
|
+
readonly stateMutability: "view";
|
|
710
|
+
}, {
|
|
711
|
+
readonly type: "function";
|
|
712
|
+
readonly name: "principalBalance";
|
|
713
|
+
readonly inputs: readonly [{
|
|
714
|
+
readonly name: "user";
|
|
715
|
+
readonly type: "address";
|
|
716
|
+
readonly internalType: "address";
|
|
717
|
+
}, {
|
|
718
|
+
readonly name: "asset";
|
|
719
|
+
readonly type: "address";
|
|
720
|
+
readonly internalType: "address";
|
|
721
|
+
}];
|
|
722
|
+
readonly outputs: readonly [{
|
|
723
|
+
readonly name: "";
|
|
724
|
+
readonly type: "uint256";
|
|
725
|
+
readonly internalType: "uint256";
|
|
726
|
+
}];
|
|
727
|
+
readonly stateMutability: "view";
|
|
728
|
+
}, {
|
|
729
|
+
readonly type: "function";
|
|
730
|
+
readonly name: "protocolScaledBalance";
|
|
731
|
+
readonly inputs: readonly [{
|
|
732
|
+
readonly name: "asset";
|
|
733
|
+
readonly type: "address";
|
|
734
|
+
readonly internalType: "address";
|
|
735
|
+
}];
|
|
736
|
+
readonly outputs: readonly [{
|
|
737
|
+
readonly name: "";
|
|
738
|
+
readonly type: "uint256";
|
|
739
|
+
readonly internalType: "uint256";
|
|
740
|
+
}];
|
|
741
|
+
readonly stateMutability: "view";
|
|
742
|
+
}, {
|
|
743
|
+
readonly type: "function";
|
|
744
|
+
readonly name: "protocolYieldShare";
|
|
745
|
+
readonly inputs: readonly [{
|
|
746
|
+
readonly name: "user";
|
|
747
|
+
readonly type: "address";
|
|
748
|
+
readonly internalType: "address";
|
|
749
|
+
}, {
|
|
750
|
+
readonly name: "asset";
|
|
751
|
+
readonly type: "address";
|
|
752
|
+
readonly internalType: "address";
|
|
753
|
+
}];
|
|
754
|
+
readonly outputs: readonly [{
|
|
755
|
+
readonly name: "";
|
|
756
|
+
readonly type: "uint256";
|
|
757
|
+
readonly internalType: "uint256";
|
|
758
|
+
}];
|
|
759
|
+
readonly stateMutability: "view";
|
|
760
|
+
}, {
|
|
761
|
+
readonly type: "function";
|
|
762
|
+
readonly name: "reconciliationDustToleranceScaled";
|
|
763
|
+
readonly inputs: readonly [];
|
|
764
|
+
readonly outputs: readonly [{
|
|
765
|
+
readonly name: "";
|
|
766
|
+
readonly type: "uint256";
|
|
767
|
+
readonly internalType: "uint256";
|
|
768
|
+
}];
|
|
769
|
+
readonly stateMutability: "pure";
|
|
770
|
+
}, {
|
|
771
|
+
readonly type: "function";
|
|
772
|
+
readonly name: "recordPayment";
|
|
773
|
+
readonly inputs: readonly [{
|
|
774
|
+
readonly name: "tabId";
|
|
775
|
+
readonly type: "uint256";
|
|
776
|
+
readonly internalType: "uint256";
|
|
777
|
+
}, {
|
|
778
|
+
readonly name: "asset";
|
|
779
|
+
readonly type: "address";
|
|
780
|
+
readonly internalType: "address";
|
|
781
|
+
}, {
|
|
782
|
+
readonly name: "amount";
|
|
783
|
+
readonly type: "uint256";
|
|
784
|
+
readonly internalType: "uint256";
|
|
785
|
+
}];
|
|
786
|
+
readonly outputs: readonly [];
|
|
787
|
+
readonly stateMutability: "nonpayable";
|
|
788
|
+
}, {
|
|
789
|
+
readonly type: "function";
|
|
790
|
+
readonly name: "remunerate";
|
|
791
|
+
readonly inputs: readonly [{
|
|
792
|
+
readonly name: "guaranteeData";
|
|
793
|
+
readonly type: "bytes";
|
|
794
|
+
readonly internalType: "bytes";
|
|
795
|
+
}, {
|
|
796
|
+
readonly name: "signature";
|
|
797
|
+
readonly type: "tuple";
|
|
798
|
+
readonly internalType: "struct BLS.G2Point";
|
|
799
|
+
readonly components: readonly [{
|
|
800
|
+
readonly name: "x_c0_a";
|
|
801
|
+
readonly type: "bytes32";
|
|
802
|
+
readonly internalType: "bytes32";
|
|
803
|
+
}, {
|
|
804
|
+
readonly name: "x_c0_b";
|
|
805
|
+
readonly type: "bytes32";
|
|
806
|
+
readonly internalType: "bytes32";
|
|
807
|
+
}, {
|
|
808
|
+
readonly name: "x_c1_a";
|
|
809
|
+
readonly type: "bytes32";
|
|
810
|
+
readonly internalType: "bytes32";
|
|
811
|
+
}, {
|
|
812
|
+
readonly name: "x_c1_b";
|
|
813
|
+
readonly type: "bytes32";
|
|
814
|
+
readonly internalType: "bytes32";
|
|
815
|
+
}, {
|
|
816
|
+
readonly name: "y_c0_a";
|
|
817
|
+
readonly type: "bytes32";
|
|
818
|
+
readonly internalType: "bytes32";
|
|
819
|
+
}, {
|
|
820
|
+
readonly name: "y_c0_b";
|
|
821
|
+
readonly type: "bytes32";
|
|
822
|
+
readonly internalType: "bytes32";
|
|
823
|
+
}, {
|
|
824
|
+
readonly name: "y_c1_a";
|
|
825
|
+
readonly type: "bytes32";
|
|
826
|
+
readonly internalType: "bytes32";
|
|
827
|
+
}, {
|
|
828
|
+
readonly name: "y_c1_b";
|
|
829
|
+
readonly type: "bytes32";
|
|
830
|
+
readonly internalType: "bytes32";
|
|
831
|
+
}];
|
|
832
|
+
}];
|
|
833
|
+
readonly outputs: readonly [];
|
|
834
|
+
readonly stateMutability: "nonpayable";
|
|
835
|
+
}, {
|
|
836
|
+
readonly type: "function";
|
|
837
|
+
readonly name: "remunerationGracePeriod";
|
|
838
|
+
readonly inputs: readonly [];
|
|
839
|
+
readonly outputs: readonly [{
|
|
840
|
+
readonly name: "";
|
|
841
|
+
readonly type: "uint256";
|
|
842
|
+
readonly internalType: "uint256";
|
|
843
|
+
}];
|
|
844
|
+
readonly stateMutability: "view";
|
|
845
|
+
}, {
|
|
846
|
+
readonly type: "function";
|
|
847
|
+
readonly name: "requestWithdrawal";
|
|
848
|
+
readonly inputs: readonly [{
|
|
849
|
+
readonly name: "amount";
|
|
850
|
+
readonly type: "uint256";
|
|
851
|
+
readonly internalType: "uint256";
|
|
852
|
+
}];
|
|
853
|
+
readonly outputs: readonly [];
|
|
854
|
+
readonly stateMutability: "nonpayable";
|
|
855
|
+
}, {
|
|
856
|
+
readonly type: "function";
|
|
857
|
+
readonly name: "requestWithdrawal";
|
|
858
|
+
readonly inputs: readonly [{
|
|
859
|
+
readonly name: "asset";
|
|
860
|
+
readonly type: "address";
|
|
861
|
+
readonly internalType: "address";
|
|
862
|
+
}, {
|
|
863
|
+
readonly name: "amount";
|
|
864
|
+
readonly type: "uint256";
|
|
865
|
+
readonly internalType: "uint256";
|
|
866
|
+
}];
|
|
867
|
+
readonly outputs: readonly [];
|
|
868
|
+
readonly stateMutability: "nonpayable";
|
|
869
|
+
}, {
|
|
870
|
+
readonly type: "function";
|
|
871
|
+
readonly name: "setAuthority";
|
|
872
|
+
readonly inputs: readonly [{
|
|
873
|
+
readonly name: "newAuthority";
|
|
874
|
+
readonly type: "address";
|
|
875
|
+
readonly internalType: "address";
|
|
876
|
+
}];
|
|
877
|
+
readonly outputs: readonly [];
|
|
878
|
+
readonly stateMutability: "nonpayable";
|
|
879
|
+
}, {
|
|
880
|
+
readonly type: "function";
|
|
881
|
+
readonly name: "setGuaranteeVerificationKey";
|
|
882
|
+
readonly inputs: readonly [{
|
|
883
|
+
readonly name: "verificationKey";
|
|
884
|
+
readonly type: "tuple";
|
|
885
|
+
readonly internalType: "struct BLS.G1Point";
|
|
886
|
+
readonly components: readonly [{
|
|
887
|
+
readonly name: "x_a";
|
|
888
|
+
readonly type: "bytes32";
|
|
889
|
+
readonly internalType: "bytes32";
|
|
890
|
+
}, {
|
|
891
|
+
readonly name: "x_b";
|
|
892
|
+
readonly type: "bytes32";
|
|
893
|
+
readonly internalType: "bytes32";
|
|
894
|
+
}, {
|
|
895
|
+
readonly name: "y_a";
|
|
896
|
+
readonly type: "bytes32";
|
|
897
|
+
readonly internalType: "bytes32";
|
|
898
|
+
}, {
|
|
899
|
+
readonly name: "y_b";
|
|
900
|
+
readonly type: "bytes32";
|
|
901
|
+
readonly internalType: "bytes32";
|
|
902
|
+
}];
|
|
903
|
+
}];
|
|
904
|
+
readonly outputs: readonly [];
|
|
905
|
+
readonly stateMutability: "nonpayable";
|
|
906
|
+
}, {
|
|
907
|
+
readonly type: "function";
|
|
908
|
+
readonly name: "setRemunerationGracePeriod";
|
|
909
|
+
readonly inputs: readonly [{
|
|
910
|
+
readonly name: "_gracePeriod";
|
|
911
|
+
readonly type: "uint256";
|
|
912
|
+
readonly internalType: "uint256";
|
|
913
|
+
}];
|
|
914
|
+
readonly outputs: readonly [];
|
|
915
|
+
readonly stateMutability: "nonpayable";
|
|
916
|
+
}, {
|
|
917
|
+
readonly type: "function";
|
|
918
|
+
readonly name: "setSynchronizationDelay";
|
|
919
|
+
readonly inputs: readonly [{
|
|
920
|
+
readonly name: "_synchronizationDelay";
|
|
921
|
+
readonly type: "uint256";
|
|
922
|
+
readonly internalType: "uint256";
|
|
923
|
+
}];
|
|
924
|
+
readonly outputs: readonly [];
|
|
925
|
+
readonly stateMutability: "nonpayable";
|
|
926
|
+
}, {
|
|
927
|
+
readonly type: "function";
|
|
928
|
+
readonly name: "setTabExpirationTime";
|
|
929
|
+
readonly inputs: readonly [{
|
|
930
|
+
readonly name: "_expirationTime";
|
|
931
|
+
readonly type: "uint256";
|
|
932
|
+
readonly internalType: "uint256";
|
|
933
|
+
}];
|
|
934
|
+
readonly outputs: readonly [];
|
|
935
|
+
readonly stateMutability: "nonpayable";
|
|
936
|
+
}, {
|
|
937
|
+
readonly type: "function";
|
|
938
|
+
readonly name: "setTimingParameters";
|
|
939
|
+
readonly inputs: readonly [{
|
|
940
|
+
readonly name: "_remunerationGracePeriod";
|
|
941
|
+
readonly type: "uint256";
|
|
942
|
+
readonly internalType: "uint256";
|
|
943
|
+
}, {
|
|
944
|
+
readonly name: "_tabExpirationTime";
|
|
945
|
+
readonly type: "uint256";
|
|
946
|
+
readonly internalType: "uint256";
|
|
947
|
+
}, {
|
|
948
|
+
readonly name: "_synchronizationDelay";
|
|
949
|
+
readonly type: "uint256";
|
|
950
|
+
readonly internalType: "uint256";
|
|
951
|
+
}, {
|
|
952
|
+
readonly name: "_withdrawalGracePeriod";
|
|
953
|
+
readonly type: "uint256";
|
|
954
|
+
readonly internalType: "uint256";
|
|
955
|
+
}];
|
|
956
|
+
readonly outputs: readonly [];
|
|
957
|
+
readonly stateMutability: "nonpayable";
|
|
958
|
+
}, {
|
|
959
|
+
readonly type: "function";
|
|
960
|
+
readonly name: "setWithdrawalGracePeriod";
|
|
961
|
+
readonly inputs: readonly [{
|
|
962
|
+
readonly name: "_gracePeriod";
|
|
963
|
+
readonly type: "uint256";
|
|
964
|
+
readonly internalType: "uint256";
|
|
965
|
+
}];
|
|
966
|
+
readonly outputs: readonly [];
|
|
967
|
+
readonly stateMutability: "nonpayable";
|
|
968
|
+
}, {
|
|
969
|
+
readonly type: "function";
|
|
970
|
+
readonly name: "setYieldFeeBps";
|
|
971
|
+
readonly inputs: readonly [{
|
|
972
|
+
readonly name: "feeBps";
|
|
973
|
+
readonly type: "uint256";
|
|
974
|
+
readonly internalType: "uint256";
|
|
975
|
+
}];
|
|
976
|
+
readonly outputs: readonly [];
|
|
977
|
+
readonly stateMutability: "nonpayable";
|
|
978
|
+
}, {
|
|
979
|
+
readonly type: "function";
|
|
980
|
+
readonly name: "stablecoinAToken";
|
|
981
|
+
readonly inputs: readonly [{
|
|
982
|
+
readonly name: "asset";
|
|
983
|
+
readonly type: "address";
|
|
984
|
+
readonly internalType: "address";
|
|
985
|
+
}];
|
|
986
|
+
readonly outputs: readonly [{
|
|
987
|
+
readonly name: "";
|
|
988
|
+
readonly type: "address";
|
|
989
|
+
readonly internalType: "address";
|
|
990
|
+
}];
|
|
991
|
+
readonly stateMutability: "view";
|
|
992
|
+
}, {
|
|
993
|
+
readonly type: "function";
|
|
994
|
+
readonly name: "surplusScaledBalance";
|
|
995
|
+
readonly inputs: readonly [{
|
|
996
|
+
readonly name: "asset";
|
|
997
|
+
readonly type: "address";
|
|
998
|
+
readonly internalType: "address";
|
|
999
|
+
}];
|
|
1000
|
+
readonly outputs: readonly [{
|
|
1001
|
+
readonly name: "";
|
|
1002
|
+
readonly type: "uint256";
|
|
1003
|
+
readonly internalType: "uint256";
|
|
1004
|
+
}];
|
|
1005
|
+
readonly stateMutability: "view";
|
|
1006
|
+
}, {
|
|
1007
|
+
readonly type: "function";
|
|
1008
|
+
readonly name: "synchronizationDelay";
|
|
1009
|
+
readonly inputs: readonly [];
|
|
1010
|
+
readonly outputs: readonly [{
|
|
1011
|
+
readonly name: "";
|
|
1012
|
+
readonly type: "uint256";
|
|
1013
|
+
readonly internalType: "uint256";
|
|
1014
|
+
}];
|
|
1015
|
+
readonly stateMutability: "view";
|
|
1016
|
+
}, {
|
|
1017
|
+
readonly type: "function";
|
|
1018
|
+
readonly name: "tabExpirationTime";
|
|
1019
|
+
readonly inputs: readonly [];
|
|
1020
|
+
readonly outputs: readonly [{
|
|
1021
|
+
readonly name: "";
|
|
1022
|
+
readonly type: "uint256";
|
|
1023
|
+
readonly internalType: "uint256";
|
|
1024
|
+
}];
|
|
1025
|
+
readonly stateMutability: "view";
|
|
1026
|
+
}, {
|
|
1027
|
+
readonly type: "function";
|
|
1028
|
+
readonly name: "totalUserScaledBalance";
|
|
1029
|
+
readonly inputs: readonly [{
|
|
1030
|
+
readonly name: "asset";
|
|
1031
|
+
readonly type: "address";
|
|
1032
|
+
readonly internalType: "address";
|
|
1033
|
+
}];
|
|
1034
|
+
readonly outputs: readonly [{
|
|
1035
|
+
readonly name: "";
|
|
1036
|
+
readonly type: "uint256";
|
|
1037
|
+
readonly internalType: "uint256";
|
|
1038
|
+
}];
|
|
1039
|
+
readonly stateMutability: "view";
|
|
1040
|
+
}, {
|
|
1041
|
+
readonly type: "function";
|
|
1042
|
+
readonly name: "unpause";
|
|
1043
|
+
readonly inputs: readonly [];
|
|
1044
|
+
readonly outputs: readonly [];
|
|
1045
|
+
readonly stateMutability: "nonpayable";
|
|
1046
|
+
}, {
|
|
1047
|
+
readonly type: "function";
|
|
1048
|
+
readonly name: "userNetYield";
|
|
1049
|
+
readonly inputs: readonly [{
|
|
1050
|
+
readonly name: "user";
|
|
1051
|
+
readonly type: "address";
|
|
1052
|
+
readonly internalType: "address";
|
|
1053
|
+
}, {
|
|
1054
|
+
readonly name: "asset";
|
|
1055
|
+
readonly type: "address";
|
|
1056
|
+
readonly internalType: "address";
|
|
1057
|
+
}];
|
|
1058
|
+
readonly outputs: readonly [{
|
|
1059
|
+
readonly name: "";
|
|
1060
|
+
readonly type: "uint256";
|
|
1061
|
+
readonly internalType: "uint256";
|
|
1062
|
+
}];
|
|
1063
|
+
readonly stateMutability: "view";
|
|
1064
|
+
}, {
|
|
1065
|
+
readonly type: "function";
|
|
1066
|
+
readonly name: "verifyAndDecodeGuarantee";
|
|
1067
|
+
readonly inputs: readonly [{
|
|
1068
|
+
readonly name: "guarantee";
|
|
1069
|
+
readonly type: "bytes";
|
|
1070
|
+
readonly internalType: "bytes";
|
|
1071
|
+
}, {
|
|
1072
|
+
readonly name: "signature";
|
|
1073
|
+
readonly type: "tuple";
|
|
1074
|
+
readonly internalType: "struct BLS.G2Point";
|
|
1075
|
+
readonly components: readonly [{
|
|
1076
|
+
readonly name: "x_c0_a";
|
|
1077
|
+
readonly type: "bytes32";
|
|
1078
|
+
readonly internalType: "bytes32";
|
|
1079
|
+
}, {
|
|
1080
|
+
readonly name: "x_c0_b";
|
|
1081
|
+
readonly type: "bytes32";
|
|
1082
|
+
readonly internalType: "bytes32";
|
|
1083
|
+
}, {
|
|
1084
|
+
readonly name: "x_c1_a";
|
|
1085
|
+
readonly type: "bytes32";
|
|
1086
|
+
readonly internalType: "bytes32";
|
|
1087
|
+
}, {
|
|
1088
|
+
readonly name: "x_c1_b";
|
|
1089
|
+
readonly type: "bytes32";
|
|
1090
|
+
readonly internalType: "bytes32";
|
|
1091
|
+
}, {
|
|
1092
|
+
readonly name: "y_c0_a";
|
|
1093
|
+
readonly type: "bytes32";
|
|
1094
|
+
readonly internalType: "bytes32";
|
|
1095
|
+
}, {
|
|
1096
|
+
readonly name: "y_c0_b";
|
|
1097
|
+
readonly type: "bytes32";
|
|
1098
|
+
readonly internalType: "bytes32";
|
|
1099
|
+
}, {
|
|
1100
|
+
readonly name: "y_c1_a";
|
|
1101
|
+
readonly type: "bytes32";
|
|
1102
|
+
readonly internalType: "bytes32";
|
|
1103
|
+
}, {
|
|
1104
|
+
readonly name: "y_c1_b";
|
|
1105
|
+
readonly type: "bytes32";
|
|
1106
|
+
readonly internalType: "bytes32";
|
|
1107
|
+
}];
|
|
1108
|
+
}];
|
|
1109
|
+
readonly outputs: readonly [{
|
|
1110
|
+
readonly name: "";
|
|
1111
|
+
readonly type: "tuple";
|
|
1112
|
+
readonly internalType: "struct Guarantee";
|
|
1113
|
+
readonly components: readonly [{
|
|
1114
|
+
readonly name: "domain";
|
|
1115
|
+
readonly type: "bytes32";
|
|
1116
|
+
readonly internalType: "bytes32";
|
|
1117
|
+
}, {
|
|
1118
|
+
readonly name: "tabId";
|
|
1119
|
+
readonly type: "uint256";
|
|
1120
|
+
readonly internalType: "uint256";
|
|
1121
|
+
}, {
|
|
1122
|
+
readonly name: "reqId";
|
|
1123
|
+
readonly type: "uint256";
|
|
1124
|
+
readonly internalType: "uint256";
|
|
1125
|
+
}, {
|
|
1126
|
+
readonly name: "client";
|
|
1127
|
+
readonly type: "address";
|
|
1128
|
+
readonly internalType: "address";
|
|
1129
|
+
}, {
|
|
1130
|
+
readonly name: "recipient";
|
|
1131
|
+
readonly type: "address";
|
|
1132
|
+
readonly internalType: "address";
|
|
1133
|
+
}, {
|
|
1134
|
+
readonly name: "amount";
|
|
1135
|
+
readonly type: "uint256";
|
|
1136
|
+
readonly internalType: "uint256";
|
|
1137
|
+
}, {
|
|
1138
|
+
readonly name: "totalAmount";
|
|
1139
|
+
readonly type: "uint256";
|
|
1140
|
+
readonly internalType: "uint256";
|
|
1141
|
+
}, {
|
|
1142
|
+
readonly name: "asset";
|
|
1143
|
+
readonly type: "address";
|
|
1144
|
+
readonly internalType: "address";
|
|
1145
|
+
}, {
|
|
1146
|
+
readonly name: "timestamp";
|
|
1147
|
+
readonly type: "uint64";
|
|
1148
|
+
readonly internalType: "uint64";
|
|
1149
|
+
}, {
|
|
1150
|
+
readonly name: "version";
|
|
1151
|
+
readonly type: "uint64";
|
|
1152
|
+
readonly internalType: "uint64";
|
|
1153
|
+
}];
|
|
1154
|
+
}];
|
|
1155
|
+
readonly stateMutability: "view";
|
|
1156
|
+
}, {
|
|
1157
|
+
readonly type: "function";
|
|
1158
|
+
readonly name: "withdrawableBalance";
|
|
1159
|
+
readonly inputs: readonly [{
|
|
1160
|
+
readonly name: "user";
|
|
1161
|
+
readonly type: "address";
|
|
1162
|
+
readonly internalType: "address";
|
|
1163
|
+
}, {
|
|
1164
|
+
readonly name: "asset";
|
|
1165
|
+
readonly type: "address";
|
|
1166
|
+
readonly internalType: "address";
|
|
1167
|
+
}];
|
|
1168
|
+
readonly outputs: readonly [{
|
|
1169
|
+
readonly name: "";
|
|
1170
|
+
readonly type: "uint256";
|
|
1171
|
+
readonly internalType: "uint256";
|
|
1172
|
+
}];
|
|
1173
|
+
readonly stateMutability: "view";
|
|
1174
|
+
}, {
|
|
1175
|
+
readonly type: "function";
|
|
1176
|
+
readonly name: "withdrawalGracePeriod";
|
|
1177
|
+
readonly inputs: readonly [];
|
|
1178
|
+
readonly outputs: readonly [{
|
|
1179
|
+
readonly name: "";
|
|
1180
|
+
readonly type: "uint256";
|
|
1181
|
+
readonly internalType: "uint256";
|
|
1182
|
+
}];
|
|
1183
|
+
readonly stateMutability: "view";
|
|
1184
|
+
}, {
|
|
1185
|
+
readonly type: "function";
|
|
1186
|
+
readonly name: "withdrawalRequests";
|
|
1187
|
+
readonly inputs: readonly [{
|
|
1188
|
+
readonly name: "";
|
|
1189
|
+
readonly type: "address";
|
|
1190
|
+
readonly internalType: "address";
|
|
1191
|
+
}, {
|
|
1192
|
+
readonly name: "";
|
|
1193
|
+
readonly type: "address";
|
|
1194
|
+
readonly internalType: "address";
|
|
1195
|
+
}];
|
|
1196
|
+
readonly outputs: readonly [{
|
|
1197
|
+
readonly name: "timestamp";
|
|
1198
|
+
readonly type: "uint256";
|
|
1199
|
+
readonly internalType: "uint256";
|
|
1200
|
+
}, {
|
|
1201
|
+
readonly name: "amount";
|
|
1202
|
+
readonly type: "uint256";
|
|
1203
|
+
readonly internalType: "uint256";
|
|
1204
|
+
}];
|
|
1205
|
+
readonly stateMutability: "view";
|
|
1206
|
+
}, {
|
|
1207
|
+
readonly type: "function";
|
|
1208
|
+
readonly name: "yieldFeeBps";
|
|
1209
|
+
readonly inputs: readonly [];
|
|
1210
|
+
readonly outputs: readonly [{
|
|
1211
|
+
readonly name: "";
|
|
1212
|
+
readonly type: "uint256";
|
|
1213
|
+
readonly internalType: "uint256";
|
|
1214
|
+
}];
|
|
1215
|
+
readonly stateMutability: "view";
|
|
1216
|
+
}, {
|
|
1217
|
+
readonly type: "event";
|
|
1218
|
+
readonly name: "AaveConfigured";
|
|
1219
|
+
readonly inputs: readonly [{
|
|
1220
|
+
readonly name: "provider";
|
|
1221
|
+
readonly type: "address";
|
|
1222
|
+
readonly indexed: true;
|
|
1223
|
+
readonly internalType: "address";
|
|
1224
|
+
}, {
|
|
1225
|
+
readonly name: "pool";
|
|
1226
|
+
readonly type: "address";
|
|
1227
|
+
readonly indexed: true;
|
|
1228
|
+
readonly internalType: "address";
|
|
1229
|
+
}];
|
|
1230
|
+
readonly anonymous: false;
|
|
1231
|
+
}, {
|
|
1232
|
+
readonly type: "event";
|
|
1233
|
+
readonly name: "AuthorityUpdated";
|
|
1234
|
+
readonly inputs: readonly [{
|
|
1235
|
+
readonly name: "authority";
|
|
1236
|
+
readonly type: "address";
|
|
1237
|
+
readonly indexed: false;
|
|
1238
|
+
readonly internalType: "address";
|
|
1239
|
+
}];
|
|
1240
|
+
readonly anonymous: false;
|
|
1241
|
+
}, {
|
|
1242
|
+
readonly type: "event";
|
|
1243
|
+
readonly name: "CollateralDeposited";
|
|
1244
|
+
readonly inputs: readonly [{
|
|
1245
|
+
readonly name: "user";
|
|
1246
|
+
readonly type: "address";
|
|
1247
|
+
readonly indexed: true;
|
|
1248
|
+
readonly internalType: "address";
|
|
1249
|
+
}, {
|
|
1250
|
+
readonly name: "asset";
|
|
1251
|
+
readonly type: "address";
|
|
1252
|
+
readonly indexed: true;
|
|
1253
|
+
readonly internalType: "address";
|
|
1254
|
+
}, {
|
|
1255
|
+
readonly name: "amount";
|
|
1256
|
+
readonly type: "uint256";
|
|
1257
|
+
readonly indexed: false;
|
|
1258
|
+
readonly internalType: "uint256";
|
|
1259
|
+
}];
|
|
1260
|
+
readonly anonymous: false;
|
|
1261
|
+
}, {
|
|
1262
|
+
readonly type: "event";
|
|
1263
|
+
readonly name: "CollateralWithdrawn";
|
|
1264
|
+
readonly inputs: readonly [{
|
|
1265
|
+
readonly name: "user";
|
|
1266
|
+
readonly type: "address";
|
|
1267
|
+
readonly indexed: true;
|
|
1268
|
+
readonly internalType: "address";
|
|
1269
|
+
}, {
|
|
1270
|
+
readonly name: "asset";
|
|
1271
|
+
readonly type: "address";
|
|
1272
|
+
readonly indexed: true;
|
|
1273
|
+
readonly internalType: "address";
|
|
1274
|
+
}, {
|
|
1275
|
+
readonly name: "amount";
|
|
1276
|
+
readonly type: "uint256";
|
|
1277
|
+
readonly indexed: false;
|
|
1278
|
+
readonly internalType: "uint256";
|
|
1279
|
+
}];
|
|
1280
|
+
readonly anonymous: false;
|
|
1281
|
+
}, {
|
|
1282
|
+
readonly type: "event";
|
|
1283
|
+
readonly name: "GuaranteeVersionUpdated";
|
|
1284
|
+
readonly inputs: readonly [{
|
|
1285
|
+
readonly name: "version";
|
|
1286
|
+
readonly type: "uint64";
|
|
1287
|
+
readonly indexed: true;
|
|
1288
|
+
readonly internalType: "uint64";
|
|
1289
|
+
}, {
|
|
1290
|
+
readonly name: "verificationKey";
|
|
1291
|
+
readonly type: "tuple";
|
|
1292
|
+
readonly indexed: false;
|
|
1293
|
+
readonly internalType: "struct BLS.G1Point";
|
|
1294
|
+
readonly components: readonly [{
|
|
1295
|
+
readonly name: "x_a";
|
|
1296
|
+
readonly type: "bytes32";
|
|
1297
|
+
readonly internalType: "bytes32";
|
|
1298
|
+
}, {
|
|
1299
|
+
readonly name: "x_b";
|
|
1300
|
+
readonly type: "bytes32";
|
|
1301
|
+
readonly internalType: "bytes32";
|
|
1302
|
+
}, {
|
|
1303
|
+
readonly name: "y_a";
|
|
1304
|
+
readonly type: "bytes32";
|
|
1305
|
+
readonly internalType: "bytes32";
|
|
1306
|
+
}, {
|
|
1307
|
+
readonly name: "y_b";
|
|
1308
|
+
readonly type: "bytes32";
|
|
1309
|
+
readonly internalType: "bytes32";
|
|
1310
|
+
}];
|
|
1311
|
+
}, {
|
|
1312
|
+
readonly name: "domainSeparator";
|
|
1313
|
+
readonly type: "bytes32";
|
|
1314
|
+
readonly indexed: false;
|
|
1315
|
+
readonly internalType: "bytes32";
|
|
1316
|
+
}, {
|
|
1317
|
+
readonly name: "decoder";
|
|
1318
|
+
readonly type: "address";
|
|
1319
|
+
readonly indexed: false;
|
|
1320
|
+
readonly internalType: "address";
|
|
1321
|
+
}, {
|
|
1322
|
+
readonly name: "enabled";
|
|
1323
|
+
readonly type: "bool";
|
|
1324
|
+
readonly indexed: false;
|
|
1325
|
+
readonly internalType: "bool";
|
|
1326
|
+
}];
|
|
1327
|
+
readonly anonymous: false;
|
|
1328
|
+
}, {
|
|
1329
|
+
readonly type: "event";
|
|
1330
|
+
readonly name: "Paused";
|
|
1331
|
+
readonly inputs: readonly [{
|
|
1332
|
+
readonly name: "account";
|
|
1333
|
+
readonly type: "address";
|
|
1334
|
+
readonly indexed: false;
|
|
1335
|
+
readonly internalType: "address";
|
|
1336
|
+
}];
|
|
1337
|
+
readonly anonymous: false;
|
|
1338
|
+
}, {
|
|
1339
|
+
readonly type: "event";
|
|
1340
|
+
readonly name: "PaymentRecorded";
|
|
1341
|
+
readonly inputs: readonly [{
|
|
1342
|
+
readonly name: "tabId";
|
|
1343
|
+
readonly type: "uint256";
|
|
1344
|
+
readonly indexed: true;
|
|
1345
|
+
readonly internalType: "uint256";
|
|
1346
|
+
}, {
|
|
1347
|
+
readonly name: "asset";
|
|
1348
|
+
readonly type: "address";
|
|
1349
|
+
readonly indexed: true;
|
|
1350
|
+
readonly internalType: "address";
|
|
1351
|
+
}, {
|
|
1352
|
+
readonly name: "amount";
|
|
1353
|
+
readonly type: "uint256";
|
|
1354
|
+
readonly indexed: false;
|
|
1355
|
+
readonly internalType: "uint256";
|
|
1356
|
+
}];
|
|
1357
|
+
readonly anonymous: false;
|
|
1358
|
+
}, {
|
|
1359
|
+
readonly type: "event";
|
|
1360
|
+
readonly name: "ProtocolYieldClaimed";
|
|
1361
|
+
readonly inputs: readonly [{
|
|
1362
|
+
readonly name: "asset";
|
|
1363
|
+
readonly type: "address";
|
|
1364
|
+
readonly indexed: true;
|
|
1365
|
+
readonly internalType: "address";
|
|
1366
|
+
}, {
|
|
1367
|
+
readonly name: "to";
|
|
1368
|
+
readonly type: "address";
|
|
1369
|
+
readonly indexed: true;
|
|
1370
|
+
readonly internalType: "address";
|
|
1371
|
+
}, {
|
|
1372
|
+
readonly name: "amount";
|
|
1373
|
+
readonly type: "uint256";
|
|
1374
|
+
readonly indexed: false;
|
|
1375
|
+
readonly internalType: "uint256";
|
|
1376
|
+
}];
|
|
1377
|
+
readonly anonymous: false;
|
|
1378
|
+
}, {
|
|
1379
|
+
readonly type: "event";
|
|
1380
|
+
readonly name: "RecipientRemunerated";
|
|
1381
|
+
readonly inputs: readonly [{
|
|
1382
|
+
readonly name: "tabId";
|
|
1383
|
+
readonly type: "uint256";
|
|
1384
|
+
readonly indexed: true;
|
|
1385
|
+
readonly internalType: "uint256";
|
|
1386
|
+
}, {
|
|
1387
|
+
readonly name: "asset";
|
|
1388
|
+
readonly type: "address";
|
|
1389
|
+
readonly indexed: true;
|
|
1390
|
+
readonly internalType: "address";
|
|
1391
|
+
}, {
|
|
1392
|
+
readonly name: "amount";
|
|
1393
|
+
readonly type: "uint256";
|
|
1394
|
+
readonly indexed: false;
|
|
1395
|
+
readonly internalType: "uint256";
|
|
1396
|
+
}];
|
|
1397
|
+
readonly anonymous: false;
|
|
1398
|
+
}, {
|
|
1399
|
+
readonly type: "event";
|
|
1400
|
+
readonly name: "RemunerationGracePeriodUpdated";
|
|
1401
|
+
readonly inputs: readonly [{
|
|
1402
|
+
readonly name: "newGracePeriod";
|
|
1403
|
+
readonly type: "uint256";
|
|
1404
|
+
readonly indexed: false;
|
|
1405
|
+
readonly internalType: "uint256";
|
|
1406
|
+
}];
|
|
1407
|
+
readonly anonymous: false;
|
|
1408
|
+
}, {
|
|
1409
|
+
readonly type: "event";
|
|
1410
|
+
readonly name: "StablecoinAssetUpdated";
|
|
1411
|
+
readonly inputs: readonly [{
|
|
1412
|
+
readonly name: "asset";
|
|
1413
|
+
readonly type: "address";
|
|
1414
|
+
readonly indexed: true;
|
|
1415
|
+
readonly internalType: "address";
|
|
1416
|
+
}, {
|
|
1417
|
+
readonly name: "enabled";
|
|
1418
|
+
readonly type: "bool";
|
|
1419
|
+
readonly indexed: false;
|
|
1420
|
+
readonly internalType: "bool";
|
|
1421
|
+
}];
|
|
1422
|
+
readonly anonymous: false;
|
|
1423
|
+
}, {
|
|
1424
|
+
readonly type: "event";
|
|
1425
|
+
readonly name: "SurplusATokensClaimed";
|
|
1426
|
+
readonly inputs: readonly [{
|
|
1427
|
+
readonly name: "asset";
|
|
1428
|
+
readonly type: "address";
|
|
1429
|
+
readonly indexed: true;
|
|
1430
|
+
readonly internalType: "address";
|
|
1431
|
+
}, {
|
|
1432
|
+
readonly name: "to";
|
|
1433
|
+
readonly type: "address";
|
|
1434
|
+
readonly indexed: true;
|
|
1435
|
+
readonly internalType: "address";
|
|
1436
|
+
}, {
|
|
1437
|
+
readonly name: "scaledAmount";
|
|
1438
|
+
readonly type: "uint256";
|
|
1439
|
+
readonly indexed: false;
|
|
1440
|
+
readonly internalType: "uint256";
|
|
1441
|
+
}, {
|
|
1442
|
+
readonly name: "nominalAmount";
|
|
1443
|
+
readonly type: "uint256";
|
|
1444
|
+
readonly indexed: false;
|
|
1445
|
+
readonly internalType: "uint256";
|
|
1446
|
+
}];
|
|
1447
|
+
readonly anonymous: false;
|
|
1448
|
+
}, {
|
|
1449
|
+
readonly type: "event";
|
|
1450
|
+
readonly name: "SynchronizationDelayUpdated";
|
|
1451
|
+
readonly inputs: readonly [{
|
|
1452
|
+
readonly name: "newExpirationTime";
|
|
1453
|
+
readonly type: "uint256";
|
|
1454
|
+
readonly indexed: false;
|
|
1455
|
+
readonly internalType: "uint256";
|
|
1456
|
+
}];
|
|
1457
|
+
readonly anonymous: false;
|
|
1458
|
+
}, {
|
|
1459
|
+
readonly type: "event";
|
|
1460
|
+
readonly name: "TabExpirationTimeUpdated";
|
|
1461
|
+
readonly inputs: readonly [{
|
|
1462
|
+
readonly name: "newExpirationTime";
|
|
1463
|
+
readonly type: "uint256";
|
|
1464
|
+
readonly indexed: false;
|
|
1465
|
+
readonly internalType: "uint256";
|
|
1466
|
+
}];
|
|
1467
|
+
readonly anonymous: false;
|
|
1468
|
+
}, {
|
|
1469
|
+
readonly type: "event";
|
|
1470
|
+
readonly name: "TabPaid";
|
|
1471
|
+
readonly inputs: readonly [{
|
|
1472
|
+
readonly name: "tabId";
|
|
1473
|
+
readonly type: "uint256";
|
|
1474
|
+
readonly indexed: true;
|
|
1475
|
+
readonly internalType: "uint256";
|
|
1476
|
+
}, {
|
|
1477
|
+
readonly name: "asset";
|
|
1478
|
+
readonly type: "address";
|
|
1479
|
+
readonly indexed: true;
|
|
1480
|
+
readonly internalType: "address";
|
|
1481
|
+
}, {
|
|
1482
|
+
readonly name: "user";
|
|
1483
|
+
readonly type: "address";
|
|
1484
|
+
readonly indexed: true;
|
|
1485
|
+
readonly internalType: "address";
|
|
1486
|
+
}, {
|
|
1487
|
+
readonly name: "recipient";
|
|
1488
|
+
readonly type: "address";
|
|
1489
|
+
readonly indexed: false;
|
|
1490
|
+
readonly internalType: "address";
|
|
1491
|
+
}, {
|
|
1492
|
+
readonly name: "amount";
|
|
1493
|
+
readonly type: "uint256";
|
|
1494
|
+
readonly indexed: false;
|
|
1495
|
+
readonly internalType: "uint256";
|
|
1496
|
+
}];
|
|
1497
|
+
readonly anonymous: false;
|
|
1498
|
+
}, {
|
|
1499
|
+
readonly type: "event";
|
|
1500
|
+
readonly name: "Unpaused";
|
|
1501
|
+
readonly inputs: readonly [{
|
|
1502
|
+
readonly name: "account";
|
|
1503
|
+
readonly type: "address";
|
|
1504
|
+
readonly indexed: false;
|
|
1505
|
+
readonly internalType: "address";
|
|
1506
|
+
}];
|
|
1507
|
+
readonly anonymous: false;
|
|
1508
|
+
}, {
|
|
1509
|
+
readonly type: "event";
|
|
1510
|
+
readonly name: "VerificationKeyUpdated";
|
|
1511
|
+
readonly inputs: readonly [{
|
|
1512
|
+
readonly name: "newVerificationKey";
|
|
1513
|
+
readonly type: "tuple";
|
|
1514
|
+
readonly indexed: false;
|
|
1515
|
+
readonly internalType: "struct BLS.G1Point";
|
|
1516
|
+
readonly components: readonly [{
|
|
1517
|
+
readonly name: "x_a";
|
|
1518
|
+
readonly type: "bytes32";
|
|
1519
|
+
readonly internalType: "bytes32";
|
|
1520
|
+
}, {
|
|
1521
|
+
readonly name: "x_b";
|
|
1522
|
+
readonly type: "bytes32";
|
|
1523
|
+
readonly internalType: "bytes32";
|
|
1524
|
+
}, {
|
|
1525
|
+
readonly name: "y_a";
|
|
1526
|
+
readonly type: "bytes32";
|
|
1527
|
+
readonly internalType: "bytes32";
|
|
1528
|
+
}, {
|
|
1529
|
+
readonly name: "y_b";
|
|
1530
|
+
readonly type: "bytes32";
|
|
1531
|
+
readonly internalType: "bytes32";
|
|
1532
|
+
}];
|
|
1533
|
+
}];
|
|
1534
|
+
readonly anonymous: false;
|
|
1535
|
+
}, {
|
|
1536
|
+
readonly type: "event";
|
|
1537
|
+
readonly name: "WithdrawalCanceled";
|
|
1538
|
+
readonly inputs: readonly [{
|
|
1539
|
+
readonly name: "user";
|
|
1540
|
+
readonly type: "address";
|
|
1541
|
+
readonly indexed: true;
|
|
1542
|
+
readonly internalType: "address";
|
|
1543
|
+
}, {
|
|
1544
|
+
readonly name: "asset";
|
|
1545
|
+
readonly type: "address";
|
|
1546
|
+
readonly indexed: true;
|
|
1547
|
+
readonly internalType: "address";
|
|
1548
|
+
}];
|
|
1549
|
+
readonly anonymous: false;
|
|
1550
|
+
}, {
|
|
1551
|
+
readonly type: "event";
|
|
1552
|
+
readonly name: "WithdrawalGracePeriodUpdated";
|
|
1553
|
+
readonly inputs: readonly [{
|
|
1554
|
+
readonly name: "newGracePeriod";
|
|
1555
|
+
readonly type: "uint256";
|
|
1556
|
+
readonly indexed: false;
|
|
1557
|
+
readonly internalType: "uint256";
|
|
1558
|
+
}];
|
|
1559
|
+
readonly anonymous: false;
|
|
1560
|
+
}, {
|
|
1561
|
+
readonly type: "event";
|
|
1562
|
+
readonly name: "WithdrawalRequested";
|
|
1563
|
+
readonly inputs: readonly [{
|
|
1564
|
+
readonly name: "user";
|
|
1565
|
+
readonly type: "address";
|
|
1566
|
+
readonly indexed: true;
|
|
1567
|
+
readonly internalType: "address";
|
|
1568
|
+
}, {
|
|
1569
|
+
readonly name: "asset";
|
|
1570
|
+
readonly type: "address";
|
|
1571
|
+
readonly indexed: true;
|
|
1572
|
+
readonly internalType: "address";
|
|
1573
|
+
}, {
|
|
1574
|
+
readonly name: "when";
|
|
1575
|
+
readonly type: "uint256";
|
|
1576
|
+
readonly indexed: false;
|
|
1577
|
+
readonly internalType: "uint256";
|
|
1578
|
+
}, {
|
|
1579
|
+
readonly name: "amount";
|
|
1580
|
+
readonly type: "uint256";
|
|
1581
|
+
readonly indexed: false;
|
|
1582
|
+
readonly internalType: "uint256";
|
|
1583
|
+
}];
|
|
1584
|
+
readonly anonymous: false;
|
|
1585
|
+
}, {
|
|
1586
|
+
readonly type: "event";
|
|
1587
|
+
readonly name: "YieldFeeBpsUpdated";
|
|
1588
|
+
readonly inputs: readonly [{
|
|
1589
|
+
readonly name: "oldFeeBps";
|
|
1590
|
+
readonly type: "uint256";
|
|
1591
|
+
readonly indexed: false;
|
|
1592
|
+
readonly internalType: "uint256";
|
|
1593
|
+
}, {
|
|
1594
|
+
readonly name: "newFeeBps";
|
|
1595
|
+
readonly type: "uint256";
|
|
1596
|
+
readonly indexed: false;
|
|
1597
|
+
readonly internalType: "uint256";
|
|
1598
|
+
}];
|
|
1599
|
+
readonly anonymous: false;
|
|
1600
|
+
}, {
|
|
1601
|
+
readonly type: "error";
|
|
1602
|
+
readonly name: "AaveNotConfigured";
|
|
1603
|
+
readonly inputs: readonly [];
|
|
1604
|
+
}, {
|
|
1605
|
+
readonly type: "error";
|
|
1606
|
+
readonly name: "AaveProviderReconfigurationBlocked";
|
|
1607
|
+
readonly inputs: readonly [];
|
|
1608
|
+
}, {
|
|
1609
|
+
readonly type: "error";
|
|
1610
|
+
readonly name: "AccessManagedInvalidAuthority";
|
|
1611
|
+
readonly inputs: readonly [{
|
|
1612
|
+
readonly name: "authority";
|
|
1613
|
+
readonly type: "address";
|
|
1614
|
+
readonly internalType: "address";
|
|
1615
|
+
}];
|
|
1616
|
+
}, {
|
|
1617
|
+
readonly type: "error";
|
|
1618
|
+
readonly name: "AccessManagedRequiredDelay";
|
|
1619
|
+
readonly inputs: readonly [{
|
|
1620
|
+
readonly name: "caller";
|
|
1621
|
+
readonly type: "address";
|
|
1622
|
+
readonly internalType: "address";
|
|
1623
|
+
}, {
|
|
1624
|
+
readonly name: "delay";
|
|
1625
|
+
readonly type: "uint32";
|
|
1626
|
+
readonly internalType: "uint32";
|
|
1627
|
+
}];
|
|
1628
|
+
}, {
|
|
1629
|
+
readonly type: "error";
|
|
1630
|
+
readonly name: "AccessManagedUnauthorized";
|
|
1631
|
+
readonly inputs: readonly [{
|
|
1632
|
+
readonly name: "caller";
|
|
1633
|
+
readonly type: "address";
|
|
1634
|
+
readonly internalType: "address";
|
|
1635
|
+
}];
|
|
1636
|
+
}, {
|
|
1637
|
+
readonly type: "error";
|
|
1638
|
+
readonly name: "AmountZero";
|
|
1639
|
+
readonly inputs: readonly [];
|
|
1640
|
+
}, {
|
|
1641
|
+
readonly type: "error";
|
|
1642
|
+
readonly name: "DirectTransferNotAllowed";
|
|
1643
|
+
readonly inputs: readonly [];
|
|
1644
|
+
}, {
|
|
1645
|
+
readonly type: "error";
|
|
1646
|
+
readonly name: "DoubleSpendingDetected";
|
|
1647
|
+
readonly inputs: readonly [];
|
|
1648
|
+
}, {
|
|
1649
|
+
readonly type: "error";
|
|
1650
|
+
readonly name: "EnforcedPause";
|
|
1651
|
+
readonly inputs: readonly [];
|
|
1652
|
+
}, {
|
|
1653
|
+
readonly type: "error";
|
|
1654
|
+
readonly name: "ExpectedPause";
|
|
1655
|
+
readonly inputs: readonly [];
|
|
1656
|
+
}, {
|
|
1657
|
+
readonly type: "error";
|
|
1658
|
+
readonly name: "FeeTooHigh";
|
|
1659
|
+
readonly inputs: readonly [];
|
|
1660
|
+
}, {
|
|
1661
|
+
readonly type: "error";
|
|
1662
|
+
readonly name: "GracePeriodNotElapsed";
|
|
1663
|
+
readonly inputs: readonly [];
|
|
1664
|
+
}, {
|
|
1665
|
+
readonly type: "error";
|
|
1666
|
+
readonly name: "IllegalValue";
|
|
1667
|
+
readonly inputs: readonly [];
|
|
1668
|
+
}, {
|
|
1669
|
+
readonly type: "error";
|
|
1670
|
+
readonly name: "InsufficientAvailable";
|
|
1671
|
+
readonly inputs: readonly [];
|
|
1672
|
+
}, {
|
|
1673
|
+
readonly type: "error";
|
|
1674
|
+
readonly name: "InvalidAToken";
|
|
1675
|
+
readonly inputs: readonly [{
|
|
1676
|
+
readonly name: "asset";
|
|
1677
|
+
readonly type: "address";
|
|
1678
|
+
readonly internalType: "address";
|
|
1679
|
+
}, {
|
|
1680
|
+
readonly name: "aToken";
|
|
1681
|
+
readonly type: "address";
|
|
1682
|
+
readonly internalType: "address";
|
|
1683
|
+
}];
|
|
1684
|
+
}, {
|
|
1685
|
+
readonly type: "error";
|
|
1686
|
+
readonly name: "InvalidAsset";
|
|
1687
|
+
readonly inputs: readonly [{
|
|
1688
|
+
readonly name: "asset";
|
|
1689
|
+
readonly type: "address";
|
|
1690
|
+
readonly internalType: "address";
|
|
1691
|
+
}];
|
|
1692
|
+
}, {
|
|
1693
|
+
readonly type: "error";
|
|
1694
|
+
readonly name: "InvalidGuaranteeDomain";
|
|
1695
|
+
readonly inputs: readonly [];
|
|
1696
|
+
}, {
|
|
1697
|
+
readonly type: "error";
|
|
1698
|
+
readonly name: "InvalidRecipient";
|
|
1699
|
+
readonly inputs: readonly [];
|
|
1700
|
+
}, {
|
|
1701
|
+
readonly type: "error";
|
|
1702
|
+
readonly name: "InvalidSignature";
|
|
1703
|
+
readonly inputs: readonly [];
|
|
1704
|
+
}, {
|
|
1705
|
+
readonly type: "error";
|
|
1706
|
+
readonly name: "MissingGuaranteeDecoder";
|
|
1707
|
+
readonly inputs: readonly [{
|
|
1708
|
+
readonly name: "version";
|
|
1709
|
+
readonly type: "uint64";
|
|
1710
|
+
readonly internalType: "uint64";
|
|
1711
|
+
}];
|
|
1712
|
+
}, {
|
|
1713
|
+
readonly type: "error";
|
|
1714
|
+
readonly name: "NoWithdrawalRequested";
|
|
1715
|
+
readonly inputs: readonly [];
|
|
1716
|
+
}, {
|
|
1717
|
+
readonly type: "error";
|
|
1718
|
+
readonly name: "ReconciliationLoss";
|
|
1719
|
+
readonly inputs: readonly [{
|
|
1720
|
+
readonly name: "asset";
|
|
1721
|
+
readonly type: "address";
|
|
1722
|
+
readonly internalType: "address";
|
|
1723
|
+
}, {
|
|
1724
|
+
readonly name: "tracked";
|
|
1725
|
+
readonly type: "uint256";
|
|
1726
|
+
readonly internalType: "uint256";
|
|
1727
|
+
}, {
|
|
1728
|
+
readonly name: "observed";
|
|
1729
|
+
readonly type: "uint256";
|
|
1730
|
+
readonly internalType: "uint256";
|
|
1731
|
+
}];
|
|
1732
|
+
}, {
|
|
1733
|
+
readonly type: "error";
|
|
1734
|
+
readonly name: "ReentrancyGuardReentrantCall";
|
|
1735
|
+
readonly inputs: readonly [];
|
|
1736
|
+
}, {
|
|
1737
|
+
readonly type: "error";
|
|
1738
|
+
readonly name: "SafeERC20FailedOperation";
|
|
1739
|
+
readonly inputs: readonly [{
|
|
1740
|
+
readonly name: "token";
|
|
1741
|
+
readonly type: "address";
|
|
1742
|
+
readonly internalType: "address";
|
|
1743
|
+
}];
|
|
1744
|
+
}, {
|
|
1745
|
+
readonly type: "error";
|
|
1746
|
+
readonly name: "StablecoinWithdrawShortfall";
|
|
1747
|
+
readonly inputs: readonly [{
|
|
1748
|
+
readonly name: "asset";
|
|
1749
|
+
readonly type: "address";
|
|
1750
|
+
readonly internalType: "address";
|
|
1751
|
+
}, {
|
|
1752
|
+
readonly name: "requested";
|
|
1753
|
+
readonly type: "uint256";
|
|
1754
|
+
readonly internalType: "uint256";
|
|
1755
|
+
}, {
|
|
1756
|
+
readonly name: "actual";
|
|
1757
|
+
readonly type: "uint256";
|
|
1758
|
+
readonly internalType: "uint256";
|
|
1759
|
+
}];
|
|
1760
|
+
}, {
|
|
1761
|
+
readonly type: "error";
|
|
1762
|
+
readonly name: "SurplusClaimExceedsAvailable";
|
|
1763
|
+
readonly inputs: readonly [];
|
|
1764
|
+
}, {
|
|
1765
|
+
readonly type: "error";
|
|
1766
|
+
readonly name: "TabAlreadyPaid";
|
|
1767
|
+
readonly inputs: readonly [];
|
|
1768
|
+
}, {
|
|
1769
|
+
readonly type: "error";
|
|
1770
|
+
readonly name: "TabExpired";
|
|
1771
|
+
readonly inputs: readonly [];
|
|
1772
|
+
}, {
|
|
1773
|
+
readonly type: "error";
|
|
1774
|
+
readonly name: "TabNotYetOverdue";
|
|
1775
|
+
readonly inputs: readonly [];
|
|
1776
|
+
}, {
|
|
1777
|
+
readonly type: "error";
|
|
1778
|
+
readonly name: "TabPreviouslyRemunerated";
|
|
1779
|
+
readonly inputs: readonly [];
|
|
1780
|
+
}, {
|
|
1781
|
+
readonly type: "error";
|
|
1782
|
+
readonly name: "TransferFailed";
|
|
1783
|
+
readonly inputs: readonly [];
|
|
1784
|
+
}, {
|
|
1785
|
+
readonly type: "error";
|
|
1786
|
+
readonly name: "TreasuryClaimExceedsAvailable";
|
|
1787
|
+
readonly inputs: readonly [];
|
|
1788
|
+
}, {
|
|
1789
|
+
readonly type: "error";
|
|
1790
|
+
readonly name: "UnsupportedAsset";
|
|
1791
|
+
readonly inputs: readonly [{
|
|
1792
|
+
readonly name: "asset";
|
|
1793
|
+
readonly type: "address";
|
|
1794
|
+
readonly internalType: "address";
|
|
1795
|
+
}];
|
|
1796
|
+
}, {
|
|
1797
|
+
readonly type: "error";
|
|
1798
|
+
readonly name: "UnsupportedGuaranteeVersion";
|
|
1799
|
+
readonly inputs: readonly [{
|
|
1800
|
+
readonly name: "version";
|
|
1801
|
+
readonly type: "uint64";
|
|
1802
|
+
readonly internalType: "uint64";
|
|
1803
|
+
}];
|
|
1804
|
+
}, {
|
|
1805
|
+
readonly type: "error";
|
|
1806
|
+
readonly name: "UnsupportedTreasuryAsset";
|
|
1807
|
+
readonly inputs: readonly [{
|
|
1808
|
+
readonly name: "asset";
|
|
1809
|
+
readonly type: "address";
|
|
1810
|
+
readonly internalType: "address";
|
|
1811
|
+
}];
|
|
1812
|
+
}, {
|
|
1813
|
+
readonly type: "error";
|
|
1814
|
+
readonly name: "UserScaledBalanceUnderflow";
|
|
1815
|
+
readonly inputs: readonly [{
|
|
1816
|
+
readonly name: "asset";
|
|
1817
|
+
readonly type: "address";
|
|
1818
|
+
readonly internalType: "address";
|
|
1819
|
+
}, {
|
|
1820
|
+
readonly name: "user";
|
|
1821
|
+
readonly type: "address";
|
|
1822
|
+
readonly internalType: "address";
|
|
1823
|
+
}, {
|
|
1824
|
+
readonly name: "deduction";
|
|
1825
|
+
readonly type: "uint256";
|
|
1826
|
+
readonly internalType: "uint256";
|
|
1827
|
+
}, {
|
|
1828
|
+
readonly name: "balance";
|
|
1829
|
+
readonly type: "uint256";
|
|
1830
|
+
readonly internalType: "uint256";
|
|
1831
|
+
}];
|
|
1832
|
+
}, {
|
|
1833
|
+
readonly type: "error";
|
|
1834
|
+
readonly name: "ZeroAddress";
|
|
1835
|
+
readonly inputs: readonly [];
|
|
1836
|
+
}];
|
|
1837
|
+
|
|
1838
|
+
type TPublicClient = ReturnType<typeof createPublicClient>;
|
|
1839
|
+
type TWalletClient = WalletClient<HttpTransport, Chain, Account>;
|
|
1840
|
+
type CoreContract = GetContractReturnType<typeof core4micaAbi, {
|
|
1841
|
+
public: ReturnType<typeof createPublicClient>;
|
|
1842
|
+
wallet: TWalletClient;
|
|
1843
|
+
}>;
|
|
1844
|
+
type TxReceiptWaitOptions = {
|
|
1845
|
+
timeout?: number;
|
|
1846
|
+
pollingInterval?: number;
|
|
1847
|
+
gas?: bigint;
|
|
1848
|
+
};
|
|
1849
|
+
|
|
1850
|
+
declare class ContractGateway {
|
|
1851
|
+
readonly publicClient: TPublicClient;
|
|
1852
|
+
readonly walletClient: TWalletClient;
|
|
1853
|
+
readonly contract: CoreContract;
|
|
1854
|
+
private erc20Cache;
|
|
1855
|
+
private clearingHouseCache;
|
|
1856
|
+
private txQueue;
|
|
1857
|
+
private constructor();
|
|
1858
|
+
static create(rpcUrl: string, signer: Account, contractAddress: Hex, chainId: number): Promise<ContractGateway>;
|
|
1859
|
+
private erc20;
|
|
1860
|
+
private clearingHouse;
|
|
1861
|
+
private enqueueTx;
|
|
1862
|
+
private defaultFeeParams;
|
|
1863
|
+
private splitWaitOptions;
|
|
1864
|
+
getGuaranteeDomain(): Promise<string>;
|
|
1865
|
+
getGuaranteeVersionConfig(version: number): Promise<{
|
|
1866
|
+
domainSeparator: string;
|
|
1867
|
+
decoder: string;
|
|
1868
|
+
enabled: boolean;
|
|
1869
|
+
}>;
|
|
1870
|
+
approveErc20(token: string, amount: number | bigint | string, waitOptions?: TxReceiptWaitOptions): Promise<viem.TransactionReceipt | undefined>;
|
|
1871
|
+
private waitForErc20Allowance;
|
|
1872
|
+
deposit(amount: number | bigint | string, erc20Token?: string, waitOptions?: TxReceiptWaitOptions): Promise<viem.TransactionReceipt>;
|
|
1873
|
+
getUserAssets(opts?: {
|
|
1874
|
+
blockNumber?: bigint;
|
|
1875
|
+
}): Promise<{
|
|
1876
|
+
asset: `0x${string}`;
|
|
1877
|
+
collateral: bigint;
|
|
1878
|
+
withdrawalRequestTimestamp: bigint;
|
|
1879
|
+
withdrawalRequestAmount: bigint;
|
|
1880
|
+
}[]>;
|
|
1881
|
+
requestWithdrawal(amount: number | bigint | string, erc20Token?: string, waitOptions?: TxReceiptWaitOptions): Promise<viem.TransactionReceipt>;
|
|
1882
|
+
cancelWithdrawal(erc20Token?: string, waitOptions?: TxReceiptWaitOptions): Promise<viem.TransactionReceipt>;
|
|
1883
|
+
finalizeWithdrawal(erc20Token?: string, waitOptions?: TxReceiptWaitOptions): Promise<viem.TransactionReceipt>;
|
|
1884
|
+
/**
|
|
1885
|
+
* Claim a net credit committed for a settlement cycle (`claimNetCredit`).
|
|
1886
|
+
*
|
|
1887
|
+
* @param contractAddress - ClearingHouse contract address (from the clearing action).
|
|
1888
|
+
* @param cycleId - On-chain `bytes32` cycle identifier.
|
|
1889
|
+
* @param netCredit - Net credit amount committed for the caller.
|
|
1890
|
+
* @param proof - Merkle proof of the caller's committed leaf.
|
|
1891
|
+
*/
|
|
1892
|
+
claimNetCredit(contractAddress: string, cycleId: Hex, netCredit: bigint, proof: Hex[], waitOptions?: TxReceiptWaitOptions): Promise<viem.TransactionReceipt>;
|
|
1893
|
+
/**
|
|
1894
|
+
* Pay a net debit committed for a settlement cycle (`payNetDebit`).
|
|
1895
|
+
*
|
|
1896
|
+
* @param payableValue - Native value to attach (non-zero only for native-asset debtors).
|
|
1897
|
+
*/
|
|
1898
|
+
payNetDebit(contractAddress: string, cycleId: Hex, netDebit: bigint, proof: Hex[], payableValue: bigint, waitOptions?: TxReceiptWaitOptions): Promise<viem.TransactionReceipt>;
|
|
1899
|
+
/**
|
|
1900
|
+
* Mark a debtor defaulted after the clearing payment finality deadline
|
|
1901
|
+
* (`markDefaulted`).
|
|
1902
|
+
*/
|
|
1903
|
+
markDefaulted(contractAddress: string, cycleId: Hex, debtor: Hex, netDebit: bigint, proof: Hex[], waitOptions?: TxReceiptWaitOptions): Promise<viem.TransactionReceipt>;
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
/**
|
|
1907
|
+
* Recipient-side operations: guarantee issuance/verification and cycle-based
|
|
1908
|
+
* clearing settlement.
|
|
1909
|
+
*/
|
|
1910
|
+
declare class RecipientClient {
|
|
1911
|
+
private client;
|
|
1912
|
+
constructor(client: Client);
|
|
1913
|
+
private get recipientAddress();
|
|
1914
|
+
get guaranteeDomain(): string;
|
|
1915
|
+
/**
|
|
1916
|
+
* Issue a BLS-signed payment guarantee certificate via the core RPC.
|
|
1917
|
+
*
|
|
1918
|
+
* The returned {@link BLSCert} can be stored and later settled via the
|
|
1919
|
+
* cycle-clearing flow ({@link claimNetCredit}).
|
|
1920
|
+
*
|
|
1921
|
+
* @param claims - Signed payment claims (V1 or V2).
|
|
1922
|
+
* @param signature - ECDSA signature hex string from the payer.
|
|
1923
|
+
* @param scheme - Signing scheme used to produce the signature.
|
|
1924
|
+
* @returns BLS certificate with ABI-encoded claims and BLS signature.
|
|
1925
|
+
* @throws {@link RpcError} if the core service rejects the request.
|
|
1926
|
+
*/
|
|
1927
|
+
issuePaymentGuarantee(claims: PaymentGuaranteeRequestClaims | PaymentGuaranteeRequestClaimsV2, signature: string, scheme: SigningScheme): Promise<BLSCert>;
|
|
1928
|
+
/**
|
|
1929
|
+
* Verify and decode a BLS guarantee certificate.
|
|
1930
|
+
*
|
|
1931
|
+
* Decodes the ABI-encoded claims and validates the domain separator against
|
|
1932
|
+
* the on-chain configuration. For V2 certificates, the active V2 domain is
|
|
1933
|
+
* fetched from the contract and verified to be enabled.
|
|
1934
|
+
*
|
|
1935
|
+
* @param cert - BLS certificate (hex-encoded claims + hex-encoded signature).
|
|
1936
|
+
* @returns Decoded {@link PaymentGuaranteeClaims}, including validation policy for V2.
|
|
1937
|
+
* @throws {@link VerificationError} on domain mismatch, invalid length, or disabled version.
|
|
1938
|
+
*/
|
|
1939
|
+
verifyPaymentGuarantee(cert: BLSCert): Promise<PaymentGuaranteeClaims>;
|
|
1940
|
+
/**
|
|
1941
|
+
* Fetch this recipient's committed position + Merkle proof for a cycle.
|
|
1942
|
+
*
|
|
1943
|
+
* @param cycleId - On-chain `bytes32` cycle identifier.
|
|
1944
|
+
*/
|
|
1945
|
+
getClearingParticipantProof(cycleId: string): Promise<ClearingParticipantProof>;
|
|
1946
|
+
/**
|
|
1947
|
+
* Fetch the prepared `claimNetCredit` action for this recipient in a cycle.
|
|
1948
|
+
*
|
|
1949
|
+
* @param cycleId - On-chain `bytes32` cycle identifier.
|
|
1950
|
+
*/
|
|
1951
|
+
getClearingClaimNetCreditAction(cycleId: string): Promise<ClearingSettlementActionResponse>;
|
|
1952
|
+
/**
|
|
1953
|
+
* Claim this recipient's committed net credit for a settlement cycle on-chain.
|
|
1954
|
+
*
|
|
1955
|
+
* Fetches the prepared clearing action (contract address, amount, and Merkle
|
|
1956
|
+
* proof) from core, then submits `claimNetCredit` to the ClearingHouse.
|
|
1957
|
+
*
|
|
1958
|
+
* @param cycleId - On-chain `bytes32` cycle identifier.
|
|
1959
|
+
* @param waitOptions - Optional timeout/polling overrides for receipt polling.
|
|
1960
|
+
* @throws {@link ContractError} if the contract call fails.
|
|
1961
|
+
*/
|
|
1962
|
+
claimNetCredit(cycleId: string, waitOptions?: TxReceiptWaitOptions): Promise<viem.TransactionReceipt>;
|
|
1963
|
+
/** List all on-chain payments received by this recipient. */
|
|
1964
|
+
listRecipientPayments(): Promise<RecipientPaymentInfo[]>;
|
|
1965
|
+
/**
|
|
1966
|
+
* Fetch the collateral balance a user has locked for a specific asset.
|
|
1967
|
+
*
|
|
1968
|
+
* @param userAddress - Address of the payer.
|
|
1969
|
+
* @param assetAddress - ERC20 token address, or zero address for ETH.
|
|
1970
|
+
* @returns Balance info, or `null` if no record exists.
|
|
1971
|
+
*/
|
|
1972
|
+
getUserAssetBalance(userAddress: string, assetAddress: string): Promise<AssetBalanceInfo | null>;
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1975
|
+
/** Payer-side operations: collateral management, payment signing, withdrawals. */
|
|
1976
|
+
declare class UserClient {
|
|
1977
|
+
private client;
|
|
1978
|
+
constructor(client: Client);
|
|
1979
|
+
/** 32-byte V1 guarantee domain separator (hex-prefixed). */
|
|
1980
|
+
get guaranteeDomain(): string;
|
|
1981
|
+
private get userAddress();
|
|
1982
|
+
/**
|
|
1983
|
+
* Approve the Core4Mica contract to spend an ERC20 token on your behalf.
|
|
1984
|
+
* Call this before {@link deposit} for ERC20 deposits.
|
|
1985
|
+
*
|
|
1986
|
+
* @param token - ERC20 token contract address.
|
|
1987
|
+
* @param amount - Amount to approve (in token base units).
|
|
1988
|
+
* @param waitOptions - Optional timeout/polling overrides for receipt polling.
|
|
1989
|
+
*/
|
|
1990
|
+
approveErc20(token: string, amount: number | bigint | string, waitOptions?: TxReceiptWaitOptions): Promise<viem.TransactionReceipt | undefined>;
|
|
1991
|
+
/**
|
|
1992
|
+
* Deposit collateral into the Core4Mica contract.
|
|
1993
|
+
*
|
|
1994
|
+
* @param amount - Amount to deposit (in wei for ETH, base units for ERC20).
|
|
1995
|
+
* @param erc20Token - ERC20 token address. Omit to deposit ETH.
|
|
1996
|
+
* Call {@link approveErc20} first when depositing ERC20.
|
|
1997
|
+
* @param waitOptions - Optional timeout/polling overrides.
|
|
1998
|
+
*/
|
|
1999
|
+
deposit(amount: number | bigint | string, erc20Token?: string, waitOptions?: TxReceiptWaitOptions): Promise<viem.TransactionReceipt>;
|
|
2000
|
+
/**
|
|
2001
|
+
* Fetch all asset positions for the current signer.
|
|
2002
|
+
*
|
|
2003
|
+
* @returns Array of positions — one entry per deposited asset, including
|
|
2004
|
+
* locked collateral and any pending withdrawal.
|
|
2005
|
+
* @throws {@link ContractError} if the contract call fails.
|
|
2006
|
+
*/
|
|
2007
|
+
getUser(opts?: {
|
|
2008
|
+
blockNumber?: bigint;
|
|
2009
|
+
}): Promise<UserInfo[]>;
|
|
2010
|
+
/**
|
|
2011
|
+
* Sign a payment guarantee request with the configured signer.
|
|
2012
|
+
*
|
|
2013
|
+
* @param claims - V1 or V2 payment claims. Build V1 with
|
|
2014
|
+
* {@link PaymentGuaranteeRequestClaims.new}; build V2 with
|
|
2015
|
+
* {@link PaymentGuaranteeRequestClaimsV2} (requires validation policy fields).
|
|
2016
|
+
* @param scheme - Signing scheme. Defaults to `EIP712`.
|
|
2017
|
+
* Use `EIP191` for wallets that do not support typed data.
|
|
2018
|
+
* @returns 65-byte ECDSA signature plus the scheme used.
|
|
2019
|
+
* @throws {@link SigningError} if the signer address does not match `claims.userAddress`
|
|
2020
|
+
* or the signing scheme is not supported by the account.
|
|
2021
|
+
*/
|
|
2022
|
+
signPayment(claims: PaymentGuaranteeRequestClaims | PaymentGuaranteeRequestClaimsV2, scheme?: SigningScheme): Promise<PaymentSignature>;
|
|
2023
|
+
/**
|
|
2024
|
+
* Fetch the prepared `payNetDebit` action for the current signer in a cycle.
|
|
2025
|
+
*
|
|
2026
|
+
* @param cycleId - On-chain `bytes32` cycle identifier.
|
|
2027
|
+
*/
|
|
2028
|
+
getClearingPayNetDebitAction(cycleId: string): Promise<ClearingSettlementActionResponse>;
|
|
2029
|
+
/**
|
|
2030
|
+
* Pay the current signer's committed net debit for a settlement cycle on-chain.
|
|
2031
|
+
*
|
|
2032
|
+
* Fetches the prepared clearing action (contract address, amount, native value,
|
|
2033
|
+
* and Merkle proof) from core, then submits `payNetDebit` to the ClearingHouse.
|
|
2034
|
+
*
|
|
2035
|
+
* @param cycleId - On-chain `bytes32` cycle identifier.
|
|
2036
|
+
* @param waitOptions - Optional timeout/polling overrides.
|
|
2037
|
+
* @throws {@link ContractError} if the contract call fails.
|
|
2038
|
+
*/
|
|
2039
|
+
payNetDebit(cycleId: string, waitOptions?: TxReceiptWaitOptions): Promise<viem.TransactionReceipt>;
|
|
2040
|
+
/**
|
|
2041
|
+
* Fetch the prepared `markDefaulted` action against a debtor in a cycle.
|
|
2042
|
+
*
|
|
2043
|
+
* @param cycleId - On-chain `bytes32` cycle identifier.
|
|
2044
|
+
* @param debtor - Address of the defaulted debtor.
|
|
2045
|
+
*/
|
|
2046
|
+
getClearingMarkDefaultedAction(cycleId: string, debtor: string): Promise<ClearingSettlementActionResponse>;
|
|
2047
|
+
/**
|
|
2048
|
+
* Mark a debtor defaulted after the clearing payment finality deadline.
|
|
2049
|
+
*
|
|
2050
|
+
* @param cycleId - On-chain `bytes32` cycle identifier.
|
|
2051
|
+
* @param debtor - Address of the defaulted debtor.
|
|
2052
|
+
* @param waitOptions - Optional timeout/polling overrides.
|
|
2053
|
+
* @throws {@link ContractError} if the contract call fails.
|
|
2054
|
+
*/
|
|
2055
|
+
markDefaulted(cycleId: string, debtor: string, waitOptions?: TxReceiptWaitOptions): Promise<viem.TransactionReceipt>;
|
|
2056
|
+
/**
|
|
2057
|
+
* Initiate a collateral withdrawal request. The withdrawal is subject to an
|
|
2058
|
+
* on-chain timelock before it can be finalised.
|
|
2059
|
+
*
|
|
2060
|
+
* @param amount - Amount to withdraw (base units / wei).
|
|
2061
|
+
* @param erc20Token - ERC20 token address. Omit to withdraw ETH.
|
|
2062
|
+
* @param waitOptions - Optional timeout/polling overrides.
|
|
2063
|
+
*/
|
|
2064
|
+
requestWithdrawal(amount: number | bigint | string, erc20Token?: string, waitOptions?: TxReceiptWaitOptions): Promise<viem.TransactionReceipt>;
|
|
2065
|
+
/**
|
|
2066
|
+
* Cancel a pending withdrawal request before the timelock expires.
|
|
2067
|
+
*
|
|
2068
|
+
* @param erc20Token - ERC20 token address. Omit to cancel an ETH withdrawal.
|
|
2069
|
+
* @param waitOptions - Optional timeout/polling overrides.
|
|
2070
|
+
*/
|
|
2071
|
+
cancelWithdrawal(erc20Token?: string, waitOptions?: TxReceiptWaitOptions): Promise<viem.TransactionReceipt>;
|
|
2072
|
+
/**
|
|
2073
|
+
* Finalise a withdrawal after the timelock has elapsed.
|
|
2074
|
+
*
|
|
2075
|
+
* @param erc20Token - ERC20 token address. Omit to finalise an ETH withdrawal.
|
|
2076
|
+
* @param waitOptions - Optional timeout/polling overrides.
|
|
2077
|
+
*/
|
|
2078
|
+
finalizeWithdrawal(erc20Token?: string, waitOptions?: TxReceiptWaitOptions): Promise<viem.TransactionReceipt>;
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
/** Validated configuration used to construct a {@link Client}. Produced by {@link ConfigBuilder.build}. */
|
|
2082
|
+
interface Config {
|
|
2083
|
+
/** URL of the 4Mica core RPC service. */
|
|
2084
|
+
rpcUrl: string;
|
|
2085
|
+
/** viem `Account` used to sign payments and authenticate requests. */
|
|
2086
|
+
signer: Account$1;
|
|
2087
|
+
/** Override for the Ethereum HTTP RPC URL (defaults to the value returned by the core service). */
|
|
2088
|
+
ethereumHttpRpcUrl?: string;
|
|
2089
|
+
/** Override for the Core4Mica contract address (defaults to the value returned by the core service). */
|
|
2090
|
+
contractAddress?: string;
|
|
2091
|
+
/** API key for admin-scoped RPC endpoints. */
|
|
2092
|
+
adminApiKey?: string;
|
|
2093
|
+
/** Static bearer token for authenticated RPC calls. Mutually exclusive with SIWE auth. */
|
|
2094
|
+
bearerToken?: string;
|
|
2095
|
+
/** URL of the SIWE authentication endpoint. Defaults to `rpcUrl` when auth is enabled. */
|
|
2096
|
+
authUrl?: string;
|
|
2097
|
+
/** Seconds before token expiry at which the auth session proactively refreshes. Defaults to 60. */
|
|
2098
|
+
authRefreshMarginSecs?: number;
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
/**
|
|
2102
|
+
* Fluent builder for {@link Config}.
|
|
2103
|
+
*
|
|
2104
|
+
* @example
|
|
2105
|
+
* ```ts
|
|
2106
|
+
* const cfg = new ConfigBuilder()
|
|
2107
|
+
* .walletPrivateKey('0x...')
|
|
2108
|
+
* .build();
|
|
2109
|
+
* ```
|
|
2110
|
+
*
|
|
2111
|
+
* All fields can also be supplied from environment variables via {@link fromEnv}.
|
|
2112
|
+
*/
|
|
2113
|
+
declare class ConfigBuilder {
|
|
2114
|
+
private _rpcUrl;
|
|
2115
|
+
private _walletPrivateKey;
|
|
2116
|
+
private _signer;
|
|
2117
|
+
private _ethereumHttpRpcUrl?;
|
|
2118
|
+
private _contractAddress?;
|
|
2119
|
+
private _adminApiKey?;
|
|
2120
|
+
private _bearerToken?;
|
|
2121
|
+
private _authEnabled;
|
|
2122
|
+
private _authUrl?;
|
|
2123
|
+
private _authRefreshMarginSecs?;
|
|
2124
|
+
/** Set the 4Mica core RPC URL directly. Use {@link network} to select a hosted network by name instead. Defaults to `https://ethereum.sepolia.api.4mica.xyz/`. */
|
|
2125
|
+
rpcUrl(value: string): ConfigBuilder;
|
|
2126
|
+
/**
|
|
2127
|
+
* Select a hosted 4Mica network by shorthand or CAIP-2 identifier.
|
|
2128
|
+
* Resolves to the corresponding core API URL.
|
|
2129
|
+
* Mutually exclusive with {@link rpcUrl} — last call wins.
|
|
2130
|
+
*
|
|
2131
|
+
* Supported values: `"base"` / `"eip155:8453"`, `"base-sepolia"` / `"eip155:84532"`,
|
|
2132
|
+
* `"ethereum-sepolia"` / `"eip155:11155111"`.
|
|
2133
|
+
*
|
|
2134
|
+
* @throws {@link ConfigError} if the network is not recognised.
|
|
2135
|
+
*
|
|
2136
|
+
* @example
|
|
2137
|
+
* ```ts
|
|
2138
|
+
* new ConfigBuilder().network("base").walletPrivateKey("0x...").build();
|
|
2139
|
+
* new ConfigBuilder().network("eip155:8453").walletPrivateKey("0x...").build();
|
|
2140
|
+
* ```
|
|
2141
|
+
*/
|
|
2142
|
+
network(value: string): ConfigBuilder;
|
|
2143
|
+
/** Set the wallet private key (hex string). Mutually exclusive with {@link signer}. */
|
|
2144
|
+
walletPrivateKey(value: string): ConfigBuilder;
|
|
2145
|
+
/** Set a pre-built viem `Account` directly. Mutually exclusive with {@link walletPrivateKey}. */
|
|
2146
|
+
signer(value: Account$1): ConfigBuilder;
|
|
2147
|
+
/** Override the Ethereum HTTP RPC URL used for on-chain calls. */
|
|
2148
|
+
ethereumHttpRpcUrl(value: string): ConfigBuilder;
|
|
2149
|
+
/** Override the Core4Mica contract address. */
|
|
2150
|
+
contractAddress(value: string): ConfigBuilder;
|
|
2151
|
+
/** Set an admin API key for privileged RPC endpoints. */
|
|
2152
|
+
adminApiKey(value: string): ConfigBuilder;
|
|
2153
|
+
/** Set a static bearer token for authenticated RPC calls. Disables SIWE auth. */
|
|
2154
|
+
bearerToken(value: string): ConfigBuilder;
|
|
2155
|
+
/** Enable SIWE authentication using the default RPC URL as the auth endpoint. Auth is enabled by default; this is a no-op unless you previously called a method that disabled it. */
|
|
2156
|
+
enableAuth(): ConfigBuilder;
|
|
2157
|
+
/** Set a custom SIWE authentication endpoint and enable auth. */
|
|
2158
|
+
authUrl(value: string): ConfigBuilder;
|
|
2159
|
+
/** Set the number of seconds before token expiry at which the session proactively refreshes. Enables auth. */
|
|
2160
|
+
authRefreshMarginSecs(value: number): ConfigBuilder;
|
|
2161
|
+
/**
|
|
2162
|
+
* Load configuration from environment variables.
|
|
2163
|
+
*
|
|
2164
|
+
* Recognised variables:
|
|
2165
|
+
* - `4MICA_NETWORK` — shorthand or CAIP-2 id (e.g. `base`); takes precedence over `4MICA_RPC_URL`
|
|
2166
|
+
* - `4MICA_RPC_URL`
|
|
2167
|
+
* - `4MICA_WALLET_PRIVATE_KEY`
|
|
2168
|
+
* - `4MICA_ETHEREUM_HTTP_RPC_URL`
|
|
2169
|
+
* - `4MICA_CONTRACT_ADDRESS`
|
|
2170
|
+
* - `4MICA_ADMIN_API_KEY`
|
|
2171
|
+
* - `4MICA_BEARER_TOKEN`
|
|
2172
|
+
* - `4MICA_AUTH_URL`
|
|
2173
|
+
* - `4MICA_AUTH_REFRESH_MARGIN_SECS`
|
|
2174
|
+
*
|
|
2175
|
+
* @param source - Environment source to read from. Defaults to `process.env`
|
|
2176
|
+
* when available (Node/Bun) and an empty object otherwise. Runtime adapters
|
|
2177
|
+
* (`@4mica/sdk-node`, `@4mica/sdk-deno`, …) pass their runtime's env here so
|
|
2178
|
+
* the core stays free of any hard `process` reference.
|
|
2179
|
+
*/
|
|
2180
|
+
fromEnv(source?: Record<string, string | undefined>): ConfigBuilder;
|
|
2181
|
+
/**
|
|
2182
|
+
* Validate all settings and return an immutable {@link Config}.
|
|
2183
|
+
*
|
|
2184
|
+
* @throws {@link ConfigError} if required fields are missing, URLs are invalid,
|
|
2185
|
+
* or the auth refresh margin is not a finite non-negative number.
|
|
2186
|
+
*/
|
|
2187
|
+
build(): Config;
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
/** Binding domain string used as a prefix when hashing validation subjects. */
|
|
2191
|
+
declare const VALIDATION_SUBJECT_BINDING_DOMAIN = "4MICA_VALIDATION_SUBJECT_V1";
|
|
2192
|
+
/** Binding domain string used as a prefix when hashing validation requests. */
|
|
2193
|
+
declare const VALIDATION_REQUEST_BINDING_DOMAIN = "4MICA_VALIDATION_REQUEST_V2";
|
|
2194
|
+
/**
|
|
2195
|
+
* Compute the `validationSubjectHash` for a V2 payment guarantee request.
|
|
2196
|
+
*
|
|
2197
|
+
* Binds the payment subject (req, user, recipient, amount, asset, timestamp) to
|
|
2198
|
+
* a keccak256 hash prefixed by {@link VALIDATION_SUBJECT_BINDING_DOMAIN} so that
|
|
2199
|
+
* on-chain validators can verify which payment the validation refers to.
|
|
2200
|
+
*
|
|
2201
|
+
* @param claims - V1 base claims (the subject fields are the same for V1 and V2).
|
|
2202
|
+
* @returns 32-byte keccak256 hash as a `0x`-prefixed hex string.
|
|
2203
|
+
*/
|
|
2204
|
+
declare function computeValidationSubjectHash(claims: PaymentGuaranteeRequestClaims): Hex;
|
|
2205
|
+
/**
|
|
2206
|
+
* Compute the `validationRequestHash` for a V2 payment guarantee request.
|
|
2207
|
+
*
|
|
2208
|
+
* Binds the full validation policy (chain, registry, validator, score threshold,
|
|
2209
|
+
* subject hash, required tag, job hash) to a keccak256 hash prefixed by
|
|
2210
|
+
* {@link VALIDATION_REQUEST_BINDING_DOMAIN}. This hash is included in the V2 claims
|
|
2211
|
+
* that are BLS-signed by the core service, allowing on-chain verification that the
|
|
2212
|
+
* validation policy was not tampered with.
|
|
2213
|
+
*
|
|
2214
|
+
* @param claims - V2 claims with all validation policy fields populated.
|
|
2215
|
+
* The `validationSubjectHash` field must already be computed via
|
|
2216
|
+
* {@link computeValidationSubjectHash} before calling this function.
|
|
2217
|
+
* @returns 32-byte keccak256 hash as a `0x`-prefixed hex string.
|
|
2218
|
+
*/
|
|
2219
|
+
declare function computeValidationRequestHash(claims: PaymentGuaranteeRequestClaimsV2): Hex;
|
|
2220
|
+
|
|
2221
|
+
type GuaranteeTypedDataValidationOptions = {
|
|
2222
|
+
expectedChainId?: number;
|
|
2223
|
+
expectedSigner?: string;
|
|
2224
|
+
expectedRecipient?: string;
|
|
2225
|
+
};
|
|
2226
|
+
type GuaranteeSigningContextOptions = {
|
|
2227
|
+
signerAddress?: string;
|
|
2228
|
+
signerChainId?: number;
|
|
2229
|
+
};
|
|
2230
|
+
|
|
2231
|
+
declare const GUARANTEE_EIP712_TYPES: {
|
|
2232
|
+
readonly EIP712Domain: readonly [{
|
|
2233
|
+
readonly name: "name";
|
|
2234
|
+
readonly type: "string";
|
|
2235
|
+
}, {
|
|
2236
|
+
readonly name: "version";
|
|
2237
|
+
readonly type: "string";
|
|
2238
|
+
}, {
|
|
2239
|
+
readonly name: "chainId";
|
|
2240
|
+
readonly type: "uint256";
|
|
2241
|
+
}];
|
|
2242
|
+
readonly SolGuaranteeRequestClaimsV1: readonly [{
|
|
2243
|
+
readonly name: "user";
|
|
2244
|
+
readonly type: "address";
|
|
2245
|
+
}, {
|
|
2246
|
+
readonly name: "recipient";
|
|
2247
|
+
readonly type: "address";
|
|
2248
|
+
}, {
|
|
2249
|
+
readonly name: "reqId";
|
|
2250
|
+
readonly type: "uint256";
|
|
2251
|
+
}, {
|
|
2252
|
+
readonly name: "amount";
|
|
2253
|
+
readonly type: "uint256";
|
|
2254
|
+
}, {
|
|
2255
|
+
readonly name: "asset";
|
|
2256
|
+
readonly type: "address";
|
|
2257
|
+
}, {
|
|
2258
|
+
readonly name: "timestamp";
|
|
2259
|
+
readonly type: "uint64";
|
|
2260
|
+
}];
|
|
2261
|
+
};
|
|
2262
|
+
declare const GUARANTEE_EIP712_TYPES_V2: {
|
|
2263
|
+
readonly EIP712Domain: readonly [{
|
|
2264
|
+
readonly name: "name";
|
|
2265
|
+
readonly type: "string";
|
|
2266
|
+
}, {
|
|
2267
|
+
readonly name: "version";
|
|
2268
|
+
readonly type: "string";
|
|
2269
|
+
}, {
|
|
2270
|
+
readonly name: "chainId";
|
|
2271
|
+
readonly type: "uint256";
|
|
2272
|
+
}];
|
|
2273
|
+
readonly SolGuaranteeRequestClaimsV2: readonly [{
|
|
2274
|
+
readonly name: "user";
|
|
2275
|
+
readonly type: "address";
|
|
2276
|
+
}, {
|
|
2277
|
+
readonly name: "recipient";
|
|
2278
|
+
readonly type: "address";
|
|
2279
|
+
}, {
|
|
2280
|
+
readonly name: "reqId";
|
|
2281
|
+
readonly type: "uint256";
|
|
2282
|
+
}, {
|
|
2283
|
+
readonly name: "amount";
|
|
2284
|
+
readonly type: "uint256";
|
|
2285
|
+
}, {
|
|
2286
|
+
readonly name: "asset";
|
|
2287
|
+
readonly type: "address";
|
|
2288
|
+
}, {
|
|
2289
|
+
readonly name: "timestamp";
|
|
2290
|
+
readonly type: "uint64";
|
|
2291
|
+
}, {
|
|
2292
|
+
readonly name: "validationRegistryAddress";
|
|
2293
|
+
readonly type: "address";
|
|
2294
|
+
}, {
|
|
2295
|
+
readonly name: "validationRequestHash";
|
|
2296
|
+
readonly type: "bytes32";
|
|
2297
|
+
}, {
|
|
2298
|
+
readonly name: "validationChainId";
|
|
2299
|
+
readonly type: "uint256";
|
|
2300
|
+
}, {
|
|
2301
|
+
readonly name: "validatorAddress";
|
|
2302
|
+
readonly type: "address";
|
|
2303
|
+
}, {
|
|
2304
|
+
readonly name: "validatorAgentId";
|
|
2305
|
+
readonly type: "uint256";
|
|
2306
|
+
}, {
|
|
2307
|
+
readonly name: "minValidationScore";
|
|
2308
|
+
readonly type: "uint8";
|
|
2309
|
+
}, {
|
|
2310
|
+
readonly name: "validationSubjectHash";
|
|
2311
|
+
readonly type: "bytes32";
|
|
2312
|
+
}, {
|
|
2313
|
+
readonly name: "jobHash";
|
|
2314
|
+
readonly type: "bytes32";
|
|
2315
|
+
}, {
|
|
2316
|
+
readonly name: "requiredValidationTag";
|
|
2317
|
+
readonly type: "string";
|
|
2318
|
+
}];
|
|
2319
|
+
};
|
|
2320
|
+
type GuaranteeTypedData = {
|
|
2321
|
+
types: typeof GUARANTEE_EIP712_TYPES;
|
|
2322
|
+
primaryType: "SolGuaranteeRequestClaimsV1";
|
|
2323
|
+
domain: {
|
|
2324
|
+
name: string;
|
|
2325
|
+
version: string;
|
|
2326
|
+
chainId: number;
|
|
2327
|
+
};
|
|
2328
|
+
message: {
|
|
2329
|
+
user: Hex;
|
|
2330
|
+
recipient: Hex;
|
|
2331
|
+
reqId: bigint;
|
|
2332
|
+
amount: bigint;
|
|
2333
|
+
asset: Hex;
|
|
2334
|
+
timestamp: bigint;
|
|
2335
|
+
};
|
|
2336
|
+
};
|
|
2337
|
+
type GuaranteeTypedDataV2 = {
|
|
2338
|
+
types: typeof GUARANTEE_EIP712_TYPES_V2;
|
|
2339
|
+
primaryType: "SolGuaranteeRequestClaimsV2";
|
|
2340
|
+
domain: {
|
|
2341
|
+
name: string;
|
|
2342
|
+
version: string;
|
|
2343
|
+
chainId: number;
|
|
2344
|
+
};
|
|
2345
|
+
message: {
|
|
2346
|
+
user: Hex;
|
|
2347
|
+
recipient: Hex;
|
|
2348
|
+
reqId: bigint;
|
|
2349
|
+
amount: bigint;
|
|
2350
|
+
asset: Hex;
|
|
2351
|
+
timestamp: bigint;
|
|
2352
|
+
validationRegistryAddress: Hex;
|
|
2353
|
+
validationRequestHash: Hex;
|
|
2354
|
+
validationChainId: bigint;
|
|
2355
|
+
validatorAddress: Hex;
|
|
2356
|
+
validatorAgentId: bigint;
|
|
2357
|
+
minValidationScore: number;
|
|
2358
|
+
validationSubjectHash: Hex;
|
|
2359
|
+
jobHash: Hex;
|
|
2360
|
+
requiredValidationTag: string;
|
|
2361
|
+
};
|
|
2362
|
+
};
|
|
2363
|
+
declare function validateGuaranteeTypedData(payload: {
|
|
2364
|
+
domain: Record<string, unknown>;
|
|
2365
|
+
types: Record<string, Array<{
|
|
2366
|
+
name: string;
|
|
2367
|
+
type: string;
|
|
2368
|
+
}>>;
|
|
2369
|
+
message: Record<string, unknown>;
|
|
2370
|
+
}, options?: GuaranteeTypedDataValidationOptions): void;
|
|
2371
|
+
declare function validateGuaranteeSigningContext(params: CorePublicParameters, claims: PaymentGuaranteeRequestClaims, options?: GuaranteeSigningContextOptions): void;
|
|
2372
|
+
declare function buildGuaranteeTypedData(params: CorePublicParameters, claims: PaymentGuaranteeRequestClaims): GuaranteeTypedData;
|
|
2373
|
+
declare function buildGuaranteeTypedDataV2(params: CorePublicParameters, claims: PaymentGuaranteeRequestClaimsV2): GuaranteeTypedDataV2;
|
|
2374
|
+
declare function encodeGuaranteeEip191V2(claims: PaymentGuaranteeRequestClaimsV2): string;
|
|
2375
|
+
declare function encodeGuaranteeEip191(claims: PaymentGuaranteeRequestClaims): string;
|
|
2376
|
+
declare class PaymentSigner {
|
|
2377
|
+
readonly signer: Account;
|
|
2378
|
+
constructor(signer: Account);
|
|
2379
|
+
signRequest(params: CorePublicParameters, claims: PaymentGuaranteeRequestClaims | PaymentGuaranteeRequestClaimsV2, scheme?: SigningScheme): Promise<PaymentSignature>;
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2382
|
+
/**
|
|
2383
|
+
* Top-level SDK client. Holds a live connection to the 4Mica core RPC and the
|
|
2384
|
+
* on-chain Core4Mica contract. Obtain an instance via {@link Client.new}.
|
|
2385
|
+
*
|
|
2386
|
+
* @example
|
|
2387
|
+
* ```ts
|
|
2388
|
+
* const cfg = new ConfigBuilder().walletPrivateKey("0x...").build();
|
|
2389
|
+
* const client = await Client.new(cfg);
|
|
2390
|
+
* try {
|
|
2391
|
+
* // client.user – payer-side operations
|
|
2392
|
+
* // client.recipient – recipient-side operations
|
|
2393
|
+
* } finally {
|
|
2394
|
+
* await client.aclose();
|
|
2395
|
+
* }
|
|
2396
|
+
* ```
|
|
2397
|
+
*/
|
|
2398
|
+
declare class Client {
|
|
2399
|
+
/** Low-level RPC proxy to the 4Mica core service. */
|
|
2400
|
+
readonly rpc: RpcProxy;
|
|
2401
|
+
/** Chain and contract parameters fetched from the core service at startup. */
|
|
2402
|
+
readonly params: CorePublicParameters;
|
|
2403
|
+
/** viem-backed gateway for on-chain calls (deposit, claimNetCredit, …). */
|
|
2404
|
+
readonly gateway: ContractGateway;
|
|
2405
|
+
/** 32-byte domain separator used to verify V1 BLS guarantee certificates. */
|
|
2406
|
+
readonly guaranteeDomain: string;
|
|
2407
|
+
/** Payer-side operations: deposit, sign, withdraw. */
|
|
2408
|
+
readonly user: UserClient;
|
|
2409
|
+
/** Recipient-side operations: tabs, guarantees, remuneration. */
|
|
2410
|
+
readonly recipient: RecipientClient;
|
|
2411
|
+
/** Payment signing wrapper around the configured viem Account. */
|
|
2412
|
+
readonly signer: PaymentSigner;
|
|
2413
|
+
private authSession?;
|
|
2414
|
+
private constructor();
|
|
2415
|
+
/**
|
|
2416
|
+
* Create and fully initialise a Client.
|
|
2417
|
+
*
|
|
2418
|
+
* Fetches public parameters from the core service, validates that the
|
|
2419
|
+
* Ethereum RPC is on the expected chain, and sets up SIWE auth if configured.
|
|
2420
|
+
*
|
|
2421
|
+
* @param cfg - Validated configuration produced by {@link ConfigBuilder.build}.
|
|
2422
|
+
* @throws {@link ConfigError} if the configuration is invalid.
|
|
2423
|
+
* @throws {@link RpcError} if the core service is unreachable.
|
|
2424
|
+
* @throws {@link ContractError} if the Ethereum RPC returns the wrong chain ID.
|
|
2425
|
+
*/
|
|
2426
|
+
static new(cfg: Config): Promise<Client>;
|
|
2427
|
+
private static buildGateway;
|
|
2428
|
+
/**
|
|
2429
|
+
* Release client resources. Safe to call multiple times.
|
|
2430
|
+
* Use in a `finally` block to ensure cleanup after use.
|
|
2431
|
+
*/
|
|
2432
|
+
aclose(): Promise<void>;
|
|
2433
|
+
/**
|
|
2434
|
+
* Perform an explicit SIWE login and return the resulting tokens.
|
|
2435
|
+
*
|
|
2436
|
+
* Not required for normal operation — the first authenticated RPC call
|
|
2437
|
+
* triggers auth automatically. Call this to pre-warm the session.
|
|
2438
|
+
*
|
|
2439
|
+
* @throws {@link AuthMissingConfigError} if auth was not enabled in the config.
|
|
2440
|
+
*/
|
|
2441
|
+
login(): Promise<AuthTokens>;
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
/** Base class for all 4Mica SDK errors. Sets `error.name` to the subclass name. */
|
|
2445
|
+
declare class FourMicaError extends Error {
|
|
2446
|
+
constructor(message: string);
|
|
2447
|
+
}
|
|
2448
|
+
/** Thrown when the SDK configuration is invalid (e.g. missing required fields or bad URL). */
|
|
2449
|
+
declare class ConfigError extends FourMicaError {
|
|
2450
|
+
}
|
|
2451
|
+
/** Thrown when a 4Mica core RPC call fails. Includes the HTTP status and raw response body. */
|
|
2452
|
+
declare class RpcError extends FourMicaError {
|
|
2453
|
+
readonly status?: number;
|
|
2454
|
+
readonly body?: unknown;
|
|
2455
|
+
constructor(message: string, options?: {
|
|
2456
|
+
status?: number;
|
|
2457
|
+
body?: unknown;
|
|
2458
|
+
});
|
|
2459
|
+
}
|
|
2460
|
+
/** Thrown when the SDK client fails to initialise (e.g. chain ID mismatch). */
|
|
2461
|
+
declare class ClientInitializationError extends FourMicaError {
|
|
2462
|
+
}
|
|
2463
|
+
/** Thrown when signing a payment claim fails (e.g. unsupported scheme, address mismatch). */
|
|
2464
|
+
declare class SigningError extends FourMicaError {
|
|
2465
|
+
}
|
|
2466
|
+
/** Thrown when an on-chain contract call fails or returns an unexpected result. */
|
|
2467
|
+
declare class ContractError extends FourMicaError {
|
|
2468
|
+
}
|
|
2469
|
+
/** Thrown when BLS certificate verification fails (e.g. domain mismatch, invalid encoding). */
|
|
2470
|
+
declare class VerificationError extends FourMicaError {
|
|
2471
|
+
}
|
|
2472
|
+
/** Thrown when an x402 HTTP payment flow encounters an error. */
|
|
2473
|
+
declare class X402Error extends FourMicaError {
|
|
2474
|
+
}
|
|
2475
|
+
/** Base class for authentication-related errors. */
|
|
2476
|
+
declare class AuthError extends FourMicaError {
|
|
2477
|
+
}
|
|
2478
|
+
/** Thrown when the auth URL is invalid or unreachable. */
|
|
2479
|
+
declare class AuthUrlError extends AuthError {
|
|
2480
|
+
}
|
|
2481
|
+
/** Thrown when a network-level error occurs during authentication. */
|
|
2482
|
+
declare class AuthTransportError extends AuthError {
|
|
2483
|
+
}
|
|
2484
|
+
/** Thrown when the auth server response cannot be decoded. */
|
|
2485
|
+
declare class AuthDecodeError extends AuthError {
|
|
2486
|
+
}
|
|
2487
|
+
/** Thrown when the auth server returns an error response. Includes HTTP status and body. */
|
|
2488
|
+
declare class AuthApiError extends AuthError {
|
|
2489
|
+
readonly status?: number;
|
|
2490
|
+
readonly body?: unknown;
|
|
2491
|
+
constructor(message: string, options?: {
|
|
2492
|
+
status?: number;
|
|
2493
|
+
body?: unknown;
|
|
2494
|
+
});
|
|
2495
|
+
}
|
|
2496
|
+
/** Thrown when auth configuration is invalid. */
|
|
2497
|
+
declare class AuthConfigError extends AuthError {
|
|
2498
|
+
}
|
|
2499
|
+
/** Thrown when an authenticated operation is attempted without auth being configured. */
|
|
2500
|
+
declare class AuthMissingConfigError extends AuthConfigError {
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2503
|
+
/**
|
|
2504
|
+
* ABI-encode a {@link PaymentGuaranteeClaims} object into a hex string.
|
|
2505
|
+
*
|
|
2506
|
+
* Produces the outer `(uint64 version, bytes innerClaims)` envelope format expected
|
|
2507
|
+
* by the Core4Mica contract. Supports V1 (9 fields) and V2 (18 fields with validation policy).
|
|
2508
|
+
*
|
|
2509
|
+
* @param claims - Decoded claims to encode. Must have `version` set to `1` or `2`.
|
|
2510
|
+
* @returns `0x`-prefixed hex string of the ABI-encoded envelope.
|
|
2511
|
+
* @throws {@link VerificationError} if `version` is not `1` or `2`, the domain is not 32 bytes,
|
|
2512
|
+
* or V2 claims are missing `validationPolicy`.
|
|
2513
|
+
*/
|
|
2514
|
+
declare function encodeGuaranteeClaims(claims: PaymentGuaranteeClaims): string;
|
|
2515
|
+
/**
|
|
2516
|
+
* Decode ABI-encoded guarantee claims into a {@link PaymentGuaranteeClaims} object.
|
|
2517
|
+
*
|
|
2518
|
+
* Accepts either the modern `(uint64 version, bytes innerClaims)` envelope or the legacy
|
|
2519
|
+
* unwrapped V1 format (raw 288-byte ABI encoding without an outer envelope).
|
|
2520
|
+
*
|
|
2521
|
+
* @param data - Hex string or raw bytes of the ABI-encoded claims.
|
|
2522
|
+
* @returns Decoded {@link PaymentGuaranteeClaims} with `version` set to `1` or `2`.
|
|
2523
|
+
* @throws {@link VerificationError} if the data is too short, the inner length is wrong,
|
|
2524
|
+
* or the encoded version number is unsupported.
|
|
2525
|
+
*/
|
|
2526
|
+
declare function decodeGuaranteeClaims(data: string | Uint8Array): PaymentGuaranteeClaims;
|
|
2527
|
+
|
|
2528
|
+
/** Metadata for a hosted 4Mica network deployment. */
|
|
2529
|
+
interface NetworkInfo {
|
|
2530
|
+
/** CAIP-2 network identifier (e.g. `eip155:84532`). */
|
|
2531
|
+
caip2: string;
|
|
2532
|
+
/** Hosted 4Mica core API URL for this network. */
|
|
2533
|
+
rpcUrl: string;
|
|
2534
|
+
/** Reliable public Ethereum RPC for on-chain calls (fallback when server doesn't provide one). */
|
|
2535
|
+
publicRpcUrl: string;
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2538
|
+
/**
|
|
2539
|
+
* Hosted 4Mica network deployments, keyed by human-readable shorthand.
|
|
2540
|
+
*
|
|
2541
|
+
* Pass the shorthand (or the CAIP-2 string) to {@link ConfigBuilder.network}
|
|
2542
|
+
* to select a network without writing a URL.
|
|
2543
|
+
*
|
|
2544
|
+
* @example
|
|
2545
|
+
* ```ts
|
|
2546
|
+
* import { Client, ConfigBuilder, NETWORKS } from "@4mica/sdk";
|
|
2547
|
+
*
|
|
2548
|
+
* // By shorthand
|
|
2549
|
+
* const cfg = new ConfigBuilder()
|
|
2550
|
+
* .network("base")
|
|
2551
|
+
* .walletPrivateKey("0x...")
|
|
2552
|
+
* .build();
|
|
2553
|
+
*
|
|
2554
|
+
* // Inspect available networks
|
|
2555
|
+
* console.log(NETWORKS["base"].caip2); // "eip155:8453"
|
|
2556
|
+
* ```
|
|
2557
|
+
*/
|
|
2558
|
+
declare const NETWORKS: Record<string, NetworkInfo>;
|
|
2559
|
+
/**
|
|
2560
|
+
* Resolve a network shorthand or CAIP-2 identifier to a core API URL.
|
|
2561
|
+
* Returns `undefined` if the identifier is not a known hosted network.
|
|
2562
|
+
*/
|
|
2563
|
+
declare function resolveNetworkRpcUrl(network: string): string | undefined;
|
|
2564
|
+
/**
|
|
2565
|
+
* Resolve a CAIP-2 identifier to a reliable public Ethereum RPC URL.
|
|
2566
|
+
* Returns `undefined` for unknown networks.
|
|
2567
|
+
*/
|
|
2568
|
+
declare function resolvePublicRpcUrl(caip2: string): string | undefined;
|
|
2569
|
+
|
|
2570
|
+
/**
|
|
2571
|
+
* Serialize V1 payment claims to the wire format expected by the core RPC.
|
|
2572
|
+
*
|
|
2573
|
+
* @param claims - V1 payment guarantee request claims.
|
|
2574
|
+
* @returns JSON-serialisable object with snake_case keys and hex-encoded `uint256` fields.
|
|
2575
|
+
*/
|
|
2576
|
+
declare function serializePaymentClaims(claims: PaymentGuaranteeRequestClaims): PaymentPayloadClaims;
|
|
2577
|
+
/**
|
|
2578
|
+
* Serialize V2 payment claims to the wire format expected by the core RPC.
|
|
2579
|
+
*
|
|
2580
|
+
* Extends the V1 serialisation with the nine additional validation policy fields.
|
|
2581
|
+
*
|
|
2582
|
+
* @param claims - V2 payment guarantee request claims with validation policy.
|
|
2583
|
+
* @returns JSON-serialisable object with snake_case keys and hex-encoded `uint256` fields.
|
|
2584
|
+
*/
|
|
2585
|
+
declare function serializePaymentClaimsV2(claims: PaymentGuaranteeRequestClaimsV2): PaymentPayloadClaimsV2;
|
|
2586
|
+
/**
|
|
2587
|
+
* Build a {@link PaymentPayload} from V2 claims and a {@link PaymentSignature}.
|
|
2588
|
+
*
|
|
2589
|
+
* @param claims - V2 payment guarantee request claims.
|
|
2590
|
+
* @param signature - Pre-built signature object (includes the scheme).
|
|
2591
|
+
*/
|
|
2592
|
+
declare function buildPaymentPayload(claims: PaymentGuaranteeRequestClaimsV2, signature: PaymentSignature): PaymentPayload;
|
|
2593
|
+
/**
|
|
2594
|
+
* Build a {@link PaymentPayload} from V2 claims, a raw signature hex string, and a scheme.
|
|
2595
|
+
*
|
|
2596
|
+
* @param claims - V2 payment guarantee request claims.
|
|
2597
|
+
* @param signature - 65-byte ECDSA signature as a `0x`-prefixed hex string.
|
|
2598
|
+
* @param scheme - Signing scheme used to produce the signature.
|
|
2599
|
+
*/
|
|
2600
|
+
declare function buildPaymentPayload(claims: PaymentGuaranteeRequestClaimsV2, signature: string, scheme: SigningScheme): PaymentPayload;
|
|
2601
|
+
/**
|
|
2602
|
+
* Build a {@link PaymentPayload} from V1 claims and a {@link PaymentSignature}.
|
|
2603
|
+
*
|
|
2604
|
+
* @param claims - V1 payment guarantee request claims.
|
|
2605
|
+
* @param signature - Pre-built signature object (includes the scheme).
|
|
2606
|
+
*/
|
|
2607
|
+
declare function buildPaymentPayload(claims: PaymentGuaranteeRequestClaims, signature: PaymentSignature): PaymentPayload;
|
|
2608
|
+
/**
|
|
2609
|
+
* Build a {@link PaymentPayload} from V1 claims, a raw signature hex string, and a scheme.
|
|
2610
|
+
*
|
|
2611
|
+
* @param claims - V1 payment guarantee request claims.
|
|
2612
|
+
* @param signature - 65-byte ECDSA signature as a `0x`-prefixed hex string.
|
|
2613
|
+
* @param scheme - Signing scheme used to produce the signature.
|
|
2614
|
+
* @throws {@link SigningError} if `signature` is a string but no `scheme` is provided.
|
|
2615
|
+
*/
|
|
2616
|
+
declare function buildPaymentPayload(claims: PaymentGuaranteeRequestClaims, signature: string, scheme: SigningScheme): PaymentPayload;
|
|
2617
|
+
|
|
2618
|
+
declare class ValidationError extends Error {
|
|
2619
|
+
constructor(message: string);
|
|
2620
|
+
}
|
|
2621
|
+
declare function validateUrl(raw: string): string;
|
|
2622
|
+
declare function normalizePrivateKey(raw: string): string;
|
|
2623
|
+
declare function normalizeAddress(raw: string): string;
|
|
2624
|
+
declare function ensureHexPrefix(value: string): Hex;
|
|
2625
|
+
declare function parseU256(value: number | bigint | string): bigint;
|
|
2626
|
+
declare function serializeU256(value: number | bigint | string): string;
|
|
2627
|
+
declare function hexFromBytes(bytes: Uint8Array): Hex;
|
|
2628
|
+
|
|
2629
|
+
interface CdpAccountConfig {
|
|
2630
|
+
/** CDP API key ID from the Coinbase Developer Platform dashboard. */
|
|
2631
|
+
apiKeyId: string;
|
|
2632
|
+
/** CDP API key secret from the Coinbase Developer Platform dashboard. */
|
|
2633
|
+
apiKeySecret: string;
|
|
2634
|
+
/** CDP wallet secret — required for account creation/signing operations. */
|
|
2635
|
+
walletSecret: string;
|
|
2636
|
+
/** Idempotency name — getOrCreateAccount always returns the same wallet for a given name. */
|
|
2637
|
+
name: string;
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
/** Creates a viem Account backed by a Coinbase CDP MPC wallet (private key never leaves CDP). */
|
|
2641
|
+
declare function createCdpAccount(config: CdpAccountConfig): Promise<Account>;
|
|
2642
|
+
|
|
2643
|
+
/**
|
|
2644
|
+
* Minimal signing interface required by {@link X402Flow}.
|
|
2645
|
+
* Implemented by {@link UserClient} from the main SDK client.
|
|
2646
|
+
*/
|
|
2647
|
+
interface FlowSigner {
|
|
2648
|
+
signPayment(claims: PaymentGuaranteeRequestClaims | PaymentGuaranteeRequestClaimsV2, scheme: SigningScheme): Promise<PaymentSignature>;
|
|
2649
|
+
}
|
|
2650
|
+
/**
|
|
2651
|
+
* Handles the x402 HTTP 402 payment protocol for 4Mica.
|
|
2652
|
+
*
|
|
2653
|
+
* Orchestrates the full client-side x402 flow: resolving a tab from the recipient's
|
|
2654
|
+
* tab endpoint, building and signing payment claims (V1 or V2), and optionally settling
|
|
2655
|
+
* the payment against a facilitator service.
|
|
2656
|
+
*
|
|
2657
|
+
* @example
|
|
2658
|
+
* ```ts
|
|
2659
|
+
* const flow = X402Flow.fromClient(client);
|
|
2660
|
+
* const signed = await flow.signPayment(paymentRequirements, userAddress);
|
|
2661
|
+
* // attach signed.header as the X-PAYMENT header on the protected request
|
|
2662
|
+
* ```
|
|
2663
|
+
*/
|
|
2664
|
+
declare class X402Flow {
|
|
2665
|
+
private signer;
|
|
2666
|
+
private fetchFn;
|
|
2667
|
+
/**
|
|
2668
|
+
* @param signer - Payment signer, typically `client.user`.
|
|
2669
|
+
* @param fetchFn - HTTP fetch implementation. Defaults to global `fetch`.
|
|
2670
|
+
*/
|
|
2671
|
+
constructor(signer: FlowSigner, fetchFn?: FetchFn);
|
|
2672
|
+
/**
|
|
2673
|
+
* Convenience factory — creates an `X402Flow` from the user sub-client of a `Client`.
|
|
2674
|
+
*
|
|
2675
|
+
* @param client - Any object with a `.user` property implementing {@link FlowSigner}.
|
|
2676
|
+
*/
|
|
2677
|
+
static fromClient(client: {
|
|
2678
|
+
user: FlowSigner;
|
|
2679
|
+
}): X402Flow;
|
|
2680
|
+
/**
|
|
2681
|
+
* Sign an x402 V1 payment.
|
|
2682
|
+
*
|
|
2683
|
+
* Resolves a tab from `paymentRequirements.extra.tabEndpoint`, builds V1 claims,
|
|
2684
|
+
* signs them with EIP-712, and returns the base64-encoded payment header together
|
|
2685
|
+
* with the raw payload and signature.
|
|
2686
|
+
*
|
|
2687
|
+
* @param paymentRequirements - V1 payment requirements from the `402 Payment Required` response.
|
|
2688
|
+
* @param userAddress - Address of the paying user.
|
|
2689
|
+
* @returns Signed payment ready to attach as the `X-PAYMENT` request header.
|
|
2690
|
+
* @throws {@link X402Error} if the scheme is not a 4Mica scheme or the tab endpoint fails.
|
|
2691
|
+
*/
|
|
2692
|
+
signPayment(paymentRequirements: PaymentRequirementsV1, userAddress: string): Promise<X402SignedPayment>;
|
|
2693
|
+
/**
|
|
2694
|
+
* Sign an x402 V2 payment, optionally including a V2 validation policy.
|
|
2695
|
+
*
|
|
2696
|
+
* If `accepted.extra` contains all required validation policy fields
|
|
2697
|
+
* (`validationRegistryAddress`, `validatorAddress`, `validatorAgentId`,
|
|
2698
|
+
* `minValidationScore`, `validationChainId`, `jobHash`), the claims are built as V2 with
|
|
2699
|
+
* the computed `validationSubjectHash` and `validationRequestHash`. Otherwise
|
|
2700
|
+
* falls back to V1 claims.
|
|
2701
|
+
*
|
|
2702
|
+
* @param paymentRequired - The original `402 Payment Required` response object.
|
|
2703
|
+
* @param accepted - The accepted V2 payment requirements.
|
|
2704
|
+
* @param userAddress - Address of the paying user.
|
|
2705
|
+
* @returns Signed payment ready to attach as the `X-PAYMENT` request header.
|
|
2706
|
+
* @throws {@link X402Error} if the scheme is not a 4Mica scheme or the tab endpoint fails.
|
|
2707
|
+
*/
|
|
2708
|
+
signPaymentV2(paymentRequired: X402PaymentRequired, accepted: PaymentRequirementsV2, userAddress: string): Promise<X402SignedPayment>;
|
|
2709
|
+
/**
|
|
2710
|
+
* Submit a signed payment to a facilitator for on-chain settlement.
|
|
2711
|
+
*
|
|
2712
|
+
* Sends a POST request to `{facilitatorUrl}/settle` with the payment header,
|
|
2713
|
+
* decoded payload, and payment requirements. Use this when the protected resource
|
|
2714
|
+
* requires facilitator-confirmed settlement before granting access.
|
|
2715
|
+
*
|
|
2716
|
+
* @param payment - Signed payment returned by {@link signPayment} or {@link signPaymentV2}.
|
|
2717
|
+
* @param paymentRequirements - V1 payment requirements included in the settlement request.
|
|
2718
|
+
* @param facilitatorUrl - Base URL of the facilitator service.
|
|
2719
|
+
* @returns The original payment plus the raw settlement response from the facilitator.
|
|
2720
|
+
* @throws {@link X402Error} if the facilitator returns a non-2xx response.
|
|
2721
|
+
*/
|
|
2722
|
+
settlePayment(payment: X402SignedPayment, paymentRequirements: PaymentRequirementsV1, facilitatorUrl: string): Promise<X402SettledPayment>;
|
|
2723
|
+
protected requestTab(guaranteeVersion: number, paymentRequirements: PaymentRequirementsV1 | PaymentRequirementsV2, userAddress: string, resource?: X402ResourceInfo): Promise<TabResponse>;
|
|
2724
|
+
protected buildClaims(requirements: PaymentRequirementsV1 | PaymentRequirementsV2, tab: TabResponse, userAddress: string): PaymentGuaranteeRequestClaims;
|
|
2725
|
+
protected buildClaimsV2(requirements: PaymentRequirementsV2, tab: TabResponse, userAddress: string): PaymentGuaranteeRequestClaimsV2;
|
|
2726
|
+
private static validateScheme;
|
|
2727
|
+
private static decodePaymentHeader;
|
|
2728
|
+
}
|
|
2729
|
+
|
|
2730
|
+
export { ADMIN_API_KEY_HEADER, ADMIN_API_KEY_PREFIX, ADMIN_SCOPE_MANAGE_KEYS, ADMIN_SCOPE_SUSPEND_USERS, AdminApiKeyInfo, AdminApiKeySecret, AssetBalanceInfo, AuthApiError, AuthClient, AuthConfigError, AuthDecodeError, AuthError, AuthMissingConfigError, type AuthNonceResponse, AuthSession, type AuthTokens, AuthTransportError, AuthUrlError, BLSCert, type BearerTokenProvider, type CdpAccountConfig, ClearingParticipantProof, ClearingSettlementActionKind, ClearingSettlementActionResponse, Client, ClientInitializationError, type Config, ConfigBuilder, ConfigError, ContractError, ContractGateway, CorePublicParameters, type FetchFn, type FlowSigner, FourMicaError, GUARANTEE_EIP712_TYPES, GUARANTEE_EIP712_TYPES_V2, type GuaranteeSigningContextOptions, type GuaranteeTypedData, type GuaranteeTypedDataV2, type GuaranteeTypedDataValidationOptions, NETWORKS, type NetworkInfo, PaymentGuaranteeClaims, PaymentGuaranteeRequestClaims, PaymentGuaranteeRequestClaimsV2, PaymentPayload, PaymentPayloadClaims, PaymentPayloadClaimsV2, PaymentRequirementsV1, PaymentRequirementsV2, PaymentSignature, PaymentSigner, RecipientClient, RecipientPaymentInfo, RpcError, RpcProxy, SigningError, SigningScheme, type SiweTemplate, SupportedTokensResponse, TabResponse, type TxReceiptWaitOptions, UserClient, UserInfo, UserSuspensionStatus, VALIDATION_REQUEST_BINDING_DOMAIN, VALIDATION_SUBJECT_BINDING_DOMAIN, ValidationError, VerificationError, X402Error, X402Flow, X402PaymentRequired, X402ResourceInfo, X402SettledPayment, X402SignedPayment, buildGuaranteeTypedData, buildGuaranteeTypedDataV2, buildPaymentPayload, buildSiweMessage, computeValidationRequestHash, computeValidationSubjectHash, createCdpAccount, decodeGuaranteeClaims, encodeGuaranteeClaims, encodeGuaranteeEip191, encodeGuaranteeEip191V2, ensureHexPrefix, hexFromBytes, normalizeAddress, normalizePrivateKey, parseU256, resolveNetworkRpcUrl, resolvePublicRpcUrl, serializePaymentClaims, serializePaymentClaimsV2, serializeU256, signatureToWords, signatureToWordsAsync, validateGuaranteeSigningContext, validateGuaranteeTypedData, validateUrl };
|