@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/src/models.d.ts
DELETED
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
export { ADMIN_API_KEY_HEADER, ADMIN_API_KEY_PREFIX, ADMIN_SCOPE_MANAGE_KEYS, ADMIN_SCOPE_SUSPEND_USERS, } from './constants';
|
|
2
|
-
/** Signing scheme used when producing a payment guarantee signature. */
|
|
3
|
-
export declare enum SigningScheme {
|
|
4
|
-
/** EIP-712 typed-data signing (default, preferred). */
|
|
5
|
-
EIP712 = "eip712",
|
|
6
|
-
/** EIP-191 personal_sign (for wallets that do not support typed data). */
|
|
7
|
-
EIP191 = "eip191"
|
|
8
|
-
}
|
|
9
|
-
/** ECDSA signature and the scheme used to produce it. */
|
|
10
|
-
export interface PaymentSignature {
|
|
11
|
-
/** 65-byte ECDSA signature as a `0x`-prefixed hex string. */
|
|
12
|
-
signature: string;
|
|
13
|
-
scheme: SigningScheme;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* V1 payment guarantee request claims. Signed by the payer and submitted to the
|
|
17
|
-
* core RPC to obtain a BLS guarantee certificate.
|
|
18
|
-
*
|
|
19
|
-
* Build with the static {@link PaymentGuaranteeRequestClaims.new} factory which
|
|
20
|
-
* normalises addresses and parses `uint256` values.
|
|
21
|
-
*/
|
|
22
|
-
export declare class PaymentGuaranteeRequestClaims {
|
|
23
|
-
userAddress: string;
|
|
24
|
-
recipientAddress: string;
|
|
25
|
-
tabId: bigint;
|
|
26
|
-
reqId: bigint;
|
|
27
|
-
amount: bigint;
|
|
28
|
-
timestamp: number;
|
|
29
|
-
assetAddress: string;
|
|
30
|
-
constructor(init: {
|
|
31
|
-
userAddress: string;
|
|
32
|
-
recipientAddress: string;
|
|
33
|
-
tabId: bigint;
|
|
34
|
-
reqId?: bigint;
|
|
35
|
-
amount: bigint;
|
|
36
|
-
timestamp: number;
|
|
37
|
-
assetAddress: string;
|
|
38
|
-
});
|
|
39
|
-
static new(userAddress: string, recipientAddress: string, tabId: number | bigint | string, amount: number | bigint | string, timestamp: number, erc20Token?: string | null, reqId?: number | bigint | string): PaymentGuaranteeRequestClaims;
|
|
40
|
-
}
|
|
41
|
-
/** On-chain validation policy fields carried in a V2 payment guarantee certificate. */
|
|
42
|
-
export interface PaymentGuaranteeValidationPolicyV2 {
|
|
43
|
-
validationRegistryAddress: string;
|
|
44
|
-
validationRequestHash: string;
|
|
45
|
-
validationChainId: number;
|
|
46
|
-
validatorAddress: string;
|
|
47
|
-
validatorAgentId: bigint;
|
|
48
|
-
minValidationScore: number;
|
|
49
|
-
validationSubjectHash: string;
|
|
50
|
-
jobHash: string;
|
|
51
|
-
requiredValidationTag: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* V2 payment guarantee request claims — extends V1 with a full on-chain validation policy.
|
|
55
|
-
*
|
|
56
|
-
* Compute `validationSubjectHash` via `computeValidationSubjectHash(baseClaims)` and
|
|
57
|
-
* `validationRequestHash` via `computeValidationRequestHash(partialV2)` before constructing.
|
|
58
|
-
* The `jobHash` must be provided and included in the validation request hash.
|
|
59
|
-
*
|
|
60
|
-
* @throws {@link ValidationError} if `minValidationScore` is outside [1, 100].
|
|
61
|
-
*/
|
|
62
|
-
export declare class PaymentGuaranteeRequestClaimsV2 extends PaymentGuaranteeRequestClaims {
|
|
63
|
-
validationRegistryAddress: string;
|
|
64
|
-
validationRequestHash: string;
|
|
65
|
-
validationChainId: number;
|
|
66
|
-
validatorAddress: string;
|
|
67
|
-
validatorAgentId: bigint;
|
|
68
|
-
minValidationScore: number;
|
|
69
|
-
validationSubjectHash: string;
|
|
70
|
-
jobHash: string;
|
|
71
|
-
requiredValidationTag: string;
|
|
72
|
-
constructor(init: {
|
|
73
|
-
userAddress: string;
|
|
74
|
-
recipientAddress: string;
|
|
75
|
-
tabId: bigint;
|
|
76
|
-
reqId?: bigint;
|
|
77
|
-
amount: bigint;
|
|
78
|
-
timestamp: number;
|
|
79
|
-
assetAddress: string;
|
|
80
|
-
validationRegistryAddress: string;
|
|
81
|
-
validationRequestHash: string;
|
|
82
|
-
validationChainId: number;
|
|
83
|
-
validatorAddress: string;
|
|
84
|
-
validatorAgentId: bigint;
|
|
85
|
-
minValidationScore: number;
|
|
86
|
-
validationSubjectHash: string;
|
|
87
|
-
jobHash: string;
|
|
88
|
-
requiredValidationTag: string;
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Decoded payment guarantee claims, as returned by `decodeGuaranteeClaims`.
|
|
93
|
-
* `version` is `1` for V1 certificates and `2` for V2 certificates.
|
|
94
|
-
* V2 certificates additionally carry a `validationPolicy`.
|
|
95
|
-
*/
|
|
96
|
-
export interface PaymentGuaranteeClaims {
|
|
97
|
-
domain: Uint8Array;
|
|
98
|
-
userAddress: string;
|
|
99
|
-
recipientAddress: string;
|
|
100
|
-
tabId: bigint;
|
|
101
|
-
reqId: bigint;
|
|
102
|
-
amount: bigint;
|
|
103
|
-
totalAmount: bigint;
|
|
104
|
-
assetAddress: string;
|
|
105
|
-
timestamp: number;
|
|
106
|
-
version: number;
|
|
107
|
-
validationPolicy?: PaymentGuaranteeValidationPolicyV2;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* BLS guarantee certificate returned by `issuePaymentGuarantee`.
|
|
111
|
-
* Both fields are `0x`-prefixed hex strings.
|
|
112
|
-
*/
|
|
113
|
-
export interface BLSCert {
|
|
114
|
-
/** ABI-encoded `(uint64 version, bytes innerClaims)` envelope as a hex string. */
|
|
115
|
-
claims: string;
|
|
116
|
-
/** BLS12-381 G2 signature as a hex string. */
|
|
117
|
-
signature: string;
|
|
118
|
-
}
|
|
119
|
-
/** On-chain payment status of a tab, returned by `getTabPaymentStatus`. */
|
|
120
|
-
export interface TabPaymentStatus {
|
|
121
|
-
/** Cumulative amount paid so far (in token base units). */
|
|
122
|
-
paid: bigint;
|
|
123
|
-
/** Whether the recipient has already called `remunerate` on-chain. */
|
|
124
|
-
remunerated: boolean;
|
|
125
|
-
/** Asset address (`0x000...` for ETH). */
|
|
126
|
-
asset: string;
|
|
127
|
-
}
|
|
128
|
-
/** On-chain collateral position for a single asset, returned by `getUser`. */
|
|
129
|
-
export interface UserInfo {
|
|
130
|
-
/** Asset address (`0x000...` for ETH). */
|
|
131
|
-
asset: string;
|
|
132
|
-
/** Total deposited collateral available for payments (in token base units). */
|
|
133
|
-
collateral: bigint;
|
|
134
|
-
/** Amount of a pending withdrawal request (0 if none). */
|
|
135
|
-
withdrawalRequestAmount: bigint;
|
|
136
|
-
/** Unix timestamp when the withdrawal request was made (0 if none). */
|
|
137
|
-
withdrawalRequestTimestamp: number;
|
|
138
|
-
}
|
|
139
|
-
export declare class UserSuspensionStatus {
|
|
140
|
-
userAddress: string;
|
|
141
|
-
suspended: boolean;
|
|
142
|
-
updatedAt: number;
|
|
143
|
-
constructor(userAddress: string, suspended: boolean, updatedAt: number);
|
|
144
|
-
static fromRpc(raw: Record<string, unknown>): UserSuspensionStatus;
|
|
145
|
-
}
|
|
146
|
-
export declare class AdminApiKeyInfo {
|
|
147
|
-
id: string;
|
|
148
|
-
name: string;
|
|
149
|
-
scopes: string[];
|
|
150
|
-
createdAt: number;
|
|
151
|
-
revokedAt?: number | null | undefined;
|
|
152
|
-
constructor(id: string, name: string, scopes: string[], createdAt: number, revokedAt?: number | null | undefined);
|
|
153
|
-
static fromRpc(raw: Record<string, unknown>): AdminApiKeyInfo;
|
|
154
|
-
}
|
|
155
|
-
export declare class AdminApiKeySecret {
|
|
156
|
-
id: string;
|
|
157
|
-
name: string;
|
|
158
|
-
scopes: string[];
|
|
159
|
-
createdAt: number;
|
|
160
|
-
apiKey: string;
|
|
161
|
-
constructor(id: string, name: string, scopes: string[], createdAt: number, apiKey: string);
|
|
162
|
-
static fromRpc(raw: Record<string, unknown>): AdminApiKeySecret;
|
|
163
|
-
}
|
|
164
|
-
export declare class TabInfo {
|
|
165
|
-
tabId: bigint;
|
|
166
|
-
userAddress: string;
|
|
167
|
-
recipientAddress: string;
|
|
168
|
-
assetAddress: string;
|
|
169
|
-
startTimestamp: number;
|
|
170
|
-
ttlSeconds: number;
|
|
171
|
-
status: string;
|
|
172
|
-
settlementStatus: string;
|
|
173
|
-
createdAt: number;
|
|
174
|
-
updatedAt: number;
|
|
175
|
-
totalAmount: bigint;
|
|
176
|
-
paidAmount: bigint;
|
|
177
|
-
constructor(tabId: bigint, userAddress: string, recipientAddress: string, assetAddress: string, startTimestamp: number, ttlSeconds: number, status: string, settlementStatus: string, createdAt: number, updatedAt: number, totalAmount?: bigint, paidAmount?: bigint);
|
|
178
|
-
static fromRpc(raw: Record<string, unknown>): TabInfo;
|
|
179
|
-
}
|
|
180
|
-
export declare class GuaranteeInfo {
|
|
181
|
-
tabId: bigint;
|
|
182
|
-
reqId: bigint;
|
|
183
|
-
fromAddress: string;
|
|
184
|
-
toAddress: string;
|
|
185
|
-
assetAddress: string;
|
|
186
|
-
amount: bigint;
|
|
187
|
-
timestamp: number;
|
|
188
|
-
certificate?: string | null | undefined;
|
|
189
|
-
constructor(tabId: bigint, reqId: bigint, fromAddress: string, toAddress: string, assetAddress: string, amount: bigint, timestamp: number, certificate?: string | null | undefined);
|
|
190
|
-
static fromRpc(raw: Record<string, unknown>): GuaranteeInfo;
|
|
191
|
-
}
|
|
192
|
-
export declare class PendingRemunerationInfo {
|
|
193
|
-
tab: TabInfo;
|
|
194
|
-
latestGuarantee?: (GuaranteeInfo | null) | undefined;
|
|
195
|
-
constructor(tab: TabInfo, latestGuarantee?: (GuaranteeInfo | null) | undefined);
|
|
196
|
-
static fromRpc(raw: Record<string, unknown>): PendingRemunerationInfo;
|
|
197
|
-
}
|
|
198
|
-
export declare class CollateralEventInfo {
|
|
199
|
-
id: string;
|
|
200
|
-
userAddress: string;
|
|
201
|
-
assetAddress: string;
|
|
202
|
-
amount: bigint;
|
|
203
|
-
eventType: string;
|
|
204
|
-
tabId?: bigint | null | undefined;
|
|
205
|
-
reqId?: bigint | null | undefined;
|
|
206
|
-
txId?: string | null | undefined;
|
|
207
|
-
createdAt: number;
|
|
208
|
-
constructor(id: string, userAddress: string, assetAddress: string, amount: bigint, eventType: string, tabId?: bigint | null | undefined, reqId?: bigint | null | undefined, txId?: string | null | undefined, createdAt?: number);
|
|
209
|
-
static fromRpc(raw: Record<string, unknown>): CollateralEventInfo;
|
|
210
|
-
}
|
|
211
|
-
export declare class AssetBalanceInfo {
|
|
212
|
-
userAddress: string;
|
|
213
|
-
assetAddress: string;
|
|
214
|
-
total: bigint;
|
|
215
|
-
locked: bigint;
|
|
216
|
-
version: number;
|
|
217
|
-
updatedAt: number;
|
|
218
|
-
constructor(userAddress: string, assetAddress: string, total: bigint, locked: bigint, version: number, updatedAt: number);
|
|
219
|
-
static fromRpc(raw: Record<string, unknown>): AssetBalanceInfo;
|
|
220
|
-
}
|
|
221
|
-
export declare class RecipientPaymentInfo {
|
|
222
|
-
userAddress: string;
|
|
223
|
-
recipientAddress: string;
|
|
224
|
-
txHash: string;
|
|
225
|
-
amount: bigint;
|
|
226
|
-
verified: boolean;
|
|
227
|
-
finalized: boolean;
|
|
228
|
-
failed: boolean;
|
|
229
|
-
createdAt: number;
|
|
230
|
-
constructor(userAddress: string, recipientAddress: string, txHash: string, amount: bigint, verified: boolean, finalized: boolean, failed: boolean, createdAt: number);
|
|
231
|
-
static fromRpc(raw: Record<string, unknown>): RecipientPaymentInfo;
|
|
232
|
-
}
|
|
233
|
-
export interface SupportedTokenInfo {
|
|
234
|
-
symbol: string;
|
|
235
|
-
address: string;
|
|
236
|
-
decimals?: number;
|
|
237
|
-
}
|
|
238
|
-
export declare class SupportedTokensResponse {
|
|
239
|
-
chainId: number;
|
|
240
|
-
tokens: SupportedTokenInfo[];
|
|
241
|
-
constructor(chainId: number, tokens: SupportedTokenInfo[]);
|
|
242
|
-
static fromRpc(raw: Record<string, unknown>): SupportedTokensResponse;
|
|
243
|
-
}
|
|
244
|
-
export declare class CorePublicParameters {
|
|
245
|
-
publicKey: Uint8Array;
|
|
246
|
-
contractAddress: string;
|
|
247
|
-
ethereumHttpRpcUrl: string;
|
|
248
|
-
eip712Name: string;
|
|
249
|
-
eip712Version: string;
|
|
250
|
-
chainId: number;
|
|
251
|
-
maxAcceptedGuaranteeVersion: number;
|
|
252
|
-
acceptedGuaranteeVersions: number[];
|
|
253
|
-
activeGuaranteeDomainSeparator: string;
|
|
254
|
-
/** Allowlist of trusted validation registry addresses configured in core (may be empty). */
|
|
255
|
-
trustedValidationRegistries: string[];
|
|
256
|
-
validationHashCanonicalizationVersion: string;
|
|
257
|
-
constructor(publicKey: Uint8Array, contractAddress: string, ethereumHttpRpcUrl: string, eip712Name: string, eip712Version: string, chainId: number, maxAcceptedGuaranteeVersion?: number, acceptedGuaranteeVersions?: number[], activeGuaranteeDomainSeparator?: string,
|
|
258
|
-
/** Allowlist of trusted validation registry addresses configured in core (may be empty). */
|
|
259
|
-
trustedValidationRegistries?: string[], validationHashCanonicalizationVersion?: string);
|
|
260
|
-
static fromRpc(payload: Record<string, unknown>): CorePublicParameters;
|
|
261
|
-
}
|
package/dist/src/models.js
DELETED
|
@@ -1,360 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CorePublicParameters = exports.SupportedTokensResponse = exports.RecipientPaymentInfo = exports.AssetBalanceInfo = exports.CollateralEventInfo = exports.PendingRemunerationInfo = exports.GuaranteeInfo = exports.TabInfo = exports.AdminApiKeySecret = exports.AdminApiKeyInfo = exports.UserSuspensionStatus = exports.PaymentGuaranteeRequestClaimsV2 = exports.PaymentGuaranteeRequestClaims = exports.SigningScheme = exports.ADMIN_SCOPE_SUSPEND_USERS = exports.ADMIN_SCOPE_MANAGE_KEYS = exports.ADMIN_API_KEY_PREFIX = exports.ADMIN_API_KEY_HEADER = void 0;
|
|
4
|
-
const viem_1 = require("viem");
|
|
5
|
-
const serde_1 = require("./serde");
|
|
6
|
-
const utils_1 = require("./utils");
|
|
7
|
-
var constants_1 = require("./constants");
|
|
8
|
-
Object.defineProperty(exports, "ADMIN_API_KEY_HEADER", { enumerable: true, get: function () { return constants_1.ADMIN_API_KEY_HEADER; } });
|
|
9
|
-
Object.defineProperty(exports, "ADMIN_API_KEY_PREFIX", { enumerable: true, get: function () { return constants_1.ADMIN_API_KEY_PREFIX; } });
|
|
10
|
-
Object.defineProperty(exports, "ADMIN_SCOPE_MANAGE_KEYS", { enumerable: true, get: function () { return constants_1.ADMIN_SCOPE_MANAGE_KEYS; } });
|
|
11
|
-
Object.defineProperty(exports, "ADMIN_SCOPE_SUSPEND_USERS", { enumerable: true, get: function () { return constants_1.ADMIN_SCOPE_SUSPEND_USERS; } });
|
|
12
|
-
/** Signing scheme used when producing a payment guarantee signature. */
|
|
13
|
-
var SigningScheme;
|
|
14
|
-
(function (SigningScheme) {
|
|
15
|
-
/** EIP-712 typed-data signing (default, preferred). */
|
|
16
|
-
SigningScheme["EIP712"] = "eip712";
|
|
17
|
-
/** EIP-191 personal_sign (for wallets that do not support typed data). */
|
|
18
|
-
SigningScheme["EIP191"] = "eip191";
|
|
19
|
-
})(SigningScheme || (exports.SigningScheme = SigningScheme = {}));
|
|
20
|
-
/**
|
|
21
|
-
* V1 payment guarantee request claims. Signed by the payer and submitted to the
|
|
22
|
-
* core RPC to obtain a BLS guarantee certificate.
|
|
23
|
-
*
|
|
24
|
-
* Build with the static {@link PaymentGuaranteeRequestClaims.new} factory which
|
|
25
|
-
* normalises addresses and parses `uint256` values.
|
|
26
|
-
*/
|
|
27
|
-
class PaymentGuaranteeRequestClaims {
|
|
28
|
-
userAddress;
|
|
29
|
-
recipientAddress;
|
|
30
|
-
tabId;
|
|
31
|
-
reqId;
|
|
32
|
-
amount;
|
|
33
|
-
timestamp;
|
|
34
|
-
assetAddress;
|
|
35
|
-
constructor(init) {
|
|
36
|
-
this.userAddress = init.userAddress;
|
|
37
|
-
this.recipientAddress = init.recipientAddress;
|
|
38
|
-
this.tabId = init.tabId;
|
|
39
|
-
this.reqId = init.reqId ?? 0n;
|
|
40
|
-
this.amount = init.amount;
|
|
41
|
-
this.timestamp = init.timestamp;
|
|
42
|
-
this.assetAddress = init.assetAddress;
|
|
43
|
-
}
|
|
44
|
-
static new(userAddress, recipientAddress, tabId, amount, timestamp, erc20Token, reqId) {
|
|
45
|
-
const asset = erc20Token ?? '0x0000000000000000000000000000000000000000';
|
|
46
|
-
return new PaymentGuaranteeRequestClaims({
|
|
47
|
-
userAddress: (0, utils_1.normalizeAddress)(userAddress),
|
|
48
|
-
recipientAddress: (0, utils_1.normalizeAddress)(recipientAddress),
|
|
49
|
-
tabId: (0, utils_1.parseU256)(tabId),
|
|
50
|
-
reqId: reqId !== undefined ? (0, utils_1.parseU256)(reqId) : 0n,
|
|
51
|
-
amount: (0, utils_1.parseU256)(amount),
|
|
52
|
-
timestamp: Number(timestamp),
|
|
53
|
-
assetAddress: (0, utils_1.normalizeAddress)(asset),
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.PaymentGuaranteeRequestClaims = PaymentGuaranteeRequestClaims;
|
|
58
|
-
/**
|
|
59
|
-
* V2 payment guarantee request claims — extends V1 with a full on-chain validation policy.
|
|
60
|
-
*
|
|
61
|
-
* Compute `validationSubjectHash` via `computeValidationSubjectHash(baseClaims)` and
|
|
62
|
-
* `validationRequestHash` via `computeValidationRequestHash(partialV2)` before constructing.
|
|
63
|
-
* The `jobHash` must be provided and included in the validation request hash.
|
|
64
|
-
*
|
|
65
|
-
* @throws {@link ValidationError} if `minValidationScore` is outside [1, 100].
|
|
66
|
-
*/
|
|
67
|
-
class PaymentGuaranteeRequestClaimsV2 extends PaymentGuaranteeRequestClaims {
|
|
68
|
-
validationRegistryAddress;
|
|
69
|
-
validationRequestHash;
|
|
70
|
-
validationChainId;
|
|
71
|
-
validatorAddress;
|
|
72
|
-
validatorAgentId;
|
|
73
|
-
minValidationScore;
|
|
74
|
-
validationSubjectHash;
|
|
75
|
-
jobHash;
|
|
76
|
-
requiredValidationTag;
|
|
77
|
-
constructor(init) {
|
|
78
|
-
super(init);
|
|
79
|
-
if (init.minValidationScore < 1 || init.minValidationScore > 100) {
|
|
80
|
-
throw new utils_1.ValidationError(`minValidationScore must be in [1, 100], got ${init.minValidationScore}`);
|
|
81
|
-
}
|
|
82
|
-
this.validationRegistryAddress = (0, utils_1.normalizeAddress)(init.validationRegistryAddress);
|
|
83
|
-
this.validationRequestHash = (0, utils_1.ensureHexPrefix)(init.validationRequestHash).toLowerCase();
|
|
84
|
-
this.validationChainId = init.validationChainId;
|
|
85
|
-
this.validatorAddress = (0, utils_1.normalizeAddress)(init.validatorAddress);
|
|
86
|
-
this.validatorAgentId = init.validatorAgentId;
|
|
87
|
-
this.minValidationScore = init.minValidationScore;
|
|
88
|
-
this.validationSubjectHash = (0, utils_1.ensureHexPrefix)(init.validationSubjectHash).toLowerCase();
|
|
89
|
-
this.jobHash = (0, utils_1.ensureHexPrefix)(init.jobHash).toLowerCase();
|
|
90
|
-
this.requiredValidationTag = init.requiredValidationTag;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
exports.PaymentGuaranteeRequestClaimsV2 = PaymentGuaranteeRequestClaimsV2;
|
|
94
|
-
class UserSuspensionStatus {
|
|
95
|
-
userAddress;
|
|
96
|
-
suspended;
|
|
97
|
-
updatedAt;
|
|
98
|
-
constructor(userAddress, suspended, updatedAt) {
|
|
99
|
-
this.userAddress = userAddress;
|
|
100
|
-
this.suspended = suspended;
|
|
101
|
-
this.updatedAt = updatedAt;
|
|
102
|
-
}
|
|
103
|
-
static fromRpc(raw) {
|
|
104
|
-
return new UserSuspensionStatus(((0, serde_1.getAny)(raw, 'user_address', 'userAddress') ?? ''), Boolean((0, serde_1.getAny)(raw, 'suspended')), Number((0, serde_1.getAny)(raw, 'updated_at', 'updatedAt') ?? 0));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports.UserSuspensionStatus = UserSuspensionStatus;
|
|
108
|
-
class AdminApiKeyInfo {
|
|
109
|
-
id;
|
|
110
|
-
name;
|
|
111
|
-
scopes;
|
|
112
|
-
createdAt;
|
|
113
|
-
revokedAt;
|
|
114
|
-
constructor(id, name, scopes, createdAt, revokedAt) {
|
|
115
|
-
this.id = id;
|
|
116
|
-
this.name = name;
|
|
117
|
-
this.scopes = scopes;
|
|
118
|
-
this.createdAt = createdAt;
|
|
119
|
-
this.revokedAt = revokedAt;
|
|
120
|
-
}
|
|
121
|
-
static fromRpc(raw) {
|
|
122
|
-
const revoked = (0, serde_1.getAny)(raw, 'revoked_at', 'revokedAt');
|
|
123
|
-
return new AdminApiKeyInfo(((0, serde_1.getAny)(raw, 'id') ?? ''), ((0, serde_1.getAny)(raw, 'name') ?? ''), ((0, serde_1.getAny)(raw, 'scopes') ?? []).map(String), Number((0, serde_1.getAny)(raw, 'created_at', 'createdAt') ?? 0), revoked === undefined || revoked === null ? null : Number(revoked));
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
exports.AdminApiKeyInfo = AdminApiKeyInfo;
|
|
127
|
-
class AdminApiKeySecret {
|
|
128
|
-
id;
|
|
129
|
-
name;
|
|
130
|
-
scopes;
|
|
131
|
-
createdAt;
|
|
132
|
-
apiKey;
|
|
133
|
-
constructor(id, name, scopes, createdAt, apiKey) {
|
|
134
|
-
this.id = id;
|
|
135
|
-
this.name = name;
|
|
136
|
-
this.scopes = scopes;
|
|
137
|
-
this.createdAt = createdAt;
|
|
138
|
-
this.apiKey = apiKey;
|
|
139
|
-
}
|
|
140
|
-
static fromRpc(raw) {
|
|
141
|
-
return new AdminApiKeySecret(((0, serde_1.getAny)(raw, 'id') ?? ''), ((0, serde_1.getAny)(raw, 'name') ?? ''), ((0, serde_1.getAny)(raw, 'scopes') ?? []).map(String), Number((0, serde_1.getAny)(raw, 'created_at', 'createdAt') ?? 0), ((0, serde_1.getAny)(raw, 'api_key', 'apiKey') ?? ''));
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
exports.AdminApiKeySecret = AdminApiKeySecret;
|
|
145
|
-
class TabInfo {
|
|
146
|
-
tabId;
|
|
147
|
-
userAddress;
|
|
148
|
-
recipientAddress;
|
|
149
|
-
assetAddress;
|
|
150
|
-
startTimestamp;
|
|
151
|
-
ttlSeconds;
|
|
152
|
-
status;
|
|
153
|
-
settlementStatus;
|
|
154
|
-
createdAt;
|
|
155
|
-
updatedAt;
|
|
156
|
-
totalAmount;
|
|
157
|
-
paidAmount;
|
|
158
|
-
constructor(tabId, userAddress, recipientAddress, assetAddress, startTimestamp, ttlSeconds, status, settlementStatus, createdAt, updatedAt, totalAmount = 0n, paidAmount = 0n) {
|
|
159
|
-
this.tabId = tabId;
|
|
160
|
-
this.userAddress = userAddress;
|
|
161
|
-
this.recipientAddress = recipientAddress;
|
|
162
|
-
this.assetAddress = assetAddress;
|
|
163
|
-
this.startTimestamp = startTimestamp;
|
|
164
|
-
this.ttlSeconds = ttlSeconds;
|
|
165
|
-
this.status = status;
|
|
166
|
-
this.settlementStatus = settlementStatus;
|
|
167
|
-
this.createdAt = createdAt;
|
|
168
|
-
this.updatedAt = updatedAt;
|
|
169
|
-
this.totalAmount = totalAmount;
|
|
170
|
-
this.paidAmount = paidAmount;
|
|
171
|
-
}
|
|
172
|
-
static fromRpc(raw) {
|
|
173
|
-
return new TabInfo((0, utils_1.parseU256)(((0, serde_1.getAny)(raw, 'tab_id', 'tabId') ?? 0)), ((0, serde_1.getAny)(raw, 'user_address', 'userAddress') ?? ''), ((0, serde_1.getAny)(raw, 'recipient_address', 'recipientAddress') ?? ''), ((0, serde_1.getAny)(raw, 'asset_address', 'assetAddress') ?? ''), Number((0, serde_1.getAny)(raw, 'start_timestamp', 'startTimestamp')), Number((0, serde_1.getAny)(raw, 'ttl_seconds', 'ttlSeconds')), ((0, serde_1.getAny)(raw, 'status') ?? ''), ((0, serde_1.getAny)(raw, 'settlement_status', 'settlementStatus') ?? ''), Number((0, serde_1.getAny)(raw, 'created_at', 'createdAt')), Number((0, serde_1.getAny)(raw, 'updated_at', 'updatedAt')), (0, utils_1.parseU256)(((0, serde_1.getAny)(raw, 'total_amount', 'totalAmount') ?? 0)), (0, utils_1.parseU256)(((0, serde_1.getAny)(raw, 'paid_amount', 'paidAmount') ?? 0)));
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
exports.TabInfo = TabInfo;
|
|
177
|
-
class GuaranteeInfo {
|
|
178
|
-
tabId;
|
|
179
|
-
reqId;
|
|
180
|
-
fromAddress;
|
|
181
|
-
toAddress;
|
|
182
|
-
assetAddress;
|
|
183
|
-
amount;
|
|
184
|
-
timestamp;
|
|
185
|
-
certificate;
|
|
186
|
-
constructor(tabId, reqId, fromAddress, toAddress, assetAddress, amount, timestamp, certificate) {
|
|
187
|
-
this.tabId = tabId;
|
|
188
|
-
this.reqId = reqId;
|
|
189
|
-
this.fromAddress = fromAddress;
|
|
190
|
-
this.toAddress = toAddress;
|
|
191
|
-
this.assetAddress = assetAddress;
|
|
192
|
-
this.amount = amount;
|
|
193
|
-
this.timestamp = timestamp;
|
|
194
|
-
this.certificate = certificate;
|
|
195
|
-
}
|
|
196
|
-
static fromRpc(raw) {
|
|
197
|
-
return new GuaranteeInfo((0, utils_1.parseU256)(((0, serde_1.getAny)(raw, 'tab_id', 'tabId') ?? 0)), (0, utils_1.parseU256)(((0, serde_1.getAny)(raw, 'req_id', 'reqId') ?? 0)), ((0, serde_1.getAny)(raw, 'from_address', 'fromAddress') ?? ''), ((0, serde_1.getAny)(raw, 'to_address', 'toAddress') ?? ''), ((0, serde_1.getAny)(raw, 'asset_address', 'assetAddress') ?? ''), (0, utils_1.parseU256)(((0, serde_1.getAny)(raw, 'amount') ?? 0)), Number((0, serde_1.getAny)(raw, 'start_timestamp', 'startTimestamp', 'timestamp') ?? 0), (0, serde_1.getAny)(raw, 'certificate'));
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
exports.GuaranteeInfo = GuaranteeInfo;
|
|
201
|
-
class PendingRemunerationInfo {
|
|
202
|
-
tab;
|
|
203
|
-
latestGuarantee;
|
|
204
|
-
constructor(tab, latestGuarantee) {
|
|
205
|
-
this.tab = tab;
|
|
206
|
-
this.latestGuarantee = latestGuarantee;
|
|
207
|
-
}
|
|
208
|
-
static fromRpc(raw) {
|
|
209
|
-
const latest = (0, serde_1.getAny)(raw, 'latest_guarantee', 'latestGuarantee');
|
|
210
|
-
return new PendingRemunerationInfo(TabInfo.fromRpc((0, serde_1.getAny)(raw, 'tab') ?? {}), latest ? GuaranteeInfo.fromRpc(latest) : null);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
exports.PendingRemunerationInfo = PendingRemunerationInfo;
|
|
214
|
-
class CollateralEventInfo {
|
|
215
|
-
id;
|
|
216
|
-
userAddress;
|
|
217
|
-
assetAddress;
|
|
218
|
-
amount;
|
|
219
|
-
eventType;
|
|
220
|
-
tabId;
|
|
221
|
-
reqId;
|
|
222
|
-
txId;
|
|
223
|
-
createdAt;
|
|
224
|
-
constructor(id, userAddress, assetAddress, amount, eventType, tabId, reqId, txId, createdAt = 0) {
|
|
225
|
-
this.id = id;
|
|
226
|
-
this.userAddress = userAddress;
|
|
227
|
-
this.assetAddress = assetAddress;
|
|
228
|
-
this.amount = amount;
|
|
229
|
-
this.eventType = eventType;
|
|
230
|
-
this.tabId = tabId;
|
|
231
|
-
this.reqId = reqId;
|
|
232
|
-
this.txId = txId;
|
|
233
|
-
this.createdAt = createdAt;
|
|
234
|
-
}
|
|
235
|
-
static fromRpc(raw) {
|
|
236
|
-
const tabId = (0, serde_1.getAny)(raw, 'tab_id', 'tabId');
|
|
237
|
-
const reqId = (0, serde_1.getAny)(raw, 'req_id', 'reqId');
|
|
238
|
-
return new CollateralEventInfo(((0, serde_1.getAny)(raw, 'id') ?? ''), ((0, serde_1.getAny)(raw, 'user_address', 'userAddress') ?? ''), ((0, serde_1.getAny)(raw, 'asset_address', 'assetAddress') ?? ''), (0, utils_1.parseU256)(((0, serde_1.getAny)(raw, 'amount') ?? 0)), ((0, serde_1.getAny)(raw, 'event_type', 'eventType') ?? ''), tabId !== undefined && tabId !== null ? (0, utils_1.parseU256)(tabId) : null, reqId !== undefined && reqId !== null ? (0, utils_1.parseU256)(reqId) : null, (0, serde_1.getAny)(raw, 'tx_id', 'txId'), Number((0, serde_1.getAny)(raw, 'created_at', 'createdAt') ?? 0));
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
exports.CollateralEventInfo = CollateralEventInfo;
|
|
242
|
-
class AssetBalanceInfo {
|
|
243
|
-
userAddress;
|
|
244
|
-
assetAddress;
|
|
245
|
-
total;
|
|
246
|
-
locked;
|
|
247
|
-
version;
|
|
248
|
-
updatedAt;
|
|
249
|
-
constructor(userAddress, assetAddress, total, locked, version, updatedAt) {
|
|
250
|
-
this.userAddress = userAddress;
|
|
251
|
-
this.assetAddress = assetAddress;
|
|
252
|
-
this.total = total;
|
|
253
|
-
this.locked = locked;
|
|
254
|
-
this.version = version;
|
|
255
|
-
this.updatedAt = updatedAt;
|
|
256
|
-
}
|
|
257
|
-
static fromRpc(raw) {
|
|
258
|
-
return new AssetBalanceInfo(((0, serde_1.getAny)(raw, 'user_address', 'userAddress') ?? ''), ((0, serde_1.getAny)(raw, 'asset_address', 'assetAddress') ?? ''), (0, utils_1.parseU256)(((0, serde_1.getAny)(raw, 'total') ?? 0)), (0, utils_1.parseU256)(((0, serde_1.getAny)(raw, 'locked') ?? 0)), Number((0, serde_1.getAny)(raw, 'version') ?? 0), Number((0, serde_1.getAny)(raw, 'updated_at', 'updatedAt') ?? 0));
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
exports.AssetBalanceInfo = AssetBalanceInfo;
|
|
262
|
-
class RecipientPaymentInfo {
|
|
263
|
-
userAddress;
|
|
264
|
-
recipientAddress;
|
|
265
|
-
txHash;
|
|
266
|
-
amount;
|
|
267
|
-
verified;
|
|
268
|
-
finalized;
|
|
269
|
-
failed;
|
|
270
|
-
createdAt;
|
|
271
|
-
constructor(userAddress, recipientAddress, txHash, amount, verified, finalized, failed, createdAt) {
|
|
272
|
-
this.userAddress = userAddress;
|
|
273
|
-
this.recipientAddress = recipientAddress;
|
|
274
|
-
this.txHash = txHash;
|
|
275
|
-
this.amount = amount;
|
|
276
|
-
this.verified = verified;
|
|
277
|
-
this.finalized = finalized;
|
|
278
|
-
this.failed = failed;
|
|
279
|
-
this.createdAt = createdAt;
|
|
280
|
-
}
|
|
281
|
-
static fromRpc(raw) {
|
|
282
|
-
return new RecipientPaymentInfo(((0, serde_1.getAny)(raw, 'user_address', 'userAddress') ?? ''), ((0, serde_1.getAny)(raw, 'recipient_address', 'recipientAddress') ?? ''), ((0, serde_1.getAny)(raw, 'tx_hash', 'txHash') ?? ''), (0, utils_1.parseU256)(((0, serde_1.getAny)(raw, 'amount') ?? 0)), Boolean((0, serde_1.getAny)(raw, 'verified')), Boolean((0, serde_1.getAny)(raw, 'finalized')), Boolean((0, serde_1.getAny)(raw, 'failed')), Number((0, serde_1.getAny)(raw, 'created_at', 'createdAt') ?? 0));
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
exports.RecipientPaymentInfo = RecipientPaymentInfo;
|
|
286
|
-
class SupportedTokensResponse {
|
|
287
|
-
chainId;
|
|
288
|
-
tokens;
|
|
289
|
-
constructor(chainId, tokens) {
|
|
290
|
-
this.chainId = chainId;
|
|
291
|
-
this.tokens = tokens;
|
|
292
|
-
}
|
|
293
|
-
static fromRpc(raw) {
|
|
294
|
-
const tokensRaw = (0, serde_1.getAny)(raw, 'tokens');
|
|
295
|
-
const tokens = [];
|
|
296
|
-
if (Array.isArray(tokensRaw)) {
|
|
297
|
-
for (const token of tokensRaw) {
|
|
298
|
-
const address = (0, serde_1.getAny)(token, 'address');
|
|
299
|
-
if (typeof address !== 'string' || address.length === 0)
|
|
300
|
-
continue;
|
|
301
|
-
const decimals = (0, serde_1.getAny)(token, 'decimals');
|
|
302
|
-
tokens.push({
|
|
303
|
-
symbol: String((0, serde_1.getAny)(token, 'symbol') ?? ''),
|
|
304
|
-
address,
|
|
305
|
-
decimals: decimals === undefined || decimals === null ? undefined : Number(decimals),
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
return new SupportedTokensResponse(Number((0, serde_1.getAny)(raw, 'chain_id', 'chainId') ?? 0), tokens);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
exports.SupportedTokensResponse = SupportedTokensResponse;
|
|
313
|
-
class CorePublicParameters {
|
|
314
|
-
publicKey;
|
|
315
|
-
contractAddress;
|
|
316
|
-
ethereumHttpRpcUrl;
|
|
317
|
-
eip712Name;
|
|
318
|
-
eip712Version;
|
|
319
|
-
chainId;
|
|
320
|
-
maxAcceptedGuaranteeVersion;
|
|
321
|
-
acceptedGuaranteeVersions;
|
|
322
|
-
activeGuaranteeDomainSeparator;
|
|
323
|
-
trustedValidationRegistries;
|
|
324
|
-
validationHashCanonicalizationVersion;
|
|
325
|
-
constructor(publicKey, contractAddress, ethereumHttpRpcUrl, eip712Name, eip712Version, chainId, maxAcceptedGuaranteeVersion = 1, acceptedGuaranteeVersions = [], activeGuaranteeDomainSeparator = '',
|
|
326
|
-
/** Allowlist of trusted validation registry addresses configured in core (may be empty). */
|
|
327
|
-
trustedValidationRegistries = [], validationHashCanonicalizationVersion = '4MICA_VALIDATION_REQUEST_V1') {
|
|
328
|
-
this.publicKey = publicKey;
|
|
329
|
-
this.contractAddress = contractAddress;
|
|
330
|
-
this.ethereumHttpRpcUrl = ethereumHttpRpcUrl;
|
|
331
|
-
this.eip712Name = eip712Name;
|
|
332
|
-
this.eip712Version = eip712Version;
|
|
333
|
-
this.chainId = chainId;
|
|
334
|
-
this.maxAcceptedGuaranteeVersion = maxAcceptedGuaranteeVersion;
|
|
335
|
-
this.acceptedGuaranteeVersions = acceptedGuaranteeVersions;
|
|
336
|
-
this.activeGuaranteeDomainSeparator = activeGuaranteeDomainSeparator;
|
|
337
|
-
this.trustedValidationRegistries = trustedValidationRegistries;
|
|
338
|
-
this.validationHashCanonicalizationVersion = validationHashCanonicalizationVersion;
|
|
339
|
-
}
|
|
340
|
-
static fromRpc(payload) {
|
|
341
|
-
const pkRaw = payload.public_key ?? payload.publicKey;
|
|
342
|
-
const pk = typeof pkRaw === 'string'
|
|
343
|
-
? (0, viem_1.toBytes)(pkRaw)
|
|
344
|
-
: pkRaw instanceof Uint8Array
|
|
345
|
-
? pkRaw
|
|
346
|
-
: Array.isArray(pkRaw)
|
|
347
|
-
? Uint8Array.from(pkRaw)
|
|
348
|
-
: new Uint8Array();
|
|
349
|
-
const registriesRaw = payload.trusted_validation_registries ?? payload.trustedValidationRegistries;
|
|
350
|
-
const trustedValidationRegistries = Array.isArray(registriesRaw)
|
|
351
|
-
? registriesRaw.map(String)
|
|
352
|
-
: [];
|
|
353
|
-
return new CorePublicParameters(pk, String(payload.contract_address ?? payload.contractAddress ?? ''), String(payload.ethereum_http_rpc_url ?? payload.ethereumHttpRpcUrl ?? ''), (payload.eip712_name ?? payload.eip712Name ?? '4Mica'), (payload.eip712_version ?? payload.eip712Version ?? '1'), Number(payload.chain_id ?? payload.chainId), Number(payload.max_accepted_guarantee_version ?? payload.maxAcceptedGuaranteeVersion ?? 1), Array.isArray(payload.accepted_guarantee_versions ?? payload.acceptedGuaranteeVersions)
|
|
354
|
-
? (payload.accepted_guarantee_versions ?? payload.acceptedGuaranteeVersions).map((version) => Number(version))
|
|
355
|
-
: [], String(payload.active_guarantee_domain_separator ?? payload.activeGuaranteeDomainSeparator ?? ''), trustedValidationRegistries, String(payload.validation_hash_canonicalization_version ??
|
|
356
|
-
payload.validationHashCanonicalizationVersion ??
|
|
357
|
-
'4MICA_VALIDATION_REQUEST_V1'));
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
exports.CorePublicParameters = CorePublicParameters;
|
package/dist/src/networks.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/** Metadata for a hosted 4Mica network deployment. */
|
|
2
|
-
export interface NetworkInfo {
|
|
3
|
-
/** CAIP-2 network identifier (e.g. `eip155:84532`). */
|
|
4
|
-
caip2: string;
|
|
5
|
-
/** Hosted 4Mica core API URL for this network. */
|
|
6
|
-
rpcUrl: string;
|
|
7
|
-
/** Reliable public Ethereum RPC for on-chain calls (fallback when server doesn't provide one). */
|
|
8
|
-
publicRpcUrl: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Hosted 4Mica network deployments, keyed by human-readable shorthand.
|
|
12
|
-
*
|
|
13
|
-
* Pass the shorthand (or the CAIP-2 string) to {@link ConfigBuilder.network}
|
|
14
|
-
* to select a network without writing a URL.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* import { Client, ConfigBuilder, NETWORKS } from "@4mica/sdk";
|
|
19
|
-
*
|
|
20
|
-
* // By shorthand
|
|
21
|
-
* const cfg = new ConfigBuilder()
|
|
22
|
-
* .network("base")
|
|
23
|
-
* .walletPrivateKey("0x...")
|
|
24
|
-
* .build();
|
|
25
|
-
*
|
|
26
|
-
* // Inspect available networks
|
|
27
|
-
* console.log(NETWORKS["base"].caip2); // "eip155:8453"
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export declare const NETWORKS: Record<string, NetworkInfo>;
|
|
31
|
-
/**
|
|
32
|
-
* Resolve a network shorthand or CAIP-2 identifier to a core API URL.
|
|
33
|
-
* Returns `undefined` if the identifier is not a known hosted network.
|
|
34
|
-
*/
|
|
35
|
-
export declare function resolveNetworkRpcUrl(network: string): string | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Resolve a CAIP-2 identifier to a reliable public Ethereum RPC URL.
|
|
38
|
-
* Returns `undefined` for unknown networks.
|
|
39
|
-
*/
|
|
40
|
-
export declare function resolvePublicRpcUrl(caip2: string): string | undefined;
|