@swapkit/wallets 4.3.11 → 4.6.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.
Files changed (121) hide show
  1. package/dist/LICENSE +246 -0
  2. package/dist/chunk-1m30h0t9.js +4 -0
  3. package/dist/{chunk-vb4wtm2w.js.map → chunk-1m30h0t9.js.map} +1 -1
  4. package/dist/chunk-5jj4jvy9.js +5 -0
  5. package/dist/{chunk-78m70510.js.map → chunk-5jj4jvy9.js.map} +1 -1
  6. package/dist/chunk-ae6bkfs5.js +3 -0
  7. package/dist/chunk-ae6bkfs5.js.map +9 -0
  8. package/dist/chunk-dx5r3mz1.js +5 -0
  9. package/dist/chunk-dx5r3mz1.js.map +10 -0
  10. package/dist/chunk-ewwx4745.js +4 -0
  11. package/dist/chunk-ewwx4745.js.map +9 -0
  12. package/dist/chunk-qv7snmdv.js +5 -0
  13. package/dist/chunk-qv7snmdv.js.map +10 -0
  14. package/dist/chunk-ttryb513.js +4 -0
  15. package/dist/chunk-ttryb513.js.map +10 -0
  16. package/dist/chunk-zrqsb6ng.js +4 -0
  17. package/dist/chunk-zrqsb6ng.js.map +10 -0
  18. package/dist/src/coinbase/index.cjs +2 -2
  19. package/dist/src/coinbase/index.cjs.map +4 -4
  20. package/dist/src/coinbase/index.js +2 -2
  21. package/dist/src/coinbase/index.js.map +4 -4
  22. package/dist/src/index.cjs +2 -2
  23. package/dist/src/index.cjs.map +4 -5
  24. package/dist/src/index.js +2 -2
  25. package/dist/src/index.js.map +4 -5
  26. package/dist/src/keystore.cjs +2 -2
  27. package/dist/src/keystore.cjs.map +5 -4
  28. package/dist/src/keystore.js +2 -2
  29. package/dist/src/keystore.js.map +5 -4
  30. package/dist/src/near-wallet-selector/index.cjs +2 -2
  31. package/dist/src/near-wallet-selector/index.cjs.map +3 -3
  32. package/dist/src/near-wallet-selector/index.js +2 -2
  33. package/dist/src/near-wallet-selector/index.js.map +3 -3
  34. package/dist/src/passkeys/index.cjs +2 -2
  35. package/dist/src/passkeys/index.cjs.map +3 -3
  36. package/dist/src/passkeys/index.js +2 -2
  37. package/dist/src/passkeys/index.js.map +3 -3
  38. package/dist/src/radix/index.cjs +2 -2
  39. package/dist/src/radix/index.cjs.map +3 -3
  40. package/dist/src/radix/index.js +2 -2
  41. package/dist/src/radix/index.js.map +3 -3
  42. package/dist/src/walletconnect/index.cjs +2 -2
  43. package/dist/src/walletconnect/index.cjs.map +4 -4
  44. package/dist/src/walletconnect/index.js +2 -2
  45. package/dist/src/walletconnect/index.js.map +4 -4
  46. package/dist/src/xaman/index.cjs +2 -2
  47. package/dist/src/xaman/index.cjs.map +5 -5
  48. package/dist/src/xaman/index.js +2 -2
  49. package/dist/src/xaman/index.js.map +5 -5
  50. package/dist/types/coinbase/signer.d.ts +58 -23
  51. package/dist/types/coinbase/signer.d.ts.map +1 -1
  52. package/dist/types/core.d.ts +18 -0
  53. package/dist/types/core.d.ts.map +1 -0
  54. package/dist/types/index.d.ts +1 -1
  55. package/dist/types/index.d.ts.map +1 -1
  56. package/dist/types/keystore-helpers.d.ts +42 -0
  57. package/dist/types/keystore-helpers.d.ts.map +1 -0
  58. package/dist/types/keystore.d.ts +66 -1
  59. package/dist/types/keystore.d.ts.map +1 -1
  60. package/dist/types/passkeys/index.d.ts +2 -2
  61. package/dist/types/passkeys/index.d.ts.map +1 -1
  62. package/dist/types/radix/index.d.ts.map +1 -1
  63. package/dist/types/types.d.ts +6 -4
  64. package/dist/types/types.d.ts.map +1 -1
  65. package/dist/types/utils.d.ts.map +1 -1
  66. package/dist/types/walletconnect/constants.d.ts +2 -1
  67. package/dist/types/walletconnect/constants.d.ts.map +1 -1
  68. package/dist/types/walletconnect/evmSigner.d.ts +2 -2
  69. package/dist/types/walletconnect/evmSigner.d.ts.map +1 -1
  70. package/dist/types/walletconnect/index.d.ts +2 -2
  71. package/dist/types/walletconnect/index.d.ts.map +1 -1
  72. package/dist/types/xaman/helpers.d.ts +22 -20
  73. package/dist/types/xaman/helpers.d.ts.map +1 -1
  74. package/dist/types/xaman/index.d.ts +1 -1
  75. package/dist/types/xaman/index.d.ts.map +1 -1
  76. package/dist/types/xaman/types.d.ts +8 -0
  77. package/dist/types/xaman/types.d.ts.map +1 -1
  78. package/dist/types/xaman/walletMethods.d.ts +14 -2
  79. package/dist/types/xaman/walletMethods.d.ts.map +1 -1
  80. package/package.json +26 -16
  81. package/dist/chunk-78m70510.js +0 -5
  82. package/dist/chunk-7jmqkkhs.js +0 -4
  83. package/dist/chunk-7jmqkkhs.js.map +0 -10
  84. package/dist/chunk-9acqzpjy.js +0 -5
  85. package/dist/chunk-9acqzpjy.js.map +0 -10
  86. package/dist/chunk-vb4wtm2w.js +0 -4
  87. package/src/bitget.ts +0 -1
  88. package/src/coinbase/index.ts +0 -44
  89. package/src/coinbase/signer.ts +0 -77
  90. package/src/cosmostation.ts +0 -1
  91. package/src/ctrl.ts +0 -1
  92. package/src/evm-extensions.ts +0 -1
  93. package/src/index.ts +0 -3
  94. package/src/keepkey-bex.ts +0 -1
  95. package/src/keepkey.ts +0 -1
  96. package/src/keplr.ts +0 -1
  97. package/src/keystore.ts +0 -1
  98. package/src/ledger.ts +0 -1
  99. package/src/near-wallet-selector/index.ts +0 -115
  100. package/src/okx.ts +0 -1
  101. package/src/onekey.ts +0 -1
  102. package/src/passkeys/index.ts +0 -183
  103. package/src/phantom.ts +0 -1
  104. package/src/polkadotjs.ts +0 -1
  105. package/src/radix/index.ts +0 -194
  106. package/src/talisman.ts +0 -1
  107. package/src/trezor.ts +0 -1
  108. package/src/tronlink.ts +0 -1
  109. package/src/types.ts +0 -94
  110. package/src/utils.ts +0 -59
  111. package/src/vultisig.ts +0 -1
  112. package/src/walletconnect/constants.ts +0 -103
  113. package/src/walletconnect/evmSigner.ts +0 -125
  114. package/src/walletconnect/helpers.ts +0 -73
  115. package/src/walletconnect/index.ts +0 -392
  116. package/src/walletconnect/namespaces.ts +0 -80
  117. package/src/walletconnect/types.ts +0 -6
  118. package/src/xaman/helpers.ts +0 -54
  119. package/src/xaman/index.ts +0 -62
  120. package/src/xaman/types.ts +0 -26
  121. package/src/xaman/walletMethods.ts +0 -110
