@armory-sh/base 0.2.28 → 0.2.30

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.
Files changed (43) hide show
  1. package/README.md +304 -28
  2. package/dist/client-hooks-runtime.d.ts +9 -0
  3. package/dist/encoding/x402.d.ts +1 -1
  4. package/dist/errors.d.ts +10 -0
  5. package/dist/facilitator-capabilities.d.ts +9 -0
  6. package/dist/index.d.ts +30 -22
  7. package/dist/index.js +1198 -650
  8. package/dist/payment-client.d.ts +1 -1
  9. package/dist/payment-requirements.d.ts +35 -0
  10. package/dist/protocol.d.ts +33 -0
  11. package/dist/types/api.d.ts +1 -1
  12. package/dist/types/hooks.d.ts +17 -1
  13. package/dist/types/protocol.d.ts +1 -1
  14. package/dist/types/wallet.d.ts +24 -0
  15. package/dist/utils/base64.d.ts +4 -0
  16. package/dist/utils/x402.d.ts +1 -1
  17. package/dist/validation.d.ts +1 -1
  18. package/package.json +15 -2
  19. package/src/abi/erc20.ts +84 -0
  20. package/src/client-hooks-runtime.ts +153 -0
  21. package/src/data/tokens.ts +199 -0
  22. package/src/eip712.ts +108 -0
  23. package/src/encoding/x402.ts +205 -0
  24. package/src/encoding.ts +98 -0
  25. package/src/errors.ts +23 -0
  26. package/src/facilitator-capabilities.ts +125 -0
  27. package/src/index.ts +330 -0
  28. package/src/payment-client.ts +201 -0
  29. package/src/payment-requirements.ts +354 -0
  30. package/src/protocol.ts +57 -0
  31. package/src/types/api.ts +304 -0
  32. package/src/types/hooks.ts +85 -0
  33. package/src/types/networks.ts +175 -0
  34. package/src/types/protocol.ts +182 -0
  35. package/src/types/v2.ts +282 -0
  36. package/src/types/wallet.ts +30 -0
  37. package/src/types/x402.ts +151 -0
  38. package/src/utils/base64.ts +48 -0
  39. package/src/utils/routes.ts +240 -0
  40. package/src/utils/utils/index.ts +7 -0
  41. package/src/utils/utils/mock-facilitator.ts +184 -0
  42. package/src/utils/x402.ts +147 -0
  43. package/src/validation.ts +654 -0
package/README.md CHANGED
@@ -14,56 +14,343 @@ bun add @armory-sh/base
14
14
 
15
15
  Armory enables HTTP API payments via EIP-3009 `transferWithAuthorization`. Let your users pay with USDC directly from their wallet—no credit cards, no middlemen, no gas for payers.
16
16
 
17
- ## Key Exports
17
+ ## API Reference
18
+
19
+ ### Protocol Types
18
20
 
19
21
  ```typescript
20
- import {
21
- // Types
22
- type PaymentPayload,
23
- type PaymentPayloadV2,
24
- type PaymentRequirementsV2,
25
- type SettlementResponseV2,
26
- type CustomToken,
27
- type NetworkConfig,
22
+ import type {
23
+ // V2 Protocol (x402 v2 / CAIP)
24
+ PaymentPayloadV2,
25
+ PaymentRequirementsV2,
26
+ PaymentRequiredV2,
27
+ SettlementResponseV2,
28
+ PayToV2,
29
+ EIP3009Authorization,
30
+ Extensions,
31
+ ResourceInfo,
32
+ Signature,
33
+ Address,
34
+ CAIPAssetId,
35
+
36
+ // Unified Types
37
+ PaymentPayload,
38
+ PaymentRequirements,
39
+ SettlementResponse,
40
+ } from '@armory-sh/base';
41
+ ```
28
42
 
