@directcryptopay/sdk 0.1.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 (141) hide show
  1. package/README.md +357 -0
  2. package/dist/ConstantsUtil-B-_-u8aQ.js +6 -0
  3. package/dist/add-KF4m4jFK.js +19 -0
  4. package/dist/all-wallets-D6NAjQgX.js +10 -0
  5. package/dist/app-store-D7TTn-EO.js +21 -0
  6. package/dist/apple-DjX2E2hE.js +22 -0
  7. package/dist/arrow-bottom-C0YrNJYB.js +12 -0
  8. package/dist/arrow-bottom-circle-Dlxvx_XG.js +15 -0
  9. package/dist/arrow-left-x8_-lUyK.js +12 -0
  10. package/dist/arrow-right-BTZybj80.js +12 -0
  11. package/dist/arrow-top-LzH7iLCp.js +12 -0
  12. package/dist/bank-23jp-IV_.js +18 -0
  13. package/dist/browser-EjoorDid.js +18 -0
  14. package/dist/card-DGgWwtwC.js +18 -0
  15. package/dist/ccip-BMANewTU.js +150 -0
  16. package/dist/checkmark-B1qcQhBo.js +15 -0
  17. package/dist/checkmark-bold-Cyc4IEEJ.js +12 -0
  18. package/dist/chevron-bottom-ClHs08rB.js +12 -0
  19. package/dist/chevron-left-O8h_551_.js +12 -0
  20. package/dist/chevron-right-DP3xpyIA.js +12 -0
  21. package/dist/chevron-top-CuwkBUs9.js +12 -0
  22. package/dist/chrome-store-zfT_aJ3R.js +65 -0
  23. package/dist/clock-DHZqivIS.js +12 -0
  24. package/dist/close-Cp9rNAw4.js +12 -0
  25. package/dist/coinPlaceholder-U7-T1KKQ.js +12 -0
  26. package/dist/compass-Ds5-PRSR.js +12 -0
  27. package/dist/copy-Jg4HdIMf.js +19 -0
  28. package/dist/core/api.d.ts +30 -0
  29. package/dist/core/config.d.ts +59 -0
  30. package/dist/core/logic.d.ts +2 -0
  31. package/dist/core/wallet.d.ts +34 -0
  32. package/dist/cursor-DmMevduB.js +7 -0
  33. package/dist/cursor-transparent-Dn9-1SV8.js +16 -0
  34. package/dist/dcp-sdk.umd.js +12000 -0
  35. package/dist/dcp.d.ts +10 -0
  36. package/dist/desktop-C4udXXlZ.js +13 -0
  37. package/dist/disconnect-wd1BYLxt.js +12 -0
  38. package/dist/discord-DthxuCAP.js +21 -0
  39. package/dist/email-B3jSnUFE.js +696 -0
  40. package/dist/embedded-wallet-CJHmoBI2.js +468 -0
  41. package/dist/etherscan-Cjp4xfMW.js +10 -0
  42. package/dist/exclamation-triangle-CRNR5WOy.js +8 -0
  43. package/dist/extension-Cydk0mZt.js +12 -0
  44. package/dist/external-link-CuPTAoq9.js +12 -0
  45. package/dist/facebook-CghqXmdf.js +30 -0
  46. package/dist/farcaster-BREqMX4y.js +16 -0
  47. package/dist/filters-Dn_Ys7ew.js +12 -0
  48. package/dist/github-C-A7JmIY.js +22 -0
  49. package/dist/google-CCdM_naE.js +22 -0
  50. package/dist/hashTypedData-D2Qmzscs.js +197 -0
  51. package/dist/help-circle-DIH4vyj3.js +16 -0
  52. package/dist/id-DkJ0gBuy.js +16 -0
  53. package/dist/if-defined-BciplFKz.js +744 -0
  54. package/dist/image-qMjyiXM0.js +8 -0
  55. package/dist/index--3Zp0jAb.js +45 -0
  56. package/dist/index-1adX-Fit.js +65 -0
  57. package/dist/index-AvC0IGDl.js +7864 -0
  58. package/dist/index-B2-vKLd8.js +276 -0
  59. package/dist/index-B2iDt0TJ.js +146 -0
  60. package/dist/index-B5zkXsLJ.js +320 -0
  61. package/dist/index-B7K86vWu.js +1742 -0
  62. package/dist/index-BBkcvSiY.js +511 -0
  63. package/dist/index-BdjxQs66.js +181 -0
  64. package/dist/index-Bijd4_Ns.js +294 -0
  65. package/dist/index-BpXOsxzU.js +387 -0
  66. package/dist/index-C1QEJL-2.js +572 -0
  67. package/dist/index-C27dwOyE.js +243 -0
  68. package/dist/index-C4BX3QW8.js +58 -0
  69. package/dist/index-CMPIqsB1.js +170 -0
  70. package/dist/index-CTYngdl0.js +21991 -0
  71. package/dist/index-CUdQyyFn.js +51 -0
  72. package/dist/index-CX60z_g2.js +573 -0
  73. package/dist/index-CppCc1n8.js +65 -0
  74. package/dist/index-CqVegmN4.js +559 -0
  75. package/dist/index-CuiyMA8F.js +78 -0
  76. package/dist/index-CwB_qRfM.js +305 -0
  77. package/dist/index-CxOF7GqE.js +265 -0
  78. package/dist/index-D-IzHD_8.js +54 -0
  79. package/dist/index-DRNiFv9I.js +218 -0
  80. package/dist/index-Da8oZh8H.js +838 -0
  81. package/dist/index-DiHImG4L.js +44236 -0
  82. package/dist/index-DmOMXRG1.js +181 -0
  83. package/dist/index-DoSYqTQg.js +199 -0
  84. package/dist/index-DpHXq5_E.js +603 -0
  85. package/dist/index-DtCsAVBg.js +78 -0
  86. package/dist/index-Ij6XA6_4.js +77 -0
  87. package/dist/index-SzyBYfzA.js +8490 -0
  88. package/dist/index-eW8y-mXH.js +257 -0
  89. package/dist/index-fxzIDZsb.js +75 -0
  90. package/dist/index-lbhz9evJ.js +97 -0
  91. package/dist/index.d.ts +3 -0
  92. package/dist/index.js +4 -0
  93. package/dist/info-DMIGgjkL.js +7 -0
  94. package/dist/info-circle-CJuIKZSx.js +16 -0
  95. package/dist/lightbulb-qFT6WEWV.js +7 -0
  96. package/dist/localBatchGatewayRequest-CsMVMFBc.js +91 -0
  97. package/dist/mail-DoYgQvOt.js +12 -0
  98. package/dist/mobile-URtsh7o-.js +13 -0
  99. package/dist/more-DoQd10TF.js +15 -0
  100. package/dist/network-placeholder-BBA2Ue6C.js +18 -0
  101. package/dist/nftPlaceholder-C9RXWz9k.js +12 -0
  102. package/dist/off-YcuDQczT.js +12 -0
  103. package/dist/onramp-BfqDIx4o.js +1279 -0
  104. package/dist/parseSignature-280HB24T.js +3560 -0
  105. package/dist/play-store-sFaloG_r.js +36 -0
  106. package/dist/plus-l0wekSht.js +17 -0
  107. package/dist/qr-code-CihrUU4G.js +10 -0
  108. package/dist/receive-dfY1Cu-g.js +186 -0
  109. package/dist/recycle-horizontal-nXu6YaPw.js +13 -0
  110. package/dist/ref-huAzXCX0.js +41 -0
  111. package/dist/refresh-D2ZbVeNC.js +12 -0
  112. package/dist/reown-logo-BMaTMJmc.js +16 -0
  113. package/dist/search-YVM9q3J-.js +12 -0
  114. package/dist/secp256k1-BrysY3Sv.js +1302 -0
  115. package/dist/secp256k1-DPQgTBwQ.js +1510 -0
  116. package/dist/send-BwQZPKxI.js +19 -0
  117. package/dist/send-GyetMVu1.js +1038 -0
  118. package/dist/socials-B0W91J9k.js +574 -0
  119. package/dist/swapHorizontal-Dy_oQEkp.js +12 -0
  120. package/dist/swapHorizontalBold-C4JpaMpc.js +12 -0
  121. package/dist/swapHorizontalMedium-D5NuVZFh.js +20 -0
  122. package/dist/swapHorizontalRoundedBold-Bq4P2MCj.js +12 -0
  123. package/dist/swapVertical-CVQ8Mg03.js +12 -0
  124. package/dist/swaps-CA04SSdK.js +1637 -0
  125. package/dist/telegram-BP4SgW_L.js +20 -0
  126. package/dist/three-dots-BJYGJ-dQ.js +9 -0
  127. package/dist/transactions-Bq-98Tsg.js +37 -0
  128. package/dist/twitch-DTATWo9M.js +22 -0
  129. package/dist/twitterIcon-D5UWPInb.js +10 -0
  130. package/dist/types.d.ts +128 -0
  131. package/dist/ui/Modal.d.ts +9 -0
  132. package/dist/ui/index.d.ts +6 -0
  133. package/dist/verify-Byvj8Wi1.js +12 -0
  134. package/dist/verify-filled-B40taNm0.js +12 -0
  135. package/dist/w3m-modal-HV6SE74G.js +1037 -0
  136. package/dist/wallet-Cp-6Kk88.js +12 -0
  137. package/dist/wallet-placeholder-C3juwA9o.js +18 -0
  138. package/dist/walletconnect-CRkIiLCx.js +36 -0
  139. package/dist/warning-circle-DtvCLwG4.js +16 -0
  140. package/dist/x-Cqyx5eCt.js +16 -0
  141. package/package.json +70 -0
