x402-evm-mantle 2.1.1-mantle
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 +183 -0
- package/dist/cjs/exact/client/index.d.ts +53 -0
- package/dist/cjs/exact/client/index.js +270 -0
- package/dist/cjs/exact/client/index.js.map +1 -0
- package/dist/cjs/exact/facilitator/index.d.ts +118 -0
- package/dist/cjs/exact/facilitator/index.js +735 -0
- package/dist/cjs/exact/facilitator/index.js.map +1 -0
- package/dist/cjs/exact/server/index.d.ts +140 -0
- package/dist/cjs/exact/server/index.js +247 -0
- package/dist/cjs/exact/server/index.js.map +1 -0
- package/dist/cjs/exact/v1/client/index.d.ts +37 -0
- package/dist/cjs/exact/v1/client/index.js +147 -0
- package/dist/cjs/exact/v1/client/index.js.map +1 -0
- package/dist/cjs/exact/v1/facilitator/index.d.ts +62 -0
- package/dist/cjs/exact/v1/facilitator/index.js +401 -0
- package/dist/cjs/exact/v1/facilitator/index.js.map +1 -0
- package/dist/cjs/index.d.ts +36 -0
- package/dist/cjs/index.js +148 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/signer-5OVDxViv.d.ts +79 -0
- package/dist/cjs/v1/index.d.ts +7 -0
- package/dist/cjs/v1/index.js +171 -0
- package/dist/cjs/v1/index.js.map +1 -0
- package/dist/esm/chunk-CYGMVQCG.mjs +88 -0
- package/dist/esm/chunk-CYGMVQCG.mjs.map +1 -0
- package/dist/esm/chunk-DI3EK7PR.mjs +305 -0
- package/dist/esm/chunk-DI3EK7PR.mjs.map +1 -0
- package/dist/esm/chunk-QLXM7BIB.mjs +23 -0
- package/dist/esm/chunk-QLXM7BIB.mjs.map +1 -0
- package/dist/esm/chunk-S5OEANGR.mjs +92 -0
- package/dist/esm/chunk-S5OEANGR.mjs.map +1 -0
- package/dist/esm/chunk-T3FPOH7F.mjs +88 -0
- package/dist/esm/chunk-T3FPOH7F.mjs.map +1 -0
- package/dist/esm/exact/client/index.d.mts +53 -0
- package/dist/esm/exact/client/index.mjs +36 -0
- package/dist/esm/exact/client/index.mjs.map +1 -0
- package/dist/esm/exact/facilitator/index.d.mts +118 -0
- package/dist/esm/exact/facilitator/index.mjs +324 -0
- package/dist/esm/exact/facilitator/index.mjs.map +1 -0
- package/dist/esm/exact/server/index.d.mts +140 -0
- package/dist/esm/exact/server/index.mjs +219 -0
- package/dist/esm/exact/server/index.mjs.map +1 -0
- package/dist/esm/exact/v1/client/index.d.mts +37 -0
- package/dist/esm/exact/v1/client/index.mjs +8 -0
- package/dist/esm/exact/v1/client/index.mjs.map +1 -0
- package/dist/esm/exact/v1/facilitator/index.d.mts +62 -0
- package/dist/esm/exact/v1/facilitator/index.mjs +8 -0
- package/dist/esm/exact/v1/facilitator/index.mjs.map +1 -0
- package/dist/esm/index.d.mts +36 -0
- package/dist/esm/index.mjs +21 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/signer-5OVDxViv.d.mts +79 -0
- package/dist/esm/v1/index.d.mts +7 -0
- package/dist/esm/v1/index.mjs +13 -0
- package/dist/esm/v1/index.mjs.map +1 -0
- package/package.json +127 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { SchemeNetworkFacilitator, PaymentPayload, PaymentRequirements, VerifyResponse, SettleResponse, Network } from 'x402-core-mantle/types';
|
|
2
|
+
import { F as FacilitatorEvmSigner } from '../../signer-5OVDxViv.js';
|
|
3
|
+
import { x402Facilitator } from 'x402-core-mantle/facilitator';
|
|
4
|
+
|
|
5
|
+
interface ExactEvmSchemeConfig {
|
|
6
|
+
/**
|
|
7
|
+
* If enabled, the facilitator will deploy ERC-4337 smart wallets
|
|
8
|
+
* via EIP-6492 when encountering undeployed contract signatures.
|
|
9
|
+
*
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
deployERC4337WithEIP6492?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* EVM facilitator implementation for the Exact payment scheme.
|
|
16
|
+
*/
|
|
17
|
+
declare class ExactEvmScheme implements SchemeNetworkFacilitator {
|
|
18
|
+
private readonly signer;
|
|
19
|
+
readonly scheme = "exact";
|
|
20
|
+
readonly caipFamily = "eip155:*";
|
|
21
|
+
private readonly config;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new ExactEvmFacilitator instance.
|
|
24
|
+
*
|
|
25
|
+
* @param signer - The EVM signer for facilitator operations
|
|
26
|
+
* @param config - Optional configuration for the facilitator
|
|
27
|
+
*/
|
|
28
|
+
constructor(signer: FacilitatorEvmSigner, config?: ExactEvmSchemeConfig);
|
|
29
|
+
/**
|
|
30
|
+
* Get mechanism-specific extra data for the supported kinds endpoint.
|
|
31
|
+
* For EVM, no extra data is needed.
|
|
32
|
+
*
|
|
33
|
+
* @param _ - The network identifier (unused for EVM)
|
|
34
|
+
* @returns undefined (EVM has no extra data)
|
|
35
|
+
*/
|
|
36
|
+
getExtra(_: string): Record<string, unknown> | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Get signer addresses used by this facilitator.
|
|
39
|
+
* Returns all addresses this facilitator can use for signing/settling transactions.
|
|
40
|
+
*
|
|
41
|
+
* @param _ - The network identifier (unused for EVM, addresses are network-agnostic)
|
|
42
|
+
* @returns Array of facilitator wallet addresses
|
|
43
|
+
*/
|
|
44
|
+
getSigners(_: string): string[];
|
|
45
|
+
/**
|
|
46
|
+
* Verifies a payment payload.
|
|
47
|
+
*
|
|
48
|
+
* @param payload - The payment payload to verify
|
|
49
|
+
* @param requirements - The payment requirements
|
|
50
|
+
* @returns Promise resolving to verification response
|
|
51
|
+
*/
|
|
52
|
+
verify(payload: PaymentPayload, requirements: PaymentRequirements): Promise<VerifyResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* Settles a payment by executing the transfer.
|
|
55
|
+
*
|
|
56
|
+
* @param payload - The payment payload to settle
|
|
57
|
+
* @param requirements - The payment requirements
|
|
58
|
+
* @returns Promise resolving to settlement response
|
|
59
|
+
*/
|
|
60
|
+
settle(payload: PaymentPayload, requirements: PaymentRequirements): Promise<SettleResponse>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Configuration options for registering EVM schemes to an x402Facilitator
|
|
65
|
+
*/
|
|
66
|
+
interface EvmFacilitatorConfig {
|
|
67
|
+
/**
|
|
68
|
+
* The EVM signer for facilitator operations (verify and settle)
|
|
69
|
+
*/
|
|
70
|
+
signer: FacilitatorEvmSigner;
|
|
71
|
+
/**
|
|
72
|
+
* Networks to register (single network or array of networks)
|
|
73
|
+
* Examples: "eip155:84532", ["eip155:84532", "eip155:1"]
|
|
74
|
+
*/
|
|
75
|
+
networks: Network | Network[];
|
|
76
|
+
/**
|
|
77
|
+
* If enabled, the facilitator will deploy ERC-4337 smart wallets
|
|
78
|
+
* via EIP-6492 when encountering undeployed contract signatures.
|
|
79
|
+
*
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
82
|
+
deployERC4337WithEIP6492?: boolean;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Registers EVM exact payment schemes to an x402Facilitator instance.
|
|
86
|
+
*
|
|
87
|
+
* This function registers:
|
|
88
|
+
* - V2: Specified networks with ExactEvmScheme
|
|
89
|
+
* - V1: All supported EVM networks with ExactEvmSchemeV1
|
|
90
|
+
*
|
|
91
|
+
* @param facilitator - The x402Facilitator instance to register schemes to
|
|
92
|
+
* @param config - Configuration for EVM facilitator registration
|
|
93
|
+
* @returns The facilitator instance for chaining
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* import { registerExactEvmScheme } from "@x402/evm/exact/facilitator/register";
|
|
98
|
+
* import { x402Facilitator } from "x402-core-mantle/facilitator";
|
|
99
|
+
* import { createPublicClient, createWalletClient } from "viem";
|
|
100
|
+
*
|
|
101
|
+
* const facilitator = new x402Facilitator();
|
|
102
|
+
*
|
|
103
|
+
* // Single network
|
|
104
|
+
* registerExactEvmScheme(facilitator, {
|
|
105
|
+
* signer: combinedClient,
|
|
106
|
+
* networks: "eip155:84532" // Base Sepolia
|
|
107
|
+
* });
|
|
108
|
+
*
|
|
109
|
+
* // Multiple networks (will auto-derive eip155:* pattern)
|
|
110
|
+
* registerExactEvmScheme(facilitator, {
|
|
111
|
+
* signer: combinedClient,
|
|
112
|
+
* networks: ["eip155:84532", "eip155:1"] // Base Sepolia and Mainnet
|
|
113
|
+
* });
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
declare function registerExactEvmScheme(facilitator: x402Facilitator, config: EvmFacilitatorConfig): x402Facilitator;
|
|
117
|
+
|
|
118
|
+
export { type EvmFacilitatorConfig, ExactEvmScheme, type ExactEvmSchemeConfig, registerExactEvmScheme };
|