coinley-pay 0.31.0 → 0.32.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/dist/{CoinleyPayment-BvxUgI2r.js → CoinleyPayment-kY9bEp6d.js} +33 -13
- package/dist/{appKitEVM-DolBzIzZ.js → appKitEVM-B0kEAmQe.js} +2 -2
- package/dist/{appKitSolana-CHASGJ9W.js → appKitSolana-DJIYi1aC.js} +2 -2
- package/dist/coinley-vanilla.min.js +576 -576
- package/dist/{index-H-42A54A.js → index-CC_wEc1a.js} +3 -3
- package/dist/{index-DLEW836a.js → index-DfHDQFzN.js} +3 -3
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
|
5
5
|
import { useState, useRef, useEffect, useCallback, useMemo } from "react";
|
|
6
6
|
import { useConnect, useAccount, useSwitchChain, useSendTransaction, useWaitForTransactionReceipt, WagmiProvider, useDisconnect } from "wagmi";
|
|
7
7
|
import { QueryClientProvider, QueryClient } from "@tanstack/react-query";
|
|
8
|
-
import { s as sdkAnalytics, c as clarityAnalytics, d as dist, a as Buffer2, B as Buffer$1, g as getCurrencyInfo, p as prefetchRates, i as isSupportedCurrency, b as convertToUSD, f as formatCurrency } from "./index-
|
|
8
|
+
import { s as sdkAnalytics, c as clarityAnalytics, d as dist, a as Buffer2, B as Buffer$1, g as getCurrencyInfo, p as prefetchRates, i as isSupportedCurrency, b as convertToUSD, f as formatCurrency } from "./index-DfHDQFzN.js";
|
|
9
9
|
import { createConfig, fallback, http, getAccount as getAccount$1, getWalletClient, simulateContract, writeContract, readContract, waitForTransactionReceipt, estimateFeesPerGas as estimateFeesPerGas$1 } from "@wagmi/core";
|
|
10
10
|
import { injected, metaMask, coinbaseWallet, walletConnect } from "@wagmi/connectors";
|
|
11
11
|
import { defineChain as defineChain$1, erc20Abi, http as http$1, createPublicClient, fallback as fallback$1 } from "viem";
|
|
@@ -21133,7 +21133,7 @@ const WalletSelector = ({
|
|
|
21133
21133
|
try {
|
|
21134
21134
|
setAppKitError(null);
|
|
21135
21135
|
setWalletConnectAddress(solanaAccountState.address);
|
|
21136
|
-
const { createWalletConnectAdapter } = await import("./appKitSolana-
|
|
21136
|
+
const { createWalletConnectAdapter } = await import("./appKitSolana-DJIYi1aC.js");
|
|
21137
21137
|
const adapter = createWalletConnectAdapter(solanaAccountState.address);
|
|
21138
21138
|
await solanaWallet.connectWalletConnect(adapter, solanaAccountState.address);
|
|
21139
21139
|
console.log("✅ WalletConnect synced with SDK");
|
|
@@ -21238,7 +21238,7 @@ const WalletSelector = ({
|
|
|
21238
21238
|
setAppKitLoading(true);
|
|
21239
21239
|
setAppKitError(null);
|
|
21240
21240
|
try {
|
|
21241
|
-
const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-
|
|
21241
|
+
const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-B0kEAmQe.js");
|
|
21242
21242
|
await initializeAppKitEVM(wagmiConfig);
|
|
21243
21243
|
await openAppKitModal();
|
|
21244
21244
|
} catch (error) {
|
|
@@ -21258,7 +21258,7 @@ const WalletSelector = ({
|
|
|
21258
21258
|
setAppKitError(null);
|
|
21259
21259
|
try {
|
|
21260
21260
|
console.log("📦 Loading AppKit Solana module...");
|
|
21261
|
-
const { initializeAppKitSolana } = await import("./appKitSolana-
|
|
21261
|
+
const { initializeAppKitSolana } = await import("./appKitSolana-DJIYi1aC.js");
|
|
21262
21262
|
console.log("✅ Module loaded, initializing...");
|
|
21263
21263
|
const modal = await initializeAppKitSolana(solanaWallet);
|
|
21264
21264
|
console.log("✅ AppKit Solana initialized successfully");
|
|
@@ -23443,6 +23443,20 @@ const CoinleyPaymentInternal = ({
|
|
|
23443
23443
|
const hasCommittedTransaction = Boolean(
|
|
23444
23444
|
currentTransactionHash || (solanaTransaction == null ? void 0 : solanaTransaction.txSignature) || (paymentData == null ? void 0 : paymentData.transactionHash)
|
|
23445
23445
|
);
|
|
23446
|
+
const resolvePaymentTransactionHash = useCallback((payment) => {
|
|
23447
|
+
return (payment == null ? void 0 : payment.depositTxHash) || (payment == null ? void 0 : payment.sweepTxHash) || (payment == null ? void 0 : payment.transactionHash) || null;
|
|
23448
|
+
}, []);
|
|
23449
|
+
const persistSuccessfulPaymentHash = useCallback((payment, txHash) => {
|
|
23450
|
+
const resolvedTxHash = txHash || resolvePaymentTransactionHash(payment);
|
|
23451
|
+
if (!resolvedTxHash) return;
|
|
23452
|
+
setPaymentData((prev) => ({
|
|
23453
|
+
...prev || {},
|
|
23454
|
+
...payment || {},
|
|
23455
|
+
transactionHash: resolvedTxHash,
|
|
23456
|
+
depositTxHash: (payment == null ? void 0 : payment.depositTxHash) ?? (prev == null ? void 0 : prev.depositTxHash),
|
|
23457
|
+
sweepTxHash: (payment == null ? void 0 : payment.sweepTxHash) ?? (prev == null ? void 0 : prev.sweepTxHash)
|
|
23458
|
+
}));
|
|
23459
|
+
}, [resolvePaymentTransactionHash, setPaymentData]);
|
|
23446
23460
|
const getUnderpaymentRecoveryStorageKey = useCallback((paymentId = paymentData == null ? void 0 : paymentData.id) => {
|
|
23447
23461
|
return paymentId ? `${UNDERPAYMENT_RECOVERY_STORAGE_PREFIX}${paymentId}` : null;
|
|
23448
23462
|
}, [paymentData == null ? void 0 : paymentData.id]);
|
|
@@ -24022,11 +24036,12 @@ const CoinleyPaymentInternal = ({
|
|
|
24022
24036
|
const statusResult = await paymentFlow.api.getDepositStatus(paymentData.id);
|
|
24023
24037
|
if (statusResult.success && statusResult.payment) {
|
|
24024
24038
|
const status = statusResult.payment.status;
|
|
24025
|
-
const txHash = statusResult.payment
|
|
24039
|
+
const txHash = resolvePaymentTransactionHash(statusResult.payment);
|
|
24026
24040
|
if ((status === "completed" || status === "swept") && txHash) {
|
|
24027
24041
|
clearInterval(pollInterval);
|
|
24028
24042
|
clearUnderpaymentRecovery(paymentData.id);
|
|
24029
24043
|
setProcessingStatusMessage("");
|
|
24044
|
+
persistSuccessfulPaymentHash(statusResult.payment, txHash);
|
|
24030
24045
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
24031
24046
|
sdkAnalytics.trackPaymentSuccess(
|
|
24032
24047
|
paymentData.id,
|
|
@@ -24085,7 +24100,7 @@ const CoinleyPaymentInternal = ({
|
|
|
24085
24100
|
}
|
|
24086
24101
|
}, 5e3);
|
|
24087
24102
|
return () => clearInterval(pollInterval);
|
|
24088
|
-
}, [currentStep, paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.depositAddress, selectedNetwork, selectedToken, onSuccess, activateUnderpaymentFlow, clearUnderpaymentRecovery]);
|
|
24103
|
+
}, [currentStep, paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.depositAddress, selectedNetwork, selectedToken, onSuccess, activateUnderpaymentFlow, clearUnderpaymentRecovery, resolvePaymentTransactionHash, persistSuccessfulPaymentHash]);
|
|
24089
24104
|
useEffect(() => {
|
|
24090
24105
|
const shouldPoll = (paymentData == null ? void 0 : paymentData.id) && (activeTab === PAYMENT_TABS.QR || activeTab === PAYMENT_TABS.TRANSFER) && currentStep === PAYMENT_STEPS.CONFIRM && !verifyingPayment && paymentType !== PAYMENT_TYPES.DEPOSIT && !(paymentData == null ? void 0 : paymentData.isDepositPayment) && !(paymentData == null ? void 0 : paymentData.depositAddress);
|
|
24091
24106
|
if (!shouldPoll) {
|
|
@@ -24101,6 +24116,7 @@ const CoinleyPaymentInternal = ({
|
|
|
24101
24116
|
if (status === "completed" || status === "success") {
|
|
24102
24117
|
console.log("✅ Auto-detected: Payment already completed");
|
|
24103
24118
|
clearInterval(pollInterval);
|
|
24119
|
+
persistSuccessfulPaymentHash(statusResult.payment, statusResult.payment.transactionHash);
|
|
24104
24120
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
24105
24121
|
sdkAnalytics.trackPaymentSuccess(
|
|
24106
24122
|
paymentData.id,
|
|
@@ -24133,8 +24149,9 @@ const CoinleyPaymentInternal = ({
|
|
|
24133
24149
|
if (verificationResult.success && verificationResult.verified) {
|
|
24134
24150
|
console.log("✅ Auto-detected: Payment verified on blockchain!");
|
|
24135
24151
|
clearInterval(pollInterval);
|
|
24136
|
-
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
24137
24152
|
const txHash = ((_a2 = verificationResult.payment) == null ? void 0 : _a2.transactionHash) || ((_b = verificationResult.onChainData) == null ? void 0 : _b.transactionHash);
|
|
24153
|
+
persistSuccessfulPaymentHash(verificationResult.payment, txHash);
|
|
24154
|
+
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
24138
24155
|
sdkAnalytics.trackPaymentSuccess(
|
|
24139
24156
|
paymentData.id,
|
|
24140
24157
|
config == null ? void 0 : config.amount,
|
|
@@ -24167,7 +24184,7 @@ const CoinleyPaymentInternal = ({
|
|
|
24167
24184
|
console.log("🛑 Stopping auto-detection polling");
|
|
24168
24185
|
clearInterval(pollInterval);
|
|
24169
24186
|
};
|
|
24170
|
-
}, [paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.isDepositPayment, paymentData == null ? void 0 : paymentData.depositAddress, activeTab, currentStep, verifyingPayment, paymentType, selectedNetwork, selectedToken, onSuccess, paymentFlow.api]);
|
|
24187
|
+
}, [paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.isDepositPayment, paymentData == null ? void 0 : paymentData.depositAddress, activeTab, currentStep, verifyingPayment, paymentType, selectedNetwork, selectedToken, onSuccess, paymentFlow.api, persistSuccessfulPaymentHash]);
|
|
24171
24188
|
const resetAllTransactionState = async () => {
|
|
24172
24189
|
var _a2;
|
|
24173
24190
|
invalidateCurrentAttempt("reset-all-transaction-state");
|
|
@@ -25544,6 +25561,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25544
25561
|
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
|
25545
25562
|
const result = await checkPayment();
|
|
25546
25563
|
if (result.success) {
|
|
25564
|
+
persistSuccessfulPaymentHash(result.payment, result.txHash);
|
|
25547
25565
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
25548
25566
|
if (onSuccess) {
|
|
25549
25567
|
onSuccess({
|
|
@@ -25614,11 +25632,12 @@ const CoinleyPaymentInternal = ({
|
|
|
25614
25632
|
const statusResult = await paymentFlow.api.getDepositStatus(paymentData.id);
|
|
25615
25633
|
if (statusResult.success && statusResult.payment) {
|
|
25616
25634
|
const status = statusResult.payment.status;
|
|
25617
|
-
const txHash = statusResult.payment
|
|
25635
|
+
const txHash = resolvePaymentTransactionHash(statusResult.payment);
|
|
25618
25636
|
if ((status === "completed" || status === "swept") && txHash) {
|
|
25619
25637
|
console.log("✅ Auto-detected: Deposit payment completed!");
|
|
25620
25638
|
clearInterval(pollInterval);
|
|
25621
25639
|
clearUnderpaymentRecovery(paymentData.id);
|
|
25640
|
+
persistSuccessfulPaymentHash(statusResult.payment, txHash);
|
|
25622
25641
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
25623
25642
|
sdkAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
|
|
25624
25643
|
clarityAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
|
|
@@ -25656,7 +25675,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25656
25675
|
console.log("🛑 Stopping deposit auto-detection polling");
|
|
25657
25676
|
clearInterval(pollInterval);
|
|
25658
25677
|
};
|
|
25659
|
-
}, [paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.depositAddress, paymentType, currentStep, verifyingPayment, expirationTime == null ? void 0 : expirationTime.expired, selectedNetwork, selectedToken, onSuccess, paymentFlow.api, activateUnderpaymentFlow, clearUnderpaymentRecovery]);
|
|
25678
|
+
}, [paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.depositAddress, paymentType, currentStep, verifyingPayment, expirationTime == null ? void 0 : expirationTime.expired, selectedNetwork, selectedToken, onSuccess, paymentFlow.api, activateUnderpaymentFlow, clearUnderpaymentRecovery, resolvePaymentTransactionHash, persistSuccessfulPaymentHash]);
|
|
25660
25679
|
useEffect(() => {
|
|
25661
25680
|
return () => {
|
|
25662
25681
|
if (manualCheckTimeout.current) {
|
|
@@ -25743,10 +25762,11 @@ const CoinleyPaymentInternal = ({
|
|
|
25743
25762
|
const statusResult = await paymentFlow.api.getDepositStatus(paymentData.id);
|
|
25744
25763
|
if (statusResult.success && statusResult.payment) {
|
|
25745
25764
|
const status = statusResult.payment.status;
|
|
25746
|
-
const txHash = statusResult.payment
|
|
25765
|
+
const txHash = resolvePaymentTransactionHash(statusResult.payment);
|
|
25747
25766
|
if ((status === "completed" || status === "swept") && txHash) {
|
|
25748
25767
|
setManualCheckStatus(null);
|
|
25749
25768
|
clearUnderpaymentRecovery(paymentData.id);
|
|
25769
|
+
persistSuccessfulPaymentHash(statusResult.payment, txHash);
|
|
25750
25770
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
25751
25771
|
sdkAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
|
|
25752
25772
|
clarityAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
|
|
@@ -25789,7 +25809,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25789
25809
|
setManualCheckStatus(null);
|
|
25790
25810
|
}, 1e4);
|
|
25791
25811
|
}
|
|
25792
|
-
}, [manualCheckStatus, paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.depositAddress, paymentFlow.api, config == null ? void 0 : config.amount, selectedNetwork, selectedToken, onSuccess, activateUnderpaymentFlow, activateUnderpaymentFromDepositBalance, clearUnderpaymentRecovery]);
|
|
25812
|
+
}, [manualCheckStatus, paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.depositAddress, paymentFlow.api, config == null ? void 0 : config.amount, selectedNetwork, selectedToken, onSuccess, activateUnderpaymentFlow, activateUnderpaymentFromDepositBalance, clearUnderpaymentRecovery, resolvePaymentTransactionHash, persistSuccessfulPaymentHash]);
|
|
25793
25813
|
if (!isOpen) return null;
|
|
25794
25814
|
if (currentStep === PAYMENT_STEPS.PROCESSING) {
|
|
25795
25815
|
return /* @__PURE__ */ jsxs("div", { id: SDK_ROOT_ID, className: `${SDK_ROOT_CLASS} fixed inset-0 z-50`, style: { fontFamily: FONT_FAMILY }, children: [
|
|
@@ -27162,4 +27182,4 @@ export {
|
|
|
27162
27182
|
isFeatureEnabled as i,
|
|
27163
27183
|
logo as l
|
|
27164
27184
|
};
|
|
27165
|
-
//# sourceMappingURL=CoinleyPayment-
|
|
27185
|
+
//# sourceMappingURL=CoinleyPayment-kY9bEp6d.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID, l as logo } from "./CoinleyPayment-
|
|
1
|
+
import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID, l as logo } from "./CoinleyPayment-kY9bEp6d.js";
|
|
2
2
|
let appKitInstance = null;
|
|
3
3
|
let isInitializing = false;
|
|
4
4
|
let initializationPromise = null;
|
|
@@ -112,4 +112,4 @@ export {
|
|
|
112
112
|
initializeAppKitEVM,
|
|
113
113
|
openAppKitModal
|
|
114
114
|
};
|
|
115
|
-
//# sourceMappingURL=appKitEVM-
|
|
115
|
+
//# sourceMappingURL=appKitEVM-B0kEAmQe.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FEATURES, l as logo, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-
|
|
1
|
+
import { F as FEATURES, l as logo, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-kY9bEp6d.js";
|
|
2
2
|
let appKitInstance = null;
|
|
3
3
|
let isInitializing = false;
|
|
4
4
|
let initializationPromise = null;
|
|
@@ -242,4 +242,4 @@ export {
|
|
|
242
242
|
disconnectWalletConnect,
|
|
243
243
|
initializeAppKitSolana
|
|
244
244
|
};
|
|
245
|
-
//# sourceMappingURL=appKitSolana-
|
|
245
|
+
//# sourceMappingURL=appKitSolana-DJIYi1aC.js.map
|