uvd-x402-sdk 2.13.1 → 2.14.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 +218 -1396
- package/dist/adapters/index.d.mts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/index.mjs.map +1 -1
- package/dist/backend/index.d.mts +1 -1
- package/dist/backend/index.d.ts +1 -1
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/index.mjs.map +1 -1
- package/dist/{index-fIhvHqCQ.d.mts → index-BYIugZlE.d.mts} +17 -0
- package/dist/{index-fIhvHqCQ.d.ts → index-BYIugZlE.d.ts} +17 -0
- package/dist/{index-DmJGKD9r.d.ts → index-Cwi_VM05.d.ts} +1 -1
- package/dist/{index-C6Vxnneo.d.mts → index-D3PO3jLW.d.mts} +1 -1
- package/dist/index.d.mts +42 -18
- package/dist/index.d.ts +42 -18
- package/dist/index.js +58 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -16
- package/dist/index.mjs.map +1 -1
- package/dist/providers/algorand/index.d.mts +4 -1
- package/dist/providers/algorand/index.d.ts +4 -1
- package/dist/providers/algorand/index.js +83 -31
- package/dist/providers/algorand/index.js.map +1 -1
- package/dist/providers/algorand/index.mjs +83 -31
- package/dist/providers/algorand/index.mjs.map +1 -1
- package/dist/providers/evm/index.d.mts +1 -1
- package/dist/providers/evm/index.d.ts +1 -1
- package/dist/providers/evm/index.js.map +1 -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.map +1 -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 +3 -0
- package/dist/providers/solana/index.js.map +1 -1
- package/dist/providers/solana/index.mjs +3 -0
- 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.map +1 -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.map +1 -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.map +1 -1
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/facilitator.ts +64 -16
- package/src/providers/algorand/index.ts +33 -20
- package/src/providers/solana/index.ts +9 -2
- package/src/types/index.ts +18 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as WalletAdapter, C as ChainConfig, P as PaymentInfo, l as X402Version } from '../../index-
|
|
1
|
+
import { c as WalletAdapter, C as ChainConfig, P as PaymentInfo, l as X402Version } from '../../index-BYIugZlE.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* uvd-x402-sdk - Algorand Provider
|
|
@@ -79,6 +79,9 @@ declare class AlgorandProvider implements WalletAdapter {
|
|
|
79
79
|
getAddress(): string | null;
|
|
80
80
|
/**
|
|
81
81
|
* Get USDC (ASA) balance
|
|
82
|
+
*
|
|
83
|
+
* Uses direct fetch with CORS-friendly RPC endpoints for browser compatibility.
|
|
84
|
+
* Falls back through multiple endpoints for reliability.
|
|
82
85
|
*/
|
|
83
86
|
getBalance(chainConfig: ChainConfig): Promise<string>;
|
|
84
87
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as WalletAdapter, C as ChainConfig, P as PaymentInfo, l as X402Version } from '../../index-
|
|
1
|
+
import { c as WalletAdapter, C as ChainConfig, P as PaymentInfo, l as X402Version } from '../../index-BYIugZlE.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* uvd-x402-sdk - Algorand Provider
|
|
@@ -79,6 +79,9 @@ declare class AlgorandProvider implements WalletAdapter {
|
|
|
79
79
|
getAddress(): string | null;
|
|
80
80
|
/**
|
|
81
81
|
* Get USDC (ASA) balance
|
|
82
|
+
*
|
|
83
|
+
* Uses direct fetch with CORS-friendly RPC endpoints for browser compatibility.
|
|
84
|
+
* Falls back through multiple endpoints for reliability.
|
|
82
85
|
*/
|
|
83
86
|
getBalance(chainConfig: ChainConfig): Promise<string>;
|
|
84
87
|
/**
|
|
@@ -680,37 +680,79 @@ function chainToCAIP2(chainName) {
|
|
|
680
680
|
|
|
681
681
|
// src/facilitator.ts
|
|
682
682
|
var FACILITATOR_ADDRESSES = {
|
|
683
|
+
// ============================================
|
|
684
|
+
// EVM Chains
|
|
685
|
+
// ============================================
|
|
683
686
|
/**
|
|
684
|
-
*
|
|
687
|
+
* EVM facilitator address (mainnet)
|
|
688
|
+
* Used for: Submitting EIP-3009 transferWithAuthorization transactions
|
|
689
|
+
* Note: Same address across all EVM mainnet chains
|
|
690
|
+
*/
|
|
691
|
+
evm: "0x103040545AC5031A11E8C03dd11324C7333a13C7",
|
|
692
|
+
/**
|
|
693
|
+
* EVM facilitator address (testnet)
|
|
694
|
+
* Used for: All EVM testnet chains
|
|
695
|
+
*/
|
|
696
|
+
"evm-testnet": "0x34033041a5944B8F10f8E4D8496Bfb84f1A293A8",
|
|
697
|
+
// ============================================
|
|
698
|
+
// Solana
|
|
699
|
+
// ============================================
|
|
700
|
+
/**
|
|
701
|
+
* Solana facilitator address (mainnet)
|
|
685
702
|
* Used for: Paying transaction fees on Solana
|
|
686
703
|
*/
|
|
687
704
|
solana: "F742C4VfFLQ9zRQyithoj5229ZgtX2WqKCSFKgH2EThq",
|
|
688
705
|
/**
|
|
689
|
-
*
|
|
690
|
-
* Used for: Signing Transaction 0 (fee tx) in atomic groups
|
|
691
|
-
* Note: This is derived from the facilitator's Algorand mnemonic
|
|
706
|
+
* Solana facilitator address (devnet)
|
|
692
707
|
*/
|
|
693
|
-
|
|
708
|
+
"solana-devnet": "6xNPewUdKRbEZDReQdpyfNUdgNg8QRc8Mt263T5GZSRv",
|
|
709
|
+
// ============================================
|
|
710
|
+
// Fogo (uses same addresses as Solana)
|
|
711
|
+
// ============================================
|
|
694
712
|
/**
|
|
695
|
-
*
|
|
713
|
+
* Fogo facilitator address (mainnet)
|
|
696
714
|
*/
|
|
697
|
-
|
|
715
|
+
fogo: "F742C4VfFLQ9zRQyithoj5229ZgtX2WqKCSFKgH2EThq",
|
|
698
716
|
/**
|
|
699
|
-
*
|
|
700
|
-
* Used for: Submitting EIP-3009 transferWithAuthorization transactions
|
|
701
|
-
* Note: Same address across all EVM chains
|
|
717
|
+
* Fogo facilitator address (testnet)
|
|
702
718
|
*/
|
|
703
|
-
|
|
719
|
+
"fogo-testnet": "6xNPewUdKRbEZDReQdpyfNUdgNg8QRc8Mt263T5GZSRv",
|
|
720
|
+
// ============================================
|
|
721
|
+
// NEAR
|
|
722
|
+
// ============================================
|
|
704
723
|
/**
|
|
705
|
-
*
|
|
724
|
+
* NEAR facilitator address (mainnet)
|
|
725
|
+
* Used for: Relaying meta-transactions
|
|
726
|
+
*/
|
|
727
|
+
near: "uvd-facilitator.near",
|
|
728
|
+
/**
|
|
729
|
+
* NEAR facilitator address (testnet)
|
|
730
|
+
*/
|
|
731
|
+
"near-testnet": "uvd-facilitator.testnet",
|
|
732
|
+
// ============================================
|
|
733
|
+
// Stellar
|
|
734
|
+
// ============================================
|
|
735
|
+
/**
|
|
736
|
+
* Stellar facilitator address (mainnet)
|
|
706
737
|
* Used for: Signing soroban authorization entries
|
|
707
738
|
*/
|
|
708
|
-
stellar: "
|
|
739
|
+
stellar: "GCHPGXJT2WFFRFCA5TV4G4E3PMMXLNIDUH27PKDYA4QJ2XGYZWGFZNHB",
|
|
709
740
|
/**
|
|
710
|
-
*
|
|
711
|
-
* Used for: Relaying meta-transactions
|
|
741
|
+
* Stellar facilitator address (testnet)
|
|
712
742
|
*/
|
|
713
|
-
|
|
743
|
+
"stellar-testnet": "GBBFZMLUJEZVI32EN4XA2KPP445XIBTMTRBLYWFIL556RDTHS2OWFQ2Z",
|
|
744
|
+
// ============================================
|
|
745
|
+
// Algorand
|
|
746
|
+
// ============================================
|
|
747
|
+
/**
|
|
748
|
+
* Algorand facilitator address (mainnet)
|
|
749
|
+
* Used for: Signing Transaction 0 (fee tx) in atomic groups
|
|
750
|
+
*/
|
|
751
|
+
algorand: "KIMS5H6QLCUDL65L5UBTOXDPWLMTS7N3AAC3I6B2NCONEI5QIVK7LH2C2I",
|
|
752
|
+
/**
|
|
753
|
+
* Algorand facilitator address (testnet)
|
|
754
|
+
*/
|
|
755
|
+
"algorand-testnet": "5DPPDQNYUPCTXRZWRYSF3WPYU6RKAUR25F3YG4EKXQRHV5AUAI62H5GXL4"
|
|
714
756
|
};
|
|
715
757
|
function getFacilitatorAddress(chainName, networkType) {
|
|
716
758
|
const exactMatch = FACILITATOR_ADDRESSES[chainName];
|
|
@@ -900,29 +942,39 @@ var AlgorandProvider = class {
|
|
|
900
942
|
}
|
|
901
943
|
/**
|
|
902
944
|
* Get USDC (ASA) balance
|
|
945
|
+
*
|
|
946
|
+
* Uses direct fetch with CORS-friendly RPC endpoints for browser compatibility.
|
|
947
|
+
* Falls back through multiple endpoints for reliability.
|
|
903
948
|
*/
|
|
904
949
|
async getBalance(chainConfig) {
|
|
905
|
-
await loadAlgorandDeps();
|
|
906
950
|
if (!this.address) {
|
|
907
951
|
throw new X402Error("Wallet not connected", "WALLET_NOT_CONNECTED");
|
|
908
952
|
}
|
|
909
|
-
const algodClient = await this.getAlgodClient(chainConfig);
|
|
910
953
|
const assetId = parseInt(chainConfig.usdc.address, 10);
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
954
|
+
const rpcEndpoints = [
|
|
955
|
+
chainConfig.rpcUrl,
|
|
956
|
+
"https://mainnet-api.4160.nodely.io",
|
|
957
|
+
"https://mainnet-api.algonode.cloud"
|
|
958
|
+
];
|
|
959
|
+
for (const rpcUrl of rpcEndpoints) {
|
|
960
|
+
try {
|
|
961
|
+
const response = await fetch(`${rpcUrl}/v2/accounts/${this.address}`, {
|
|
962
|
+
method: "GET",
|
|
963
|
+
headers: { "Content-Type": "application/json" }
|
|
964
|
+
});
|
|
965
|
+
if (!response.ok) continue;
|
|
966
|
+
const data = await response.json();
|
|
967
|
+
const assets = data.assets || [];
|
|
968
|
+
const usdcAsset = assets.find(
|
|
969
|
+
(asset) => asset["asset-id"] === assetId
|
|
970
|
+
);
|
|
971
|
+
if (!usdcAsset) return "0.00";
|
|
972
|
+
const balance = Number(usdcAsset.amount) / Math.pow(10, chainConfig.usdc.decimals);
|
|
973
|
+
return balance.toFixed(2);
|
|
974
|
+
} catch {
|
|
919
975
|
}
|
|
920
|
-
const amount = Number(usdcAsset.amount || usdcAsset["amount"]);
|
|
921
|
-
const balance = amount / Math.pow(10, chainConfig.usdc.decimals);
|
|
922
|
-
return balance.toFixed(2);
|
|
923
|
-
} catch {
|
|
924
|
-
return "0.00";
|
|
925
976
|
}
|
|
977
|
+
return "0.00";
|
|
926
978
|
}
|
|
927
979
|
/**
|
|
928
980
|
* Create Algorand atomic group payment (GoPlausible x402-avm spec)
|