@relai-fi/x402 0.6.5 → 0.6.7
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 +251 -0
- package/dist/bridge.cjs +109 -0
- package/dist/bridge.cjs.map +1 -0
- package/dist/bridge.d.cts +78 -0
- package/dist/bridge.d.ts +78 -0
- package/dist/bridge.js +80 -0
- package/dist/bridge.js.map +1 -0
- package/dist/client.cjs +131 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +13 -1
- package/dist/client.d.ts +13 -1
- package/dist/client.js +131 -1
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +586 -105
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +291 -30
- package/dist/index.d.ts +291 -30
- package/dist/index.js +578 -105
- package/dist/index.js.map +1 -1
- package/dist/mpp/bridge-client.cjs +23922 -0
- package/dist/mpp/bridge-client.cjs.map +1 -0
- package/dist/mpp/bridge-client.d.cts +58 -0
- package/dist/mpp/bridge-client.d.ts +58 -0
- package/dist/mpp/bridge-client.js +23892 -0
- package/dist/mpp/bridge-client.js.map +1 -0
- package/dist/mpp/bridge-method.cjs +13202 -0
- package/dist/mpp/bridge-method.cjs.map +1 -0
- package/dist/mpp/bridge-method.d.cts +69 -0
- package/dist/mpp/bridge-method.d.ts +69 -0
- package/dist/mpp/bridge-method.js +13181 -0
- package/dist/mpp/bridge-method.js.map +1 -0
- package/dist/mpp/bridge-server.cjs +13887 -0
- package/dist/mpp/bridge-server.cjs.map +1 -0
- package/dist/mpp/bridge-server.d.cts +62 -0
- package/dist/mpp/bridge-server.d.ts +62 -0
- package/dist/mpp/bridge-server.js +13866 -0
- package/dist/mpp/bridge-server.js.map +1 -0
- package/dist/mpp/evm-server.cjs +49 -33
- package/dist/mpp/evm-server.cjs.map +1 -1
- package/dist/mpp/evm-server.js +49 -33
- package/dist/mpp/evm-server.js.map +1 -1
- package/dist/mpp/verify-erc20.cjs +71 -0
- package/dist/mpp/verify-erc20.cjs.map +1 -0
- package/dist/mpp/verify-erc20.d.cts +27 -0
- package/dist/mpp/verify-erc20.d.ts +27 -0
- package/dist/mpp/verify-erc20.js +46 -0
- package/dist/mpp/verify-erc20.js.map +1 -0
- package/dist/mpp/verify-spl.cjs +96 -0
- package/dist/mpp/verify-spl.cjs.map +1 -0
- package/dist/mpp/verify-spl.d.cts +30 -0
- package/dist/mpp/verify-spl.d.ts +30 -0
- package/dist/mpp/verify-spl.js +71 -0
- package/dist/mpp/verify-spl.js.map +1 -0
- package/dist/mpp/with-bridge.cjs +23956 -0
- package/dist/mpp/with-bridge.cjs.map +1 -0
- package/dist/mpp/with-bridge.d.cts +53 -0
- package/dist/mpp/with-bridge.d.ts +53 -0
- package/dist/mpp/with-bridge.js +23926 -0
- package/dist/mpp/with-bridge.js.map +1 -0
- package/dist/plugins.d.cts +2 -2
- package/dist/plugins.d.ts +2 -2
- package/dist/react/index.cjs +131 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +131 -1
- package/dist/react/index.js.map +1 -1
- package/dist/{server-DaySqG5H.d.ts → server-D9ZfrFFx.d.ts} +1 -1
- package/dist/{server-CBZ2RjEP.d.cts → server-DgMG2zhy.d.cts} +1 -1
- package/dist/server.cjs +6 -39
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +6 -39
- package/dist/server.js.map +1 -1
- package/dist/{types-Y9ni5XwY.d.cts → types-DjEveKgt.d.cts} +1 -1
- package/dist/{types-Y9ni5XwY.d.ts → types-DjEveKgt.d.ts} +1 -1
- package/package.json +31 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from 'mppx';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Bridge charge method for MPP — shared schema used by both server and client.
|
|
5
|
+
*
|
|
6
|
+
* Enables cross-chain payments: the client pays on a source chain (e.g. Base),
|
|
7
|
+
* the bridge settles on the merchant's target chain (e.g. SKALE).
|
|
8
|
+
*
|
|
9
|
+
* Composable with direct evm/charge methods via Mppx.compose() — the client
|
|
10
|
+
* receives both challenges and picks direct payment if it has the right wallet,
|
|
11
|
+
* or bridge if it needs cross-chain routing.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
declare const charge: {
|
|
15
|
+
readonly intent: "charge";
|
|
16
|
+
readonly name: "bridge";
|
|
17
|
+
readonly schema: {
|
|
18
|
+
readonly credential: {
|
|
19
|
+
readonly payload: z.ZodMiniObject<{
|
|
20
|
+
/** "settled" = client called bridge settle, targetTxHash is proof */
|
|
21
|
+
type: z.ZodMiniString<string>;
|
|
22
|
+
/** Target chain tx hash (0x-prefixed) — server verifies on-chain */
|
|
23
|
+
targetTxHash: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
24
|
+
/** Source chain tx hash/signature (for auditing) */
|
|
25
|
+
sourceTxHash: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
26
|
+
/** CAIP-2 source chain used */
|
|
27
|
+
sourceChain: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
};
|
|
30
|
+
readonly request: z.ZodMiniObject<{
|
|
31
|
+
/** Amount in target token base units */
|
|
32
|
+
amount: z.ZodMiniString<string>;
|
|
33
|
+
/** Target ERC-20 token contract address */
|
|
34
|
+
currency: z.ZodMiniString<string>;
|
|
35
|
+
/** Target chain recipient address (merchant) */
|
|
36
|
+
recipient: z.ZodMiniString<string>;
|
|
37
|
+
/** Human-readable description */
|
|
38
|
+
description: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
39
|
+
methodDetails: z.ZodMiniObject<{
|
|
40
|
+
/** Target chain ID (where the merchant gets paid) */
|
|
41
|
+
targetChainId: z.ZodMiniNumber<number>;
|
|
42
|
+
/** Human-readable target network name (e.g. "skale-base") */
|
|
43
|
+
targetNetwork: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
44
|
+
/** Target chain RPC URL (for server-side verification) */
|
|
45
|
+
targetRpcUrl: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
46
|
+
/** Target token decimals */
|
|
47
|
+
targetDecimals: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
48
|
+
/** Bridge settle endpoint URL */
|
|
49
|
+
settleEndpoint: z.ZodMiniString<string>;
|
|
50
|
+
/** Supported source chains (CAIP-2 format, e.g. ["eip155:8453", "solana:5eykt4..."]) */
|
|
51
|
+
supportedSourceChains: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
52
|
+
/** Supported source token addresses */
|
|
53
|
+
supportedSourceAssets: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
54
|
+
/** Bridge receiver addresses per source chain: { [caip2]: address } */
|
|
55
|
+
payToMap: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
|
|
56
|
+
/** Solana fee payer address (bridge facilitator sponsors gas) */
|
|
57
|
+
feePayerSvm: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
58
|
+
/** Bridge fee in basis points */
|
|
59
|
+
feeBps: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
60
|
+
/** Payment facilitator URL */
|
|
61
|
+
paymentFacilitator: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
62
|
+
/** Unique reference ID (for replay protection) */
|
|
63
|
+
reference: z.ZodMiniString<string>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export { charge };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from 'mppx';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Bridge charge method for MPP — shared schema used by both server and client.
|
|
5
|
+
*
|
|
6
|
+
* Enables cross-chain payments: the client pays on a source chain (e.g. Base),
|
|
7
|
+
* the bridge settles on the merchant's target chain (e.g. SKALE).
|
|
8
|
+
*
|
|
9
|
+
* Composable with direct evm/charge methods via Mppx.compose() — the client
|
|
10
|
+
* receives both challenges and picks direct payment if it has the right wallet,
|
|
11
|
+
* or bridge if it needs cross-chain routing.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
declare const charge: {
|
|
15
|
+
readonly intent: "charge";
|
|
16
|
+
readonly name: "bridge";
|
|
17
|
+
readonly schema: {
|
|
18
|
+
readonly credential: {
|
|
19
|
+
readonly payload: z.ZodMiniObject<{
|
|
20
|
+
/** "settled" = client called bridge settle, targetTxHash is proof */
|
|
21
|
+
type: z.ZodMiniString<string>;
|
|
22
|
+
/** Target chain tx hash (0x-prefixed) — server verifies on-chain */
|
|
23
|
+
targetTxHash: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
24
|
+
/** Source chain tx hash/signature (for auditing) */
|
|
25
|
+
sourceTxHash: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
26
|
+
/** CAIP-2 source chain used */
|
|
27
|
+
sourceChain: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
};
|
|
30
|
+
readonly request: z.ZodMiniObject<{
|
|
31
|
+
/** Amount in target token base units */
|
|
32
|
+
amount: z.ZodMiniString<string>;
|
|
33
|
+
/** Target ERC-20 token contract address */
|
|
34
|
+
currency: z.ZodMiniString<string>;
|
|
35
|
+
/** Target chain recipient address (merchant) */
|
|
36
|
+
recipient: z.ZodMiniString<string>;
|
|
37
|
+
/** Human-readable description */
|
|
38
|
+
description: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
39
|
+
methodDetails: z.ZodMiniObject<{
|
|
40
|
+
/** Target chain ID (where the merchant gets paid) */
|
|
41
|
+
targetChainId: z.ZodMiniNumber<number>;
|
|
42
|
+
/** Human-readable target network name (e.g. "skale-base") */
|
|
43
|
+
targetNetwork: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
44
|
+
/** Target chain RPC URL (for server-side verification) */
|
|
45
|
+
targetRpcUrl: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
46
|
+
/** Target token decimals */
|
|
47
|
+
targetDecimals: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
48
|
+
/** Bridge settle endpoint URL */
|
|
49
|
+
settleEndpoint: z.ZodMiniString<string>;
|
|
50
|
+
/** Supported source chains (CAIP-2 format, e.g. ["eip155:8453", "solana:5eykt4..."]) */
|
|
51
|
+
supportedSourceChains: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
52
|
+
/** Supported source token addresses */
|
|
53
|
+
supportedSourceAssets: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
54
|
+
/** Bridge receiver addresses per source chain: { [caip2]: address } */
|
|
55
|
+
payToMap: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
|
|
56
|
+
/** Solana fee payer address (bridge facilitator sponsors gas) */
|
|
57
|
+
feePayerSvm: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
58
|
+
/** Bridge fee in basis points */
|
|
59
|
+
feeBps: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
60
|
+
/** Payment facilitator URL */
|
|
61
|
+
paymentFacilitator: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
62
|
+
/** Unique reference ID (for replay protection) */
|
|
63
|
+
reference: z.ZodMiniString<string>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export { charge };
|