@coinbase/cdp-core 0.0.113 → 0.0.114
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.web110.js +2 -2
- package/dist/esm/index.web126.js +11 -11
- package/dist/esm/index.web128.js +12 -12
- package/dist/esm/index.web129.js +12 -12
- package/dist/esm/index.web130.js +1 -1
- package/dist/esm/index.web131.js +1 -1
- package/dist/esm/index.web133.js +1 -1
- package/dist/esm/index.web135.js +4 -4
- package/dist/esm/index.web136.js +11 -943
- package/dist/esm/index.web137.js +12 -2
- package/dist/esm/index.web138.js +944 -49
- package/dist/esm/index.web139.js +2 -27
- package/dist/esm/index.web140.js +50 -5
- package/dist/esm/index.web141.js +26 -47
- package/dist/esm/index.web142.js +14 -4
- package/dist/esm/index.web143.js +18 -4
- package/dist/esm/index.web144.js +7 -28
- package/dist/esm/index.web145.js +3 -7
- package/dist/esm/index.web146.js +28 -3
- package/dist/esm/index.web147.js +8 -28
- package/dist/esm/index.web148.js +7 -8
- package/dist/esm/index.web149.js +80 -7
- package/dist/esm/index.web150.js +19 -71
- package/dist/esm/index.web151.js +3 -28
- package/dist/esm/index.web152.js +15 -3
- package/dist/esm/index.web153.js +4 -15
- package/dist/esm/index.web154.js +14 -4
- package/dist/esm/index.web155.js +19 -14
- package/dist/esm/index.web156.js +57 -15
- package/dist/esm/index.web157.js +16 -60
- package/dist/esm/index.web158.js +23 -17
- package/dist/esm/index.web159.js +8 -23
- package/dist/esm/index.web160.js +42 -8
- package/dist/esm/index.web161.js +7 -42
- package/dist/esm/index.web162.js +20 -7
- package/dist/esm/index.web163.js +5 -21
- package/dist/esm/index.web164.js +43 -50
- package/dist/esm/index.web165.js +4 -10
- package/dist/esm/index.web166.js +55 -2
- package/dist/esm/index.web167.js +11 -45
- package/dist/esm/index.web168.js +2 -14
- package/dist/esm/index.web169.js +44 -12
- package/dist/esm/index.web170.js +13 -11
- package/dist/esm/index.web171.js +104 -2
- package/dist/esm/index.web172.js +79 -2
- package/dist/esm/index.web173.js +78 -13
- package/dist/esm/index.web174.js +20 -54
- package/dist/esm/index.web175.js +32 -6
- package/dist/esm/index.web176.js +10 -19
- package/dist/esm/index.web177.js +4 -17
- package/dist/esm/index.web178.js +49 -39
- package/dist/esm/index.web179.js +55 -3
- package/dist/esm/index.web181.js +1 -1
- package/dist/esm/index.web182.js +43 -10
- package/dist/esm/index.web183.js +13 -4
- package/dist/esm/index.web184.js +6 -28
- package/dist/esm/index.web185.js +104 -6
- package/dist/esm/index.web186.js +17 -32
- package/dist/esm/index.web187.js +8 -12
- package/dist/esm/index.web188.js +9 -54
- package/dist/esm/index.web189.js +11 -42
- package/dist/esm/index.web190.js +13 -127
- package/dist/esm/index.web191.js +3 -104
- package/dist/esm/index.web192.js +6 -6
- package/dist/esm/index.web193.js +43 -3
- package/dist/esm/index.web194.js +11 -11
- package/dist/esm/index.web195.js +15 -2
- package/dist/esm/index.web196.js +19 -2
- package/dist/esm/index.web197.js +9 -34
- package/dist/esm/index.web198.js +28 -6
- package/dist/esm/index.web199.js +126 -33
- package/dist/esm/index.web2.js +2 -2
- package/dist/esm/index.web200.js +6 -14
- package/dist/esm/index.web201.js +3 -35
- package/dist/esm/index.web202.js +2 -19
- package/dist/esm/index.web203.js +2 -9
- package/dist/esm/index.web204.js +36 -9
- package/dist/esm/index.web205.js +6 -11
- package/dist/esm/index.web206.js +33 -12
- package/dist/esm/index.web207.js +34 -5
- package/dist/esm/index.web208.js +6 -5
- package/dist/esm/index.web209.js +5 -11
- package/dist/esm/index.web210.js +11 -2
- package/dist/esm/index.web211.js +2 -109
- package/dist/esm/index.web212.js +2 -2
- package/dist/esm/index.web213.js +2 -8
- package/dist/esm/index.web214.js +109 -2
- package/dist/esm/index.web215.js +2 -369
- package/dist/esm/index.web216.js +46 -826
- package/dist/esm/index.web217.js +7 -38
- package/dist/esm/index.web219.js +358 -67
- package/dist/esm/index.web220.js +852 -34
- package/dist/esm/index.web221.js +38 -14
- package/dist/esm/index.web222.js +2 -21
- package/dist/esm/index.web223.js +70 -10
- package/dist/esm/index.web224.js +34 -19
- package/dist/esm/index.web225.js +13 -92
- package/dist/esm/index.web226.js +20 -20
- package/dist/esm/index.web227.js +9 -117
- package/dist/esm/index.web228.js +17 -101
- package/dist/esm/index.web229.js +90 -75
- package/dist/esm/index.web230.js +21 -79
- package/dist/esm/index.web231.js +115 -44
- package/dist/esm/index.web232.js +19 -3
- package/dist/esm/index.web233.js +2 -21
- package/dist/esm/index.web234.js +7 -2
- package/dist/esm/index.web235.js +31 -18
- package/dist/esm/index.web236.js +18 -30
- package/dist/esm/index.web237.js +3 -6
- package/dist/esm/index.web238.js +2 -2
- package/dist/esm/index.web239.js +2 -2
- package/dist/esm/index.web240.js +2 -2
- package/dist/esm/index.web247.js +1 -1
- package/dist/esm/index.web250.js +1 -1
- package/dist/esm/index.web3.js +1 -1
- package/dist/esm/index.web53.js +40 -35
- package/dist/esm/index.web69.js +52 -48
- package/dist/esm/index.web87.js +21 -21
- package/dist/esm/index.web9.js +1 -1
- package/dist/esm/index.web91.js +55 -49
- package/dist/esm/index.web97.js +19 -11
- package/dist/esm/index.web99.js +1 -1
- package/dist/native/index.native109.js +3 -3
- package/dist/native/index.native11.js +1 -1
- package/dist/native/index.native112.js +2 -2
- package/dist/native/index.native116.js +3 -3
- package/dist/native/index.native129.js +16 -89
- package/dist/native/index.native130.js +21 -15
- package/dist/native/index.native131.js +49 -21
- package/dist/native/index.native132.js +363 -37
- package/dist/native/index.native133.js +2 -379
- package/dist/native/index.native134.js +65 -28
- package/dist/native/index.native135.js +364 -28
- package/dist/native/index.native136.js +92 -2
- package/dist/native/index.native137.js +28 -65
- package/dist/native/index.native138.js +28 -364
- package/dist/native/index.native143.js +55 -5
- package/dist/native/index.native144.js +10 -47
- package/dist/native/index.native145.js +2 -35
- package/dist/native/index.native146.js +43 -66
- package/dist/native/index.native147.js +13 -54
- package/dist/native/index.native148.js +4 -10
- package/dist/native/index.native149.js +5 -2
- package/dist/native/index.native150.js +47 -44
- package/dist/native/index.native151.js +34 -13
- package/dist/native/index.native152.js +67 -4
- package/dist/native/index.native153.js +13 -12
- package/dist/native/index.native154.js +27 -11
- package/dist/native/index.native155.js +7 -13
- package/dist/native/index.native156.js +3 -27
- package/dist/native/index.native157.js +27 -7
- package/dist/native/index.native158.js +8 -3
- package/dist/native/index.native159.js +7 -27
- package/dist/native/index.native160.js +79 -8
- package/dist/native/index.native161.js +27 -7
- package/dist/native/index.native162.js +3 -79
- package/dist/native/index.native163.js +5 -18
- package/dist/native/index.native164.js +4 -3
- package/dist/native/index.native165.js +3 -4
- package/dist/native/index.native166.js +19 -4
- package/dist/native/index.native167.js +52 -5
- package/dist/native/index.native168.js +17 -19
- package/dist/native/index.native169.js +18 -55
- package/dist/native/index.native170.js +8 -17
- package/dist/native/index.native171.js +37 -19
- package/dist/native/index.native172.js +7 -8
- package/dist/native/index.native173.js +17 -38
- package/dist/native/index.native174.js +12 -7
- package/dist/native/index.native175.js +11 -20
- package/dist/native/index.native194.js +1 -1
- package/dist/native/index.native196.js +1 -1
- package/dist/native/index.native197.js +2 -2
- package/dist/native/index.native2.js +2 -2
- package/dist/native/index.native205.js +2 -2
- package/dist/native/index.native215.js +1 -1
- package/dist/native/index.native219.js +1 -1
- package/dist/native/index.native221.js +2 -109
- package/dist/native/index.native222.js +109 -2
- package/dist/native/index.native223.js +2 -2
- package/dist/native/index.native224.js +38 -103
- package/dist/native/index.native225.js +2 -79
- package/dist/native/index.native226.js +69 -78
- package/dist/native/index.native227.js +33 -37
- package/dist/native/index.native228.js +15 -2
- package/dist/native/index.native229.js +7 -69
- package/dist/native/index.native230.js +2 -35
- package/dist/native/index.native231.js +357 -11
- package/dist/native/index.native232.js +852 -7
- package/dist/native/index.native233.js +104 -2
- package/dist/native/index.native234.js +71 -361
- package/dist/native/index.native235.js +78 -826
- package/dist/native/index.native241.js +1 -1
- package/dist/native/index.native243.js +1 -1
- package/dist/native/index.native248.js +1 -1
- package/dist/native/index.native249.js +1 -1
- package/dist/native/index.native3.js +1 -1
- package/dist/native/index.native55.js +40 -35
- package/dist/native/index.native71.js +52 -48
- package/dist/native/index.native86.js +1 -1
- package/dist/native/index.native89.js +23 -23
- package/dist/native/index.native93.js +55 -49
- package/dist/native/index.native99.js +19 -11
- package/dist/native-types/version.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/web/index.web110.js +2 -2
- package/dist/web/index.web126.js +11 -11
- package/dist/web/index.web128.js +12 -12
- package/dist/web/index.web129.js +12 -12
- package/dist/web/index.web130.js +1 -1
- package/dist/web/index.web131.js +1 -1
- package/dist/web/index.web133.js +1 -1
- package/dist/web/index.web135.js +4 -4
- package/dist/web/index.web136.js +11 -943
- package/dist/web/index.web137.js +12 -2
- package/dist/web/index.web138.js +944 -49
- package/dist/web/index.web139.js +2 -27
- package/dist/web/index.web140.js +50 -5
- package/dist/web/index.web141.js +26 -47
- package/dist/web/index.web142.js +14 -4
- package/dist/web/index.web143.js +18 -4
- package/dist/web/index.web144.js +7 -28
- package/dist/web/index.web145.js +3 -7
- package/dist/web/index.web146.js +28 -3
- package/dist/web/index.web147.js +8 -28
- package/dist/web/index.web148.js +7 -8
- package/dist/web/index.web149.js +80 -7
- package/dist/web/index.web150.js +19 -71
- package/dist/web/index.web151.js +3 -28
- package/dist/web/index.web152.js +15 -3
- package/dist/web/index.web153.js +4 -15
- package/dist/web/index.web154.js +14 -4
- package/dist/web/index.web155.js +19 -14
- package/dist/web/index.web156.js +57 -15
- package/dist/web/index.web157.js +16 -60
- package/dist/web/index.web158.js +23 -17
- package/dist/web/index.web159.js +8 -23
- package/dist/web/index.web160.js +42 -8
- package/dist/web/index.web161.js +7 -42
- package/dist/web/index.web162.js +20 -7
- package/dist/web/index.web163.js +5 -21
- package/dist/web/index.web164.js +43 -50
- package/dist/web/index.web165.js +4 -10
- package/dist/web/index.web166.js +55 -2
- package/dist/web/index.web167.js +11 -45
- package/dist/web/index.web168.js +2 -14
- package/dist/web/index.web169.js +44 -12
- package/dist/web/index.web170.js +13 -11
- package/dist/web/index.web171.js +104 -2
- package/dist/web/index.web172.js +79 -2
- package/dist/web/index.web173.js +78 -13
- package/dist/web/index.web174.js +20 -54
- package/dist/web/index.web175.js +32 -6
- package/dist/web/index.web176.js +10 -19
- package/dist/web/index.web177.js +4 -17
- package/dist/web/index.web178.js +49 -39
- package/dist/web/index.web179.js +55 -3
- package/dist/web/index.web181.js +1 -1
- package/dist/web/index.web182.js +43 -10
- package/dist/web/index.web183.js +13 -4
- package/dist/web/index.web184.js +6 -28
- package/dist/web/index.web185.js +104 -6
- package/dist/web/index.web186.js +17 -32
- package/dist/web/index.web187.js +8 -12
- package/dist/web/index.web188.js +9 -54
- package/dist/web/index.web189.js +11 -42
- package/dist/web/index.web190.js +13 -127
- package/dist/web/index.web191.js +3 -104
- package/dist/web/index.web192.js +6 -6
- package/dist/web/index.web193.js +43 -3
- package/dist/web/index.web194.js +11 -11
- package/dist/web/index.web195.js +15 -2
- package/dist/web/index.web196.js +19 -2
- package/dist/web/index.web197.js +9 -34
- package/dist/web/index.web198.js +28 -6
- package/dist/web/index.web199.js +126 -33
- package/dist/web/index.web2.js +2 -2
- package/dist/web/index.web200.js +6 -14
- package/dist/web/index.web201.js +3 -35
- package/dist/web/index.web202.js +2 -19
- package/dist/web/index.web203.js +2 -9
- package/dist/web/index.web204.js +36 -9
- package/dist/web/index.web205.js +6 -11
- package/dist/web/index.web206.js +33 -12
- package/dist/web/index.web207.js +34 -5
- package/dist/web/index.web208.js +6 -5
- package/dist/web/index.web209.js +5 -11
- package/dist/web/index.web210.js +11 -2
- package/dist/web/index.web211.js +2 -109
- package/dist/web/index.web212.js +2 -2
- package/dist/web/index.web213.js +2 -8
- package/dist/web/index.web214.js +109 -2
- package/dist/web/index.web215.js +2 -369
- package/dist/web/index.web216.js +46 -826
- package/dist/web/index.web217.js +7 -38
- package/dist/web/index.web219.js +358 -67
- package/dist/web/index.web220.js +852 -34
- package/dist/web/index.web221.js +38 -14
- package/dist/web/index.web222.js +2 -21
- package/dist/web/index.web223.js +70 -10
- package/dist/web/index.web224.js +34 -19
- package/dist/web/index.web225.js +13 -92
- package/dist/web/index.web226.js +20 -20
- package/dist/web/index.web227.js +9 -117
- package/dist/web/index.web228.js +17 -101
- package/dist/web/index.web229.js +90 -75
- package/dist/web/index.web230.js +21 -79
- package/dist/web/index.web231.js +115 -44
- package/dist/web/index.web232.js +19 -3
- package/dist/web/index.web233.js +2 -21
- package/dist/web/index.web234.js +7 -2
- package/dist/web/index.web235.js +31 -18
- package/dist/web/index.web236.js +18 -30
- package/dist/web/index.web237.js +3 -6
- package/dist/web/index.web238.js +2 -2
- package/dist/web/index.web239.js +2 -2
- package/dist/web/index.web240.js +2 -2
- package/dist/web/index.web247.js +1 -1
- package/dist/web/index.web250.js +1 -1
- package/dist/web/index.web3.js +1 -1
- package/dist/web/index.web53.js +40 -35
- package/dist/web/index.web69.js +52 -48
- package/dist/web/index.web87.js +21 -21
- package/dist/web/index.web9.js +1 -1
- package/dist/web/index.web91.js +55 -49
- package/dist/web/index.web97.js +19 -11
- package/dist/web/index.web99.js +1 -1
- package/dist/web-types/version.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { __require as r } from "./index.
|
|
1
|
+
import { __require as r } from "./index.native229.js";
|
|
2
2
|
r();
|
|
@@ -1,61 +1,66 @@
|
|
|
1
|
-
import { APIError as
|
|
2
|
-
import { Analytics as
|
|
1
|
+
import { APIError as A, createEndUserEvmSmartAccount as h } from "@coinbase/cdp-api-client";
|
|
2
|
+
import { Analytics as f } from "./index.native2.js";
|
|
3
3
|
import "./index.native3.js";
|
|
4
|
-
import { toAuthStateUser as
|
|
5
|
-
import { InternalError as
|
|
6
|
-
import { createEvmEoaAccount as
|
|
7
|
-
import { validateUserAuthState as
|
|
8
|
-
import { getCoreAuthManager as
|
|
9
|
-
async function
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
import { toAuthStateUser as l } from "./index.native103.js";
|
|
5
|
+
import { InternalError as S } from "./index.native90.js";
|
|
6
|
+
import { createEvmEoaAccount as E } from "./index.native54.js";
|
|
7
|
+
import { validateUserAuthState as g } from "./index.native104.js";
|
|
8
|
+
import { getCoreAuthManager as p, getConfig as v } from "./index.native76.js";
|
|
9
|
+
async function M(r) {
|
|
10
|
+
f.sendActionCallEvent({ name: "create_evm_smart_account" });
|
|
11
|
+
const o = p(), { user: t, authState: d } = g(
|
|
12
|
+
o.getUser(),
|
|
13
|
+
o.getAuthState()
|
|
14
14
|
);
|
|
15
|
-
let
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
let n;
|
|
16
|
+
if (r?.owner) {
|
|
17
|
+
const e = r.owner.toLowerCase();
|
|
18
|
+
if (!t.evmAccountObjects?.some(
|
|
19
|
+
(a) => a.address.toLowerCase() === e
|
|
20
|
+
))
|
|
21
|
+
throw new Error(`Owner address ${r.owner} does not belong to the current user`);
|
|
19
22
|
const m = t.evmSmartAccountObjects?.find(
|
|
20
|
-
(
|
|
23
|
+
(a) => a.ownerAddresses.some(
|
|
24
|
+
(w) => w.toLowerCase() === e
|
|
25
|
+
)
|
|
21
26
|
);
|
|
22
27
|
if (m)
|
|
23
28
|
throw new Error(
|
|
24
|
-
`Owner address ${
|
|
29
|
+
`Owner address ${r.owner} already controls smart account ${m.address}`
|
|
25
30
|
);
|
|
26
|
-
|
|
31
|
+
n = r.owner;
|
|
27
32
|
} else
|
|
28
33
|
try {
|
|
29
|
-
|
|
30
|
-
} catch (
|
|
31
|
-
throw
|
|
34
|
+
n = await E();
|
|
35
|
+
} catch (e) {
|
|
36
|
+
throw e instanceof A && e.errorType === "account_limit_exceeded" ? new Error(
|
|
32
37
|
"Cannot create smart account: Maximum number of EOA accounts (10) reached. Please provide an existing EOA address using the 'owner' parameter."
|
|
33
|
-
) :
|
|
38
|
+
) : e;
|
|
34
39
|
}
|
|
35
|
-
const
|
|
40
|
+
const i = await h(
|
|
36
41
|
t.userId,
|
|
37
42
|
{
|
|
38
|
-
owner:
|
|
39
|
-
enableSpendPermissions:
|
|
43
|
+
owner: n,
|
|
44
|
+
enableSpendPermissions: r?.enableSpendPermissions ?? !1
|
|
40
45
|
},
|
|
41
|
-
{ projectID:
|
|
42
|
-
|
|
43
|
-
), s =
|
|
44
|
-
await
|
|
46
|
+
{ projectID: v().projectId },
|
|
47
|
+
r?.idempotencyKey
|
|
48
|
+
), s = l(i);
|
|
49
|
+
await o.setAuthState({
|
|
45
50
|
...d,
|
|
46
51
|
user: s
|
|
47
52
|
});
|
|
48
|
-
const
|
|
49
|
-
t.evmSmartAccountObjects?.map((
|
|
53
|
+
const u = new Set(
|
|
54
|
+
t.evmSmartAccountObjects?.map((e) => e.address) || []
|
|
50
55
|
), c = s.evmSmartAccountObjects?.find(
|
|
51
|
-
(
|
|
56
|
+
(e) => !u.has(e.address)
|
|
52
57
|
)?.address;
|
|
53
58
|
if (!c)
|
|
54
|
-
throw new
|
|
59
|
+
throw new S(
|
|
55
60
|
"EVM Smart Account was not created. Check the network log for more details."
|
|
56
61
|
);
|
|
57
62
|
return c;
|
|
58
63
|
}
|
|
59
64
|
export {
|
|
60
|
-
|
|
65
|
+
M as createEvmSmartAccount
|
|
61
66
|
};
|
|
@@ -2,50 +2,52 @@ import { Analytics as m } from "./index.native2.js";
|
|
|
2
2
|
import "./index.native3.js";
|
|
3
3
|
import { getCurrentUserSync as u } from "./index.native46.js";
|
|
4
4
|
import { sendEvmEoaUsdc as l } from "./index.native68.js";
|
|
5
|
-
import { sendEvmSmartAccountUsdc as
|
|
6
|
-
import { sendSolanaUsdc as
|
|
7
|
-
const
|
|
5
|
+
import { sendEvmSmartAccountUsdc as w } from "./index.native69.js";
|
|
6
|
+
import { sendSolanaUsdc as f } from "./index.native70.js";
|
|
7
|
+
const $ = async (t) => {
|
|
8
8
|
m.sendActionCallEvent({ name: "send_usdc" });
|
|
9
|
-
const { to:
|
|
9
|
+
const { to: o, amount: a } = t, r = u();
|
|
10
10
|
if (!r)
|
|
11
11
|
throw new Error("User must be authenticated to send USDC");
|
|
12
|
-
const e = "from" in t && t.from ? t.from : v(r),
|
|
13
|
-
return A(
|
|
12
|
+
const e = "from" in t && t.from ? t.from : v(r), s = t.network, { fromIsSolana: n } = E(e, o);
|
|
13
|
+
return A(s, n), y(r, e, n), n ? {
|
|
14
14
|
type: "solana",
|
|
15
|
-
transactionSignature: (await
|
|
15
|
+
transactionSignature: (await f({
|
|
16
16
|
solanaAccount: e,
|
|
17
|
-
to:
|
|
18
|
-
amount:
|
|
19
|
-
network:
|
|
17
|
+
to: o,
|
|
18
|
+
amount: a,
|
|
19
|
+
network: s,
|
|
20
20
|
createRecipientAta: "createRecipientAta" in t ? t.createRecipientAta : void 0,
|
|
21
21
|
idempotencyKey: t.idempotencyKey
|
|
22
22
|
})).transactionSignature,
|
|
23
23
|
from: e,
|
|
24
|
-
network:
|
|
25
|
-
} : r.evmAccountObjects?.some(
|
|
24
|
+
network: s
|
|
25
|
+
} : r.evmAccountObjects?.some(
|
|
26
|
+
(c) => c.address.toLowerCase() === e.toLowerCase()
|
|
27
|
+
) ? {
|
|
26
28
|
type: "evm-eoa",
|
|
27
29
|
transactionHash: (await l({
|
|
28
30
|
evmAccount: e,
|
|
29
|
-
to:
|
|
30
|
-
amount:
|
|
31
|
-
network:
|
|
31
|
+
to: o,
|
|
32
|
+
amount: a,
|
|
33
|
+
network: s,
|
|
32
34
|
idempotencyKey: t.idempotencyKey
|
|
33
35
|
})).transactionHash,
|
|
34
36
|
from: e,
|
|
35
|
-
network:
|
|
37
|
+
network: s
|
|
36
38
|
} : {
|
|
37
39
|
type: "evm-smart",
|
|
38
|
-
userOpHash: (await
|
|
40
|
+
userOpHash: (await w({
|
|
39
41
|
evmSmartAccount: e,
|
|
40
|
-
to:
|
|
41
|
-
amount:
|
|
42
|
-
network:
|
|
42
|
+
to: o,
|
|
43
|
+
amount: a,
|
|
44
|
+
network: s,
|
|
43
45
|
useCdpPaymaster: "useCdpPaymaster" in t ? t.useCdpPaymaster : void 0,
|
|
44
46
|
paymasterUrl: "paymasterUrl" in t ? t.paymasterUrl : void 0,
|
|
45
47
|
idempotencyKey: t.idempotencyKey
|
|
46
48
|
})).userOpHash,
|
|
47
49
|
from: e,
|
|
48
|
-
network:
|
|
50
|
+
network: s
|
|
49
51
|
};
|
|
50
52
|
};
|
|
51
53
|
function i(t) {
|
|
@@ -58,26 +60,26 @@ function h(t) {
|
|
|
58
60
|
return t === "solana" || t === "solana-devnet";
|
|
59
61
|
}
|
|
60
62
|
function v(t) {
|
|
61
|
-
const
|
|
62
|
-
if (!e && !
|
|
63
|
+
const o = t.solanaAccountObjects?.length || 0, a = t.evmSmartAccountObjects?.length || 0, r = t.evmAccountObjects?.length || 0, e = a > 0 || r > 0, s = o > 0;
|
|
64
|
+
if (!e && !s)
|
|
63
65
|
throw new Error(
|
|
64
66
|
"No accounts available. User must have at least one Solana, EVM Smart Account, or EVM Account."
|
|
65
67
|
);
|
|
66
|
-
if (e &&
|
|
68
|
+
if (e && s)
|
|
67
69
|
throw new Error(
|
|
68
70
|
"Multiple account types detected (EVM and Solana). Please specify 'from' address to select which account to send from."
|
|
69
71
|
);
|
|
70
72
|
if (e) {
|
|
71
|
-
if (
|
|
73
|
+
if (a === 1 && r === 1)
|
|
72
74
|
return t.evmSmartAccountObjects[0].address;
|
|
73
|
-
if (r === 1 &&
|
|
75
|
+
if (r === 1 && a === 0)
|
|
74
76
|
return t.evmAccountObjects[0].address;
|
|
75
77
|
throw new Error(
|
|
76
78
|
"Multiple EVM accounts available. Please specify 'from' address to select which account to send from."
|
|
77
79
|
);
|
|
78
80
|
}
|
|
79
|
-
if (
|
|
80
|
-
if (
|
|
81
|
+
if (s) {
|
|
82
|
+
if (o === 1)
|
|
81
83
|
return t.solanaAccountObjects[0].address;
|
|
82
84
|
throw new Error(
|
|
83
85
|
"Multiple Solana accounts available. Please specify 'from' address to select which account to send from."
|
|
@@ -85,35 +87,37 @@ function v(t) {
|
|
|
85
87
|
}
|
|
86
88
|
throw new Error("Unable to auto-select account");
|
|
87
89
|
}
|
|
88
|
-
function E(t,
|
|
89
|
-
const
|
|
90
|
-
if (!
|
|
90
|
+
function E(t, o) {
|
|
91
|
+
const a = i(t), r = d(t), e = i(o), s = d(o);
|
|
92
|
+
if (!a && !r)
|
|
91
93
|
throw new Error(`Invalid 'from' address format: ${t}`);
|
|
92
|
-
if (!e && !
|
|
93
|
-
throw new Error(`Invalid 'to' address format: ${
|
|
94
|
-
if (
|
|
94
|
+
if (!e && !s)
|
|
95
|
+
throw new Error(`Invalid 'to' address format: ${o}`);
|
|
96
|
+
if (a !== e)
|
|
95
97
|
throw new Error(
|
|
96
|
-
`Address type mismatch: 'from' is ${
|
|
98
|
+
`Address type mismatch: 'from' is ${a ? "Solana" : "EVM"} but 'to' is ${e ? "Solana" : "EVM"}`
|
|
97
99
|
);
|
|
98
|
-
return { fromIsSolana:
|
|
100
|
+
return { fromIsSolana: a, fromIsEvm: r };
|
|
99
101
|
}
|
|
100
|
-
function A(t,
|
|
101
|
-
const
|
|
102
|
-
if (
|
|
102
|
+
function A(t, o) {
|
|
103
|
+
const a = h(t);
|
|
104
|
+
if (o && !a)
|
|
103
105
|
throw new Error(`Network mismatch: Solana address provided but network is ${t}`);
|
|
104
|
-
if (!
|
|
106
|
+
if (!o && a)
|
|
105
107
|
throw new Error(`Network mismatch: EVM address provided but network is ${t}`);
|
|
106
108
|
}
|
|
107
|
-
function y(t,
|
|
108
|
-
if (
|
|
109
|
-
if (!t.solanaAccountObjects?.some((e) => e.address ===
|
|
110
|
-
throw new Error(`User does not own Solana account: ${
|
|
109
|
+
function y(t, o, a) {
|
|
110
|
+
if (a) {
|
|
111
|
+
if (!t.solanaAccountObjects?.some((e) => e.address === o))
|
|
112
|
+
throw new Error(`User does not own Solana account: ${o}`);
|
|
111
113
|
} else {
|
|
112
|
-
const r = t.evmAccountObjects?.some((n) => n.address ===
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
const r = o.toLowerCase(), e = t.evmAccountObjects?.some((n) => n.address.toLowerCase() === r), s = t.evmSmartAccountObjects?.some(
|
|
115
|
+
(n) => n.address.toLowerCase() === r
|
|
116
|
+
);
|
|
117
|
+
if (!e && !s)
|
|
118
|
+
throw new Error(`User does not own EVM account: ${o}`);
|
|
115
119
|
}
|
|
116
120
|
}
|
|
117
121
|
export {
|
|
118
|
-
|
|
122
|
+
$ as sendUsdc
|
|
119
123
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createSolanaKeyExportIframe as t, createEvmKeyExportIframe as m } from "./index.
|
|
1
|
+
import { createSolanaKeyExportIframe as t, createEvmKeyExportIframe as m } from "./index.native136.js";
|
|
2
2
|
import { signBitcoinHash as i } from "./index.native67.js";
|
|
3
3
|
import "@coinbase/cdp-api-client";
|
|
4
4
|
import "./index.native2.js";
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { hashTypedData as
|
|
2
|
-
import { getCurrentUserSync as
|
|
1
|
+
import { hashTypedData as m, serializeErc6492Signature as u, encodeFunctionData as g, pad as d, getTypesForEIP712Domain as A, hashMessage as p } from "viem";
|
|
2
|
+
import { getCurrentUserSync as l } from "./index.native46.js";
|
|
3
3
|
import "@coinbase/cdp-api-client";
|
|
4
4
|
import "./index.native2.js";
|
|
5
5
|
import "./index.native3.js";
|
|
6
6
|
import "jose";
|
|
7
7
|
import "./index.native100.js";
|
|
8
|
-
import { signEvmHash as
|
|
8
|
+
import { signEvmHash as i } from "./index.native30.js";
|
|
9
9
|
import { signEvmTransaction as h } from "./index.native31.js";
|
|
10
|
-
import { signEvmMessage as
|
|
11
|
-
import { signEvmTypedData as
|
|
10
|
+
import { signEvmMessage as f } from "./index.native32.js";
|
|
11
|
+
import { signEvmTypedData as y } from "./index.native33.js";
|
|
12
12
|
import "./index.native101.js";
|
|
13
13
|
import "@solana/web3.js";
|
|
14
14
|
import "bs58";
|
|
15
|
-
import { COINBASE_SMART_WALLET_FACTORY_ADDRESS as
|
|
15
|
+
import { COINBASE_SMART_WALLET_FACTORY_ADDRESS as v, COINBASE_SMART_WALLET_FACTORY_ABI as w } from "./index.native110.js";
|
|
16
16
|
import { signAndWrapTypedDataForSmartAccount as E } from "./index.native111.js";
|
|
17
17
|
import { toAccount as T } from "./index.native112.js";
|
|
18
|
-
function
|
|
19
|
-
const o =
|
|
18
|
+
function W(r) {
|
|
19
|
+
const o = l();
|
|
20
20
|
if (!o || !o.evmAccountObjects?.length && !o.evmSmartAccountObjects?.length)
|
|
21
21
|
throw new Error(
|
|
22
22
|
"No accounts found - user must be authenticated and have at least one EVM account or smart account"
|
|
23
23
|
);
|
|
24
|
-
const
|
|
25
|
-
if (!
|
|
24
|
+
const s = r.toLowerCase(), c = o.evmAccountObjects?.some((e) => e.address.toLowerCase() === s) ?? !1, a = o.evmSmartAccountObjects?.some((e) => e.address.toLowerCase() === s) ?? !1;
|
|
25
|
+
if (!c && !a)
|
|
26
26
|
throw new Error(`Cannot sign for address ${r} - not authorized for this account`);
|
|
27
27
|
return T({
|
|
28
28
|
address: r,
|
|
@@ -37,13 +37,13 @@ function B(r) {
|
|
|
37
37
|
async signMessage({ message: e }) {
|
|
38
38
|
let t;
|
|
39
39
|
if (typeof e == "string")
|
|
40
|
-
t = (await
|
|
40
|
+
t = (await f({
|
|
41
41
|
evmAccount: r,
|
|
42
42
|
message: e
|
|
43
43
|
})).signature;
|
|
44
44
|
else if ("raw" in e) {
|
|
45
|
-
const n =
|
|
46
|
-
t = (await
|
|
45
|
+
const n = p(e);
|
|
46
|
+
t = (await i({
|
|
47
47
|
evmAccount: r,
|
|
48
48
|
hash: n
|
|
49
49
|
})).signature;
|
|
@@ -85,15 +85,15 @@ function B(r) {
|
|
|
85
85
|
const t = await E({
|
|
86
86
|
smartAccount: r,
|
|
87
87
|
ownerAddress: o.evmAccountObjects?.[0]?.address,
|
|
88
|
-
hash:
|
|
88
|
+
hash: m(e),
|
|
89
89
|
chainId: Number(e.domain.chainId)
|
|
90
90
|
});
|
|
91
|
-
return
|
|
92
|
-
address:
|
|
93
|
-
data:
|
|
94
|
-
abi:
|
|
91
|
+
return u({
|
|
92
|
+
address: v,
|
|
93
|
+
data: g({
|
|
94
|
+
abi: w,
|
|
95
95
|
functionName: "createAccount",
|
|
96
|
-
args: [[
|
|
96
|
+
args: [[d(o.evmAccountObjects?.[0]?.address)], 0n]
|
|
97
97
|
}),
|
|
98
98
|
signature: t.signature
|
|
99
99
|
});
|
|
@@ -101,7 +101,7 @@ function B(r) {
|
|
|
101
101
|
const t = {
|
|
102
102
|
domain: e.domain,
|
|
103
103
|
types: {
|
|
104
|
-
EIP712Domain:
|
|
104
|
+
EIP712Domain: A({
|
|
105
105
|
domain: e.domain
|
|
106
106
|
}),
|
|
107
107
|
...e.types
|
|
@@ -109,7 +109,7 @@ function B(r) {
|
|
|
109
109
|
primaryType: e.primaryType,
|
|
110
110
|
message: e.message
|
|
111
111
|
};
|
|
112
|
-
return (await
|
|
112
|
+
return (await y({
|
|
113
113
|
evmAccount: r,
|
|
114
114
|
typedData: t
|
|
115
115
|
})).signature;
|
|
@@ -122,7 +122,7 @@ function B(r) {
|
|
|
122
122
|
* @returns The signature as a hex string
|
|
123
123
|
*/
|
|
124
124
|
async sign(e) {
|
|
125
|
-
return (await
|
|
125
|
+
return (await i({
|
|
126
126
|
evmAccount: r,
|
|
127
127
|
hash: e.hash
|
|
128
128
|
})).signature;
|
|
@@ -130,5 +130,5 @@ function B(r) {
|
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
export {
|
|
133
|
-
|
|
133
|
+
W as toViemAccount
|
|
134
134
|
};
|
|
@@ -9,7 +9,7 @@ import { getCurrentUser as u } from "./index.native23.js";
|
|
|
9
9
|
import "./index.native101.js";
|
|
10
10
|
import "@solana/web3.js";
|
|
11
11
|
import "bs58";
|
|
12
|
-
const
|
|
12
|
+
const n = {
|
|
13
13
|
rpc: {
|
|
14
14
|
invalidInput: -32e3,
|
|
15
15
|
resourceNotFound: -32001,
|
|
@@ -32,7 +32,7 @@ const r = {
|
|
|
32
32
|
unsupportedChain: 4902
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
class
|
|
35
|
+
class s extends Error {
|
|
36
36
|
/**
|
|
37
37
|
* The error code from EIP1193ErrorCode enum.
|
|
38
38
|
*/
|
|
@@ -43,8 +43,8 @@ class o extends Error {
|
|
|
43
43
|
* @param code - The error code from EIP1193ErrorCode enum.
|
|
44
44
|
* @param message - The error message.
|
|
45
45
|
*/
|
|
46
|
-
constructor(t,
|
|
47
|
-
super(
|
|
46
|
+
constructor(t, r) {
|
|
47
|
+
super(r), this.code = t;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
class c extends Error {
|
|
@@ -58,8 +58,8 @@ class c extends Error {
|
|
|
58
58
|
* @param code - The error code from RPCErrorCode type.
|
|
59
59
|
* @param message - The error message.
|
|
60
60
|
*/
|
|
61
|
-
constructor(t,
|
|
62
|
-
super(
|
|
61
|
+
constructor(t, r) {
|
|
62
|
+
super(r), this.code = t;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
const p = /* @__PURE__ */ new Set([
|
|
@@ -76,83 +76,89 @@ const p = /* @__PURE__ */ new Set([
|
|
|
76
76
|
"wallet_getCallsStatus",
|
|
77
77
|
"wallet_getCapabilities"
|
|
78
78
|
]);
|
|
79
|
-
function
|
|
80
|
-
const { method:
|
|
81
|
-
if (typeof
|
|
79
|
+
function b(e, { chains: t }) {
|
|
80
|
+
const { method: r, params: o } = e;
|
|
81
|
+
if (typeof r != "string" || r.length === 0)
|
|
82
82
|
throw new c(
|
|
83
|
-
|
|
83
|
+
n.rpc.invalidParams,
|
|
84
84
|
"'method' must be a non-empty string."
|
|
85
85
|
);
|
|
86
|
-
const a = (
|
|
87
|
-
if (typeof a == "string" && !t.some((
|
|
88
|
-
throw new
|
|
89
|
-
|
|
86
|
+
const a = (o ?? [])[0]?.chainId;
|
|
87
|
+
if (typeof a == "string" && !t.some((i) => i.id === Number.parseInt(a, 16)))
|
|
88
|
+
throw new s(
|
|
89
|
+
n.provider.unsupportedChain,
|
|
90
90
|
`Chain ${a} not supported - make sure the provider is configured with the correct chains.`
|
|
91
91
|
);
|
|
92
|
-
if (
|
|
92
|
+
if (o !== void 0 && !Array.isArray(o))
|
|
93
93
|
throw new c(
|
|
94
|
-
|
|
94
|
+
n.rpc.invalidParams,
|
|
95
95
|
"'params' must be an array if provided."
|
|
96
96
|
);
|
|
97
|
-
if (!p.has(
|
|
98
|
-
throw new
|
|
99
|
-
|
|
97
|
+
if (!p.has(r))
|
|
98
|
+
throw new s(
|
|
99
|
+
n.provider.unsupportedMethod,
|
|
100
100
|
`Method ${e.method} not supported`
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
|
-
async function
|
|
103
|
+
async function d() {
|
|
104
104
|
const e = await u();
|
|
105
105
|
if (!e)
|
|
106
|
-
throw new
|
|
107
|
-
|
|
106
|
+
throw new s(
|
|
107
|
+
n.provider.unauthorized,
|
|
108
108
|
"User not connected"
|
|
109
109
|
);
|
|
110
110
|
return e;
|
|
111
111
|
}
|
|
112
|
-
async function
|
|
113
|
-
const t = await
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
async function O(e) {
|
|
113
|
+
const t = await d(), r = e.toLowerCase(), o = t.evmAccountObjects?.some(
|
|
114
|
+
(i) => i.address.toLowerCase() === r
|
|
115
|
+
), a = t.evmSmartAccountObjects?.some(
|
|
116
|
+
(i) => i.address.toLowerCase() === r
|
|
117
|
+
);
|
|
118
|
+
if (!o && !a)
|
|
119
|
+
throw new s(
|
|
120
|
+
n.provider.unauthorized,
|
|
117
121
|
"Address not owned by user"
|
|
118
122
|
);
|
|
119
123
|
return t;
|
|
120
124
|
}
|
|
121
|
-
async function
|
|
122
|
-
const t = await
|
|
123
|
-
if (!t.
|
|
124
|
-
throw new
|
|
125
|
-
|
|
125
|
+
async function S(e) {
|
|
126
|
+
const t = await d(), r = e.toLowerCase();
|
|
127
|
+
if (!t.evmAccountObjects?.some((o) => o.address.toLowerCase() === r))
|
|
128
|
+
throw new s(
|
|
129
|
+
n.provider.unauthorized,
|
|
126
130
|
"EOA not owned by user"
|
|
127
131
|
);
|
|
128
132
|
return t;
|
|
129
133
|
}
|
|
130
|
-
async function
|
|
131
|
-
const t = await
|
|
132
|
-
if (!t.
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
async function R(e) {
|
|
135
|
+
const t = await d(), r = e.toLowerCase();
|
|
136
|
+
if (!t.evmSmartAccountObjects?.some(
|
|
137
|
+
(o) => o.address.toLowerCase() === r
|
|
138
|
+
))
|
|
139
|
+
throw new s(
|
|
140
|
+
n.provider.unauthorized,
|
|
135
141
|
"Smart account not owned by user"
|
|
136
142
|
);
|
|
137
143
|
return t;
|
|
138
144
|
}
|
|
139
|
-
async function
|
|
140
|
-
const e = await
|
|
145
|
+
async function g() {
|
|
146
|
+
const e = await d();
|
|
141
147
|
if (!e.evmSmartAccountObjects?.[0])
|
|
142
|
-
throw new
|
|
143
|
-
|
|
148
|
+
throw new s(
|
|
149
|
+
n.provider.unauthorized,
|
|
144
150
|
"No EVM smart accounts available"
|
|
145
151
|
);
|
|
146
152
|
return e;
|
|
147
153
|
}
|
|
148
154
|
export {
|
|
149
|
-
|
|
155
|
+
s as EIP1193ProviderError,
|
|
150
156
|
c as RPCRequestError,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
157
|
+
n as STANDARD_ERROR_CODES,
|
|
158
|
+
b as validateRequest,
|
|
159
|
+
d as validateUserConnected,
|
|
160
|
+
g as validateUserHasEvmSmartAccount,
|
|
161
|
+
O as validateUserOwnsAddress,
|
|
162
|
+
S as validateUserOwnsEOA,
|
|
163
|
+
R as validateUserOwnsSmartAccount
|
|
158
164
|
};
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import "@coinbase/cdp-api-client";
|
|
2
2
|
import "viem";
|
|
3
|
-
const u = async (
|
|
4
|
-
async function
|
|
3
|
+
const u = async (t) => await t.isSignedIn();
|
|
4
|
+
async function i(t, a, r) {
|
|
5
5
|
if (!await u(a))
|
|
6
6
|
throw new Error("User not signed in");
|
|
7
|
-
const
|
|
8
|
-
if ("evmAccount" in
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
const c = a.getUser();
|
|
8
|
+
if ("evmAccount" in t) {
|
|
9
|
+
const o = t.evmAccount.toLowerCase();
|
|
10
|
+
if (!(c.evmAccounts?.find((n) => n.toLowerCase() === o) || c.evmAccountObjects?.find((n) => n.address.toLowerCase() === o)))
|
|
11
|
+
throw new Error("EVM account not found");
|
|
12
|
+
}
|
|
13
|
+
if ("evmSmartAccount" in t) {
|
|
14
|
+
const o = t.evmSmartAccount.toLowerCase();
|
|
15
|
+
if (!(c.evmSmartAccounts?.find((n) => n.toLowerCase() === o) || c.evmSmartAccountObjects?.find(
|
|
16
|
+
(n) => n.address.toLowerCase() === o
|
|
17
|
+
)))
|
|
18
|
+
throw new Error("EVM Smart Account not found");
|
|
19
|
+
}
|
|
20
|
+
if ("solanaAccount" in t && !(c.solanaAccounts?.find((e) => e === t.solanaAccount) || c.solanaAccountObjects?.find((e) => e.address === t.solanaAccount)))
|
|
13
21
|
throw new Error("Solana account not found");
|
|
14
|
-
const
|
|
15
|
-
return r({ ...
|
|
22
|
+
const s = await a.getWalletSecretId();
|
|
23
|
+
return r({ ...t, user: c, walletSecretId: s });
|
|
16
24
|
}
|
|
17
25
|
export {
|
|
18
26
|
u as isSignedIn,
|
|
19
|
-
|
|
27
|
+
i as withAuth
|
|
20
28
|
};
|
package/dist/types/version.d.ts
CHANGED
package/dist/web/index.web110.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InvalidAddressError as s } from "./index.
|
|
2
|
-
import { isAddress as a } from "./index.
|
|
1
|
+
import { InvalidAddressError as s } from "./index.web136.js";
|
|
2
|
+
import { isAddress as a } from "./index.web137.js";
|
|
3
3
|
function r(n) {
|
|
4
4
|
if (typeof n == "string") {
|
|
5
5
|
if (!a(n, { strict: !1 }))
|