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
|
@@ -676,37 +676,79 @@ function chainToCAIP2(chainName) {
|
|
|
676
676
|
|
|
677
677
|
// src/facilitator.ts
|
|
678
678
|
var FACILITATOR_ADDRESSES = {
|
|
679
|
+
// ============================================
|
|
680
|
+
// EVM Chains
|
|
681
|
+
// ============================================
|
|
679
682
|
/**
|
|
680
|
-
*
|
|
683
|
+
* EVM facilitator address (mainnet)
|
|
684
|
+
* Used for: Submitting EIP-3009 transferWithAuthorization transactions
|
|
685
|
+
* Note: Same address across all EVM mainnet chains
|
|
686
|
+
*/
|
|
687
|
+
evm: "0x103040545AC5031A11E8C03dd11324C7333a13C7",
|
|
688
|
+
/**
|
|
689
|
+
* EVM facilitator address (testnet)
|
|
690
|
+
* Used for: All EVM testnet chains
|
|
691
|
+
*/
|
|
692
|
+
"evm-testnet": "0x34033041a5944B8F10f8E4D8496Bfb84f1A293A8",
|
|
693
|
+
// ============================================
|
|
694
|
+
// Solana
|
|
695
|
+
// ============================================
|
|
696
|
+
/**
|
|
697
|
+
* Solana facilitator address (mainnet)
|
|
681
698
|
* Used for: Paying transaction fees on Solana
|
|
682
699
|
*/
|
|
683
700
|
solana: "F742C4VfFLQ9zRQyithoj5229ZgtX2WqKCSFKgH2EThq",
|
|
684
701
|
/**
|
|
685
|
-
*
|
|
686
|
-
* Used for: Signing Transaction 0 (fee tx) in atomic groups
|
|
687
|
-
* Note: This is derived from the facilitator's Algorand mnemonic
|
|
702
|
+
* Solana facilitator address (devnet)
|
|
688
703
|
*/
|
|
689
|
-
|
|
704
|
+
"solana-devnet": "6xNPewUdKRbEZDReQdpyfNUdgNg8QRc8Mt263T5GZSRv",
|
|
705
|
+
// ============================================
|
|
706
|
+
// Fogo (uses same addresses as Solana)
|
|
707
|
+
// ============================================
|
|
690
708
|
/**
|
|
691
|
-
*
|
|
709
|
+
* Fogo facilitator address (mainnet)
|
|
692
710
|
*/
|
|
693
|
-
|
|
711
|
+
fogo: "F742C4VfFLQ9zRQyithoj5229ZgtX2WqKCSFKgH2EThq",
|
|
694
712
|
/**
|
|
695
|
-
*
|
|
696
|
-
* Used for: Submitting EIP-3009 transferWithAuthorization transactions
|
|
697
|
-
* Note: Same address across all EVM chains
|
|
713
|
+
* Fogo facilitator address (testnet)
|
|
698
714
|
*/
|
|
699
|
-
|
|
715
|
+
"fogo-testnet": "6xNPewUdKRbEZDReQdpyfNUdgNg8QRc8Mt263T5GZSRv",
|
|
716
|
+
// ============================================
|
|
717
|
+
// NEAR
|
|
718
|
+
// ============================================
|
|
700
719
|
/**
|
|
701
|
-
*
|
|
720
|
+
* NEAR facilitator address (mainnet)
|
|
721
|
+
* Used for: Relaying meta-transactions
|
|
722
|
+
*/
|
|
723
|
+
near: "uvd-facilitator.near",
|
|
724
|
+
/**
|
|
725
|
+
* NEAR facilitator address (testnet)
|
|
726
|
+
*/
|
|
727
|
+
"near-testnet": "uvd-facilitator.testnet",
|
|
728
|
+
// ============================================
|
|
729
|
+
// Stellar
|
|
730
|
+
// ============================================
|
|
731
|
+
/**
|
|
732
|
+
* Stellar facilitator address (mainnet)
|
|
702
733
|
* Used for: Signing soroban authorization entries
|
|
703
734
|
*/
|
|
704
|
-
stellar: "
|
|
735
|
+
stellar: "GCHPGXJT2WFFRFCA5TV4G4E3PMMXLNIDUH27PKDYA4QJ2XGYZWGFZNHB",
|
|
705
736
|
/**
|
|
706
|
-
*
|
|
707
|
-
* Used for: Relaying meta-transactions
|
|
737
|
+
* Stellar facilitator address (testnet)
|
|
708
738
|
*/
|
|
709
|
-
|
|
739
|
+
"stellar-testnet": "GBBFZMLUJEZVI32EN4XA2KPP445XIBTMTRBLYWFIL556RDTHS2OWFQ2Z",
|
|
740
|
+
// ============================================
|
|
741
|
+
// Algorand
|
|
742
|
+
// ============================================
|
|
743
|
+
/**
|
|
744
|
+
* Algorand facilitator address (mainnet)
|
|
745
|
+
* Used for: Signing Transaction 0 (fee tx) in atomic groups
|
|
746
|
+
*/
|
|
747
|
+
algorand: "KIMS5H6QLCUDL65L5UBTOXDPWLMTS7N3AAC3I6B2NCONEI5QIVK7LH2C2I",
|
|
748
|
+
/**
|
|
749
|
+
* Algorand facilitator address (testnet)
|
|
750
|
+
*/
|
|
751
|
+
"algorand-testnet": "5DPPDQNYUPCTXRZWRYSF3WPYU6RKAUR25F3YG4EKXQRHV5AUAI62H5GXL4"
|
|
710
752
|
};
|
|
711
753
|
function getFacilitatorAddress(chainName, networkType) {
|
|
712
754
|
const exactMatch = FACILITATOR_ADDRESSES[chainName];
|
|
@@ -896,29 +938,39 @@ var AlgorandProvider = class {
|
|
|
896
938
|
}
|
|
897
939
|
/**
|
|
898
940
|
* Get USDC (ASA) balance
|
|
941
|
+
*
|
|
942
|
+
* Uses direct fetch with CORS-friendly RPC endpoints for browser compatibility.
|
|
943
|
+
* Falls back through multiple endpoints for reliability.
|
|
899
944
|
*/
|
|
900
945
|
async getBalance(chainConfig) {
|
|
901
|
-
await loadAlgorandDeps();
|
|
902
946
|
if (!this.address) {
|
|
903
947
|
throw new X402Error("Wallet not connected", "WALLET_NOT_CONNECTED");
|
|
904
948
|
}
|
|
905
|
-
const algodClient = await this.getAlgodClient(chainConfig);
|
|
906
949
|
const assetId = parseInt(chainConfig.usdc.address, 10);
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
950
|
+
const rpcEndpoints = [
|
|
951
|
+
chainConfig.rpcUrl,
|
|
952
|
+
"https://mainnet-api.4160.nodely.io",
|
|
953
|
+
"https://mainnet-api.algonode.cloud"
|
|
954
|
+
];
|
|
955
|
+
for (const rpcUrl of rpcEndpoints) {
|
|
956
|
+
try {
|
|
957
|
+
const response = await fetch(`${rpcUrl}/v2/accounts/${this.address}`, {
|
|
958
|
+
method: "GET",
|
|
959
|
+
headers: { "Content-Type": "application/json" }
|
|
960
|
+
});
|
|
961
|
+
if (!response.ok) continue;
|
|
962
|
+
const data = await response.json();
|
|
963
|
+
const assets = data.assets || [];
|
|
964
|
+
const usdcAsset = assets.find(
|
|
965
|
+
(asset) => asset["asset-id"] === assetId
|
|
966
|
+
);
|
|
967
|
+
if (!usdcAsset) return "0.00";
|
|
968
|
+
const balance = Number(usdcAsset.amount) / Math.pow(10, chainConfig.usdc.decimals);
|
|
969
|
+
return balance.toFixed(2);
|
|
970
|
+
} catch {
|
|
915
971
|
}
|
|
916
|
-
const amount = Number(usdcAsset.amount || usdcAsset["amount"]);
|
|
917
|
-
const balance = amount / Math.pow(10, chainConfig.usdc.decimals);
|
|
918
|
-
return balance.toFixed(2);
|
|
919
|
-
} catch {
|
|
920
|
-
return "0.00";
|
|
921
972
|
}
|
|
973
|
+
return "0.00";
|
|
922
974
|
}
|
|
923
975
|
/**
|
|
924
976
|
* Create Algorand atomic group payment (GoPlausible x402-avm spec)
|