coinley-pay 0.0.11 → 0.0.13

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.esm.js CHANGED
@@ -47301,6 +47301,7 @@ const RedesignedCoinleyPaymentInternal = ({
47301
47301
  const finalResult = await paymentFlow.api.processPayment(
47302
47302
  paymentData.id,
47303
47303
  result2.signature,
47304
+ selectedNetwork.shortName,
47304
47305
  solanaWallet.publicKey
47305
47306
  );
47306
47307
  if (finalResult.success) {
@@ -47331,20 +47332,18 @@ const RedesignedCoinleyPaymentInternal = ({
47331
47332
  }
47332
47333
  try {
47333
47334
  setCurrentStep(PAYMENT_STEPS.PROCESSING);
47334
- const result2 = await executePaymentTransaction();
47335
- if ((result2 == null ? void 0 : result2.success) && (result2 == null ? void 0 : result2.transactionHash)) {
47335
+ const txHash = await executePaymentTransaction();
47336
+ if (txHash) {
47336
47337
  setCurrentStep(PAYMENT_STEPS.SUCCESS);
47337
47338
  if (onSuccess) {
47338
47339
  onSuccess({
47339
47340
  paymentId: paymentData.id,
47340
- transactionHash: result2.transactionHash,
47341
+ transactionHash: txHash,
47341
47342
  senderAddress: address,
47342
47343
  network: selectedNetwork == null ? void 0 : selectedNetwork.shortName,
47343
47344
  currency: selectedToken == null ? void 0 : selectedToken.symbol
47344
47345
  });
47345
47346
  }
47346
- } else if (result2 == null ? void 0 : result2.error) {
47347
- throw new Error(result2.error);
47348
47347
  }
47349
47348
  } catch (err) {
47350
47349
  setError(err.message || "Transaction failed");
@@ -47576,37 +47575,40 @@ const RedesignedCoinleyPaymentInternal = ({
47576
47575
  selectedNetwork && availableTokens.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
47577
47576
  /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold mb-1", children: "Choose a token" }),
47578
47577
  /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-400 mb-4", children: "Select an option from these available tokens" }),
47579
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-3", children: availableTokens.map((token) => /* @__PURE__ */ jsxs(
47580
- "button",
47581
- {
47582
- onClick: () => handleTokenSelect(token),
47583
- className: `flex items-center gap-3 p-3 rounded-xl border-2 transition-all ${(selectedToken == null ? void 0 : selectedToken.id) === token.id ? "border-[#7042D2] bg-purple-50" : "border-gray-100 hover:border-[#7042D2] hover:bg-purple-50"}`,
47584
- children: [
47585
- /* @__PURE__ */ jsx(
47586
- "img",
47587
- {
47588
- src: getTokenLogoUrl(token.symbol),
47589
- alt: token.symbol,
47590
- className: "w-4 h-4 rounded-full",
47591
- onError: (e) => {
47592
- e.target.src = `https://ui-avatars.com/api/?name=${token.symbol}&background=7042D2&color=fff`;
47578
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-3", children: availableTokens.map((token) => {
47579
+ var _a2;
47580
+ return /* @__PURE__ */ jsxs(
47581
+ "button",
47582
+ {
47583
+ onClick: () => handleTokenSelect(token),
47584
+ className: `flex items-center gap-3 p-3 rounded-xl border-2 transition-all ${(selectedToken == null ? void 0 : selectedToken.id) === token.id ? "border-[#7042D2] bg-purple-50" : "border-gray-100 hover:border-[#7042D2] hover:bg-purple-50"}`,
47585
+ children: [
47586
+ /* @__PURE__ */ jsx(
47587
+ "img",
47588
+ {
47589
+ src: getTokenLogoUrl(token.symbol),
47590
+ alt: token.symbol,
47591
+ className: "w-4 h-4 rounded-full",
47592
+ onError: (e) => {
47593
+ e.target.src = `https://ui-avatars.com/api/?name=${token.symbol}&background=7042D2&color=fff`;
47594
+ }
47593
47595
  }
47594
- }
47595
- ),
47596
- /* @__PURE__ */ jsxs("div", { className: "text-left", children: [
47597
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
47598
- /* @__PURE__ */ jsx("p", { className: "font-medium text-xs text-gray-900", children: token.name || token.symbol }),
47599
- token.isStablecoin && /* @__PURE__ */ jsxs("span", { className: "text-xs text-green-600 flex items-center gap-1", children: [
47600
- /* @__PURE__ */ jsx("span", { className: "w-1.5 h-1.5 bg-green-500 rounded-full" }),
47601
- "Stablecoin"
47602
- ] })
47603
- ] }),
47604
- /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-400", children: truncateAddress(token.contractAddress || token.address) })
47605
- ] })
47606
- ]
47607
- },
47608
- token.id
47609
- )) })
47596
+ ),
47597
+ /* @__PURE__ */ jsxs("div", { className: "text-left", children: [
47598
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
47599
+ /* @__PURE__ */ jsx("p", { className: "font-medium text-xs text-gray-900", children: token.name || token.symbol }),
47600
+ token.isStablecoin && /* @__PURE__ */ jsxs("span", { className: "text-xs text-green-600 flex items-center gap-1", children: [
47601
+ /* @__PURE__ */ jsx("span", { className: "w-1.5 h-1.5 bg-green-500 rounded-full" }),
47602
+ "Stablecoin"
47603
+ ] })
47604
+ ] }),
47605
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-400", children: truncateAddress(((_a2 = config == null ? void 0 : config.merchantWalletAddresses) == null ? void 0 : _a2[selectedNetwork == null ? void 0 : selectedNetwork.shortName]) || "N/A") })
47606
+ ] })
47607
+ ]
47608
+ },
47609
+ token.id
47610
+ );
47611
+ }) })
47610
47612
  ] }),