@@ -0,0 +1,218 @@
1
+ import { cH as D, bp as b, aW as I, cI as C, c0 as g, b2 as A, cJ as y, cn as _ } from "./index-DiHImG4L.js";
2
+ import { cK as m } from "./index-DiHImG4L.js";
3
+ function q(u = {}) {
4
+ let l, d, s, a;
5
+ return D((n) => ({
6
+ id: "baseAccount",
7
+ name: "Base Account",
8
+ rdns: "app.base.account",
9
+ type: "baseAccount",
10
+ async connect({ chainId: t, withCapabilities: e, ...i } = {}) {
11
+ var r;
12
+ try {
13
+ const c = await this.getProvider(), p = t ?? ((r = n.chains[0]) == null ? void 0 : r.id);
14
+ if (!p)
15
+ throw new C();
16
+ const h = await c.request({
17
+ method: "wallet_connect",
18
+ params: [
19
+ {
20
+ capabilities: "capabilities" in i && i.capabilities ? i.capabilities : {},
21
+ chainIds: [
22
+ g(p),
23
+ ...n.chains.filter((o) => o.id !== p).map((o) => g(o.id))
24
+ ]
25
+ }
26
+ ]
27
+ }), v = h.accounts.map((o) => ({
28
+ address: b(o.address),
29
+ capabilities: o.capabilities ?? {}
30
+ }));
31
+ let f = Number(h.chainIds[0]);
32
+ if (d || (d = this.onAccountsChanged.bind(this), c.on("accountsChanged", d)), s || (s = this.onChainChanged.bind(this), c.on("chainChanged", s)), a || (a = this.onDisconnect.bind(this), c.on("disconnect", a)), t && f !== t) {
33
+ const o = await this.switchChain({ chainId: t }).catch((w) => {
34
+ if (w.code === A.code)
35
+ throw w;
36
+ return { id: f };
37
+ });
38
+ f = (o == null ? void 0 : o.id) ?? f;
39
+ }
40
+ return {
41
+ // TODO(v3): Make `withCapabilities: true` default behavior
42
+ accounts: e ? v : v.map((o) => o.address),
43
+ chainId: f
44
+ };
45
+ } catch (c) {
46
+ throw /(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(c.message) ? new A(c) : c;
47
+ }
48
+ },
49
+ async disconnect() {
50
+ const t = await this.getProvider();
51
+ d && (t.removeListener("accountsChanged", d), d = void 0), s && (t.removeListener("chainChanged", s), s = void 0), a && (t.removeListener("disconnect", a), a = void 0), t.disconnect();
52
+ },
53
+ async getAccounts() {
54
+ return (await (await this.getProvider()).request({
55
+ method: "eth_accounts"
56
+ })).map((e) => b(e));
57
+ },
58
+ async getChainId() {
59
+ const e = await (await this.getProvider()).request({
60
+ method: "eth_chainId"
61
+ });
62
+ return Number(e);
63
+ },
64
+ async getProvider() {
65
+ if (!l) {
66
+ const t = (() => {
67
+ var r;
68
+ return typeof u.preference == "string" ? { options: u.preference } : {
69
+ ...u.preference,
70
+ options: ((r = u.preference) == null ? void 0 : r.options) ?? "all"
71
+ };
72
+ })(), { createBaseAccountSDK: e } = await import("./index-SzyBYfzA.js");
73
+ l = e({
74
+ ...u,
75
+ appChainIds: n.chains.map((r) => r.id),
76
+ preference: t
77
+ }).getProvider();
78
+ }
79
+ return l;
80
+ },
81
+ async isAuthorized() {
82
+ try {
83
+ return !!(await this.getAccounts()).length;
84
+ } catch {
85
+ return !1;
86
+ }
87
+ },
88
+ async switchChain({ addEthereumChainParameter: t, chainId: e }) {
89
+ var c, p, h, v;
90
+ const i = n.chains.find((f) => f.id === e);
91
+ if (!i)
92
+ throw new I(new C());
93
+ const r = await this.getProvider();
94
+ try {
95
+ return await r.request({
96
+ method: "wallet_switchEthereumChain",
97
+ params: [{ chainId: g(i.id) }]
98
+ }), i;
99
+ } catch (f) {
100
+ if (f.code === 4902)
101
+ try {
102
+ let o;
103
+ t != null && t.blockExplorerUrls ? o = t.blockExplorerUrls : o = (c = i.blockExplorers) != null && c.default.url ? [(p = i.blockExplorers) == null ? void 0 : p.default.url] : [];
104
+ let w;
105
+ (h = t == null ? void 0 : t.rpcUrls) != null && h.length ? w = t.rpcUrls : w = [((v = i.rpcUrls.default) == null ? void 0 : v.http[0]) ?? ""];
106
+ const U = {
107
+ blockExplorerUrls: o,
108
+ chainId: g(e),
109
+ chainName: (t == null ? void 0 : t.chainName) ?? i.name,
110
+ iconUrls: t == null ? void 0 : t.iconUrls,
111
+ nativeCurrency: (t == null ? void 0 : t.nativeCurrency) ?? i.nativeCurrency,
112
+ rpcUrls: w
113
+ };
114
+ return await r.request({
115
+ method: "wallet_addEthereumChain",
116
+ params: [U]
117
+ }), i;
118
+ } catch (o) {
119
+ throw new A(o);
120
+ }
121
+ throw new I(f);
122
+ }
123
+ },
124
+ onAccountsChanged(t) {
125
+ t.length === 0 ? this.onDisconnect() : n.emitter.emit("change", {
126
+ accounts: t.map((e) => b(e))
127
+ });
128
+ },
129
+ onChainChanged(t) {
130
+ const e = Number(t);
131
+ n.emitter.emit("change", { chainId: e });
132
+ },
133
+ async onDisconnect(t) {
134
+ n.emitter.emit("disconnect");
135
+ const e = await this.getProvider();
136
+ d && (e.removeListener("accountsChanged", d), d = void 0), s && (e.removeListener("chainChanged", s), s = void 0), a && (e.removeListener("disconnect", a), a = void 0);
137
+ }
138
+ }));
139
+ }
140
+ S.type = "safe";
141
+ function S(u = {}) {
142
+ const { shimDisconnect: l = !1 } = u;
143
+ let d, s;
144
+ return D((a) => ({
145
+ id: "safe",
146
+ name: "Safe",
147
+ type: S.type,
148
+ async connect({ withCapabilities: n } = {}) {
149
+ var r;
150
+ const t = await this.getProvider();
151
+ if (!t)
152
+ throw new y();
153
+ const e = await this.getAccounts(), i = await this.getChainId();
154
+ return s || (s = this.onDisconnect.bind(this), t.on("disconnect", s)), l && await ((r = a.storage) == null ? void 0 : r.removeItem("safe.disconnected")), {
155
+ // TODO(v3): Make `withCapabilities: true` default behavior
156
+ accounts: n ? e.map((c) => ({ address: c, capabilities: {} })) : e,
157
+ chainId: i
158
+ };
159
+ },
160
+ async disconnect() {
161
+ var t;
162
+ const n = await this.getProvider();
163
+ if (!n)
164
+ throw new y();
165
+ s && (n.removeListener("disconnect", s), s = void 0), l && await ((t = a.storage) == null ? void 0 : t.setItem("safe.disconnected", !0));
166
+ },
167
+ async getAccounts() {
168
+ const n = await this.getProvider();
169
+ if (!n)
170
+ throw new y();
171
+ return (await n.request({ method: "eth_accounts" })).map(b);
172
+ },
173
+ async getProvider() {
174
+ if (typeof window < "u" && (window == null ? void 0 : window.parent) !== window) {
175
+ if (!d) {
176
+ const { default: t } = await import("./index-BpXOsxzU.js"), e = new t(u), i = await _(() => e.safe.getInfo(), {
177
+ timeout: u.unstable_getInfoTimeout ?? 10
178
+ });
179
+ if (!i)
180
+ throw new Error("Could not load Safe information");
181
+ const r = await (async () => {
182
+ const c = await import("./index-CTYngdl0.js").then((p) => p.i);
183
+ return typeof c.SafeAppProvider != "function" && typeof c.default.SafeAppProvider == "function" ? c.default.SafeAppProvider : c.SafeAppProvider;
184
+ })();
185
+ d = new r(i, e);
186
+ }
187
+ return d;
188
+ }
189
+ },
190
+ async getChainId() {
191
+ const n = await this.getProvider();
192
+ if (!n)
193
+ throw new y();
194
+ return Number(n.chainId);
195
+ },
196
+ async isAuthorized() {
197
+ var n;
198
+ try {
199
+ return l && // If shim exists in storage, connector is disconnected
200
+ await ((n = a.storage) == null ? void 0 : n.getItem("safe.disconnected")) ? !1 : !!(await this.getAccounts()).length;
201
+ } catch {
202
+ return !1;
203
+ }
204
+ },
205
+ onAccountsChanged() {
206
+ },
207
+ onChainChanged() {
208
+ },
209
+ onDisconnect() {
210
+ a.emitter.emit("disconnect");
211
+ }
212
+ }));
213
+ }
214
+ export {
215
+ q as baseAccount,
216
+ m as injected,
217
+ S as safe
218
+ };