@@ -1,110 +0,0 @@
1
- import { SwapKitError } from "@swapkit/helpers";
2
- import type { Xumm } from "xumm";
3
- import type { XamanPaymentParams } from "./types";
4
-
5
- export const connectXamanWallet = async (xumm: Xumm) => {
6
- if (!xumm) {
7
- throw new SwapKitError("wallet_xaman_not_configured");
8
- }
9
-
10
- try {
11
- const user = await xumm.user;
12
- const account = await user?.account;
13
-
14
- if (account) {
15
- return account;
16
- }
17
-
18
- throw new SwapKitError("wallet_xaman_auth_failed");
19
- } catch (error) {
20
- console.error("Xaman wallet connection failed:", error);
21
- throw new SwapKitError("wallet_xaman_connection_failed");
22
- }
23
- };
24
-
25
- export const sendXamanTransaction = async (xumm: Xumm, params: XamanPaymentParams) => {
26
- try {
27
- // Validate required parameters
28
- if (!(params.destination && params.amount && params.from)) {
29
- throw new SwapKitError("wallet_xaman_connection_failed");
30
- }
31
-
32
- // Convert XRP to drops (1 XRP = 1,000,000 drops)
33
- const amountInDrops = (Number.parseFloat(params.amount) * 1000000).toString();
34
-
35
- // Create transaction object
36
- const transaction = {
37
- Account: params.from,
38
- Amount: amountInDrops,
39
- Destination: params.destination,
40
- TransactionType: "Payment" as const,
41
- ...(params.destinationTag !== undefined && { DestinationTag: params.destinationTag }),
42
- ...(params.memo && {
43
- Memos: [{ Memo: { MemoData: Buffer.from(params.memo, "utf8").toString("hex").toUpperCase() } }],
44
- }),
45
- };
46
-
47
- // Create and subscribe to payload following the official example
48
- const subscription = await xumm.payload?.createAndSubscribe(transaction, (event) => {
49
- if ("signed" in event.data) {
50
- // Return event.data to close subscription and resolve promise
51
- return event.data; // { signed: true|false, payload_uuidv4: '...' }
52
- }
53
- return undefined;
54
- });
55
-
56
- if (!subscription) {
57
- throw new SwapKitError("wallet_xaman_transaction_failed");
58
- }
59
-
60
- const { created } = subscription;
61
-
62
- // Handle payload presentation based on runtime environment
63
- if (xumm.runtime?.xapp) {
64
- xumm.xapp?.openSignRequest(created);
65
- } else if (typeof window !== "undefined") {
66
- const url =
67
- created.pushed && created.next?.no_push_msg_received ? created.next.no_push_msg_received : created.next?.always;
68
- if (url) window.open(url);
69
- }
70
-
71
- // Wait until the user signed/rejected
72
- const resolved = await subscription.resolved;
73
-
74
- if (!resolved || typeof resolved !== "object" || !("signed" in resolved) || !resolved.signed) {
75
- throw new SwapKitError("wallet_xaman_transaction_failed");
76
- }
77
-
78
- // Fetch the full payload result using the UUID from resolved data
79
- const payloadDetails = await xumm.payload?.get((resolved as any).payload_uuidv4);
80
-
81
- if (!payloadDetails) {
82
- throw new SwapKitError("wallet_xaman_monitoring_failed");
83
- }
84
-
85
- // Extract transaction ID from response
86
- const transactionId = payloadDetails.response?.txid || "";
87
- const account = payloadDetails.response?.account || "";
88
-
89
- if (!transactionId) {
90
- throw new SwapKitError("wallet_xaman_transaction_failed");
91
- }
92
-
93
- // Return comprehensive result
94
- return {
95
- deepLink: created.next?.always || "",
96
- // Initial payload info for QR codes, deep links, etc.
97
- payloadId: created.uuid || "",
98
- qrCode: created.refs?.qr_png || "",
99
- // Final transaction result - SUCCESS with tx hash
100
- result: { account, reason: undefined, success: true, transactionId },
101
- websocketUrl: created.refs?.websocket_status || "",
102
- };
103
- } catch (error) {
104
- console.error("Xaman payment creation and subscription failed:", error);
105
- if (error instanceof SwapKitError) {
106
- throw error;
107
- }
108
- throw new SwapKitError("wallet_xaman_transaction_failed");
109
- }
110
- };