uvd-x402-sdk 2.31.0 → 2.32.2
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 +80 -2
- package/dist/backend/index.d.mts +6 -1
- package/dist/backend/index.d.ts +6 -1
- package/dist/backend/index.js +31 -9
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/index.mjs +31 -10
- package/dist/backend/index.mjs.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
- package/src/backend/index.ts +41 -9
package/README.md
CHANGED
|
@@ -48,7 +48,85 @@ npm install @mysten/sui
|
|
|
48
48
|
|
|
49
49
|
## Quick Start
|
|
50
50
|
|
|
51
|
-
###
|
|
51
|
+
### Server + Client (Private Key)
|
|
52
|
+
|
|
53
|
+
The fastest way to get up and running. No browser wallet needed — works in Node.js, scripts, and agents.
|
|
54
|
+
|
|
55
|
+
**.env**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
RECEIVING_ADDRESS=0xYourWalletAddress
|
|
59
|
+
PRIVATE_KEY=0xYourPrivateKey
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Server (Hono)**
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm install hono @hono/node-server uvd-x402-sdk dotenv
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { Hono } from 'hono';
|
|
70
|
+
import { serve } from '@hono/node-server';
|
|
71
|
+
import { createHonoMiddleware } from 'uvd-x402-sdk';
|
|
72
|
+
import 'dotenv/config';
|
|
73
|
+
|
|
74
|
+
const app = new Hono();
|
|
75
|
+
const receiver = process.env.RECEIVING_ADDRESS as string;
|
|
76
|
+
|
|
77
|
+
// x402 payment middleware — handles 402, verify, and settle automatically
|
|
78
|
+
const paywall = createHonoMiddleware({
|
|
79
|
+
accepts: [{
|
|
80
|
+
network: 'skale-base',
|
|
81
|
+
asset: '0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20',
|
|
82
|
+
amount: '1000000', // $1.00 USDC.e (6 decimals)
|
|
83
|
+
payTo: receiver,
|
|
84
|
+
extra: {
|
|
85
|
+
name: 'Bridged USDC (SKALE Bridge)',
|
|
86
|
+
version: '2',
|
|
87
|
+
},
|
|
88
|
+
}],
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
app.get('/api/free', (c) => c.json({ message: 'This endpoint is free!' }));
|
|
92
|
+
|
|
93
|
+
app.get('/api/premium', paywall, (c) => {
|
|
94
|
+
return c.json({ message: 'Payment verified and settled!', timestamp: new Date().toISOString() });
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
serve({ fetch: app.fetch, port: 3000 });
|
|
98
|
+
console.log('Server running on http://localhost:3000');
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Client (Private Key)**
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npm install uvd-x402-sdk ethers dotenv
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
import { X402Client } from 'uvd-x402-sdk';
|
|
109
|
+
import 'dotenv/config';
|
|
110
|
+
|
|
111
|
+
const client = new X402Client({ defaultChain: 'skale-base' });
|
|
112
|
+
await client.connectWithPrivateKey(process.env.PRIVATE_KEY as string);
|
|
113
|
+
|
|
114
|
+
const result = await client.createPayment({
|
|
115
|
+
recipient: process.env.RECEIVING_ADDRESS as string,
|
|
116
|
+
amount: '1.00',
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const response = await fetch('http://localhost:3000/api/premium', {
|
|
120
|
+
headers: { 'X-PAYMENT': result.paymentHeader },
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const data = await response.json();
|
|
124
|
+
console.log('Response:', data);
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
This example uses SKALE Base (zero gas costs). Replace `network`, `asset`, and `extra` to use any supported chain — see [Supported Networks](#supported-networks).
|
|
128
|
+
|
|
129
|
+
### EVM Chains (Browser Wallet)
|
|
52
130
|
|
|
53
131
|
```typescript
|
|
54
132
|
import { X402Client } from 'uvd-x402-sdk';
|
|
@@ -550,7 +628,7 @@ app.post('/api/premium', async (req, res) => {
|
|
|
550
628
|
});
|
|
551
629
|
```
|
|
552
630
|
|
|
553
|
-
`createPaymentMiddleware()` and `createHonoMiddleware()` verify
|
|
631
|
+
`createPaymentMiddleware()` and `createHonoMiddleware()` verify and settle automatically by default (`before-handler`). Use `settlementStrategy: 'manual'` if you need to control when settlement happens (e.g., settle only after confirming you can fulfill the request).
|
|
554
632
|
|
|
555
633
|
## React
|
|
556
634
|
|
package/dist/backend/index.d.mts
CHANGED
|
@@ -1937,6 +1937,11 @@ interface AdvancedEscrowClientOptions {
|
|
|
1937
1937
|
* (AUTHORIZE goes through the facilitator, not directly on-chain)
|
|
1938
1938
|
*/
|
|
1939
1939
|
declare const OPERATOR_ABI: string[];
|
|
1940
|
+
/**
|
|
1941
|
+
* CREATE3-deployed operators (SKALE, future chains) use updated ABI with extra `bytes data` param
|
|
1942
|
+
* on release() and refundInEscrow(). Pass empty bytes (0x) for the data parameter.
|
|
1943
|
+
*/
|
|
1944
|
+
declare const OPERATOR_ABI_CREATE3: string[];
|
|
1940
1945
|
/**
|
|
1941
1946
|
* AdvancedEscrowClient provides the 5 Advanced Escrow flows via the
|
|
1942
1947
|
* PaymentOperator contract on 9 supported EVM networks.
|
|
@@ -2133,4 +2138,4 @@ declare class AdvancedEscrowClient {
|
|
|
2133
2138
|
refundPostEscrow(paymentInfo: AdvancedPaymentInfo, amount?: string, tokenCollector?: string, collectorData?: string): Promise<AdvancedTransactionResult>;
|
|
2134
2139
|
}
|
|
2135
2140
|
|
|
2136
|
-
export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, BASE_MAINNET_CONTRACTS, type BazaarCategory, BazaarClient, type BazaarClientOptions, type BazaarDiscoverOptions, type BazaarDiscoverResponse, type BazaarNetwork, type BazaarRegisterOptions, type BazaarResource, type BazaarToken, type CreateEscrowOptions, DEPOSIT_LIMIT_USDC, type Dispute, type DisputeOutcome, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, type Erc8004ClientOptions, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStateResponse, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, type HonoMiddlewareOptions, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, type MetadataEntryParam, OPERATOR_ABI, PAYMENT_INFO_TYPEHASH, type PaymentAcceptance, type PaymentMiddlewareOptions, type PaymentRequirementResolver, type PaymentRequirements, type PaymentRequirementsOptions, type ProofOfPayment, type RefundRequest, type RefundStatus, type RegisterAgentRequest, type RegisterAgentResponse, type ReputationResponse, type ReputationSummary, type RequestRefundOptions, type SettleRequest, type SettleResponse, type SettleResponseWithProof, TIER_TIMINGS, USDC_DOMAIN_NAME, type VerifiedPaymentState, type VerifyRequest, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildVerifyRequest, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isEscrowExpired, isEscrowSupportedOnChain, parsePaymentHeader };
|
|
2141
|
+
export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, BASE_MAINNET_CONTRACTS, type BazaarCategory, BazaarClient, type BazaarClientOptions, type BazaarDiscoverOptions, type BazaarDiscoverResponse, type BazaarNetwork, type BazaarRegisterOptions, type BazaarResource, type BazaarToken, type CreateEscrowOptions, DEPOSIT_LIMIT_USDC, type Dispute, type DisputeOutcome, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, type Erc8004ClientOptions, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStateResponse, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, type HonoMiddlewareOptions, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, type MetadataEntryParam, OPERATOR_ABI, OPERATOR_ABI_CREATE3, PAYMENT_INFO_TYPEHASH, type PaymentAcceptance, type PaymentMiddlewareOptions, type PaymentRequirementResolver, type PaymentRequirements, type PaymentRequirementsOptions, type ProofOfPayment, type RefundRequest, type RefundStatus, type RegisterAgentRequest, type RegisterAgentResponse, type ReputationResponse, type ReputationSummary, type RequestRefundOptions, type SettleRequest, type SettleResponse, type SettleResponseWithProof, TIER_TIMINGS, USDC_DOMAIN_NAME, type VerifiedPaymentState, type VerifyRequest, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildVerifyRequest, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isEscrowExpired, isEscrowSupportedOnChain, parsePaymentHeader };
|
package/dist/backend/index.d.ts
CHANGED
|
@@ -1937,6 +1937,11 @@ interface AdvancedEscrowClientOptions {
|
|
|
1937
1937
|
* (AUTHORIZE goes through the facilitator, not directly on-chain)
|
|
1938
1938
|
*/
|
|
1939
1939
|
declare const OPERATOR_ABI: string[];
|
|
1940
|
+
/**
|
|
1941
|
+
* CREATE3-deployed operators (SKALE, future chains) use updated ABI with extra `bytes data` param
|
|
1942
|
+
* on release() and refundInEscrow(). Pass empty bytes (0x) for the data parameter.
|
|
1943
|
+
*/
|
|
1944
|
+
declare const OPERATOR_ABI_CREATE3: string[];
|
|
1940
1945
|
/**
|
|
1941
1946
|
* AdvancedEscrowClient provides the 5 Advanced Escrow flows via the
|
|
1942
1947
|
* PaymentOperator contract on 9 supported EVM networks.
|
|
@@ -2133,4 +2138,4 @@ declare class AdvancedEscrowClient {
|
|
|
2133
2138
|
refundPostEscrow(paymentInfo: AdvancedPaymentInfo, amount?: string, tokenCollector?: string, collectorData?: string): Promise<AdvancedTransactionResult>;
|
|
2134
2139
|
}
|
|
2135
2140
|
|
|
2136
|
-
export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, BASE_MAINNET_CONTRACTS, type BazaarCategory, BazaarClient, type BazaarClientOptions, type BazaarDiscoverOptions, type BazaarDiscoverResponse, type BazaarNetwork, type BazaarRegisterOptions, type BazaarResource, type BazaarToken, type CreateEscrowOptions, DEPOSIT_LIMIT_USDC, type Dispute, type DisputeOutcome, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, type Erc8004ClientOptions, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStateResponse, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, type HonoMiddlewareOptions, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, type MetadataEntryParam, OPERATOR_ABI, PAYMENT_INFO_TYPEHASH, type PaymentAcceptance, type PaymentMiddlewareOptions, type PaymentRequirementResolver, type PaymentRequirements, type PaymentRequirementsOptions, type ProofOfPayment, type RefundRequest, type RefundStatus, type RegisterAgentRequest, type RegisterAgentResponse, type ReputationResponse, type ReputationSummary, type RequestRefundOptions, type SettleRequest, type SettleResponse, type SettleResponseWithProof, TIER_TIMINGS, USDC_DOMAIN_NAME, type VerifiedPaymentState, type VerifyRequest, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildVerifyRequest, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isEscrowExpired, isEscrowSupportedOnChain, parsePaymentHeader };
|
|
2141
|
+
export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, BASE_MAINNET_CONTRACTS, type BazaarCategory, BazaarClient, type BazaarClientOptions, type BazaarDiscoverOptions, type BazaarDiscoverResponse, type BazaarNetwork, type BazaarRegisterOptions, type BazaarResource, type BazaarToken, type CreateEscrowOptions, DEPOSIT_LIMIT_USDC, type Dispute, type DisputeOutcome, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, type Erc8004ClientOptions, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStateResponse, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, type HonoMiddlewareOptions, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, type MetadataEntryParam, OPERATOR_ABI, OPERATOR_ABI_CREATE3, PAYMENT_INFO_TYPEHASH, type PaymentAcceptance, type PaymentMiddlewareOptions, type PaymentRequirementResolver, type PaymentRequirements, type PaymentRequirementsOptions, type ProofOfPayment, type RefundRequest, type RefundStatus, type RegisterAgentRequest, type RegisterAgentResponse, type ReputationResponse, type ReputationSummary, type RequestRefundOptions, type SettleRequest, type SettleResponse, type SettleResponseWithProof, TIER_TIMINGS, USDC_DOMAIN_NAME, type VerifiedPaymentState, type VerifyRequest, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildVerifyRequest, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isEscrowExpired, isEscrowSupportedOnChain, parsePaymentHeader };
|
package/dist/backend/index.js
CHANGED
|
@@ -1438,15 +1438,16 @@ async function resolvePaymentRequirement(payment, requirements, resolver) {
|
|
|
1438
1438
|
return { requirement: matches[0] };
|
|
1439
1439
|
}
|
|
1440
1440
|
function createVerifiedPaymentState(client, payment, requirements, verifyResult) {
|
|
1441
|
-
let
|
|
1441
|
+
let settlePromise = null;
|
|
1442
1442
|
return {
|
|
1443
1443
|
payment,
|
|
1444
1444
|
requirements,
|
|
1445
1445
|
verifyResult,
|
|
1446
|
-
settle:
|
|
1447
|
-
if (
|
|
1448
|
-
|
|
1449
|
-
|
|
1446
|
+
settle: () => {
|
|
1447
|
+
if (!settlePromise) {
|
|
1448
|
+
settlePromise = client.settle(payment, requirements);
|
|
1449
|
+
}
|
|
1450
|
+
return settlePromise;
|
|
1450
1451
|
}
|
|
1451
1452
|
};
|
|
1452
1453
|
}
|
|
@@ -3098,6 +3099,15 @@ var ESCROW_CONTRACTS = {
|
|
|
3098
3099
|
protocolFeeConfig: "0xD979dBfBdA5f4b16AAF60Eaab32A44f352076838",
|
|
3099
3100
|
refundRequest: "0xc1256Bb30bd0cdDa07D8C8Cf67a59105f2EA1b98",
|
|
3100
3101
|
usdc: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85"
|
|
3102
|
+
},
|
|
3103
|
+
// SKALE Base (chain 1187947933) - CREATE3 deployment, operator via factory
|
|
3104
|
+
1187947933: {
|
|
3105
|
+
operator: "0x28c23AE8f55aDe5Ea10a5353FC40418D0c1B3d33",
|
|
3106
|
+
escrow: "0xBC151792f80C0EB1973d56b0235e6bee2A60e245",
|
|
3107
|
+
tokenCollector: "0x9A12A116a44636F55c9e135189A1321Abcfe2f30",
|
|
3108
|
+
protocolFeeConfig: "0xf62788834C99B2E85a6891C0b46D1EB996f8f596",
|
|
3109
|
+
refundRequest: "0x69e9BF2b40Ed472b55E47e9D4205d93Ed673093F",
|
|
3110
|
+
usdc: "0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20"
|
|
3101
3111
|
}
|
|
3102
3112
|
};
|
|
3103
3113
|
var BASE_MAINNET_CONTRACTS = ESCROW_CONTRACTS[8453];
|
|
@@ -3122,6 +3132,13 @@ var OPERATOR_ABI = [
|
|
|
3122
3132
|
"function charge(tuple(address operator, address payer, address receiver, address token, uint120 maxAmount, uint48 preApprovalExpiry, uint48 authorizationExpiry, uint48 refundExpiry, uint16 minFeeBps, uint16 maxFeeBps, address feeReceiver, uint256 salt) paymentInfo, uint256 amount, address tokenCollector, bytes collectorData)",
|
|
3123
3133
|
"function refundPostEscrow(tuple(address operator, address payer, address receiver, address token, uint120 maxAmount, uint48 preApprovalExpiry, uint48 authorizationExpiry, uint48 refundExpiry, uint16 minFeeBps, uint16 maxFeeBps, address feeReceiver, uint256 salt) paymentInfo, uint256 amount, address tokenCollector, bytes collectorData)"
|
|
3124
3134
|
];
|
|
3135
|
+
var OPERATOR_ABI_CREATE3 = [
|
|
3136
|
+
"function release(tuple(address operator, address payer, address receiver, address token, uint120 maxAmount, uint48 preApprovalExpiry, uint48 authorizationExpiry, uint48 refundExpiry, uint16 minFeeBps, uint16 maxFeeBps, address feeReceiver, uint256 salt) paymentInfo, uint256 amount, bytes data)",
|
|
3137
|
+
"function refundInEscrow(tuple(address operator, address payer, address receiver, address token, uint120 maxAmount, uint48 preApprovalExpiry, uint48 authorizationExpiry, uint48 refundExpiry, uint16 minFeeBps, uint16 maxFeeBps, address feeReceiver, uint256 salt) paymentInfo, uint120 amount, bytes data)",
|
|
3138
|
+
"function charge(tuple(address operator, address payer, address receiver, address token, uint120 maxAmount, uint48 preApprovalExpiry, uint48 authorizationExpiry, uint48 refundExpiry, uint16 minFeeBps, uint16 maxFeeBps, address feeReceiver, uint256 salt) paymentInfo, uint256 amount, address tokenCollector, bytes collectorData)",
|
|
3139
|
+
"function refundPostEscrow(tuple(address operator, address payer, address receiver, address token, uint120 maxAmount, uint48 preApprovalExpiry, uint48 authorizationExpiry, uint48 refundExpiry, uint16 minFeeBps, uint16 maxFeeBps, address feeReceiver, uint256 salt) paymentInfo, uint256 amount, address tokenCollector, bytes collectorData)"
|
|
3140
|
+
];
|
|
3141
|
+
var CREATE3_CHAIN_IDS = /* @__PURE__ */ new Set([1187947933]);
|
|
3125
3142
|
var AdvancedEscrowClient = class {
|
|
3126
3143
|
facilitatorUrl;
|
|
3127
3144
|
chainId;
|
|
@@ -3370,10 +3387,12 @@ var AdvancedEscrowClient = class {
|
|
|
3370
3387
|
if (!this.payerAddress) await this.init();
|
|
3371
3388
|
try {
|
|
3372
3389
|
const { ethers } = await import('ethers');
|
|
3373
|
-
const
|
|
3390
|
+
const isCreate3 = CREATE3_CHAIN_IDS.has(this.chainId);
|
|
3391
|
+
const abi = isCreate3 ? OPERATOR_ABI_CREATE3 : OPERATOR_ABI;
|
|
3392
|
+
const contract = new ethers.Contract(this.contracts.operator, abi, this.signer);
|
|
3374
3393
|
const amt = amount || paymentInfo.maxAmount;
|
|
3375
3394
|
const tuple = this.buildTuple(paymentInfo);
|
|
3376
|
-
const tx = await contract.release(tuple, amt, { gasLimit: this.gasLimit });
|
|
3395
|
+
const tx = isCreate3 ? await contract.release(tuple, amt, "0x", { gasLimit: this.gasLimit }) : await contract.release(tuple, amt, { gasLimit: this.gasLimit });
|
|
3377
3396
|
const receipt = await tx.wait();
|
|
3378
3397
|
return {
|
|
3379
3398
|
success: receipt.status === 1,
|
|
@@ -3397,10 +3416,12 @@ var AdvancedEscrowClient = class {
|
|
|
3397
3416
|
if (!this.payerAddress) await this.init();
|
|
3398
3417
|
try {
|
|
3399
3418
|
const { ethers } = await import('ethers');
|
|
3400
|
-
const
|
|
3419
|
+
const isCreate3 = CREATE3_CHAIN_IDS.has(this.chainId);
|
|
3420
|
+
const abi = isCreate3 ? OPERATOR_ABI_CREATE3 : OPERATOR_ABI;
|
|
3421
|
+
const contract = new ethers.Contract(this.contracts.operator, abi, this.signer);
|
|
3401
3422
|
const amt = amount || paymentInfo.maxAmount;
|
|
3402
3423
|
const tuple = this.buildTuple(paymentInfo);
|
|
3403
|
-
const tx = await contract.refundInEscrow(tuple, amt, { gasLimit: this.gasLimit });
|
|
3424
|
+
const tx = isCreate3 ? await contract.refundInEscrow(tuple, amt, "0x", { gasLimit: this.gasLimit }) : await contract.refundInEscrow(tuple, amt, { gasLimit: this.gasLimit });
|
|
3404
3425
|
const receipt = await tx.wait();
|
|
3405
3426
|
return {
|
|
3406
3427
|
success: receipt.status === 1,
|
|
@@ -3754,6 +3775,7 @@ exports.Erc8004Client = Erc8004Client;
|
|
|
3754
3775
|
exports.EscrowClient = EscrowClient;
|
|
3755
3776
|
exports.FacilitatorClient = FacilitatorClient;
|
|
3756
3777
|
exports.OPERATOR_ABI = OPERATOR_ABI;
|
|
3778
|
+
exports.OPERATOR_ABI_CREATE3 = OPERATOR_ABI_CREATE3;
|
|
3757
3779
|
exports.PAYMENT_INFO_TYPEHASH = PAYMENT_INFO_TYPEHASH;
|
|
3758
3780
|
exports.TIER_TIMINGS = TIER_TIMINGS;
|
|
3759
3781
|
exports.USDC_DOMAIN_NAME = USDC_DOMAIN_NAME;
|