29
- // Encoding/Decoding
43
+ ### Encoding / Decoding
44
+
45
+ ```typescript
46
+ import {
47
+ // V2 Encoding
30
48
  encodePaymentV2,
31
49
  decodePaymentV2,
32
50
  encodeSettlementV2,
33
51
  decodeSettlementV2,
52
+
53
+ // x402 Cross-Version Encoding
54
+ encodePayment,
55
+ decodePayment,
56
+ encodeSettlementResponse,
57
+ decodeSettlementResponse,
58
+ encodeX402Response,
59
+ decodeX402Response,
60
+
61
+ // Base64 Utilities
34
62
  safeBase64Encode,
35
63
  safeBase64Decode,
64
+ toBase64Url,
65
+ normalizeBase64Url,
66
+ encodeUtf8ToBase64,
67
+ decodeBase64ToUtf8,
68
+
69
+ // Header Creation
70
+ createPaymentRequiredHeaders,
71
+ createSettlementHeaders,
72
+ extractPaymentFromHeaders,
73
+
74
+ // Type Guards
75
+ isPaymentV2,
76
+ isSettlementV2,
77
+ isX402V2Payload,
78
+ isX402V2PaymentRequired,
79
+ isX402V2Settlement,
80
+ isPaymentPayload,
81
+ detectPaymentVersion,
82
+ } from '@armory-sh/base';
83
+ ```
84
+
85
+ ### EIP-712 (EIP-3009 Signing)
36
86
 
37
- // EIP-712
87
+ ```typescript
88
+ import {
89
+ // Domain & Typed Data
38
90
  createEIP712Domain,
91
+ EIP712_TYPES,
92
+ USDC_DOMAIN,
93
+
94
+ // Transfer With Authorization
39
95
  createTransferWithAuthorization,
40
96
  validateTransferWithAuthorization,
41
- EIP712_TYPES,
42
97
 
43
- // Networks
98
+ // Types
99
+ type EIP712Domain,
100
+ type TransferWithAuthorization,
101
+ type TypedDataDomain,
102
+ } from '@armory-sh/base';
103
+ ```
104
+
105
+ ### Networks
106
+
107
+ ```typescript
108
+ import {
109
+ // Network Registry
44
110
  NETWORKS,
45
111
  getNetworkConfig,
46
112
  getNetworkByChainId,
47
113
  getMainnets,
48
114
  getTestnets,
49
115
 
50
- // Token Registry
116
+ // Network Resolution
117
+ resolveNetwork,
118
+ normalizeNetworkName,
119
+ getAvailableNetworks,
120
+
121
+ // CAIP-2 Conversion
122
+ networkToCaip2,
123
+ caip2ToNetwork,
124
+
125
+ // Types
126
+ type NetworkConfig,
127
+ type ResolvedNetwork,
128
+ } from '@armory-sh/base';
129
+ ```
130
+
131
+ **Supported Networks**
132
+
133
+ | Key | Chain ID | Name |
134
+ |-----|----------|------|
135
+ | `ethereum` | 1 | Ethereum Mainnet |
136
+ | `base` | 8453 | Base Mainnet |
137
+ | `base-sepolia` | 84532 | Base Sepolia |
138
+ | `skale-base` | 1187947933 | SKALE Base |
139
+ | `skale-base-sepolia` | 324705682 | SKALE Base Sepolia |
140
+ | `ethereum-sepolia` | 11155111 | Ethereum Sepolia |
141
+
142
+ ### Tokens
143
+
144
+ ```typescript
145
+ import {
146
+ // Pre-configured Tokens
51
147
  TOKENS,
148
+ USDC_BASE,
149
+ USDC_BASE_SEPOLIA,
150
+ EURC_BASE,
151
+ getUSDCTokens,
152
+ getEURCTokens,
153
+ getAllTokens,
154
+ getTokensByChain,
155
+ getTokensBySymbol,
156
+
157
+ // Custom Token Registry
52
158
  registerToken,
53
159
  getCustomToken,
54
160
  getAllCustomTokens,
55
161
  unregisterToken,
56
162
  isCustomToken,
57
163
 
58
- // Utilities
164
+ // Token Resolution
165
+ resolveToken,
166
+ getAvailableTokens,
167
+ addressToAssetId,
168
+ assetIdToAddress,
169
+
170
+ // Types
171
+ type CustomToken,
172
+ type ResolvedToken,
173
+ } from '@armory-sh/base';
174
+ ```
175
+
176
+ **Supported Tokens**
177
+
178
+ USDC, EURC, USDT, WBTC, WETH, SKL across supported networks.
179
+
180
+ ### Protocol Utilities
181
+
182
+ ```typescript
183
+ import {
184
+ // Nonce & Time
185
+ generateNonce,
59
186
  createNonce,
60
- toAtomicUnits,
61
- fromAtomicUnits,
187
+ getCurrentTimestamp,
188
+ calculateValidBefore,
189
+
190
+ // Parsing
191
+ parseJsonOrBase64,
192
+
193
+ // Headers
194
+ getPaymentHeaderName,
195
+ PAYMENT_REQUIRED_HEADER,
196
+ PAYMENT_SIGNATURE_HEADER,
197
+ PAYMENT_RESPONSE_HEADER,
198
+
199
+ // Version Detection
200
+ detectX402Version,
201
+ X402_VERSION,
202
+ } from '@armory-sh/base';
203
+ ```
204
+
205
+ ### Payment Requirements (Middleware)
206
+
207
+ ```typescript
208
+ import {
209
+ // Requirement Creation
210
+ createPaymentRequirements,
211
+
212
+ // Requirement Lookup
213
+ findRequirementByNetwork,
214
+ findRequirementByAccepted,
215
+
216
+ // Types
217
+ type PaymentConfig,
218
+ type ResolvedRequirementsConfig,
219
+ } from '@armory-sh/base';
220
+ ```
221
+
222
+ ### Validation
223
+
224
+ ```typescript
225
+ import {
226
+ // Network & Token Validation
62
227
  resolveNetwork,
63
228
  resolveToken,
229
+ validatePaymentConfig,
230
+ validateAcceptConfig,
231
+
232
+ // Facilitator Validation
233
+ resolveFacilitator,
234
+ checkFacilitatorSupport,
235
+
236
+ // Error Creation
237
+ createError,
238
+
239
+ // Type Guards
240
+ isValidationError,
241
+ isResolvedNetwork,
242
+ isResolvedToken,
243
+
244
+ // Available Options
245
+ getAvailableNetworks,
246
+ getAvailableTokens,
64
247
  } from '@armory-sh/base';
65
248
  ```
