@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.
- package/README.md +57 -0
- package/dist/Arc-VDBY7LNS-DBrTWC6L.mjs +4 -0
- package/dist/Brave-BRAKJXDS-CfOthErl.mjs +4 -0
- package/dist/Browser-76IHF3Y2-D5mI5yDv.mjs +4 -0
- package/dist/Button.d.ts +11 -0
- package/dist/Chrome-65Q5P54Y-DrF9hxVd.mjs +4 -0
- package/dist/Edge-XSPUTORV-BPc8HSNM.mjs +4 -0
- package/dist/Firefox-AAHGJQIP--XXnd95e.mjs +4 -0
- package/dist/LabelSpacing.d.ts +8 -0
- package/dist/Linux-OO4TNCLJ-DjZl5oHj.mjs +4 -0
- package/dist/Macos-MW4AE7LN-DDrYwsGC.mjs +4 -0
- package/dist/MultichainErrorWrapper.d.ts +5 -0
- package/dist/MultichainHooks.d.ts +7 -0
- package/dist/MultichainStep.d.ts +4 -0
- package/dist/MultichainTheme.d.ts +23 -0
- package/dist/NumberInput.d.ts +13 -0
- package/dist/Opera-KQZLSACL-DhwRnyeO.mjs +4 -0
- package/dist/ProgressStatus.d.ts +9 -0
- package/dist/ProgressTracker.d.ts +8 -0
- package/dist/Router.d.ts +10 -0
- package/dist/Safari-ZPL37GXR-BJMyZNGk.mjs +4 -0
- package/dist/Select.d.ts +13 -0
- package/dist/SwapData.d.ts +8 -0
- package/dist/Tab1.d.ts +11 -0
- package/dist/Tab2.d.ts +13 -0
- package/dist/TextInput.d.ts +10 -0
- package/dist/Typography.d.ts +9 -0
- package/dist/Vertical.d.ts +7 -0
- package/dist/Windows-PPTHQER6-8DxONxME.mjs +4 -0
- package/dist/add-BaaFGpjE.mjs +19 -0
- package/dist/all-wallets-C4glPyDd.mjs +10 -0
- package/dist/apechain-SX5YFU6N-B6iVN2eI.mjs +4 -0
- package/dist/app-store-D83eAZij.mjs +21 -0
- package/dist/apple-D-am83__.mjs +22 -0
- package/dist/ar_AR-CTNWGWSS-B2yhhasT.mjs +1430 -0
- package/dist/arbitrum-WURIBY6W-C9umEuPP.mjs +4 -0
- package/dist/arrow-bottom-Br5TDvbL.mjs +12 -0
- package/dist/arrow-bottom-circle-DR_QyRKh.mjs +15 -0
- package/dist/arrow-left-DVYN58EU.mjs +12 -0
- package/dist/arrow-right-CyzEFMvr.mjs +12 -0
- package/dist/arrow-top-jqA3K6Zg.mjs +12 -0
- package/dist/assets-Q6ZU7ZJ5-DrI2eCWt.mjs +4 -0
- package/dist/avalanche-KOMJD3XY-BzTQlT3D.mjs +4 -0
- package/dist/bank-ByHNwpc3.mjs +18 -0
- package/dist/base-OAXLRA4F-zGysVgz6.mjs +4 -0
- package/dist/basic-CSosNPWM.mjs +5734 -0
- package/dist/berachain-NJECWIVC-CRQ0XjnA.mjs +4 -0
- package/dist/blast-V555OVXZ-DfAGOAm0.mjs +4 -0
- package/dist/browser-3VflZ6uC.mjs +308 -0
- package/dist/browser-ySWxlHoa.mjs +18 -0
- package/dist/bsc-N647EYR2-BZ1b_4BN.mjs +4 -0
- package/dist/card-CRN66uYO.mjs +18 -0
- package/dist/ccip-De2aDqcs.mjs +147 -0
- package/dist/celo-GEP4TUHG-DjaxM9On.mjs +4 -0
- package/dist/checkmark-B326mymW.mjs +15 -0
- package/dist/checkmark-bold-CZsJD2Gr.mjs +12 -0
- package/dist/chevron-bottom-DkZc5wTP.mjs +12 -0
- package/dist/chevron-left-o4mMwB-E.mjs +12 -0
- package/dist/chevron-right-DkxYecAn.mjs +12 -0
- package/dist/chevron-top-CmqtU-3t.mjs +12 -0
- package/dist/chrome-store-BiNhwxXr.mjs +65 -0
- package/dist/clock-Ca5tol9L.mjs +12 -0
- package/dist/close-DiXtNp7Z.mjs +12 -0
- package/dist/coinPlaceholder-3mnOUj7X.mjs +12 -0
- package/dist/coinbaseWallet-OKXU3TRC-5iCQMeiP.mjs +4 -0
- package/dist/compass-BeTMfz74.mjs +12 -0
- package/dist/connect-UA7M4XW6-of1DMMin.mjs +4 -0
- package/dist/copy-Dsf3uZQO.mjs +19 -0
- package/dist/core-C9zZKsa4.mjs +15268 -0
- package/dist/create-FASO7PVG-BFLB5t7x.mjs +4 -0
- package/dist/cronos-HJPAQTAE-CWSImNSf.mjs +4 -0
- package/dist/cursor-BdwdNQbq.mjs +7 -0
- package/dist/cursor-transparent-BQbUy-MI.mjs +16 -0
- package/dist/de_DE-P43L3PR7-CtO9uiNS.mjs +1430 -0
- package/dist/degen-FQQ4XGHB-DXAeLlGy.mjs +4 -0
- package/dist/desktop-CZMhBJFb.mjs +13 -0
- package/dist/disconnect-DLhBZUoq.mjs +12 -0
- package/dist/discord-CdM4DmVY.mjs +21 -0
- package/dist/en_US-RFN65H63-DaOvy-Ie.mjs +4 -0
- package/dist/es_419-JBX5FS3Q-hWy9nCEf.mjs +1430 -0
- package/dist/ethereum-RGGVA4PY-DxPcn0KS.mjs +4 -0
- package/dist/etherscan-DRQI7jsG.mjs +10 -0
- package/dist/events-BCEOhv4q.mjs +215 -0
- package/dist/exclamation-triangle-C5nhoqtz.mjs +8 -0
- package/dist/extension-aejRiJF7.mjs +12 -0
- package/dist/external-link-oWHbY6ff.mjs +12 -0
- package/dist/facebook-FUrhPDsl.mjs +30 -0
- package/dist/farcaster-fPZEqZwK.mjs +16 -0
- package/dist/filters-B1xTGafV.mjs +12 -0
- package/dist/flow-5FQJFCTK-CVfZv3to.mjs +4 -0
- package/dist/fr_FR-CM2EDAQC-B_30pesA.mjs +1430 -0
- package/dist/github-Dp4K2Czx.mjs +22 -0
- package/dist/gnosis-37ZC4RBL-xYLDpnHh.mjs +4 -0
- package/dist/google-ub7aEPpV.mjs +22 -0
- package/dist/gravity-J5YQHTYH-B97TrN9J.mjs +4 -0
- package/dist/hardhat-TX56IT5N-2KZA3GeI.mjs +4 -0
- package/dist/help-circle-BY3olasE.mjs +16 -0
- package/dist/hi_IN-GYVCUYRD-BaP4Kv7X.mjs +1430 -0
- package/dist/hooks.module-CsKUm6iL.mjs +487 -0
- package/dist/hyperevm-VKPAA4SA-C95vekJe.mjs +4 -0
- package/dist/id-CcbGN1gV.mjs +16 -0
- package/dist/id_ID-7ZWSMOOE-Dmml3uJR.mjs +1430 -0
- package/dist/image-D4ynYkwO.mjs +8 -0
- package/dist/index-5rNVG-X1.mjs +13987 -0
- package/dist/index-Bm8yUuPZ.mjs +1031 -0
- package/dist/index-CD3t4hnN.mjs +788 -0
- package/dist/index-CDBq6imb.mjs +9170 -0
- package/dist/index-CYj_i5FF.mjs +48 -0
- package/dist/index-Cm6VblFi.mjs +386 -0
- package/dist/index-CzXxUYUh.mjs +116342 -0
- package/dist/index-DhCSttFR.mjs +572 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.es-mDlOQVHq.mjs +11936 -0
- package/dist/info-DeimbgLd.mjs +7 -0
- package/dist/info-circle-CwTrbHls.mjs +16 -0
- package/dist/ink-FZMYZWHG-DlcClk5L.mjs +4 -0
- package/dist/ja_JP-CGMP6VLZ-k1qEQOBd.mjs +1430 -0
- package/dist/kaia-65D2U3PU-DJdIsERb.mjs +4 -0
- package/dist/ko_KR-YCZDTF7X-N5e302Ee.mjs +1430 -0
- package/dist/lightbulb-1S-xUrVG.mjs +7 -0
- package/dist/linea-QRMVQ5DY-CrycDmSa.mjs +4 -0
- package/dist/login-UP3DZBGS-BT9d537y.mjs +4 -0
- package/dist/mail-Bx6EPzBz.mjs +12 -0
- package/dist/manta-SI27YFEJ-CFctqJ5B.mjs +4 -0
- package/dist/mantle-CKIUT334-DZTIMdrF.mjs +4 -0
- package/dist/metaMaskWallet-SITXT2FV-CaDFha8m.mjs +4 -0
- package/dist/metamask-sdk-nVei8ADt.mjs +14679 -0
- package/dist/mobile-B8-sJxpC.mjs +13 -0
- package/dist/more-B6z1a_a4.mjs +15 -0
- package/dist/ms_MY-5LHAYMS7-DXUqJsVQ.mjs +1430 -0
- package/dist/multichain-widget.css +1 -0
- package/dist/multichain-widget.es.js +4 -0
- package/dist/multichain-widget.umd.js +53310 -0
- package/dist/network-placeholder-Q6vZ0clE.mjs +18 -0
- package/dist/nftPlaceholder-DaWpsRwT.mjs +12 -0
- package/dist/off-CoEljpqo.mjs +12 -0
- package/dist/optimism-HAF2GUT7-CDkFpVXG.mjs +4 -0
- package/dist/play-store-CwE3M0eU.mjs +36 -0
- package/dist/plus-1bFJ_g6P.mjs +17 -0
- package/dist/polygon-WW6ZI7PM-DMiAjxYW.mjs +4 -0
- package/dist/pt_BR-3JTS4PSK-BcqTSqXX.mjs +1430 -0
- package/dist/qr-code-tlhzSQ7q.mjs +10 -0
- package/dist/rainbowWallet-O26YNBMX-CB4dd0t7.mjs +4 -0
- package/dist/recycle-horizontal-DVabIaNj.mjs +13 -0
- package/dist/refresh-BEzHm0St.mjs +12 -0
- package/dist/refresh-S4T5V5GX-CoT4SMY4.mjs +4 -0
- package/dist/reown-logo-ZGeC-Zjq.mjs +16 -0
- package/dist/ronin-EMCPYXZT-CMqZm7Bj.mjs +4 -0
- package/dist/ru_RU-6J6XERHI-NHs582yY.mjs +1430 -0
- package/dist/safeWallet-5MNKTR5Z-ByPwRyZO.mjs +4 -0
- package/dist/sanko-RHQYXGM5-BdRCo3KT.mjs +4 -0
- package/dist/scan-4UYSQ56Q-Bt1XXdi3.mjs +4 -0
- package/dist/scroll-5OBGQVOV-C_cEm-kG.mjs +4 -0
- package/dist/search-BQm4fL3J.mjs +12 -0
- package/dist/secp256k1-CzCNdoTs.mjs +1509 -0
- package/dist/secp256k1-sIPbOTrM.mjs +1509 -0
- package/dist/send-B3VoVme5.mjs +19 -0
- package/dist/sign-A7IJEUT5-BQQmgNRT.mjs +4 -0
- package/dist/superposition-HG6MMR2Y-DHda4Hsd.mjs +4 -0
- package/dist/swapHorizontal-CX4jGdb-.mjs +12 -0
- package/dist/swapHorizontalBold-BOgCYVbo.mjs +12 -0
- package/dist/swapHorizontalMedium-DB47Xtfo.mjs +20 -0
- package/dist/swapHorizontalRoundedBold-DlQi9SKq.mjs +12 -0
- package/dist/swapVertical-0hWEwQ-0.mjs +12 -0
- package/dist/telegram-Cv_JwtKa.mjs +20 -0
- package/dist/th_TH-STXOD4CR-BIfWqO2o.mjs +1430 -0
- package/dist/three-dots-BB9sWThR.mjs +9 -0
- package/dist/tr_TR-P7QAUUZU-eG8PiHRZ.mjs +1430 -0
- package/dist/twitch-rc6Nwqz3.mjs +22 -0
- package/dist/twitterIcon-C0_NYbu8.mjs +10 -0
- package/dist/uk_UA-JTTBGJGQ-Dr7NKTT4.mjs +1430 -0
- package/dist/unichain-C5BWO2ZY-CgjeJfD4.mjs +4 -0
- package/dist/verify-DOiQmnqA.mjs +12 -0
- package/dist/verify-filled-BBBQPsk8.mjs +12 -0
- package/dist/vi_VN-5XUUAVWW-DDODReq8.mjs +1430 -0
- package/dist/w3m-modal-CJ9n0c2W.mjs +1457 -0
- package/dist/wallet-ERpC7VYY.mjs +12 -0
- package/dist/wallet-placeholder-ClAlPjuC.mjs +18 -0
- package/dist/walletConnectWallet-YHWKVTDY-DU_S15em.mjs +4 -0
- package/dist/walletconnect-np7_TJtf.mjs +36 -0
- package/dist/warning-circle-D-7HoIeW.mjs +16 -0
- package/dist/x-BS4s0iBO.mjs +16 -0
- package/dist/xdc-KJ3TDBYO-Ie58M8Vn.mjs +4 -0
- package/dist/zetachain-TLDS5IPW-CCJ72zNa.mjs +4 -0
- package/dist/zh_CN-RGMLPFEP-CTX3PM0F.mjs +1430 -0
- package/dist/zh_HK-YM3T6EI5-DZjb_17i.mjs +1430 -0
- package/dist/zh_TW-HAEH6VE5-BOq1c4Vl.mjs +1430 -0
- package/dist/zksync-DH7HK5U4-08fCIujK.mjs +4 -0
- package/dist/zora-FYL5H3IO-BoL7oY8W.mjs +4 -0
- package/package.json +45 -0
|
@@ -0,0 +1,788 @@
|
|
|
1
|
+
import { r as Se, o as we } from "./index-CzXxUYUh.mjs";
|
|
2
|
+
import { r as Pe } from "./index-DhCSttFR.mjs";
|
|
3
|
+
import { r as Te } from "./events-BCEOhv4q.mjs";
|
|
4
|
+
function Ce(e, u) {
|
|
5
|
+
for (var t = 0; t < u.length; t++) {
|
|
6
|
+
const h = u[t];
|
|
7
|
+
if (typeof h != "string" && !Array.isArray(h)) {
|
|
8
|
+
for (const r in h)
|
|
9
|
+
if (r !== "default" && !(r in e)) {
|
|
10
|
+
const a = Object.getOwnPropertyDescriptor(h, r);
|
|
11
|
+
a && Object.defineProperty(e, r, a.get ? a : {
|
|
12
|
+
enumerable: !0,
|
|
13
|
+
get: () => h[r]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
|
|
19
|
+
}
|
|
20
|
+
var N = {}, j = {}, p = {}, E = {}, v = {}, M = {}, q = {}, W;
|
|
21
|
+
function me() {
|
|
22
|
+
if (W) return q;
|
|
23
|
+
W = 1, Object.defineProperty(q, "__esModule", { value: !0 }), q.getSDKVersion = void 0;
|
|
24
|
+
const e = () => "9.1.0";
|
|
25
|
+
return q.getSDKVersion = e, q;
|
|
26
|
+
}
|
|
27
|
+
var O = {}, K;
|
|
28
|
+
function Re() {
|
|
29
|
+
if (K) return O;
|
|
30
|
+
K = 1, Object.defineProperty(O, "__esModule", { value: !0 }), O.generateRequestId = void 0;
|
|
31
|
+
const e = (h) => h.toString(16).padStart(2, "0"), u = (h) => {
|
|
32
|
+
const r = new Uint8Array(h / 2);
|
|
33
|
+
return window.crypto.getRandomValues(r), Array.from(r, e).join("");
|
|
34
|
+
}, t = () => typeof window < "u" ? u(10) : (/* @__PURE__ */ new Date()).getTime().toString(36);
|
|
35
|
+
return O.generateRequestId = t, O;
|
|
36
|
+
}
|
|
37
|
+
var J;
|
|
38
|
+
function pe() {
|
|
39
|
+
if (J) return M;
|
|
40
|
+
J = 1, Object.defineProperty(M, "__esModule", { value: !0 }), M.MessageFormatter = void 0;
|
|
41
|
+
const e = me(), u = Re();
|
|
42
|
+
class t {
|
|
43
|
+
}
|
|
44
|
+
return M.MessageFormatter = t, t.makeRequest = (h, r) => ({
|
|
45
|
+
id: (0, u.generateRequestId)(),
|
|
46
|
+
method: h,
|
|
47
|
+
params: r,
|
|
48
|
+
env: {
|
|
49
|
+
sdkVersion: (0, e.getSDKVersion)()
|
|
50
|
+
}
|
|
51
|
+
}), t.makeResponse = (h, r, a) => ({
|
|
52
|
+
id: h,
|
|
53
|
+
success: !0,
|
|
54
|
+
version: a,
|
|
55
|
+
data: r
|
|
56
|
+
}), t.makeErrorResponse = (h, r, a) => ({
|
|
57
|
+
id: h,
|
|
58
|
+
success: !1,
|
|
59
|
+
error: r,
|
|
60
|
+
version: a
|
|
61
|
+
}), M;
|
|
62
|
+
}
|
|
63
|
+
var b = {}, Q;
|
|
64
|
+
function C() {
|
|
65
|
+
if (Q) return b;
|
|
66
|
+
Q = 1, Object.defineProperty(b, "__esModule", { value: !0 }), b.RestrictedMethods = b.Methods = void 0;
|
|
67
|
+
var e;
|
|
68
|
+
(function(t) {
|
|
69
|
+
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";
|
|
70
|
+
})(e || (b.Methods = e = {}));
|
|
71
|
+
var u;
|
|
72
|
+
return (function(t) {
|
|
73
|
+
t.requestAddressBook = "requestAddressBook";
|
|
74
|
+
})(u || (b.RestrictedMethods = u = {})), b;
|
|
75
|
+
}
|
|
76
|
+
var X;
|
|
77
|
+
function Ee() {
|
|
78
|
+
return X || (X = 1, (function(e) {
|
|
79
|
+
var u = v && v.__createBinding || (Object.create ? (function(a, i, s, o) {
|
|
80
|
+
o === void 0 && (o = s);
|
|
81
|
+
var d = Object.getOwnPropertyDescriptor(i, s);
|
|
82
|
+
(!d || ("get" in d ? !i.__esModule : d.writable || d.configurable)) && (d = { enumerable: !0, get: function() {
|
|
83
|
+
return i[s];
|
|
84
|
+
} }), Object.defineProperty(a, o, d);
|
|
85
|
+
}) : (function(a, i, s, o) {
|
|
86
|
+
o === void 0 && (o = s), a[o] = i[s];
|
|
87
|
+
})), t = v && v.__exportStar || function(a, i) {
|
|
88
|
+
for (var s in a) s !== "default" && !Object.prototype.hasOwnProperty.call(i, s) && u(i, a, s);
|
|
89
|
+
};
|
|
90
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
91
|
+
const h = pe();
|
|
92
|
+
class r {
|
|
93
|
+
constructor(i = null, s = !1) {
|
|
94
|
+
this.allowedOrigins = null, this.callbacks = /* @__PURE__ */ new Map(), this.debugMode = !1, this.isServer = typeof window > "u", this.isValidMessage = ({ origin: o, data: d, source: n }) => {
|
|
95
|
+
const g = !d, c = !this.isServer && n === window.parent, l = typeof d.version < "u" && parseInt(d.version.split(".")[0]), f = typeof l == "number" && l >= 1;
|
|
96
|
+
let _ = !0;
|
|
97
|
+
return Array.isArray(this.allowedOrigins) && (_ = this.allowedOrigins.find((m) => m.test(o)) !== void 0), !g && c && f && _;
|
|
98
|
+
}, this.logIncomingMessage = (o) => {
|
|
99
|
+
console.info(`Safe Apps SDK v1: A message was received from origin ${o.origin}. `, o.data);
|
|
100
|
+
}, this.onParentMessage = (o) => {
|
|
101
|
+
this.isValidMessage(o) && (this.debugMode && this.logIncomingMessage(o), this.handleIncomingMessage(o.data));
|
|
102
|
+
}, this.handleIncomingMessage = (o) => {
|
|
103
|
+
const { id: d } = o, n = this.callbacks.get(d);
|
|
104
|
+
n && (n(o), this.callbacks.delete(d));
|
|
105
|
+
}, this.send = (o, d) => {
|
|
106
|
+
const n = h.MessageFormatter.makeRequest(o, d);
|
|
107
|
+
if (this.isServer)
|
|
108
|
+
throw new Error("Window doesn't exist");
|
|
109
|
+
return window.parent.postMessage(n, "*"), new Promise((g, c) => {
|
|
110
|
+
this.callbacks.set(n.id, (l) => {
|
|
111
|
+
if (!l.success) {
|
|
112
|
+
c(new Error(l.error));
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
g(l);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
}, this.allowedOrigins = i, this.debugMode = s, this.isServer || window.addEventListener("message", this.onParentMessage);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
e.default = r, t(C(), e);
|
|
122
|
+
})(v)), v;
|
|
123
|
+
}
|
|
124
|
+
var I = {}, S = {}, A = {}, Y;
|
|
125
|
+
function je() {
|
|
126
|
+
if (Y) return A;
|
|
127
|
+
Y = 1, Object.defineProperty(A, "__esModule", { value: !0 }), A.isObjectEIP712TypedData = void 0;
|
|
128
|
+
const e = (u) => typeof u == "object" && u != null && "domain" in u && "types" in u && "message" in u;
|
|
129
|
+
return A.isObjectEIP712TypedData = e, A;
|
|
130
|
+
}
|
|
131
|
+
var V = {}, z;
|
|
132
|
+
function Me() {
|
|
133
|
+
return z || (z = 1, Object.defineProperty(V, "__esModule", { value: !0 })), V;
|
|
134
|
+
}
|
|
135
|
+
var U = {}, Z;
|
|
136
|
+
function qe() {
|
|
137
|
+
return Z || (Z = 1, (function(e) {
|
|
138
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.TransferDirection = e.TransactionStatus = e.TokenType = e.Operation = void 0;
|
|
139
|
+
var u = Pe();
|
|
140
|
+
Object.defineProperty(e, "Operation", { enumerable: !0, get: function() {
|
|
141
|
+
return u.Operation;
|
|
142
|
+
} }), Object.defineProperty(e, "TokenType", { enumerable: !0, get: function() {
|
|
143
|
+
return u.TokenType;
|
|
144
|
+
} }), Object.defineProperty(e, "TransactionStatus", { enumerable: !0, get: function() {
|
|
145
|
+
return u.TransactionStatus;
|
|
146
|
+
} }), Object.defineProperty(e, "TransferDirection", { enumerable: !0, get: function() {
|
|
147
|
+
return u.TransferDirection;
|
|
148
|
+
} });
|
|
149
|
+
})(U)), U;
|
|
150
|
+
}
|
|
151
|
+
var G = {}, ee;
|
|
152
|
+
function Oe() {
|
|
153
|
+
return ee || (ee = 1, Object.defineProperty(G, "__esModule", { value: !0 }), C()), G;
|
|
154
|
+
}
|
|
155
|
+
var te;
|
|
156
|
+
function F() {
|
|
157
|
+
return te || (te = 1, (function(e) {
|
|
158
|
+
var u = S && S.__createBinding || (Object.create ? (function(h, r, a, i) {
|
|
159
|
+
i === void 0 && (i = a);
|
|
160
|
+
var s = Object.getOwnPropertyDescriptor(r, a);
|
|
161
|
+
(!s || ("get" in s ? !r.__esModule : s.writable || s.configurable)) && (s = { enumerable: !0, get: function() {
|
|
162
|
+
return r[a];
|
|
163
|
+
} }), Object.defineProperty(h, i, s);
|
|
164
|
+
}) : (function(h, r, a, i) {
|
|
165
|
+
i === void 0 && (i = a), h[i] = r[a];
|
|
166
|
+
})), t = S && S.__exportStar || function(h, r) {
|
|
167
|
+
for (var a in h) a !== "default" && !Object.prototype.hasOwnProperty.call(r, a) && u(r, h, a);
|
|
168
|
+
};
|
|
169
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), t(je(), e), t(Me(), e), t(qe(), e), t(Oe(), e);
|
|
170
|
+
})(S)), S;
|
|
171
|
+
}
|
|
172
|
+
var se;
|
|
173
|
+
function Ie() {
|
|
174
|
+
if (se) return I;
|
|
175
|
+
se = 1, Object.defineProperty(I, "__esModule", { value: !0 }), I.TXs = void 0;
|
|
176
|
+
const e = C(), u = F();
|
|
177
|
+
class t {
|
|
178
|
+
constructor(r) {
|
|
179
|
+
this.communicator = r;
|
|
180
|
+
}
|
|
181
|
+
async getBySafeTxHash(r) {
|
|
182
|
+
if (!r)
|
|
183
|
+
throw new Error("Invalid safeTxHash");
|
|
184
|
+
return (await this.communicator.send(e.Methods.getTxBySafeTxHash, { safeTxHash: r })).data;
|
|
185
|
+
}
|
|
186
|
+
async signMessage(r) {
|
|
187
|
+
const a = {
|
|
188
|
+
message: r
|
|
189
|
+
};
|
|
190
|
+
return (await this.communicator.send(e.Methods.signMessage, a)).data;
|
|
191
|
+
}
|
|
192
|
+
async signTypedMessage(r) {
|
|
193
|
+
if (!(0, u.isObjectEIP712TypedData)(r))
|
|
194
|
+
throw new Error("Invalid typed data");
|
|
195
|
+
return (await this.communicator.send(e.Methods.signTypedMessage, { typedData: r })).data;
|
|
196
|
+
}
|
|
197
|
+
async send({ txs: r, params: a }) {
|
|
198
|
+
if (!r || !r.length)
|
|
199
|
+
throw new Error("No transactions were passed");
|
|
200
|
+
const i = {
|
|
201
|
+
txs: r,
|
|
202
|
+
params: a
|
|
203
|
+
};
|
|
204
|
+
return (await this.communicator.send(e.Methods.sendTransactions, i)).data;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return I.TXs = t, I;
|
|
208
|
+
}
|
|
209
|
+
var B = {}, x = {}, re;
|
|
210
|
+
function $() {
|
|
211
|
+
return re || (re = 1, Object.defineProperty(x, "__esModule", { value: !0 }), x.RPC_CALLS = void 0, x.RPC_CALLS = {
|
|
212
|
+
eth_call: "eth_call",
|
|
213
|
+
eth_gasPrice: "eth_gasPrice",
|
|
214
|
+
eth_getLogs: "eth_getLogs",
|
|
215
|
+
eth_getBalance: "eth_getBalance",
|
|
216
|
+
eth_getCode: "eth_getCode",
|
|
217
|
+
eth_getBlockByHash: "eth_getBlockByHash",
|
|
218
|
+
eth_getBlockByNumber: "eth_getBlockByNumber",
|
|
219
|
+
eth_getStorageAt: "eth_getStorageAt",
|
|
220
|
+
eth_getTransactionByHash: "eth_getTransactionByHash",
|
|
221
|
+
eth_getTransactionReceipt: "eth_getTransactionReceipt",
|
|
222
|
+
eth_getTransactionCount: "eth_getTransactionCount",
|
|
223
|
+
eth_estimateGas: "eth_estimateGas",
|
|
224
|
+
safe_setSettings: "safe_setSettings"
|
|
225
|
+
}), x;
|
|
226
|
+
}
|
|
227
|
+
var ae;
|
|
228
|
+
function Ae() {
|
|
229
|
+
if (ae) return B;
|
|
230
|
+
ae = 1, Object.defineProperty(B, "__esModule", { value: !0 }), B.Eth = void 0;
|
|
231
|
+
const e = $(), u = C(), t = {
|
|
232
|
+
defaultBlockParam: (r = "latest") => r,
|
|
233
|
+
returnFullTxObjectParam: (r = !1) => r,
|
|
234
|
+
blockNumberToHex: (r) => Number.isInteger(r) ? `0x${r.toString(16)}` : r
|
|
235
|
+
};
|
|
236
|
+
class h {
|
|
237
|
+
constructor(a) {
|
|
238
|
+
this.communicator = a, this.call = this.buildRequest({
|
|
239
|
+
call: e.RPC_CALLS.eth_call,
|
|
240
|
+
formatters: [null, t.defaultBlockParam]
|
|
241
|
+
}), this.getBalance = this.buildRequest({
|
|
242
|
+
call: e.RPC_CALLS.eth_getBalance,
|
|
243
|
+
formatters: [null, t.defaultBlockParam]
|
|
244
|
+
}), this.getCode = this.buildRequest({
|
|
245
|
+
call: e.RPC_CALLS.eth_getCode,
|
|
246
|
+
formatters: [null, t.defaultBlockParam]
|
|
247
|
+
}), this.getStorageAt = this.buildRequest({
|
|
248
|
+
call: e.RPC_CALLS.eth_getStorageAt,
|
|
249
|
+
formatters: [null, t.blockNumberToHex, t.defaultBlockParam]
|
|
250
|
+
}), this.getPastLogs = this.buildRequest({
|
|
251
|
+
call: e.RPC_CALLS.eth_getLogs
|
|
252
|
+
}), this.getBlockByHash = this.buildRequest({
|
|
253
|
+
call: e.RPC_CALLS.eth_getBlockByHash,
|
|
254
|
+
formatters: [null, t.returnFullTxObjectParam]
|
|
255
|
+
}), this.getBlockByNumber = this.buildRequest({
|
|
256
|
+
call: e.RPC_CALLS.eth_getBlockByNumber,
|
|
257
|
+
formatters: [t.blockNumberToHex, t.returnFullTxObjectParam]
|
|
258
|
+
}), this.getTransactionByHash = this.buildRequest({
|
|
259
|
+
call: e.RPC_CALLS.eth_getTransactionByHash
|
|
260
|
+
}), this.getTransactionReceipt = this.buildRequest({
|
|
261
|
+
call: e.RPC_CALLS.eth_getTransactionReceipt
|
|
262
|
+
}), this.getTransactionCount = this.buildRequest({
|
|
263
|
+
call: e.RPC_CALLS.eth_getTransactionCount,
|
|
264
|
+
formatters: [null, t.defaultBlockParam]
|
|
265
|
+
}), this.getGasPrice = this.buildRequest({
|
|
266
|
+
call: e.RPC_CALLS.eth_gasPrice
|
|
267
|
+
}), this.getEstimateGas = (i) => this.buildRequest({
|
|
268
|
+
call: e.RPC_CALLS.eth_estimateGas
|
|
269
|
+
})([i]), this.setSafeSettings = this.buildRequest({
|
|
270
|
+
call: e.RPC_CALLS.safe_setSettings
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
buildRequest(a) {
|
|
274
|
+
const { call: i, formatters: s } = a;
|
|
275
|
+
return async (o) => {
|
|
276
|
+
s && Array.isArray(o) && s.forEach((g, c) => {
|
|
277
|
+
g && (o[c] = g(o[c]));
|
|
278
|
+
});
|
|
279
|
+
const d = {
|
|
280
|
+
call: i,
|
|
281
|
+
params: o || []
|
|
282
|
+
};
|
|
283
|
+
return (await this.communicator.send(u.Methods.rpcCall, d)).data;
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return B.Eth = h, B;
|
|
288
|
+
}
|
|
289
|
+
var y = {}, w = {}, ne;
|
|
290
|
+
function Be() {
|
|
291
|
+
if (ne) return w;
|
|
292
|
+
ne = 1, Object.defineProperty(w, "__esModule", { value: !0 }), w.MAGIC_VALUE_BYTES = w.MAGIC_VALUE = void 0;
|
|
293
|
+
const e = "0x1626ba7e";
|
|
294
|
+
w.MAGIC_VALUE = e;
|
|
295
|
+
const u = "0x20c13b0b";
|
|
296
|
+
return w.MAGIC_VALUE_BYTES = u, w;
|
|
297
|
+
}
|
|
298
|
+
var H = {}, k = {}, P = {}, ie;
|
|
299
|
+
function ye() {
|
|
300
|
+
if (ie) return P;
|
|
301
|
+
ie = 1, Object.defineProperty(P, "__esModule", { value: !0 }), P.PermissionsError = P.PERMISSIONS_REQUEST_REJECTED = void 0, P.PERMISSIONS_REQUEST_REJECTED = 4001;
|
|
302
|
+
class e extends Error {
|
|
303
|
+
constructor(t, h, r) {
|
|
304
|
+
super(t), this.code = h, this.data = r, Object.setPrototypeOf(this, e.prototype);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return P.PermissionsError = e, P;
|
|
308
|
+
}
|
|
309
|
+
var oe;
|
|
310
|
+
function ve() {
|
|
311
|
+
if (oe) return k;
|
|
312
|
+
oe = 1, Object.defineProperty(k, "__esModule", { value: !0 }), k.Wallet = void 0;
|
|
313
|
+
const e = C(), u = ye();
|
|
314
|
+
class t {
|
|
315
|
+
constructor(r) {
|
|
316
|
+
this.communicator = r;
|
|
317
|
+
}
|
|
318
|
+
async getPermissions() {
|
|
319
|
+
return (await this.communicator.send(e.Methods.wallet_getPermissions, void 0)).data;
|
|
320
|
+
}
|
|
321
|
+
async requestPermissions(r) {
|
|
322
|
+
if (!this.isPermissionRequestValid(r))
|
|
323
|
+
throw new u.PermissionsError("Permissions request is invalid", u.PERMISSIONS_REQUEST_REJECTED);
|
|
324
|
+
try {
|
|
325
|
+
return (await this.communicator.send(e.Methods.wallet_requestPermissions, r)).data;
|
|
326
|
+
} catch {
|
|
327
|
+
throw new u.PermissionsError("Permissions rejected", u.PERMISSIONS_REQUEST_REJECTED);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
isPermissionRequestValid(r) {
|
|
331
|
+
return r.every((a) => typeof a == "object" ? Object.keys(a).every((i) => !!Object.values(e.RestrictedMethods).includes(i)) : !1);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return k.Wallet = t, k;
|
|
335
|
+
}
|
|
336
|
+
var ue;
|
|
337
|
+
function xe() {
|
|
338
|
+
if (ue) return H;
|
|
339
|
+
ue = 1, Object.defineProperty(H, "__esModule", { value: !0 });
|
|
340
|
+
const e = ve(), u = ye(), t = (r, a) => a.some((i) => i.parentCapability === r), h = () => (r, a, i) => {
|
|
341
|
+
const s = i.value;
|
|
342
|
+
return i.value = async function() {
|
|
343
|
+
const o = new e.Wallet(this.communicator);
|
|
344
|
+
let d = await o.getPermissions();
|
|
345
|
+
if (t(a, d) || (d = await o.requestPermissions([{ [a]: {} }])), !t(a, d))
|
|
346
|
+
throw new u.PermissionsError("Permissions rejected", u.PERMISSIONS_REQUEST_REJECTED);
|
|
347
|
+
return s.apply(this);
|
|
348
|
+
}, i;
|
|
349
|
+
};
|
|
350
|
+
return H.default = h, H;
|
|
351
|
+
}
|
|
352
|
+
var ce;
|
|
353
|
+
function ke() {
|
|
354
|
+
if (ce) return y;
|
|
355
|
+
ce = 1;
|
|
356
|
+
var e = y && y.__decorate || function(d, n, g, c) {
|
|
357
|
+
var l = arguments.length, f = l < 3 ? n : c === null ? c = Object.getOwnPropertyDescriptor(n, g) : c, _;
|
|
358
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") f = Reflect.decorate(d, n, g, c);
|
|
359
|
+
else for (var m = d.length - 1; m >= 0; m--) (_ = d[m]) && (f = (l < 3 ? _(f) : l > 3 ? _(n, g, f) : _(n, g)) || f);
|
|
360
|
+
return l > 3 && f && Object.defineProperty(n, g, f), f;
|
|
361
|
+
}, u = y && y.__importDefault || function(d) {
|
|
362
|
+
return d && d.__esModule ? d : { default: d };
|
|
363
|
+
};
|
|
364
|
+
Object.defineProperty(y, "__esModule", { value: !0 }), y.Safe = void 0;
|
|
365
|
+
const t = /* @__PURE__ */ Se(), h = Be(), r = C(), a = $(), i = F(), s = u(xe());
|
|
366
|
+
class o {
|
|
367
|
+
constructor(n) {
|
|
368
|
+
this.communicator = n;
|
|
369
|
+
}
|
|
370
|
+
async getChainInfo() {
|
|
371
|
+
return (await this.communicator.send(r.Methods.getChainInfo, void 0)).data;
|
|
372
|
+
}
|
|
373
|
+
async getInfo() {
|
|
374
|
+
return (await this.communicator.send(r.Methods.getSafeInfo, void 0)).data;
|
|
375
|
+
}
|
|
376
|
+
// There is a possibility that this method will change because we may add pagination to the endpoint
|
|
377
|
+
async experimental_getBalances({ currency: n = "usd" } = {}) {
|
|
378
|
+
return (await this.communicator.send(r.Methods.getSafeBalances, {
|
|
379
|
+
currency: n
|
|
380
|
+
})).data;
|
|
381
|
+
}
|
|
382
|
+
async check1271Signature(n, g = "0x") {
|
|
383
|
+
const c = await this.getInfo(), l = (0, t.encodeFunctionData)({
|
|
384
|
+
abi: [
|
|
385
|
+
{
|
|
386
|
+
constant: !1,
|
|
387
|
+
inputs: [
|
|
388
|
+
{
|
|
389
|
+
name: "_dataHash",
|
|
390
|
+
type: "bytes32"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
name: "_signature",
|
|
394
|
+
type: "bytes"
|
|
395
|
+
}
|
|
396
|
+
],
|
|
397
|
+
name: "isValidSignature",
|
|
398
|
+
outputs: [
|
|
399
|
+
{
|
|
400
|
+
name: "",
|
|
401
|
+
type: "bytes4"
|
|
402
|
+
}
|
|
403
|
+
],
|
|
404
|
+
payable: !1,
|
|
405
|
+
stateMutability: "nonpayable",
|
|
406
|
+
type: "function"
|
|
407
|
+
}
|
|
408
|
+
],
|
|
409
|
+
functionName: "isValidSignature",
|
|
410
|
+
args: [n, g]
|
|
411
|
+
}), f = {
|
|
412
|
+
call: a.RPC_CALLS.eth_call,
|
|
413
|
+
params: [
|
|
414
|
+
{
|
|
415
|
+
to: c.safeAddress,
|
|
416
|
+
data: l
|
|
417
|
+
},
|
|
418
|
+
"latest"
|
|
419
|
+
]
|
|
420
|
+
};
|
|
421
|
+
try {
|
|
422
|
+
return (await this.communicator.send(r.Methods.rpcCall, f)).data.slice(0, 10).toLowerCase() === h.MAGIC_VALUE;
|
|
423
|
+
} catch {
|
|
424
|
+
return !1;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
async check1271SignatureBytes(n, g = "0x") {
|
|
428
|
+
const c = await this.getInfo(), l = (0, t.encodeFunctionData)({
|
|
429
|
+
abi: [
|
|
430
|
+
{
|
|
431
|
+
constant: !1,
|
|
432
|
+
inputs: [
|
|
433
|
+
{
|
|
434
|
+
name: "_data",
|
|
435
|
+
type: "bytes"
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
name: "_signature",
|
|
439
|
+
type: "bytes"
|
|
440
|
+
}
|
|
441
|
+
],
|
|
442
|
+
name: "isValidSignature",
|
|
443
|
+
outputs: [
|
|
444
|
+
{
|
|
445
|
+
name: "",
|
|
446
|
+
type: "bytes4"
|
|
447
|
+
}
|
|
448
|
+
],
|
|
449
|
+
payable: !1,
|
|
450
|
+
stateMutability: "nonpayable",
|
|
451
|
+
type: "function"
|
|
452
|
+
}
|
|
453
|
+
],
|
|
454
|
+
functionName: "isValidSignature",
|
|
455
|
+
args: [n, g]
|
|
456
|
+
}), f = {
|
|
457
|
+
call: a.RPC_CALLS.eth_call,
|
|
458
|
+
params: [
|
|
459
|
+
{
|
|
460
|
+
to: c.safeAddress,
|
|
461
|
+
data: l
|
|
462
|
+
},
|
|
463
|
+
"latest"
|
|
464
|
+
]
|
|
465
|
+
};
|
|
466
|
+
try {
|
|
467
|
+
return (await this.communicator.send(r.Methods.rpcCall, f)).data.slice(0, 10).toLowerCase() === h.MAGIC_VALUE_BYTES;
|
|
468
|
+
} catch {
|
|
469
|
+
return !1;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
calculateMessageHash(n) {
|
|
473
|
+
return (0, t.hashMessage)(n);
|
|
474
|
+
}
|
|
475
|
+
calculateTypedMessageHash(n) {
|
|
476
|
+
const g = typeof n.domain.chainId == "object" ? n.domain.chainId.toNumber() : Number(n.domain.chainId);
|
|
477
|
+
let c = n.primaryType;
|
|
478
|
+
if (!c) {
|
|
479
|
+
const l = Object.values(n.types), f = Object.keys(n.types).filter((_) => l.every((m) => m.every(({ type: L }) => L.replace("[", "").replace("]", "") !== _)));
|
|
480
|
+
if (f.length === 0 || f.length > 1)
|
|
481
|
+
throw new Error("Please specify primaryType");
|
|
482
|
+
c = f[0];
|
|
483
|
+
}
|
|
484
|
+
return (0, t.hashTypedData)({
|
|
485
|
+
message: n.message,
|
|
486
|
+
domain: {
|
|
487
|
+
...n.domain,
|
|
488
|
+
chainId: g,
|
|
489
|
+
verifyingContract: n.domain.verifyingContract,
|
|
490
|
+
salt: n.domain.salt
|
|
491
|
+
},
|
|
492
|
+
types: n.types,
|
|
493
|
+
primaryType: c
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
async getOffChainSignature(n) {
|
|
497
|
+
return (await this.communicator.send(r.Methods.getOffChainSignature, n)).data;
|
|
498
|
+
}
|
|
499
|
+
async isMessageSigned(n, g = "0x") {
|
|
500
|
+
let c;
|
|
501
|
+
if (typeof n == "string" && (c = async () => {
|
|
502
|
+
const l = this.calculateMessageHash(n);
|
|
503
|
+
return await this.isMessageHashSigned(l, g);
|
|
504
|
+
}), (0, i.isObjectEIP712TypedData)(n) && (c = async () => {
|
|
505
|
+
const l = this.calculateTypedMessageHash(n);
|
|
506
|
+
return await this.isMessageHashSigned(l, g);
|
|
507
|
+
}), c)
|
|
508
|
+
return await c();
|
|
509
|
+
throw new Error("Invalid message type");
|
|
510
|
+
}
|
|
511
|
+
async isMessageHashSigned(n, g = "0x") {
|
|
512
|
+
const c = [this.check1271Signature.bind(this), this.check1271SignatureBytes.bind(this)];
|
|
513
|
+
for (const l of c)
|
|
514
|
+
if (await l(n, g))
|
|
515
|
+
return !0;
|
|
516
|
+
return !1;
|
|
517
|
+
}
|
|
518
|
+
async getEnvironmentInfo() {
|
|
519
|
+
return (await this.communicator.send(r.Methods.getEnvironmentInfo, void 0)).data;
|
|
520
|
+
}
|
|
521
|
+
async requestAddressBook() {
|
|
522
|
+
return (await this.communicator.send(r.Methods.requestAddressBook, void 0)).data;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
return y.Safe = o, e([
|
|
526
|
+
(0, s.default)()
|
|
527
|
+
], o.prototype, "requestAddressBook", null), y;
|
|
528
|
+
}
|
|
529
|
+
var de;
|
|
530
|
+
function le() {
|
|
531
|
+
if (de) return E;
|
|
532
|
+
de = 1;
|
|
533
|
+
var e = E && E.__importDefault || function(s) {
|
|
534
|
+
return s && s.__esModule ? s : { default: s };
|
|
535
|
+
};
|
|
536
|
+
Object.defineProperty(E, "__esModule", { value: !0 });
|
|
537
|
+
const u = e(Ee()), t = Ie(), h = Ae(), r = ke(), a = ve();
|
|
538
|
+
class i {
|
|
539
|
+
constructor(o = {}) {
|
|
540
|
+
const { allowedDomains: d = null, debug: n = !1 } = o;
|
|
541
|
+
this.communicator = new u.default(d, n), this.eth = new h.Eth(this.communicator), this.txs = new t.TXs(this.communicator), this.safe = new r.Safe(this.communicator), this.wallet = new a.Wallet(this.communicator);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
return E.default = i, E;
|
|
545
|
+
}
|
|
546
|
+
var he;
|
|
547
|
+
function Le() {
|
|
548
|
+
return he || (he = 1, (function(e) {
|
|
549
|
+
var u = p && p.__createBinding || (Object.create ? (function(i, s, o, d) {
|
|
550
|
+
d === void 0 && (d = o);
|
|
551
|
+
var n = Object.getOwnPropertyDescriptor(s, o);
|
|
552
|
+
(!n || ("get" in n ? !s.__esModule : n.writable || n.configurable)) && (n = { enumerable: !0, get: function() {
|
|
553
|
+
return s[o];
|
|
554
|
+
} }), Object.defineProperty(i, d, n);
|
|
555
|
+
}) : (function(i, s, o, d) {
|
|
556
|
+
d === void 0 && (d = o), i[d] = s[o];
|
|
557
|
+
})), t = p && p.__exportStar || function(i, s) {
|
|
558
|
+
for (var o in i) o !== "default" && !Object.prototype.hasOwnProperty.call(s, o) && u(s, i, o);
|
|
559
|
+
}, h = p && p.__importDefault || function(i) {
|
|
560
|
+
return i && i.__esModule ? i : { default: i };
|
|
561
|
+
};
|
|
562
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.getSDKVersion = void 0;
|
|
563
|
+
const r = h(le());
|
|
564
|
+
e.default = r.default, t(le(), e), t(F(), e), t(C(), e), t(pe(), e);
|
|
565
|
+
var a = me();
|
|
566
|
+
Object.defineProperty(e, "getSDKVersion", { enumerable: !0, get: function() {
|
|
567
|
+
return a.getSDKVersion;
|
|
568
|
+
} }), t($(), e);
|
|
569
|
+
})(p)), p;
|
|
570
|
+
}
|
|
571
|
+
var T = {}, fe;
|
|
572
|
+
function He() {
|
|
573
|
+
if (fe) return T;
|
|
574
|
+
fe = 1, Object.defineProperty(T, "__esModule", { value: !0 }), T.numberToHex = T.getLowerCase = void 0;
|
|
575
|
+
function e(t) {
|
|
576
|
+
return t && t.toLowerCase();
|
|
577
|
+
}
|
|
578
|
+
T.getLowerCase = e;
|
|
579
|
+
function u(t) {
|
|
580
|
+
return `0x${t.toString(16)}`;
|
|
581
|
+
}
|
|
582
|
+
return T.numberToHex = u, T;
|
|
583
|
+
}
|
|
584
|
+
var ge;
|
|
585
|
+
function De() {
|
|
586
|
+
if (ge) return j;
|
|
587
|
+
ge = 1, Object.defineProperty(j, "__esModule", { value: !0 }), j.SafeAppProvider = void 0;
|
|
588
|
+
const e = /* @__PURE__ */ Le(), u = Te(), t = /* @__PURE__ */ He();
|
|
589
|
+
class h extends u.EventEmitter {
|
|
590
|
+
constructor(a, i) {
|
|
591
|
+
super(), this.submittedTxs = /* @__PURE__ */ new Map(), this.safe = a, this.sdk = i;
|
|
592
|
+
}
|
|
593
|
+
async connect() {
|
|
594
|
+
this.emit("connect", { chainId: this.chainId });
|
|
595
|
+
}
|
|
596
|
+
async disconnect() {
|
|
597
|
+
}
|
|
598
|
+
get chainId() {
|
|
599
|
+
return this.safe.chainId;
|
|
600
|
+
}
|
|
601
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
602
|
+
async request(a) {
|
|
603
|
+
const { method: i, params: s = [] } = a;
|
|
604
|
+
switch (i) {
|
|
605
|
+
case "eth_accounts":
|
|
606
|
+
return [this.safe.safeAddress];
|
|
607
|
+
case "net_version":
|
|
608
|
+
case "eth_chainId":
|
|
609
|
+
return (0, t.numberToHex)(this.chainId);
|
|
610
|
+
case "personal_sign": {
|
|
611
|
+
const [c, l] = s;
|
|
612
|
+
if (this.safe.safeAddress.toLowerCase() !== l.toLowerCase())
|
|
613
|
+
throw new Error("The address or message hash is invalid");
|
|
614
|
+
const f = await this.sdk.txs.signMessage(c);
|
|
615
|
+
return ("signature" in f ? f.signature : void 0) || "0x";
|
|
616
|
+
}
|
|
617
|
+
case "eth_sign": {
|
|
618
|
+
const [c, l] = s;
|
|
619
|
+
if (this.safe.safeAddress.toLowerCase() !== c.toLowerCase() || !l.startsWith("0x"))
|
|
620
|
+
throw new Error("The address or message hash is invalid");
|
|
621
|
+
const f = await this.sdk.txs.signMessage(l);
|
|
622
|
+
return ("signature" in f ? f.signature : void 0) || "0x";
|
|
623
|
+
}
|
|
624
|
+
case "eth_signTypedData":
|
|
625
|
+
case "eth_signTypedData_v4": {
|
|
626
|
+
const [c, l] = s, f = typeof l == "string" ? JSON.parse(l) : l;
|
|
627
|
+
if (this.safe.safeAddress.toLowerCase() !== c.toLowerCase())
|
|
628
|
+
throw new Error("The address is invalid");
|
|
629
|
+
const _ = await this.sdk.txs.signTypedMessage(f);
|
|
630
|
+
return ("signature" in _ ? _.signature : void 0) || "0x";
|
|
631
|
+
}
|
|
632
|
+
case "eth_sendTransaction":
|
|
633
|
+
const o = {
|
|
634
|
+
...s[0],
|
|
635
|
+
value: s[0].value || "0",
|
|
636
|
+
data: s[0].data || "0x"
|
|
637
|
+
};
|
|
638
|
+
typeof o.gas == "string" && o.gas.startsWith("0x") && (o.gas = parseInt(o.gas, 16));
|
|
639
|
+
const d = await this.sdk.txs.send({
|
|
640
|
+
txs: [o],
|
|
641
|
+
params: { safeTxGas: o.gas }
|
|
642
|
+
});
|
|
643
|
+
return this.submittedTxs.set(d.safeTxHash, {
|
|
644
|
+
from: this.safe.safeAddress,
|
|
645
|
+
hash: d.safeTxHash,
|
|
646
|
+
gas: 0,
|
|
647
|
+
gasPrice: "0x00",
|
|
648
|
+
nonce: 0,
|
|
649
|
+
input: o.data,
|
|
650
|
+
value: o.value,
|
|
651
|
+
to: o.to,
|
|
652
|
+
blockHash: null,
|
|
653
|
+
blockNumber: null,
|
|
654
|
+
transactionIndex: null
|
|
655
|
+
}), d.safeTxHash;
|
|
656
|
+
case "eth_blockNumber":
|
|
657
|
+
return (await this.sdk.eth.getBlockByNumber(["latest"])).number;
|
|
658
|
+
case "eth_getBalance":
|
|
659
|
+
return this.sdk.eth.getBalance([(0, t.getLowerCase)(s[0]), s[1]]);
|
|
660
|
+
case "eth_getCode":
|
|
661
|
+
return this.sdk.eth.getCode([(0, t.getLowerCase)(s[0]), s[1]]);
|
|
662
|
+
case "eth_getTransactionCount":
|
|
663
|
+
return this.sdk.eth.getTransactionCount([(0, t.getLowerCase)(s[0]), s[1]]);
|
|
664
|
+
case "eth_getStorageAt":
|
|
665
|
+
return this.sdk.eth.getStorageAt([(0, t.getLowerCase)(s[0]), s[1], s[2]]);
|
|
666
|
+
case "eth_getBlockByNumber":
|
|
667
|
+
return this.sdk.eth.getBlockByNumber([s[0], s[1]]);
|
|
668
|
+
case "eth_getBlockByHash":
|
|
669
|
+
return this.sdk.eth.getBlockByHash([s[0], s[1]]);
|
|
670
|
+
case "eth_getTransactionByHash":
|
|
671
|
+
let g = s[0];
|
|
672
|
+
try {
|
|
673
|
+
g = (await this.sdk.txs.getBySafeTxHash(g)).txHash || g;
|
|
674
|
+
} catch {
|
|
675
|
+
}
|
|
676
|
+
return this.submittedTxs.has(g) ? this.submittedTxs.get(g) : this.sdk.eth.getTransactionByHash([g]).then((c) => (c && (c.hash = s[0]), c));
|
|
677
|
+
case "eth_getTransactionReceipt": {
|
|
678
|
+
let c = s[0];
|
|
679
|
+
try {
|
|
680
|
+
c = (await this.sdk.txs.getBySafeTxHash(c)).txHash || c;
|
|
681
|
+
} catch {
|
|
682
|
+
}
|
|
683
|
+
return this.sdk.eth.getTransactionReceipt([c]).then((l) => (l && (l.transactionHash = s[0]), l));
|
|
684
|
+
}
|
|
685
|
+
case "eth_estimateGas":
|
|
686
|
+
return this.sdk.eth.getEstimateGas(s[0]);
|
|
687
|
+
case "eth_call":
|
|
688
|
+
return this.sdk.eth.call([s[0], s[1]]);
|
|
689
|
+
case "eth_getLogs":
|
|
690
|
+
return this.sdk.eth.getPastLogs([s[0]]);
|
|
691
|
+
case "eth_gasPrice":
|
|
692
|
+
return this.sdk.eth.getGasPrice();
|
|
693
|
+
case "wallet_getPermissions":
|
|
694
|
+
return this.sdk.wallet.getPermissions();
|
|
695
|
+
case "wallet_requestPermissions":
|
|
696
|
+
return this.sdk.wallet.requestPermissions(s[0]);
|
|
697
|
+
case "safe_setSettings":
|
|
698
|
+
return this.sdk.eth.setSafeSettings([s[0]]);
|
|
699
|
+
case "wallet_sendCalls": {
|
|
700
|
+
const { from: c, calls: l, chainId: f } = s[0];
|
|
701
|
+
if (f !== (0, t.numberToHex)(this.chainId))
|
|
702
|
+
throw new Error(`Safe is not on chain ${f}`);
|
|
703
|
+
if (c !== this.safe.safeAddress)
|
|
704
|
+
throw Error("Invalid from address");
|
|
705
|
+
const _ = l.map((R, D) => {
|
|
706
|
+
if (!R.to)
|
|
707
|
+
throw new Error(`Invalid call #${D}: missing "to" field`);
|
|
708
|
+
return {
|
|
709
|
+
to: R.to,
|
|
710
|
+
data: R.data ?? "0x",
|
|
711
|
+
value: R.value ?? (0, t.numberToHex)(0)
|
|
712
|
+
};
|
|
713
|
+
}), { safeTxHash: m } = await this.sdk.txs.send({ txs: _ });
|
|
714
|
+
return {
|
|
715
|
+
id: m
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
case "wallet_getCallsStatus": {
|
|
719
|
+
const c = s[0], l = {
|
|
720
|
+
[e.TransactionStatus.AWAITING_CONFIRMATIONS]: 100,
|
|
721
|
+
[e.TransactionStatus.AWAITING_EXECUTION]: 100,
|
|
722
|
+
[e.TransactionStatus.SUCCESS]: 200,
|
|
723
|
+
[e.TransactionStatus.CANCELLED]: 400,
|
|
724
|
+
[e.TransactionStatus.FAILED]: 500
|
|
725
|
+
}, f = await this.sdk.txs.getBySafeTxHash(c), _ = {
|
|
726
|
+
version: "1.0",
|
|
727
|
+
id: c,
|
|
728
|
+
chainId: (0, t.numberToHex)(this.chainId),
|
|
729
|
+
status: l[f.txStatus]
|
|
730
|
+
};
|
|
731
|
+
if (!f.txHash)
|
|
732
|
+
return _;
|
|
733
|
+
const m = await this.sdk.eth.getTransactionReceipt([f.txHash]);
|
|
734
|
+
if (!m)
|
|
735
|
+
return _;
|
|
736
|
+
const L = f.txData?.dataDecoded?.method !== "multiSend" ? 1 : (
|
|
737
|
+
// Number of batched transactions
|
|
738
|
+
f.txData.dataDecoded.parameters?.[0].valueDecoded?.length ?? 1
|
|
739
|
+
), R = Number(m.blockNumber), D = Number(m.gasUsed);
|
|
740
|
+
return _.receipts = Array(L).fill({
|
|
741
|
+
logs: m.logs,
|
|
742
|
+
status: (0, t.numberToHex)(f.txStatus === e.TransactionStatus.SUCCESS ? 1 : 0),
|
|
743
|
+
blockHash: m.blockHash,
|
|
744
|
+
blockNumber: (0, t.numberToHex)(R),
|
|
745
|
+
gasUsed: (0, t.numberToHex)(D),
|
|
746
|
+
transactionHash: f.txHash
|
|
747
|
+
}), _;
|
|
748
|
+
}
|
|
749
|
+
case "wallet_showCallsStatus":
|
|
750
|
+
throw new Error(`"${a.method}" not supported`);
|
|
751
|
+
case "wallet_getCapabilities":
|
|
752
|
+
return {
|
|
753
|
+
[(0, t.numberToHex)(this.chainId)]: {
|
|
754
|
+
atomicBatch: {
|
|
755
|
+
supported: !0
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
};
|
|
759
|
+
default:
|
|
760
|
+
throw Error(`"${a.method}" not implemented`);
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
// this method is needed for ethers v4
|
|
764
|
+
// https://github.com/ethers-io/ethers.js/blob/427e16826eb15d52d25c4f01027f8db22b74b76c/src.ts/providers/web3-provider.ts#L41-L55
|
|
765
|
+
send(a, i) {
|
|
766
|
+
a || i("Undefined request"), this.request(a).then((s) => i(null, { jsonrpc: "2.0", id: a.id, result: s })).catch((s) => i(s, null));
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
return j.SafeAppProvider = h, j;
|
|
770
|
+
}
|
|
771
|
+
var _e;
|
|
772
|
+
function Ne() {
|
|
773
|
+
return _e || (_e = 1, (function(e) {
|
|
774
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.SafeAppProvider = void 0;
|
|
775
|
+
var u = /* @__PURE__ */ De();
|
|
776
|
+
Object.defineProperty(e, "SafeAppProvider", { enumerable: !0, get: function() {
|
|
777
|
+
return u.SafeAppProvider;
|
|
778
|
+
} });
|
|
779
|
+
})(N)), N;
|
|
780
|
+
}
|
|
781
|
+
var be = /* @__PURE__ */ Ne();
|
|
782
|
+
const Ve = /* @__PURE__ */ we(be), $e = /* @__PURE__ */ Ce({
|
|
783
|
+
__proto__: null,
|
|
784
|
+
default: Ve
|
|
785
|
+
}, [be]);
|
|
786
|
+
export {
|
|
787
|
+
$e as i
|
|
788
|
+
};
|