47611
47613
  /* @__PURE__ */ jsxs("div", { className: "flex gap-3 mt-6", children: [
47612
47614
  /* @__PURE__ */ jsx(
@@ -47670,20 +47672,6 @@ const RedesignedCoinleyPaymentInternal = ({
47670
47672
  formatAmount((paymentData == null ? void 0 : paymentData.productAmount) || (config == null ? void 0 : config.amount) || 0)
47671
47673
  ] })
47672
47674
  ] }),
47673
- /* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
47674
- /* @__PURE__ */ jsx("span", { className: "text-gray-500", children: "Processing Fee" }),
47675
- /* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
47676
- "+$",
47677
- formatAmount((paymentData == null ? void 0 : paymentData.platformFee) || 0)
47678
- ] })
47679
- ] }),
47680
- /* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
47681
- /* @__PURE__ */ jsx("span", { className: "text-gray-500", children: "Network Fee" }),
47682
- /* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
47683
- "+$",
47684
- formatAmount((paymentData == null ? void 0 : paymentData.networkFee) || 0)
47685
- ] })
47686
- ] }),
47687
47675
  /* @__PURE__ */ jsxs("div", { className: "border-t border-gray-200 pt-3 flex justify-between", children: [
47688
47676
  /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Total" }),
47689
47677
  /* @__PURE__ */ jsxs("span", { className: "font-bold text-lg", children: [
@@ -47966,13 +47954,6 @@ const RedesignedCoinleyPaymentInternal = ({
47966
47954
  selectedToken == null ? void 0 : selectedToken.symbol
47967
47955
  ] }) })
47968
47956
  ] }),
47969
- /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
47970
- /* @__PURE__ */ jsx("h3", { className: "text-sm font-medium text-gray-700 mb-2", children: "Network Fee" }),
47971
- /* @__PURE__ */ jsx("div", { className: "p-4 bg-gray-50 rounded-xl border border-gray-200", children: /* @__PURE__ */ jsxs("span", { className: "text-lg font-semibold", children: [
47972
- "$",
47973
- formatAmount((paymentData == null ? void 0 : paymentData.networkFee) || 0.5)
47974
- ] }) })
47975
- ] }),
47976
47957
  /* @__PURE__ */ jsxs("div", { className: "bg-orange-50 border border-orange-200 rounded-xl p-4 flex items-start gap-3", children: [
47977
47958
  /* @__PURE__ */ jsx("svg", { className: "w-6 h-6 text-orange-500 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" }) }),
47978
47959
  /* @__PURE__ */ jsxs("div", { children: [