@coinbase/cdp-core 0.0.19 → 0.0.20

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.
Files changed (75) hide show
  1. package/README.md +13 -5
  2. package/dist/esm/index104.js +1 -1
  3. package/dist/esm/index13.js +9 -3
  4. package/dist/esm/index15.js +8 -8
  5. package/dist/esm/index16.js +2 -2
  6. package/dist/esm/index17.js +158 -39
  7. package/dist/esm/index18.js +47 -16
  8. package/dist/esm/index19.js +152 -4
  9. package/dist/esm/index20.js +56 -5
  10. package/dist/esm/index21.js +39 -158
  11. package/dist/esm/index22.js +16 -47
  12. package/dist/esm/index23.js +4 -152
  13. package/dist/esm/index24.js +5 -56
  14. package/dist/esm/index25.js +12 -8
  15. package/dist/esm/index26.js +11 -17
  16. package/dist/esm/index27.js +8 -45
  17. package/dist/esm/index28.js +17 -13
  18. package/dist/esm/index29.js +40 -50
  19. package/dist/esm/index3.js +4 -4
  20. package/dist/esm/index30.js +13 -6
  21. package/dist/esm/index31.js +54 -20
  22. package/dist/esm/index32.js +6 -11
  23. package/dist/esm/index33.js +21 -3
  24. package/dist/esm/index34.js +3 -3
  25. package/dist/esm/index35.js +3 -34
  26. package/dist/esm/index36.js +32 -10
  27. package/dist/esm/index37.js +12 -4
  28. package/dist/esm/index38.js +4 -28
  29. package/dist/esm/index39.js +28 -6
  30. package/dist/esm/index40.js +6 -24
  31. package/dist/esm/index41.js +24 -16
  32. package/dist/esm/index42.js +16 -54
  33. package/dist/esm/index43.js +53 -22
  34. package/dist/esm/index44.js +23 -11
  35. package/dist/esm/index45.js +10 -26
  36. package/dist/esm/index46.js +26 -41
  37. package/dist/esm/index47.js +41 -54
  38. package/dist/esm/index48.js +54 -126
  39. package/dist/esm/index49.js +126 -11
  40. package/dist/esm/index50.js +9 -101
  41. package/dist/esm/index51.js +104 -6
  42. package/dist/esm/index52.js +7 -3
  43. package/dist/esm/index53.js +3 -15
  44. package/dist/esm/index54.js +14 -42
  45. package/dist/esm/index55.js +38 -74
  46. package/dist/esm/index56.js +79 -2
  47. package/dist/esm/index57.js +2 -2
  48. package/dist/esm/index58.js +2 -13
  49. package/dist/esm/index59.js +2 -2
  50. package/dist/esm/index6.js +4 -4
  51. package/dist/esm/index60.js +1 -1
  52. package/dist/esm/index61.js +1 -1
  53. package/dist/esm/index62.js +2 -2
  54. package/dist/esm/index63.js +2 -2
  55. package/dist/esm/index64.js +1 -1
  56. package/dist/esm/index65.js +1 -1
  57. package/dist/esm/index66.js +3 -3
  58. package/dist/esm/index70.js +17 -2
  59. package/dist/esm/index71.js +19 -17
  60. package/dist/esm/index72.js +47 -13
  61. package/dist/esm/index73.js +102 -21
  62. package/dist/esm/index74.js +71 -43
  63. package/dist/esm/index75.js +80 -20
  64. package/dist/esm/index76.js +2 -80
  65. package/dist/esm/index77.js +17 -100
  66. package/dist/esm/index78.js +18 -31
  67. package/dist/esm/index79.js +32 -6
  68. package/dist/esm/index80.js +6 -78
  69. package/dist/esm/index82.js +1 -1
  70. package/dist/esm/index89.js +4 -4
  71. package/dist/esm/index90.js +5 -5
  72. package/dist/esm/index95.js +1 -1
  73. package/dist/esm/index98.js +1 -1
  74. package/dist/types/index.d.ts +6 -2
  75. package/package.json +3 -3
