astra-modal-test 1.0.5 → 1.0.7
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/.github/workflows/code-quality.yml +43 -0
- package/.github/workflows/publish.yml +64 -0
- package/README.md +204 -0
- package/dist/SwapController-CsNqEWIM.js +447 -0
- package/dist/add-Dm_oSEbv.js +19 -0
- package/dist/all-wallets-DfLlzQJ3.js +10 -0
- package/dist/app-store-BMdJkp6P.js +21 -0
- package/dist/apple-BetlVMKw.js +22 -0
- package/dist/arrow-bottom-BddPptxy.js +12 -0
- package/dist/arrow-bottom-circle-CvdJJniv.js +15 -0
- package/dist/arrow-left-Bbq-z1nQ.js +12 -0
- package/dist/arrow-right-Bu4_SVLC.js +12 -0
- package/dist/arrow-top-CynlXB-M.js +12 -0
- package/dist/astra-sdk.es.js +4 -4
- package/dist/bank-B9QscNnS.js +18 -0
- package/dist/bin-v-tshf8_.js +8 -0
- package/dist/bitcoin-C01gkYyN.js +17 -0
- package/dist/browser-9uNaCY31.js +18 -0
- package/dist/card-hKR9lRzU.js +18 -0
- package/dist/{ccip-oZOrZYR9.js → ccip-CUCziAPw.js} +52 -49
- package/dist/checkmark-D1M40aM5.js +15 -0
- package/dist/checkmark-bold-1_UGl24m.js +12 -0
- package/dist/chevron-bottom-BleoRNRL.js +12 -0
- package/dist/chevron-left-C9JMU-3B.js +12 -0
- package/dist/chevron-right-Daue4WBx.js +12 -0
- package/dist/chevron-top-yuXekbUC.js +12 -0
- package/dist/chrome-store-BsUFRR7F.js +65 -0
- package/dist/circle-BCxdhM5X.js +8 -0
- package/dist/clock-7a-DWZQa.js +12 -0
- package/dist/close-DMQYuJ0z.js +12 -0
- package/dist/clsx.m-DCYaa4RU.js +20 -0
- package/dist/coinPlaceholder-DjQ-HnSH.js +12 -0
- package/dist/compass-AMecXNVm.js +12 -0
- package/dist/copy-CgIPGYbU.js +19 -0
- package/dist/cursor-DpYbTNcO.js +7 -0
- package/dist/cursor-transparent-C8iPJkn8.js +16 -0
- package/dist/desktop-BWVQVGng.js +13 -0
- package/dist/disconnect-C6IQRrtF.js +12 -0
- package/dist/discord-gH3i-QsC.js +21 -0
- package/dist/email-BxYwJC5T.js +10 -0
- package/dist/embedded-wallet-DCcVNgkc.js +464 -0
- package/dist/ethereum-CGWsmZaC.js +14 -0
- package/dist/etherscan-D4EFsAJ4.js +10 -0
- package/dist/exclamation-triangle-DNwQ1Xq6.js +8 -0
- package/dist/extension-DxQPsN2z.js +12 -0
- package/dist/external-link-BeEzrdgR.js +12 -0
- package/dist/facebook-B2Ix8_d3.js +30 -0
- package/dist/farcaster-BB83p8dC.js +16 -0
- package/dist/filters-PzdIomB1.js +12 -0
- package/dist/github-gcp1rxX0.js +22 -0
- package/dist/google-Qv9lTZcz.js +22 -0
- package/dist/help-circle-BLXTMjzX.js +16 -0
- package/dist/id-BHg2CRhj.js +16 -0
- package/dist/image-DWi1V30x.js +8 -0
- package/dist/index-4lbsZ6RQ.js +33 -0
- package/dist/index-64U3D9_n.js +21034 -0
- package/dist/index-CRU49I0g.js +15911 -0
- package/dist/index-ChxXyuZj.js +572 -0
- package/dist/index-ClS956E1.js +74511 -0
- package/dist/index-Cs4fWw01.js +386 -0
- package/dist/index-DfWqgW4h.js +709 -0
- package/dist/index-VYNI76FM.js +315 -0
- package/dist/index-qfkTLN90.js +10785 -0
- package/dist/index-r2ztgVN2.js +1060 -0
- package/dist/index-wvh7Yd5J.js +70 -0
- package/dist/info-Bl5tmiBJ.js +7 -0
- package/dist/info-circle-D2uYywg-.js +16 -0
- package/dist/lightbulb-HvXH2AVF.js +7 -0
- package/dist/mail-DXOPfnog.js +12 -0
- package/dist/mobile-Dd0Gj4vZ.js +13 -0
- package/dist/more-DYcnClbB.js +15 -0
- package/dist/network-placeholder-CfRZGQfi.js +18 -0
- package/dist/nftPlaceholder-DHmFkY55.js +12 -0
- package/dist/off-CG2Y30qN.js +8 -0
- package/dist/onramp-DoAMTeNm.js +917 -0
- package/dist/play-store-B5EYBQto.js +36 -0
- package/dist/plus-DPo25_zL.js +17 -0
- package/dist/qr-code-BRTO19PL.js +10 -0
- package/dist/receive-BvclNdV_.js +179 -0
- package/dist/recycle-horizontal-ng_b2eJV.js +13 -0
- package/dist/refresh-3kiwRV0w.js +12 -0
- package/dist/reown-logo-_9cuIfJD.js +16 -0
- package/dist/search-CoJvIxpi.js +12 -0
- package/dist/secp256k1-wZyK2iIX.js +1257 -0
- package/dist/send-BVKGSR-Z.js +19 -0
- package/dist/send-Bkj5YtHe.js +1039 -0
- package/dist/socials-DL42HlL5.js +589 -0
- package/dist/solana-BjP-_Ioa.js +17 -0
- package/dist/swapHorizontal-Do3uBbum.js +12 -0
- package/dist/swapHorizontalBold-D7N75BE-.js +12 -0
- package/dist/swapHorizontalMedium-BahEVO2x.js +20 -0
- package/dist/swapHorizontalRoundedBold-D6Hoi132.js +12 -0
- package/dist/swapVertical-P-fnrADh.js +12 -0
- package/dist/swaps-DZgbVJZ2.js +1713 -0
- package/dist/telegram-DmaL2iB8.js +20 -0
- package/dist/three-dots-oXyAsUA6.js +9 -0
- package/dist/transactions-BjB5yZN7.js +35 -0
- package/dist/twitch-0UGrMr2K.js +22 -0
- package/dist/twitterIcon-B97KAbaJ.js +10 -0
- package/dist/ui-r6nnVhBA.js +812 -0
- package/dist/user-BG1yp56Q.js +7 -0
- package/dist/verify-CgzkMSuV.js +12 -0
- package/dist/verify-filled-D-TRpWtN.js +12 -0
- package/dist/w3m-modal-Drsibcs0.js +1041 -0
- package/dist/wallet-CAHsZdfj.js +12 -0
- package/dist/wallet-placeholder-agbbreqw.js +18 -0
- package/dist/walletconnect-Yd8iXqY9.js +36 -0
- package/dist/warning-circle-C0hqC6h_.js +16 -0
- package/dist/x-mark-D9_ai2sI.js +7 -0
- package/dist/x-z6v1Jegg.js +16 -0
- package/eslint.config.mjs +1 -1
- package/package.json +14 -13
- package/src/apis/lspApi.js +47 -24
- package/src/assets/ln.png +0 -0
- package/src/assets/network/Arbitrum.png +0 -0
- package/src/assets/network/Polygon.png +0 -0
- package/src/assets/network/Solana.png +0 -0
- package/src/assets/network/botanix.png +0 -0
- package/src/assets/network/bsc.svg +13 -0
- package/src/assets/pay.png +0 -0
- package/src/assets/tokens/usdc.png +0 -0
- package/src/assets/tokens/usdt.png +0 -0
- package/src/comps/AstraImage.jsx +17 -3
- package/src/comps/AstraModal.jsx +22 -16
- package/src/comps/AstraModalLogo.jsx +9 -9
- package/src/comps/AstraNetwork.jsx +174 -45
- package/src/comps/CheckErc20Button.jsx +1 -1
- package/src/comps/CommonStyle.jsx +4 -0
- package/src/comps/ConnectButton.jsx +16 -33
- package/src/comps/ResultModal.jsx +45 -39
- package/src/comps/ToLightning.jsx +207 -80
- package/src/comps/ToToken.jsx +278 -217
- package/src/constants/index.js +20 -4
- package/src/hooks/useContract.js +164 -125
- package/src/hooks/useGetMinAndMax.js +48 -0
- package/src/hooks/useLspApi.js +56 -39
- package/src/hooks/useParseInvoice.js +82 -72
- package/src/index.jsx +43 -10
- package/src/main.jsx +36 -5
- package/src/utils/index.js +136 -24
- package/vite.config.js +7 -1
- package/dist/astra-sdk.umd.js +0 -12578
- package/dist/hooks.module-BBZfodGH.js +0 -506
- package/dist/index-BKKAfRrw.js +0 -87520
- package/dist/index-C2MAIRET.js +0 -2929
- package/dist/index-CsRxokSv.js +0 -445
- package/dist/index-DQ6iiHxJ.js +0 -13720
- package/dist/index-SJhlkSif.js +0 -133
- package/dist/w3m-modal-CYJpmgnf.js +0 -267
- package/src/constants/contracts/abi/bridge.js +0 -1281
- package/src/constants/contracts/abi/index.js +0 -3
- package/src/constants/contracts/abi/usdt.js +0 -130
- package/src/constants/contracts/abi/watcher.js +0 -437
- package/src/constants/contracts/index.js +0 -37
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { r as T } from "./index-ChxXyuZj.js";
|
|
2
|
+
import { b2 as y, b3 as k, b4 as I } from "./index-ClS956E1.js";
|
|
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
|
+
};
|