@coinbase/cdp-core 0.0.41 → 0.0.42
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/esm/index.native101.js +10 -79
- package/dist/esm/index.native102.js +79 -10
- package/dist/esm/index.native13.js +1 -1
- package/dist/esm/index.native25.js +149 -940
- package/dist/esm/index.native26.js +48 -2
- package/dist/esm/index.native27.js +244 -43
- package/dist/esm/index.native28.js +55 -27
- package/dist/esm/index.native29.js +940 -149
- package/dist/esm/index.native30.js +2 -48
- package/dist/esm/index.native31.js +43 -243
- package/dist/esm/index.native32.js +27 -55
- package/dist/esm/index.native8.js +4 -4
- package/dist/esm/index.native9.js +49 -31
- package/dist/esm/index.native92.js +1 -1
- package/dist/esm/index.web100.js +9 -117
- package/dist/esm/index.web101.js +79 -10
- package/dist/esm/index.web26.js +156 -155
- package/dist/esm/index.web27.js +1 -1
- package/dist/esm/index.web8.js +49 -31
- package/dist/esm/index.web82.js +6 -6
- package/dist/esm/index.web91.js +1 -1
- package/dist/esm/index.web94.js +19 -77
- package/dist/esm/index.web95.js +10 -21
- package/dist/esm/index.web96.js +19 -9
- package/dist/esm/index.web97.js +89 -15
- package/dist/esm/index.web98.js +19 -92
- package/dist/esm/index.web99.js +115 -18
- package/dist/native/index.native101.js +10 -79
- package/dist/native/index.native102.js +79 -10
- package/dist/native/index.native13.js +1 -1
- package/dist/native/index.native25.js +149 -940
- package/dist/native/index.native26.js +48 -2
- package/dist/native/index.native27.js +244 -43
- package/dist/native/index.native28.js +55 -27
- package/dist/native/index.native29.js +940 -149
- package/dist/native/index.native30.js +2 -48
- package/dist/native/index.native31.js +43 -243
- package/dist/native/index.native32.js +27 -55
- package/dist/native/index.native8.js +4 -4
- package/dist/native/index.native9.js +49 -31
- package/dist/native/index.native92.js +1 -1
- package/dist/native-types/eip1193/errors.d.ts +6 -0
- package/dist/native-types/eip1193/internal.d.ts +3 -1
- package/dist/types/eip1193/errors.d.ts +6 -0
- package/dist/types/eip1193/internal.d.ts +3 -1
- package/dist/web/index.web100.js +9 -117
- package/dist/web/index.web101.js +79 -10
- package/dist/web/index.web26.js +156 -155
- package/dist/web/index.web27.js +1 -1
- package/dist/web/index.web8.js +49 -31
- package/dist/web/index.web82.js +6 -6
- package/dist/web/index.web91.js +1 -1
- package/dist/web/index.web94.js +19 -77
- package/dist/web/index.web95.js +10 -21
- package/dist/web/index.web96.js +19 -9
- package/dist/web/index.web97.js +89 -15
- package/dist/web/index.web98.js +19 -92
- package/dist/web/index.web99.js +115 -18
- package/dist/web-types/eip1193/errors.d.ts +6 -0
- package/dist/web-types/eip1193/internal.d.ts +3 -1
- package/package.json +2 -2
package/dist/web/index.web100.js
CHANGED
|
@@ -1,120 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (n?.[s])
|
|
10
|
-
return n[s];
|
|
11
|
-
const t = await y({ ...r, alg: s });
|
|
12
|
-
return i && Object.freeze(e), n ? n[s] = t : c.set(e, { [s]: t }), t;
|
|
13
|
-
}, E = (e, r) => {
|
|
14
|
-
c ||= /* @__PURE__ */ new WeakMap();
|
|
15
|
-
let s = c.get(e);
|
|
16
|
-
if (s?.[r])
|
|
17
|
-
return s[r];
|
|
18
|
-
const i = e.type === "public", n = !!i;
|
|
19
|
-
let t;
|
|
20
|
-
if (e.asymmetricKeyType === "x25519") {
|
|
21
|
-
switch (r) {
|
|
22
|
-
case "ECDH-ES":
|
|
23
|
-
case "ECDH-ES+A128KW":
|
|
24
|
-
case "ECDH-ES+A192KW":
|
|
25
|
-
case "ECDH-ES+A256KW":
|
|
26
|
-
break;
|
|
27
|
-
default:
|
|
28
|
-
throw new TypeError("given KeyObject instance cannot be used for this algorithm");
|
|
29
|
-
}
|
|
30
|
-
t = e.toCryptoKey(e.asymmetricKeyType, n, i ? [] : ["deriveBits"]);
|
|
31
|
-
}
|
|
32
|
-
if (e.asymmetricKeyType === "ed25519") {
|
|
33
|
-
if (r !== "EdDSA" && r !== "Ed25519")
|
|
34
|
-
throw new TypeError("given KeyObject instance cannot be used for this algorithm");
|
|
35
|
-
t = e.toCryptoKey(e.asymmetricKeyType, n, [
|
|
36
|
-
i ? "verify" : "sign"
|
|
37
|
-
]);
|
|
38
|
-
}
|
|
39
|
-
if (e.asymmetricKeyType === "rsa") {
|
|
40
|
-
let a;
|
|
41
|
-
switch (r) {
|
|
42
|
-
case "RSA-OAEP":
|
|
43
|
-
a = "SHA-1";
|
|
44
|
-
break;
|
|
45
|
-
case "RS256":
|
|
46
|
-
case "PS256":
|
|
47
|
-
case "RSA-OAEP-256":
|
|
48
|
-
a = "SHA-256";
|
|
49
|
-
break;
|
|
50
|
-
case "RS384":
|
|
51
|
-
case "PS384":
|
|
52
|
-
case "RSA-OAEP-384":
|
|
53
|
-
a = "SHA-384";
|
|
54
|
-
break;
|
|
55
|
-
case "RS512":
|
|
56
|
-
case "PS512":
|
|
57
|
-
case "RSA-OAEP-512":
|
|
58
|
-
a = "SHA-512";
|
|
59
|
-
break;
|
|
60
|
-
default:
|
|
61
|
-
throw new TypeError("given KeyObject instance cannot be used for this algorithm");
|
|
62
|
-
}
|
|
63
|
-
if (r.startsWith("RSA-OAEP"))
|
|
64
|
-
return e.toCryptoKey({
|
|
65
|
-
name: "RSA-OAEP",
|
|
66
|
-
hash: a
|
|
67
|
-
}, n, i ? ["encrypt"] : ["decrypt"]);
|
|
68
|
-
t = e.toCryptoKey({
|
|
69
|
-
name: r.startsWith("PS") ? "RSA-PSS" : "RSASSA-PKCS1-v1_5",
|
|
70
|
-
hash: a
|
|
71
|
-
}, n, [i ? "verify" : "sign"]);
|
|
72
|
-
}
|
|
73
|
-
if (e.asymmetricKeyType === "ec") {
|
|
74
|
-
const o = (/* @__PURE__ */ new Map([
|
|
75
|
-
["prime256v1", "P-256"],
|
|
76
|
-
["secp384r1", "P-384"],
|
|
77
|
-
["secp521r1", "P-521"]
|
|
78
|
-
])).get(e.asymmetricKeyDetails?.namedCurve);
|
|
79
|
-
if (!o)
|
|
80
|
-
throw new TypeError("given KeyObject instance cannot be used for this algorithm");
|
|
81
|
-
r === "ES256" && o === "P-256" && (t = e.toCryptoKey({
|
|
82
|
-
name: "ECDSA",
|
|
83
|
-
namedCurve: o
|
|
84
|
-
}, n, [i ? "verify" : "sign"])), r === "ES384" && o === "P-384" && (t = e.toCryptoKey({
|
|
85
|
-
name: "ECDSA",
|
|
86
|
-
namedCurve: o
|
|
87
|
-
}, n, [i ? "verify" : "sign"])), r === "ES512" && o === "P-521" && (t = e.toCryptoKey({
|
|
88
|
-
name: "ECDSA",
|
|
89
|
-
namedCurve: o
|
|
90
|
-
}, n, [i ? "verify" : "sign"])), r.startsWith("ECDH-ES") && (t = e.toCryptoKey({
|
|
91
|
-
name: "ECDH",
|
|
92
|
-
namedCurve: o
|
|
93
|
-
}, n, i ? [] : ["deriveBits"]));
|
|
94
|
-
}
|
|
95
|
-
if (!t)
|
|
96
|
-
throw new TypeError("given KeyObject instance cannot be used for this algorithm");
|
|
97
|
-
return s ? s[r] = t : c.set(e, { [r]: t }), t;
|
|
98
|
-
}, d = async (e, r) => {
|
|
99
|
-
if (e instanceof Uint8Array || S(e))
|
|
100
|
-
return e;
|
|
101
|
-
if (K(e)) {
|
|
102
|
-
if (e.type === "secret")
|
|
103
|
-
return e.export();
|
|
104
|
-
if ("toCryptoKey" in e && typeof e.toCryptoKey == "function")
|
|
105
|
-
try {
|
|
106
|
-
return E(e, r);
|
|
107
|
-
} catch (i) {
|
|
108
|
-
if (i instanceof TypeError)
|
|
109
|
-
throw i;
|
|
110
|
-
}
|
|
111
|
-
let s = e.export({ format: "jwk" });
|
|
112
|
-
return f(e, s, r);
|
|
113
|
-
}
|
|
114
|
-
if (p(e))
|
|
115
|
-
return e.k ? m(e.k) : f(e, e, r, !0);
|
|
116
|
-
throw new Error("unreachable");
|
|
1
|
+
import { contracts as o } from "./index.web111.js";
|
|
2
|
+
import { formatters as r } from "./index.web112.js";
|
|
3
|
+
import { serializers as t } from "./index.web113.js";
|
|
4
|
+
const e = {
|
|
5
|
+
blockTime: 2e3,
|
|
6
|
+
contracts: o,
|
|
7
|
+
formatters: r,
|
|
8
|
+
serializers: t
|
|
117
9
|
};
|
|
118
10
|
export {
|
|
119
|
-
|
|
11
|
+
e as chainConfig
|
|
120
12
|
};
|
package/dist/web/index.web101.js
CHANGED
|
@@ -1,12 +1,81 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { Hash as g, createView as l, aexists as b, toBytes as a, abytes as d, aoutput as x, clean as w } from "./index.web90.js";
|
|
2
|
+
function y(o, t, s, n) {
|
|
3
|
+
if (typeof o.setBigUint64 == "function")
|
|
4
|
+
return o.setBigUint64(t, s, n);
|
|
5
|
+
const i = BigInt(32), h = BigInt(4294967295), e = Number(s >> i & h), r = Number(s & h), c = n ? 4 : 0, u = n ? 0 : 4;
|
|
6
|
+
o.setUint32(t + c, e, n), o.setUint32(t + u, r, n);
|
|
7
|
+
}
|
|
8
|
+
function U(o, t, s) {
|
|
9
|
+
return o & t ^ ~o & s;
|
|
10
|
+
}
|
|
11
|
+
function _(o, t, s) {
|
|
12
|
+
return o & t ^ o & s ^ t & s;
|
|
13
|
+
}
|
|
14
|
+
class m extends g {
|
|
15
|
+
constructor(t, s, n, i) {
|
|
16
|
+
super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = t, this.outputLen = s, this.padOffset = n, this.isLE = i, this.buffer = new Uint8Array(t), this.view = l(this.buffer);
|
|
17
|
+
}
|
|
18
|
+
update(t) {
|
|
19
|
+
b(this), t = a(t), d(t);
|
|
20
|
+
const { view: s, buffer: n, blockLen: i } = this, h = t.length;
|
|
21
|
+
for (let e = 0; e < h; ) {
|
|
22
|
+
const r = Math.min(i - this.pos, h - e);
|
|
23
|
+
if (r === i) {
|
|
24
|
+
const c = l(t);
|
|
25
|
+
for (; i <= h - e; e += i)
|
|
26
|
+
this.process(c, e);
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
n.set(t.subarray(e, e + r), this.pos), this.pos += r, e += r, this.pos === i && (this.process(s, 0), this.pos = 0);
|
|
30
|
+
}
|
|
31
|
+
return this.length += t.length, this.roundClean(), this;
|
|
32
|
+
}
|
|
33
|
+
digestInto(t) {
|
|
34
|
+
b(this), x(t, this), this.finished = !0;
|
|
35
|
+
const { buffer: s, view: n, blockLen: i, isLE: h } = this;
|
|
36
|
+
let { pos: e } = this;
|
|
37
|
+
s[e++] = 128, w(this.buffer.subarray(e)), this.padOffset > i - e && (this.process(n, 0), e = 0);
|
|
38
|
+
for (let f = e; f < i; f++)
|
|
39
|
+
s[f] = 0;
|
|
40
|
+
y(n, i - 8, BigInt(this.length * 8), h), this.process(n, 0);
|
|
41
|
+
const r = l(t), c = this.outputLen;
|
|
42
|
+
if (c % 4)
|
|
43
|
+
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
44
|
+
const u = c / 4, p = this.get();
|
|
45
|
+
if (u > p.length)
|
|
46
|
+
throw new Error("_sha2: outputLen bigger than state");
|
|
47
|
+
for (let f = 0; f < u; f++)
|
|
48
|
+
r.setUint32(4 * f, p[f], h);
|
|
49
|
+
}
|
|
50
|
+
digest() {
|
|
51
|
+
const { buffer: t, outputLen: s } = this;
|
|
52
|
+
this.digestInto(t);
|
|
53
|
+
const n = t.slice(0, s);
|
|
54
|
+
return this.destroy(), n;
|
|
55
|
+
}
|
|
56
|
+
_cloneInto(t) {
|
|
57
|
+
t || (t = new this.constructor()), t.set(...this.get());
|
|
58
|
+
const { blockLen: s, buffer: n, length: i, finished: h, destroyed: e, pos: r } = this;
|
|
59
|
+
return t.destroyed = e, t.finished = h, t.length = i, t.pos = r, i % s && t.buffer.set(n), t;
|
|
60
|
+
}
|
|
61
|
+
clone() {
|
|
62
|
+
return this._cloneInto();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const B = /* @__PURE__ */ Uint32Array.from([
|
|
66
|
+
1779033703,
|
|
67
|
+
3144134277,
|
|
68
|
+
1013904242,
|
|
69
|
+
2773480762,
|
|
70
|
+
1359893119,
|
|
71
|
+
2600822924,
|
|
72
|
+
528734635,
|
|
73
|
+
1541459225
|
|
74
|
+
]);
|
|
10
75
|
export {
|
|
11
|
-
|
|
76
|
+
U as Chi,
|
|
77
|
+
m as HashMD,
|
|
78
|
+
_ as Maj,
|
|
79
|
+
B as SHA256_IV,
|
|
80
|
+
y as setBigUint64
|
|
12
81
|
};
|
package/dist/web/index.web26.js
CHANGED
|
@@ -1,41 +1,49 @@
|
|
|
1
|
-
import { Hex as
|
|
2
|
-
import { toHex as
|
|
3
|
-
import { getUserOperation as
|
|
1
|
+
import { Hex as E } from "ox";
|
|
2
|
+
import { toHex as T, createWalletClient as P } from "viem";
|
|
3
|
+
import { getUserOperation as R, sendUserOperation as b, signEvmTypedData as U, signEvmHash as x, getCurrentUser as w, signOut as H, sendEvmTransaction as O, signEvmTransaction as D, signEvmMessage as N } from "./index.web5.js";
|
|
4
4
|
import "@coinbase/cdp-api-client";
|
|
5
5
|
import "./index.web7.js";
|
|
6
|
-
import { validateUserConnected as
|
|
6
|
+
import { validateUserConnected as v, validateUserHasEvmSmartAccount as S, RPCRequestError as u, STANDARD_ERROR_CODES as o, validateIsUsingEOA as h, validateUserOwnsAddress as p, EIP1193ProviderError as g } from "./index.web8.js";
|
|
7
7
|
import "zustand";
|
|
8
|
-
import { userOperationChainIdToNameMapping as m, isChainIdSupportedForCDPUserOps as I, isChainIdSupportedForCDPSends as
|
|
9
|
-
function
|
|
8
|
+
import { userOperationChainIdToNameMapping as m, isChainIdSupportedForCDPUserOps as I, isChainIdSupportedForCDPSends as F, sendTransactionChainIdToNameMapping as j, userOperationNameToChainIdMapping as k } from "./index.web17.js";
|
|
9
|
+
function f(t) {
|
|
10
10
|
return {
|
|
11
|
-
to:
|
|
12
|
-
data:
|
|
13
|
-
value:
|
|
14
|
-
nonce:
|
|
15
|
-
gas:
|
|
16
|
-
maxFeePerGas:
|
|
17
|
-
maxPriorityFeePerGas:
|
|
11
|
+
to: t.to,
|
|
12
|
+
data: t.data,
|
|
13
|
+
value: t.value ? BigInt(t.value) : void 0,
|
|
14
|
+
nonce: t.nonce ? Number(t.nonce) : void 0,
|
|
15
|
+
gas: t.gas ? BigInt(t.gas) : void 0,
|
|
16
|
+
maxFeePerGas: t.maxFeePerGas ? BigInt(t.maxFeePerGas) : void 0,
|
|
17
|
+
maxPriorityFeePerGas: t.maxPriorityFeePerGas ? BigInt(t.maxPriorityFeePerGas) : void 0,
|
|
18
18
|
type: "eip1559"
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
return
|
|
23
|
-
to:
|
|
24
|
-
data:
|
|
25
|
-
value:
|
|
21
|
+
function q(t) {
|
|
22
|
+
return t.map((e) => ({
|
|
23
|
+
to: e.to,
|
|
24
|
+
data: e.data,
|
|
25
|
+
value: e.value ? BigInt(e.value) : void 0
|
|
26
26
|
}));
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function B(t) {
|
|
29
29
|
return {
|
|
30
30
|
atomic: !0,
|
|
31
|
-
chainId:
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
chainId: k[t.network] ?? 0,
|
|
32
|
+
receipts: t.receipts?.map((e) => ({
|
|
33
|
+
transactionHash: e.transactionHash,
|
|
34
|
+
blockHash: e.blockHash,
|
|
35
|
+
blockNumber: BigInt(e.blockNumber ?? 0),
|
|
36
|
+
gasUsed: BigInt(e.gasUsed ?? 0),
|
|
37
|
+
logs: [],
|
|
38
|
+
status: ""
|
|
39
|
+
})),
|
|
40
|
+
id: t.userOpHash,
|
|
41
|
+
status: G(t.status),
|
|
34
42
|
version: "1"
|
|
35
43
|
};
|
|
36
44
|
}
|
|
37
|
-
function
|
|
38
|
-
switch (
|
|
45
|
+
function G(t) {
|
|
46
|
+
switch (t) {
|
|
39
47
|
case "dropped":
|
|
40
48
|
case "failed":
|
|
41
49
|
return 400;
|
|
@@ -46,207 +54,200 @@ function B(e) {
|
|
|
46
54
|
}
|
|
47
55
|
}
|
|
48
56
|
async function Q() {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
await
|
|
60
|
-
const a =
|
|
57
|
+
const t = await w();
|
|
58
|
+
return t?.evmSmartAccounts && t.evmSmartAccounts.length > 0 ? t.evmSmartAccounts : t?.evmAccounts || [];
|
|
59
|
+
}
|
|
60
|
+
async function X(t, e) {
|
|
61
|
+
const a = await v();
|
|
62
|
+
return t.emit("connect", {
|
|
63
|
+
chainId: E.fromNumber(e.getState().chainId)
|
|
64
|
+
}), a.evmSmartAccounts && a.evmSmartAccounts.length > 0 ? a.evmSmartAccounts : a.evmAccounts || [];
|
|
65
|
+
}
|
|
66
|
+
async function Y(t) {
|
|
67
|
+
await h();
|
|
68
|
+
const [e, a] = t;
|
|
69
|
+
await p(a);
|
|
70
|
+
const r = Buffer.from(e.slice(2), "hex").toString();
|
|
61
71
|
try {
|
|
62
|
-
return (await
|
|
63
|
-
evmAccount:
|
|
64
|
-
message:
|
|
72
|
+
return (await N({
|
|
73
|
+
evmAccount: a,
|
|
74
|
+
message: r
|
|
65
75
|
})).signature;
|
|
66
|
-
} catch (
|
|
67
|
-
throw new
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
} catch (n) {
|
|
77
|
+
throw new g(
|
|
78
|
+
o.provider.userRejectedRequest,
|
|
79
|
+
n instanceof Error ? n.message : "Signing failed"
|
|
70
80
|
);
|
|
71
81
|
}
|
|
72
82
|
}
|
|
73
|
-
async function Z(
|
|
74
|
-
|
|
75
|
-
|
|
83
|
+
async function Z(t) {
|
|
84
|
+
await h();
|
|
85
|
+
const [e, a] = t;
|
|
86
|
+
await p(e);
|
|
76
87
|
try {
|
|
77
88
|
return (await U({
|
|
78
|
-
evmAccount:
|
|
79
|
-
typedData: JSON.parse(
|
|
89
|
+
evmAccount: e,
|
|
90
|
+
typedData: JSON.parse(a)
|
|
80
91
|
})).signature;
|
|
81
|
-
} catch (
|
|
82
|
-
throw new
|
|
83
|
-
|
|
84
|
-
|
|
92
|
+
} catch (r) {
|
|
93
|
+
throw new g(
|
|
94
|
+
o.provider.userRejectedRequest,
|
|
95
|
+
r instanceof Error ? r.message : "Signing failed"
|
|
85
96
|
);
|
|
86
97
|
}
|
|
87
98
|
}
|
|
88
|
-
async function
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
99
|
+
async function tt(t, e, a) {
|
|
100
|
+
const r = await h({
|
|
101
|
+
errorMessage: "sendTransaction with a smart account is not supported. Use sendCalls instead."
|
|
102
|
+
}), [n] = t;
|
|
103
|
+
if (!n || typeof n != "object")
|
|
104
|
+
throw new u(
|
|
105
|
+
o.rpc.invalidParams,
|
|
93
106
|
"Transaction parameter must be an object"
|
|
94
107
|
);
|
|
95
|
-
if (!
|
|
96
|
-
throw new
|
|
97
|
-
|
|
108
|
+
if (!n.to)
|
|
109
|
+
throw new u(
|
|
110
|
+
o.rpc.invalidParams,
|
|
98
111
|
"Transaction must include 'to' field"
|
|
99
112
|
);
|
|
100
|
-
const d =
|
|
113
|
+
const d = r.evmAccounts?.[0], i = e.getState(), s = n.chainId ? Number(n.chainId) : i.chainId;
|
|
101
114
|
if (!d)
|
|
102
|
-
throw new
|
|
103
|
-
|
|
115
|
+
throw new u(
|
|
116
|
+
o.rpc.invalidParams,
|
|
104
117
|
"User does not have an EVM account"
|
|
105
118
|
);
|
|
106
|
-
if (
|
|
119
|
+
if (F(s))
|
|
107
120
|
try {
|
|
108
|
-
return (await
|
|
121
|
+
return (await O({
|
|
109
122
|
evmAccount: d,
|
|
110
|
-
transaction: { ...
|
|
111
|
-
network: j[
|
|
123
|
+
transaction: { ...f(n), chainId: s },
|
|
124
|
+
network: j[s]
|
|
112
125
|
})).transactionHash;
|
|
113
|
-
} catch (
|
|
114
|
-
throw console.log("Transaction failed",
|
|
115
|
-
|
|
116
|
-
|
|
126
|
+
} catch (c) {
|
|
127
|
+
throw console.log("Transaction failed", c), new u(
|
|
128
|
+
o.rpc.transactionRejected,
|
|
129
|
+
c instanceof Error ? c.message : "Transaction failed"
|
|
117
130
|
);
|
|
118
131
|
}
|
|
119
132
|
else
|
|
120
133
|
try {
|
|
121
|
-
const
|
|
134
|
+
const c = P({
|
|
122
135
|
// Safe as we check before calling this handler that chainId is configured
|
|
123
|
-
chain:
|
|
124
|
-
transport:
|
|
136
|
+
chain: i.chains.find((l) => l.id === s),
|
|
137
|
+
transport: a[s],
|
|
125
138
|
account: d
|
|
126
|
-
}), y =
|
|
127
|
-
...
|
|
139
|
+
}), y = i.chains.find((l) => l.id === s), A = await c.prepareTransactionRequest({
|
|
140
|
+
...f(n),
|
|
128
141
|
chain: y
|
|
129
|
-
}),
|
|
142
|
+
}), C = await D({
|
|
130
143
|
evmAccount: d,
|
|
131
144
|
transaction: {
|
|
132
|
-
...
|
|
145
|
+
...A,
|
|
133
146
|
type: "eip1559"
|
|
134
147
|
}
|
|
135
148
|
});
|
|
136
|
-
return await
|
|
137
|
-
serializedTransaction:
|
|
149
|
+
return await c.sendRawTransaction({
|
|
150
|
+
serializedTransaction: C.signedTransaction
|
|
138
151
|
});
|
|
139
|
-
} catch (
|
|
140
|
-
throw new
|
|
141
|
-
|
|
142
|
-
|
|
152
|
+
} catch (c) {
|
|
153
|
+
throw new u(
|
|
154
|
+
o.rpc.transactionRejected,
|
|
155
|
+
c instanceof Error ? c.message : "Transaction failed"
|
|
143
156
|
);
|
|
144
157
|
}
|
|
145
158
|
}
|
|
146
|
-
async function
|
|
147
|
-
|
|
148
|
-
|
|
159
|
+
async function et(t) {
|
|
160
|
+
await h();
|
|
161
|
+
const [e, a] = t;
|
|
162
|
+
await p(a);
|
|
149
163
|
try {
|
|
150
164
|
return (await x({
|
|
151
|
-
evmAccount:
|
|
152
|
-
hash:
|
|
165
|
+
evmAccount: a,
|
|
166
|
+
hash: e
|
|
153
167
|
})).signature;
|
|
154
|
-
} catch (
|
|
155
|
-
throw new
|
|
156
|
-
|
|
157
|
-
|
|
168
|
+
} catch (r) {
|
|
169
|
+
throw new g(
|
|
170
|
+
o.provider.userRejectedRequest,
|
|
171
|
+
r instanceof Error ? r.message : "Signing failed"
|
|
158
172
|
);
|
|
159
173
|
}
|
|
160
174
|
}
|
|
161
|
-
async function
|
|
162
|
-
return `0x${
|
|
175
|
+
async function at(t) {
|
|
176
|
+
return `0x${t.getState().chainId.toString(16)}`;
|
|
163
177
|
}
|
|
164
|
-
async function
|
|
165
|
-
await
|
|
178
|
+
async function nt() {
|
|
179
|
+
await w() && await H();
|
|
166
180
|
}
|
|
167
|
-
function
|
|
168
|
-
const
|
|
169
|
-
|
|
181
|
+
function rt(t, e) {
|
|
182
|
+
const a = Number.parseInt(t[0].chainId, 16);
|
|
183
|
+
e.getState().setChainId(a);
|
|
170
184
|
}
|
|
171
|
-
async function
|
|
172
|
-
const
|
|
173
|
-
if (!
|
|
174
|
-
throw new
|
|
175
|
-
|
|
176
|
-
"User does not have an EVM smart account"
|
|
177
|
-
);
|
|
178
|
-
if (!I(c))
|
|
179
|
-
throw new i(
|
|
180
|
-
s.rpc.invalidParams,
|
|
185
|
+
async function st(t, e) {
|
|
186
|
+
const a = t[0].calls, n = (await S()).evmSmartAccounts?.[0], i = e.getState().chainId;
|
|
187
|
+
if (!I(i))
|
|
188
|
+
throw new u(
|
|
189
|
+
o.rpc.invalidParams,
|
|
181
190
|
"Chain ID is not supported for user operations"
|
|
182
191
|
);
|
|
183
192
|
try {
|
|
184
|
-
return (await
|
|
185
|
-
evmSmartAccount:
|
|
186
|
-
calls:
|
|
187
|
-
network: m[
|
|
193
|
+
return (await b({
|
|
194
|
+
evmSmartAccount: n,
|
|
195
|
+
calls: q(a),
|
|
196
|
+
network: m[i]
|
|
188
197
|
})).userOperationHash;
|
|
189
|
-
} catch (
|
|
190
|
-
throw console.log("User operation failed",
|
|
191
|
-
|
|
192
|
-
|
|
198
|
+
} catch (s) {
|
|
199
|
+
throw console.log("User operation failed", s), new u(
|
|
200
|
+
o.rpc.transactionRejected,
|
|
201
|
+
s instanceof Error ? s.message : "User operation failed"
|
|
193
202
|
);
|
|
194
203
|
}
|
|
195
204
|
}
|
|
196
|
-
async function
|
|
197
|
-
const
|
|
198
|
-
if (!
|
|
199
|
-
throw new
|
|
200
|
-
|
|
201
|
-
"User does not have an EVM smart account"
|
|
202
|
-
);
|
|
203
|
-
if (!I(c) || !m[c])
|
|
204
|
-
throw new i(
|
|
205
|
-
s.rpc.invalidParams,
|
|
205
|
+
async function ot(t, e) {
|
|
206
|
+
const a = t[0], n = (await S()).evmSmartAccounts?.[0], i = e.getState().chainId;
|
|
207
|
+
if (!I(i) || !m[i])
|
|
208
|
+
throw new u(
|
|
209
|
+
o.rpc.invalidParams,
|
|
206
210
|
"Chain ID is not supported for user operations"
|
|
207
211
|
);
|
|
208
212
|
try {
|
|
209
|
-
const
|
|
210
|
-
userOperationHash:
|
|
211
|
-
evmSmartAccount:
|
|
212
|
-
network: m[
|
|
213
|
+
const s = await R({
|
|
214
|
+
userOperationHash: a,
|
|
215
|
+
evmSmartAccount: n,
|
|
216
|
+
network: m[i]
|
|
213
217
|
});
|
|
214
|
-
return
|
|
215
|
-
} catch (
|
|
216
|
-
throw console.log("Failed to get user operation status",
|
|
217
|
-
|
|
218
|
+
return B(s);
|
|
219
|
+
} catch (s) {
|
|
220
|
+
throw console.log("Failed to get user operation status", s), new u(
|
|
221
|
+
o.rpc.internal,
|
|
218
222
|
"Failed to get user operation status"
|
|
219
223
|
);
|
|
220
224
|
}
|
|
221
225
|
}
|
|
222
|
-
async function
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
(a, o) => {
|
|
228
|
-
const d = f(Number(o));
|
|
229
|
-
return a[d] = {
|
|
226
|
+
async function it() {
|
|
227
|
+
return !(await v()).evmSmartAccounts?.length ? {} : Object.keys(m).reduce(
|
|
228
|
+
(r, n) => {
|
|
229
|
+
const d = T(Number(n));
|
|
230
|
+
return r[d] = {
|
|
230
231
|
atomic: { status: "supported" },
|
|
231
232
|
paymasterService: { supported: !0 }
|
|
232
|
-
},
|
|
233
|
+
}, r;
|
|
233
234
|
},
|
|
234
235
|
{}
|
|
235
236
|
);
|
|
236
237
|
}
|
|
237
238
|
export {
|
|
238
239
|
Q as handleAccounts,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
240
|
+
at as handleChainId,
|
|
241
|
+
nt as handleDisconnect,
|
|
242
|
+
et as handleEthSign,
|
|
243
|
+
ot as handleGetCallsStatus,
|
|
244
|
+
it as handleGetCapabilities,
|
|
244
245
|
Y as handlePersonalSign,
|
|
245
246
|
X as handleRequestAccounts,
|
|
246
|
-
|
|
247
|
-
|
|
247
|
+
st as handleSendCalls,
|
|
248
|
+
tt as handleSendTransaction,
|
|
248
249
|
Z as handleSignTypedData,
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
250
|
+
rt as handleSwitchEthereumChain,
|
|
251
|
+
q as shimProviderCallsRequest,
|
|
252
|
+
f as shimProviderTxRequest
|
|
252
253
|
};
|
package/dist/web/index.web27.js
CHANGED