66
249
 
250
+ ### Utilities
251
+
252
+ ```typescript
253
+ import {
254
+ // Unit Conversion
255
+ toAtomicUnits,
256
+ fromAtomicUnits,
257
+
258
+ // Address Utilities
259
+ normalizeAddress,
260
+ isValidAddress,
261
+ isAddress,
262
+
263
+ // Route Matching
264
+ matchRoute,
265
+ parseRoutePattern,
266
+ findMatchingRoute,
267
+ validateRouteConfig,
268
+
269
+ // Types
270
+ type RouteMatcher,
271
+ type RoutePattern,
272
+ } from '@armory-sh/base';
273
+ ```
274
+
275
+ ### Client Hooks Runtime
276
+
277
+ ```typescript
278
+ import {
279
+ // Hook Execution
280
+ runOnPaymentRequiredHooks,
281
+ runBeforeSignPaymentHooks,
282
+ runAfterPaymentResponseHooks,
283
+ selectRequirementWithHooks,
284
+
285
+ // Types
286
+ type ClientHook,
287
+ type OnPaymentRequiredHook,
288
+ type BeforePaymentHook,
289
+ type PaymentRequiredContext,
290
+ type PaymentPayloadContext,
291
+ type ClientHookErrorContext,
292
+ } from '@armory-sh/base';
293
+ ```
294
+
295
+ ### ERC20 ABI
296
+
297
+ ```typescript
298
+ import {
299
+ ERC20_ABI,
300
+
301
+ // Types
302
+ type ERC20Abi,
303
+ type TransferWithAuthorizationParams,
304
+ type BalanceOfParams,
305
+ } from '@armory-sh/base';
306
+ ```
307
+
308
+ ### Payment Client (Facilitator)
309
+
310
+ ```typescript
311
+ import {
312
+ // Payment Operations
313
+ verifyPayment,
314
+ settlePayment,
315
+
316
+ // Payload Extraction
317
+ decodePayloadHeader,
318
+ extractPayerAddress,
319
+
320
+ // Facilitator Discovery
321
+ getSupported,
322
+
323
+ // Types
324
+ type FacilitatorClientConfig,
325
+ type SupportedResponse,
326
+ } from '@armory-sh/base';
327
+ ```
328
+
329
+ ### Error Classes
330
+
331
+ ```typescript
332
+ import {
333
+ X402ClientError,
334
+ SigningError,
335
+ PaymentException,
336
+ } from '@armory-sh/base';
337
+ ```
338
+
339
+ ### Headers Constants
340
+
341
+ ```typescript
342
+ import {
343
+ PAYMENT_REQUIRED_HEADER,
344
+ PAYMENT_SIGNATURE_HEADER,
345
+ PAYMENT_RESPONSE_HEADER,
346
+ V2_HEADERS,
347
+ } from '@armory-sh/base';
348
+ ```
349
+
350
+ ---
351
+
352
+ ## Quick Start
353
+
67
354
  ## Quick Start
