astra-modal-test 1.0.10 → 1.0.12
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 +206 -134
- package/dist/{SwapController-DyormRqe.js → SwapController-mYFErPzx.js} +1 -1
- package/dist/{add-C1zIRxeS.js → add-CXtFvysR.js} +1 -1
- package/dist/{all-wallets-5a2U9fLw.js → all-wallets-B9fFXw5x.js} +1 -1
- package/dist/{app-store-2IKrZeLe.js → app-store-BXf1yvR8.js} +1 -1
- package/dist/{apple-DH9ESSKX.js → apple-DtcOcX1n.js} +1 -1
- package/dist/{arrow-bottom-BxAPS43J.js → arrow-bottom-BXeLKqSV.js} +1 -1
- package/dist/{arrow-bottom-circle-Cy5Gjca4.js → arrow-bottom-circle-BVUU200N.js} +1 -1
- package/dist/{arrow-left-CBX7JaHB.js → arrow-left-LguJPyNR.js} +1 -1
- package/dist/{arrow-right-G72bt1-M.js → arrow-right-D9kKZzGG.js} +1 -1
- package/dist/{arrow-top-DCkQG0Dq.js → arrow-top-C5JcaCqz.js} +1 -1
- package/dist/{bank-FNxAUs8r.js → bank-DgbCzr0A.js} +1 -1
- package/dist/{bin-B-c2CIPW.js → bin-ykHym2bC.js} +1 -1
- package/dist/{bitcoin-jk4NLDu1.js → bitcoin-B8jzy_uV.js} +1 -1
- package/dist/{browser-D6w0J78l.js → browser-Bk8u8PAA.js} +1 -1
- package/dist/{card-BLWRKU-r.js → card-DcwQMUca.js} +1 -1
- package/dist/ccip-CwJvuExU.js +239 -0
- package/dist/{checkmark-C1pTfaGr.js → checkmark-D3aEYZ8B.js} +1 -1
- package/dist/{checkmark-bold-UzogCu8g.js → checkmark-bold-5H7N-CDG.js} +1 -1
- package/dist/{chevron-bottom-w_rMAO7x.js → chevron-bottom-BA3C4MR1.js} +1 -1
- package/dist/{chevron-left-DGNJGxiP.js → chevron-left-BX18UWKM.js} +1 -1
- package/dist/{chevron-right-VFQCvCyG.js → chevron-right-DG7ovxTe.js} +1 -1
- package/dist/{chevron-top-DVhFmsKp.js → chevron-top-DHfev7lV.js} +1 -1
- package/dist/{chrome-store-BkYX3All.js → chrome-store-BSVzpGdu.js} +1 -1
- package/dist/{circle-B1A3j4eP.js → circle-SYFB9f2-.js} +1 -1
- package/dist/{clock-BKr-VHDU.js → clock-Cygqlf1g.js} +1 -1
- package/dist/{close-BEacRQ8Q.js → close-B43cuuko.js} +1 -1
- package/dist/{coinPlaceholder-0ZwtMAHl.js → coinPlaceholder-BHdR6bKb.js} +1 -1
- package/dist/{compass-pulK-BFi.js → compass-7S6b6wyA.js} +1 -1
- package/dist/{copy-MWCQE0T4.js → copy-CT53bEwd.js} +1 -1
- package/dist/{cursor-transparent-Co_5p0du.js → cursor-transparent-LmjzjsFm.js} +1 -1
- package/dist/{cursor-C2GVfUuM.js → cursor-vtqRnrF7.js} +1 -1
- package/dist/{desktop-C91EoSqM.js → desktop-Doa7TQsq.js} +1 -1
- package/dist/{disconnect-BWg1-rml.js → disconnect-C5G6Ncu_.js} +1 -1
- package/dist/{discord-Bi0Bfa_e.js → discord-DX7Cl3Ko.js} +1 -1
- package/dist/{email-U2WCRPFh.js → email-CyHWh9wL.js} +1 -1
- package/dist/{embedded-wallet-B6P0kU9A.js → embedded-wallet-BZQImi7s.js} +8 -8
- package/dist/{ethereum-BeZyayQW.js → ethereum-Bwvtk5-_.js} +1 -1
- package/dist/{etherscan-BQTsufjv.js → etherscan-CyVRICvw.js} +1 -1
- package/dist/{exclamation-triangle-JT-YKNXX.js → exclamation-triangle-BDbPL3nL.js} +1 -1
- package/dist/{extension-TnYLHoFA.js → extension-Cx3t2k-R.js} +1 -1
- package/dist/{external-link-Dhgai9sc.js → external-link-DZCYpOZI.js} +1 -1
- package/dist/{facebook-C6XFGRDw.js → facebook-BEnPrhG3.js} +1 -1
- package/dist/{farcaster-CvYbxZQq.js → farcaster-DyBPLb_k.js} +1 -1
- package/dist/{filters-DwVRjAav.js → filters-CTwxivn_.js} +1 -1
- package/dist/{github-BVZSx-z9.js → github-kzQb61pT.js} +1 -1
- package/dist/{google-NbJiQLc5.js → google-DSC-rYNu.js} +1 -1
- package/dist/{help-circle-Cum2UOMJ.js → help-circle-C5XfimVx.js} +1 -1
- package/dist/{id-kRR6YgVc.js → id-B9fQOT4E.js} +1 -1
- package/dist/{image-BWUCRAmp.js → image-1CCj36XM.js} +1 -1
- package/dist/{index-RFYbqmu0.js → index-Bjik7E9u.js} +1 -1
- package/dist/{index-DQ5AZLMt.js → index-C1fgrzi0.js} +16 -16
- package/dist/{index-BZZHE-1t.js → index-CyeGBcX0.js} +1 -1
- package/dist/{index-Dq0LIBEh.js → index-DKEMW9N8.js} +25 -25
- package/dist/{index-2vYoun4O.js → index-LucuShOc.js} +45292 -56275
- package/dist/{info-Br-SBtj3.js → info-Begf9tO0.js} +1 -1
- package/dist/{info-circle-Ew4RoR_Q.js → info-circle-Bo1H2OXh.js} +1 -1
- package/dist/{lightbulb-BRBVOE_b.js → lightbulb-C-SU_z2I.js} +1 -1
- package/dist/{mail-Dzi4AncY.js → mail-CXsYiNAT.js} +1 -1
- package/dist/{mobile-BGGxQ5be.js → mobile-C7bUjgog.js} +1 -1
- package/dist/{more-BmNaKbYJ.js → more-29BC-wmy.js} +1 -1
- package/dist/{network-placeholder-EMiMf4q1.js → network-placeholder-B-x3-6jN.js} +1 -1
- package/dist/{nftPlaceholder-CvSqy3Sd.js → nftPlaceholder-pM-Hmswq.js} +1 -1
- package/dist/nodeflow-sdk.es.js +15 -0
- package/dist/{off-DF9uz0Nc.js → off-DEa_uc7_.js} +1 -1
- package/dist/{onramp-cKzTmKku.js → onramp-ZXqyloYt.js} +10 -10
- package/dist/{play-store-CGxW4MgL.js → play-store-WgSEpEI1.js} +1 -1
- package/dist/{plus-CQ6wWkN0.js → plus-u4UZhYAg.js} +1 -1
- package/dist/{qr-code-VBqx9nAF.js → qr-code-DxZGxoPE.js} +1 -1
- package/dist/{receive-CVzkHmKR.js → receive-Ct_mQWzk.js} +1 -1
- package/dist/{recycle-horizontal-Oq1YtvUx.js → recycle-horizontal-BWVpmHJc.js} +1 -1
- package/dist/{refresh-BDlGAzmY.js → refresh-gi4TfgEU.js} +1 -1
- package/dist/{reown-logo-BlIpXIlG.js → reown-logo-Bg731n4w.js} +1 -1
- package/dist/{search-DfmCmp0m.js → search-BQv7DVJG.js} +1 -1
- package/dist/{send-BXudz514.js → send-BzmnFT2p.js} +1 -1
- package/dist/{send-Cz0L5LmE.js → send-CyxKtrQ9.js} +17 -17
- package/dist/{socials-CDOh8MRf.js → socials-vziOn4zi.js} +5 -5
- package/dist/{solana-CbiyOE-8.js → solana-Dz48awbr.js} +1 -1
- package/dist/{swapHorizontal-DyU1TH_e.js → swapHorizontal-Cwe1PoMp.js} +1 -1
- package/dist/{swapHorizontalBold-CGXW7Ocj.js → swapHorizontalBold-Dxu58sRG.js} +1 -1
- package/dist/{swapHorizontalMedium-2KTcj67d.js → swapHorizontalMedium-DOZZthlB.js} +1 -1
- package/dist/{swapHorizontalRoundedBold-TxFtmmda.js → swapHorizontalRoundedBold-BkIZQXnD.js} +1 -1
- package/dist/{swapVertical-BKD6lxM3.js → swapVertical-LSq66ctC.js} +1 -1
- package/dist/{swaps-BuGsEQaI.js → swaps-C2EO6dQA.js} +9 -9
- package/dist/{telegram-CAsl9DeG.js → telegram-ITq9s69Y.js} +1 -1
- package/dist/{three-dots-BoE2aHZi.js → three-dots-JH3A1TFR.js} +1 -1
- package/dist/{transactions-C1NtsnD6.js → transactions-DpMVZVap.js} +1 -1
- package/dist/{twitch-CvkZZxgT.js → twitch-BKs5FlDf.js} +1 -1
- package/dist/{twitterIcon-CrhnOl_O.js → twitterIcon-CCXEj_Nv.js} +1 -1
- package/dist/{ui-BJcuThPA.js → ui-D5ULRvGt.js} +6 -6
- package/dist/{user-BZRWUXG7.js → user-CBgAUjZv.js} +1 -1
- package/dist/{verify-y9F4DcJ4.js → verify-BPlPPkhG.js} +1 -1
- package/dist/{verify-filled-X_8-BhMk.js → verify-filled-qTRg0OWM.js} +1 -1
- package/dist/{w3m-modal-BX--v1Nc.js → w3m-modal-DSdDfy32.js} +27 -27
- package/dist/{wallet-CIaVVkjQ.js → wallet-BuDEi_8z.js} +1 -1
- package/dist/{wallet-placeholder-Cq1ofde1.js → wallet-placeholder-D4DKTuB_.js} +1 -1
- package/dist/{walletconnect-CINzSCJ3.js → walletconnect-Dt3q5XFc.js} +1 -1
- package/dist/{warning-circle-BvBNhMKH.js → warning-circle-B8Fkc0_4.js} +1 -1
- package/dist/{x-xHY7JehW.js → x-Cm_V3zUI.js} +1 -1
- package/dist/{x-mark-DEmnBt6u.js → x-mark-BVvwdxda.js} +1 -1
- package/package.json +11 -10
- package/.github/workflows/code-quality.yml +0 -43
- package/.github/workflows/publish.yml +0 -64
- package/dist/astra-sdk.es.js +0 -9
- package/dist/ccip-DkYvh7hg.js +0 -149
- package/dist/clsx.m-DCYaa4RU.js +0 -20
- package/dist/index-BDE-2VTp.js +0 -315
- package/dist/index-BjLIiJQa.js +0 -21034
- package/dist/index-CIr4zlVp.js +0 -386
- package/dist/index-ChxXyuZj.js +0 -572
- package/dist/index-D-T7kk3G.js +0 -15911
- package/dist/index-DSX3HrTS.js +0 -10785
- package/dist/secp256k1-CsKSDHNi.js +0 -1257
- package/eslint.config.mjs +0 -41
- package/index.html +0 -13
- package/public/font/ClashDisplay-Variable.ttf +0 -0
- package/public/font/ClashDisplay-Variable.woff +0 -0
- package/public/font/ClashDisplay-Variable.woff2 +0 -0
- package/public/vite.svg +0 -1
- package/src/App.css +0 -170
- package/src/apis/lspApi.js +0 -82
- package/src/apis/request.js +0 -59
- package/src/assets/arrow-right.svg +0 -3
- package/src/assets/astr.svg +0 -13
- package/src/assets/bridge-loading.png +0 -0
- 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/base.png +0 -0
- package/src/assets/network/botanix.png +0 -0
- package/src/assets/network/bsc.svg +0 -13
- package/src/assets/network/eth.png +0 -0
- package/src/assets/network/lighting.png +0 -0
- package/src/assets/network/ligtning.svg +0 -22
- package/src/assets/network/solona.png +0 -0
- package/src/assets/pay.png +0 -0
- package/src/assets/powerby.svg +0 -14
- package/src/assets/react.svg +0 -1
- package/src/assets/success.svg +0 -3
- package/src/assets/tip.svg +0 -5
- package/src/assets/tokens/sol.png +0 -0
- package/src/assets/tokens/usdc.png +0 -0
- package/src/assets/tokens/usdt.png +0 -0
- package/src/comps/AstraImage.jsx +0 -37
- package/src/comps/AstraModal.jsx +0 -202
- package/src/comps/AstraModalLogo.jsx +0 -29
- package/src/comps/AstraNetwork.jsx +0 -261
- package/src/comps/CheckErc20Button.jsx +0 -28
- package/src/comps/CommonStyle.jsx +0 -4
- package/src/comps/ConnectButton.jsx +0 -19
- package/src/comps/EllipsisMiddle.jsx +0 -42
- package/src/comps/ResultModal.jsx +0 -312
- package/src/comps/ToLightning.jsx +0 -653
- package/src/comps/ToToken.jsx +0 -550
- package/src/constants/index.js +0 -21
- package/src/font/ClashDisplay-Variable.ttf +0 -0
- package/src/font/ClashDisplay-Variable.woff +0 -0
- package/src/font/ClashDisplay-Variable.woff2 +0 -0
- package/src/hooks/useContract.js +0 -179
- package/src/hooks/useGetMinAndMax.js +0 -48
- package/src/hooks/useLspApi.js +0 -70
- package/src/hooks/useParseInvoice.js +0 -95
- package/src/index.css +0 -69
- package/src/index.jsx +0 -161
- package/src/lib/bolt11.min.js +0 -1
- package/src/main.jsx +0 -75
- package/src/store/index.js +0 -25
- package/src/theme.js +0 -108
- package/src/utils/index.js +0 -267
- package/vite.config.js +0 -50
package/dist/index-CIr4zlVp.js
DELETED
|
@@ -1,386 +0,0 @@
|
|
|
1
|
-
import { r as T } from "./index-ChxXyuZj.js";
|
|
2
|
-
import { b2 as y, b3 as k, b4 as I } from "./index-2vYoun4O.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
|
-
};
|