uvd-x402-sdk 2.31.1 → 2.33.0
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 +79 -1
- package/dist/backend/index.d.mts +9 -4
- package/dist/backend/index.d.ts +9 -4
- package/dist/backend/index.js +36 -6
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/index.mjs +36 -7
- package/dist/backend/index.mjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
- package/src/backend/index.ts +50 -10
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';
|
package/dist/backend/index.d.mts
CHANGED
|
@@ -1249,7 +1249,7 @@ declare const ERC8004_EXTENSION_ID = "8004-reputation";
|
|
|
1249
1249
|
*/
|
|
1250
1250
|
type AgentId = number | string;
|
|
1251
1251
|
/**
|
|
1252
|
-
* ERC-8004 contract addresses per network (
|
|
1252
|
+
* ERC-8004 contract addresses per network (20 networks: 18 EVM + 2 Solana)
|
|
1253
1253
|
*/
|
|
1254
1254
|
declare const ERC8004_CONTRACTS: Record<string, {
|
|
1255
1255
|
identityRegistry?: string;
|
|
@@ -1259,9 +1259,9 @@ declare const ERC8004_CONTRACTS: Record<string, {
|
|
|
1259
1259
|
atomEngineProgram?: string;
|
|
1260
1260
|
}>;
|
|
1261
1261
|
/**
|
|
1262
|
-
* Network type for ERC-8004 operations (
|
|
1262
|
+
* Network type for ERC-8004 operations (20 networks: 18 EVM + 2 Solana)
|
|
1263
1263
|
*/
|
|
1264
|
-
type Erc8004Network = 'ethereum' | 'base-mainnet' | 'polygon' | 'arbitrum' | 'optimism' | 'celo' | 'bsc' | 'monad' | 'avalanche' | 'ethereum-sepolia' | 'base-sepolia' | 'polygon-amoy' | 'arbitrum-sepolia' | 'optimism-sepolia' | 'celo-sepolia' | 'avalanche-fuji' | 'solana' | 'solana-devnet';
|
|
1264
|
+
type Erc8004Network = 'ethereum' | 'base-mainnet' | 'polygon' | 'arbitrum' | 'optimism' | 'celo' | 'bsc' | 'monad' | 'avalanche' | 'skale-base' | 'ethereum-sepolia' | 'base-sepolia' | 'polygon-amoy' | 'arbitrum-sepolia' | 'optimism-sepolia' | 'celo-sepolia' | 'avalanche-fuji' | 'skale-base-sepolia' | 'solana' | 'solana-devnet';
|
|
1265
1265
|
/**
|
|
1266
1266
|
* Proof of payment returned when settling with ERC-8004 extension
|
|
1267
1267
|
*/
|
|
@@ -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
|
@@ -1249,7 +1249,7 @@ declare const ERC8004_EXTENSION_ID = "8004-reputation";
|
|
|
1249
1249
|
*/
|
|
1250
1250
|
type AgentId = number | string;
|
|
1251
1251
|
/**
|
|
1252
|
-
* ERC-8004 contract addresses per network (
|
|
1252
|
+
* ERC-8004 contract addresses per network (20 networks: 18 EVM + 2 Solana)
|
|
1253
1253
|
*/
|
|
1254
1254
|
declare const ERC8004_CONTRACTS: Record<string, {
|
|
1255
1255
|
identityRegistry?: string;
|
|
@@ -1259,9 +1259,9 @@ declare const ERC8004_CONTRACTS: Record<string, {
|
|
|
1259
1259
|
atomEngineProgram?: string;
|
|
1260
1260
|
}>;
|
|
1261
1261
|
/**
|
|
1262
|
-
* Network type for ERC-8004 operations (
|
|
1262
|
+
* Network type for ERC-8004 operations (20 networks: 18 EVM + 2 Solana)
|
|
1263
1263
|
*/
|
|
1264
|
-
type Erc8004Network = 'ethereum' | 'base-mainnet' | 'polygon' | 'arbitrum' | 'optimism' | 'celo' | 'bsc' | 'monad' | 'avalanche' | 'ethereum-sepolia' | 'base-sepolia' | 'polygon-amoy' | 'arbitrum-sepolia' | 'optimism-sepolia' | 'celo-sepolia' | 'avalanche-fuji' | 'solana' | 'solana-devnet';
|
|
1264
|
+
type Erc8004Network = 'ethereum' | 'base-mainnet' | 'polygon' | 'arbitrum' | 'optimism' | 'celo' | 'bsc' | 'monad' | 'avalanche' | 'skale-base' | 'ethereum-sepolia' | 'base-sepolia' | 'polygon-amoy' | 'arbitrum-sepolia' | 'optimism-sepolia' | 'celo-sepolia' | 'avalanche-fuji' | 'skale-base-sepolia' | 'solana' | 'solana-devnet';
|
|
1265
1265
|
/**
|
|
1266
1266
|
* Proof of payment returned when settling with ERC-8004 extension
|
|
1267
1267
|
*/
|
|
@@ -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
|
@@ -2394,7 +2394,7 @@ var TESTNET_VALIDATION = "0x8004Cb1BF31DAf7788923b405b754f57acEB4272";
|
|
|
2394
2394
|
var SOLANA_AGENT_REGISTRY = "8oo4dC4JvBLwy5tGgiH3WwK4B9PWxL9Z4XjA2jzkQMbQ";
|
|
2395
2395
|
var SOLANA_ATOM_ENGINE = "AToMw53aiPQ8j7iHVb4fGt6nzUNxUhcPc3tbPBZuzVVb";
|
|
2396
2396
|
var ERC8004_CONTRACTS = {
|
|
2397
|
-
// Mainnets (
|
|
2397
|
+
// Mainnets (10)
|
|
2398
2398
|
ethereum: {
|
|
2399
2399
|
identityRegistry: MAINNET_IDENTITY,
|
|
2400
2400
|
reputationRegistry: MAINNET_REPUTATION
|
|
@@ -2431,7 +2431,11 @@ var ERC8004_CONTRACTS = {
|
|
|
2431
2431
|
identityRegistry: MAINNET_IDENTITY,
|
|
2432
2432
|
reputationRegistry: MAINNET_REPUTATION
|
|
2433
2433
|
},
|
|
2434
|
-
|
|
2434
|
+
"skale-base": {
|
|
2435
|
+
identityRegistry: MAINNET_IDENTITY,
|
|
2436
|
+
reputationRegistry: MAINNET_REPUTATION
|
|
2437
|
+
},
|
|
2438
|
+
// Testnets (8)
|
|
2435
2439
|
"ethereum-sepolia": {
|
|
2436
2440
|
identityRegistry: TESTNET_IDENTITY,
|
|
2437
2441
|
reputationRegistry: TESTNET_REPUTATION,
|
|
@@ -2467,6 +2471,11 @@ var ERC8004_CONTRACTS = {
|
|
|
2467
2471
|
reputationRegistry: TESTNET_REPUTATION,
|
|
2468
2472
|
validationRegistry: TESTNET_VALIDATION
|
|
2469
2473
|
},
|
|
2474
|
+
"skale-base-sepolia": {
|
|
2475
|
+
identityRegistry: TESTNET_IDENTITY,
|
|
2476
|
+
reputationRegistry: TESTNET_REPUTATION,
|
|
2477
|
+
validationRegistry: TESTNET_VALIDATION
|
|
2478
|
+
},
|
|
2470
2479
|
// Solana (2) - uses QuantuLabs 8004-solana Anchor program + ATOM Engine
|
|
2471
2480
|
solana: {
|
|
2472
2481
|
agentRegistryProgram: SOLANA_AGENT_REGISTRY,
|
|
@@ -3099,6 +3108,15 @@ var ESCROW_CONTRACTS = {
|
|
|
3099
3108
|
protocolFeeConfig: "0xD979dBfBdA5f4b16AAF60Eaab32A44f352076838",
|
|
3100
3109
|
refundRequest: "0xc1256Bb30bd0cdDa07D8C8Cf67a59105f2EA1b98",
|
|
3101
3110
|
usdc: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85"
|
|
3111
|
+
},
|
|
3112
|
+
// SKALE Base (chain 1187947933) - CREATE3 deployment, operator via factory
|
|
3113
|
+
1187947933: {
|
|
3114
|
+
operator: "0x28c23AE8f55aDe5Ea10a5353FC40418D0c1B3d33",
|
|
3115
|
+
escrow: "0xBC151792f80C0EB1973d56b0235e6bee2A60e245",
|
|
3116
|
+
tokenCollector: "0x9A12A116a44636F55c9e135189A1321Abcfe2f30",
|
|
3117
|
+
protocolFeeConfig: "0xf62788834C99B2E85a6891C0b46D1EB996f8f596",
|
|
3118
|
+
refundRequest: "0x69e9BF2b40Ed472b55E47e9D4205d93Ed673093F",
|
|
3119
|
+
usdc: "0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20"
|
|
3102
3120
|
}
|
|
3103
3121
|
};
|
|
3104
3122
|
var BASE_MAINNET_CONTRACTS = ESCROW_CONTRACTS[8453];
|
|
@@ -3123,6 +3141,13 @@ var OPERATOR_ABI = [
|
|
|
3123
3141
|
"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)",
|
|
3124
3142
|
"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)"
|
|
3125
3143
|
];
|
|
3144
|
+
var OPERATOR_ABI_CREATE3 = [
|
|
3145
|
+
"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)",
|
|
3146
|
+
"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)",
|
|
3147
|
+
"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)",
|
|
3148
|
+
"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)"
|
|
3149
|
+
];
|
|
3150
|
+
var CREATE3_CHAIN_IDS = /* @__PURE__ */ new Set([1187947933]);
|
|
3126
3151
|
var AdvancedEscrowClient = class {
|
|
3127
3152
|
facilitatorUrl;
|
|
3128
3153
|
chainId;
|
|
@@ -3371,10 +3396,12 @@ var AdvancedEscrowClient = class {
|
|
|
3371
3396
|
if (!this.payerAddress) await this.init();
|
|
3372
3397
|
try {
|
|
3373
3398
|
const { ethers } = await import('ethers');
|
|
3374
|
-
const
|
|
3399
|
+
const isCreate3 = CREATE3_CHAIN_IDS.has(this.chainId);
|
|
3400
|
+
const abi = isCreate3 ? OPERATOR_ABI_CREATE3 : OPERATOR_ABI;
|
|
3401
|
+
const contract = new ethers.Contract(this.contracts.operator, abi, this.signer);
|
|
3375
3402
|
const amt = amount || paymentInfo.maxAmount;
|
|
3376
3403
|
const tuple = this.buildTuple(paymentInfo);
|
|
3377
|
-
const tx = await contract.release(tuple, amt, { gasLimit: this.gasLimit });
|
|
3404
|
+
const tx = isCreate3 ? await contract.release(tuple, amt, "0x", { gasLimit: this.gasLimit }) : await contract.release(tuple, amt, { gasLimit: this.gasLimit });
|
|
3378
3405
|
const receipt = await tx.wait();
|
|
3379
3406
|
return {
|
|
3380
3407
|
success: receipt.status === 1,
|
|
@@ -3398,10 +3425,12 @@ var AdvancedEscrowClient = class {
|
|
|
3398
3425
|
if (!this.payerAddress) await this.init();
|
|
3399
3426
|
try {
|
|
3400
3427
|
const { ethers } = await import('ethers');
|
|
3401
|
-
const
|
|
3428
|
+
const isCreate3 = CREATE3_CHAIN_IDS.has(this.chainId);
|
|
3429
|
+
const abi = isCreate3 ? OPERATOR_ABI_CREATE3 : OPERATOR_ABI;
|
|
3430
|
+
const contract = new ethers.Contract(this.contracts.operator, abi, this.signer);
|
|
3402
3431
|
const amt = amount || paymentInfo.maxAmount;
|
|
3403
3432
|
const tuple = this.buildTuple(paymentInfo);
|
|
3404
|
-
const tx = await contract.refundInEscrow(tuple, amt, { gasLimit: this.gasLimit });
|
|
3433
|
+
const tx = isCreate3 ? await contract.refundInEscrow(tuple, amt, "0x", { gasLimit: this.gasLimit }) : await contract.refundInEscrow(tuple, amt, { gasLimit: this.gasLimit });
|
|
3405
3434
|
const receipt = await tx.wait();
|
|
3406
3435
|
return {
|
|
3407
3436
|
success: receipt.status === 1,
|
|
@@ -3755,6 +3784,7 @@ exports.Erc8004Client = Erc8004Client;
|
|
|
3755
3784
|
exports.EscrowClient = EscrowClient;
|
|
3756
3785
|
exports.FacilitatorClient = FacilitatorClient;
|
|
3757
3786
|
exports.OPERATOR_ABI = OPERATOR_ABI;
|
|
3787
|
+
exports.OPERATOR_ABI_CREATE3 = OPERATOR_ABI_CREATE3;
|
|
3758
3788
|
exports.PAYMENT_INFO_TYPEHASH = PAYMENT_INFO_TYPEHASH;
|
|
3759
3789
|
exports.TIER_TIMINGS = TIER_TIMINGS;
|
|
3760
3790
|
exports.USDC_DOMAIN_NAME = USDC_DOMAIN_NAME;
|