68
355
 
69
356
  ### Pre-configured Tokens
@@ -155,17 +442,6 @@ const decoded = decodePaymentV2(encoded)
155
442
  - **Custom Tokens**: Register your own tokens
156
443
  - **Encoding**: Base64URL encoding for HTTP headers
157
444
 
158
- ## Supported Networks
159
-
160
- | Network | Chain ID |
161
- |---------|----------|
162
- | Ethereum | 1 |
163
- | Base | 8453 |
164
- | Base Sepolia | 84532 |
165
- | SKALE Base | 1187947933 |
166
- | SKALE Base Sepolia | 324705682 |
167
- | Ethereum Sepolia | 11155111 |
168
-
169
445
  ## License
170
446
 
171
447
  MIT © [Sawyer Cutler](https://github.com/TheGreatAxios/armory)
@@ -0,0 +1,9 @@
1
+ import type { ClientHook, PaymentPayloadContext, PaymentRequiredContext } from "./types/hooks";
2
+ import type { PaymentRequirementsV2 } from "./types/v2";
3
+ export declare const runOnPaymentRequiredHooks: <TWallet>(hooks: ClientHook<TWallet>[] | undefined, context: PaymentRequiredContext) => Promise<void>;
4
+ export declare const selectRequirementWithHooks: <TWallet>(hooks: ClientHook<TWallet>[] | undefined, context: PaymentRequiredContext) => Promise<PaymentRequirementsV2>;
5
+ export declare const getRequirementAttemptOrderWithHooks: <TWallet>(hooks: ClientHook<TWallet>[] | undefined, context: PaymentRequiredContext) => Promise<PaymentRequirementsV2[]>;
6
+ export declare const runBeforeSignPaymentHooks: <TWallet>(hooks: ClientHook<TWallet>[] | undefined, context: PaymentPayloadContext<TWallet>) => Promise<void>;
7
+ export declare const runAfterPaymentResponseHooks: <TWallet>(hooks: ClientHook<TWallet>[] | undefined, context: PaymentPayloadContext<TWallet> & {
8
+ response: Response;
9
+ }) => Promise<void>;
@@ -4,7 +4,7 @@
4
4
  * Payment payloads are JSON-encoded for transport in HTTP headers.
5
5
  * Matches the Coinbase x402 v2 SDK format.
6
6
  */
7
- import type { PaymentPayload, X402Response, PaymentRequirements, SettlementResponse } from "../types/x402";
7
+ import type { PaymentPayload, PaymentRequirements, SettlementResponse, X402Response } from "../types/x402";
8
8
  /**
9
9
  * Safe Base64 encode (URL-safe, no padding)
10
10
  */
@@ -0,0 +1,10 @@
1
+ export declare class X402ClientError extends Error {
2
+ readonly cause?: unknown;
3
+ constructor(message: string, cause?: unknown);
4
+ }
5
+ export declare class SigningError extends X402ClientError {
6
+ constructor(message: string, cause?: unknown);
7
+ }
8
+ export declare class PaymentException extends X402ClientError {
9
+ constructor(message: string, cause?: unknown);
10
+ }
@@ -0,0 +1,9 @@
1
+ import type { PaymentRequirementsV2 } from "./types/v2";
2
+ import type { FacilitatorRoutingConfig } from "./payment-requirements";
3
+ export declare function filterExtensionsForFacilitator(extensions: Record<string, unknown> | undefined, facilitatorUrl: string | undefined, network: string, ttlMs?: number): Promise<Record<string, unknown>>;
4
+ export declare function filterExtensionsForFacilitators(extensions: Record<string, unknown> | undefined, facilitators: Array<{
5
+ url?: string;
6
+ network: string;
7
+ }>, ttlMs?: number): Promise<Record<string, unknown>>;
8
+ export declare function filterExtensionsForRequirements(extensions: Record<string, unknown> | undefined, requirements: PaymentRequirementsV2[], config: FacilitatorRoutingConfig, ttlMs?: number): Promise<Record<string, unknown>>;
9
+ export declare function clearFacilitatorCapabilityCache(): void;
package/dist/index.d.ts CHANGED
@@ -1,24 +1,32 @@
1
- export type { Address as X402Address, Hex, X402Version, Scheme, Network as X402Network, ExactEvmAuthorization, ExactEvmPayload, PaymentPayload as X402PaymentPayload, UnsignedPaymentPayload as X402UnsignedPaymentPayload, PaymentRequirements as X402PaymentRequirements, SettlementResponse as X402SettlementResponse, VerifyResponse, X402Response, } from "./types/x402";
2
- export { X402_VERSION, SCHEMES, isPaymentPayload, isExactEvmPayload, } from "./types/x402";
3
- export { safeBase64Encode, safeBase64Decode, encodePayment, decodePayment, encodeSettlementResponse, decodeSettlementResponse, encodeX402Response, decodeX402Response, detectPaymentVersion, extractPaymentFromHeaders, createPaymentRequiredHeaders, createSettlementHeaders, } from "./encoding/x402";
4
- export type { PaymentRequiredOptions } from "./encoding/x402";
5
- export { createNonce, toAtomicUnits, fromAtomicUnits, caip2ToNetwork, networkToCaip2, getCurrentTimestamp, isValidAddress, normalizeAddress, } from "./utils/x402";
6
- export type { CAIP2Network as CAIP2ChainId, CAIPAssetId, Address, Signature, PayToV2, Extensions, PaymentPayloadV2, PaymentRequirementsV2, SettlementResponseV2, PaymentRequiredV2, ResourceInfo, EIP3009Authorization, SchemePayloadV2, } from "./types/v2";
7
- export { V2_HEADERS, isCAIP2ChainId, isCAIPAssetId, isAddress, isPaymentRequiredV2, isPaymentPayloadV2, assetIdToAddress, addressToAssetId, parseSignature as parseSignatureV2, combineSignature as combineSignatureV2, } from "./types/v2";
8
- export type { PaymentPayload, PaymentRequirements, SettlementResponse, PaymentRequired, } from "./types/protocol";
9
- export { isX402V2Payload, isX402V2Requirements, isX402V2Settlement, isX402V2PaymentRequired, isSettlementSuccessful, getTxHash, PAYMENT_SIGNATURE_HEADER, PAYMENT_RESPONSE_HEADER, PAYMENT_REQUIRED_HEADER, } from "./types/protocol";
10
- export type { NetworkConfig, CustomToken } from "./types/networks";
11
- export { NETWORKS, getNetworkConfig, getNetworkByChainId, getMainnets, getTestnets, registerToken, getCustomToken, getAllCustomTokens, unregisterToken, isCustomToken, } from "./types/networks";
12
- export { TOKENS, USDC_BASE, EURC_BASE, USDC_BASE_SEPOLIA, USDC_SKALE_BASE, SKL_SKALE_BASE, USDT_SKALE_BASE, WBTC_SKALE_BASE, WETH_SKALE_BASE, SKL_SKALE_BASE_SEPOLIA, USDC_SKALE_BASE_SEPOLIA, USDT_SKALE_BASE_SEPOLIA, WBTC_SKALE_BASE_SEPOLIA, WETH_SKALE_BASE_SEPOLIA, getToken, getAllTokens, getTokensBySymbol, getTokensByChain, getUSDCTokens, getEURCTokens, getSKLTokens, getUSDTTokens, getWBTCTokens, getWETHTokens, } from "./data/tokens";
13
- export type { TransferWithAuthorizationParams, ReceiveWithAuthorizationParams, BalanceOfParams, BalanceOfReturnType, NameReturnType, SymbolReturnType, ERC20Abi, } from "./abi/erc20";
1
+ export type { BalanceOfParams, BalanceOfReturnType, ERC20Abi, NameReturnType, ReceiveWithAuthorizationParams, SymbolReturnType, TransferWithAuthorizationParams, } from "./abi/erc20";
14
2
  export { ERC20_ABI } from "./abi/erc20";
15
- export type { TypedDataDomain, EIP712Domain, TransferWithAuthorization, TypedDataField, EIP712Types, } from "./eip712";
16
- export { EIP712_TYPES, USDC_DOMAIN, createEIP712Domain, createTransferWithAuthorization, validateTransferWithAuthorization, } from "./eip712";
17
- export { resolveNetwork, resolveToken, resolveFacilitator, checkFacilitatorSupport, validatePaymentConfig, validateAcceptConfig, getAvailableNetworks, getAvailableTokens, isValidationError, isResolvedNetwork, isResolvedToken, createError, normalizeNetworkName, } from "./validation";
18
- export type { RoutePattern, RouteMatcher, RouteConfig, ParsedPattern, RouteInputConfig, RouteValidationError, } from "./utils/routes";
19
- export { parseRoutePattern, matchRoute, findMatchingRoute, validateRouteConfig, } from "./utils/routes";
20
- export { encodePaymentV2, decodePaymentV2, encodeSettlementV2, decodeSettlementV2, isPaymentV2, isSettlementV2, } from "./encoding";
21
- export type { NetworkId, TokenId, FacilitatorConfig, FacilitatorVerifyResult, FacilitatorSettleResult, SettlementMode, PayToAddress, AcceptPaymentOptions, PricingConfig, PaymentResult, PaymentError, PaymentErrorCode, ArmoryPaymentResult, ResolvedNetwork, ResolvedToken, ResolvedFacilitator, ResolvedPaymentConfig, ValidationError, } from "./types/api";
22
- export type { PaymentRequiredContext, PaymentPayloadContext, HookResult, OnPaymentRequiredHook, BeforePaymentHook, ExtensionHook, HookConfig, HookRegistry, } from "./types/hooks";
3
+ export { runAfterPaymentResponseHooks, runBeforeSignPaymentHooks, runOnPaymentRequiredHooks, selectRequirementWithHooks, } from "./client-hooks-runtime";
4
+ export { EURC_BASE, getAllTokens, getEURCTokens, getSKLTokens, getToken, getTokensByChain, getTokensBySymbol, getUSDCTokens, getUSDTTokens, getWBTCTokens, getWETHTokens, SKL_SKALE_BASE, SKL_SKALE_BASE_SEPOLIA, TOKENS, USDC_BASE, USDC_BASE_SEPOLIA, USDC_SKALE_BASE, USDC_SKALE_BASE_SEPOLIA, USDT_SKALE_BASE, USDT_SKALE_BASE_SEPOLIA, WBTC_SKALE_BASE, WBTC_SKALE_BASE_SEPOLIA, WETH_SKALE_BASE, WETH_SKALE_BASE_SEPOLIA, } from "./data/tokens";
5
+ export type { EIP712Domain, EIP712Types, TransferWithAuthorization, TypedDataDomain, TypedDataField, } from "./eip712";
6
+ export { createEIP712Domain, createTransferWithAuthorization, EIP712_TYPES, USDC_DOMAIN, validateTransferWithAuthorization, } from "./eip712";
7
+ export { decodePaymentV2, decodeSettlementV2, encodePaymentV2, encodeSettlementV2, isPaymentV2, isSettlementV2, } from "./encoding";
8
+ export type { PaymentRequiredOptions } from "./encoding/x402";
9
+ export { createPaymentRequiredHeaders, createSettlementHeaders, decodePayment, decodeSettlementResponse, decodeX402Response, detectPaymentVersion, encodePayment, encodeSettlementResponse, encodeX402Response, extractPaymentFromHeaders, safeBase64Decode, safeBase64Encode, } from "./encoding/x402";
10
+ export { PaymentException, SigningError, X402ClientError, } from "./errors";
23
11
  export type { FacilitatorClientConfig, SupportedKind, SupportedResponse, } from "./payment-client";
24
- export { verifyPayment, settlePayment, getSupported, decodePayloadHeader, extractPayerAddress, } from "./payment-client";
12
+ export { decodePayloadHeader, extractPayerAddress, getSupported, settlePayment, verifyPayment, } from "./payment-client";
13
+ export { clearFacilitatorCapabilityCache, filterExtensionsForFacilitator, filterExtensionsForFacilitators, filterExtensionsForRequirements, } from "./facilitator-capabilities";
14
+ export type { PaymentConfig, ResolvedRequirementsConfig, } from "./payment-requirements";
15
+ export { createPaymentRequirements, findRequirementByAccepted, findRequirementByNetwork, resolveFacilitatorUrlFromRequirement, } from "./payment-requirements";
16
+ export { calculateValidBefore, detectX402Version, generateNonce, getPaymentHeaderName, parseJsonOrBase64, } from "./protocol";
17
+ export type { AcceptPaymentOptions, ArmoryPaymentResult, FacilitatorConfig, FacilitatorSettleResult, FacilitatorVerifyResult, NetworkId, PaymentError, PaymentErrorCode, PaymentResult, PayToAddress, PricingConfig, ResolvedFacilitator, ResolvedNetwork, ResolvedPaymentConfig, ResolvedToken, SettlementMode, TokenId, ValidationError, } from "./types/api";
18
+ export type { BeforePaymentHook, ClientHook, ClientHookErrorContext, ExtensionHook, HookConfig, HookRegistry, HookResult, OnPaymentRequiredHook, PaymentPayloadContext, PaymentRequiredContext, } from "./types/hooks";
19
+ export type { CustomToken, NetworkConfig } from "./types/networks";
20
+ export { getAllCustomTokens, getCustomToken, getMainnets, getNetworkByChainId, getNetworkConfig, getTestnets, isCustomToken, NETWORKS, registerToken, unregisterToken, } from "./types/networks";
21
+ export type { PaymentPayload, PaymentRequired, PaymentRequirements, SettlementResponse, } from "./types/protocol";
22
+ export { getTxHash, isSettlementSuccessful, isX402V2Payload, isX402V2PaymentRequired, isX402V2Requirements, isX402V2Settlement, PAYMENT_REQUIRED_HEADER, PAYMENT_RESPONSE_HEADER, PAYMENT_SIGNATURE_HEADER, } from "./types/protocol";
23
+ export type { Address, CAIP2Network as CAIP2ChainId, CAIPAssetId, EIP3009Authorization, Extensions, PaymentPayloadV2, PaymentRequiredV2, PaymentRequirementsV2, PayToV2, ResourceInfo, SchemePayloadV2, SettlementResponseV2, Signature, } from "./types/v2";
24
+ export { addressToAssetId, assetIdToAddress, combineSignature as combineSignatureV2, isAddress, isCAIP2ChainId, isCAIPAssetId, isPaymentPayloadV2, isPaymentRequiredV2, parseSignature as parseSignatureV2, V2_HEADERS, } from "./types/v2";
25
+ export type { PaymentWallet } from "./types/wallet";
26
+ export type { Address as X402Address, ExactEvmAuthorization, ExactEvmPayload, Hex, Network as X402Network, PaymentPayload as X402PaymentPayload, PaymentRequirements as X402PaymentRequirements, Scheme, SettlementResponse as X402SettlementResponse, UnsignedPaymentPayload as X402UnsignedPaymentPayload, VerifyResponse, X402Response, X402Version, } from "./types/x402";
27
+ export { isExactEvmPayload, isPaymentPayload, SCHEMES, X402_VERSION, } from "./types/x402";
28
+ export { decodeBase64ToUtf8, encodeUtf8ToBase64, normalizeBase64Url, toBase64Url, } from "./utils/base64";
29
+ export type { ParsedPattern, RouteConfig, RouteInputConfig, RouteMatcher, RoutePattern, RouteValidationError, } from "./utils/routes";
30
+ export { findMatchingRoute, matchRoute, parseRoutePattern, validateRouteConfig, } from "./utils/routes";
31
+ export { caip2ToNetwork, createNonce, fromAtomicUnits, getCurrentTimestamp, isValidAddress, networkToCaip2, normalizeAddress, toAtomicUnits, } from "./utils/x402";
32
+ export { checkFacilitatorSupport, createError, getAvailableNetworks, getAvailableTokens, isResolvedNetwork, isResolvedToken, isValidationError, normalizeNetworkName, resolveFacilitator, resolveNetwork, resolveToken, validateAcceptConfig, validatePaymentConfig, } from "./validation";