@coinbase/cdp-core 0.0.78 → 0.0.79
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 +26 -6
- package/dist/esm/index.native119.js +54 -4
- package/dist/esm/index.native120.js +10 -54
- package/dist/esm/index.native121.js +2 -11
- package/dist/esm/index.native122.js +45 -2
- package/dist/esm/index.native123.js +13 -44
- package/dist/esm/index.native124.js +4 -13
- package/dist/esm/index.native147.js +1 -1
- package/dist/esm/index.native152.js +1 -1
- package/dist/esm/index.native155.js +19 -77
- package/dist/esm/index.native156.js +10 -2
- package/dist/esm/index.native157.js +18 -107
- package/dist/esm/index.native158.js +94 -2
- package/dist/esm/index.native159.js +20 -20
- package/dist/esm/index.native160.js +117 -9
- package/dist/esm/index.native161.js +2 -20
- package/dist/esm/index.native162.js +104 -89
- package/dist/esm/index.native163.js +2 -21
- package/dist/esm/index.native164.js +73 -112
- package/dist/esm/index.native166.js +7 -38
- package/dist/esm/index.native168.js +375 -67
- package/dist/esm/index.native169.js +835 -34
- package/dist/esm/index.native170.js +38 -20
- package/dist/esm/index.native171.js +2 -8
- package/dist/esm/index.native172.js +70 -2
- package/dist/esm/index.native173.js +30 -373
- package/dist/esm/index.native174.js +20 -835
- package/dist/esm/index.native175.js +2 -2
- package/dist/esm/index.native178.js +1 -1
- package/dist/esm/index.native183.js +1 -1
- package/dist/esm/index.native184.js +1 -1
- package/dist/esm/index.native185.js +15 -2
- package/dist/esm/index.native188.js +2 -15
- package/dist/esm/index.native22.js +49 -28
- package/dist/esm/index.native3.js +1 -1
- package/dist/esm/index.native54.js +8 -8
- package/dist/esm/index.native57.js +3 -3
- package/dist/esm/index.native64.js +1 -1
- package/dist/esm/index.native69.js +13 -373
- package/dist/esm/index.native70.js +25 -2
- package/dist/esm/index.native71.js +48 -63
- package/dist/esm/index.native72.js +189 -177
- package/dist/esm/index.native75.js +2 -19
- package/dist/esm/index.native76.js +63 -20
- package/dist/esm/index.native77.js +351 -37
- package/dist/esm/index.native9.js +1 -1
- package/dist/esm/index.web122.js +4 -54
- package/dist/esm/index.web123.js +54 -10
- package/dist/esm/index.web124.js +11 -2
- package/dist/esm/index.web125.js +2 -45
- package/dist/esm/index.web126.js +44 -13
- package/dist/esm/index.web127.js +13 -4
- package/dist/esm/index.web151.js +1 -1
- package/dist/esm/index.web155.js +1 -1
- package/dist/esm/index.web158.js +2 -21
- package/dist/esm/index.web159.js +109 -10
- package/dist/esm/index.web160.js +2 -20
- package/dist/esm/index.web161.js +20 -93
- package/dist/esm/index.web162.js +9 -20
- package/dist/esm/index.web163.js +16 -114
- package/dist/esm/index.web164.js +90 -75
- package/dist/esm/index.web165.js +21 -2
- package/dist/esm/index.web166.js +115 -106
- package/dist/esm/index.web167.js +79 -2
- package/dist/esm/index.web169.js +1 -1
- package/dist/esm/index.web170.js +7 -38
- package/dist/esm/index.web172.js +375 -67
- package/dist/esm/index.web173.js +835 -34
- package/dist/esm/index.web174.js +38 -20
- package/dist/esm/index.web175.js +2 -8
- package/dist/esm/index.web176.js +70 -2
- package/dist/esm/index.web177.js +30 -373
- package/dist/esm/index.web178.js +20 -835
- package/dist/esm/index.web181.js +1 -1
- package/dist/esm/index.web186.js +1 -1
- package/dist/esm/index.web187.js +1 -1
- package/dist/esm/index.web189.js +2 -2
- package/dist/esm/index.web190.js +2 -2
- package/dist/esm/index.web191.js +2 -2
- package/dist/esm/index.web21.js +49 -28
- package/dist/esm/index.web3.js +1 -1
- package/dist/esm/index.web56.js +8 -8
- package/dist/esm/index.web59.js +3 -3
- package/dist/esm/index.web66.js +3 -3
- package/dist/esm/index.web70.js +1 -1
- package/dist/esm/index.web71.js +1 -1
- package/dist/esm/index.web72.js +2 -17
- package/dist/esm/index.web73.js +2 -23
- package/dist/esm/index.web74.js +363 -37
- package/dist/esm/index.web75.js +26 -374
- package/dist/esm/index.web76.js +31 -2
- package/dist/esm/index.web77.js +2 -68
- package/dist/esm/index.web78.js +37 -336
- package/dist/esm/index.web79.js +364 -28
- package/dist/esm/index.web8.js +1 -1
- package/dist/esm/index.web80.js +16 -28
- package/dist/esm/index.web81.js +23 -2
- package/dist/esm/index.web82.js +51 -2
- package/dist/native/index.native119.js +54 -4
- package/dist/native/index.native120.js +10 -54
- package/dist/native/index.native121.js +2 -11
- package/dist/native/index.native122.js +45 -2
- package/dist/native/index.native123.js +13 -44
- package/dist/native/index.native124.js +4 -13
- package/dist/native/index.native147.js +1 -1
- package/dist/native/index.native152.js +1 -1
- package/dist/native/index.native155.js +19 -77
- package/dist/native/index.native156.js +10 -2
- package/dist/native/index.native157.js +18 -107
- package/dist/native/index.native158.js +94 -2
- package/dist/native/index.native159.js +20 -20
- package/dist/native/index.native160.js +117 -9
- package/dist/native/index.native161.js +2 -20
- package/dist/native/index.native162.js +104 -89
- package/dist/native/index.native163.js +2 -21
- package/dist/native/index.native164.js +73 -112
- package/dist/native/index.native166.js +7 -38
- package/dist/native/index.native168.js +375 -67
- package/dist/native/index.native169.js +835 -34
- package/dist/native/index.native170.js +38 -20
- package/dist/native/index.native171.js +2 -8
- package/dist/native/index.native172.js +70 -2
- package/dist/native/index.native173.js +30 -373
- package/dist/native/index.native174.js +20 -835
- package/dist/native/index.native175.js +2 -2
- package/dist/native/index.native178.js +1 -1
- package/dist/native/index.native183.js +1 -1
- package/dist/native/index.native184.js +1 -1
- package/dist/native/index.native185.js +15 -2
- package/dist/native/index.native188.js +2 -15
- package/dist/native/index.native22.js +49 -28
- package/dist/native/index.native3.js +1 -1
- package/dist/native/index.native54.js +8 -8
- package/dist/native/index.native57.js +3 -3
- package/dist/native/index.native64.js +1 -1
- package/dist/native/index.native69.js +13 -373
- package/dist/native/index.native70.js +25 -2
- package/dist/native/index.native71.js +48 -63
- package/dist/native/index.native72.js +189 -177
- package/dist/native/index.native75.js +2 -19
- package/dist/native/index.native76.js +63 -20
- package/dist/native/index.native77.js +351 -37
- package/dist/native/index.native9.js +1 -1
- package/dist/native-types/actions/createEvmSmartAccount.d.ts +1 -0
- package/dist/native-types/solana-kit/toTransactionSigner.d.ts +2 -2
- package/dist/native-types/version.d.ts +1 -1
- package/dist/types/actions/createEvmSmartAccount.d.ts +1 -0
- package/dist/types/solana-kit/toTransactionSigner.d.ts +2 -2
- package/dist/types/version.d.ts +1 -1
- package/dist/web/index.web122.js +4 -54
- package/dist/web/index.web123.js +54 -10
- package/dist/web/index.web124.js +11 -2
- package/dist/web/index.web125.js +2 -45
- package/dist/web/index.web126.js +44 -13
- package/dist/web/index.web127.js +13 -4
- package/dist/web/index.web151.js +1 -1
- package/dist/web/index.web155.js +1 -1
- package/dist/web/index.web158.js +2 -21
- package/dist/web/index.web159.js +109 -10
- package/dist/web/index.web160.js +2 -20
- package/dist/web/index.web161.js +20 -93
- package/dist/web/index.web162.js +9 -20
- package/dist/web/index.web163.js +16 -114
- package/dist/web/index.web164.js +90 -75
- package/dist/web/index.web165.js +21 -2
- package/dist/web/index.web166.js +115 -106
- package/dist/web/index.web167.js +79 -2
- package/dist/web/index.web169.js +1 -1
- package/dist/web/index.web170.js +7 -38
- package/dist/web/index.web172.js +375 -67
- package/dist/web/index.web173.js +835 -34
- package/dist/web/index.web174.js +38 -20
- package/dist/web/index.web175.js +2 -8
- package/dist/web/index.web176.js +70 -2
- package/dist/web/index.web177.js +30 -373
- package/dist/web/index.web178.js +20 -835
- package/dist/web/index.web181.js +1 -1
- package/dist/web/index.web186.js +1 -1
- package/dist/web/index.web187.js +1 -1
- package/dist/web/index.web189.js +2 -2
- package/dist/web/index.web190.js +2 -2
- package/dist/web/index.web191.js +2 -2
- package/dist/web/index.web21.js +49 -28
- package/dist/web/index.web3.js +1 -1
- package/dist/web/index.web56.js +8 -8
- package/dist/web/index.web59.js +3 -3
- package/dist/web/index.web66.js +3 -3
- package/dist/web/index.web70.js +1 -1
- package/dist/web/index.web71.js +1 -1
- package/dist/web/index.web72.js +2 -17
- package/dist/web/index.web73.js +2 -23
- package/dist/web/index.web74.js +363 -37
- package/dist/web/index.web75.js +26 -374
- package/dist/web/index.web76.js +31 -2
- package/dist/web/index.web77.js +2 -68
- package/dist/web/index.web78.js +37 -336
- package/dist/web/index.web79.js +364 -28
- package/dist/web/index.web8.js +1 -1
- package/dist/web/index.web80.js +16 -28
- package/dist/web/index.web81.js +23 -2
- package/dist/web/index.web82.js +51 -2
- package/dist/web-types/actions/createEvmSmartAccount.d.ts +1 -0
- package/dist/web-types/solana-kit/toTransactionSigner.d.ts +2 -2
- package/dist/web-types/version.d.ts +1 -1
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseError as f } from "./index.
|
|
2
|
-
import { pad as g } from "./index.
|
|
1
|
+
import { BaseError as f } from "./index.native76.js";
|
|
2
|
+
import { pad as g } from "./index.native185.js";
|
|
3
3
|
function m(t, i = {}) {
|
|
4
4
|
const { signed: r, size: e } = i, o = BigInt(t);
|
|
5
5
|
let n;
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { SizeExceedsPaddingSizeError as a } from "./index.native175.js";
|
|
2
|
+
function o(r, i = {}) {
|
|
3
|
+
const { dir: n, size: e = 32 } = i;
|
|
4
|
+
if (e === 0)
|
|
5
|
+
return r;
|
|
6
|
+
const t = r.replace("0x", "");
|
|
7
|
+
if (t.length > e * 2)
|
|
8
|
+
throw new a({
|
|
9
|
+
size: Math.ceil(t.length / 2),
|
|
10
|
+
targetSize: e,
|
|
11
|
+
type: "Hex"
|
|
12
|
+
});
|
|
13
|
+
return `0x${t[n === "right" ? "padEnd" : "padStart"](e * 2, "0")}`;
|
|
14
|
+
}
|
|
2
15
|
export {
|
|
3
|
-
|
|
16
|
+
o as pad
|
|
4
17
|
};
|
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
function o(r, i = {}) {
|
|
3
|
-
const { dir: n, size: e = 32 } = i;
|
|
4
|
-
if (e === 0)
|
|
5
|
-
return r;
|
|
6
|
-
const t = r.replace("0x", "");
|
|
7
|
-
if (t.length > e * 2)
|
|
8
|
-
throw new a({
|
|
9
|
-
size: Math.ceil(t.length / 2),
|
|
10
|
-
targetSize: e,
|
|
11
|
-
type: "Hex"
|
|
12
|
-
});
|
|
13
|
-
return `0x${t[n === "right" ? "padEnd" : "padStart"](e * 2, "0")}`;
|
|
14
|
-
}
|
|
1
|
+
var r = { exports: {} };
|
|
15
2
|
export {
|
|
16
|
-
|
|
3
|
+
r as __module
|
|
17
4
|
};
|
|
@@ -1,39 +1,60 @@
|
|
|
1
|
-
import { createEndUserEvmSmartAccount as
|
|
2
|
-
import { Analytics as
|
|
1
|
+
import { APIError as w, createEndUserEvmSmartAccount as A } from "@coinbase/cdp-api-client";
|
|
2
|
+
import { Analytics as h } from "./index.native2.js";
|
|
3
3
|
import "./index.native3.js";
|
|
4
|
-
import { toAuthStateUser as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { validateUserAuthState as
|
|
9
|
-
async function
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
import { toAuthStateUser as f } from "./index.native46.js";
|
|
5
|
+
import { InternalError as l } from "./index.native37.js";
|
|
6
|
+
import { getCoreAuthManager as S, getConfig as E } from "./index.native41.js";
|
|
7
|
+
import { createEvmEoaAccount as g } from "./index.native21.js";
|
|
8
|
+
import { validateUserAuthState as v } from "./index.native55.js";
|
|
9
|
+
async function _(r) {
|
|
10
|
+
h.sendActionCallEvent({ name: "create_evm_smart_account" });
|
|
11
|
+
const n = S(), { user: t, authState: d } = v(
|
|
12
|
+
n.getUser(),
|
|
13
|
+
n.getAuthState()
|
|
14
|
+
);
|
|
15
|
+
let a;
|
|
16
|
+
if (r?.owner) {
|
|
17
|
+
if (!t.evmAccountObjects?.some((o) => o.address === r.owner))
|
|
18
|
+
throw new Error(`Owner address ${r.owner} does not belong to the current user`);
|
|
19
|
+
const m = t.evmSmartAccountObjects?.find(
|
|
20
|
+
(o) => o.ownerAddresses.includes(r.owner)
|
|
21
|
+
);
|
|
22
|
+
if (m)
|
|
23
|
+
throw new Error(
|
|
24
|
+
`Owner address ${r.owner} already controls smart account ${m.address}`
|
|
25
|
+
);
|
|
26
|
+
a = r.owner;
|
|
27
|
+
} else
|
|
28
|
+
try {
|
|
29
|
+
a = await g();
|
|
30
|
+
} catch (e) {
|
|
31
|
+
throw e instanceof w && e.errorType === "account_limit_exceeded" ? new Error(
|
|
32
|
+
"Cannot create smart account: Maximum number of EOA accounts (10) reached. Please provide an existing EOA address using the 'owner' parameter."
|
|
33
|
+
) : e;
|
|
34
|
+
}
|
|
35
|
+
const u = await A(
|
|
36
|
+
E().projectId,
|
|
37
|
+
t.userId,
|
|
17
38
|
{
|
|
18
|
-
owner:
|
|
19
|
-
enableSpendPermissions:
|
|
39
|
+
owner: a,
|
|
40
|
+
enableSpendPermissions: r?.enableSpendPermissions ?? !1
|
|
20
41
|
}
|
|
21
|
-
),
|
|
22
|
-
await
|
|
23
|
-
...
|
|
24
|
-
user:
|
|
42
|
+
), s = f(u);
|
|
43
|
+
await n.setAuthState({
|
|
44
|
+
...d,
|
|
45
|
+
user: s
|
|
25
46
|
});
|
|
26
47
|
const i = new Set(
|
|
27
|
-
|
|
28
|
-
),
|
|
29
|
-
(
|
|
48
|
+
t.evmSmartAccountObjects?.map((e) => e.address) || []
|
|
49
|
+
), c = s.evmSmartAccountObjects?.find(
|
|
50
|
+
(e) => !i.has(e.address)
|
|
30
51
|
)?.address;
|
|
31
|
-
if (!
|
|
32
|
-
throw new
|
|
52
|
+
if (!c)
|
|
53
|
+
throw new l(
|
|
33
54
|
"EVM Smart Account was not created. Check the network log for more details."
|
|
34
55
|
);
|
|
35
|
-
return
|
|
56
|
+
return c;
|
|
36
57
|
}
|
|
37
58
|
export {
|
|
38
|
-
|
|
59
|
+
_ as createEvmSmartAccount
|
|
39
60
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { __require as r } from "./index.
|
|
1
|
+
import { __require as r } from "./index.native166.js";
|
|
2
2
|
r();
|
|
@@ -2,17 +2,17 @@ import { getTransactionEncoder as u, getTransactionDecoder as f, address as g }
|
|
|
2
2
|
import { getCurrentUserSync as l } from "./index.native14.js";
|
|
3
3
|
import { signSolanaTransaction as m } from "./index.native10.js";
|
|
4
4
|
import { encodeBase64 as T, decodeBase64 as h } from "./index.native40.js";
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
if (!
|
|
5
|
+
function E(n) {
|
|
6
|
+
const o = l();
|
|
7
|
+
if (!o || !o.solanaAccountObjects?.length)
|
|
8
8
|
throw new Error(
|
|
9
9
|
"No accounts found. User must be authenticated and have at least one Solana account"
|
|
10
10
|
);
|
|
11
11
|
const r = u(), a = f();
|
|
12
12
|
return {
|
|
13
13
|
address: g(n),
|
|
14
|
-
signTransactions: async (c) => {
|
|
15
|
-
const
|
|
14
|
+
signTransactions: async (c, p) => {
|
|
15
|
+
const t = [];
|
|
16
16
|
for (const s of c) {
|
|
17
17
|
const i = new Uint8Array(r.encode(s)), { signedTransaction: d } = await m({
|
|
18
18
|
solanaAccount: n,
|
|
@@ -20,16 +20,16 @@ function A(n) {
|
|
|
20
20
|
}), e = a.decode(h(d)).signatures[n];
|
|
21
21
|
if (!e)
|
|
22
22
|
throw new Error("Wallet did not return a signature for the selected account.");
|
|
23
|
-
|
|
23
|
+
t.push(
|
|
24
24
|
Object.freeze({
|
|
25
25
|
[n]: e
|
|
26
26
|
})
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
|
-
return
|
|
29
|
+
return t;
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
export {
|
|
34
|
-
|
|
34
|
+
E as toTransactionSigner
|
|
35
35
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CompactSign as i } from "./index.
|
|
2
|
-
import { JWTInvalid as r } from "./index.
|
|
3
|
-
import { JWTClaimsBuilder as n } from "./index.
|
|
1
|
+
import { CompactSign as i } from "./index.native69.js";
|
|
2
|
+
import { JWTInvalid as r } from "./index.native70.js";
|
|
3
|
+
import { JWTClaimsBuilder as n } from "./index.native71.js";
|
|
4
4
|
class d {
|
|
5
5
|
#s;
|
|
6
6
|
#t;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DisconnectedError as l, from as d } from "./index.
|
|
1
|
+
import { DisconnectedError as l, from as d } from "./index.native72.js";
|
|
2
2
|
import { validateRequest as h, EIP1193ProviderError as m, STANDARD_ERROR_CODES as _ } from "./index.native39.js";
|
|
3
3
|
import { createEOAHandlers as p } from "./index.native73.js";
|
|
4
4
|
import { createSmartAccountHandlers as g } from "./index.native74.js";
|
|
@@ -1,379 +1,19 @@
|
|
|
1
|
-
import "./index.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
super(t), Object.defineProperty(this, "name", {
|
|
7
|
-
enumerable: !0,
|
|
8
|
-
configurable: !0,
|
|
9
|
-
writable: !0,
|
|
10
|
-
value: "ProviderRpcError"
|
|
11
|
-
}), Object.defineProperty(this, "code", {
|
|
12
|
-
enumerable: !0,
|
|
13
|
-
configurable: !0,
|
|
14
|
-
writable: !0,
|
|
15
|
-
value: void 0
|
|
16
|
-
}), Object.defineProperty(this, "details", {
|
|
17
|
-
enumerable: !0,
|
|
18
|
-
configurable: !0,
|
|
19
|
-
writable: !0,
|
|
20
|
-
value: void 0
|
|
21
|
-
}), this.code = e, this.details = t;
|
|
1
|
+
import { FlattenedSign as n } from "./index.native119.js";
|
|
2
|
+
class o {
|
|
3
|
+
#e;
|
|
4
|
+
constructor(e) {
|
|
5
|
+
this.#e = new n(e);
|
|
22
6
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
constructor({ message: e = "The user rejected the request." } = {}) {
|
|
26
|
-
super(4001, e), Object.defineProperty(this, "code", {
|
|
27
|
-
enumerable: !0,
|
|
28
|
-
configurable: !0,
|
|
29
|
-
writable: !0,
|
|
30
|
-
value: 4001
|
|
31
|
-
}), Object.defineProperty(this, "name", {
|
|
32
|
-
enumerable: !0,
|
|
33
|
-
configurable: !0,
|
|
34
|
-
writable: !0,
|
|
35
|
-
value: "Provider.UserRejectedRequestError"
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
Object.defineProperty(n, "code", {
|
|
40
|
-
enumerable: !0,
|
|
41
|
-
configurable: !0,
|
|
42
|
-
writable: !0,
|
|
43
|
-
value: 4001
|
|
44
|
-
});
|
|
45
|
-
class a extends u {
|
|
46
|
-
constructor({ message: e = "The requested method and/or account has not been authorized by the user." } = {}) {
|
|
47
|
-
super(4100, e), Object.defineProperty(this, "code", {
|
|
48
|
-
enumerable: !0,
|
|
49
|
-
configurable: !0,
|
|
50
|
-
writable: !0,
|
|
51
|
-
value: 4100
|
|
52
|
-
}), Object.defineProperty(this, "name", {
|
|
53
|
-
enumerable: !0,
|
|
54
|
-
configurable: !0,
|
|
55
|
-
writable: !0,
|
|
56
|
-
value: "Provider.UnauthorizedError"
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
Object.defineProperty(a, "code", {
|
|
61
|
-
enumerable: !0,
|
|
62
|
-
configurable: !0,
|
|
63
|
-
writable: !0,
|
|
64
|
-
value: 4100
|
|
65
|
-
});
|
|
66
|
-
class i extends u {
|
|
67
|
-
constructor({ message: e = "The provider does not support the requested method." } = {}) {
|
|
68
|
-
super(4200, e), Object.defineProperty(this, "code", {
|
|
69
|
-
enumerable: !0,
|
|
70
|
-
configurable: !0,
|
|
71
|
-
writable: !0,
|
|
72
|
-
value: 4200
|
|
73
|
-
}), Object.defineProperty(this, "name", {
|
|
74
|
-
enumerable: !0,
|
|
75
|
-
configurable: !0,
|
|
76
|
-
writable: !0,
|
|
77
|
-
value: "Provider.UnsupportedMethodError"
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
Object.defineProperty(i, "code", {
|
|
82
|
-
enumerable: !0,
|
|
83
|
-
configurable: !0,
|
|
84
|
-
writable: !0,
|
|
85
|
-
value: 4200
|
|
86
|
-
});
|
|
87
|
-
class c extends u {
|
|
88
|
-
constructor({ message: e = "The provider is disconnected from all chains." } = {}) {
|
|
89
|
-
super(4900, e), Object.defineProperty(this, "code", {
|
|
90
|
-
enumerable: !0,
|
|
91
|
-
configurable: !0,
|
|
92
|
-
writable: !0,
|
|
93
|
-
value: 4900
|
|
94
|
-
}), Object.defineProperty(this, "name", {
|
|
95
|
-
enumerable: !0,
|
|
96
|
-
configurable: !0,
|
|
97
|
-
writable: !0,
|
|
98
|
-
value: "Provider.DisconnectedError"
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
Object.defineProperty(c, "code", {
|
|
103
|
-
enumerable: !0,
|
|
104
|
-
configurable: !0,
|
|
105
|
-
writable: !0,
|
|
106
|
-
value: 4900
|
|
107
|
-
});
|
|
108
|
-
class l extends u {
|
|
109
|
-
constructor({ message: e = "The provider is not connected to the requested chain." } = {}) {
|
|
110
|
-
super(4901, e), Object.defineProperty(this, "code", {
|
|
111
|
-
enumerable: !0,
|
|
112
|
-
configurable: !0,
|
|
113
|
-
writable: !0,
|
|
114
|
-
value: 4901
|
|
115
|
-
}), Object.defineProperty(this, "name", {
|
|
116
|
-
enumerable: !0,
|
|
117
|
-
configurable: !0,
|
|
118
|
-
writable: !0,
|
|
119
|
-
value: "Provider.ChainDisconnectedError"
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
Object.defineProperty(l, "code", {
|
|
124
|
-
enumerable: !0,
|
|
125
|
-
configurable: !0,
|
|
126
|
-
writable: !0,
|
|
127
|
-
value: 4901
|
|
128
|
-
});
|
|
129
|
-
class d extends u {
|
|
130
|
-
constructor({ message: e = "An error occurred when attempting to switch chain." } = {}) {
|
|
131
|
-
super(4902, e), Object.defineProperty(this, "code", {
|
|
132
|
-
enumerable: !0,
|
|
133
|
-
configurable: !0,
|
|
134
|
-
writable: !0,
|
|
135
|
-
value: 4902
|
|
136
|
-
}), Object.defineProperty(this, "name", {
|
|
137
|
-
enumerable: !0,
|
|
138
|
-
configurable: !0,
|
|
139
|
-
writable: !0,
|
|
140
|
-
value: "Provider.SwitchChainError"
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
Object.defineProperty(d, "code", {
|
|
145
|
-
enumerable: !0,
|
|
146
|
-
configurable: !0,
|
|
147
|
-
writable: !0,
|
|
148
|
-
value: 4902
|
|
149
|
-
});
|
|
150
|
-
class b extends u {
|
|
151
|
-
constructor({ message: e = "This Wallet does not support a capability that was not marked as optional." } = {}) {
|
|
152
|
-
super(5700, e), Object.defineProperty(this, "code", {
|
|
153
|
-
enumerable: !0,
|
|
154
|
-
configurable: !0,
|
|
155
|
-
writable: !0,
|
|
156
|
-
value: 5700
|
|
157
|
-
}), Object.defineProperty(this, "name", {
|
|
158
|
-
enumerable: !0,
|
|
159
|
-
configurable: !0,
|
|
160
|
-
writable: !0,
|
|
161
|
-
value: "Provider.UnsupportedNonOptionalCapabilityError"
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
Object.defineProperty(b, "code", {
|
|
166
|
-
enumerable: !0,
|
|
167
|
-
configurable: !0,
|
|
168
|
-
writable: !0,
|
|
169
|
-
value: 5700
|
|
170
|
-
});
|
|
171
|
-
class s extends u {
|
|
172
|
-
constructor({ message: e = "This Wallet does not support the requested chain ID." } = {}) {
|
|
173
|
-
super(5710, e), Object.defineProperty(this, "code", {
|
|
174
|
-
enumerable: !0,
|
|
175
|
-
configurable: !0,
|
|
176
|
-
writable: !0,
|
|
177
|
-
value: 5710
|
|
178
|
-
}), Object.defineProperty(this, "name", {
|
|
179
|
-
enumerable: !0,
|
|
180
|
-
configurable: !0,
|
|
181
|
-
writable: !0,
|
|
182
|
-
value: "Provider.UnsupportedChainIdError"
|
|
183
|
-
});
|
|
7
|
+
setProtectedHeader(e) {
|
|
8
|
+
return this.#e.setProtectedHeader(e), this;
|
|
184
9
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
value: 5710
|
|
191
|
-
});
|
|
192
|
-
class f extends u {
|
|
193
|
-
constructor({ message: e = "There is already a bundle submitted with this ID." } = {}) {
|
|
194
|
-
super(5720, e), Object.defineProperty(this, "code", {
|
|
195
|
-
enumerable: !0,
|
|
196
|
-
configurable: !0,
|
|
197
|
-
writable: !0,
|
|
198
|
-
value: 5720
|
|
199
|
-
}), Object.defineProperty(this, "name", {
|
|
200
|
-
enumerable: !0,
|
|
201
|
-
configurable: !0,
|
|
202
|
-
writable: !0,
|
|
203
|
-
value: "Provider.DuplicateIdError"
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
Object.defineProperty(f, "code", {
|
|
208
|
-
enumerable: !0,
|
|
209
|
-
configurable: !0,
|
|
210
|
-
writable: !0,
|
|
211
|
-
value: 5720
|
|
212
|
-
});
|
|
213
|
-
class p extends u {
|
|
214
|
-
constructor({ message: e = "This bundle id is unknown / has not been submitted." } = {}) {
|
|
215
|
-
super(5730, e), Object.defineProperty(this, "code", {
|
|
216
|
-
enumerable: !0,
|
|
217
|
-
configurable: !0,
|
|
218
|
-
writable: !0,
|
|
219
|
-
value: 5730
|
|
220
|
-
}), Object.defineProperty(this, "name", {
|
|
221
|
-
enumerable: !0,
|
|
222
|
-
configurable: !0,
|
|
223
|
-
writable: !0,
|
|
224
|
-
value: "Provider.UnknownBundleIdError"
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
Object.defineProperty(p, "code", {
|
|
229
|
-
enumerable: !0,
|
|
230
|
-
configurable: !0,
|
|
231
|
-
writable: !0,
|
|
232
|
-
value: 5730
|
|
233
|
-
});
|
|
234
|
-
class h extends u {
|
|
235
|
-
constructor({ message: e = "The call bundle is too large for the Wallet to process." } = {}) {
|
|
236
|
-
super(5740, e), Object.defineProperty(this, "code", {
|
|
237
|
-
enumerable: !0,
|
|
238
|
-
configurable: !0,
|
|
239
|
-
writable: !0,
|
|
240
|
-
value: 5740
|
|
241
|
-
}), Object.defineProperty(this, "name", {
|
|
242
|
-
enumerable: !0,
|
|
243
|
-
configurable: !0,
|
|
244
|
-
writable: !0,
|
|
245
|
-
value: "Provider.BundleTooLargeError"
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
Object.defineProperty(h, "code", {
|
|
250
|
-
enumerable: !0,
|
|
251
|
-
configurable: !0,
|
|
252
|
-
writable: !0,
|
|
253
|
-
value: 5740
|
|
254
|
-
});
|
|
255
|
-
class m extends u {
|
|
256
|
-
constructor({ message: e = "The Wallet can support atomicity after an upgrade, but the user rejected the upgrade." } = {}) {
|
|
257
|
-
super(5750, e), Object.defineProperty(this, "code", {
|
|
258
|
-
enumerable: !0,
|
|
259
|
-
configurable: !0,
|
|
260
|
-
writable: !0,
|
|
261
|
-
value: 5750
|
|
262
|
-
}), Object.defineProperty(this, "name", {
|
|
263
|
-
enumerable: !0,
|
|
264
|
-
configurable: !0,
|
|
265
|
-
writable: !0,
|
|
266
|
-
value: "Provider.AtomicReadyWalletRejectedUpgradeError"
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
Object.defineProperty(m, "code", {
|
|
271
|
-
enumerable: !0,
|
|
272
|
-
configurable: !0,
|
|
273
|
-
writable: !0,
|
|
274
|
-
value: 5750
|
|
275
|
-
});
|
|
276
|
-
class w extends u {
|
|
277
|
-
constructor({ message: e = "The wallet does not support atomic execution but the request requires it." } = {}) {
|
|
278
|
-
super(5760, e), Object.defineProperty(this, "code", {
|
|
279
|
-
enumerable: !0,
|
|
280
|
-
configurable: !0,
|
|
281
|
-
writable: !0,
|
|
282
|
-
value: 5760
|
|
283
|
-
}), Object.defineProperty(this, "name", {
|
|
284
|
-
enumerable: !0,
|
|
285
|
-
configurable: !0,
|
|
286
|
-
writable: !0,
|
|
287
|
-
value: "Provider.AtomicityNotSupportedError"
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
Object.defineProperty(w, "code", {
|
|
292
|
-
enumerable: !0,
|
|
293
|
-
configurable: !0,
|
|
294
|
-
writable: !0,
|
|
295
|
-
value: 5760
|
|
296
|
-
});
|
|
297
|
-
function q(r, e = {}) {
|
|
298
|
-
const { includeEvents: t = !0 } = e;
|
|
299
|
-
if (!r)
|
|
300
|
-
throw new E();
|
|
301
|
-
return {
|
|
302
|
-
...t ? {
|
|
303
|
-
on: r.on?.bind(r),
|
|
304
|
-
removeListener: r.removeListener?.bind(r)
|
|
305
|
-
} : {},
|
|
306
|
-
async request(v) {
|
|
307
|
-
try {
|
|
308
|
-
const o = await r.request(v);
|
|
309
|
-
return o && typeof o == "object" && "jsonrpc" in o ? y(o) : o;
|
|
310
|
-
} catch (o) {
|
|
311
|
-
throw O(o);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
function O(r) {
|
|
317
|
-
const e = j(r);
|
|
318
|
-
if (e instanceof g) {
|
|
319
|
-
if (!e.data)
|
|
320
|
-
return e;
|
|
321
|
-
const { code: t } = e.data;
|
|
322
|
-
if (t === c.code)
|
|
323
|
-
return new c(e);
|
|
324
|
-
if (t === l.code)
|
|
325
|
-
return new l(e);
|
|
326
|
-
if (t === n.code)
|
|
327
|
-
return new n(e);
|
|
328
|
-
if (t === a.code)
|
|
329
|
-
return new a(e);
|
|
330
|
-
if (t === i.code)
|
|
331
|
-
return new i(e);
|
|
332
|
-
if (t === d.code)
|
|
333
|
-
return new d(e);
|
|
334
|
-
if (t === m.code)
|
|
335
|
-
return new m(e);
|
|
336
|
-
if (t === w.code)
|
|
337
|
-
return new w(e);
|
|
338
|
-
if (t === h.code)
|
|
339
|
-
return new h(e);
|
|
340
|
-
if (t === p.code)
|
|
341
|
-
return new p(e);
|
|
342
|
-
if (t === f.code)
|
|
343
|
-
return new f(e);
|
|
344
|
-
if (t === s.code)
|
|
345
|
-
return new s(e);
|
|
346
|
-
if (t === b.code)
|
|
347
|
-
return new b(e);
|
|
348
|
-
}
|
|
349
|
-
return e;
|
|
350
|
-
}
|
|
351
|
-
class E extends P {
|
|
352
|
-
constructor() {
|
|
353
|
-
super("`provider` is undefined."), Object.defineProperty(this, "name", {
|
|
354
|
-
enumerable: !0,
|
|
355
|
-
configurable: !0,
|
|
356
|
-
writable: !0,
|
|
357
|
-
value: "Provider.IsUndefinedError"
|
|
358
|
-
});
|
|
10
|
+
async sign(e, r) {
|
|
11
|
+
const t = await this.#e.sign(e, r);
|
|
12
|
+
if (t.payload === void 0)
|
|
13
|
+
throw new TypeError("use the flattened module for creating JWS with b64: false");
|
|
14
|
+
return `${t.protected}.${t.payload}.${t.signature}`;
|
|
359
15
|
}
|
|
360
16
|
}
|
|
361
17
|
export {
|
|
362
|
-
|
|
363
|
-
w as AtomicityNotSupportedError,
|
|
364
|
-
h as BundleTooLargeError,
|
|
365
|
-
l as ChainDisconnectedError,
|
|
366
|
-
c as DisconnectedError,
|
|
367
|
-
f as DuplicateIdError,
|
|
368
|
-
E as IsUndefinedError,
|
|
369
|
-
u as ProviderRpcError,
|
|
370
|
-
d as SwitchChainError,
|
|
371
|
-
a as UnauthorizedError,
|
|
372
|
-
p as UnknownBundleIdError,
|
|
373
|
-
s as UnsupportedChainIdError,
|
|
374
|
-
i as UnsupportedMethodError,
|
|
375
|
-
b as UnsupportedNonOptionalCapabilityError,
|
|
376
|
-
n as UserRejectedRequestError,
|
|
377
|
-
q as from,
|
|
378
|
-
O as parseError
|
|
18
|
+
o as CompactSign
|
|
379
19
|
};
|
|
@@ -1,2 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
class c extends Error {
|
|
2
|
+
static code = "ERR_JOSE_GENERIC";
|
|
3
|
+
code = "ERR_JOSE_GENERIC";
|
|
4
|
+
constructor(s, e) {
|
|
5
|
+
super(s, e), this.name = this.constructor.name, Error.captureStackTrace?.(this, this.constructor);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
class E extends c {
|
|
9
|
+
static code = "ERR_JOSE_NOT_SUPPORTED";
|
|
10
|
+
code = "ERR_JOSE_NOT_SUPPORTED";
|
|
11
|
+
}
|
|
12
|
+
class o extends c {
|
|
13
|
+
static code = "ERR_JWS_INVALID";
|
|
14
|
+
code = "ERR_JWS_INVALID";
|
|
15
|
+
}
|
|
16
|
+
class r extends c {
|
|
17
|
+
static code = "ERR_JWT_INVALID";
|
|
18
|
+
code = "ERR_JWT_INVALID";
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
c as JOSEError,
|
|
22
|
+
E as JOSENotSupported,
|
|
23
|
+
o as JWSInvalid,
|
|
24
|
+
r as JWTInvalid
|
|
25
|
+
};
|