@upcoming/multichain-widget 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 (190) hide show
  1. package/README.md +57 -0
  2. package/dist/Arc-VDBY7LNS-DBrTWC6L.mjs +4 -0
  3. package/dist/Brave-BRAKJXDS-CfOthErl.mjs +4 -0
  4. package/dist/Browser-76IHF3Y2-D5mI5yDv.mjs +4 -0
  5. package/dist/Button.d.ts +11 -0
  6. package/dist/Chrome-65Q5P54Y-DrF9hxVd.mjs +4 -0
  7. package/dist/Edge-XSPUTORV-BPc8HSNM.mjs +4 -0
  8. package/dist/Firefox-AAHGJQIP--XXnd95e.mjs +4 -0
  9. package/dist/LabelSpacing.d.ts +8 -0
  10. package/dist/Linux-OO4TNCLJ-DjZl5oHj.mjs +4 -0
  11. package/dist/Macos-MW4AE7LN-DDrYwsGC.mjs +4 -0
  12. package/dist/MultichainErrorWrapper.d.ts +5 -0
  13. package/dist/MultichainHooks.d.ts +7 -0
  14. package/dist/MultichainStep.d.ts +4 -0
  15. package/dist/MultichainTheme.d.ts +23 -0
  16. package/dist/NumberInput.d.ts +13 -0
  17. package/dist/Opera-KQZLSACL-DhwRnyeO.mjs +4 -0
  18. package/dist/ProgressStatus.d.ts +9 -0
  19. package/dist/ProgressTracker.d.ts +8 -0
  20. package/dist/Router.d.ts +10 -0
  21. package/dist/Safari-ZPL37GXR-BJMyZNGk.mjs +4 -0
  22. package/dist/Select.d.ts +13 -0
  23. package/dist/SwapData.d.ts +8 -0
  24. package/dist/Tab1.d.ts +11 -0
  25. package/dist/Tab2.d.ts +13 -0
  26. package/dist/TextInput.d.ts +10 -0
  27. package/dist/Typography.d.ts +9 -0
  28. package/dist/Vertical.d.ts +7 -0
  29. package/dist/Windows-PPTHQER6-8DxONxME.mjs +4 -0
  30. package/dist/add-BaaFGpjE.mjs +19 -0
  31. package/dist/all-wallets-C4glPyDd.mjs +10 -0
  32. package/dist/apechain-SX5YFU6N-B6iVN2eI.mjs +4 -0
  33. package/dist/app-store-D83eAZij.mjs +21 -0
  34. package/dist/apple-D-am83__.mjs +22 -0
  35. package/dist/ar_AR-CTNWGWSS-B2yhhasT.mjs +1430 -0
  36. package/dist/arbitrum-WURIBY6W-C9umEuPP.mjs +4 -0
  37. package/dist/arrow-bottom-Br5TDvbL.mjs +12 -0
  38. package/dist/arrow-bottom-circle-DR_QyRKh.mjs +15 -0
  39. package/dist/arrow-left-DVYN58EU.mjs +12 -0
  40. package/dist/arrow-right-CyzEFMvr.mjs +12 -0
  41. package/dist/arrow-top-jqA3K6Zg.mjs +12 -0
  42. package/dist/assets-Q6ZU7ZJ5-DrI2eCWt.mjs +4 -0
  43. package/dist/avalanche-KOMJD3XY-BzTQlT3D.mjs +4 -0
  44. package/dist/bank-ByHNwpc3.mjs +18 -0
  45. package/dist/base-OAXLRA4F-zGysVgz6.mjs +4 -0
  46. package/dist/basic-CSosNPWM.mjs +5734 -0
  47. package/dist/berachain-NJECWIVC-CRQ0XjnA.mjs +4 -0
  48. package/dist/blast-V555OVXZ-DfAGOAm0.mjs +4 -0
  49. package/dist/browser-3VflZ6uC.mjs +308 -0
  50. package/dist/browser-ySWxlHoa.mjs +18 -0
  51. package/dist/bsc-N647EYR2-BZ1b_4BN.mjs +4 -0
  52. package/dist/card-CRN66uYO.mjs +18 -0
  53. package/dist/ccip-De2aDqcs.mjs +147 -0
  54. package/dist/celo-GEP4TUHG-DjaxM9On.mjs +4 -0
  55. package/dist/checkmark-B326mymW.mjs +15 -0
  56. package/dist/checkmark-bold-CZsJD2Gr.mjs +12 -0
  57. package/dist/chevron-bottom-DkZc5wTP.mjs +12 -0
  58. package/dist/chevron-left-o4mMwB-E.mjs +12 -0
  59. package/dist/chevron-right-DkxYecAn.mjs +12 -0
  60. package/dist/chevron-top-CmqtU-3t.mjs +12 -0
  61. package/dist/chrome-store-BiNhwxXr.mjs +65 -0
  62. package/dist/clock-Ca5tol9L.mjs +12 -0
  63. package/dist/close-DiXtNp7Z.mjs +12 -0
  64. package/dist/coinPlaceholder-3mnOUj7X.mjs +12 -0
  65. package/dist/coinbaseWallet-OKXU3TRC-5iCQMeiP.mjs +4 -0
  66. package/dist/compass-BeTMfz74.mjs +12 -0
  67. package/dist/connect-UA7M4XW6-of1DMMin.mjs +4 -0
  68. package/dist/copy-Dsf3uZQO.mjs +19 -0
  69. package/dist/core-C9zZKsa4.mjs +15268 -0
  70. package/dist/create-FASO7PVG-BFLB5t7x.mjs +4 -0
  71. package/dist/cronos-HJPAQTAE-CWSImNSf.mjs +4 -0
  72. package/dist/cursor-BdwdNQbq.mjs +7 -0
  73. package/dist/cursor-transparent-BQbUy-MI.mjs +16 -0
  74. package/dist/de_DE-P43L3PR7-CtO9uiNS.mjs +1430 -0
  75. package/dist/degen-FQQ4XGHB-DXAeLlGy.mjs +4 -0
  76. package/dist/desktop-CZMhBJFb.mjs +13 -0
  77. package/dist/disconnect-DLhBZUoq.mjs +12 -0
  78. package/dist/discord-CdM4DmVY.mjs +21 -0
  79. package/dist/en_US-RFN65H63-DaOvy-Ie.mjs +4 -0
  80. package/dist/es_419-JBX5FS3Q-hWy9nCEf.mjs +1430 -0
  81. package/dist/ethereum-RGGVA4PY-DxPcn0KS.mjs +4 -0
  82. package/dist/etherscan-DRQI7jsG.mjs +10 -0
  83. package/dist/events-BCEOhv4q.mjs +215 -0
  84. package/dist/exclamation-triangle-C5nhoqtz.mjs +8 -0
  85. package/dist/extension-aejRiJF7.mjs +12 -0
  86. package/dist/external-link-oWHbY6ff.mjs +12 -0
  87. package/dist/facebook-FUrhPDsl.mjs +30 -0
  88. package/dist/farcaster-fPZEqZwK.mjs +16 -0
  89. package/dist/filters-B1xTGafV.mjs +12 -0
  90. package/dist/flow-5FQJFCTK-CVfZv3to.mjs +4 -0
  91. package/dist/fr_FR-CM2EDAQC-B_30pesA.mjs +1430 -0
  92. package/dist/github-Dp4K2Czx.mjs +22 -0
  93. package/dist/gnosis-37ZC4RBL-xYLDpnHh.mjs +4 -0
  94. package/dist/google-ub7aEPpV.mjs +22 -0
  95. package/dist/gravity-J5YQHTYH-B97TrN9J.mjs +4 -0
  96. package/dist/hardhat-TX56IT5N-2KZA3GeI.mjs +4 -0
  97. package/dist/help-circle-BY3olasE.mjs +16 -0
  98. package/dist/hi_IN-GYVCUYRD-BaP4Kv7X.mjs +1430 -0
  99. package/dist/hooks.module-CsKUm6iL.mjs +487 -0
  100. package/dist/hyperevm-VKPAA4SA-C95vekJe.mjs +4 -0
  101. package/dist/id-CcbGN1gV.mjs +16 -0
  102. package/dist/id_ID-7ZWSMOOE-Dmml3uJR.mjs +1430 -0
  103. package/dist/image-D4ynYkwO.mjs +8 -0
  104. package/dist/index-5rNVG-X1.mjs +13987 -0
  105. package/dist/index-Bm8yUuPZ.mjs +1031 -0
  106. package/dist/index-CD3t4hnN.mjs +788 -0
  107. package/dist/index-CDBq6imb.mjs +9170 -0
  108. package/dist/index-CYj_i5FF.mjs +48 -0
  109. package/dist/index-Cm6VblFi.mjs +386 -0
  110. package/dist/index-CzXxUYUh.mjs +116342 -0
  111. package/dist/index-DhCSttFR.mjs +572 -0
  112. package/dist/index.d.ts +12 -0
  113. package/dist/index.es-mDlOQVHq.mjs +11936 -0
  114. package/dist/info-DeimbgLd.mjs +7 -0
  115. package/dist/info-circle-CwTrbHls.mjs +16 -0
  116. package/dist/ink-FZMYZWHG-DlcClk5L.mjs +4 -0
  117. package/dist/ja_JP-CGMP6VLZ-k1qEQOBd.mjs +1430 -0
  118. package/dist/kaia-65D2U3PU-DJdIsERb.mjs +4 -0
  119. package/dist/ko_KR-YCZDTF7X-N5e302Ee.mjs +1430 -0
  120. package/dist/lightbulb-1S-xUrVG.mjs +7 -0
  121. package/dist/linea-QRMVQ5DY-CrycDmSa.mjs +4 -0
  122. package/dist/login-UP3DZBGS-BT9d537y.mjs +4 -0
  123. package/dist/mail-Bx6EPzBz.mjs +12 -0
  124. package/dist/manta-SI27YFEJ-CFctqJ5B.mjs +4 -0
  125. package/dist/mantle-CKIUT334-DZTIMdrF.mjs +4 -0
  126. package/dist/metaMaskWallet-SITXT2FV-CaDFha8m.mjs +4 -0
  127. package/dist/metamask-sdk-nVei8ADt.mjs +14679 -0
  128. package/dist/mobile-B8-sJxpC.mjs +13 -0
  129. package/dist/more-B6z1a_a4.mjs +15 -0
  130. package/dist/ms_MY-5LHAYMS7-DXUqJsVQ.mjs +1430 -0
  131. package/dist/multichain-widget.css +1 -0
  132. package/dist/multichain-widget.es.js +4 -0
  133. package/dist/multichain-widget.umd.js +53310 -0
  134. package/dist/network-placeholder-Q6vZ0clE.mjs +18 -0
  135. package/dist/nftPlaceholder-DaWpsRwT.mjs +12 -0
  136. package/dist/off-CoEljpqo.mjs +12 -0
  137. package/dist/optimism-HAF2GUT7-CDkFpVXG.mjs +4 -0
  138. package/dist/play-store-CwE3M0eU.mjs +36 -0
  139. package/dist/plus-1bFJ_g6P.mjs +17 -0
  140. package/dist/polygon-WW6ZI7PM-DMiAjxYW.mjs +4 -0
  141. package/dist/pt_BR-3JTS4PSK-BcqTSqXX.mjs +1430 -0
  142. package/dist/qr-code-tlhzSQ7q.mjs +10 -0
  143. package/dist/rainbowWallet-O26YNBMX-CB4dd0t7.mjs +4 -0
  144. package/dist/recycle-horizontal-DVabIaNj.mjs +13 -0
  145. package/dist/refresh-BEzHm0St.mjs +12 -0
  146. package/dist/refresh-S4T5V5GX-CoT4SMY4.mjs +4 -0
  147. package/dist/reown-logo-ZGeC-Zjq.mjs +16 -0
  148. package/dist/ronin-EMCPYXZT-CMqZm7Bj.mjs +4 -0
  149. package/dist/ru_RU-6J6XERHI-NHs582yY.mjs +1430 -0
  150. package/dist/safeWallet-5MNKTR5Z-ByPwRyZO.mjs +4 -0
  151. package/dist/sanko-RHQYXGM5-BdRCo3KT.mjs +4 -0
  152. package/dist/scan-4UYSQ56Q-Bt1XXdi3.mjs +4 -0
  153. package/dist/scroll-5OBGQVOV-C_cEm-kG.mjs +4 -0
  154. package/dist/search-BQm4fL3J.mjs +12 -0
  155. package/dist/secp256k1-CzCNdoTs.mjs +1509 -0
  156. package/dist/secp256k1-sIPbOTrM.mjs +1509 -0
  157. package/dist/send-B3VoVme5.mjs +19 -0
  158. package/dist/sign-A7IJEUT5-BQQmgNRT.mjs +4 -0
  159. package/dist/superposition-HG6MMR2Y-DHda4Hsd.mjs +4 -0
  160. package/dist/swapHorizontal-CX4jGdb-.mjs +12 -0
  161. package/dist/swapHorizontalBold-BOgCYVbo.mjs +12 -0
  162. package/dist/swapHorizontalMedium-DB47Xtfo.mjs +20 -0
  163. package/dist/swapHorizontalRoundedBold-DlQi9SKq.mjs +12 -0
  164. package/dist/swapVertical-0hWEwQ-0.mjs +12 -0
  165. package/dist/telegram-Cv_JwtKa.mjs +20 -0
  166. package/dist/th_TH-STXOD4CR-BIfWqO2o.mjs +1430 -0
  167. package/dist/three-dots-BB9sWThR.mjs +9 -0
  168. package/dist/tr_TR-P7QAUUZU-eG8PiHRZ.mjs +1430 -0
  169. package/dist/twitch-rc6Nwqz3.mjs +22 -0
  170. package/dist/twitterIcon-C0_NYbu8.mjs +10 -0
  171. package/dist/uk_UA-JTTBGJGQ-Dr7NKTT4.mjs +1430 -0
  172. package/dist/unichain-C5BWO2ZY-CgjeJfD4.mjs +4 -0
  173. package/dist/verify-DOiQmnqA.mjs +12 -0
  174. package/dist/verify-filled-BBBQPsk8.mjs +12 -0
  175. package/dist/vi_VN-5XUUAVWW-DDODReq8.mjs +1430 -0
  176. package/dist/w3m-modal-CJ9n0c2W.mjs +1457 -0
  177. package/dist/wallet-ERpC7VYY.mjs +12 -0
  178. package/dist/wallet-placeholder-ClAlPjuC.mjs +18 -0
  179. package/dist/walletConnectWallet-YHWKVTDY-DU_S15em.mjs +4 -0
  180. package/dist/walletconnect-np7_TJtf.mjs +36 -0
  181. package/dist/warning-circle-D-7HoIeW.mjs +16 -0
  182. package/dist/x-BS4s0iBO.mjs +16 -0
  183. package/dist/xdc-KJ3TDBYO-Ie58M8Vn.mjs +4 -0
  184. package/dist/zetachain-TLDS5IPW-CCJ72zNa.mjs +4 -0
  185. package/dist/zh_CN-RGMLPFEP-CTX3PM0F.mjs +1430 -0
  186. package/dist/zh_HK-YM3T6EI5-DZjb_17i.mjs +1430 -0
  187. package/dist/zh_TW-HAEH6VE5-BOq1c4Vl.mjs +1430 -0
  188. package/dist/zksync-DH7HK5U4-08fCIujK.mjs +4 -0
  189. package/dist/zora-FYL5H3IO-BoL7oY8W.mjs +4 -0
  190. package/package.json +45 -0
