uvd-x402-sdk 2.6.0 → 2.10.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 +380 -3
- package/dist/adapters/index.d.mts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.js +78 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/index.mjs +78 -1
- package/dist/adapters/index.mjs.map +1 -1
- package/dist/backend/index.d.mts +1036 -0
- package/dist/backend/index.d.ts +1036 -0
- package/dist/backend/index.js +1722 -0
- package/dist/backend/index.js.map +1 -0
- package/dist/backend/index.mjs +1704 -0
- package/dist/backend/index.mjs.map +1 -0
- package/dist/{index-fwbSkart.d.ts → index-C60c_e5z.d.mts} +13 -4
- package/dist/{index-BR1o8JZQ.d.mts → index-D-dO_FoP.d.mts} +38 -4
- package/dist/{index-BR1o8JZQ.d.ts → index-D-dO_FoP.d.ts} +38 -4
- package/dist/{index-DKbWiaJ9.d.mts → index-VIOUicmO.d.ts} +13 -4
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +93 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +92 -2
- package/dist/index.mjs.map +1 -1
- package/dist/providers/algorand/index.d.mts +86 -0
- package/dist/providers/algorand/index.d.ts +86 -0
- package/dist/providers/algorand/index.js +903 -0
- package/dist/providers/algorand/index.js.map +1 -0
- package/dist/providers/algorand/index.mjs +898 -0
- package/dist/providers/algorand/index.mjs.map +1 -0
- package/dist/providers/evm/index.d.mts +1 -1
- package/dist/providers/evm/index.d.ts +1 -1
- package/dist/providers/evm/index.js +78 -1
- package/dist/providers/evm/index.js.map +1 -1
- package/dist/providers/evm/index.mjs +78 -1
- package/dist/providers/evm/index.mjs.map +1 -1
- package/dist/providers/near/index.d.mts +1 -1
- package/dist/providers/near/index.d.ts +1 -1
- package/dist/providers/near/index.js +78 -1
- package/dist/providers/near/index.js.map +1 -1
- package/dist/providers/near/index.mjs +78 -1
- package/dist/providers/near/index.mjs.map +1 -1
- package/dist/providers/solana/index.d.mts +1 -1
- package/dist/providers/solana/index.d.ts +1 -1
- package/dist/providers/solana/index.js +78 -1
- package/dist/providers/solana/index.js.map +1 -1
- package/dist/providers/solana/index.mjs +78 -1
- package/dist/providers/solana/index.mjs.map +1 -1
- package/dist/providers/stellar/index.d.mts +1 -1
- package/dist/providers/stellar/index.d.ts +1 -1
- package/dist/providers/stellar/index.js +78 -1
- package/dist/providers/stellar/index.js.map +1 -1
- package/dist/providers/stellar/index.mjs +78 -1
- package/dist/providers/stellar/index.mjs.map +1 -1
- package/dist/react/index.d.mts +3 -3
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.js +78 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +78 -1
- package/dist/react/index.mjs.map +1 -1
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +78 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +78 -1
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +24 -3
- package/src/backend/index.ts +2131 -0
- package/src/chains/index.ts +94 -2
- package/src/index.ts +19 -1
- package/src/providers/algorand/index.ts +356 -0
- package/src/types/index.ts +44 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { w as X402ClientConfig, P as PaymentInfo, f as PaymentResult, W as WalletState, C as ChainConfig, y as X402Event, B as X402EventHandler, a as NetworkType, T as TokenType, b as TokenConfig } from './index-D-dO_FoP.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* uvd-x402-sdk - Main Client
|
|
@@ -127,11 +127,12 @@ declare global {
|
|
|
127
127
|
/**
|
|
128
128
|
* uvd-x402-sdk - Chain Registry
|
|
129
129
|
*
|
|
130
|
-
* Complete configuration for all
|
|
131
|
-
* EVM chains (
|
|
130
|
+
* Complete configuration for all 16 supported blockchain networks.
|
|
131
|
+
* EVM chains (10): Use ERC-3009 TransferWithAuthorization
|
|
132
132
|
* SVM chains (2): Solana and Fogo - Use SPL tokens with partially-signed transactions
|
|
133
133
|
* Stellar (1): Uses Soroban authorization entries
|
|
134
134
|
* NEAR (1): Uses NEP-366 meta-transactions
|
|
135
|
+
* Algorand (2): Uses ASA transfers with atomic transaction groups
|
|
135
136
|
*/
|
|
136
137
|
|
|
137
138
|
/**
|
|
@@ -195,6 +196,14 @@ declare function getExplorerTxUrl(chainName: string, txHash: string): string | n
|
|
|
195
196
|
* Format address URL for block explorer
|
|
196
197
|
*/
|
|
197
198
|
declare function getExplorerAddressUrl(chainName: string, address: string): string | null;
|
|
199
|
+
/**
|
|
200
|
+
* Get list of Algorand chains
|
|
201
|
+
*/
|
|
202
|
+
declare function getAlgorandChains(): ChainConfig[];
|
|
203
|
+
/**
|
|
204
|
+
* Check if a chain is Algorand-based
|
|
205
|
+
*/
|
|
206
|
+
declare function isAlgorandChain(chainName: string): boolean;
|
|
198
207
|
/**
|
|
199
208
|
* Get token configuration for a specific chain and token type
|
|
200
209
|
* Falls back to USDC config if token not found (for backward compatibility)
|
|
@@ -227,4 +236,4 @@ declare function isTokenSupported(chainName: string, tokenType: TokenType): bool
|
|
|
227
236
|
*/
|
|
228
237
|
declare function getChainsByToken(tokenType: TokenType): ChainConfig[];
|
|
229
238
|
|
|
230
|
-
export { DEFAULT_CHAIN as D, SUPPORTED_CHAINS as S, X402Client as X, DEFAULT_FACILITATOR_URL as a, getChainByName as b, getEnabledChains as c, getChainsByNetworkType as d, getEVMChainIds as e, getSVMChains as f, getChainById as g, isSVMChain as h, isChainSupported as i, getNetworkType as j, getExplorerTxUrl as k, getExplorerAddressUrl as l, getTokenConfig as m, getSupportedTokens as n, isTokenSupported as o, getChainsByToken as p };
|
|
239
|
+
export { DEFAULT_CHAIN as D, SUPPORTED_CHAINS as S, X402Client as X, DEFAULT_FACILITATOR_URL as a, getChainByName as b, getEnabledChains as c, getChainsByNetworkType as d, getEVMChainIds as e, getSVMChains as f, getChainById as g, isSVMChain as h, isChainSupported as i, getNetworkType as j, getExplorerTxUrl as k, getExplorerAddressUrl as l, getTokenConfig as m, getSupportedTokens as n, isTokenSupported as o, getChainsByToken as p, getAlgorandChains as q, isAlgorandChain as r };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { D as DEFAULT_CHAIN, a as DEFAULT_FACILITATOR_URL, S as SUPPORTED_CHAINS, X as X402Client, g as getChainById, b as getChainByName, d as getChainsByNetworkType, p as getChainsByToken, e as getEVMChainIds, c as getEnabledChains, l as getExplorerAddressUrl, k as getExplorerTxUrl, j as getNetworkType, f as getSVMChains, n as getSupportedTokens, m as getTokenConfig, i as isChainSupported, h as isSVMChain, o as isTokenSupported } from './index-
|
|
1
|
+
export { D as DEFAULT_CHAIN, a as DEFAULT_FACILITATOR_URL, S as SUPPORTED_CHAINS, X as X402Client, q as getAlgorandChains, g as getChainById, b as getChainByName, d as getChainsByNetworkType, p as getChainsByToken, e as getEVMChainIds, c as getEnabledChains, l as getExplorerAddressUrl, k as getExplorerTxUrl, j as getNetworkType, f as getSVMChains, n as getSupportedTokens, m as getTokenConfig, r as isAlgorandChain, i as isChainSupported, h as isSVMChain, o as isTokenSupported } from './index-C60c_e5z.mjs';
|
|
2
2
|
export { DEFAULT_PAYMENT_HEADER, PAYMENT_HEADER_NAMES, caip2ToChain, chainToCAIP2, convertX402Header, createPaymentHeaders, createX402Header, createX402V1Header, createX402V2Header, decodeX402Header, detectX402Version, encodeX402Header, generatePaymentOptions, getPaymentHeader, isCAIP2Format, parseNetworkIdentifier, validateAmount, validateRecipient } from './utils/index.mjs';
|
|
3
|
-
export {
|
|
3
|
+
export { A as AlgorandPaymentPayload, H as CAIP2_IDENTIFIERS, I as CAIP2_TO_CHAIN, C as ChainConfig, G as DEFAULT_CONFIG, E as EIP712Domain, d as EIP712Types, i as EVMPaymentPayload, M as MultiPaymentConfig, k as NEARPaymentPayload, N as NativeCurrency, x as NetworkBalance, a as NetworkType, g as PaymentHeaders, P as PaymentInfo, h as PaymentPayload, e as PaymentRequest, f as PaymentResult, S as SolanaPaymentPayload, j as StellarPaymentPayload, b as TokenConfig, T as TokenType, U as USDCConfig, c as WalletAdapter, W as WalletState, v as X402AlgorandPayload, w as X402ClientConfig, r as X402EVMPayload, F as X402Error, D as X402ErrorCode, y as X402Event, z as X402EventData, B as X402EventHandler, m as X402Header, X as X402HeaderName, n as X402HeaderV1, o as X402HeaderV2, u as X402NEARPayload, q as X402PayloadData, p as X402PaymentOption, s as X402SolanaPayload, t as X402StellarPayload, l as X402Version } from './index-D-dO_FoP.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { D as DEFAULT_CHAIN, a as DEFAULT_FACILITATOR_URL, S as SUPPORTED_CHAINS, X as X402Client, g as getChainById, b as getChainByName, d as getChainsByNetworkType, p as getChainsByToken, e as getEVMChainIds, c as getEnabledChains, l as getExplorerAddressUrl, k as getExplorerTxUrl, j as getNetworkType, f as getSVMChains, n as getSupportedTokens, m as getTokenConfig, i as isChainSupported, h as isSVMChain, o as isTokenSupported } from './index-
|
|
1
|
+
export { D as DEFAULT_CHAIN, a as DEFAULT_FACILITATOR_URL, S as SUPPORTED_CHAINS, X as X402Client, q as getAlgorandChains, g as getChainById, b as getChainByName, d as getChainsByNetworkType, p as getChainsByToken, e as getEVMChainIds, c as getEnabledChains, l as getExplorerAddressUrl, k as getExplorerTxUrl, j as getNetworkType, f as getSVMChains, n as getSupportedTokens, m as getTokenConfig, r as isAlgorandChain, i as isChainSupported, h as isSVMChain, o as isTokenSupported } from './index-VIOUicmO.js';
|
|
2
2
|
export { DEFAULT_PAYMENT_HEADER, PAYMENT_HEADER_NAMES, caip2ToChain, chainToCAIP2, convertX402Header, createPaymentHeaders, createX402Header, createX402V1Header, createX402V2Header, decodeX402Header, detectX402Version, encodeX402Header, generatePaymentOptions, getPaymentHeader, isCAIP2Format, parseNetworkIdentifier, validateAmount, validateRecipient } from './utils/index.js';
|
|
3
|
-
export {
|
|
3
|
+
export { A as AlgorandPaymentPayload, H as CAIP2_IDENTIFIERS, I as CAIP2_TO_CHAIN, C as ChainConfig, G as DEFAULT_CONFIG, E as EIP712Domain, d as EIP712Types, i as EVMPaymentPayload, M as MultiPaymentConfig, k as NEARPaymentPayload, N as NativeCurrency, x as NetworkBalance, a as NetworkType, g as PaymentHeaders, P as PaymentInfo, h as PaymentPayload, e as PaymentRequest, f as PaymentResult, S as SolanaPaymentPayload, j as StellarPaymentPayload, b as TokenConfig, T as TokenType, U as USDCConfig, c as WalletAdapter, W as WalletState, v as X402AlgorandPayload, w as X402ClientConfig, r as X402EVMPayload, F as X402Error, D as X402ErrorCode, y as X402Event, z as X402EventData, B as X402EventHandler, m as X402Header, X as X402HeaderName, n as X402HeaderV1, o as X402HeaderV2, u as X402NEARPayload, q as X402PayloadData, p as X402PaymentOption, s as X402SolanaPayload, t as X402StellarPayload, l as X402Version } from './index-D-dO_FoP.js';
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,10 @@ var CAIP2_IDENTIFIERS = {
|
|
|
23
23
|
// Stellar
|
|
24
24
|
stellar: "stellar:pubnet",
|
|
25
25
|
// NEAR
|
|
26
|
-
near: "near:mainnet"
|
|
26
|
+
near: "near:mainnet",
|
|
27
|
+
// Algorand
|
|
28
|
+
algorand: "algorand:mainnet",
|
|
29
|
+
"algorand-testnet": "algorand:testnet"
|
|
27
30
|
};
|
|
28
31
|
var CAIP2_TO_CHAIN = Object.fromEntries(
|
|
29
32
|
Object.entries(CAIP2_IDENTIFIERS).map(([k, v]) => [v, k])
|
|
@@ -572,6 +575,80 @@ var SUPPORTED_CHAINS = {
|
|
|
572
575
|
enabled: true
|
|
573
576
|
// NEP-366 meta-transactions supported
|
|
574
577
|
}
|
|
578
|
+
},
|
|
579
|
+
// ============================================================================
|
|
580
|
+
// ALGORAND (2 networks) - Uses ASA transfers with atomic transaction groups
|
|
581
|
+
// ============================================================================
|
|
582
|
+
algorand: {
|
|
583
|
+
chainId: 0,
|
|
584
|
+
// Non-EVM (Algorand uses genesis hash for network identification)
|
|
585
|
+
chainIdHex: "0x0",
|
|
586
|
+
name: "algorand",
|
|
587
|
+
displayName: "Algorand",
|
|
588
|
+
networkType: "algorand",
|
|
589
|
+
rpcUrl: "https://mainnet-api.algonode.cloud",
|
|
590
|
+
explorerUrl: "https://allo.info",
|
|
591
|
+
nativeCurrency: {
|
|
592
|
+
name: "Algo",
|
|
593
|
+
symbol: "ALGO",
|
|
594
|
+
decimals: 6
|
|
595
|
+
// Algorand uses 6 decimals (microAlgos)
|
|
596
|
+
},
|
|
597
|
+
usdc: {
|
|
598
|
+
address: "31566704",
|
|
599
|
+
// USDC ASA ID on Algorand mainnet
|
|
600
|
+
decimals: 6,
|
|
601
|
+
name: "USDC",
|
|
602
|
+
version: "1"
|
|
603
|
+
},
|
|
604
|
+
tokens: {
|
|
605
|
+
usdc: {
|
|
606
|
+
address: "31566704",
|
|
607
|
+
// USDC ASA ID on Algorand mainnet
|
|
608
|
+
decimals: 6,
|
|
609
|
+
name: "USDC",
|
|
610
|
+
version: "1"
|
|
611
|
+
}
|
|
612
|
+
},
|
|
613
|
+
x402: {
|
|
614
|
+
facilitatorUrl: DEFAULT_FACILITATOR_URL,
|
|
615
|
+
enabled: true
|
|
616
|
+
}
|
|
617
|
+
},
|
|
618
|
+
"algorand-testnet": {
|
|
619
|
+
chainId: 0,
|
|
620
|
+
// Non-EVM
|
|
621
|
+
chainIdHex: "0x0",
|
|
622
|
+
name: "algorand-testnet",
|
|
623
|
+
displayName: "Algorand Testnet",
|
|
624
|
+
networkType: "algorand",
|
|
625
|
+
rpcUrl: "https://testnet-api.algonode.cloud",
|
|
626
|
+
explorerUrl: "https://testnet.allo.info",
|
|
627
|
+
nativeCurrency: {
|
|
628
|
+
name: "Algo",
|
|
629
|
+
symbol: "ALGO",
|
|
630
|
+
decimals: 6
|
|
631
|
+
},
|
|
632
|
+
usdc: {
|
|
633
|
+
address: "10458941",
|
|
634
|
+
// USDC ASA ID on Algorand testnet
|
|
635
|
+
decimals: 6,
|
|
636
|
+
name: "USDC",
|
|
637
|
+
version: "1"
|
|
638
|
+
},
|
|
639
|
+
tokens: {
|
|
640
|
+
usdc: {
|
|
641
|
+
address: "10458941",
|
|
642
|
+
// USDC ASA ID on Algorand testnet
|
|
643
|
+
decimals: 6,
|
|
644
|
+
name: "USDC",
|
|
645
|
+
version: "1"
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
x402: {
|
|
649
|
+
facilitatorUrl: DEFAULT_FACILITATOR_URL,
|
|
650
|
+
enabled: true
|
|
651
|
+
}
|
|
575
652
|
}
|
|
576
653
|
};
|
|
577
654
|
var DEFAULT_CHAIN = "base";
|
|
@@ -624,6 +701,8 @@ function getExplorerTxUrl(chainName, txHash) {
|
|
|
624
701
|
return `${chain.explorerUrl}/tx/${txHash}`;
|
|
625
702
|
case "near":
|
|
626
703
|
return `${chain.explorerUrl}/txns/${txHash}`;
|
|
704
|
+
case "algorand":
|
|
705
|
+
return `${chain.explorerUrl}/tx/${txHash}`;
|
|
627
706
|
default:
|
|
628
707
|
return null;
|
|
629
708
|
}
|
|
@@ -641,10 +720,21 @@ function getExplorerAddressUrl(chainName, address) {
|
|
|
641
720
|
return `${chain.explorerUrl}/account/${address}`;
|
|
642
721
|
case "near":
|
|
643
722
|
return `${chain.explorerUrl}/address/${address}`;
|
|
723
|
+
case "algorand":
|
|
724
|
+
return `${chain.explorerUrl}/account/${address}`;
|
|
644
725
|
default:
|
|
645
726
|
return null;
|
|
646
727
|
}
|
|
647
728
|
}
|
|
729
|
+
function getAlgorandChains() {
|
|
730
|
+
return Object.values(SUPPORTED_CHAINS).filter(
|
|
731
|
+
(chain) => chain.networkType === "algorand" && chain.x402.enabled
|
|
732
|
+
);
|
|
733
|
+
}
|
|
734
|
+
function isAlgorandChain(chainName) {
|
|
735
|
+
const chain = getChainByName(chainName);
|
|
736
|
+
return chain?.networkType === "algorand";
|
|
737
|
+
}
|
|
648
738
|
function getTokenConfig(chainName, tokenType = "usdc") {
|
|
649
739
|
const chain = getChainByName(chainName);
|
|
650
740
|
if (!chain) return void 0;
|
|
@@ -1445,6 +1535,7 @@ exports.decodeX402Header = decodeX402Header;
|
|
|
1445
1535
|
exports.detectX402Version = detectX402Version;
|
|
1446
1536
|
exports.encodeX402Header = encodeX402Header;
|
|
1447
1537
|
exports.generatePaymentOptions = generatePaymentOptions;
|
|
1538
|
+
exports.getAlgorandChains = getAlgorandChains;
|
|
1448
1539
|
exports.getChainById = getChainById;
|
|
1449
1540
|
exports.getChainByName = getChainByName;
|
|
1450
1541
|
exports.getChainsByNetworkType = getChainsByNetworkType;
|
|
@@ -1458,6 +1549,7 @@ exports.getPaymentHeader = getPaymentHeader;
|
|
|
1458
1549
|
exports.getSVMChains = getSVMChains;
|
|
1459
1550
|
exports.getSupportedTokens = getSupportedTokens;
|
|
1460
1551
|
exports.getTokenConfig = getTokenConfig;
|
|
1552
|
+
exports.isAlgorandChain = isAlgorandChain;
|
|
1461
1553
|
exports.isCAIP2Format = isCAIP2Format;
|
|
1462
1554
|
exports.isChainSupported = isChainSupported;
|
|
1463
1555
|
exports.isSVMChain = isSVMChain;
|