@prosopo/procaptcha-bundle 0.3.5 → 0.3.37
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/dist/bundle/{Captcha-Cx0ArXYl.js → Captcha-Cv4jnpZb.js} +23 -22
- package/dist/bundle/{ProcaptchaWidget-DDAodo6R.js → ProcaptchaWidget-O71j1WKI.js} +353 -356
- package/dist/bundle/{index-HgeMtpKw.js → index-ChKfVXCq.js} +161 -157
- package/dist/bundle/procaptcha.bundle.js +1 -1
- package/dist/bundle/{utils-CfklpKIj.js → utils-C0DFj2UN.js} +11703 -11641
- package/dist/cjs/account/dist/extension/ExtensionWeb2.cjs +1 -1
- package/dist/cjs/procaptcha-pow/dist/Services/Manager.cjs +3 -1
- package/package.json +8 -7
- package/stats.html +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { B as K, u as M,
|
|
1
|
+
import { A as p, P as I, j as n, C as W, W as _, a as C, c as k, e as P, f as R, g as O, i as G, L as H, k as U, m as L, n as j, l as F, d as B, r as b } from "./index-ChKfVXCq.js";
|
|
2
|
+
import { B as K, u as M, p as q, h as w, m as X, w as $, t as z, q as J, A as Q, W as V, K as Y, x as Z, C as ee, n as D, y as te, z as ne } from "./utils-C0DFj2UN.js";
|
|
3
3
|
const oe = (a, e) => {
|
|
4
4
|
let o = 0;
|
|
5
5
|
const c = "0".repeat(e);
|
|
6
6
|
for (; ; ) {
|
|
7
|
-
const
|
|
8
|
-
if (ae(K(
|
|
7
|
+
const l = new TextEncoder().encode(o + a);
|
|
8
|
+
if (ae(K(l)).startsWith(c))
|
|
9
9
|
return o;
|
|
10
10
|
o += 1;
|
|
11
11
|
}
|
|
12
12
|
}, ae = (a) => Array.from(a).map((e) => e.toString(16).padStart(2, "0")).join(""), re = (a, e, o, c) => {
|
|
13
|
-
const
|
|
13
|
+
const l = () => ({
|
|
14
14
|
showModal: !1,
|
|
15
15
|
loading: !1,
|
|
16
16
|
index: 0,
|
|
@@ -20,14 +20,14 @@ const oe = (a, e) => {
|
|
|
20
20
|
captchaApi: void 0,
|
|
21
21
|
account: void 0
|
|
22
22
|
}), r = () => {
|
|
23
|
-
window.clearTimeout(e.timeout),
|
|
23
|
+
window.clearTimeout(e.timeout), d({ timeout: void 0 });
|
|
24
24
|
}, i = () => {
|
|
25
25
|
const t = {
|
|
26
26
|
userAccountAddress: "",
|
|
27
27
|
...a
|
|
28
28
|
};
|
|
29
29
|
return I.parse(t);
|
|
30
|
-
},
|
|
30
|
+
}, f = (t) => {
|
|
31
31
|
const s = t.networks[t.defaultNetwork];
|
|
32
32
|
if (!s)
|
|
33
33
|
throw new w("DEVELOPER.NETWORK_NOT_FOUND", {
|
|
@@ -35,7 +35,7 @@ const oe = (a, e) => {
|
|
|
35
35
|
});
|
|
36
36
|
return s;
|
|
37
37
|
}, A = async () => {
|
|
38
|
-
const t =
|
|
38
|
+
const t = f(i()), s = await Q.create({
|
|
39
39
|
provider: new V(t.endpoint),
|
|
40
40
|
initWasm: !1,
|
|
41
41
|
noInitWarn: !0
|
|
@@ -45,41 +45,42 @@ const oe = (a, e) => {
|
|
|
45
45
|
if (!e.account)
|
|
46
46
|
throw new w("GENERAL.ACCOUNT_NOT_FOUND", { context: { error: "Account not loaded" } });
|
|
47
47
|
return e.account;
|
|
48
|
-
},
|
|
48
|
+
}, u = () => {
|
|
49
49
|
if (!e.dappAccount)
|
|
50
50
|
throw new w("GENERAL.SITE_KEY_MISSING");
|
|
51
51
|
return e.dappAccount;
|
|
52
|
-
},
|
|
53
|
-
r(),
|
|
52
|
+
}, d = D(e, o), N = () => {
|
|
53
|
+
r(), d(l());
|
|
54
54
|
};
|
|
55
55
|
return {
|
|
56
56
|
start: async () => {
|
|
57
57
|
if (e.loading || e.isHuman)
|
|
58
58
|
return;
|
|
59
|
-
N()
|
|
59
|
+
N(), d({
|
|
60
|
+
loading: !0
|
|
61
|
+
});
|
|
60
62
|
const t = i(), s = new M(), h = t.userAccountAddress || (await s.getAccount(t)).account.address;
|
|
61
|
-
if (
|
|
62
|
-
loading: !0,
|
|
63
|
+
if (d({
|
|
63
64
|
account: { account: { address: h } }
|
|
64
|
-
}),
|
|
65
|
+
}), d({ dappAccount: t.account.address }), await q(100), !t.web2 && !t.userAccountAddress)
|
|
65
66
|
throw new w("GENERAL.ACCOUNT_NOT_FOUND", {
|
|
66
67
|
context: { error: "Account address has not been set for web3 mode" }
|
|
67
68
|
});
|
|
68
|
-
const m = await A(), S = X(o, e, c), v = await $(m.query.getRandomActiveProvider, m.query)(h,
|
|
69
|
-
(await E.submitPowCaptchaSolution(g, x().account.address,
|
|
69
|
+
const m = await A(), S = X(o, e, c), v = await $(m.query.getRandomActiveProvider, m.query)(h, u()), y = z(v.provider.url.toString()), E = new J(f(i()), y, u()), g = await E.getPowCaptchaChallenge(h, u()), T = oe(g.challenge, g.difficulty);
|
|
70
|
+
(await E.submitPowCaptchaSolution(g, x().account.address, u(), v, T))[p.verified] && (d({
|
|
70
71
|
isHuman: !0,
|
|
71
72
|
loading: !1
|
|
72
73
|
}), S.onHuman({
|
|
73
74
|
providerUrl: y,
|
|
74
|
-
[
|
|
75
|
-
[
|
|
76
|
-
[
|
|
77
|
-
[
|
|
75
|
+
[p.user]: x().account.address,
|
|
76
|
+
[p.dapp]: u(),
|
|
77
|
+
[p.challenge]: g.challenge,
|
|
78
|
+
[p.blockNumber]: v.blockNumber
|
|
78
79
|
}));
|
|
79
80
|
}
|
|
80
81
|
};
|
|
81
82
|
}, le = (a) => {
|
|
82
|
-
const e = a.config, o = e.theme === "light" ? "light" : "dark", c = a.config.theme === "light" ? F : B,
|
|
83
|
+
const e = a.config, o = e.theme === "light" ? "light" : "dark", c = a.config.theme === "light" ? F : B, l = a.callbacks || {}, [r, i] = te(b.useState, b.useRef), f = D(r, i), A = re(e, r, f, l);
|
|
83
84
|
return n("div", { children: n("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: n(W, { children: n(_, { children: C("div", { style: k, "data-cy": "button-human", children: [" ", C("div", { style: {
|
|
84
85
|
padding: P,
|
|
85
86
|
border: R,
|