@cookill/wallet-adapter 2.4.2 → 2.5.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/dist/react.js CHANGED
@@ -1,7 +1,12 @@
1
- import React2, { createContext, Component, useState, useMemo, useEffect, useCallback, useContext } from 'react';
2
- import { jsxs, jsx } from 'react/jsx-runtime';
3
-
4
1
  // src/react.tsx
2
+ import React2, {
3
+ createContext,
4
+ useContext,
5
+ useState,
6
+ useEffect,
7
+ useCallback,
8
+ useMemo
9
+ } from "react";
5
10
 
6
11
  // src/index.ts
7
12
  var NETWORKS = {
@@ -97,6 +102,10 @@ function isValidAddress(address) {
97
102
  if (address.length < 32 || address.length > 50) return false;
98
103
  return /^[1-9A-HJ-NP-Za-km-z]+$/.test(address);
99
104
  }
105
+
106
+ // src/ErrorBoundary.tsx
107
+ import { Component } from "react";
108
+ import { jsx, jsxs } from "react/jsx-runtime";
100
109
  var WalletErrorBoundary = class extends Component {
101
110
  constructor() {
102
111
  super(...arguments);
@@ -190,6 +199,9 @@ var WalletErrorBoundary = class extends Component {
190
199
  return this.props.children;
191
200
  }
192
201
  };
202
+
203
+ // src/LoadingStates.tsx
204
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
193
205
  function LoadingSpinner({ size = "md", color = "#6EB9A8", className = "" }) {
194
206
  const sizes = {
195
207
  sm: { container: 20, stroke: 2 },
@@ -199,7 +211,7 @@ function LoadingSpinner({ size = "md", color = "#6EB9A8", className = "" }) {
199
211
  const { container, stroke } = sizes[size];
200
212
  const radius = (container - stroke) / 2;
201
213
  const circumference = radius * 2 * Math.PI;
202
- return /* @__PURE__ */ jsxs(
214
+ return /* @__PURE__ */ jsxs2(
203
215
  "svg",
204
216
  {
205
217
  width: container,
@@ -208,13 +220,13 @@ function LoadingSpinner({ size = "md", color = "#6EB9A8", className = "" }) {
208
220
  className,
209
221
  style: { animation: "wallet-spin 1s linear infinite" },
210
222
  children: [
211
- /* @__PURE__ */ jsx("style", { children: `
223
+ /* @__PURE__ */ jsx2("style", { children: `
212
224
  @keyframes wallet-spin {
213
225
  from { transform: rotate(0deg); }
214
226
  to { transform: rotate(360deg); }
215
227
  }
216
228
  ` }),
217
- /* @__PURE__ */ jsx(
229
+ /* @__PURE__ */ jsx2(
218
230
  "circle",
219
231
  {
220
232
  cx: container / 2,
@@ -226,7 +238,7 @@ function LoadingSpinner({ size = "md", color = "#6EB9A8", className = "" }) {
226
238
  strokeOpacity: 0.2
227
239
  }
228
240
  ),
229
- /* @__PURE__ */ jsx(
241
+ /* @__PURE__ */ jsx2(
230
242
  "circle",
231
243
  {
232
244
  cx: container / 2,
@@ -250,7 +262,7 @@ function ApprovalPending({
250
262
  walletName = "Sheep Wallet",
251
263
  onCancel
252
264
  }) {
253
- return /* @__PURE__ */ jsxs(
265
+ return /* @__PURE__ */ jsxs2(
254
266
  "div",
255
267
  {
256
268
  style: {
@@ -261,7 +273,7 @@ function ApprovalPending({
261
273
  border: "1px solid #e2e8f0"
262
274
  },
263
275
  children: [
264
- /* @__PURE__ */ jsxs(
276
+ /* @__PURE__ */ jsxs2(
265
277
  "div",
266
278
  {
267
279
  style: {
@@ -276,8 +288,8 @@ function ApprovalPending({
276
288
  position: "relative"
277
289
  },
278
290
  children: [
279
- /* @__PURE__ */ jsx(LoadingSpinner, { size: "lg" }),
280
- /* @__PURE__ */ jsx(
291
+ /* @__PURE__ */ jsx2(LoadingSpinner, { size: "lg" }),
292
+ /* @__PURE__ */ jsx2(
281
293
  "div",
282
294
  {
283
295
  style: {
@@ -293,7 +305,7 @@ function ApprovalPending({
293
305
  ]
294
306
  }
295
307
  ),
296
- /* @__PURE__ */ jsx(
308
+ /* @__PURE__ */ jsx2(
297
309
  "h3",
298
310
  {
299
311
  style: {
@@ -305,7 +317,7 @@ function ApprovalPending({
305
317
  children: title
306
318
  }
307
319
  ),
308
- /* @__PURE__ */ jsx(
320
+ /* @__PURE__ */ jsx2(
309
321
  "p",
310
322
  {
311
323
  style: {
@@ -316,7 +328,7 @@ function ApprovalPending({
316
328
  children: message
317
329
  }
318
330
  ),
319
- /* @__PURE__ */ jsxs(
331
+ /* @__PURE__ */ jsxs2(
320
332
  "p",
321
333
  {
322
334
  style: {
@@ -331,7 +343,7 @@ function ApprovalPending({
331
343
  ]
332
344
  }
333
345
  ),
334
- onCancel && /* @__PURE__ */ jsx(
346
+ onCancel && /* @__PURE__ */ jsx2(
335
347
  "button",
336
348
  {
337
349
  onClick: onCancel,
@@ -390,7 +402,7 @@ function ConnectionStatus({ status, message, onRetry }) {
390
402
  }
391
403
  };
392
404
  const config = statusConfig[status];
393
- return /* @__PURE__ */ jsxs(
405
+ return /* @__PURE__ */ jsxs2(
394
406
  "div",
395
407
  {
396
408
  style: {
@@ -401,7 +413,7 @@ function ConnectionStatus({ status, message, onRetry }) {
401
413
  textAlign: "center"
402
414
  },
403
415
  children: [
404
- /* @__PURE__ */ jsx(
416
+ /* @__PURE__ */ jsx2(
405
417
  "div",
406
418
  {
407
419
  style: {
@@ -414,15 +426,15 @@ function ConnectionStatus({ status, message, onRetry }) {
414
426
  alignItems: "center",
415
427
  justifyContent: "center"
416
428
  },
417
- children: status === "success" ? /* @__PURE__ */ jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: config.color, strokeWidth: "2", children: /* @__PURE__ */ jsx("polyline", { points: "20,6 9,17 4,12" }) }) : status === "error" ? /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: config.color, strokeWidth: "2", children: [
418
- /* @__PURE__ */ jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
419
- /* @__PURE__ */ jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
420
- ] }) : /* @__PURE__ */ jsx(LoadingSpinner, { size: "sm", color: config.color })
429
+ children: status === "success" ? /* @__PURE__ */ jsx2("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: config.color, strokeWidth: "2", children: /* @__PURE__ */ jsx2("polyline", { points: "20,6 9,17 4,12" }) }) : status === "error" ? /* @__PURE__ */ jsxs2("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: config.color, strokeWidth: "2", children: [
430
+ /* @__PURE__ */ jsx2("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
431
+ /* @__PURE__ */ jsx2("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
432
+ ] }) : /* @__PURE__ */ jsx2(LoadingSpinner, { size: "sm", color: config.color })
421
433
  }
422
434
  ),
423
- /* @__PURE__ */ jsx("h4", { style: { margin: "0 0 4px", fontSize: "14px", fontWeight: 600, color: config.color }, children: config.title }),
424
- /* @__PURE__ */ jsx("p", { style: { margin: 0, fontSize: "12px", color: "#64748b" }, children: message || config.defaultMessage }),
425
- status === "error" && onRetry && /* @__PURE__ */ jsx(
435
+ /* @__PURE__ */ jsx2("h4", { style: { margin: "0 0 4px", fontSize: "14px", fontWeight: 600, color: config.color }, children: config.title }),
436
+ /* @__PURE__ */ jsx2("p", { style: { margin: 0, fontSize: "12px", color: "#64748b" }, children: message || config.defaultMessage }),
437
+ status === "error" && onRetry && /* @__PURE__ */ jsx2(
426
438
  "button",
427
439
  {
428
440
  onClick: onRetry,
@@ -444,6 +456,9 @@ function ConnectionStatus({ status, message, onRetry }) {
444
456
  }
445
457
  );
446
458
  }
459
+
460
+ // src/react.tsx
461
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
447
462
  var SHEEP_WALLET_ICON = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHJ4PSI4IiBmaWxsPSIjMUExQTFBIi8+PGNpcmNsZSBjeD0iMTYiIGN5PSIxNCIgcj0iOCIgZmlsbD0iI0ZGRjhGMCIvPjxjaXJjbGUgY3g9IjEyIiBjeT0iMTAiIHI9IjQiIGZpbGw9IiNGRkY4RjAiLz48Y2lyY2xlIGN4PSIyMCIgY3k9IjEwIiByPSI0IiBmaWxsPSIjRkZGOEYwIi8+PGNpcmNsZSBjeD0iMTMiIGN5PSIxMyIgcj0iMS41IiBmaWxsPSIjMzMzIi8+PGNpcmNsZSBjeD0iMTkiIGN5PSIxMyIgcj0iMS41IiBmaWxsPSIjMzMzIi8+PGVsbGlwc2UgY3g9IjE2IiBjeT0iMTciIHJ4PSIyIiByeT0iMS41IiBmaWxsPSIjRkZDMENCIi8+PHBhdGggZD0iTTE0IDI0QzE0IDIyLjkgMTQuOSAyMiAxNiAyMkMxNy4xIDIyIDE4IDIyLjkgMTggMjRWMjZIMTRWMjRaIiBmaWxsPSIjNkVCOUE4Ii8+PC9zdmc+";
448
463
  var DEFAULT_WALLETS = [
449
464
  {
@@ -692,9 +707,9 @@ function WalletProvider({
692
707
  openModal,
693
708
  closeModal
694
709
  };
695
- return /* @__PURE__ */ jsxs(WalletContext.Provider, { value, children: [
710
+ return /* @__PURE__ */ jsxs3(WalletContext.Provider, { value, children: [
696
711
  children,
697
- /* @__PURE__ */ jsx(WalletModal, {})
712
+ /* @__PURE__ */ jsx3(WalletModal, {})
698
713
  ] });
699
714
  }
700
715
  function useWallet() {
@@ -870,7 +885,7 @@ function ConnectButton({
870
885
  ...style
871
886
  };
872
887
  if (connecting) {
873
- return /* @__PURE__ */ jsx(
888
+ return /* @__PURE__ */ jsx3(
874
889
  "button",
875
890
  {
876
891
  disabled: true,
@@ -881,7 +896,7 @@ function ConnectButton({
881
896
  );
882
897
  }
883
898
  if (connected && activeAccount) {
884
- return /* @__PURE__ */ jsxs(
899
+ return /* @__PURE__ */ jsxs3(
885
900
  "button",
886
901
  {
887
902
  onClick: () => disconnect(),
@@ -892,7 +907,7 @@ function ConnectButton({
892
907
  color: "white"
893
908
  },
894
909
  children: [
895
- showBalance && balance && /* @__PURE__ */ jsxs("span", { style: { marginRight: 8 }, children: [
910
+ showBalance && balance && /* @__PURE__ */ jsxs3("span", { style: { marginRight: 8 }, children: [
896
911
  formatBalance(balance),
897
912
  " RLO"
898
913
  ] }),
@@ -901,7 +916,7 @@ function ConnectButton({
901
916
  }
902
917
  );
903
918
  }
904
- return /* @__PURE__ */ jsx(
919
+ return /* @__PURE__ */ jsx3(
905
920
  "button",
906
921
  {
907
922
  onClick: openModal,
@@ -935,7 +950,7 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
935
950
  if (!isOwner) return null;
936
951
  const { isModalOpen, closeModal, wallets, selectWallet, connecting } = useWallet();
937
952
  if (!isModalOpen) return null;
938
- return /* @__PURE__ */ jsx(
953
+ return /* @__PURE__ */ jsx3(
939
954
  "div",
940
955
  {
941
956
  className,
@@ -949,7 +964,7 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
949
964
  backgroundColor: "rgba(0, 0, 0, 0.5)"
950
965
  },
951
966
  onClick: closeModal,
952
- children: /* @__PURE__ */ jsxs(
967
+ children: /* @__PURE__ */ jsxs3(
953
968
  "div",
954
969
  {
955
970
  style: {
@@ -963,9 +978,9 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
963
978
  },
964
979
  onClick: (e) => e.stopPropagation(),
965
980
  children: [
966
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "20px" }, children: [
967
- /* @__PURE__ */ jsx("h2", { style: { margin: 0, fontSize: "18px", fontWeight: 600 }, children: title }),
968
- /* @__PURE__ */ jsx(
981
+ /* @__PURE__ */ jsxs3("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "20px" }, children: [
982
+ /* @__PURE__ */ jsx3("h2", { style: { margin: 0, fontSize: "18px", fontWeight: 600 }, children: title }),
983
+ /* @__PURE__ */ jsx3(
969
984
  "button",
970
985
  {
971
986
  onClick: closeModal,
@@ -974,7 +989,7 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
974
989
  }
975
990
  )
976
991
  ] }),
977
- /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: wallets.map((wallet) => /* @__PURE__ */ jsxs(
992
+ /* @__PURE__ */ jsx3("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: wallets.map((wallet) => /* @__PURE__ */ jsxs3(
978
993
  "button",
979
994
  {
980
995
  onClick: () => selectWallet(wallet.id),
@@ -992,17 +1007,17 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
992
1007
  transition: "all 0.2s ease"
993
1008
  },
994
1009
  children: [
995
- /* @__PURE__ */ jsx("img", { src: wallet.icon, alt: wallet.name, style: { width: 40, height: 40, borderRadius: 8 } }),
996
- /* @__PURE__ */ jsxs("div", { style: { textAlign: "left", flex: 1 }, children: [
997
- /* @__PURE__ */ jsx("div", { style: { fontWeight: 500 }, children: wallet.name }),
998
- /* @__PURE__ */ jsx("div", { style: { fontSize: "12px", color: "#666" }, children: wallet.installed ? "Detected" : "Not installed" })
1010
+ /* @__PURE__ */ jsx3("img", { src: wallet.icon, alt: wallet.name, style: { width: 40, height: 40, borderRadius: 8 } }),
1011
+ /* @__PURE__ */ jsxs3("div", { style: { textAlign: "left", flex: 1 }, children: [
1012
+ /* @__PURE__ */ jsx3("div", { style: { fontWeight: 500 }, children: wallet.name }),
1013
+ /* @__PURE__ */ jsx3("div", { style: { fontSize: "12px", color: "#666" }, children: wallet.installed ? "Detected" : "Not installed" })
999
1014
  ] }),
1000
- !wallet.installed && /* @__PURE__ */ jsx("span", { style: { fontSize: "12px", color: "#6EB9A8" }, children: "Install \u2192" })
1015
+ !wallet.installed && /* @__PURE__ */ jsx3("span", { style: { fontSize: "12px", color: "#6EB9A8" }, children: "Install \u2192" })
1001
1016
  ]
1002
1017
  },
1003
1018
  wallet.id
1004
1019
  )) }),
1005
- /* @__PURE__ */ jsx("div", { style: { marginTop: "20px", textAlign: "center", fontSize: "12px", color: "#999" }, children: "Powered by CookilLabs" })
1020
+ /* @__PURE__ */ jsx3("div", { style: { marginTop: "20px", textAlign: "center", fontSize: "12px", color: "#999" }, children: "Powered by CookilLabs" })
1006
1021
  ]
1007
1022
  }
1008
1023
  )
@@ -1011,14 +1026,41 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
1011
1026
  }
1012
1027
  function withWalletErrorBoundary(WrappedComponent, fallback) {
1013
1028
  return function WithErrorBoundary(props) {
1014
- return /* @__PURE__ */ jsx(WalletErrorBoundary, { fallback, children: /* @__PURE__ */ jsx(WrappedComponent, { ...props }) });
1029
+ return /* @__PURE__ */ jsx3(WalletErrorBoundary, { fallback, children: /* @__PURE__ */ jsx3(WrappedComponent, { ...props }) });
1015
1030
  };
1016
1031
  }
1017
1032
  function SafeWalletProvider(props) {
1018
1033
  const { errorFallback, ...providerProps } = props;
1019
- return /* @__PURE__ */ jsx(WalletErrorBoundary, { fallback: errorFallback, children: /* @__PURE__ */ jsx(WalletProvider, { ...providerProps }) });
1034
+ return /* @__PURE__ */ jsx3(WalletErrorBoundary, { fallback: errorFallback, children: /* @__PURE__ */ jsx3(WalletProvider, { ...providerProps }) });
1020
1035
  }
1021
-
1022
- export { ApprovalPending, ConnectButton, ConnectionStatus, LoadingSpinner, NETWORKS, SafeWalletProvider, WalletErrorBoundary, WalletModal, WalletProvider, formatAddress, formatBalance, getRialoProvider, isRialoInstalled, isValidAddress, useAccounts, useActiveAccount, useBalance, useChainId, useConnectWallet, useDisconnectWallet, useIsConnected, useNetwork, useSendTransaction, useSignMessage, useSignTransaction, useSwitchNetwork, useWallet, withWalletErrorBoundary };
1023
- //# sourceMappingURL=react.js.map
1036
+ export {
1037
+ ApprovalPending,
1038
+ ConnectButton,
1039
+ ConnectionStatus,
1040
+ LoadingSpinner,
1041
+ NETWORKS,
1042
+ SafeWalletProvider,
1043
+ WalletErrorBoundary,
1044
+ WalletModal,
1045
+ WalletProvider,
1046
+ formatAddress,
1047
+ formatBalance,
1048
+ getRialoProvider,
1049
+ isRialoInstalled,
1050
+ isValidAddress,
1051
+ useAccounts,
1052
+ useActiveAccount,
1053
+ useBalance,
1054
+ useChainId,
1055
+ useConnectWallet,
1056
+ useDisconnectWallet,
1057
+ useIsConnected,
1058
+ useNetwork,
1059
+ useSendTransaction,
1060
+ useSignMessage,
1061
+ useSignTransaction,
1062
+ useSwitchNetwork,
1063
+ useWallet,
1064
+ withWalletErrorBoundary
1065
+ };
1024
1066
  //# sourceMappingURL=react.js.map