@@ -0,0 +1,48 @@
1
+ function r(e) {
2
+ return new Promise((t, n) => {
3
+ e.oncomplete = e.onsuccess = () => t(e.result), e.onabort = e.onerror = () => n(e.error);
4
+ });
5
+ }
6
+ function l(e, t) {
7
+ const n = indexedDB.open(e);
8
+ n.onupgradeneeded = () => n.result.createObjectStore(t);
9
+ const u = r(n);
10
+ return (a, i) => u.then((s) => i(s.transaction(t, a).objectStore(t)));
11
+ }
12
+ let c;
13
+ function o() {
14
+ return c || (c = l("keyval-store", "keyval")), c;
15
+ }
16
+ function f(e, t = o()) {
17
+ return t("readonly", (n) => r(n.get(e)));
18
+ }
19
+ function p(e, t, n = o()) {
20
+ return n("readwrite", (u) => (u.put(t, e), r(u.transaction)));
21
+ }
22
+ function y(e, t = o()) {
23
+ return t("readwrite", (n) => (n.delete(e), r(n.transaction)));
24
+ }
25
+ function h(e = o()) {
26
+ return e("readwrite", (t) => (t.clear(), r(t.transaction)));
27
+ }
28
+ function d(e, t) {
29
+ return e.openCursor().onsuccess = function() {
30
+ this.result && (t(this.result), this.result.continue());
31
+ }, r(e.transaction);
32
+ }
33
+ function g(e = o()) {
34
+ return e("readonly", (t) => {
35
+ if (t.getAllKeys)
36
+ return r(t.getAllKeys());
37
+ const n = [];
38
+ return d(t, (u) => n.push(u.key)).then(() => n);
39
+ });
40
+ }
41
+ export {
42
+ h as a,
43
+ l as c,
44
+ y as d,
45
+ f as g,
46
+ g as k,
47
+ p as s
48
+ };
@@ -0,0 +1,386 @@
1
+ import { r as T } from "./index-DhCSttFR.mjs";
2
+ import { j as y, k, m as I } from "./index-CzXxUYUh.mjs";
3
+ const q = () => "9.1.0", v = (t) => t.toString(16).padStart(2, "0"), C = (t) => {
4
+ const e = new Uint8Array(t / 2);
5
+ return window.crypto.getRandomValues(e), Array.from(e, v).join("");
6
+ }, R = () => typeof window < "u" ? C(10) : (/* @__PURE__ */ new Date()).getTime().toString(36);
7
+ class g {
8
+ }
9
+ g.makeRequest = (t, e) => ({
10
+ id: R(),
11
+ method: t,
12
+ params: e,
13
+ env: {
14
+ sdkVersion: q()
15
+ }
16
+ });
17
+ g.makeResponse = (t, e, s) => ({
18
+ id: t,
19
+ success: !0,
20
+ version: s,
21
+ data: e
22
+ });
23
+ g.makeErrorResponse = (t, e, s) => ({
24
+ id: t,
25
+ success: !1,
26
+ error: e,
27
+ version: s
28
+ });
29
+ var r;
30
+ (function(t) {
31
+ t.sendTransactions = "sendTransactions", t.rpcCall = "rpcCall", t.getChainInfo = "getChainInfo", t.getSafeInfo = "getSafeInfo", t.getTxBySafeTxHash = "getTxBySafeTxHash", t.getSafeBalances = "getSafeBalances", t.signMessage = "signMessage", t.signTypedMessage = "signTypedMessage", t.getEnvironmentInfo = "getEnvironmentInfo", t.getOffChainSignature = "getOffChainSignature", t.requestAddressBook = "requestAddressBook", t.wallet_getPermissions = "wallet_getPermissions", t.wallet_requestPermissions = "wallet_requestPermissions";
32
+ })(r || (r = {}));
33
+ var m;
34
+ (function(t) {
35
+ t.requestAddressBook = "requestAddressBook";
36
+ })(m || (m = {}));
37
+ class H {
38
+ constructor(e = null, s = !1) {
39
+ this.allowedOrigins = null, this.callbacks = /* @__PURE__ */ new Map(), this.debugMode = !1, this.isServer = typeof window > "u", this.isValidMessage = ({ origin: a, data: n, source: i }) => {
40
+ const o = !n, l = !this.isServer && i === window.parent, u = typeof n.version < "u" && parseInt(n.version.split(".")[0]), B = typeof u == "number" && u >= 1;
41
+ let p = !0;
42
+ return Array.isArray(this.allowedOrigins) && (p = this.allowedOrigins.find((P) => P.test(a)) !== void 0), !o && l && B && p;
43
+ }, this.logIncomingMessage = (a) => {
44
+ console.info(`Safe Apps SDK v1: A message was received from origin ${a.origin}. `, a.data);
45
+ }, this.onParentMessage = (a) => {
46
+ this.isValidMessage(a) && (this.debugMode && this.logIncomingMessage(a), this.handleIncomingMessage(a.data));
47
+ }, this.handleIncomingMessage = (a) => {
48
+ const { id: n } = a, i = this.callbacks.get(n);
49
+ i && (i(a), this.callbacks.delete(n));
50
+ }, this.send = (a, n) => {
51
+ const i = g.makeRequest(a, n);
52
+ if (this.isServer)
53
+ throw new Error("Window doesn't exist");
54
+ return window.parent.postMessage(i, "*"), new Promise((o, l) => {
55
+ this.callbacks.set(i.id, (u) => {
56
+ if (!u.success) {
57
+ l(new Error(u.error));
58
+ return;
59
+ }
60
+ o(u);
61
+ });
62
+ });
63
+ }, this.allowedOrigins = e, this.debugMode = s, this.isServer || window.addEventListener("message", this.onParentMessage);
64
+ }
65
+ }
66
+ const b = (t) => typeof t == "object" && t != null && "domain" in t && "types" in t && "message" in t;
67
+ T();
68
+ class E {
69
+ constructor(e) {
70
+ this.communicator = e;
71
+ }
72
+ async getBySafeTxHash(e) {
73
+ if (!e)
74
+ throw new Error("Invalid safeTxHash");
75
+ return (await this.communicator.send(r.getTxBySafeTxHash, { safeTxHash: e })).data;
76
+ }
77
+ async signMessage(e) {
78
+ const s = {
79
+ message: e
80
+ };
81
+ return (await this.communicator.send(r.signMessage, s)).data;
82
+ }
83
+ async signTypedMessage(e) {
84
+ if (!b(e))
85
+ throw new Error("Invalid typed data");
86
+ return (await this.communicator.send(r.signTypedMessage, { typedData: e })).data;
87
+ }
88
+ async send({ txs: e, params: s }) {
89
+ if (!e || !e.length)
90
+ throw new Error("No transactions were passed");
91
+ const a = {
92
+ txs: e,
93
+ params: s
94
+ };
95
+ return (await this.communicator.send(r.sendTransactions, a)).data;
96
+ }
97
+ }
98
+ const c = {
99
+ eth_call: "eth_call",
100
+ eth_gasPrice: "eth_gasPrice",
101
+ eth_getLogs: "eth_getLogs",
102
+ eth_getBalance: "eth_getBalance",
103
+ eth_getCode: "eth_getCode",
104
+ eth_getBlockByHash: "eth_getBlockByHash",
105
+ eth_getBlockByNumber: "eth_getBlockByNumber",
106
+ eth_getStorageAt: "eth_getStorageAt",
107
+ eth_getTransactionByHash: "eth_getTransactionByHash",
108
+ eth_getTransactionReceipt: "eth_getTransactionReceipt",
109
+ eth_getTransactionCount: "eth_getTransactionCount",
110
+ eth_estimateGas: "eth_estimateGas",
111
+ safe_setSettings: "safe_setSettings"
112
+ }, h = {
113
+ defaultBlockParam: (t = "latest") => t,
114
+ returnFullTxObjectParam: (t = !1) => t,
115
+ blockNumberToHex: (t) => Number.isInteger(t) ? `0x${t.toString(16)}` : t
116
+ };
117
+ class A {
118
+ constructor(e) {
119
+ this.communicator = e, this.call = this.buildRequest({
120
+ call: c.eth_call,
121
+ formatters: [null, h.defaultBlockParam]
122
+ }), this.getBalance = this.buildRequest({
123
+ call: c.eth_getBalance,
124
+ formatters: [null, h.defaultBlockParam]
125
+ }), this.getCode = this.buildRequest({
126
+ call: c.eth_getCode,
127
+ formatters: [null, h.defaultBlockParam]
128
+ }), this.getStorageAt = this.buildRequest({
129
+ call: c.eth_getStorageAt,
130
+ formatters: [null, h.blockNumberToHex, h.defaultBlockParam]
131
+ }), this.getPastLogs = this.buildRequest({
132
+ call: c.eth_getLogs
133
+ }), this.getBlockByHash = this.buildRequest({
134
+ call: c.eth_getBlockByHash,
135
+ formatters: [null, h.returnFullTxObjectParam]
136
+ }), this.getBlockByNumber = this.buildRequest({
137
+ call: c.eth_getBlockByNumber,
138
+ formatters: [h.blockNumberToHex, h.returnFullTxObjectParam]
139
+ }), this.getTransactionByHash = this.buildRequest({
140
+ call: c.eth_getTransactionByHash
141
+ }), this.getTransactionReceipt = this.buildRequest({
142
+ call: c.eth_getTransactionReceipt
143
+ }), this.getTransactionCount = this.buildRequest({
144
+ call: c.eth_getTransactionCount,
145
+ formatters: [null, h.defaultBlockParam]
146
+ }), this.getGasPrice = this.buildRequest({
147
+ call: c.eth_gasPrice
148
+ }), this.getEstimateGas = (s) => this.buildRequest({
149
+ call: c.eth_estimateGas
150
+ })([s]), this.setSafeSettings = this.buildRequest({
151
+ call: c.safe_setSettings
152
+ });
153
+ }
154
+ buildRequest(e) {
155
+ const { call: s, formatters: a } = e;
156
+ return async (n) => {
157
+ a && Array.isArray(n) && a.forEach((l, u) => {
158
+ l && (n[u] = l(n[u]));
159
+ });
160
+ const i = {
161
+ call: s,
162
+ params: n || []
163
+ };
164
+ return (await this.communicator.send(r.rpcCall, i)).data;
165
+ };
166
+ }
167
+ }
168
+ const x = "0x1626ba7e", O = "0x20c13b0b", f = 4001;
169
+ class d extends Error {
170
+ constructor(e, s, a) {
171
+ super(e), this.code = s, this.data = a, Object.setPrototypeOf(this, d.prototype);
172
+ }
173
+ }
174
+ class S {
175
+ constructor(e) {
176
+ this.communicator = e;
177
+ }
178
+ async getPermissions() {
179
+ return (await this.communicator.send(r.wallet_getPermissions, void 0)).data;
180
+ }
181
+ async requestPermissions(e) {
182
+ if (!this.isPermissionRequestValid(e))
183
+ throw new d("Permissions request is invalid", f);
184
+ try {
185
+ return (await this.communicator.send(r.wallet_requestPermissions, e)).data;
186
+ } catch {
187
+ throw new d("Permissions rejected", f);
188
+ }
189
+ }
190
+ isPermissionRequestValid(e) {
191
+ return e.every((s) => typeof s == "object" ? Object.keys(s).every((a) => !!Object.values(m).includes(a)) : !1);
192
+ }
193
+ }
194
+ const w = (t, e) => e.some((s) => s.parentCapability === t), V = () => (t, e, s) => {
195
+ const a = s.value;
196
+ return s.value = async function() {
197
+ const n = new S(this.communicator);
198
+ let i = await n.getPermissions();
199
+ if (w(e, i) || (i = await n.requestPermissions([{ [e]: {} }])), !w(e, i))
200
+ throw new d("Permissions rejected", f);
201
+ return a.apply(this);
202
+ }, s;
203
+ };
204
+ var M = function(t, e, s, a) {
205
+ var n = arguments.length, i = n < 3 ? e : a === null ? a = Object.getOwnPropertyDescriptor(e, s) : a, o;
206
+ if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(t, e, s, a);
207
+ else for (var l = t.length - 1; l >= 0; l--) (o = t[l]) && (i = (n < 3 ? o(i) : n > 3 ? o(e, s, i) : o(e, s)) || i);
208
+ return n > 3 && i && Object.defineProperty(e, s, i), i;
209
+ };
210
+ class _ {
211
+ constructor(e) {
212
+ this.communicator = e;
213
+ }
214
+ async getChainInfo() {
215
+ return (await this.communicator.send(r.getChainInfo, void 0)).data;
216
+ }
217
+ async getInfo() {
218
+ return (await this.communicator.send(r.getSafeInfo, void 0)).data;
219
+ }
220
+ // There is a possibility that this method will change because we may add pagination to the endpoint
221
+ async experimental_getBalances({ currency: e = "usd" } = {}) {
222
+ return (await this.communicator.send(r.getSafeBalances, {
223
+ currency: e
224
+ })).data;
225
+ }
226
+ async check1271Signature(e, s = "0x") {
227
+ const a = await this.getInfo(), n = y({
228
+ abi: [
229
+ {
230
+ constant: !1,
231
+ inputs: [
232
+ {
233
+ name: "_dataHash",
234
+ type: "bytes32"
235
+ },
236
+ {
237
+ name: "_signature",
238
+ type: "bytes"
239
+ }
240
+ ],
241
+ name: "isValidSignature",
242
+ outputs: [
243
+ {
244
+ name: "",
245
+ type: "bytes4"
246
+ }
247
+ ],
248
+ payable: !1,
249
+ stateMutability: "nonpayable",
250
+ type: "function"
251
+ }
252
+ ],
253
+ functionName: "isValidSignature",
254
+ args: [e, s]
255
+ }), i = {
256
+ call: c.eth_call,
257
+ params: [
258
+ {
259
+ to: a.safeAddress,
260
+ data: n
261
+ },
262
+ "latest"
263
+ ]
264
+ };
265
+ try {
266
+ return (await this.communicator.send(r.rpcCall, i)).data.slice(0, 10).toLowerCase() === x;
267
+ } catch {
268
+ return !1;
269
+ }
270
+ }
271
+ async check1271SignatureBytes(e, s = "0x") {
272
+ const a = await this.getInfo(), n = y({
273
+ abi: [
274
+ {
275
+ constant: !1,
276
+ inputs: [
277
+ {
278
+ name: "_data",
279
+ type: "bytes"
280
+ },
281
+ {
282
+ name: "_signature",
283
+ type: "bytes"
284
+ }
285
+ ],
286
+ name: "isValidSignature",
287
+ outputs: [
288
+ {
289
+ name: "",
290
+ type: "bytes4"
291
+ }
292
+ ],
293
+ payable: !1,
294
+ stateMutability: "nonpayable",
295
+ type: "function"
296
+ }
297
+ ],
298
+ functionName: "isValidSignature",
299
+ args: [e, s]
300
+ }), i = {
301
+ call: c.eth_call,
302
+ params: [
303
+ {
304
+ to: a.safeAddress,
305
+ data: n
306
+ },
307
+ "latest"
308
+ ]
309
+ };
310
+ try {
311
+ return (await this.communicator.send(r.rpcCall, i)).data.slice(0, 10).toLowerCase() === O;
312
+ } catch {
313
+ return !1;
314
+ }
315
+ }
316
+ calculateMessageHash(e) {
317
+ return k(e);
318
+ }
319
+ calculateTypedMessageHash(e) {
320
+ const s = typeof e.domain.chainId == "object" ? e.domain.chainId.toNumber() : Number(e.domain.chainId);
321
+ let a = e.primaryType;
322
+ if (!a) {
323
+ const n = Object.values(e.types), i = Object.keys(e.types).filter((o) => n.every((l) => l.every(({ type: u }) => u.replace("[", "").replace("]", "") !== o)));
324
+ if (i.length === 0 || i.length > 1)
325
+ throw new Error("Please specify primaryType");
326
+ a = i[0];
327
+ }
328
+ return I({
329
+ message: e.message,
330
+ domain: {
331
+ ...e.domain,
332
+ chainId: s,
333
+ verifyingContract: e.domain.verifyingContract,
334
+ salt: e.domain.salt
335
+ },
336
+ types: e.types,
337
+ primaryType: a
338
+ });
339
+ }
340
+ async getOffChainSignature(e) {
341
+ return (await this.communicator.send(r.getOffChainSignature, e)).data;
342
+ }
343
+ async isMessageSigned(e, s = "0x") {
344
+ let a;
345
+ if (typeof e == "string" && (a = async () => {
346
+ const n = this.calculateMessageHash(e);
347
+ return await this.isMessageHashSigned(n, s);
348
+ }), b(e) && (a = async () => {
349
+ const n = this.calculateTypedMessageHash(e);
350
+ return await this.isMessageHashSigned(n, s);
351
+ }), a)
352
+ return await a();
353
+ throw new Error("Invalid message type");
354
+ }
355
+ async isMessageHashSigned(e, s = "0x") {
356
+ const a = [this.check1271Signature.bind(this), this.check1271SignatureBytes.bind(this)];
357
+ for (const n of a)
358
+ if (await n(e, s))
359
+ return !0;
360
+ return !1;
361
+ }
362
+ async getEnvironmentInfo() {
363
+ return (await this.communicator.send(r.getEnvironmentInfo, void 0)).data;
364
+ }
365
+ async requestAddressBook() {
366
+ return (await this.communicator.send(r.requestAddressBook, void 0)).data;
367
+ }
368
+ }
369
+ M([
370
+ V()
371
+ ], _.prototype, "requestAddressBook", null);
372
+ class D {
373
+ constructor(e = {}) {
374
+ const { allowedDomains: s = null, debug: a = !1 } = e;
375
+ this.communicator = new H(s, a), this.eth = new A(this.communicator), this.txs = new E(this.communicator), this.safe = new _(this.communicator), this.wallet = new S(this.communicator);
376
+ }
377
+ }
378
+ export {
379
+ g as MessageFormatter,
380
+ r as Methods,
381
+ c as RPC_CALLS,
382
+ m as RestrictedMethods,
383
+ D as default,
384
+ q as getSDKVersion,
385
+ b as isObjectEIP712TypedData
386
+ };