@springmicro/auth 0.2.0 → 0.3.4
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/.eslintrc.cjs +0 -0
- package/README.md +60 -60
- package/dist/{Index-c419311f-C4ismbFI.js → Index-64ac63ff-mcEPPGzJ.js} +101 -102
- package/dist/{Index-652aeb8c-CnQjaQIW.js → Index-6c094240-D4xpr8fA.js} +70 -71
- package/dist/{Web3Auth-bM2cUiiC.js → Web3Auth-DB9s-qbl.js} +12454 -12511
- package/dist/alphawallet-B7eovdf-.js +0 -0
- package/dist/apexwallet-ysP20G9D.js +0 -0
- package/dist/atoken-BBnNTzcz.js +0 -0
- package/dist/bifrostwallet-CNNBO92h.js +0 -0
- package/dist/binance-DvPgAzCw.js +0 -0
- package/dist/bitget-DZOUrwgy.js +0 -0
- package/dist/bitpie-C_uxmEzw.js +0 -0
- package/dist/bitski-DpzkHNkv.js +0 -0
- package/dist/blockwallet-BL69cqkA.js +0 -0
- package/dist/brave-DnRzMQYW.js +0 -0
- package/dist/ccip-c78d2f16-DLcRlwod.js +0 -0
- package/dist/coin98wallet-CkFdOvXt.js +0 -0
- package/dist/coinbase-CaGNx5if.js +0 -0
- package/dist/core-9rK8tWud.js +0 -0
- package/dist/defiwallet-0AsgJBSy.js +0 -0
- package/dist/detected-CX_JZaUk.js +0 -0
- package/dist/echooo-CmaetT_Z.js +0 -0
- package/dist/enkrypt-BibtwvK7.js +0 -0
- package/dist/exodus-BxzkDWWP.js +0 -0
- package/dist/fordefi-CvKyVwhI.js +0 -0
- package/dist/foxwallet-D7c_LDTf.js +0 -0
- package/dist/frame-CDfNmjUy.js +0 -0
- package/dist/frontier-DqKNSj2z.js +0 -0
- package/dist/hashMessage-Dw0KdqMZ.js +2101 -0
- package/dist/huobiwallet-CxSwqa5L.js +0 -0
- package/dist/hyperpay-nmHE3WqM.js +0 -0
- package/dist/icon-2Zqy7pqQ.js +0 -0
- package/dist/icon-CGWI1Ies.js +0 -0
- package/dist/icon-C_O4nprO.js +0 -0
- package/dist/icon-DbgmZCnU.js +0 -0
- package/dist/icon-Dbjb6jc5.js +20 -0
- package/dist/icon-cAd7RhSC.js +0 -0
- package/dist/imtoken-yENtOTS3.js +0 -0
- package/dist/index-021f6a62-Zz543EDB.js +0 -0
- package/dist/index-40a497ea-Bn2mC0r7.js +0 -0
- package/dist/{index-UIY0HLkp.js → index-C0yeApwY.js} +750 -751
- package/dist/{index-CWOsToua.js → index-CDaoza_m.js} +2 -2
- package/dist/index-CiwBcaZ0.js +384 -0
- package/dist/{index-DsVRaLEN.js → index-CroNOC7e.js} +1859 -1826
- package/dist/{index-DhlCF-kH.js → index-Df5ie3cE.js} +2 -2
- package/dist/{index-CSySSnNv.js → index-F-gl3DJX.js} +8 -10
- package/dist/index-wNV8PBAh.js +11412 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +347 -336
- package/dist/infinitywallet-C8J4FUYw.js +0 -0
- package/dist/kayros-AIrUK1za.js +0 -0
- package/dist/keplr-CyLTca9B.js +36 -0
- package/dist/lif3wallet-C5D6r8pg.js +0 -0
- package/dist/liquality-nbCtErVq.js +0 -0
- package/dist/mathwallet-CWkivCXo.js +0 -0
- package/dist/meetone-kKmvI8md.js +0 -0
- package/dist/metamask-BN7yiDV1.js +0 -0
- package/dist/mykey-CQZ6UcLH.js +0 -0
- package/dist/native-FDN9oNjc.js +15 -0
- package/dist/number-ByqdQYDu.js +1529 -0
- package/dist/okxwallet-CJLVogh2.js +0 -0
- package/dist/oneInch-CciyZ4Pz.js +0 -0
- package/dist/onekey-Dal8kYjU.js +0 -0
- package/dist/opera-DnKg-TJU.js +0 -0
- package/dist/ownbit-BshJUVuW.js +0 -0
- package/dist/phantom-CJ8dIcov.js +0 -0
- package/dist/rabby-D4thTcd6.js +0 -0
- package/dist/rainbow-mXld6yWV.js +0 -0
- package/dist/roninwallet-ZyYrd-D1.js +0 -0
- package/dist/safeheron-Eg1Jb29V.js +0 -0
- package/dist/safepal-DVIKy94N.js +0 -0
- package/dist/sequence-BS2IbtDg.js +0 -0
- package/dist/stablewallet-jyB079Wb.js +0 -0
- package/dist/status-FrAvQjfn.js +0 -0
- package/dist/subwallet-DMvFqKyY.js +0 -0
- package/dist/talisman-Bp8zUXqB.js +0 -0
- package/dist/tallywallet-B4OS9nIr.js +0 -0
- package/dist/tokenary-C7jjcbQa.js +0 -0
- package/dist/tokenpocket-9ZRPmAFA.js +0 -0
- package/dist/tp-V2em5bdl.js +0 -0
- package/dist/transactionRequest-be6a8ea9-CUKWo5mx.js +0 -0
- package/dist/trust-SgHubMq7.js +20 -0
- package/dist/xdefi-COVIyGz4.js +0 -0
- package/dist/zeal-DxHbDqm0.js +0 -0
- package/dist/zerion-BfW0UElc.js +0 -0
- package/dist/zodiacpilot-CrId6F4w.js +0 -0
- package/index.html +0 -0
- package/package.json +2 -2
- package/src/auth/config.ts +91 -91
- package/src/components/SignUp.tsx +442 -442
- package/src/components/forms/AgreementModal.tsx +88 -88
- package/src/components/forms/CaptchaController.tsx +94 -94
- package/src/components/forms/CaptchaModal.jsx +171 -171
- package/src/components/forms/CaptchaWidget.jsx +146 -146
- package/src/components/forms/PasswordChecker.ts +88 -88
- package/src/components/forms/SendCodeInput.tsx +149 -149
- package/src/components/forms/SignUpFormItem.tsx +704 -704
- package/src/components/forms/util/application-api.ts +155 -155
- package/src/components/forms/util/auth-api.ts +198 -198
- package/src/components/forms/util/auth-util.tsx +346 -346
- package/src/components/forms/util/core.ts +493 -493
- package/src/components/forms/util/invitation-api.ts +132 -132
- package/src/components/forms/util/provider.tsx +603 -603
- package/src/components/forms/util/user-api.ts +303 -303
- package/src/components/provider/AdfsLoginButton.jsx +38 -38
- package/src/components/provider/AlipayLoginButton.jsx +38 -38
- package/src/components/provider/AppleLoginButton.jsx +38 -38
- package/src/components/provider/AzureADB2CLoginButton.jsx +38 -38
- package/src/components/provider/AzureADLoginButton.jsx +38 -38
- package/src/components/provider/BaiduLoginButton.jsx +38 -38
- package/src/components/provider/BilibiliLoginButton.jsx +37 -37
- package/src/components/provider/CasdoorLoginButton.jsx +38 -38
- package/src/components/provider/DingTalkLoginButton.jsx +37 -37
- package/src/components/provider/DouyinLoginButton.jsx +38 -38
- package/src/components/provider/FacebookLoginButton.jsx +37 -37
- package/src/components/provider/GitHubLoginButton.jsx +37 -37
- package/src/components/provider/GitLabLoginButton.jsx +38 -38
- package/src/components/provider/GiteeLoginButton.jsx +34 -34
- package/src/components/provider/GoogleLoginButton.jsx +68 -68
- package/src/components/provider/InfoflowLoginButton.jsx +38 -38
- package/src/components/provider/LarkLoginButton.jsx +38 -38
- package/src/components/provider/LinkedInLoginButton.jsx +37 -37
- package/src/components/provider/LoginButton.jsx +33 -33
- package/src/components/provider/OktaLoginButton.jsx +38 -38
- package/src/components/provider/Provider.jsx +3 -3
- package/src/components/provider/ProviderButton.jsx +327 -327
- package/src/components/provider/QqLoginButton.jsx +31 -31
- package/src/components/provider/SelfLoginButton.jsx +47 -47
- package/src/components/provider/SlackLoginButton.jsx +38 -38
- package/src/components/provider/SteamLoginButton.jsx +38 -38
- package/src/components/provider/WeComLoginButton.jsx +34 -34
- package/src/components/provider/Web3Auth.jsx +365 -365
- package/src/components/provider/WechatLoginButton.jsx +37 -37
- package/src/components/provider/WeiboLoginButton.jsx +34 -34
- package/src/components/util.tsx +173 -173
- package/src/i18n/en/signup.json +48 -48
- package/src/i18n/index.ts +17 -17
- package/src/index.tsx +8 -8
- package/src/vite-env.d.ts +0 -0
- package/tsconfig.json +0 -0
- package/tsconfig.node.json +0 -0
- package/vite.config.ts +33 -33
- package/dist/hmac-CGR-aDxj.js +0 -47
- package/dist/icon-duCa3gfT.js +0 -11
- package/dist/index-6lyEypQV.js +0 -161
- package/dist/index-BtLU53lm.js +0 -6023
- package/dist/index-C6mFEZgd.js +0 -14043
- package/dist/number-CgDDPrEe.js +0 -1291
- package/dist/sha256-JJGtJ2gn.js +0 -325
- package/dist/trust-gPypS1O7.js +0 -11
package/vite.config.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import react from "@vitejs/plugin-react";
|
|
2
|
-
import { resolve } from "path";
|
|
3
|
-
import { defineConfig } from "vite";
|
|
4
|
-
import dts from "vite-plugin-dts";
|
|
5
|
-
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
plugins: [react(), dts({ rollupTypes: true })],
|
|
8
|
-
build: {
|
|
9
|
-
lib: {
|
|
10
|
-
entry: resolve(__dirname, "src/index.tsx"),
|
|
11
|
-
name: "@springmicro/auth",
|
|
12
|
-
fileName: "index",
|
|
13
|
-
},
|
|
14
|
-
rollupOptions: {
|
|
15
|
-
external: [
|
|
16
|
-
"react",
|
|
17
|
-
"react-dom",
|
|
18
|
-
"auth-astro",
|
|
19
|
-
"i18next",
|
|
20
|
-
"react-i18next",
|
|
21
|
-
],
|
|
22
|
-
output: {
|
|
23
|
-
globals: {
|
|
24
|
-
react: "React",
|
|
25
|
-
"react-dom": "ReactDom",
|
|
26
|
-
"auth-astro": "AuthAstro",
|
|
27
|
-
i18next: "I18Next",
|
|
28
|
-
"react-i18next": "React-i18next",
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
});
|
|
1
|
+
import react from "@vitejs/plugin-react";
|
|
2
|
+
import { resolve } from "path";
|
|
3
|
+
import { defineConfig } from "vite";
|
|
4
|
+
import dts from "vite-plugin-dts";
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [react(), dts({ rollupTypes: true })],
|
|
8
|
+
build: {
|
|
9
|
+
lib: {
|
|
10
|
+
entry: resolve(__dirname, "src/index.tsx"),
|
|
11
|
+
name: "@springmicro/auth",
|
|
12
|
+
fileName: "index",
|
|
13
|
+
},
|
|
14
|
+
rollupOptions: {
|
|
15
|
+
external: [
|
|
16
|
+
"react",
|
|
17
|
+
"react-dom",
|
|
18
|
+
"auth-astro",
|
|
19
|
+
"i18next",
|
|
20
|
+
"react-i18next",
|
|
21
|
+
],
|
|
22
|
+
output: {
|
|
23
|
+
globals: {
|
|
24
|
+
react: "React",
|
|
25
|
+
"react-dom": "ReactDom",
|
|
26
|
+
"auth-astro": "AuthAstro",
|
|
27
|
+
i18next: "I18Next",
|
|
28
|
+
"react-i18next": "React-i18next",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
});
|
package/dist/hmac-CGR-aDxj.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { H as u, h as l, t as H, e as r, b as p } from "./sha256-JJGtJ2gn.js";
|
|
2
|
-
class o extends u {
|
|
3
|
-
constructor(t, i) {
|
|
4
|
-
super(), this.finished = !1, this.destroyed = !1, l(t);
|
|
5
|
-
const h = H(i);
|
|
6
|
-
if (this.iHash = t.create(), typeof this.iHash.update != "function")
|
|
7
|
-
throw new Error("Expected instance of class which extends utils.Hash");
|
|
8
|
-
this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
|
|
9
|
-
const a = this.blockLen, e = new Uint8Array(a);
|
|
10
|
-
e.set(h.length > a ? t.create().update(h).digest() : h);
|
|
11
|
-
for (let s = 0; s < e.length; s++)
|
|
12
|
-
e[s] ^= 54;
|
|
13
|
-
this.iHash.update(e), this.oHash = t.create();
|
|
14
|
-
for (let s = 0; s < e.length; s++)
|
|
15
|
-
e[s] ^= 106;
|
|
16
|
-
this.oHash.update(e), e.fill(0);
|
|
17
|
-
}
|
|
18
|
-
update(t) {
|
|
19
|
-
return r(this), this.iHash.update(t), this;
|
|
20
|
-
}
|
|
21
|
-
digestInto(t) {
|
|
22
|
-
r(this), p(t, this.outputLen), this.finished = !0, this.iHash.digestInto(t), this.oHash.update(t), this.oHash.digestInto(t), this.destroy();
|
|
23
|
-
}
|
|
24
|
-
digest() {
|
|
25
|
-
const t = new Uint8Array(this.oHash.outputLen);
|
|
26
|
-
return this.digestInto(t), t;
|
|
27
|
-
}
|
|
28
|
-
_cloneInto(t) {
|
|
29
|
-
t || (t = Object.create(Object.getPrototypeOf(this), {}));
|
|
30
|
-
const { oHash: i, iHash: h, finished: a, destroyed: e, blockLen: s, outputLen: c } = this;
|
|
31
|
-
return t = t, t.finished = a, t.destroyed = e, t.blockLen = s, t.outputLen = c, t.oHash = i._cloneInto(t.oHash), t.iHash = h._cloneInto(t.iHash), t;
|
|
32
|
-
}
|
|
33
|
-
destroy() {
|
|
34
|
-
this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const d = (n, t, i) => new o(n, t).update(i).digest();
|
|
38
|
-
d.create = (n, t) => new o(n, t);
|
|
39
|
-
const y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
40
|
-
__proto__: null,
|
|
41
|
-
HMAC: o,
|
|
42
|
-
hmac: d
|
|
43
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
44
|
-
export {
|
|
45
|
-
y as a,
|
|
46
|
-
d as h
|
|
47
|
-
};
|
package/dist/icon-duCa3gfT.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const c = `
|
|
2
|
-
<svg width="100%" height="100%"
|
|
3
|
-
viewBox="0 0 40 40"
|
|
4
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
-
>
|
|
6
|
-
<path d="m1.36250526 6.825c-1.36250526 2.675-1.36250526 6.175-1.36250526 13.175s0 10.5 1.36250526 13.1750526c1.2 2.35 3.11249474 4.2624211 5.46249474 5.4624211 2.675 1.3625263 6.175 1.3625263 13.175 1.3625263s10.5 0 13.1750526-1.3625263c2.35-1.2 4.2624211-3.1124211 5.4624211-5.4624211 1.3625263-2.6750526 1.3625263-6.1750526 1.3625263-13.1750526s0-10.5-1.3625263-13.175c-1.2-2.35-3.1124211-4.26249474-5.4624211-5.46249474-2.6750526-1.36250526-6.1750526-1.36250526-13.1750526-1.36250526s-10.5 0-13.175 1.36250526c-2.35 1.2-4.26249474 3.11249474-5.46249474 5.46249474zm28.61875794 3.9624737c.35 0 .6812631.1437895.9250526.3875789.2436842.25.3812631.5874737.3751557.9311579-.0626294 3.7250527-.2064189 6.5750527-.4751557 8.8312632-.2625263 2.2563158-.6563158 3.9312631-1.25 5.2875789-.4.9062106-.8937895 1.6562106-1.4750526 2.2936842-.7812632.8437895-1.6749474 1.4563158-2.65 2.037579-.4168421.2492631-.8502106.4953684-1.3048421.7535789-.97.5508421-2.0365264 1.1565264-3.2451579 1.9651579-.4374737.2936842-1.0062106.2936842-1.4436843 0-1.2271578-.8181052-2.3077894-1.4312631-3.2866315-1.9865263-.2176842-.1234737-.4303158-.2441052-.6384211-.3634737-1.1436842-.6625263-2.1749474-1.2937894-3.0749474-2.2063158-.6-.6-1.1187368-1.3312631-1.5312631-2.2-.5625158-1.1625263-.94376843-2.5687368-1.22501054-4.3874736-.37501052-2.4312632-.56250526-5.6125264-.63146616-10.0250527-.0060391-.3436842.12521353-.6811579.3689609-.9311579.24374737-.2437894.5812526-.3875789.9312526-.3875789h.5375263c1.6562106.0063158 5.3124211-.1562105 8.4749474-2.61871581.4687369-.36250526 1.1250526-.36250526 1.5937895 0 3.1625263 2.46250531 6.8187368 2.62503161 8.4812631 2.61871581zm-2.9062106 14.6063158c.4062106-.837579.7437895-1.9937895 1-3.6563158.3062106-1.9874737.4937895-4.6874737.5812632-8.3624211-1.95-.0563158-5.3-.4312631-8.4937895-2.5812631-3.1936842 2.1436842-6.5436842 2.5187368-8.4874737 2.5812631.0687369 3.0374737.2062106 5.4.4249474 7.2562106.25 2.1125263.6063158 3.5437894 1.05 4.55.2937895.6687368.6188421 1.15 1.0063158 1.5749473.5187368.5688421 1.1749474 1.037579 2.0687368 1.5750527.3707369.222421.7794737.4537894 1.2244211.7056842.7927368.4486315 1.7003158.9623158 2.7130526 1.6068421.9941053-.634 1.8886316-1.1424211 2.6721053-1.5877895.2362105-.1342105.4622105-.2627368.6778947-.3872632 1.1-.6312631 1.9125263-1.1562105 2.5187369-1.7687368.4063157-.4187368.7375789-.8749474 1.0437894-1.5062105z" fill="#3375bb" fill-rule="evenodd"/>
|
|
7
|
-
</svg>
|
|
8
|
-
`;
|
|
9
|
-
export {
|
|
10
|
-
c as default
|
|
11
|
-
};
|
package/dist/index-6lyEypQV.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { bK as p } from "./Web3Auth-bM2cUiiC.js";
|
|
2
|
-
function _(n, r) {
|
|
3
|
-
for (var i = 0; i < r.length; i++) {
|
|
4
|
-
const e = r[i];
|
|
5
|
-
if (typeof e != "string" && !Array.isArray(e)) {
|
|
6
|
-
for (const s in e)
|
|
7
|
-
if (s !== "default" && !(s in n)) {
|
|
8
|
-
const o = Object.getOwnPropertyDescriptor(e, s);
|
|
9
|
-
o && Object.defineProperty(n, s, o.get ? o : {
|
|
10
|
-
enumerable: !0,
|
|
11
|
-
get: () => e[s]
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
|
|
17
|
-
}
|
|
18
|
-
var l = {}, g = {}, f = {};
|
|
19
|
-
Object.defineProperty(f, "__esModule", { value: !0 });
|
|
20
|
-
f.getLowerCase = void 0;
|
|
21
|
-
function m(n) {
|
|
22
|
-
return n && n.toLowerCase();
|
|
23
|
-
}
|
|
24
|
-
f.getLowerCase = m;
|
|
25
|
-
Object.defineProperty(g, "__esModule", { value: !0 });
|
|
26
|
-
g.SafeAppProvider = void 0;
|
|
27
|
-
const w = p, u = f;
|
|
28
|
-
class k extends w.EventEmitter {
|
|
29
|
-
constructor(r, i) {
|
|
30
|
-
super(), this.submittedTxs = /* @__PURE__ */ new Map(), this.safe = r, this.sdk = i;
|
|
31
|
-
}
|
|
32
|
-
async connect() {
|
|
33
|
-
this.emit("connect", { chainId: this.chainId });
|
|
34
|
-
}
|
|
35
|
-
async disconnect() {
|
|
36
|
-
}
|
|
37
|
-
get chainId() {
|
|
38
|
-
return this.safe.chainId;
|
|
39
|
-
}
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
-
async request(r) {
|
|
42
|
-
const { method: i, params: e = [] } = r;
|
|
43
|
-
switch (i) {
|
|
44
|
-
case "eth_accounts":
|
|
45
|
-
return [this.safe.safeAddress];
|
|
46
|
-
case "net_version":
|
|
47
|
-
case "eth_chainId":
|
|
48
|
-
return `0x${this.chainId.toString(16)}`;
|
|
49
|
-
case "personal_sign": {
|
|
50
|
-
const [t, a] = e;
|
|
51
|
-
if (this.safe.safeAddress.toLowerCase() !== a.toLowerCase())
|
|
52
|
-
throw new Error("The address or message hash is invalid");
|
|
53
|
-
const h = await this.sdk.txs.signMessage(t);
|
|
54
|
-
return ("signature" in h ? h.signature : void 0) || "0x";
|
|
55
|
-
}
|
|
56
|
-
case "eth_sign": {
|
|
57
|
-
const [t, a] = e;
|
|
58
|
-
if (this.safe.safeAddress.toLowerCase() !== t.toLowerCase() || !a.startsWith("0x"))
|
|
59
|
-
throw new Error("The address or message hash is invalid");
|
|
60
|
-
const h = await this.sdk.txs.signMessage(a);
|
|
61
|
-
return ("signature" in h ? h.signature : void 0) || "0x";
|
|
62
|
-
}
|
|
63
|
-
case "eth_signTypedData":
|
|
64
|
-
case "eth_signTypedData_v4": {
|
|
65
|
-
const [t, a] = e, h = typeof a == "string" ? JSON.parse(a) : a;
|
|
66
|
-
if (this.safe.safeAddress.toLowerCase() !== t.toLowerCase())
|
|
67
|
-
throw new Error("The address is invalid");
|
|
68
|
-
const c = await this.sdk.txs.signTypedMessage(h);
|
|
69
|
-
return ("signature" in c ? c.signature : void 0) || "0x";
|
|
70
|
-
}
|
|
71
|
-
case "eth_sendTransaction":
|
|
72
|
-
const s = {
|
|
73
|
-
...e[0],
|
|
74
|
-
value: e[0].value || "0",
|
|
75
|
-
data: e[0].data || "0x"
|
|
76
|
-
};
|
|
77
|
-
typeof s.gas == "string" && s.gas.startsWith("0x") && (s.gas = parseInt(s.gas, 16));
|
|
78
|
-
const o = await this.sdk.txs.send({
|
|
79
|
-
txs: [s],
|
|
80
|
-
params: { safeTxGas: s.gas }
|
|
81
|
-
});
|
|
82
|
-
return this.submittedTxs.set(o.safeTxHash, {
|
|
83
|
-
from: this.safe.safeAddress,
|
|
84
|
-
hash: o.safeTxHash,
|
|
85
|
-
gas: 0,
|
|
86
|
-
gasPrice: "0x00",
|
|
87
|
-
nonce: 0,
|
|
88
|
-
input: s.data,
|
|
89
|
-
value: s.value,
|
|
90
|
-
to: s.to,
|
|
91
|
-
blockHash: null,
|
|
92
|
-
blockNumber: null,
|
|
93
|
-
transactionIndex: null
|
|
94
|
-
}), o.safeTxHash;
|
|
95
|
-
case "eth_blockNumber":
|
|
96
|
-
return (await this.sdk.eth.getBlockByNumber(["latest"])).number;
|
|
97
|
-
case "eth_getBalance":
|
|
98
|
-
return this.sdk.eth.getBalance([(0, u.getLowerCase)(e[0]), e[1]]);
|
|
99
|
-
case "eth_getCode":
|
|
100
|
-
return this.sdk.eth.getCode([(0, u.getLowerCase)(e[0]), e[1]]);
|
|
101
|
-
case "eth_getTransactionCount":
|
|
102
|
-
return this.sdk.eth.getTransactionCount([(0, u.getLowerCase)(e[0]), e[1]]);
|
|
103
|
-
case "eth_getStorageAt":
|
|
104
|
-
return this.sdk.eth.getStorageAt([(0, u.getLowerCase)(e[0]), e[1], e[2]]);
|
|
105
|
-
case "eth_getBlockByNumber":
|
|
106
|
-
return this.sdk.eth.getBlockByNumber([e[0], e[1]]);
|
|
107
|
-
case "eth_getBlockByHash":
|
|
108
|
-
return this.sdk.eth.getBlockByHash([e[0], e[1]]);
|
|
109
|
-
case "eth_getTransactionByHash":
|
|
110
|
-
let d = e[0];
|
|
111
|
-
try {
|
|
112
|
-
d = (await this.sdk.txs.getBySafeTxHash(d)).txHash || d;
|
|
113
|
-
} catch {
|
|
114
|
-
}
|
|
115
|
-
return this.submittedTxs.has(d) ? this.submittedTxs.get(d) : this.sdk.eth.getTransactionByHash([d]).then((t) => (t && (t.hash = e[0]), t));
|
|
116
|
-
case "eth_getTransactionReceipt": {
|
|
117
|
-
let t = e[0];
|
|
118
|
-
try {
|
|
119
|
-
t = (await this.sdk.txs.getBySafeTxHash(t)).txHash || t;
|
|
120
|
-
} catch {
|
|
121
|
-
}
|
|
122
|
-
return this.sdk.eth.getTransactionReceipt([t]).then((a) => (a && (a.transactionHash = e[0]), a));
|
|
123
|
-
}
|
|
124
|
-
case "eth_estimateGas":
|
|
125
|
-
return this.sdk.eth.getEstimateGas(e[0]);
|
|
126
|
-
case "eth_call":
|
|
127
|
-
return this.sdk.eth.call([e[0], e[1]]);
|
|
128
|
-
case "eth_getLogs":
|
|
129
|
-
return this.sdk.eth.getPastLogs([e[0]]);
|
|
130
|
-
case "eth_gasPrice":
|
|
131
|
-
return this.sdk.eth.getGasPrice();
|
|
132
|
-
case "wallet_getPermissions":
|
|
133
|
-
return this.sdk.wallet.getPermissions();
|
|
134
|
-
case "wallet_requestPermissions":
|
|
135
|
-
return this.sdk.wallet.requestPermissions(e[0]);
|
|
136
|
-
case "safe_setSettings":
|
|
137
|
-
return this.sdk.eth.setSafeSettings([e[0]]);
|
|
138
|
-
default:
|
|
139
|
-
throw Error(`"${r.method}" not implemented`);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
// this method is needed for ethers v4
|
|
143
|
-
// https://github.com/ethers-io/ethers.js/blob/427e16826eb15d52d25c4f01027f8db22b74b76c/src.ts/providers/web3-provider.ts#L41-L55
|
|
144
|
-
send(r, i) {
|
|
145
|
-
r || i("Undefined request"), this.request(r).then((e) => i(null, { jsonrpc: "2.0", id: r.id, result: e })).catch((e) => i(e, null));
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
g.SafeAppProvider = k;
|
|
149
|
-
(function(n) {
|
|
150
|
-
Object.defineProperty(n, "__esModule", { value: !0 }), n.SafeAppProvider = void 0;
|
|
151
|
-
var r = g;
|
|
152
|
-
Object.defineProperty(n, "SafeAppProvider", { enumerable: !0, get: function() {
|
|
153
|
-
return r.SafeAppProvider;
|
|
154
|
-
} });
|
|
155
|
-
})(l);
|
|
156
|
-
const b = /* @__PURE__ */ _({
|
|
157
|
-
__proto__: null
|
|
158
|
-
}, [l]);
|
|
159
|
-
export {
|
|
160
|
-
b as i
|
|
161
|
-
};
|