@volr/react 0.1.106 → 0.1.109
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/dist/index.cjs +2 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +2 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -809,8 +809,10 @@ interface PaymentItem {
|
|
|
809
809
|
image?: string;
|
|
810
810
|
}
|
|
811
811
|
interface PayOptions {
|
|
812
|
-
/** Amount in token units (before decimals applied) */
|
|
812
|
+
/** Amount in token units (before decimals applied) - same amount applies to all tokens */
|
|
813
813
|
amount: number;
|
|
814
|
+
/** Token ID to use for payment (if not provided, user selects in modal) */
|
|
815
|
+
tokenId?: string;
|
|
814
816
|
/** Item information to display in payment modal */
|
|
815
817
|
item?: PaymentItem;
|
|
816
818
|
/** Client-side order/reference ID */
|
|
@@ -846,6 +848,8 @@ interface PaymentToken {
|
|
|
846
848
|
symbol: string;
|
|
847
849
|
chainId: number;
|
|
848
850
|
decimals: number;
|
|
851
|
+
address: string;
|
|
852
|
+
iconUrl?: string | null;
|
|
849
853
|
}
|
|
850
854
|
interface PaymentResult {
|
|
851
855
|
id: string;
|
|
@@ -916,8 +920,11 @@ interface PaymentContext {
|
|
|
916
920
|
interface UseVolrPaymentApiReturn {
|
|
917
921
|
/**
|
|
918
922
|
* Create a payment via API
|
|
923
|
+
* @param options Payment options including required tokenId
|
|
919
924
|
*/
|
|
920
|
-
createPayment: (options: PayOptions
|
|
925
|
+
createPayment: (options: PayOptions & {
|
|
926
|
+
tokenId: string;
|
|
927
|
+
}) => Promise<PaymentResult>;
|
|
921
928
|
/**
|
|
922
929
|
* Check payment status by ID
|
|
923
930
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -809,8 +809,10 @@ interface PaymentItem {
|
|
|
809
809
|
image?: string;
|
|
810
810
|
}
|
|
811
811
|
interface PayOptions {
|
|
812
|
-
/** Amount in token units (before decimals applied) */
|
|
812
|
+
/** Amount in token units (before decimals applied) - same amount applies to all tokens */
|
|
813
813
|
amount: number;
|
|
814
|
+
/** Token ID to use for payment (if not provided, user selects in modal) */
|
|
815
|
+
tokenId?: string;
|
|
814
816
|
/** Item information to display in payment modal */
|
|
815
817
|
item?: PaymentItem;
|
|
816
818
|
/** Client-side order/reference ID */
|
|
@@ -846,6 +848,8 @@ interface PaymentToken {
|
|
|
846
848
|
symbol: string;
|
|
847
849
|
chainId: number;
|
|
848
850
|
decimals: number;
|
|
851
|
+
address: string;
|
|
852
|
+
iconUrl?: string | null;
|
|
849
853
|
}
|
|
850
854
|
interface PaymentResult {
|
|
851
855
|
id: string;
|
|
@@ -916,8 +920,11 @@ interface PaymentContext {
|
|
|
916
920
|
interface UseVolrPaymentApiReturn {
|
|
917
921
|
/**
|
|
918
922
|
* Create a payment via API
|
|
923
|
+
* @param options Payment options including required tokenId
|
|
919
924
|
*/
|
|
920
|
-
createPayment: (options: PayOptions
|
|
925
|
+
createPayment: (options: PayOptions & {
|
|
926
|
+
tokenId: string;
|
|
927
|
+
}) => Promise<PaymentResult>;
|
|
921
928
|
/**
|
|
922
929
|
* Check payment status by ID
|
|
923
930
|
*/
|
package/dist/index.js
CHANGED
|
@@ -18100,20 +18100,13 @@ var CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
|
18100
18100
|
function createGetRpcUrl(deps) {
|
|
18101
18101
|
const { client, rpcOverrides } = deps;
|
|
18102
18102
|
return async function getRpcUrl(chainId) {
|
|
18103
|
-
console.log("[getRpcUrl] Getting RPC URL for chainId:", chainId);
|
|
18104
18103
|
const overrideUrl = rpcOverrides?.[chainId.toString()];
|
|
18105
|
-
if (overrideUrl)
|
|
18106
|
-
console.log("[getRpcUrl] Using override URL");
|
|
18107
|
-
return overrideUrl;
|
|
18108
|
-
}
|
|
18104
|
+
if (overrideUrl) return overrideUrl;
|
|
18109
18105
|
const cached = networkCache.get(chainId);
|
|
18110
18106
|
if (cached && cached.rpcUrl && Date.now() - cached.timestamp < CACHE_TTL_MS) {
|
|
18111
|
-
console.log("[getRpcUrl] Using cached URL");
|
|
18112
18107
|
return cached.rpcUrl;
|
|
18113
18108
|
}
|
|
18114
|
-
console.log("[getRpcUrl] Fetching from backend API...");
|
|
18115
18109
|
const response = await client.get(`/networks/${chainId}?includeRpcUrl=true`);
|
|
18116
|
-
console.log("[getRpcUrl] Backend response received");
|
|
18117
18110
|
if (!response.rpcUrl) {
|
|
18118
18111
|
throw new Error(
|
|
18119
18112
|
`RPC URL not available for chainId ${chainId}. Please provide it in config.rpcOverrides[${chainId}]`
|
|
@@ -18125,7 +18118,6 @@ function createGetRpcUrl(deps) {
|
|
|
18125
18118
|
invokerAddress: response.invokerAddress,
|
|
18126
18119
|
timestamp: Date.now()
|
|
18127
18120
|
});
|
|
18128
|
-
console.log("[getRpcUrl] RPC URL fetched and cached");
|
|
18129
18121
|
return response.rpcUrl;
|
|
18130
18122
|
};
|
|
18131
18123
|
}
|
|
@@ -19639,6 +19631,7 @@ function useVolrPaymentApi() {
|
|
|
19639
19631
|
setIsLoading(true);
|
|
19640
19632
|
try {
|
|
19641
19633
|
const response = await client.post("/payments", {
|
|
19634
|
+
tokenId: options.tokenId,
|
|
19642
19635
|
amount: options.amount,
|
|
19643
19636
|
item: options.item,
|
|
19644
19637
|
referenceId: options.referenceId,
|