@wtflabs/x402 0.0.1-beta.4 → 0.0.1-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client/index.d.ts +1 -1
- package/dist/cjs/client/index.js +7 -2
- package/dist/cjs/client/index.js.map +1 -1
- package/dist/cjs/facilitator/index.d.ts +1 -1
- package/dist/cjs/facilitator/index.js +444 -87
- package/dist/cjs/facilitator/index.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +445 -88
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/{middleware-Brgsx32F.d.ts → middleware-nzDe-TDJ.d.ts} +1 -1
- package/dist/cjs/paywall/index.d.ts +1 -1
- package/dist/cjs/schemes/index.d.ts +25 -7
- package/dist/cjs/schemes/index.js +477 -95
- package/dist/cjs/schemes/index.js.map +1 -1
- package/dist/cjs/shared/index.d.ts +2 -2
- package/dist/cjs/shared/index.js +6 -1
- package/dist/cjs/shared/index.js.map +1 -1
- package/dist/cjs/types/index.d.ts +93 -4
- package/dist/cjs/types/index.js +64 -1
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/verify/index.d.ts +2 -2
- package/dist/cjs/verify/index.js +6 -1
- package/dist/cjs/verify/index.js.map +1 -1
- package/dist/{esm/x402Specs-CYq5tSY1.d.mts → cjs/x402Specs-BtRXj67U.d.ts} +43 -10
- package/dist/esm/{chunk-G6WN2WYX.mjs → chunk-3SCH5JL2.mjs} +433 -98
- package/dist/esm/chunk-3SCH5JL2.mjs.map +1 -0
- package/dist/esm/{chunk-2AM3S66N.mjs → chunk-7MNUQUHN.mjs} +3 -3
- package/dist/esm/{chunk-34YNR4LY.mjs → chunk-KABV25HJ.mjs} +3 -3
- package/dist/esm/{chunk-UCBE7FDY.mjs → chunk-NPWDNT2P.mjs} +67 -2
- package/dist/esm/chunk-NPWDNT2P.mjs.map +1 -0
- package/dist/esm/{chunk-RX2JKK4O.mjs → chunk-VTLJOZXM.mjs} +3 -3
- package/dist/esm/chunk-VTLJOZXM.mjs.map +1 -0
- package/dist/esm/client/index.d.mts +1 -1
- package/dist/esm/client/index.mjs +3 -3
- package/dist/esm/facilitator/index.d.mts +1 -1
- package/dist/esm/facilitator/index.mjs +4 -4
- package/dist/esm/index.d.mts +1 -1
- package/dist/esm/index.mjs +5 -5
- package/dist/esm/{middleware-BSjsPDKM.d.mts → middleware-DSDucaQ5.d.mts} +1 -1
- package/dist/esm/paywall/index.d.mts +1 -1
- package/dist/esm/schemes/index.d.mts +25 -7
- package/dist/esm/schemes/index.mjs +3 -3
- package/dist/esm/shared/index.d.mts +2 -2
- package/dist/esm/shared/index.mjs +1 -1
- package/dist/esm/types/index.d.mts +93 -4
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/verify/index.d.mts +2 -2
- package/dist/esm/verify/index.mjs +1 -1
- package/dist/{cjs/x402Specs-CYq5tSY1.d.ts → esm/x402Specs-BtRXj67U.d.mts} +43 -10
- package/package.json +15 -15
- package/dist/cjs/middleware-6_1ApcJn.d.ts +0 -93
- package/dist/cjs/middleware-B_ewwsQp.d.ts +0 -93
- package/dist/cjs/middleware-BwfW7mAs.d.ts +0 -93
- package/dist/cjs/middleware-CQb61c1k.d.ts +0 -93
- package/dist/cjs/middleware-DB9lqy9f.d.ts +0 -93
- package/dist/cjs/middleware-DcHctwQV.d.ts +0 -93
- package/dist/cjs/middleware-De0jD3Bp.d.ts +0 -93
- package/dist/cjs/middleware-HoFOmpgv.d.ts +0 -93
- package/dist/cjs/middleware-Y8AiAfYw.d.ts +0 -93
- package/dist/cjs/middleware-pnres9YM.d.ts +0 -93
- package/dist/cjs/network-RtNddYQk.d.ts +0 -11
- package/dist/cjs/rpc-Ca8eHCWz.d.ts +0 -35
- package/dist/cjs/wallet-BRWfOM5D.d.ts +0 -153
- package/dist/cjs/wallet-BYRAGtOB.d.ts +0 -153
- package/dist/cjs/wallet-BmEtlgEf.d.ts +0 -48
- package/dist/cjs/wallet-CNOAmyZ6.d.ts +0 -48
- package/dist/cjs/wallet-D1SoxFTw.d.ts +0 -48
- package/dist/cjs/wallet-SJ-hbjm9.d.ts +0 -153
- package/dist/cjs/wallet-ecnda4Aj.d.ts +0 -48
- package/dist/cjs/wallet-gP8Qoi-c.d.ts +0 -74
- package/dist/cjs/x402Specs-B7InXo2L.d.ts +0 -1065
- package/dist/cjs/x402Specs-BLH3j34O.d.ts +0 -1696
- package/dist/cjs/x402Specs-C7LipAZg.d.ts +0 -1715
- package/dist/cjs/x402Specs-CeajqonG.d.ts +0 -1696
- package/dist/cjs/x402Specs-qMujgEV5.d.ts +0 -1715
- package/dist/cjs/x402Specs-qUBCpcuz.d.ts +0 -1715
- package/dist/esm/chunk-G6WN2WYX.mjs.map +0 -1
- package/dist/esm/chunk-RX2JKK4O.mjs.map +0 -1
- package/dist/esm/chunk-UCBE7FDY.mjs.map +0 -1
- /package/dist/esm/{chunk-2AM3S66N.mjs.map → chunk-7MNUQUHN.mjs.map} +0 -0
- /package/dist/esm/{chunk-34YNR4LY.mjs.map → chunk-KABV25HJ.mjs.map} +0 -0
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { N as Network } from './network-FrFmmiyj.js';
|
|
3
|
-
import { E as EvmSigner } from './wallet-BYRAGtOB.js';
|
|
4
|
-
import { a as PaymentPayload, P as PaymentRequirements, J as VerifyResponse, S as SettleResponse, X as SupportedPaymentKindsResponse, M as ListDiscoveryResourcesRequest, O as ListDiscoveryResourcesResponse, z as HTTPRequestStructure } from './x402Specs-CYq5tSY1.js';
|
|
5
|
-
|
|
6
|
-
declare const moneySchema: z.ZodPipeline<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodNumber]>, z.ZodNumber>;
|
|
7
|
-
type Money = z.input<typeof moneySchema>;
|
|
8
|
-
|
|
9
|
-
type Resource = `${string}://${string}`;
|
|
10
|
-
|
|
11
|
-
type CreateHeaders = () => Promise<{
|
|
12
|
-
verify: Record<string, string>;
|
|
13
|
-
settle: Record<string, string>;
|
|
14
|
-
supported: Record<string, string>;
|
|
15
|
-
list?: Record<string, string>;
|
|
16
|
-
}>;
|
|
17
|
-
/**
|
|
18
|
-
* Creates a facilitator client for interacting with the X402 payment facilitator service
|
|
19
|
-
*
|
|
20
|
-
* @param facilitator - The facilitator config to use. If not provided, the default facilitator will be used.
|
|
21
|
-
* @returns An object containing verify and settle functions for interacting with the facilitator
|
|
22
|
-
*/
|
|
23
|
-
declare function useFacilitator(facilitator?: FacilitatorConfig): {
|
|
24
|
-
verify: (payload: PaymentPayload, paymentRequirements: PaymentRequirements) => Promise<VerifyResponse>;
|
|
25
|
-
settle: (payload: PaymentPayload, paymentRequirements: PaymentRequirements) => Promise<SettleResponse>;
|
|
26
|
-
supported: () => Promise<SupportedPaymentKindsResponse>;
|
|
27
|
-
list: (config?: ListDiscoveryResourcesRequest) => Promise<ListDiscoveryResourcesResponse>;
|
|
28
|
-
};
|
|
29
|
-
declare const verify: (payload: PaymentPayload, paymentRequirements: PaymentRequirements) => Promise<VerifyResponse>;
|
|
30
|
-
declare const settle: (payload: PaymentPayload, paymentRequirements: PaymentRequirements) => Promise<SettleResponse>;
|
|
31
|
-
declare const supported: () => Promise<SupportedPaymentKindsResponse>;
|
|
32
|
-
declare const list: (config?: ListDiscoveryResourcesRequest) => Promise<ListDiscoveryResourcesResponse>;
|
|
33
|
-
|
|
34
|
-
type FacilitatorConfig = {
|
|
35
|
-
url: Resource;
|
|
36
|
-
createAuthHeaders?: CreateHeaders;
|
|
37
|
-
};
|
|
38
|
-
type PaywallConfig = {
|
|
39
|
-
cdpClientKey?: string;
|
|
40
|
-
appName?: string;
|
|
41
|
-
appLogo?: string;
|
|
42
|
-
sessionTokenEndpoint?: string;
|
|
43
|
-
};
|
|
44
|
-
type PaymentMiddlewareConfig = {
|
|
45
|
-
description?: string;
|
|
46
|
-
mimeType?: string;
|
|
47
|
-
maxTimeoutSeconds?: number;
|
|
48
|
-
inputSchema?: Omit<HTTPRequestStructure, "type" | "method">;
|
|
49
|
-
outputSchema?: object;
|
|
50
|
-
discoverable?: boolean;
|
|
51
|
-
customPaywallHtml?: string;
|
|
52
|
-
resource?: Resource;
|
|
53
|
-
errorMessages?: {
|
|
54
|
-
paymentRequired?: string;
|
|
55
|
-
invalidPayment?: string;
|
|
56
|
-
noMatchingRequirements?: string;
|
|
57
|
-
verificationFailed?: string;
|
|
58
|
-
settlementFailed?: string;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
interface ERC20TokenAmount {
|
|
62
|
-
amount: string;
|
|
63
|
-
asset: {
|
|
64
|
-
address: `0x${string}`;
|
|
65
|
-
decimals: number;
|
|
66
|
-
eip712: {
|
|
67
|
-
name: string;
|
|
68
|
-
version: string;
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
interface SPLTokenAmount {
|
|
73
|
-
amount: string;
|
|
74
|
-
asset: {
|
|
75
|
-
address: string;
|
|
76
|
-
decimals: number;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
type Price = Money | ERC20TokenAmount | SPLTokenAmount;
|
|
80
|
-
interface RouteConfig {
|
|
81
|
-
price: Price;
|
|
82
|
-
network: Network;
|
|
83
|
-
config?: PaymentMiddlewareConfig;
|
|
84
|
-
}
|
|
85
|
-
type RoutesConfig = Record<string, Price | RouteConfig>;
|
|
86
|
-
interface RoutePattern {
|
|
87
|
-
verb: string;
|
|
88
|
-
pattern: RegExp;
|
|
89
|
-
config: RouteConfig;
|
|
90
|
-
}
|
|
91
|
-
type Wallet = EvmSigner;
|
|
92
|
-
|
|
93
|
-
export { type CreateHeaders as C, type ERC20TokenAmount as E, type FacilitatorConfig as F, type Money as M, type Price as P, type RoutesConfig as R, type SPLTokenAmount as S, type Wallet as W, type RoutePattern as a, type Resource as b, type PaywallConfig as c, type PaymentMiddlewareConfig as d, type RouteConfig as e, supported as f, list as l, moneySchema as m, settle as s, useFacilitator as u, verify as v };
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { N as Network } from './network-RtNddYQk.js';
|
|
3
|
-
import { E as EvmSigner } from './wallet-gP8Qoi-c.js';
|
|
4
|
-
import { a as PaymentPayload, P as PaymentRequirements, J as VerifyResponse, S as SettleResponse, X as SupportedPaymentKindsResponse, M as ListDiscoveryResourcesRequest, O as ListDiscoveryResourcesResponse, z as HTTPRequestStructure } from './x402Specs-qMujgEV5.js';
|
|
5
|
-
|
|
6
|
-
declare const moneySchema: z.ZodPipeline<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodNumber]>, z.ZodNumber>;
|
|
7
|
-
type Money = z.input<typeof moneySchema>;
|
|
8
|
-
|
|
9
|
-
type Resource = `${string}://${string}`;
|
|
10
|
-
|
|
11
|
-
type CreateHeaders = () => Promise<{
|
|
12
|
-
verify: Record<string, string>;
|
|
13
|
-
settle: Record<string, string>;
|
|
14
|
-
supported: Record<string, string>;
|
|
15
|
-
list?: Record<string, string>;
|
|
16
|
-
}>;
|
|
17
|
-
/**
|
|
18
|
-
* Creates a facilitator client for interacting with the X402 payment facilitator service
|
|
19
|
-
*
|
|
20
|
-
* @param facilitator - The facilitator config to use. If not provided, the default facilitator will be used.
|
|
21
|
-
* @returns An object containing verify and settle functions for interacting with the facilitator
|
|
22
|
-
*/
|
|
23
|
-
declare function useFacilitator(facilitator?: FacilitatorConfig): {
|
|
24
|
-
verify: (payload: PaymentPayload, paymentRequirements: PaymentRequirements) => Promise<VerifyResponse>;
|
|
25
|
-
settle: (payload: PaymentPayload, paymentRequirements: PaymentRequirements) => Promise<SettleResponse>;
|
|
26
|
-
supported: () => Promise<SupportedPaymentKindsResponse>;
|
|
27
|
-
list: (config?: ListDiscoveryResourcesRequest) => Promise<ListDiscoveryResourcesResponse>;
|
|
28
|
-
};
|
|
29
|
-
declare const verify: (payload: PaymentPayload, paymentRequirements: PaymentRequirements) => Promise<VerifyResponse>;
|
|
30
|
-
declare const settle: (payload: PaymentPayload, paymentRequirements: PaymentRequirements) => Promise<SettleResponse>;
|
|
31
|
-
declare const supported: () => Promise<SupportedPaymentKindsResponse>;
|
|
32
|
-
declare const list: (config?: ListDiscoveryResourcesRequest) => Promise<ListDiscoveryResourcesResponse>;
|
|
33
|
-
|
|
34
|
-
type FacilitatorConfig = {
|
|
35
|
-
url: Resource;
|
|
36
|
-
createAuthHeaders?: CreateHeaders;
|
|
37
|
-
};
|
|
38
|
-
type PaywallConfig = {
|
|
39
|
-
cdpClientKey?: string;
|
|
40
|
-
appName?: string;
|
|
41
|
-
appLogo?: string;
|
|
42
|
-
sessionTokenEndpoint?: string;
|
|
43
|
-
};
|
|
44
|
-
type PaymentMiddlewareConfig = {
|
|
45
|
-
description?: string;
|
|
46
|
-
mimeType?: string;
|
|
47
|
-
maxTimeoutSeconds?: number;
|
|
48
|
-
inputSchema?: Omit<HTTPRequestStructure, "type" | "method">;
|
|
49
|
-
outputSchema?: object;
|
|
50
|
-
discoverable?: boolean;
|
|
51
|
-
customPaywallHtml?: string;
|
|
52
|
-
resource?: Resource;
|
|
53
|
-
errorMessages?: {
|
|
54
|
-
paymentRequired?: string;
|
|
55
|
-
invalidPayment?: string;
|
|
56
|
-
noMatchingRequirements?: string;
|
|
57
|
-
verificationFailed?: string;
|
|
58
|
-
settlementFailed?: string;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
interface ERC20TokenAmount {
|
|
62
|
-
amount: string;
|
|
63
|
-
asset: {
|
|
64
|
-
address: `0x${string}`;
|
|
65
|
-
decimals: number;
|
|
66
|
-
eip712: {
|
|
67
|
-
name: string;
|
|
68
|
-
version: string;
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
interface SPLTokenAmount {
|
|
73
|
-
amount: string;
|
|
74
|
-
asset: {
|
|
75
|
-
address: string;
|
|
76
|
-
decimals: number;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
type Price = Money | ERC20TokenAmount | SPLTokenAmount;
|
|
80
|
-
interface RouteConfig {
|
|
81
|
-
price: Price;
|
|
82
|
-
network: Network;
|
|
83
|
-
config?: PaymentMiddlewareConfig;
|
|
84
|
-
}
|
|
85
|
-
type RoutesConfig = Record<string, Price | RouteConfig>;
|
|
86
|
-
interface RoutePattern {
|
|
87
|
-
verb: string;
|
|
88
|
-
pattern: RegExp;
|
|
89
|
-
config: RouteConfig;
|
|
90
|
-
}
|
|
91
|
-
type Wallet = EvmSigner;
|
|
92
|
-
|
|
93
|
-
export { type CreateHeaders as C, type ERC20TokenAmount as E, type FacilitatorConfig as F, type Money as M, type Price as P, type RoutesConfig as R, type SPLTokenAmount as S, type Wallet as W, type RoutePattern as a, type Resource as b, type PaywallConfig as c, type PaymentMiddlewareConfig as d, type RouteConfig as e, supported as f, list as l, moneySchema as m, settle as s, useFacilitator as u, verify as v };
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { N as Network } from './network-RtNddYQk.js';
|
|
3
|
-
import { E as EvmSigner } from './wallet-gP8Qoi-c.js';
|
|
4
|
-
import { a as PaymentPayload, P as PaymentRequirements, u as VerifyResponse, S as SettleResponse, F as SupportedPaymentKindsResponse, w as ListDiscoveryResourcesRequest, z as ListDiscoveryResourcesResponse, m as HTTPRequestStructure } from './x402Specs-B7InXo2L.js';
|
|
5
|
-
|
|
6
|
-
declare const moneySchema: z.ZodPipeline<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodNumber]>, z.ZodNumber>;
|
|
7
|
-
type Money = z.input<typeof moneySchema>;
|
|
8
|
-
|
|
9
|
-
type Resource = `${string}://${string}`;
|
|
10
|
-
|
|
11
|
-
type CreateHeaders = () => Promise<{
|
|
12
|
-
verify: Record<string, string>;
|
|
13
|
-
settle: Record<string, string>;
|
|
14
|
-
supported: Record<string, string>;
|
|
15
|
-
list?: Record<string, string>;
|
|
16
|
-
}>;
|
|
17
|
-
/**
|
|
18
|
-
* Creates a facilitator client for interacting with the X402 payment facilitator service
|
|
19
|
-
*
|
|
20
|
-
* @param facilitator - The facilitator config to use. If not provided, the default facilitator will be used.
|
|
21
|
-
* @returns An object containing verify and settle functions for interacting with the facilitator
|
|
22
|
-
*/
|
|
23
|
-
declare function useFacilitator(facilitator?: FacilitatorConfig): {
|
|
24
|
-
verify: (payload: PaymentPayload, paymentRequirements: PaymentRequirements) => Promise<VerifyResponse>;
|
|
25
|
-
settle: (payload: PaymentPayload, paymentRequirements: PaymentRequirements) => Promise<SettleResponse>;
|
|
26
|
-
supported: () => Promise<SupportedPaymentKindsResponse>;
|
|
27
|
-
list: (config?: ListDiscoveryResourcesRequest) => Promise<ListDiscoveryResourcesResponse>;
|
|
28
|
-
};
|
|
29
|
-
declare const verify: (payload: PaymentPayload, paymentRequirements: PaymentRequirements) => Promise<VerifyResponse>;
|
|
30
|
-
declare const settle: (payload: PaymentPayload, paymentRequirements: PaymentRequirements) => Promise<SettleResponse>;
|
|
31
|
-
declare const supported: () => Promise<SupportedPaymentKindsResponse>;
|
|
32
|
-
declare const list: (config?: ListDiscoveryResourcesRequest) => Promise<ListDiscoveryResourcesResponse>;
|
|
33
|
-
|
|
34
|
-
type FacilitatorConfig = {
|
|
35
|
-
url: Resource;
|
|
36
|
-
createAuthHeaders?: CreateHeaders;
|
|
37
|
-
};
|
|
38
|
-
type PaywallConfig = {
|
|
39
|
-
cdpClientKey?: string;
|
|
40
|
-
appName?: string;
|
|
41
|
-
appLogo?: string;
|
|
42
|
-
sessionTokenEndpoint?: string;
|
|
43
|
-
};
|
|
44
|
-
type PaymentMiddlewareConfig = {
|
|
45
|
-
description?: string;
|
|
46
|
-
mimeType?: string;
|
|
47
|
-
maxTimeoutSeconds?: number;
|
|
48
|
-
inputSchema?: Omit<HTTPRequestStructure, "type" | "method">;
|
|
49
|
-
outputSchema?: object;
|
|
50
|
-
discoverable?: boolean;
|
|
51
|
-
customPaywallHtml?: string;
|
|
52
|
-
resource?: Resource;
|
|
53
|
-
errorMessages?: {
|
|
54
|
-
paymentRequired?: string;
|
|
55
|
-
invalidPayment?: string;
|
|
56
|
-
noMatchingRequirements?: string;
|
|
57
|
-
verificationFailed?: string;
|
|
58
|
-
settlementFailed?: string;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
interface ERC20TokenAmount {
|
|
62
|
-
amount: string;
|
|
63
|
-
asset: {
|
|
64
|
-
address: `0x${string}`;
|
|
65
|
-
decimals: number;
|
|
66
|
-
eip712: {
|
|
67
|
-
name: string;
|
|
68
|
-
version: string;
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
interface SPLTokenAmount {
|
|
73
|
-
amount: string;
|
|
74
|
-
asset: {
|
|
75
|
-
address: string;
|
|
76
|
-
decimals: number;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
type Price = Money | ERC20TokenAmount | SPLTokenAmount;
|
|
80
|
-
interface RouteConfig {
|
|
81
|
-
price: Price;
|
|
82
|
-
network: Network;
|
|
83
|
-
config?: PaymentMiddlewareConfig;
|
|
84
|
-
}
|
|
85
|
-
type RoutesConfig = Record<string, Price | RouteConfig>;
|
|
86
|
-
interface RoutePattern {
|
|
87
|
-
verb: string;
|
|
88
|
-
pattern: RegExp;
|
|
89
|
-
config: RouteConfig;
|
|
90
|
-
}
|
|
91
|
-
type Wallet = EvmSigner;
|
|
92
|
-
|
|
93
|
-
export { type CreateHeaders as C, type ERC20TokenAmount as E, type FacilitatorConfig as F, type Money as M, type Price as P, type RoutesConfig as R, type SPLTokenAmount as S, type Wallet as W, type RoutePattern as a, type Resource as b, type PaywallConfig as c, type PaymentMiddlewareConfig as d, type RouteConfig as e, supported as f, list as l, moneySchema as m, settle as s, useFacilitator as u, verify as v };
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { N as Network } from './network-FrFmmiyj.js';
|
|
3
|
-
import { E as EvmSigner } from './wallet-gP8Qoi-c.js';
|
|
4
|
-
import { a as PaymentPayload, P as PaymentRequirements, J as VerifyResponse, S as SettleResponse, X as SupportedPaymentKindsResponse, M as ListDiscoveryResourcesRequest, O as ListDiscoveryResourcesResponse, z as HTTPRequestStructure } from './x402Specs-CYq5tSY1.js';
|
|
5
|
-
|
|
6
|
-
declare const moneySchema: z.ZodPipeline<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodNumber]>, z.ZodNumber>;
|
|
7
|
-
type Money = z.input<typeof moneySchema>;
|
|
8
|
-
|
|
9
|
-
type Resource = `${string}://${string}`;
|
|
10
|
-
|
|
11
|
-
type CreateHeaders = () => Promise<{
|
|
12
|
-
verify: Record<string, string>;
|
|
13
|
-
settle: Record<string, string>;
|
|
14
|
-
supported: Record<string, string>;
|
|
15
|
-
list?: Record<string, string>;
|
|
16
|
-
}>;
|
|
17
|
-
/**
|
|
18
|
-
* Creates a facilitator client for interacting with the X402 payment facilitator service
|
|
19
|
-
*
|
|
20
|
-
* @param facilitator - The facilitator config to use. If not provided, the default facilitator will be used.
|
|
21
|
-
* @returns An object containing verify and settle functions for interacting with the facilitator
|
|
22
|
-
*/
|
|
23
|
-
declare function useFacilitator(facilitator?: FacilitatorConfig): {
|
|
24
|
-
verify: (payload: PaymentPayload, paymentRequirements: PaymentRequirements) => Promise<VerifyResponse>;
|
|
25
|
-
settle: (payload: PaymentPayload, paymentRequirements: PaymentRequirements) => Promise<SettleResponse>;
|
|
26
|
-
supported: () => Promise<SupportedPaymentKindsResponse>;
|
|
27
|
-
list: (config?: ListDiscoveryResourcesRequest) => Promise<ListDiscoveryResourcesResponse>;
|
|
28
|
-
};
|
|
29
|
-
declare const verify: (payload: PaymentPayload, paymentRequirements: PaymentRequirements) => Promise<VerifyResponse>;
|
|
30
|
-
declare const settle: (payload: PaymentPayload, paymentRequirements: PaymentRequirements) => Promise<SettleResponse>;
|
|
31
|
-
declare const supported: () => Promise<SupportedPaymentKindsResponse>;
|
|
32
|
-
declare const list: (config?: ListDiscoveryResourcesRequest) => Promise<ListDiscoveryResourcesResponse>;
|
|
33
|
-
|
|
34
|
-
type FacilitatorConfig = {
|
|
35
|
-
url: Resource;
|
|
36
|
-
createAuthHeaders?: CreateHeaders;
|
|
37
|
-
};
|
|
38
|
-
type PaywallConfig = {
|
|
39
|
-
cdpClientKey?: string;
|
|
40
|
-
appName?: string;
|
|
41
|
-
appLogo?: string;
|
|
42
|
-
sessionTokenEndpoint?: string;
|
|
43
|
-
};
|
|
44
|
-
type PaymentMiddlewareConfig = {
|
|
45
|
-
description?: string;
|
|
46
|
-
mimeType?: string;
|
|
47
|
-
maxTimeoutSeconds?: number;
|
|
48
|
-
inputSchema?: Omit<HTTPRequestStructure, "type" | "method">;
|
|
49
|
-
outputSchema?: object;
|
|
50
|
-
discoverable?: boolean;
|
|
51
|
-
customPaywallHtml?: string;
|
|
52
|
-
resource?: Resource;
|
|
53
|
-
errorMessages?: {
|
|
54
|
-
paymentRequired?: string;
|
|
55
|
-
invalidPayment?: string;
|
|
56
|
-
noMatchingRequirements?: string;
|
|
57
|
-
verificationFailed?: string;
|
|
58
|
-
settlementFailed?: string;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
interface ERC20TokenAmount {
|
|
62
|
-
amount: string;
|
|
63
|
-
asset: {
|
|
64
|
-
address: `0x${string}`;
|
|
65
|
-
decimals: number;
|
|
66
|
-
eip712: {
|
|
67
|
-
name: string;
|
|
68
|
-
version: string;
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
interface SPLTokenAmount {
|
|
73
|
-
amount: string;
|
|
74
|
-
asset: {
|
|
75
|
-
address: string;
|
|
76
|
-
decimals: number;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
type Price = Money | ERC20TokenAmount | SPLTokenAmount;
|
|
80
|
-
interface RouteConfig {
|
|
81
|
-
price: Price;
|
|
82
|
-
network: Network;
|
|
83
|
-
config?: PaymentMiddlewareConfig;
|
|
84
|
-
}
|
|
85
|
-
type RoutesConfig = Record<string, Price | RouteConfig>;
|
|
86
|
-
interface RoutePattern {
|
|
87
|
-
verb: string;
|
|
88
|
-
pattern: RegExp;
|
|
89
|
-
config: RouteConfig;
|
|
90
|
-
}
|
|
91
|
-
type Wallet = EvmSigner;
|
|
92
|
-
|
|
93
|
-
export { type CreateHeaders as C, type ERC20TokenAmount as E, type FacilitatorConfig as F, type Money as M, type Price as P, type RoutesConfig as R, type SPLTokenAmount as S, type Wallet as W, type RoutePattern as a, type Resource as b, type PaywallConfig as c, type PaymentMiddlewareConfig as d, type RouteConfig as e, supported as f, list as l, moneySchema as m, settle as s, useFacilitator as u, verify as v };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
declare const NetworkSchema: z.ZodEnum<["base-sepolia", "base", "avalanche-fuji", "avalanche", "iotex", "solana-devnet", "solana", "sei", "sei-testnet", "polygon", "polygon-amoy", "peaq"]>;
|
|
4
|
-
type Network = z.infer<typeof NetworkSchema>;
|
|
5
|
-
declare const SupportedEVMNetworks: Network[];
|
|
6
|
-
declare const EvmNetworkToChainId: Map<"base-sepolia" | "avalanche-fuji" | "base" | "avalanche" | "sei" | "sei-testnet" | "polygon" | "polygon-amoy" | "peaq" | "iotex" | "solana-devnet" | "solana", number>;
|
|
7
|
-
declare const SupportedSVMNetworks: Network[];
|
|
8
|
-
declare const SvmNetworkToChainId: Map<"base-sepolia" | "avalanche-fuji" | "base" | "avalanche" | "sei" | "sei-testnet" | "polygon" | "polygon-amoy" | "peaq" | "iotex" | "solana-devnet" | "solana", number>;
|
|
9
|
-
declare const ChainIdToNetwork: Record<number, Network>;
|
|
10
|
-
|
|
11
|
-
export { ChainIdToNetwork as C, EvmNetworkToChainId as E, type Network as N, SupportedEVMNetworks as S, NetworkSchema as a, SupportedSVMNetworks as b, SvmNetworkToChainId as c };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { RpcDevnet, SolanaRpcApiDevnet, RpcMainnet, SolanaRpcApiMainnet, RpcSubscriptionsFromTransport, SolanaRpcSubscriptionsApi, RpcSubscriptionsTransportFromClusterUrl, ClusterUrl } from '@solana/kit';
|
|
2
|
-
import { N as Network } from './network-RtNddYQk.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Creates a Solana RPC client for the devnet network.
|
|
6
|
-
*
|
|
7
|
-
* @param url - Optional URL of the devnet network.
|
|
8
|
-
* @returns A Solana RPC client.
|
|
9
|
-
*/
|
|
10
|
-
declare function createDevnetRpcClient(url?: string): RpcDevnet<SolanaRpcApiDevnet>;
|
|
11
|
-
/**
|
|
12
|
-
* Creates a Solana RPC client for the mainnet network.
|
|
13
|
-
*
|
|
14
|
-
* @param url - Optional URL of the mainnet network.
|
|
15
|
-
* @returns A Solana RPC client.
|
|
16
|
-
*/
|
|
17
|
-
declare function createMainnetRpcClient(url?: string): RpcMainnet<SolanaRpcApiMainnet>;
|
|
18
|
-
/**
|
|
19
|
-
* Gets the RPC client for the given network.
|
|
20
|
-
*
|
|
21
|
-
* @param network - The network to get the RPC client for
|
|
22
|
-
* @param url - Optional URL of the network. If not provided, the default URL will be used.
|
|
23
|
-
* @returns The RPC client for the given network
|
|
24
|
-
*/
|
|
25
|
-
declare function getRpcClient(network: Network, url?: string): RpcDevnet<SolanaRpcApiDevnet> | RpcMainnet<SolanaRpcApiMainnet>;
|
|
26
|
-
/**
|
|
27
|
-
* Gets the RPC subscriptions for the given network.
|
|
28
|
-
*
|
|
29
|
-
* @param network - The network to get the RPC subscriptions for
|
|
30
|
-
* @param url - Optional URL of the network. If not provided, the default URL will be used.
|
|
31
|
-
* @returns The RPC subscriptions for the given network
|
|
32
|
-
*/
|
|
33
|
-
declare function getRpcSubscriptions(network: Network, url?: string): RpcSubscriptionsFromTransport<SolanaRpcSubscriptionsApi, RpcSubscriptionsTransportFromClusterUrl<ClusterUrl>>;
|
|
34
|
-
|
|
35
|
-
export { createMainnetRpcClient as a, getRpcSubscriptions as b, createDevnetRpcClient as c, getRpcClient as g };
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { Chain, Transport, Account, Client, RpcSchema, PublicActions, WalletActions, LocalAccount, PublicClient, Hex } from 'viem';
|
|
2
|
-
import { baseSepolia, avalancheFuji } from 'viem/chains';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Chain configuration options for creating a signer
|
|
6
|
-
*/
|
|
7
|
-
type EvmChainConfig = string | Chain | {
|
|
8
|
-
chainId: number;
|
|
9
|
-
name: string;
|
|
10
|
-
rpcUrl: string;
|
|
11
|
-
nativeCurrency?: {
|
|
12
|
-
name: string;
|
|
13
|
-
symbol: string;
|
|
14
|
-
decimals: number;
|
|
15
|
-
};
|
|
16
|
-
blockExplorer?: {
|
|
17
|
-
name: string;
|
|
18
|
-
url: string;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
type SignerWallet<chain extends Chain = Chain, transport extends Transport = Transport, account extends Account = Account> = Client<transport, chain, account, RpcSchema, PublicActions<transport, chain, account> & WalletActions<chain, account>>;
|
|
22
|
-
type ConnectedClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain, account extends Account | undefined = undefined> = PublicClient<transport, chain, account>;
|
|
23
|
-
type EvmSigner = SignerWallet<Chain, Transport, Account> | LocalAccount;
|
|
24
|
-
/**
|
|
25
|
-
* Creates a public client configured for the specified network
|
|
26
|
-
*
|
|
27
|
-
* @param network - The network to connect to
|
|
28
|
-
* @returns A public client instance connected to the specified chain
|
|
29
|
-
*/
|
|
30
|
-
declare function createConnectedClient(network: string): ConnectedClient<Transport, Chain, undefined>;
|
|
31
|
-
/**
|
|
32
|
-
* Creates a public client configured for the Base Sepolia testnet
|
|
33
|
-
*
|
|
34
|
-
* @deprecated Use `createConnectedClient("base-sepolia")` instead
|
|
35
|
-
* @returns A public client instance connected to Base Sepolia
|
|
36
|
-
*/
|
|
37
|
-
declare function createClientSepolia(): ConnectedClient<Transport, typeof baseSepolia, undefined>;
|
|
38
|
-
/**
|
|
39
|
-
* Creates a public client configured for the Avalanche Fuji testnet
|
|
40
|
-
*
|
|
41
|
-
* @deprecated Use `createConnectedClient("avalanche-fuji")` instead
|
|
42
|
-
* @returns A public client instance connected to Avalanche Fuji
|
|
43
|
-
*/
|
|
44
|
-
declare function createClientAvalancheFuji(): ConnectedClient<Transport, typeof avalancheFuji, undefined>;
|
|
45
|
-
/**
|
|
46
|
-
* Creates a wallet client configured for the specified chain with a private key
|
|
47
|
-
*
|
|
48
|
-
* @param network - The network to connect to
|
|
49
|
-
* @param privateKey - The private key to use for signing transactions
|
|
50
|
-
* @returns A wallet client instance connected to the specified chain with the provided private key
|
|
51
|
-
*/
|
|
52
|
-
declare function createSigner(network: string, privateKey: Hex): SignerWallet<Chain>;
|
|
53
|
-
/**
|
|
54
|
-
* Creates a wallet client configured for the Base Sepolia testnet with a private key
|
|
55
|
-
*
|
|
56
|
-
* @deprecated Use `createSigner("base-sepolia", privateKey)` instead
|
|
57
|
-
* @param privateKey - The private key to use for signing transactions
|
|
58
|
-
* @returns A wallet client instance connected to Base Sepolia with the provided private key
|
|
59
|
-
*/
|
|
60
|
-
declare function createSignerSepolia(privateKey: Hex): SignerWallet<typeof baseSepolia>;
|
|
61
|
-
/**
|
|
62
|
-
* Creates a wallet client configured for the Avalanche Fuji testnet with a private key
|
|
63
|
-
*
|
|
64
|
-
* @deprecated Use `createSigner("avalanche-fuji", privateKey)` instead
|
|
65
|
-
* @param privateKey - The private key to use for signing transactions
|
|
66
|
-
* @returns A wallet client instance connected to Avalanche Fuji with the provided private key
|
|
67
|
-
*/
|
|
68
|
-
declare function createSignerAvalancheFuji(privateKey: Hex): SignerWallet<typeof avalancheFuji>;
|
|
69
|
-
/**
|
|
70
|
-
* Checks if a wallet is a signer wallet
|
|
71
|
-
*
|
|
72
|
-
* @param wallet - The wallet to check
|
|
73
|
-
* @returns True if the wallet is a signer wallet, false otherwise
|
|
74
|
-
*/
|
|
75
|
-
declare function isSignerWallet<TChain extends Chain = Chain, TTransport extends Transport = Transport, TAccount extends Account = Account>(wallet: SignerWallet<TChain, TTransport, TAccount> | LocalAccount): wallet is SignerWallet<TChain, TTransport, TAccount>;
|
|
76
|
-
/**
|
|
77
|
-
* Checks if a wallet is an account
|
|
78
|
-
*
|
|
79
|
-
* @param wallet - The wallet to check
|
|
80
|
-
* @returns True if the wallet is an account, false otherwise
|
|
81
|
-
*/
|
|
82
|
-
declare function isAccount<TChain extends Chain = Chain, TTransport extends Transport = Transport, TAccount extends Account = Account>(wallet: SignerWallet<TChain, TTransport, TAccount> | LocalAccount): wallet is LocalAccount;
|
|
83
|
-
/**
|
|
84
|
-
* Maps network strings to Chain objects
|
|
85
|
-
*
|
|
86
|
-
* @param network - The network string to convert to a Chain object
|
|
87
|
-
* @returns The corresponding Chain object
|
|
88
|
-
*/
|
|
89
|
-
declare function getChainFromNetwork(network: string | undefined): Chain;
|
|
90
|
-
/**
|
|
91
|
-
* Creates a Chain configuration from various input formats
|
|
92
|
-
*
|
|
93
|
-
* @param config - The chain configuration (string, Chain object, or custom config)
|
|
94
|
-
* @param customRpcUrl - Optional custom RPC URL to override the default
|
|
95
|
-
* @returns A viem Chain object
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```typescript
|
|
99
|
-
* // Using string
|
|
100
|
-
* const chain = withChain('bsc');
|
|
101
|
-
*
|
|
102
|
-
* // Using viem chain object
|
|
103
|
-
* import { bsc } from 'viem/chains';
|
|
104
|
-
* const chain = withChain(bsc);
|
|
105
|
-
*
|
|
106
|
-
* // Using custom config
|
|
107
|
-
* const chain = withChain({
|
|
108
|
-
* chainId: 56,
|
|
109
|
-
* name: 'BSC',
|
|
110
|
-
* rpcUrl: 'https://my-custom-rpc.com',
|
|
111
|
-
* });
|
|
112
|
-
*
|
|
113
|
-
* // Override RPC for existing chain
|
|
114
|
-
* const chain = withChain('bsc', 'https://my-custom-rpc.com');
|
|
115
|
-
* ```
|
|
116
|
-
*/
|
|
117
|
-
declare function withChain(config: EvmChainConfig, customRpcUrl?: string): Chain;
|
|
118
|
-
/**
|
|
119
|
-
* Creates a wallet client with flexible chain configuration
|
|
120
|
-
*
|
|
121
|
-
* @param chainConfig - The chain configuration (string, Chain object, or custom config)
|
|
122
|
-
* @param privateKey - The private key to use for signing transactions
|
|
123
|
-
* @param customRpcUrl - Optional custom RPC URL to override the default
|
|
124
|
-
* @returns A wallet client instance
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* ```typescript
|
|
128
|
-
* // Simple usage with network name
|
|
129
|
-
* const signer = createEvmSigner('bsc', '0x...');
|
|
130
|
-
*
|
|
131
|
-
* // Using viem chain object
|
|
132
|
-
* import { bsc } from 'viem/chains';
|
|
133
|
-
* const signer = createEvmSigner(bsc, '0x...');
|
|
134
|
-
*
|
|
135
|
-
* // With custom RPC
|
|
136
|
-
* const signer = createEvmSigner('bsc', '0x...', 'https://my-custom-rpc.com');
|
|
137
|
-
*
|
|
138
|
-
* // Full custom chain
|
|
139
|
-
* const signer = createEvmSigner({
|
|
140
|
-
* chainId: 56,
|
|
141
|
-
* name: 'BSC Mainnet',
|
|
142
|
-
* rpcUrl: 'https://bsc-dataseed.binance.org',
|
|
143
|
-
* nativeCurrency: {
|
|
144
|
-
* name: 'BNB',
|
|
145
|
-
* symbol: 'BNB',
|
|
146
|
-
* decimals: 18,
|
|
147
|
-
* },
|
|
148
|
-
* }, '0x...');
|
|
149
|
-
* ```
|
|
150
|
-
*/
|
|
151
|
-
declare function createEvmSigner(chainConfig: EvmChainConfig, privateKey: Hex, customRpcUrl?: string): SignerWallet<Chain>;
|
|
152
|
-
|
|
153
|
-
export { type ConnectedClient as C, type EvmSigner as E, type SignerWallet as S, type EvmChainConfig as a, createClientAvalancheFuji as b, createEvmSigner as c, createClientSepolia as d, createConnectedClient as e, createSigner as f, createSignerAvalancheFuji as g, createSignerSepolia as h, getChainFromNetwork as i, isAccount as j, isSignerWallet as k, withChain as w };
|