@dexterai/x402 3.1.1 → 3.2.1
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 +25 -6
- package/assets/x402gle-by-dexter.svg +49 -0
- package/assets/x402gle-wordmark.svg +22 -0
- package/dist/adapters/index.cjs +1 -1
- package/dist/adapters/index.d.cts +4 -3
- package/dist/adapters/index.d.ts +4 -3
- package/dist/adapters/index.js +1 -1
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.d.cts +6 -7
- package/dist/client/index.d.ts +6 -7
- package/dist/client/index.js +1 -1
- package/dist/constants-qU-4U3L-.d.cts +52 -0
- package/dist/constants-qU-4U3L-.d.ts +52 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.d.cts +5 -5
- package/dist/react/index.d.ts +5 -5
- package/dist/react/index.js +1 -1
- package/dist/server/index.cjs +15 -15
- package/dist/server/index.d.cts +3 -2
- package/dist/server/index.d.ts +3 -2
- package/dist/server/index.js +17 -17
- package/dist/{sponsored-access-BVoucsEW.d.ts → sponsored-access-BuecDKXL.d.cts} +2 -3
- package/dist/{sponsored-access-CE7WpV5b.d.cts → sponsored-access-DP61rXDl.d.ts} +2 -3
- package/dist/{types-DBS0XOsH.d.ts → types-BPKUVJEl.d.ts} +2 -46
- package/dist/{types-_iT11DL0.d.cts → types-CKiTYeJ-.d.cts} +3 -12
- package/dist/{types-_iT11DL0.d.ts → types-CKiTYeJ-.d.ts} +3 -12
- package/dist/{types-C_aQh02s.d.cts → types-i7C2GiVY.d.cts} +2 -46
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.cts +15 -1
- package/dist/utils/index.d.ts +15 -1
- package/dist/utils/index.js +1 -1
- package/package.json +3 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ChainAdapter, W as WalletSet } from './types-
|
|
2
|
-
import { A as AccessPassClientConfig, P as PaymentAccept } from './types-
|
|
1
|
+
import { C as ChainAdapter, W as WalletSet } from './types-i7C2GiVY.cjs';
|
|
2
|
+
import { A as AccessPassClientConfig, P as PaymentAccept } from './types-CKiTYeJ-.cjs';
|
|
3
3
|
import { SponsoredRecommendation, SponsoredAccessSettlementInfo } from '@dexterai/x402-ads-types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -44,7 +44,6 @@ interface PaymentReceipt {
|
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Get the x402 payment receipt from a response, or undefined if none.
|
|
47
|
-
* Typed alternative to the legacy `(response as any)._x402` pattern.
|
|
48
47
|
*/
|
|
49
48
|
declare function getPaymentReceipt(response: Response): PaymentReceipt | undefined;
|
|
50
49
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ChainAdapter, W as WalletSet } from './types-
|
|
2
|
-
import { A as AccessPassClientConfig, P as PaymentAccept } from './types-
|
|
1
|
+
import { C as ChainAdapter, W as WalletSet } from './types-BPKUVJEl.js';
|
|
2
|
+
import { A as AccessPassClientConfig, P as PaymentAccept } from './types-CKiTYeJ-.js';
|
|
3
3
|
import { SponsoredRecommendation, SponsoredAccessSettlementInfo } from '@dexterai/x402-ads-types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -44,7 +44,6 @@ interface PaymentReceipt {
|
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Get the x402 payment receipt from a response, or undefined if none.
|
|
47
|
-
* Typed alternative to the legacy `(response as any)._x402` pattern.
|
|
48
47
|
*/
|
|
49
48
|
declare function getPaymentReceipt(response: Response): PaymentReceipt | undefined;
|
|
50
49
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PaymentAccept } from './types-
|
|
1
|
+
import { P as PaymentAccept } from './types-CKiTYeJ-.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* EVM Chain Adapter
|
|
@@ -7,44 +7,6 @@ import { P as PaymentAccept } from './types-_iT11DL0.js';
|
|
|
7
7
|
* Uses EIP-712 typed data signing for x402 v2 payments.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* Permit2 constants (Uniswap canonical deployment, same address on every EVM chain)
|
|
12
|
-
*/
|
|
13
|
-
declare const PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
14
|
-
declare const X402_EXACT_PERMIT2_PROXY = "0x402085c248EeA27D92E8b30b2C58ed07f9E20001";
|
|
15
|
-
/**
|
|
16
|
-
* CAIP-2 network identifiers for EVM chains.
|
|
17
|
-
* Mirrors dexter-facilitator/src/config/chains.ts — update both when adding chains.
|
|
18
|
-
*/
|
|
19
|
-
declare const BASE_MAINNET = "eip155:8453";
|
|
20
|
-
declare const BASE_SEPOLIA = "eip155:84532";
|
|
21
|
-
declare const ARBITRUM_ONE = "eip155:42161";
|
|
22
|
-
declare const POLYGON = "eip155:137";
|
|
23
|
-
declare const OPTIMISM = "eip155:10";
|
|
24
|
-
declare const AVALANCHE = "eip155:43114";
|
|
25
|
-
declare const BSC_MAINNET = "eip155:56";
|
|
26
|
-
declare const SKALE_BASE = "eip155:1187947933";
|
|
27
|
-
declare const SKALE_BASE_SEPOLIA = "eip155:324705682";
|
|
28
|
-
/** @deprecated Not supported by the Dexter facilitator. Use BASE_MAINNET for EVM payments. */
|
|
29
|
-
declare const ETHEREUM_MAINNET = "eip155:1";
|
|
30
|
-
/**
|
|
31
|
-
* BSC stablecoin addresses (18 decimals — unlike 6 on every other chain)
|
|
32
|
-
*/
|
|
33
|
-
declare const BSC_USDT = "0x55d398326f99059fF775485246999027B3197955";
|
|
34
|
-
declare const BSC_USDC = "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d";
|
|
35
|
-
/**
|
|
36
|
-
* USDC contract addresses by chain.
|
|
37
|
-
* Source of truth: dexter-facilitator/src/config/chains.ts
|
|
38
|
-
*/
|
|
39
|
-
declare const USDC_ADDRESSES: Record<string, string>;
|
|
40
|
-
/**
|
|
41
|
-
* Known BSC stablecoin addresses (for isKnownStablecoin checks).
|
|
42
|
-
* Both use 18 decimals on BSC, unlike the 6 decimals on all other chains.
|
|
43
|
-
*/
|
|
44
|
-
declare const BSC_STABLECOIN_ADDRESSES: Record<string, {
|
|
45
|
-
symbol: string;
|
|
46
|
-
decimals: number;
|
|
47
|
-
}>;
|
|
48
10
|
/**
|
|
49
11
|
* EVM wallet interface (compatible with wagmi, ethers, viem)
|
|
50
12
|
*/
|
|
@@ -169,12 +131,6 @@ declare function createEvmAdapter(config?: AdapterConfig): EvmAdapter;
|
|
|
169
131
|
* Handles transaction building, signing, and balance queries.
|
|
170
132
|
*/
|
|
171
133
|
|
|
172
|
-
/**
|
|
173
|
-
* CAIP-2 network identifiers for Solana
|
|
174
|
-
*/
|
|
175
|
-
declare const SOLANA_MAINNET = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
176
|
-
declare const SOLANA_DEVNET = "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
|
|
177
|
-
declare const SOLANA_TESTNET = "solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z";
|
|
178
134
|
/**
|
|
179
135
|
* Solana wallet interface (compatible with @solana/wallet-adapter)
|
|
180
136
|
*/
|
|
@@ -325,4 +281,4 @@ interface BalanceInfo {
|
|
|
325
281
|
asset: string;
|
|
326
282
|
}
|
|
327
283
|
|
|
328
|
-
export { type AdapterConfig as A,
|
|
284
|
+
export { type AdapterConfig as A, type BalanceInfo as B, type ChainAdapter as C, type EvmWallet as E, type GenericWallet as G, type SolanaWallet as S, type WalletSet as W, createEvmAdapter as a, SolanaAdapter as b, createSolanaAdapter as c, EvmAdapter as d, type SignedTransaction as e, isEvmWallet as f, isSolanaWallet as i };
|
|
@@ -4,16 +4,7 @@
|
|
|
4
4
|
* Chain-agnostic types for x402 v2 payments.
|
|
5
5
|
* Works with Solana, Base, and any future x402-compatible networks.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
declare const SOLANA_MAINNET_NETWORK = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
9
|
-
/** CAIP-2 network identifier for Base mainnet */
|
|
10
|
-
declare const BASE_MAINNET_NETWORK = "eip155:8453";
|
|
11
|
-
/** USDC mint on Solana mainnet */
|
|
12
|
-
declare const USDC_MINT = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
13
|
-
/** USDC address on Base mainnet */
|
|
14
|
-
declare const USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
15
|
-
/** Dexter's public x402 v2 facilitator URL */
|
|
16
|
-
declare const DEXTER_FACILITATOR_URL = "https://x402.dexter.cash";
|
|
7
|
+
|
|
17
8
|
/**
|
|
18
9
|
* Context passed to a PayToProvider function.
|
|
19
10
|
* Contains request-scoped information for dynamic address resolution.
|
|
@@ -212,7 +203,7 @@ interface AccessPassClientConfig {
|
|
|
212
203
|
/**
|
|
213
204
|
* SDK error codes
|
|
214
205
|
*/
|
|
215
|
-
type X402ErrorCode = 'missing_payment_required_header' | 'invalid_payment_required' | 'unsupported_network' | 'no_matching_payment_option' | '
|
|
206
|
+
type X402ErrorCode = 'missing_payment_required_header' | 'invalid_payment_required' | 'unsupported_network' | 'no_matching_payment_option' | 'missing_fee_payer' | 'missing_decimals' | 'missing_amount' | 'amount_exceeds_max' | 'insufficient_balance' | 'wallet_missing_sign_transaction' | 'wallet_not_connected' | 'wallet_disconnected' | 'user_rejected_signature' | 'transaction_build_failed' | 'payment_rejected' | 'rpc_timeout' | 'facilitator_timeout' | 'invalid_payment_signature' | 'facilitator_verify_failed' | 'facilitator_settle_failed' | 'facilitator_request_failed' | 'no_matching_requirement' | 'access_pass_expired' | 'access_pass_invalid' | 'access_pass_tier_not_found' | 'access_pass_exceeds_max_spend';
|
|
216
207
|
/**
|
|
217
208
|
* Custom error class for x402 operations
|
|
218
209
|
*/
|
|
@@ -224,4 +215,4 @@ declare class X402Error extends Error {
|
|
|
224
215
|
constructor(code: X402ErrorCode, message: string, details?: unknown);
|
|
225
216
|
}
|
|
226
217
|
|
|
227
|
-
export { type AccessPassClientConfig as A,
|
|
218
|
+
export { type AccessPassClientConfig as A, type PaymentAccept as P, type SettleResponse as S, type VerifyResponse as V, X402Error as X, type AccessPassTier as a, type AccessPassInfo as b, type PayToProvider as c, type PaymentRequired as d, type PayToContext as e, type PayToProviderDefaults as f, type AccessPassClaims as g };
|
|
@@ -4,16 +4,7 @@
|
|
|
4
4
|
* Chain-agnostic types for x402 v2 payments.
|
|
5
5
|
* Works with Solana, Base, and any future x402-compatible networks.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
declare const SOLANA_MAINNET_NETWORK = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
9
|
-
/** CAIP-2 network identifier for Base mainnet */
|
|
10
|
-
declare const BASE_MAINNET_NETWORK = "eip155:8453";
|
|
11
|
-
/** USDC mint on Solana mainnet */
|
|
12
|
-
declare const USDC_MINT = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
13
|
-
/** USDC address on Base mainnet */
|
|
14
|
-
declare const USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
15
|
-
/** Dexter's public x402 v2 facilitator URL */
|
|
16
|
-
declare const DEXTER_FACILITATOR_URL = "https://x402.dexter.cash";
|
|
7
|
+
|
|
17
8
|
/**
|
|
18
9
|
* Context passed to a PayToProvider function.
|
|
19
10
|
* Contains request-scoped information for dynamic address resolution.
|
|
@@ -212,7 +203,7 @@ interface AccessPassClientConfig {
|
|
|
212
203
|
/**
|
|
213
204
|
* SDK error codes
|
|
214
205
|
*/
|
|
215
|
-
type X402ErrorCode = 'missing_payment_required_header' | 'invalid_payment_required' | 'unsupported_network' | 'no_matching_payment_option' | '
|
|
206
|
+
type X402ErrorCode = 'missing_payment_required_header' | 'invalid_payment_required' | 'unsupported_network' | 'no_matching_payment_option' | 'missing_fee_payer' | 'missing_decimals' | 'missing_amount' | 'amount_exceeds_max' | 'insufficient_balance' | 'wallet_missing_sign_transaction' | 'wallet_not_connected' | 'wallet_disconnected' | 'user_rejected_signature' | 'transaction_build_failed' | 'payment_rejected' | 'rpc_timeout' | 'facilitator_timeout' | 'invalid_payment_signature' | 'facilitator_verify_failed' | 'facilitator_settle_failed' | 'facilitator_request_failed' | 'no_matching_requirement' | 'access_pass_expired' | 'access_pass_invalid' | 'access_pass_tier_not_found' | 'access_pass_exceeds_max_spend';
|
|
216
207
|
/**
|
|
217
208
|
* Custom error class for x402 operations
|
|
218
209
|
*/
|
|
@@ -224,4 +215,4 @@ declare class X402Error extends Error {
|
|
|
224
215
|
constructor(code: X402ErrorCode, message: string, details?: unknown);
|
|
225
216
|
}
|
|
226
217
|
|
|
227
|
-
export { type AccessPassClientConfig as A,
|
|
218
|
+
export { type AccessPassClientConfig as A, type PaymentAccept as P, type SettleResponse as S, type VerifyResponse as V, X402Error as X, type AccessPassTier as a, type AccessPassInfo as b, type PayToProvider as c, type PaymentRequired as d, type PayToContext as e, type PayToProviderDefaults as f, type AccessPassClaims as g };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PaymentAccept } from './types-
|
|
1
|
+
import { P as PaymentAccept } from './types-CKiTYeJ-.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* EVM Chain Adapter
|
|
@@ -7,44 +7,6 @@ import { P as PaymentAccept } from './types-_iT11DL0.cjs';
|
|
|
7
7
|
* Uses EIP-712 typed data signing for x402 v2 payments.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* Permit2 constants (Uniswap canonical deployment, same address on every EVM chain)
|
|
12
|
-
*/
|
|
13
|
-
declare const PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
14
|
-
declare const X402_EXACT_PERMIT2_PROXY = "0x402085c248EeA27D92E8b30b2C58ed07f9E20001";
|
|
15
|
-
/**
|
|
16
|
-
* CAIP-2 network identifiers for EVM chains.
|
|
17
|
-
* Mirrors dexter-facilitator/src/config/chains.ts — update both when adding chains.
|
|
18
|
-
*/
|
|
19
|
-
declare const BASE_MAINNET = "eip155:8453";
|
|
20
|
-
declare const BASE_SEPOLIA = "eip155:84532";
|
|
21
|
-
declare const ARBITRUM_ONE = "eip155:42161";
|
|
22
|
-
declare const POLYGON = "eip155:137";
|
|
23
|
-
declare const OPTIMISM = "eip155:10";
|
|
24
|
-
declare const AVALANCHE = "eip155:43114";
|
|
25
|
-
declare const BSC_MAINNET = "eip155:56";
|
|
26
|
-
declare const SKALE_BASE = "eip155:1187947933";
|
|
27
|
-
declare const SKALE_BASE_SEPOLIA = "eip155:324705682";
|
|
28
|
-
/** @deprecated Not supported by the Dexter facilitator. Use BASE_MAINNET for EVM payments. */
|
|
29
|
-
declare const ETHEREUM_MAINNET = "eip155:1";
|
|
30
|
-
/**
|
|
31
|
-
* BSC stablecoin addresses (18 decimals — unlike 6 on every other chain)
|
|
32
|
-
*/
|
|
33
|
-
declare const BSC_USDT = "0x55d398326f99059fF775485246999027B3197955";
|
|
34
|
-
declare const BSC_USDC = "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d";
|
|
35
|
-
/**
|
|
36
|
-
* USDC contract addresses by chain.
|
|
37
|
-
* Source of truth: dexter-facilitator/src/config/chains.ts
|
|
38
|
-
*/
|
|
39
|
-
declare const USDC_ADDRESSES: Record<string, string>;
|
|
40
|
-
/**
|
|
41
|
-
* Known BSC stablecoin addresses (for isKnownStablecoin checks).
|
|
42
|
-
* Both use 18 decimals on BSC, unlike the 6 decimals on all other chains.
|
|
43
|
-
*/
|
|
44
|
-
declare const BSC_STABLECOIN_ADDRESSES: Record<string, {
|
|
45
|
-
symbol: string;
|
|
46
|
-
decimals: number;
|
|
47
|
-
}>;
|
|
48
10
|
/**
|
|
49
11
|
* EVM wallet interface (compatible with wagmi, ethers, viem)
|
|
50
12
|
*/
|
|
@@ -169,12 +131,6 @@ declare function createEvmAdapter(config?: AdapterConfig): EvmAdapter;
|
|
|
169
131
|
* Handles transaction building, signing, and balance queries.
|
|
170
132
|
*/
|
|
171
133
|
|
|
172
|
-
/**
|
|
173
|
-
* CAIP-2 network identifiers for Solana
|
|
174
|
-
*/
|
|
175
|
-
declare const SOLANA_MAINNET = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
176
|
-
declare const SOLANA_DEVNET = "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
|
|
177
|
-
declare const SOLANA_TESTNET = "solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z";
|
|
178
134
|
/**
|
|
179
135
|
* Solana wallet interface (compatible with @solana/wallet-adapter)
|
|
180
136
|
*/
|
|
@@ -325,4 +281,4 @@ interface BalanceInfo {
|
|
|
325
281
|
asset: string;
|
|
326
282
|
}
|
|
327
283
|
|
|
328
|
-
export { type AdapterConfig as A,
|
|
284
|
+
export { type AdapterConfig as A, type BalanceInfo as B, type ChainAdapter as C, type EvmWallet as E, type GenericWallet as G, type SolanaWallet as S, type WalletSet as W, createEvmAdapter as a, SolanaAdapter as b, createSolanaAdapter as c, EvmAdapter as d, type SignedTransaction as e, isEvmWallet as f, isSolanaWallet as i };
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var u=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var B=(t,e)=>{for(var s in e)u(t,s,{get:e[s],enumerable:!0})},I=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of g(e))!D.call(t,n)&&n!==s&&u(t,n,{get:()=>e[n],enumerable:!(r=C(e,n))||r.enumerable});return t};var K=t=>I(u({},"__esModule",{value:!0}),t);var U={};B(U,{fromAtomicUnits:()=>d,getChainDisplayName:()=>O,getChainFamily:()=>b,getChainName:()=>S,getExplorerUrl:()=>R,toAtomicUnits:()=>_});module.exports=K(U);var x="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",N="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",f="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z";var a="eip155:8453",o="eip155:84532",i="eip155:42161",c="eip155:137",p="eip155:10",E="eip155:43114",l="eip155:56",A="eip155:1187947933",h="eip155:324705682",m="eip155:1";var L="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",M="0x55d398326f99059fF775485246999027B3197955",T="0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",P={[l]:T,[a]:L,[o]:"0x036CbD53842c5426634e7929541eC2318f3dCF7e",[i]:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",[c]:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",[p]:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",[E]:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",[A]:"0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20",[h]:"0x2e08028E3C4c2356572E096d8EF835cD5C6030bD",[m]:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},F={[M]:{symbol:"USDT",decimals:18},[T]:{symbol:"USDC",decimals:18}};var $={[l]:56,[a]:8453,[o]:84532,[i]:42161,[c]:137,[p]:10,[E]:43114,[A]:1187947933,[h]:324705682,[m]:1},V={[x]:"https://api.dexter.cash/api/solana/rpc",[N]:"https://api.devnet.solana.com",[f]:"https://api.testnet.solana.com"},H={[l]:"https://bsc-dataseed1.binance.org",[a]:"https://api.dexter.cash/api/base/rpc",[o]:"https://sepolia.base.org",[i]:"https://arb1.arbitrum.io/rpc",[c]:"https://polygon-rpc.com",[p]:"https://mainnet.optimism.io",[E]:"https://api.avax.network/ext/bc/C/rpc",[A]:"https://skale-base.skalenodes.com/v1/base",[h]:"https://base-sepolia-testnet.skalenodes.com/v1/jubilant-horrible-ancha",[m]:"https://eth.llamarpc.com"};function _(t,e){let s=Math.pow(10,e);return Math.floor(t*s).toString()}function d(t,e){let s=Math.pow(10,e);return Number(t)/s}function y(t){return t.startsWith("solana:")||t==="solana"}function W(t){return t.startsWith("eip155:")||["base","ethereum","arbitrum"].includes(t)}function b(t){return y(t)?"solana":W(t)?"evm":"unknown"}function S(t){return{[x]:"Solana",[N]:"Solana Devnet",[f]:"Solana Testnet",solana:"Solana","solana-devnet":"Solana Devnet","solana-testnet":"Solana Testnet",[a]:"Base",[o]:"Base Sepolia",[m]:"Ethereum",[i]:"Arbitrum",[c]:"Polygon",[p]:"Optimism",[E]:"Avalanche",[l]:"BSC",[A]:"SKALE Base",[h]:"SKALE Base Sepolia",base:"Base","base-sepolia":"Base Sepolia",ethereum:"Ethereum",arbitrum:"Arbitrum",polygon:"Polygon",optimism:"Optimism",avalanche:"Avalanche",bsc:"BSC","skale-base":"SKALE Base","skale-base-sepolia":"SKALE Base Sepolia"}[t]||t}function O(t,e){let s=S(t);return s===t?e:s}function R(t,e){let s=b(e);if(s==="solana")return e.includes("devnet")||e===N?`https://solscan.io/tx/${t}?cluster=devnet`:`https://www.orbmarkets.io/tx/${t}`;if(s==="evm"){let r="8453";switch(e.startsWith("eip155:")?r=e.split(":")[1]:e==="ethereum"?r="1":e==="arbitrum"?r="42161":e==="polygon"?r="137":e==="optimism"?r="10":e==="avalanche"?r="43114":e==="bsc"?r="56":e==="skale-base"?r="1187947933":e==="skale-base-sepolia"&&(r="324705682"),r){case"8453":return`https://basescan.org/tx/${t}`;case"84532":return`https://sepolia.basescan.org/tx/${t}`;case"1":return`https://etherscan.io/tx/${t}`;case"42161":return`https://arbiscan.io/tx/${t}`;case"137":return`https://polygonscan.com/tx/${t}`;case"10":return`https://optimistic.etherscan.io/tx/${t}`;case"43114":return`https://snowtrace.io/tx/${t}`;case"56":return`https://bscscan.com/tx/${t}`;case"1187947933":return`https://elated-tan-skat.explorer.mainnet.skalenodes.com/tx/${t}`;case"324705682":return`https://base-sepolia-testnet.explorer.skalenodes.com/tx/${t}`;default:return`https://basescan.org/tx/${t}`}}return`https://solscan.io/tx/${t}`}0&&(module.exports={fromAtomicUnits,getChainDisplayName,getChainFamily,getChainName,getExplorerUrl,toAtomicUnits});
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -55,6 +55,20 @@ declare function getChainFamily(network: string): ChainFamily;
|
|
|
55
55
|
* @returns Human-readable name
|
|
56
56
|
*/
|
|
57
57
|
declare function getChainName(network: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* Get a human-readable chain name with adapter-family fallback.
|
|
60
|
+
*
|
|
61
|
+
* Differs from {@link getChainName} in the fallback: instead of returning
|
|
62
|
+
* the raw network identifier (which is useful for logging / matching), this
|
|
63
|
+
* returns the adapter family ("Solana" / "EVM") when the chain isn't in
|
|
64
|
+
* the registry. Use this in user-facing strings — error messages, badges,
|
|
65
|
+
* status pills — where exposing a CAIP-2 string would be ugly.
|
|
66
|
+
*
|
|
67
|
+
* @param network - CAIP-2 network identifier or legacy alias
|
|
68
|
+
* @param family - The adapter family name to use as a fallback
|
|
69
|
+
* (e.g. 'Solana' or 'EVM')
|
|
70
|
+
*/
|
|
71
|
+
declare function getChainDisplayName(network: string, family: string): string;
|
|
58
72
|
/**
|
|
59
73
|
* Get explorer URL for a transaction
|
|
60
74
|
*
|
|
@@ -64,4 +78,4 @@ declare function getChainName(network: string): string;
|
|
|
64
78
|
*/
|
|
65
79
|
declare function getExplorerUrl(txSignature: string, network: string): string;
|
|
66
80
|
|
|
67
|
-
export { type ChainFamily, fromAtomicUnits, getChainFamily, getChainName, getExplorerUrl, toAtomicUnits };
|
|
81
|
+
export { type ChainFamily, fromAtomicUnits, getChainDisplayName, getChainFamily, getChainName, getExplorerUrl, toAtomicUnits };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -55,6 +55,20 @@ declare function getChainFamily(network: string): ChainFamily;
|
|
|
55
55
|
* @returns Human-readable name
|
|
56
56
|
*/
|
|
57
57
|
declare function getChainName(network: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* Get a human-readable chain name with adapter-family fallback.
|
|
60
|
+
*
|
|
61
|
+
* Differs from {@link getChainName} in the fallback: instead of returning
|
|
62
|
+
* the raw network identifier (which is useful for logging / matching), this
|
|
63
|
+
* returns the adapter family ("Solana" / "EVM") when the chain isn't in
|
|
64
|
+
* the registry. Use this in user-facing strings — error messages, badges,
|
|
65
|
+
* status pills — where exposing a CAIP-2 string would be ugly.
|
|
66
|
+
*
|
|
67
|
+
* @param network - CAIP-2 network identifier or legacy alias
|
|
68
|
+
* @param family - The adapter family name to use as a fallback
|
|
69
|
+
* (e.g. 'Solana' or 'EVM')
|
|
70
|
+
*/
|
|
71
|
+
declare function getChainDisplayName(network: string, family: string): string;
|
|
58
72
|
/**
|
|
59
73
|
* Get explorer URL for a transaction
|
|
60
74
|
*
|
|
@@ -64,4 +78,4 @@ declare function getChainName(network: string): string;
|
|
|
64
78
|
*/
|
|
65
79
|
declare function getExplorerUrl(txSignature: string, network: string): string;
|
|
66
80
|
|
|
67
|
-
export { type ChainFamily, fromAtomicUnits, getChainFamily, getChainName, getExplorerUrl, toAtomicUnits };
|
|
81
|
+
export { type ChainFamily, fromAtomicUnits, getChainDisplayName, getChainFamily, getChainName, getExplorerUrl, toAtomicUnits };
|
package/dist/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var N="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",m="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",u="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z";var n="eip155:8453",a="eip155:84532",o="eip155:42161",i="eip155:137",c="eip155:10",p="eip155:43114",E="eip155:56",l="eip155:1187947933",A="eip155:324705682",h="eip155:1";var S="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",T="0x55d398326f99059fF775485246999027B3197955",x="0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",D={[E]:x,[n]:S,[a]:"0x036CbD53842c5426634e7929541eC2318f3dCF7e",[o]:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",[i]:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",[c]:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",[p]:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",[l]:"0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20",[A]:"0x2e08028E3C4c2356572E096d8EF835cD5C6030bD",[h]:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},B={[T]:{symbol:"USDT",decimals:18},[x]:{symbol:"USDC",decimals:18}};var I={[E]:56,[n]:8453,[a]:84532,[o]:42161,[i]:137,[c]:10,[p]:43114,[l]:1187947933,[A]:324705682,[h]:1},K={[N]:"https://api.dexter.cash/api/solana/rpc",[m]:"https://api.devnet.solana.com",[u]:"https://api.testnet.solana.com"},L={[E]:"https://bsc-dataseed1.binance.org",[n]:"https://api.dexter.cash/api/base/rpc",[a]:"https://sepolia.base.org",[o]:"https://arb1.arbitrum.io/rpc",[i]:"https://polygon-rpc.com",[c]:"https://mainnet.optimism.io",[p]:"https://api.avax.network/ext/bc/C/rpc",[l]:"https://skale-base.skalenodes.com/v1/base",[A]:"https://base-sepolia-testnet.skalenodes.com/v1/jubilant-horrible-ancha",[h]:"https://eth.llamarpc.com"};function _(t,e){let r=Math.pow(10,e);return Math.floor(t*r).toString()}function d(t,e){let r=Math.pow(10,e);return Number(t)/r}function O(t){return t.startsWith("solana:")||t==="solana"}function R(t){return t.startsWith("eip155:")||["base","ethereum","arbitrum"].includes(t)}function f(t){return O(t)?"solana":R(t)?"evm":"unknown"}function b(t){return{[N]:"Solana",[m]:"Solana Devnet",[u]:"Solana Testnet",solana:"Solana","solana-devnet":"Solana Devnet","solana-testnet":"Solana Testnet",[n]:"Base",[a]:"Base Sepolia",[h]:"Ethereum",[o]:"Arbitrum",[i]:"Polygon",[c]:"Optimism",[p]:"Avalanche",[E]:"BSC",[l]:"SKALE Base",[A]:"SKALE Base Sepolia",base:"Base","base-sepolia":"Base Sepolia",ethereum:"Ethereum",arbitrum:"Arbitrum",polygon:"Polygon",optimism:"Optimism",avalanche:"Avalanche",bsc:"BSC","skale-base":"SKALE Base","skale-base-sepolia":"SKALE Base Sepolia"}[t]||t}function C(t,e){let r=b(t);return r===t?e:r}function g(t,e){let r=f(e);if(r==="solana")return e.includes("devnet")||e===m?`https://solscan.io/tx/${t}?cluster=devnet`:`https://www.orbmarkets.io/tx/${t}`;if(r==="evm"){let s="8453";switch(e.startsWith("eip155:")?s=e.split(":")[1]:e==="ethereum"?s="1":e==="arbitrum"?s="42161":e==="polygon"?s="137":e==="optimism"?s="10":e==="avalanche"?s="43114":e==="bsc"?s="56":e==="skale-base"?s="1187947933":e==="skale-base-sepolia"&&(s="324705682"),s){case"8453":return`https://basescan.org/tx/${t}`;case"84532":return`https://sepolia.basescan.org/tx/${t}`;case"1":return`https://etherscan.io/tx/${t}`;case"42161":return`https://arbiscan.io/tx/${t}`;case"137":return`https://polygonscan.com/tx/${t}`;case"10":return`https://optimistic.etherscan.io/tx/${t}`;case"43114":return`https://snowtrace.io/tx/${t}`;case"56":return`https://bscscan.com/tx/${t}`;case"1187947933":return`https://elated-tan-skat.explorer.mainnet.skalenodes.com/tx/${t}`;case"324705682":return`https://base-sepolia-testnet.explorer.skalenodes.com/tx/${t}`;default:return`https://basescan.org/tx/${t}`}}return`https://solscan.io/tx/${t}`}export{d as fromAtomicUnits,C as getChainDisplayName,f as getChainFamily,b as getChainName,g as getExplorerUrl,_ as toAtomicUnits};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexterai/x402",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "Full-stack x402 SDK - add paid API monetization to any endpoint. Express middleware, React hooks, Access Pass, dynamic pricing. Solana, Base, Polygon, Arbitrum, Optimism, Avalanche, SKALE.",
|
|
5
5
|
"author": "Dexter",
|
|
6
6
|
"license": "MIT",
|
|
@@ -106,6 +106,8 @@
|
|
|
106
106
|
"arbitrum",
|
|
107
107
|
"optimism",
|
|
108
108
|
"avalanche",
|
|
109
|
+
"bsc",
|
|
110
|
+
"skale",
|
|
109
111
|
"payments",
|
|
110
112
|
"dexter",
|
|
111
113
|
"web3",
|