@coinbase/cdp-core 0.0.31 → 0.0.33
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.native.js +40 -38
- package/dist/esm/index.native10.js +115 -21
- package/dist/esm/index.native100.js +6 -9
- package/dist/esm/index.native101.js +11 -13
- package/dist/esm/index.native102.js +11 -8
- package/dist/esm/index.native103.js +7 -14
- package/dist/esm/index.native104.js +16 -80
- package/dist/esm/index.native105.js +79 -11
- package/dist/esm/index.native106.js +12 -35
- package/dist/esm/index.native107.js +35 -41
- package/dist/esm/index.native108.js +38 -75
- package/dist/esm/index.native109.js +81 -0
- package/dist/esm/index.native11.js +20 -30
- package/dist/esm/index.native12.js +30 -7
- package/dist/esm/index.native13.js +9 -15
- package/dist/esm/index.native14.js +14 -15
- package/dist/esm/index.native15.js +13 -116
- package/dist/esm/index.native16.js +116 -11
- package/dist/esm/index.native17.js +14 -42
- package/dist/esm/index.native18.js +42 -20
- package/dist/esm/index.native19.js +20 -172
- package/dist/esm/index.native2.js +3 -3
- package/dist/esm/index.native20.js +170 -39
- package/dist/esm/index.native21.js +41 -49
- package/dist/esm/index.native22.js +47 -70
- package/dist/esm/index.native23.js +69 -23
- package/dist/esm/index.native24.js +22 -156
- package/dist/esm/index.native25.js +157 -45
- package/dist/esm/index.native26.js +43 -245
- package/dist/esm/index.native27.js +247 -53
- package/dist/esm/index.native28.js +56 -17
- package/dist/esm/index.native29.js +15 -21
- package/dist/esm/index.native3.js +40 -30
- package/dist/esm/index.native30.js +21 -49
- package/dist/esm/index.native31.js +50 -8
- package/dist/esm/index.native32.js +8 -17
- package/dist/esm/index.native33.js +16 -44
- package/dist/esm/index.native34.js +45 -13
- package/dist/esm/index.native35.js +13 -55
- package/dist/esm/index.native36.js +55 -6
- package/dist/esm/index.native37.js +6 -21
- package/dist/esm/index.native38.js +21 -11
- package/dist/esm/index.native39.js +11 -3
- package/dist/esm/index.native4.js +67 -21
- package/dist/esm/index.native40.js +3 -3
- package/dist/esm/index.native41.js +3 -34
- package/dist/esm/index.native42.js +32 -10
- package/dist/esm/index.native43.js +12 -4
- package/dist/esm/index.native44.js +4 -28
- package/dist/esm/index.native45.js +28 -6
- package/dist/esm/index.native46.js +6 -24
- package/dist/esm/index.native47.js +24 -16
- package/dist/esm/index.native48.js +16 -54
- package/dist/esm/index.native49.js +53 -22
- package/dist/esm/index.native5.js +21 -254
- package/dist/esm/index.native50.js +23 -11
- package/dist/esm/index.native51.js +10 -26
- package/dist/esm/index.native52.js +26 -41
- package/dist/esm/index.native53.js +41 -54
- package/dist/esm/index.native54.js +54 -126
- package/dist/esm/index.native55.js +126 -11
- package/dist/esm/index.native56.js +9 -101
- package/dist/esm/index.native57.js +104 -6
- package/dist/esm/index.native58.js +7 -3
- package/dist/esm/index.native59.js +3 -15
- package/dist/esm/index.native6.js +262 -176
- package/dist/esm/index.native60.js +14 -42
- package/dist/esm/index.native61.js +38 -74
- package/dist/esm/index.native62.js +79 -2
- package/dist/esm/index.native63.js +2 -2
- package/dist/esm/index.native64.js +2 -13
- package/dist/esm/index.native65.js +8 -33
- package/dist/esm/index.native66.js +36 -5
- package/dist/esm/index.native67.js +5 -33
- package/dist/esm/index.native68.js +34 -8
- package/dist/esm/index.native69.js +8 -10
- package/dist/esm/index.native7.js +213 -115
- package/dist/esm/index.native70.js +10 -11
- package/dist/esm/index.native71.js +11 -13
- package/dist/esm/index.native72.js +13 -18
- package/dist/esm/index.native73.js +18 -5
- package/dist/esm/index.native74.js +6 -5
- package/dist/esm/index.native75.js +5 -11
- package/dist/esm/index.native76.js +10 -54
- package/dist/esm/index.native77.js +54 -10
- package/dist/esm/index.native78.js +11 -2
- package/dist/esm/index.native79.js +2 -45
- package/dist/esm/index.native8.js +115 -137
- package/dist/esm/index.native80.js +44 -13
- package/dist/esm/index.native81.js +14 -2
- package/dist/esm/index.native82.js +1 -1
- package/dist/esm/index.native83.js +2 -20
- package/dist/esm/index.native84.js +103 -79
- package/dist/esm/index.native85.js +18 -102
- package/dist/esm/index.native86.js +79 -32
- package/dist/esm/index.native87.js +32 -6
- package/dist/esm/index.native88.js +6 -78
- package/dist/esm/index.native89.js +2 -2
- package/dist/esm/index.native9.js +138 -113
- package/dist/esm/index.native90.js +3 -3
- package/dist/esm/index.native92.js +3 -3
- package/dist/esm/index.native93.js +1 -1
- package/dist/esm/index.native94.js +3 -3
- package/dist/esm/index.native95.js +79 -10
- package/dist/esm/index.native96.js +10 -5
- package/dist/esm/index.native97.js +5 -18
- package/dist/esm/index.native98.js +18 -28
- package/dist/esm/index.native99.js +26 -6
- package/dist/esm/index.web100.js +13 -28
- package/dist/esm/index.web101.js +10 -8
- package/dist/esm/index.web102.js +17 -11
- package/dist/esm/index.web103.js +80 -12
- package/dist/esm/index.web104.js +13 -10
- package/dist/esm/index.web105.js +36 -17
- package/dist/esm/index.web106.js +40 -79
- package/dist/esm/index.web26.js +1 -1
- package/dist/esm/index.web5.js +131 -109
- package/dist/esm/index.web6.js +65 -38
- package/dist/esm/index.web75.js +6 -6
- package/dist/esm/index.web84.js +1 -1
- package/dist/esm/index.web87.js +21 -10
- package/dist/esm/index.web88.js +10 -21
- package/dist/esm/index.web89.js +19 -9
- package/dist/esm/index.web90.js +89 -15
- package/dist/esm/index.web91.js +19 -92
- package/dist/esm/index.web92.js +115 -18
- package/dist/esm/index.web93.js +73 -112
- package/dist/esm/index.web94.js +10 -79
- package/dist/esm/index.web96.js +18 -13
- package/dist/esm/index.web97.js +27 -35
- package/dist/esm/index.web98.js +7 -41
- package/dist/esm/index.web99.js +11 -18
- package/dist/native/index.native.js +40 -38
- package/dist/native/index.native10.js +115 -21
- package/dist/native/index.native100.js +6 -9
- package/dist/native/index.native101.js +11 -13
- package/dist/native/index.native102.js +11 -8
- package/dist/native/index.native103.js +7 -14
- package/dist/native/index.native104.js +16 -80
- package/dist/native/index.native105.js +79 -11
- package/dist/native/index.native106.js +12 -35
- package/dist/native/index.native107.js +35 -41
- package/dist/native/index.native108.js +38 -75
- package/dist/native/index.native109.js +81 -0
- package/dist/native/index.native11.js +20 -30
- package/dist/native/index.native12.js +30 -7
- package/dist/native/index.native13.js +9 -15
- package/dist/native/index.native14.js +14 -15
- package/dist/native/index.native15.js +13 -116
- package/dist/native/index.native16.js +116 -11
- package/dist/native/index.native17.js +14 -42
- package/dist/native/index.native18.js +42 -20
- package/dist/native/index.native19.js +20 -172
- package/dist/native/index.native2.js +3 -3
- package/dist/native/index.native20.js +170 -39
- package/dist/native/index.native21.js +41 -49
- package/dist/native/index.native22.js +47 -70
- package/dist/native/index.native23.js +69 -23
- package/dist/native/index.native24.js +22 -156
- package/dist/native/index.native25.js +157 -45
- package/dist/native/index.native26.js +43 -245
- package/dist/native/index.native27.js +247 -53
- package/dist/native/index.native28.js +56 -17
- package/dist/native/index.native29.js +15 -21
- package/dist/native/index.native3.js +40 -30
- package/dist/native/index.native30.js +21 -49
- package/dist/native/index.native31.js +50 -8
- package/dist/native/index.native32.js +8 -17
- package/dist/native/index.native33.js +16 -44
- package/dist/native/index.native34.js +45 -13
- package/dist/native/index.native35.js +13 -55
- package/dist/native/index.native36.js +55 -6
- package/dist/native/index.native37.js +6 -21
- package/dist/native/index.native38.js +21 -11
- package/dist/native/index.native39.js +11 -3
- package/dist/native/index.native4.js +67 -21
- package/dist/native/index.native40.js +3 -3
- package/dist/native/index.native41.js +3 -34
- package/dist/native/index.native42.js +32 -10
- package/dist/native/index.native43.js +12 -4
- package/dist/native/index.native44.js +4 -28
- package/dist/native/index.native45.js +28 -6
- package/dist/native/index.native46.js +6 -24
- package/dist/native/index.native47.js +24 -16
- package/dist/native/index.native48.js +16 -54
- package/dist/native/index.native49.js +53 -22
- package/dist/native/index.native5.js +21 -254
- package/dist/native/index.native50.js +23 -11
- package/dist/native/index.native51.js +10 -26
- package/dist/native/index.native52.js +26 -41
- package/dist/native/index.native53.js +41 -54
- package/dist/native/index.native54.js +54 -126
- package/dist/native/index.native55.js +126 -11
- package/dist/native/index.native56.js +9 -101
- package/dist/native/index.native57.js +104 -6
- package/dist/native/index.native58.js +7 -3
- package/dist/native/index.native59.js +3 -15
- package/dist/native/index.native6.js +262 -176
- package/dist/native/index.native60.js +14 -42
- package/dist/native/index.native61.js +38 -74
- package/dist/native/index.native62.js +79 -2
- package/dist/native/index.native63.js +2 -2
- package/dist/native/index.native64.js +2 -13
- package/dist/native/index.native65.js +8 -33
- package/dist/native/index.native66.js +36 -5
- package/dist/native/index.native67.js +5 -33
- package/dist/native/index.native68.js +34 -8
- package/dist/native/index.native69.js +8 -10
- package/dist/native/index.native7.js +213 -115
- package/dist/native/index.native70.js +10 -11
- package/dist/native/index.native71.js +11 -13
- package/dist/native/index.native72.js +13 -18
- package/dist/native/index.native73.js +18 -5
- package/dist/native/index.native74.js +6 -5
- package/dist/native/index.native75.js +5 -11
- package/dist/native/index.native76.js +10 -54
- package/dist/native/index.native77.js +54 -10
- package/dist/native/index.native78.js +11 -2
- package/dist/native/index.native79.js +2 -45
- package/dist/native/index.native8.js +115 -137
- package/dist/native/index.native80.js +44 -13
- package/dist/native/index.native81.js +14 -2
- package/dist/native/index.native82.js +1 -1
- package/dist/native/index.native83.js +2 -20
- package/dist/native/index.native84.js +103 -79
- package/dist/native/index.native85.js +18 -102
- package/dist/native/index.native86.js +79 -32
- package/dist/native/index.native87.js +32 -6
- package/dist/native/index.native88.js +6 -78
- package/dist/native/index.native89.js +2 -2
- package/dist/native/index.native9.js +138 -113
- package/dist/native/index.native90.js +3 -3
- package/dist/native/index.native92.js +3 -3
- package/dist/native/index.native93.js +1 -1
- package/dist/native/index.native94.js +3 -3
- package/dist/native/index.native95.js +79 -10
- package/dist/native/index.native96.js +10 -5
- package/dist/native/index.native97.js +5 -18
- package/dist/native/index.native98.js +18 -28
- package/dist/native/index.native99.js +26 -6
- package/dist/native-types/auth/authManager.d.ts +3 -0
- package/dist/native-types/platform/native/secureStorage.d.ts +2 -0
- package/dist/native-types/platform/types.d.ts +7 -0
- package/dist/types/auth/authManager.d.ts +3 -0
- package/dist/types/platform/native/secureStorage.d.ts +2 -0
- package/dist/types/platform/types.d.ts +7 -0
- package/dist/web/index.web100.js +13 -28
- package/dist/web/index.web101.js +10 -8
- package/dist/web/index.web102.js +17 -11
- package/dist/web/index.web103.js +80 -12
- package/dist/web/index.web104.js +13 -10
- package/dist/web/index.web105.js +36 -17
- package/dist/web/index.web106.js +40 -79
- package/dist/web/index.web26.js +1 -1
- package/dist/web/index.web5.js +131 -109
- package/dist/web/index.web6.js +65 -38
- package/dist/web/index.web75.js +6 -6
- package/dist/web/index.web84.js +1 -1
- package/dist/web/index.web87.js +21 -10
- package/dist/web/index.web88.js +10 -21
- package/dist/web/index.web89.js +19 -9
- package/dist/web/index.web90.js +89 -15
- package/dist/web/index.web91.js +19 -92
- package/dist/web/index.web92.js +115 -18
- package/dist/web/index.web93.js +73 -112
- package/dist/web/index.web94.js +10 -79
- package/dist/web/index.web96.js +18 -13
- package/dist/web/index.web97.js +27 -35
- package/dist/web/index.web98.js +7 -41
- package/dist/web/index.web99.js +11 -18
- package/dist/web-types/auth/authManager.d.ts +3 -0
- package/dist/web-types/platform/native/secureStorage.d.ts +2 -0
- package/dist/web-types/platform/types.d.ts +7 -0
- package/package.json +8 -4
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return s;
|
|
1
|
+
import { hexToBytes as b } from "./index.native36.js";
|
|
2
|
+
import { bytesToHex as y } from "./index.native34.js";
|
|
3
|
+
function h(t) {
|
|
4
|
+
const { kzg: m } = t, c = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), s = typeof t.blobs[0] == "string" ? t.blobs.map((o) => b(o)) : t.blobs, i = typeof t.commitments[0] == "string" ? t.commitments.map((o) => b(o)) : t.commitments, n = [];
|
|
5
|
+
for (let o = 0; o < s.length; o++) {
|
|
6
|
+
const f = s[o], l = i[o];
|
|
7
|
+
n.push(Uint8Array.from(m.computeBlobKzgProof(f, l)));
|
|
8
|
+
}
|
|
9
|
+
return c === "bytes" ? n : n.map((o) => y(o));
|
|
11
10
|
}
|
|
12
11
|
export {
|
|
13
|
-
|
|
12
|
+
h as blobsToProofs
|
|
14
13
|
};
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
});
|
|
12
|
-
return c;
|
|
1
|
+
import { commitmentToVersionedHash as i } from "./index.native88.js";
|
|
2
|
+
function r(o) {
|
|
3
|
+
const { commitments: t, version: n } = o, e = o.to ?? (typeof t[0] == "string" ? "hex" : "bytes"), s = [];
|
|
4
|
+
for (const m of t)
|
|
5
|
+
s.push(i({
|
|
6
|
+
commitment: m,
|
|
7
|
+
to: e,
|
|
8
|
+
version: n
|
|
9
|
+
}));
|
|
10
|
+
return s;
|
|
13
11
|
}
|
|
14
12
|
export {
|
|
15
|
-
|
|
13
|
+
r as commitmentsToVersionedHashes
|
|
16
14
|
};
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (!f(i, { strict: !1 }))
|
|
14
|
-
throw new s({ address: i });
|
|
15
|
-
n.push([i, e]);
|
|
16
|
-
}
|
|
17
|
-
return n;
|
|
1
|
+
import { blobsToCommitments as f } from "./index.native69.js";
|
|
2
|
+
import { blobsToProofs as l } from "./index.native70.js";
|
|
3
|
+
import { toBlobs as p } from "./index.native87.js";
|
|
4
|
+
function k(t) {
|
|
5
|
+
const { data: i, kzg: n, to: m } = t, s = t.blobs ?? p({ data: i, to: m }), b = t.commitments ?? f({ blobs: s, kzg: n, to: m }), r = t.proofs ?? l({ blobs: s, commitments: b, kzg: n, to: m }), c = [];
|
|
6
|
+
for (let o = 0; o < s.length; o++)
|
|
7
|
+
c.push({
|
|
8
|
+
blob: s[o],
|
|
9
|
+
commitment: b[o],
|
|
10
|
+
proof: r[o]
|
|
11
|
+
});
|
|
12
|
+
return c;
|
|
18
13
|
}
|
|
19
14
|
export {
|
|
20
|
-
|
|
15
|
+
k as toBlobSidecars
|
|
21
16
|
};
|
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { InvalidAddressError as s } from "./index.native65.js";
|
|
2
|
+
import { InvalidStorageKeySizeError as l } from "./index.native61.js";
|
|
3
|
+
import { isAddress as f } from "./index.native39.js";
|
|
4
|
+
function a(r) {
|
|
5
|
+
if (!r || r.length === 0)
|
|
6
|
+
return [];
|
|
7
|
+
const n = [];
|
|
8
|
+
for (let o = 0; o < r.length; o++) {
|
|
9
|
+
const { address: i, storageKeys: e } = r[o];
|
|
10
|
+
for (let t = 0; t < e.length; t++)
|
|
11
|
+
if (e[t].length - 2 !== 64)
|
|
12
|
+
throw new l({ storageKey: e[t] });
|
|
13
|
+
if (!f(i, { strict: !1 }))
|
|
14
|
+
throw new s({ address: i });
|
|
15
|
+
n.push([i, e]);
|
|
16
|
+
}
|
|
17
|
+
return n;
|
|
5
18
|
}
|
|
6
19
|
export {
|
|
7
|
-
|
|
20
|
+
a as serializeAccessList
|
|
8
21
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { gweiUnits as i } from "./index.native75.js";
|
|
2
|
+
import { formatUnits as o } from "./index.native76.js";
|
|
3
|
+
function f(r, t = "wei") {
|
|
4
|
+
return o(r, i[t]);
|
|
5
|
+
}
|
|
5
6
|
export {
|
|
6
|
-
|
|
7
|
+
f as formatGwei
|
|
7
8
|
};
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
let [l, e] = [
|
|
6
|
-
t.slice(0, t.length - n),
|
|
7
|
-
t.slice(t.length - n)
|
|
8
|
-
];
|
|
9
|
-
return e = e.replace(/(0+)$/, ""), `${i ? "-" : ""}${l || "0"}${e ? `.${e}` : ""}`;
|
|
10
|
-
}
|
|
1
|
+
const e = {
|
|
2
|
+
ether: -9,
|
|
3
|
+
wei: 9
|
|
4
|
+
};
|
|
11
5
|
export {
|
|
12
|
-
|
|
6
|
+
e as gweiUnits
|
|
13
7
|
};
|
|
@@ -1,57 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
#r;
|
|
11
|
-
#e;
|
|
12
|
-
#t;
|
|
13
|
-
constructor(e) {
|
|
14
|
-
if (!(e instanceof Uint8Array))
|
|
15
|
-
throw new TypeError("payload must be an instance of Uint8Array");
|
|
16
|
-
this.#r = e;
|
|
17
|
-
}
|
|
18
|
-
setProtectedHeader(e) {
|
|
19
|
-
if (this.#e)
|
|
20
|
-
throw new TypeError("setProtectedHeader can only be called once");
|
|
21
|
-
return this.#e = e, this;
|
|
22
|
-
}
|
|
23
|
-
setUnprotectedHeader(e) {
|
|
24
|
-
if (this.#t)
|
|
25
|
-
throw new TypeError("setUnprotectedHeader can only be called once");
|
|
26
|
-
return this.#t = e, this;
|
|
27
|
-
}
|
|
28
|
-
async sign(e, l) {
|
|
29
|
-
if (!this.#e && !this.#t)
|
|
30
|
-
throw new r("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");
|
|
31
|
-
if (!b(this.#e, this.#t))
|
|
32
|
-
throw new r("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
33
|
-
const c = {
|
|
34
|
-
...this.#e,
|
|
35
|
-
...this.#t
|
|
36
|
-
}, p = H(r, /* @__PURE__ */ new Map([["b64", !0]]), l?.crit, this.#e, c);
|
|
37
|
-
let o = !0;
|
|
38
|
-
if (p.has("b64") && (o = this.#e.b64, typeof o != "boolean"))
|
|
39
|
-
throw new r('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
40
|
-
const { alg: t } = c;
|
|
41
|
-
if (typeof t != "string" || !t)
|
|
42
|
-
throw new r('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
43
|
-
g(t, e, "sign");
|
|
44
|
-
let i = this.#r;
|
|
45
|
-
o && (i = s.encode(d(i)));
|
|
46
|
-
let n;
|
|
47
|
-
this.#e ? n = s.encode(d(JSON.stringify(this.#e))) : n = s.encode("");
|
|
48
|
-
const f = u(n, s.encode("."), i), m = await P(e, t), w = await y(t, m, f), a = {
|
|
49
|
-
signature: d(w),
|
|
50
|
-
payload: ""
|
|
51
|
-
};
|
|
52
|
-
return o && (a.payload = h.decode(i)), this.#t && (a.header = this.#t), this.#e && (a.protected = h.decode(n)), a;
|
|
53
|
-
}
|
|
1
|
+
function a(r, n) {
|
|
2
|
+
let t = r.toString();
|
|
3
|
+
const i = t.startsWith("-");
|
|
4
|
+
i && (t = t.slice(1)), t = t.padStart(n, "0");
|
|
5
|
+
let [l, e] = [
|
|
6
|
+
t.slice(0, t.length - n),
|
|
7
|
+
t.slice(t.length - n)
|
|
8
|
+
];
|
|
9
|
+
return e = e.replace(/(0+)$/, ""), `${i ? "-" : ""}${l || "0"}${e ? `.${e}` : ""}`;
|
|
54
10
|
}
|
|
55
11
|
export {
|
|
56
|
-
|
|
12
|
+
a as formatUnits
|
|
57
13
|
};
|
|
@@ -1,13 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { encode as d } from "./index.native89.js";
|
|
2
|
+
import y from "./index.native90.js";
|
|
3
|
+
import b from "./index.native91.js";
|
|
4
|
+
import { JWSInvalid as r } from "./index.native30.js";
|
|
5
|
+
import { encoder as s, concat as u, decoder as h } from "./index.native78.js";
|
|
6
|
+
import g from "./index.native92.js";
|
|
7
|
+
import H from "./index.native93.js";
|
|
8
|
+
import P from "./index.native94.js";
|
|
9
|
+
class x {
|
|
10
|
+
#r;
|
|
11
|
+
#e;
|
|
12
|
+
#t;
|
|
13
|
+
constructor(e) {
|
|
14
|
+
if (!(e instanceof Uint8Array))
|
|
15
|
+
throw new TypeError("payload must be an instance of Uint8Array");
|
|
16
|
+
this.#r = e;
|
|
17
|
+
}
|
|
18
|
+
setProtectedHeader(e) {
|
|
19
|
+
if (this.#e)
|
|
20
|
+
throw new TypeError("setProtectedHeader can only be called once");
|
|
21
|
+
return this.#e = e, this;
|
|
22
|
+
}
|
|
23
|
+
setUnprotectedHeader(e) {
|
|
24
|
+
if (this.#t)
|
|
25
|
+
throw new TypeError("setUnprotectedHeader can only be called once");
|
|
26
|
+
return this.#t = e, this;
|
|
27
|
+
}
|
|
28
|
+
async sign(e, l) {
|
|
29
|
+
if (!this.#e && !this.#t)
|
|
30
|
+
throw new r("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");
|
|
31
|
+
if (!b(this.#e, this.#t))
|
|
32
|
+
throw new r("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
33
|
+
const c = {
|
|
34
|
+
...this.#e,
|
|
35
|
+
...this.#t
|
|
36
|
+
}, p = H(r, /* @__PURE__ */ new Map([["b64", !0]]), l?.crit, this.#e, c);
|
|
37
|
+
let o = !0;
|
|
38
|
+
if (p.has("b64") && (o = this.#e.b64, typeof o != "boolean"))
|
|
39
|
+
throw new r('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
40
|
+
const { alg: t } = c;
|
|
41
|
+
if (typeof t != "string" || !t)
|
|
42
|
+
throw new r('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
43
|
+
g(t, e, "sign");
|
|
44
|
+
let i = this.#r;
|
|
45
|
+
o && (i = s.encode(d(i)));
|
|
46
|
+
let n;
|
|
47
|
+
this.#e ? n = s.encode(d(JSON.stringify(this.#e))) : n = s.encode("");
|
|
48
|
+
const f = u(n, s.encode("."), i), m = await P(e, t), w = await y(t, m, f), a = {
|
|
49
|
+
signature: d(w),
|
|
50
|
+
payload: ""
|
|
51
|
+
};
|
|
52
|
+
return o && (a.payload = h.decode(i)), this.#t && (a.header = this.#t), this.#e && (a.protected = h.decode(n)), a;
|
|
53
|
+
}
|
|
8
54
|
}
|
|
9
55
|
export {
|
|
10
|
-
|
|
11
|
-
s as decoder,
|
|
12
|
-
d as encoder
|
|
56
|
+
x as FlattenedSign
|
|
13
57
|
};
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
const
|
|
1
|
+
const d = new TextEncoder(), s = new TextDecoder();
|
|
2
|
+
function f(...n) {
|
|
3
|
+
const c = n.reduce((e, { length: r }) => e + r, 0), t = new Uint8Array(c);
|
|
4
|
+
let o = 0;
|
|
5
|
+
for (const e of n)
|
|
6
|
+
t.set(e, o), o += e.length;
|
|
7
|
+
return t;
|
|
8
|
+
}
|
|
2
9
|
export {
|
|
3
|
-
|
|
10
|
+
f as concat,
|
|
11
|
+
s as decoder,
|
|
12
|
+
d as encoder
|
|
4
13
|
};
|
|
@@ -1,47 +1,4 @@
|
|
|
1
|
-
const o =
|
|
2
|
-
const s = o.exec(c);
|
|
3
|
-
if (!s || s[4] && s[1])
|
|
4
|
-
throw new TypeError("Invalid time period format");
|
|
5
|
-
const a = parseFloat(s[2]), r = s[3].toLowerCase();
|
|
6
|
-
let e;
|
|
7
|
-
switch (r) {
|
|
8
|
-
case "sec":
|
|
9
|
-
case "secs":
|
|
10
|
-
case "second":
|
|
11
|
-
case "seconds":
|
|
12
|
-
case "s":
|
|
13
|
-
e = Math.round(a);
|
|
14
|
-
break;
|
|
15
|
-
case "minute":
|
|
16
|
-
case "minutes":
|
|
17
|
-
case "min":
|
|
18
|
-
case "mins":
|
|
19
|
-
case "m":
|
|
20
|
-
e = Math.round(a * 60);
|
|
21
|
-
break;
|
|
22
|
-
case "hour":
|
|
23
|
-
case "hours":
|
|
24
|
-
case "hr":
|
|
25
|
-
case "hrs":
|
|
26
|
-
case "h":
|
|
27
|
-
e = Math.round(a * 3600);
|
|
28
|
-
break;
|
|
29
|
-
case "day":
|
|
30
|
-
case "days":
|
|
31
|
-
case "d":
|
|
32
|
-
e = Math.round(a * 86400);
|
|
33
|
-
break;
|
|
34
|
-
case "week":
|
|
35
|
-
case "weeks":
|
|
36
|
-
case "w":
|
|
37
|
-
e = Math.round(a * 604800);
|
|
38
|
-
break;
|
|
39
|
-
default:
|
|
40
|
-
e = Math.round(a * 31557600);
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
return s[1] === "-" || s[4] === "ago" ? -e : e;
|
|
44
|
-
};
|
|
1
|
+
const o = (e) => Math.floor(e.getTime() / 1e3);
|
|
45
2
|
export {
|
|
46
|
-
|
|
3
|
+
o as default
|
|
47
4
|
};
|
|
@@ -1,143 +1,121 @@
|
|
|
1
|
-
import "ox";
|
|
2
|
-
import "viem";
|
|
3
|
-
import "zustand";
|
|
1
|
+
import { Provider as h } from "ox";
|
|
2
|
+
import { http as m } from "viem";
|
|
3
|
+
import { create as p } from "zustand";
|
|
4
|
+
import { subscribeWithSelector as g, persist as f } from "./index.native25.js";
|
|
5
|
+
import { validateRequest as I, EIP1193ProviderError as S, STANDARD_ERROR_CODES as w } from "./index.native9.js";
|
|
6
|
+
import { EventEmitter as C } from "./index.native26.js";
|
|
7
|
+
import { getPlatformStorage as b } from "./index.native5.js";
|
|
4
8
|
import "@coinbase/cdp-api-client";
|
|
5
|
-
import {
|
|
6
|
-
import "./index.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
9
|
+
import { handleGetCapabilities as _, handleGetCallsStatus as A, handleSendCalls as v, handleChainId as D, handleSignTypedData as P, handleEthSign as E, handleSwitchEthereumChain as R, handleDisconnect as y, handleSendTransaction as T, handlePersonalSign as q, handleRequestAccounts as G, handleAccounts as L } from "./index.native27.js";
|
|
10
|
+
import { onAuthStateChange as M } from "./index.native6.js";
|
|
11
|
+
import { baseSepolia as l } from "./index.native28.js";
|
|
12
|
+
function N(r, n, s) {
|
|
13
|
+
n.subscribe(
|
|
14
|
+
(e) => e.chainId,
|
|
15
|
+
(e, t) => {
|
|
16
|
+
e !== t && r.emit("chainChanged", e);
|
|
17
|
+
}
|
|
18
|
+
), n.subscribe(
|
|
19
|
+
(e) => e.user,
|
|
20
|
+
(e, t) => {
|
|
21
|
+
if (!(e?.userId === t?.userId && e?.evmAccounts?.length === t?.evmAccounts?.length)) {
|
|
22
|
+
if (!e && t) {
|
|
23
|
+
r.emit("disconnect", new h.DisconnectedError());
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (e && e.evmAccounts?.length && (!t || t.evmAccounts?.length === 0)) {
|
|
27
|
+
const a = n.getState().chainId;
|
|
28
|
+
r.emit("connect", { chainId: a });
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
const { chainId: i, setChainId: o } = n.getState(), d = i || s.chains[0].id;
|
|
35
|
+
return i || o(d), h.from({
|
|
36
|
+
request: async (e) => {
|
|
37
|
+
I(e, s);
|
|
38
|
+
const t = e;
|
|
39
|
+
switch (t.method) {
|
|
40
|
+
case "eth_accounts":
|
|
41
|
+
return L();
|
|
42
|
+
case "eth_requestAccounts":
|
|
43
|
+
return G(r, n);
|
|
44
|
+
case "personal_sign":
|
|
45
|
+
return q(t.params);
|
|
46
|
+
case "eth_sendTransaction":
|
|
47
|
+
return T(t.params, n, s.transports);
|
|
48
|
+
case "wallet_disconnect":
|
|
49
|
+
return y();
|
|
50
|
+
case "wallet_switchEthereumChain":
|
|
51
|
+
return R(t.params, n);
|
|
52
|
+
case "eth_sign":
|
|
53
|
+
return E(t.params);
|
|
54
|
+
case "eth_signTypedData_v4":
|
|
55
|
+
return P(t.params);
|
|
56
|
+
case "eth_chainId":
|
|
57
|
+
return D(n);
|
|
58
|
+
case "wallet_sendCalls":
|
|
59
|
+
return v(t.params, n);
|
|
60
|
+
case "wallet_getCallsStatus":
|
|
61
|
+
return A(t.params, n);
|
|
62
|
+
case "wallet_getCapabilities":
|
|
63
|
+
return _();
|
|
64
|
+
// Catch-all for any unknown method
|
|
65
|
+
default:
|
|
66
|
+
throw new S(
|
|
67
|
+
w.provider.unsupportedMethod,
|
|
68
|
+
`Method ${t.method} not supported`
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
// Event emitter methods - only the ones required by the interface
|
|
73
|
+
on: r.on.bind(r),
|
|
74
|
+
removeListener: r.removeListener.bind(r)
|
|
75
|
+
});
|
|
44
76
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
code;
|
|
50
|
-
/**
|
|
51
|
-
* Creates a new RPC Invalid Params error.
|
|
52
|
-
*
|
|
53
|
-
* @param code - The error code from RPCErrorCode type.
|
|
54
|
-
* @param message - The error message.
|
|
55
|
-
*/
|
|
56
|
-
constructor(t, n) {
|
|
57
|
-
super(n), this.code = t;
|
|
77
|
+
const u = {
|
|
78
|
+
chains: [l],
|
|
79
|
+
transports: {
|
|
80
|
+
[l.id]: m()
|
|
58
81
|
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
`Method ${e.method} not supported`
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
async function i() {
|
|
99
|
-
const e = await u();
|
|
100
|
-
if (!e)
|
|
101
|
-
throw new o(
|
|
102
|
-
r.provider.unauthorized,
|
|
103
|
-
"User not connected"
|
|
104
|
-
);
|
|
105
|
-
return e;
|
|
106
|
-
}
|
|
107
|
-
async function E(e) {
|
|
108
|
-
const t = await i();
|
|
109
|
-
if (!t.evmAccounts?.includes(e))
|
|
110
|
-
throw new o(
|
|
111
|
-
r.provider.unauthorized,
|
|
112
|
-
"Address not owned by user"
|
|
113
|
-
);
|
|
114
|
-
return t;
|
|
115
|
-
}
|
|
116
|
-
async function y() {
|
|
117
|
-
const e = await i();
|
|
118
|
-
if (!e.evmAccounts?.[0])
|
|
119
|
-
throw new o(
|
|
120
|
-
r.provider.unauthorized,
|
|
121
|
-
"No EVM accounts available"
|
|
122
|
-
);
|
|
123
|
-
return e;
|
|
124
|
-
}
|
|
125
|
-
async function A() {
|
|
126
|
-
const e = await i();
|
|
127
|
-
if (!e.evmSmartAccounts?.[0])
|
|
128
|
-
throw new o(
|
|
129
|
-
r.provider.unauthorized,
|
|
130
|
-
"No EVM smart accounts available"
|
|
131
|
-
);
|
|
132
|
-
return e;
|
|
82
|
+
};
|
|
83
|
+
function K(r) {
|
|
84
|
+
if (r?.chains.length === 0)
|
|
85
|
+
throw new Error("At least one chain must be configured");
|
|
86
|
+
const n = r?.chains ?? u.chains, s = r?.transports ?? u.transports;
|
|
87
|
+
if (n.length === 0)
|
|
88
|
+
throw new Error("No chains found in configuration");
|
|
89
|
+
const i = new C(), o = b(), d = {
|
|
90
|
+
getItem: (t) => o.getItem(t),
|
|
91
|
+
setItem: (t, a) => o.setItem(t, a),
|
|
92
|
+
removeItem: (t) => o.removeItem(t)
|
|
93
|
+
}, c = p()(
|
|
94
|
+
g(
|
|
95
|
+
f(
|
|
96
|
+
(t) => ({
|
|
97
|
+
chainId: n[0].id,
|
|
98
|
+
setChainId: (a) => t({ chainId: a }),
|
|
99
|
+
chains: n,
|
|
100
|
+
user: null,
|
|
101
|
+
setUser: (a) => t({ user: a })
|
|
102
|
+
}),
|
|
103
|
+
{
|
|
104
|
+
name: "cdp-provider-store",
|
|
105
|
+
storage: d
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
)
|
|
109
|
+
);
|
|
110
|
+
return c.persist.rehydrate(), M((t) => {
|
|
111
|
+
c.getState().setUser(t);
|
|
112
|
+
}), {
|
|
113
|
+
provider: N(i, c, {
|
|
114
|
+
chains: n,
|
|
115
|
+
transports: s
|
|
116
|
+
})
|
|
117
|
+
};
|
|
133
118
|
}
|
|
134
119
|
export {
|
|
135
|
-
|
|
136
|
-
c as RPCRequestError,
|
|
137
|
-
r as STANDARD_ERROR_CODES,
|
|
138
|
-
_ as validateRequest,
|
|
139
|
-
i as validateUserConnected,
|
|
140
|
-
y as validateUserHasEvmAccount,
|
|
141
|
-
A as validateUserHasEvmSmartAccount,
|
|
142
|
-
E as validateUserOwnsAddress
|
|
120
|
+
K as createCDPEmbeddedWallet
|
|
143
121
|
};
|