@@ -1,106 +1,23 @@
1
- import { HashMD as D, SHA256_IV as b, Chi as g, Maj as p } from "./index80.js";
2
- import { createHasher as u, clean as C, rotr as i } from "./index76.js";
3
- const B = /* @__PURE__ */ Uint32Array.from([
4
- 1116352408,
5
- 1899447441,
6
- 3049323471,
7
- 3921009573,
8
- 961987163,
9
- 1508970993,
10
- 2453635748,
11
- 2870763221,
12
- 3624381080,
13
- 310598401,
14
- 607225278,
15
- 1426881987,
16
- 1925078388,
17
- 2162078206,
18
- 2614888103,
19
- 3248222580,
20
- 3835390401,
21
- 4022224774,
22
- 264347078,
23
- 604807628,
24
- 770255983,
25
- 1249150122,
26
- 1555081692,
27
- 1996064986,
28
- 2554220882,
29
- 2821834349,
30
- 2952996808,
31
- 3210313671,
32
- 3336571891,
33
- 3584528711,
34
- 113926993,
35
- 338241895,
36
- 666307205,
37
- 773529912,
38
- 1294757372,
39
- 1396182291,
40
- 1695183700,
41
- 1986661051,
42
- 2177026350,
43
- 2456956037,
44
- 2730485921,
45
- 2820302411,
46
- 3259730800,
47
- 3345764771,
48
- 3516065817,
49
- 3600352804,
50
- 4094571909,
51
- 275423344,
52
- 430227734,
53
- 506948616,
54
- 659060556,
55
- 883997877,
56
- 958139571,
57
- 1322822218,
58
- 1537002063,
59
- 1747873779,
60
- 1955562222,
61
- 2024104815,
62
- 2227730452,
63
- 2361852424,
64
- 2428436474,
65
- 2756734187,
66
- 3204031479,
67
- 3329325298
68
- ]), h = /* @__PURE__ */ new Uint32Array(64);
69
- class E extends D {
70
- constructor(o = 32) {
71
- super(64, o, 8, !1), this.A = b[0] | 0, this.B = b[1] | 0, this.C = b[2] | 0, this.D = b[3] | 0, this.E = b[4] | 0, this.F = b[5] | 0, this.G = b[6] | 0, this.H = b[7] | 0;
1
+ import { BaseError as o } from "./index48.js";
2
+ class i extends o {
3
+ constructor({ offset: e }) {
4
+ super(`Offset \`${e}\` cannot be negative.`, {
5
+ name: "NegativeOffsetError"
6
+ });
72
7
  }
73
- get() {
74
- const { A: o, B: r, C: t, D: s, E: a, F: f, G: c, H: e } = this;
75
- return [o, r, t, s, a, f, c, e];
76
- }
77
- // prettier-ignore
78
- set(o, r, t, s, a, f, c, e) {
79
- this.A = o | 0, this.B = r | 0, this.C = t | 0, this.D = s | 0, this.E = a | 0, this.F = f | 0, this.G = c | 0, this.H = e | 0;
80
- }
81
- process(o, r) {
82
- for (let x = 0; x < 16; x++, r += 4)
83
- h[x] = o.getUint32(r, !1);
84
- for (let x = 16; x < 64; x++) {
85
- const H = h[x - 15], d = h[x - 2], m = i(H, 7) ^ i(H, 18) ^ H >>> 3, l = i(d, 17) ^ i(d, 19) ^ d >>> 10;
86
- h[x] = l + h[x - 7] + m + h[x - 16] | 0;
87
- }
88
- let { A: t, B: s, C: a, D: f, E: c, F: e, G: n, H: A } = this;
89
- for (let x = 0; x < 64; x++) {
90
- const H = i(c, 6) ^ i(c, 11) ^ i(c, 25), d = A + H + g(c, e, n) + B[x] + h[x] | 0, l = (i(t, 2) ^ i(t, 13) ^ i(t, 22)) + p(t, s, a) | 0;
91
- A = n, n = e, e = c, c = f + d | 0, f = a, a = s, s = t, t = d + l | 0;
92
- }
93
- t = t + this.A | 0, s = s + this.B | 0, a = a + this.C | 0, f = f + this.D | 0, c = c + this.E | 0, e = e + this.F | 0, n = n + this.G | 0, A = A + this.H | 0, this.set(t, s, a, f, c, e, n, A);
94
- }
95
- roundClean() {
96
- C(h);
8
+ }
9
+ class n extends o {
10
+ constructor({ length: e, position: r }) {
11
+ super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`, { name: "PositionOutOfBoundsError" });
97
12
  }
98
- destroy() {
99
- this.set(0, 0, 0, 0, 0, 0, 0, 0), C(this.buffer);
13
+ }
14
+ class c extends o {
15
+ constructor({ count: e, limit: r }) {
16
+ super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`, { name: "RecursiveReadLimitExceededError" });
100
17
  }
101
18
  }
102
- const y = /* @__PURE__ */ u(() => new E());
103
19
  export {
104
- E as SHA256,
105
- y as sha256
20
+ i as NegativeOffsetError,
21
+ n as PositionOutOfBoundsError,
22
+ c as RecursiveReadLimitExceededError
106
23
  };
@@ -1,35 +1,22 @@
1
- import { maxBytesPerTransaction as y, bytesPerBlob as a, fieldElementsPerBlob as f, bytesPerFieldElement as p } from "./index87.js";
2
- import { EmptyBlobError as c, BlobSizeTooLargeError as h } from "./index59.js";
3
- import { createCursor as B } from "./index48.js";
4
- import { size as u } from "./index37.js";
5
- import { hexToBytes as x } from "./index29.js";
6
- import { bytesToHex as d } from "./index27.js";
7
- function S(e) {
8
- const m = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), i = typeof e.data == "string" ? x(e.data) : e.data, o = u(i);
9
- if (!o)
10
- throw new c();
11
- if (o > y)
12
- throw new h({
13
- maxSize: y,
14
- size: o
15
- });
16
- const s = [];
17
- let n = !0, r = 0;
18
- for (; n; ) {
19
- const t = B(new Uint8Array(a));
20
- let l = 0;
21
- for (; l < f; ) {
22
- const b = i.slice(r, r + (p - 1));
23
- if (t.pushByte(0), t.pushBytes(b), b.length < 31) {
24
- t.pushByte(128), n = !1;
25
- break;
26
- }
27
- l++, r += 31;
28
- }
29
- s.push(t);
1
+ const o = /* @__PURE__ */ BigInt(4294967295), i = /* @__PURE__ */ BigInt(32);
2
+ function s(t, r = !1) {
3
+ return r ? { h: Number(t & o), l: Number(t >> i & o) } : { h: Number(t >> i & o) | 0, l: Number(t & o) | 0 };
4
+ }
5
+ function h(t, r = !1) {
6
+ const n = t.length;
7
+ let l = new Uint32Array(n), c = new Uint32Array(n);
8
+ for (let e = 0; e < n; e++) {
9
+ const { h: u, l: f } = s(t[e], r);
10
+ [l[e], c[e]] = [u, f];
30
11
  }
31
- return m === "bytes" ? s.map((t) => t.bytes) : s.map((t) => d(t.bytes));
12
+ return [l, c];
32
13
  }
14
+ const m = (t, r, n) => t << n | r >>> 32 - n, A = (t, r, n) => r << n | t >>> 32 - n, B = (t, r, n) => r << n - 32 | t >>> 64 - n, a = (t, r, n) => t << n - 32 | r >>> 64 - n;
33
15
  export {
34
- S as toBlobs
16
+ s as fromBig,
17
+ B as rotlBH,
18
+ a as rotlBL,
19
+ m as rotlSH,
20
+ A as rotlSL,
21
+ h as split
35
22
  };
@@ -1,9 +1,35 @@
1
- import { bytesToHex as i } from "./index27.js";
2
- import { sha256 as m } from "./index51.js";
3
- function f(t) {
4
- const { commitment: e, version: s = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), o = m(e);
5
- return o.set([s], 0), n === "bytes" ? o : i(o);
1
+ import { maxBytesPerTransaction as y, bytesPerBlob as a, fieldElementsPerBlob as f, bytesPerFieldElement as p } from "./index87.js";
2
+ import { EmptyBlobError as c, BlobSizeTooLargeError as h } from "./index59.js";
3
+ import { createCursor as B } from "./index49.js";
4
+ import { size as u } from "./index38.js";
5
+ import { hexToBytes as x } from "./index31.js";
6
+ import { bytesToHex as d } from "./index29.js";
7
+ function S(e) {
8
+ const m = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), i = typeof e.data == "string" ? x(e.data) : e.data, o = u(i);
9
+ if (!o)
10
+ throw new c();
11
+ if (o > y)
12
+ throw new h({
13
+ maxSize: y,
14
+ size: o
15
+ });
16
+ const s = [];
17
+ let n = !0, r = 0;
18
+ for (; n; ) {
19
+ const t = B(new Uint8Array(a));
20
+ let l = 0;
21
+ for (; l < f; ) {
22
+ const b = i.slice(r, r + (p - 1));
23
+ if (t.pushByte(0), t.pushBytes(b), b.length < 31) {
24
+ t.pushByte(128), n = !1;
25
+ break;
26
+ }
27
+ l++, r += 31;
28
+ }
29
+ s.push(t);
30
+ }
31
+ return m === "bytes" ? s.map((t) => t.bytes) : s.map((t) => d(t.bytes));
6
32
  }
7
33
  export {
8
- f as commitmentToVersionedHash
34
+ S as toBlobs
9
35
  };
@@ -1,81 +1,9 @@
1
- import { Hash as g, createView as l, aexists as b, toBytes as a, abytes as d, aoutput as x, clean as w } from "./index76.js";
2
- function y(o, t, s, n) {
3
- if (typeof o.setBigUint64 == "function")
4
- return o.setBigUint64(t, s, n);
5
- const i = BigInt(32), h = BigInt(4294967295), e = Number(s >> i & h), r = Number(s & h), c = n ? 4 : 0, u = n ? 0 : 4;
6
- o.setUint32(t + c, e, n), o.setUint32(t + u, r, n);
1
+ import { bytesToHex as i } from "./index29.js";
2
+ import { sha256 as m } from "./index52.js";
3
+ function f(t) {
4
+ const { commitment: e, version: s = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), o = m(e);
5
+ return o.set([s], 0), n === "bytes" ? o : i(o);
7
6
  }
8
- function U(o, t, s) {
9
- return o & t ^ ~o & s;
10
- }
11
- function _(o, t, s) {
12
- return o & t ^ o & s ^ t & s;
13
- }
14
- class m extends g {
15
- constructor(t, s, n, i) {
16
- super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = t, this.outputLen = s, this.padOffset = n, this.isLE = i, this.buffer = new Uint8Array(t), this.view = l(this.buffer);
17
- }
18
- update(t) {
19
- b(this), t = a(t), d(t);
20
- const { view: s, buffer: n, blockLen: i } = this, h = t.length;
21
- for (let e = 0; e < h; ) {
22
- const r = Math.min(i - this.pos, h - e);
23
- if (r === i) {
24
- const c = l(t);
25
- for (; i <= h - e; e += i)
26
- this.process(c, e);
27
- continue;
28
- }
29
- n.set(t.subarray(e, e + r), this.pos), this.pos += r, e += r, this.pos === i && (this.process(s, 0), this.pos = 0);
30
- }
31
- return this.length += t.length, this.roundClean(), this;
32
- }
33
- digestInto(t) {
34
- b(this), x(t, this), this.finished = !0;
35
- const { buffer: s, view: n, blockLen: i, isLE: h } = this;
36
- let { pos: e } = this;
37
- s[e++] = 128, w(this.buffer.subarray(e)), this.padOffset > i - e && (this.process(n, 0), e = 0);
38
- for (let f = e; f < i; f++)
39
- s[f] = 0;
40
- y(n, i - 8, BigInt(this.length * 8), h), this.process(n, 0);
41
- const r = l(t), c = this.outputLen;
42
- if (c % 4)
43
- throw new Error("_sha2: outputLen should be aligned to 32bit");
44
- const u = c / 4, p = this.get();
45
- if (u > p.length)
46
- throw new Error("_sha2: outputLen bigger than state");
47
- for (let f = 0; f < u; f++)
48
- r.setUint32(4 * f, p[f], h);
49
- }
50
- digest() {
51
- const { buffer: t, outputLen: s } = this;
52
- this.digestInto(t);
53
- const n = t.slice(0, s);
54
- return this.destroy(), n;
55
- }
56
- _cloneInto(t) {
57
- t || (t = new this.constructor()), t.set(...this.get());
58
- const { blockLen: s, buffer: n, length: i, finished: h, destroyed: e, pos: r } = this;
59
- return t.destroyed = e, t.finished = h, t.length = i, t.pos = r, i % s && t.buffer.set(n), t;
60
- }
61
- clone() {
62
- return this._cloneInto();
63
- }
64
- }
65
- const B = /* @__PURE__ */ Uint32Array.from([
66
- 1779033703,
67
- 3144134277,
68
- 1013904242,
69
- 2773480762,
70
- 1359893119,
71
- 2600822924,
72
- 528734635,
73
- 1541459225
74
- ]);
75
7
  export {
76
- U as Chi,
77
- m as HashMD,
78
- _ as Maj,
79
- B as SHA256_IV,
80
- y as setBigUint64
8
+ f as commitmentToVersionedHash
81
9
  };
@@ -1,7 +1,7 @@
1
1
  import { encode as d } from "./index91.js";
2
2
  import y from "./index92.js";
3
3
  import b from "./index93.js";
4
- import { JWSInvalid as r } from "./index73.js";
4
+ import { JWSInvalid as r } from "./index71.js";
5
5
  import { encoder as s, concat as u, decoder as h } from "./index83.js";
6
6
  import g from "./index94.js";
7
7
  import H from "./index95.js";
@@ -1,7 +1,7 @@
1
- import { hexToBigInt as n } from "./index43.js";
2
- import { defineBlock as r } from "./index40.js";
3
- import { defineTransaction as s, formatTransaction as m } from "./index42.js";
4
- import { defineTransactionReceipt as l } from "./index45.js";
1
+ import { hexToBigInt as n } from "./index44.js";
2
+ import { defineBlock as r } from "./index41.js";
3
+ import { defineTransaction as s, formatTransaction as m } from "./index43.js";
4
+ import { defineTransactionReceipt as l } from "./index46.js";
5
5
  const p = {
6
6
  block: /* @__PURE__ */ r({
7
7
  format(e) {
@@ -1,8 +1,8 @@
1
- import { InvalidAddressError as a } from "./index58.js";
2
- import { isAddress as f } from "./index32.js";
3
- import { concatHex as p } from "./index33.js";
4
- import { toHex as i } from "./index27.js";
5
- import { toRlp as x } from "./index46.js";
1
+ import { InvalidAddressError as a } from "./index25.js";
2
+ import { isAddress as f } from "./index26.js";
3
+ import { concatHex as p } from "./index34.js";
4
+ import { toHex as i } from "./index29.js";
5
+ import { toRlp as x } from "./index47.js";
6
6
  import { serializeTransaction as l } from "./index15.js";
7
7
  function T(r, e) {
8
8
  return h(r) ? z(r) : l(r, e);
@@ -1,4 +1,4 @@
1
- import { JOSENotSupported as f } from "./index73.js";
1
+ import { JOSENotSupported as f } from "./index71.js";
2
2
  const w = (n, r, a, e, s) => {
3
3
  if (s.crit !== void 0 && e?.crit === void 0)
4
4
  throw new n('"crit" (Critical) Header Parameter MUST be integrity protected');
@@ -1,4 +1,4 @@
1
- import { JOSENotSupported as r } from "./index73.js";
1
+ import { JOSENotSupported as r } from "./index71.js";
2
2
  const S = (e, s) => {
3
3
  const a = `SHA-${e.slice(-3)}`;
4
4
  switch (e) {
@@ -24,10 +24,9 @@ export { APIError }
24
24
 
25
25
  export { APIErrorType }
26
26
 
27
- export declare type AuthenticationMethod = EmailAuthentication;
28
-
29
27
  export declare type AuthenticationMethods = {
30
28
  email?: EmailAuthentication;
29
+ sms?: SmsAuthentication;
31
30
  };
32
31
 
33
32
  export declare type CDPEmbeddedWallet = {
@@ -265,6 +264,11 @@ export declare type SignTypedDataRequest = {
265
264
  params: [EvmAddress, string];
266
265
  };
267
266
 
267
+ export declare type SmsAuthentication = {
268
+ type: "sms";
269
+ phoneNumber: string;
270
+ };
271
+
268
272
  export declare const STANDARD_ERROR_CODES: {
269
273
  rpc: {
270
274
  invalidInput: -32000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-core",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist/**",
@@ -17,7 +17,7 @@
17
17
  "ox": "0.8.1",
18
18
  "viem": "^2.33.0",
19
19
  "zustand": "^5.0.6",
20
- "@coinbase/cdp-api-client": "^0.0.19"
20
+ "@coinbase/cdp-api-client": "^0.0.20"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@size-limit/preset-big-lib": "^11.2.0",
@@ -52,7 +52,7 @@
52
52
  "path": "./dist/esm/index.js",
53
53
  "running": false,
54
54
  "import": "{ exportEvmAccount }",
55
- "limit": "25 KB"
55
+ "limit": "30 KB"
56
56
  },
57
57
  {
58
58
  "name": "provider-only",