@coinbase/cdp-core 0.0.33 → 0.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -8
- package/dist/esm/index.native.js +40 -37
- package/dist/esm/index.native100.js +41 -7
- package/dist/esm/index.native101.js +18 -11
- package/dist/esm/index.native102.js +28 -13
- package/dist/esm/index.native103.js +8 -10
- package/dist/esm/index.native104.js +11 -17
- package/dist/esm/index.native105.js +12 -80
- package/dist/esm/index.native106.js +10 -13
- package/dist/esm/index.native107.js +17 -36
- package/dist/esm/index.native108.js +79 -40
- package/dist/esm/index.native14.js +6 -5
- package/dist/esm/index.native15.js +12 -10
- package/dist/esm/index.native17.js +1 -0
- package/dist/esm/index.native28.js +1 -1
- package/dist/esm/index.native54.js +1 -1
- package/dist/esm/index.native55.js +1 -1
- package/dist/esm/index.native57.js +2 -2
- package/dist/esm/index.native59.js +1 -1
- package/dist/esm/index.native6.js +188 -134
- package/dist/esm/index.native77.js +6 -6
- package/dist/esm/index.native82.js +2 -21
- package/dist/esm/index.native83.js +21 -2
- package/dist/esm/index.native84.js +18 -102
- package/dist/esm/index.native85.js +80 -20
- package/dist/esm/index.native86.js +103 -79
- package/dist/esm/index.native89.js +10 -21
- package/dist/esm/index.native90.js +21 -10
- package/dist/esm/index.native91.js +9 -19
- package/dist/esm/index.native92.js +15 -89
- package/dist/esm/index.native93.js +92 -19
- package/dist/esm/index.native94.js +18 -115
- package/dist/esm/index.native95.js +112 -73
- package/dist/esm/index.native96.js +79 -10
- package/dist/esm/index.native98.js +13 -18
- package/dist/esm/index.native99.js +35 -27
- package/dist/esm/index.web.js +41 -38
- package/dist/esm/index.web12.js +6 -5
- package/dist/esm/index.web13.js +12 -10
- package/dist/esm/index.web15.js +1 -0
- package/dist/esm/index.web5.js +188 -134
- package/dist/native/index.native.js +40 -37
- package/dist/native/index.native100.js +41 -7
- package/dist/native/index.native101.js +18 -11
- package/dist/native/index.native102.js +28 -13
- package/dist/native/index.native103.js +8 -10
- package/dist/native/index.native104.js +11 -17
- package/dist/native/index.native105.js +12 -80
- package/dist/native/index.native106.js +10 -13
- package/dist/native/index.native107.js +17 -36
- package/dist/native/index.native108.js +79 -40
- package/dist/native/index.native14.js +6 -5
- package/dist/native/index.native15.js +12 -10
- package/dist/native/index.native17.js +1 -0
- package/dist/native/index.native28.js +1 -1
- package/dist/native/index.native54.js +1 -1
- package/dist/native/index.native55.js +1 -1
- package/dist/native/index.native57.js +2 -2
- package/dist/native/index.native59.js +1 -1
- package/dist/native/index.native6.js +188 -134
- package/dist/native/index.native77.js +6 -6
- package/dist/native/index.native82.js +2 -21
- package/dist/native/index.native83.js +21 -2
- package/dist/native/index.native84.js +18 -102
- package/dist/native/index.native85.js +80 -20
- package/dist/native/index.native86.js +103 -79
- package/dist/native/index.native89.js +10 -21
- package/dist/native/index.native90.js +21 -10
- package/dist/native/index.native91.js +9 -19
- package/dist/native/index.native92.js +15 -89
- package/dist/native/index.native93.js +92 -19
- package/dist/native/index.native94.js +18 -115
- package/dist/native/index.native95.js +112 -73
- package/dist/native/index.native96.js +79 -10
- package/dist/native/index.native98.js +13 -18
- package/dist/native/index.native99.js +35 -27
- package/dist/native-types/auth/withAuth.d.ts +3 -1
- package/dist/native-types/core.d.ts +3 -1
- package/dist/native-types/types.d.ts +20 -3
- package/dist/types/auth/withAuth.d.ts +3 -1
- package/dist/types/core.d.ts +3 -1
- package/dist/types/types.d.ts +20 -3
- package/dist/web/index.web.js +41 -38
- package/dist/web/index.web12.js +6 -5
- package/dist/web/index.web13.js +12 -10
- package/dist/web/index.web15.js +1 -0
- package/dist/web/index.web5.js +188 -134
- package/dist/web-types/auth/withAuth.d.ts +3 -1
- package/dist/web-types/core.d.ts +3 -1
- package/dist/web-types/types.d.ts +20 -3
- package/package.json +2 -2
package/dist/types/types.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { SendEvmTransactionWithEndUserAccountBodyNetwork, APIError, APIErrorType, ErrorType, HttpErrorType, EvmUserOperation } from '@coinbase/cdp-api-client';
|
|
1
|
+
import { SendEvmTransactionWithEndUserAccountBodyNetwork, SendSolanaTransactionWithEndUserAccountBodyNetwork, APIError, APIErrorType, ErrorType, HttpErrorType, EvmUserOperation } from '@coinbase/cdp-api-client';
|
|
2
2
|
import { TransactionSerializableEIP1559 } from 'viem';
|
|
3
|
-
export { APIError, type APIErrorType, ErrorType, HttpErrorType, SendEvmTransactionWithEndUserAccountBodyNetwork, };
|
|
3
|
+
export { APIError, type APIErrorType, ErrorType, HttpErrorType, SendEvmTransactionWithEndUserAccountBodyNetwork, SendSolanaTransactionWithEndUserAccountBodyNetwork, };
|
|
4
4
|
export type Config = {
|
|
5
5
|
projectId: string;
|
|
6
6
|
useMock?: boolean;
|
|
7
7
|
debugging?: boolean;
|
|
8
8
|
basePath?: string;
|
|
9
|
-
createAccountOnLogin?: "evm-eoa" | "evm-smart";
|
|
9
|
+
createAccountOnLogin?: "evm-eoa" | "evm-smart" | "solana";
|
|
10
10
|
};
|
|
11
11
|
export type Hex = `0x${string}`;
|
|
12
12
|
export type EvmAddress = `0x${string}`;
|
|
13
|
+
export type SolanaAddress = string;
|
|
13
14
|
export type AuthenticationMethods = {
|
|
14
15
|
email?: EmailAuthentication;
|
|
15
16
|
sms?: SmsAuthentication;
|
|
@@ -19,6 +20,7 @@ export type User = {
|
|
|
19
20
|
authenticationMethods: AuthenticationMethods;
|
|
20
21
|
evmAccounts?: EvmAddress[];
|
|
21
22
|
evmSmartAccounts?: EvmAddress[];
|
|
23
|
+
solanaAccounts?: SolanaAddress[];
|
|
22
24
|
};
|
|
23
25
|
export type EmailAuthentication = {
|
|
24
26
|
type: "email";
|
|
@@ -76,6 +78,13 @@ export type SignEvmTransactionOptions = {
|
|
|
76
78
|
export type SignEvmTransactionResult = {
|
|
77
79
|
signedTransaction: Hex;
|
|
78
80
|
};
|
|
81
|
+
export type SignSolanaTransactionOptions = {
|
|
82
|
+
solanaAccount: SolanaAddress;
|
|
83
|
+
transaction: string;
|
|
84
|
+
};
|
|
85
|
+
export type SignSolanaTransactionResult = {
|
|
86
|
+
signedTransaction: string;
|
|
87
|
+
};
|
|
79
88
|
export type SendEvmTransactionOptions = {
|
|
80
89
|
evmAccount: EvmAddress;
|
|
81
90
|
network: SendEvmTransactionWithEndUserAccountBodyNetwork;
|
|
@@ -84,6 +93,14 @@ export type SendEvmTransactionOptions = {
|
|
|
84
93
|
export type SendEvmTransactionResult = {
|
|
85
94
|
transactionHash: Hex;
|
|
86
95
|
};
|
|
96
|
+
export type SendSolanaTransactionOptions = {
|
|
97
|
+
solanaAccount: SolanaAddress;
|
|
98
|
+
network: SendSolanaTransactionWithEndUserAccountBodyNetwork;
|
|
99
|
+
transaction: string;
|
|
100
|
+
};
|
|
101
|
+
export type SendSolanaTransactionResult = {
|
|
102
|
+
transactionSignature: string;
|
|
103
|
+
};
|
|
87
104
|
export type SignEvmMessageOptions = {
|
|
88
105
|
evmAccount: EvmAddress;
|
|
89
106
|
message: string;
|
package/dist/web/index.web.js
CHANGED
|
@@ -1,47 +1,50 @@
|
|
|
1
1
|
import { setPlatformServices as r } from "./index.web2.js";
|
|
2
|
-
import { webCrypto as
|
|
3
|
-
import { webStorage as
|
|
4
|
-
import { exportEvmAccount as
|
|
5
|
-
import { AuthManager as
|
|
6
|
-
import { APIError as
|
|
2
|
+
import { webCrypto as o } from "./index.web3.js";
|
|
3
|
+
import { webStorage as e } from "./index.web4.js";
|
|
4
|
+
import { exportEvmAccount as c, getAccessToken as g, getCurrentUser as d, getUserOperation as f, initialize as S, isSignedIn as T, onAuthStateChange as l, sendEvmTransaction as v, sendSolanaTransaction as u, sendUserOperation as A, signEvmHash as y, signEvmMessage as h, signEvmTransaction as x, signEvmTypedData as O, signInWithEmail as P, signInWithSms as C, signOut as D, signSolanaTransaction as I, verifyEmailOTP as R, verifySmsOTP as U } from "./index.web5.js";
|
|
5
|
+
import { AuthManager as w } from "./index.web6.js";
|
|
6
|
+
import { APIError as k, ErrorType as M, HttpErrorType as N, SendEvmTransactionWithEndUserAccountBodyNetwork as B, SendSolanaTransactionWithEndUserAccountBodyNetwork as H } from "@coinbase/cdp-api-client";
|
|
7
7
|
import "viem";
|
|
8
|
-
import { createCDPEmbeddedWallet as
|
|
9
|
-
import { EIP1193ProviderError as
|
|
8
|
+
import { createCDPEmbeddedWallet as z } from "./index.web7.js";
|
|
9
|
+
import { EIP1193ProviderError as j, STANDARD_ERROR_CODES as q } from "./index.web8.js";
|
|
10
10
|
import "ox";
|
|
11
11
|
import "zustand";
|
|
12
|
-
import { toViemAccount as
|
|
13
|
-
import { ModuleResolutionError as
|
|
12
|
+
import { toViemAccount as G } from "./index.web9.js";
|
|
13
|
+
import { ModuleResolutionError as K } from "./index.web10.js";
|
|
14
14
|
r({
|
|
15
|
-
crypto:
|
|
16
|
-
storage:
|
|
15
|
+
crypto: o,
|
|
16
|
+
storage: e
|
|
17
17
|
});
|
|
18
18
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
c as
|
|
30
|
-
|
|
31
|
-
d as
|
|
32
|
-
|
|
19
|
+
k as APIError,
|
|
20
|
+
w as AuthManager,
|
|
21
|
+
j as EIP1193ProviderError,
|
|
22
|
+
M as ErrorType,
|
|
23
|
+
N as HttpErrorType,
|
|
24
|
+
K as ModuleResolutionError,
|
|
25
|
+
q as STANDARD_ERROR_CODES,
|
|
26
|
+
B as SendEvmTransactionWithEndUserAccountBodyNetwork,
|
|
27
|
+
H as SendSolanaTransactionWithEndUserAccountBodyNetwork,
|
|
28
|
+
z as createCDPEmbeddedWallet,
|
|
29
|
+
c as exportEvmAccount,
|
|
30
|
+
g as getAccessToken,
|
|
31
|
+
d as getCurrentUser,
|
|
32
|
+
f as getUserOperation,
|
|
33
|
+
S as initialize,
|
|
33
34
|
T as isSignedIn,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
O as
|
|
42
|
-
P as
|
|
43
|
-
C as
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
l as onAuthStateChange,
|
|
36
|
+
v as sendEvmTransaction,
|
|
37
|
+
u as sendSolanaTransaction,
|
|
38
|
+
A as sendUserOperation,
|
|
39
|
+
y as signEvmHash,
|
|
40
|
+
h as signEvmMessage,
|
|
41
|
+
x as signEvmTransaction,
|
|
42
|
+
O as signEvmTypedData,
|
|
43
|
+
P as signInWithEmail,
|
|
44
|
+
C as signInWithSms,
|
|
45
|
+
D as signOut,
|
|
46
|
+
I as signSolanaTransaction,
|
|
47
|
+
G as toViemAccount,
|
|
48
|
+
R as verifyEmailOTP,
|
|
49
|
+
U as verifySmsOTP
|
|
47
50
|
};
|
package/dist/web/index.web12.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import "@coinbase/cdp-api-client";
|
|
2
|
-
const
|
|
3
|
-
const s = new Date(
|
|
2
|
+
const m = (c, a, e) => {
|
|
3
|
+
const s = new Date(a).getTime(), u = {
|
|
4
4
|
userId: e.userId,
|
|
5
5
|
evmAccounts: e.evmAccounts?.map((t) => t) ?? [],
|
|
6
6
|
evmSmartAccounts: e.evmSmartAccounts?.map((t) => t) ?? [],
|
|
7
|
+
solanaAccounts: e.solanaAccounts?.map((t) => t) ?? [],
|
|
7
8
|
authenticationMethods: e.authenticationMethods.reduce((t, o) => (t[o.type] = o, t), {})
|
|
8
9
|
};
|
|
9
10
|
return {
|
|
10
|
-
accessToken:
|
|
11
|
+
accessToken: c,
|
|
11
12
|
expiresAt: s,
|
|
12
|
-
user:
|
|
13
|
+
user: u
|
|
13
14
|
};
|
|
14
15
|
};
|
|
15
16
|
export {
|
|
16
|
-
|
|
17
|
+
m as toAuthState
|
|
17
18
|
};
|
package/dist/web/index.web13.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import "@coinbase/cdp-api-client";
|
|
2
2
|
import "viem";
|
|
3
|
-
const
|
|
4
|
-
async function
|
|
5
|
-
if (!await
|
|
3
|
+
const i = async (n) => await n.isSignedIn();
|
|
4
|
+
async function f(n, r, o) {
|
|
5
|
+
if (!await i(r))
|
|
6
6
|
throw new Error("User not signed in");
|
|
7
|
-
const
|
|
8
|
-
if ("evmAccount" in
|
|
7
|
+
const c = await r.getUser();
|
|
8
|
+
if ("evmAccount" in n && !c.evmAccounts?.find((t) => t === n.evmAccount))
|
|
9
9
|
throw new Error("EVM account not found");
|
|
10
|
-
if ("evmSmartAccount" in
|
|
10
|
+
if ("evmSmartAccount" in n && !c.evmSmartAccounts?.find((t) => t === n.evmSmartAccount))
|
|
11
11
|
throw new Error("EVM Smart Account not found");
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
if ("solanaAccount" in n && !c.solanaAccounts?.find((t) => t === n.solanaAccount))
|
|
13
|
+
throw new Error("Solana account not found");
|
|
14
|
+
const e = await r.getWalletSecretId();
|
|
15
|
+
return o({ ...n, user: c, walletSecretId: e });
|
|
14
16
|
}
|
|
15
17
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
i as isSignedIn,
|
|
19
|
+
f as withAuth
|
|
18
20
|
};
|
package/dist/web/index.web15.js
CHANGED