@coinbase/cdp-core 0.0.41 → 0.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.native101.js +10 -79
- package/dist/esm/index.native102.js +79 -10
- package/dist/esm/index.native13.js +1 -1
- package/dist/esm/index.native25.js +149 -940
- package/dist/esm/index.native26.js +48 -2
- package/dist/esm/index.native27.js +244 -43
- package/dist/esm/index.native28.js +55 -27
- package/dist/esm/index.native29.js +940 -149
- package/dist/esm/index.native30.js +2 -48
- package/dist/esm/index.native31.js +43 -243
- package/dist/esm/index.native32.js +27 -55
- package/dist/esm/index.native8.js +4 -4
- package/dist/esm/index.native9.js +49 -31
- package/dist/esm/index.native92.js +1 -1
- package/dist/esm/index.web100.js +9 -117
- package/dist/esm/index.web101.js +79 -10
- package/dist/esm/index.web26.js +156 -155
- package/dist/esm/index.web27.js +1 -1
- package/dist/esm/index.web8.js +49 -31
- package/dist/esm/index.web82.js +6 -6
- package/dist/esm/index.web91.js +1 -1
- package/dist/esm/index.web94.js +19 -77
- package/dist/esm/index.web95.js +10 -21
- package/dist/esm/index.web96.js +19 -9
- package/dist/esm/index.web97.js +89 -15
- package/dist/esm/index.web98.js +19 -92
- package/dist/esm/index.web99.js +115 -18
- package/dist/native/index.native101.js +10 -79
- package/dist/native/index.native102.js +79 -10
- package/dist/native/index.native13.js +1 -1
- package/dist/native/index.native25.js +149 -940
- package/dist/native/index.native26.js +48 -2
- package/dist/native/index.native27.js +244 -43
- package/dist/native/index.native28.js +55 -27
- package/dist/native/index.native29.js +940 -149
- package/dist/native/index.native30.js +2 -48
- package/dist/native/index.native31.js +43 -243
- package/dist/native/index.native32.js +27 -55
- package/dist/native/index.native8.js +4 -4
- package/dist/native/index.native9.js +49 -31
- package/dist/native/index.native92.js +1 -1
- package/dist/native-types/eip1193/errors.d.ts +6 -0
- package/dist/native-types/eip1193/internal.d.ts +3 -1
- package/dist/types/eip1193/errors.d.ts +6 -0
- package/dist/types/eip1193/internal.d.ts +3 -1
- package/dist/web/index.web100.js +9 -117
- package/dist/web/index.web101.js +79 -10
- package/dist/web/index.web26.js +156 -155
- package/dist/web/index.web27.js +1 -1
- package/dist/web/index.web8.js +49 -31
- package/dist/web/index.web82.js +6 -6
- package/dist/web/index.web91.js +1 -1
- package/dist/web/index.web94.js +19 -77
- package/dist/web/index.web95.js +10 -21
- package/dist/web/index.web96.js +19 -9
- package/dist/web/index.web97.js +89 -15
- package/dist/web/index.web98.js +19 -92
- package/dist/web/index.web99.js +115 -18
- package/dist/web-types/eip1193/errors.d.ts +6 -0
- package/dist/web-types/eip1193/internal.d.ts +3 -1
- package/package.json +2 -2
package/dist/web/index.web99.js
CHANGED
|
@@ -1,23 +1,120 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { isJWK as p } from "./index.web109.js";
|
|
2
|
+
import { decode as m } from "./index.web94.js";
|
|
3
|
+
import y from "./index.web110.js";
|
|
4
|
+
import { isCryptoKey as S, isKeyObject as K } from "./index.web108.js";
|
|
5
|
+
let c;
|
|
6
|
+
const f = async (e, r, s, i = !1) => {
|
|
7
|
+
c ||= /* @__PURE__ */ new WeakMap();
|
|
8
|
+
let n = c.get(e);
|
|
9
|
+
if (n?.[s])
|
|
10
|
+
return n[s];
|
|
11
|
+
const t = await y({ ...r, alg: s });
|
|
12
|
+
return i && Object.freeze(e), n ? n[s] = t : c.set(e, { [s]: t }), t;
|
|
13
|
+
}, E = (e, r) => {
|
|
14
|
+
c ||= /* @__PURE__ */ new WeakMap();
|
|
15
|
+
let s = c.get(e);
|
|
16
|
+
if (s?.[r])
|
|
17
|
+
return s[r];
|
|
18
|
+
const i = e.type === "public", n = !!i;
|
|
9
19
|
let t;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
if (e.asymmetricKeyType === "x25519") {
|
|
21
|
+
switch (r) {
|
|
22
|
+
case "ECDH-ES":
|
|
23
|
+
case "ECDH-ES+A128KW":
|
|
24
|
+
case "ECDH-ES+A192KW":
|
|
25
|
+
case "ECDH-ES+A256KW":
|
|
26
|
+
break;
|
|
27
|
+
default:
|
|
28
|
+
throw new TypeError("given KeyObject instance cannot be used for this algorithm");
|
|
29
|
+
}
|
|
30
|
+
t = e.toCryptoKey(e.asymmetricKeyType, n, i ? [] : ["deriveBits"]);
|
|
18
31
|
}
|
|
19
|
-
|
|
32
|
+
if (e.asymmetricKeyType === "ed25519") {
|
|
33
|
+
if (r !== "EdDSA" && r !== "Ed25519")
|
|
34
|
+
throw new TypeError("given KeyObject instance cannot be used for this algorithm");
|
|
35
|
+
t = e.toCryptoKey(e.asymmetricKeyType, n, [
|
|
36
|
+
i ? "verify" : "sign"
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
if (e.asymmetricKeyType === "rsa") {
|
|
40
|
+
let a;
|
|
41
|
+
switch (r) {
|
|
42
|
+
case "RSA-OAEP":
|
|
43
|
+
a = "SHA-1";
|
|
44
|
+
break;
|
|
45
|
+
case "RS256":
|
|
46
|
+
case "PS256":
|
|
47
|
+
case "RSA-OAEP-256":
|
|
48
|
+
a = "SHA-256";
|
|
49
|
+
break;
|
|
50
|
+
case "RS384":
|
|
51
|
+
case "PS384":
|
|
52
|
+
case "RSA-OAEP-384":
|
|
53
|
+
a = "SHA-384";
|
|
54
|
+
break;
|
|
55
|
+
case "RS512":
|
|
56
|
+
case "PS512":
|
|
57
|
+
case "RSA-OAEP-512":
|
|
58
|
+
a = "SHA-512";
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
throw new TypeError("given KeyObject instance cannot be used for this algorithm");
|
|
62
|
+
}
|
|
63
|
+
if (r.startsWith("RSA-OAEP"))
|
|
64
|
+
return e.toCryptoKey({
|
|
65
|
+
name: "RSA-OAEP",
|
|
66
|
+
hash: a
|
|
67
|
+
}, n, i ? ["encrypt"] : ["decrypt"]);
|
|
68
|
+
t = e.toCryptoKey({
|
|
69
|
+
name: r.startsWith("PS") ? "RSA-PSS" : "RSASSA-PKCS1-v1_5",
|
|
70
|
+
hash: a
|
|
71
|
+
}, n, [i ? "verify" : "sign"]);
|
|
72
|
+
}
|
|
73
|
+
if (e.asymmetricKeyType === "ec") {
|
|
74
|
+
const o = (/* @__PURE__ */ new Map([
|
|
75
|
+
["prime256v1", "P-256"],
|
|
76
|
+
["secp384r1", "P-384"],
|
|
77
|
+
["secp521r1", "P-521"]
|
|
78
|
+
])).get(e.asymmetricKeyDetails?.namedCurve);
|
|
79
|
+
if (!o)
|
|
80
|
+
throw new TypeError("given KeyObject instance cannot be used for this algorithm");
|
|
81
|
+
r === "ES256" && o === "P-256" && (t = e.toCryptoKey({
|
|
82
|
+
name: "ECDSA",
|
|
83
|
+
namedCurve: o
|
|
84
|
+
}, n, [i ? "verify" : "sign"])), r === "ES384" && o === "P-384" && (t = e.toCryptoKey({
|
|
85
|
+
name: "ECDSA",
|
|
86
|
+
namedCurve: o
|
|
87
|
+
}, n, [i ? "verify" : "sign"])), r === "ES512" && o === "P-521" && (t = e.toCryptoKey({
|
|
88
|
+
name: "ECDSA",
|
|
89
|
+
namedCurve: o
|
|
90
|
+
}, n, [i ? "verify" : "sign"])), r.startsWith("ECDH-ES") && (t = e.toCryptoKey({
|
|
91
|
+
name: "ECDH",
|
|
92
|
+
namedCurve: o
|
|
93
|
+
}, n, i ? [] : ["deriveBits"]));
|
|
94
|
+
}
|
|
95
|
+
if (!t)
|
|
96
|
+
throw new TypeError("given KeyObject instance cannot be used for this algorithm");
|
|
97
|
+
return s ? s[r] = t : c.set(e, { [r]: t }), t;
|
|
98
|
+
}, d = async (e, r) => {
|
|
99
|
+
if (e instanceof Uint8Array || S(e))
|
|
100
|
+
return e;
|
|
101
|
+
if (K(e)) {
|
|
102
|
+
if (e.type === "secret")
|
|
103
|
+
return e.export();
|
|
104
|
+
if ("toCryptoKey" in e && typeof e.toCryptoKey == "function")
|
|
105
|
+
try {
|
|
106
|
+
return E(e, r);
|
|
107
|
+
} catch (i) {
|
|
108
|
+
if (i instanceof TypeError)
|
|
109
|
+
throw i;
|
|
110
|
+
}
|
|
111
|
+
let s = e.export({ format: "jwk" });
|
|
112
|
+
return f(e, s, r);
|
|
113
|
+
}
|
|
114
|
+
if (p(e))
|
|
115
|
+
return e.k ? m(e.k) : f(e, e, r, !0);
|
|
116
|
+
throw new Error("unreachable");
|
|
20
117
|
};
|
|
21
118
|
export {
|
|
22
|
-
|
|
119
|
+
d as default
|
|
23
120
|
};
|
|
@@ -39,6 +39,9 @@ export declare class RPCRequestError extends Error {
|
|
|
39
39
|
code: RPCErrorCode;
|
|
40
40
|
constructor(code: RPCErrorCode, message: string);
|
|
41
41
|
}
|
|
42
|
+
export declare class AccountTypeMismatchError extends Error {
|
|
43
|
+
constructor(message: string);
|
|
44
|
+
}
|
|
42
45
|
export declare function validateRequest(request: Parameters<ReturnType<typeof ox_Provider.from>["request"]>[0], { chains }: {
|
|
43
46
|
chains: readonly [Chain, ...Chain[]];
|
|
44
47
|
}): void;
|
|
@@ -46,3 +49,6 @@ export declare function validateUserConnected(): Promise<import('../types.js').U
|
|
|
46
49
|
export declare function validateUserOwnsAddress(address: EvmAddress): Promise<import('../types.js').User>;
|
|
47
50
|
export declare function validateUserHasEvmAccount(): Promise<import('../types.js').User>;
|
|
48
51
|
export declare function validateUserHasEvmSmartAccount(): Promise<import('../types.js').User>;
|
|
52
|
+
export declare function validateIsUsingEOA({ errorMessage }?: {
|
|
53
|
+
errorMessage?: string;
|
|
54
|
+
}): Promise<import('../types.js').User>;
|
|
@@ -27,5 +27,7 @@ export declare function handleChainId(store: ProviderStoreInstance): Promise<Hex
|
|
|
27
27
|
export declare function handleDisconnect(): Promise<void>;
|
|
28
28
|
export declare function handleSwitchEthereumChain(params: SwitchEthereumChainRequest["params"], store: ProviderStoreInstance): void;
|
|
29
29
|
export declare function handleSendCalls(params: SendCallsRequest["params"], store: ProviderStoreInstance): Promise<`0x${string}`>;
|
|
30
|
-
export declare function handleGetCallsStatus(params: GetCallsStatusRequest["params"], store: ProviderStoreInstance): Promise<WalletGetCallsStatusReturnType
|
|
30
|
+
export declare function handleGetCallsStatus(params: GetCallsStatusRequest["params"], store: ProviderStoreInstance): Promise<WalletGetCallsStatusReturnType<{
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
}, number, bigint | undefined, string | undefined>>;
|
|
31
33
|
export declare function handleGetCapabilities(): Promise<WalletCapabilities>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cdp-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.42",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"ox": "0.8.1",
|
|
28
28
|
"viem": "^2.33.0",
|
|
29
29
|
"zustand": "^5.0.6",
|
|
30
|
-
"@coinbase/cdp-api-client": "^0.0.
|
|
30
|
+
"@coinbase/cdp-api-client": "^0.0.42"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@react-native-async-storage/async-storage": "^2.0.0",
|