@coinbase/cdp-core 0.0.58 → 0.0.60
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 +55 -54
- package/dist/esm/index.native103.js +1 -1
- package/dist/esm/index.native115.js +1 -1
- package/dist/esm/index.native127.js +1 -1
- package/dist/esm/index.native141.js +46 -3
- package/dist/esm/index.native142.js +3 -46
- package/dist/esm/index.native16.js +8 -0
- package/dist/esm/index.native164.js +1 -1
- package/dist/esm/index.native29.js +10 -2
- package/dist/esm/index.native47.js +1 -1
- package/dist/esm/index.native7.js +52 -51
- package/dist/esm/index.web.js +59 -58
- package/dist/esm/index.web100.js +2 -4
- package/dist/esm/index.web101.js +44 -19
- package/dist/esm/index.web102.js +13 -8
- package/dist/esm/index.web103.js +2 -8
- package/dist/esm/index.web104.js +4 -71
- package/dist/esm/index.web105.js +12 -12
- package/dist/esm/index.web106.js +7 -3
- package/dist/esm/index.web107.js +3 -4
- package/dist/esm/index.web108.js +19 -4
- package/dist/esm/index.web109.js +8 -4
- package/dist/esm/index.web110.js +7 -19
- package/dist/esm/index.web111.js +66 -47
- package/dist/esm/index.web112.js +18 -17
- package/dist/esm/index.web113.js +3 -20
- package/dist/esm/index.web114.js +4 -8
- package/dist/esm/index.web115.js +4 -30
- package/dist/esm/index.web116.js +4 -7
- package/dist/esm/index.web117.js +10 -11
- package/dist/esm/index.web118.js +52 -4
- package/dist/esm/index.web119.js +17 -54
- package/dist/esm/index.web120.js +20 -10
- package/dist/esm/index.web121.js +9 -2
- package/dist/esm/index.web122.js +30 -44
- package/dist/esm/index.web123.js +7 -13
- package/dist/esm/index.web124.js +21 -2
- package/dist/esm/index.web126.js +2 -2
- package/dist/esm/index.web131.js +32 -6
- package/dist/esm/index.web132.js +6 -32
- package/dist/esm/index.web137.js +3 -46
- package/dist/esm/index.web138.js +20 -3
- package/dist/esm/index.web139.js +10 -21
- package/dist/esm/index.web140.js +19 -9
- package/dist/esm/index.web141.js +89 -15
- package/dist/esm/index.web142.js +19 -92
- package/dist/esm/index.web143.js +115 -18
- package/dist/esm/index.web144.js +44 -115
- package/dist/esm/index.web145.js +7 -38
- package/dist/esm/index.web147.js +375 -67
- package/dist/esm/index.web148.js +832 -34
- package/dist/esm/index.web149.js +38 -20
- package/dist/esm/index.web15.js +8 -0
- package/dist/esm/index.web150.js +2 -8
- package/dist/esm/index.web151.js +70 -2
- package/dist/esm/index.web152.js +30 -373
- package/dist/esm/index.web153.js +20 -832
- package/dist/esm/index.web155.js +17 -14
- package/dist/esm/index.web156.js +28 -18
- package/dist/esm/index.web157.js +6 -26
- package/dist/esm/index.web158.js +9 -6
- package/dist/esm/index.web159.js +13 -11
- package/dist/esm/index.web160.js +8 -11
- package/dist/esm/index.web161.js +14 -7
- package/dist/esm/index.web162.js +80 -16
- package/dist/esm/index.web163.js +14 -80
- package/dist/esm/index.web164.js +2 -2
- package/dist/esm/index.web165.js +2 -2
- package/dist/esm/index.web166.js +2 -2
- package/dist/esm/index.web23.js +1 -1
- package/dist/esm/index.web27.js +10 -2
- package/dist/esm/index.web40.js +1 -1
- package/dist/esm/index.web41.js +3 -3
- package/dist/esm/index.web46.js +377 -2
- package/dist/esm/index.web47.js +2 -379
- package/dist/esm/index.web48.js +65 -28
- package/dist/esm/index.web49.js +364 -28
- package/dist/esm/index.web50.js +4 -2
- package/dist/esm/index.web51.js +28 -65
- package/dist/esm/index.web52.js +28 -364
- package/dist/esm/index.web53.js +1 -1
- package/dist/esm/index.web55.js +4 -4
- package/dist/esm/index.web6.js +52 -51
- package/dist/esm/index.web73.js +1 -1
- package/dist/esm/index.web91.js +1 -1
- package/dist/esm/index.web92.js +1 -1
- package/dist/esm/index.web97.js +4 -4
- package/dist/esm/index.web98.js +53 -17
- package/dist/esm/index.web99.js +10 -7
- package/dist/native/index.native.js +55 -54
- package/dist/native/index.native103.js +1 -1
- package/dist/native/index.native115.js +1 -1
- package/dist/native/index.native127.js +1 -1
- package/dist/native/index.native141.js +46 -3
- package/dist/native/index.native142.js +3 -46
- package/dist/native/index.native16.js +8 -0
- package/dist/native/index.native164.js +1 -1
- package/dist/native/index.native29.js +10 -2
- package/dist/native/index.native47.js +1 -1
- package/dist/native/index.native7.js +52 -51
- package/dist/native-types/auth/authManager.d.ts +1 -0
- package/dist/native-types/auth/types.d.ts +1 -0
- package/dist/native-types/core.d.ts +1 -0
- package/dist/native-types/mocks/mockAuthManager.d.ts +1 -0
- package/dist/native-types/types.d.ts +4 -0
- package/dist/native-types/version.d.ts +1 -1
- package/dist/types/auth/authManager.d.ts +1 -0
- package/dist/types/auth/types.d.ts +1 -0
- package/dist/types/core.d.ts +1 -0
- package/dist/types/mocks/mockAuthManager.d.ts +1 -0
- package/dist/types/types.d.ts +4 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/web/index.web.js +59 -58
- package/dist/web/index.web100.js +2 -4
- package/dist/web/index.web101.js +44 -19
- package/dist/web/index.web102.js +13 -8
- package/dist/web/index.web103.js +2 -8
- package/dist/web/index.web104.js +4 -71
- package/dist/web/index.web105.js +12 -12
- package/dist/web/index.web106.js +7 -3
- package/dist/web/index.web107.js +3 -4
- package/dist/web/index.web108.js +19 -4
- package/dist/web/index.web109.js +8 -4
- package/dist/web/index.web110.js +7 -19
- package/dist/web/index.web111.js +66 -47
- package/dist/web/index.web112.js +18 -17
- package/dist/web/index.web113.js +3 -20
- package/dist/web/index.web114.js +4 -8
- package/dist/web/index.web115.js +4 -30
- package/dist/web/index.web116.js +4 -7
- package/dist/web/index.web117.js +10 -11
- package/dist/web/index.web118.js +52 -4
- package/dist/web/index.web119.js +17 -54
- package/dist/web/index.web120.js +20 -10
- package/dist/web/index.web121.js +9 -2
- package/dist/web/index.web122.js +30 -44
- package/dist/web/index.web123.js +7 -13
- package/dist/web/index.web124.js +21 -2
- package/dist/web/index.web126.js +2 -2
- package/dist/web/index.web131.js +32 -6
- package/dist/web/index.web132.js +6 -32
- package/dist/web/index.web137.js +3 -46
- package/dist/web/index.web138.js +20 -3
- package/dist/web/index.web139.js +10 -21
- package/dist/web/index.web140.js +19 -9
- package/dist/web/index.web141.js +89 -15
- package/dist/web/index.web142.js +19 -92
- package/dist/web/index.web143.js +115 -18
- package/dist/web/index.web144.js +44 -115
- package/dist/web/index.web145.js +7 -38
- package/dist/web/index.web147.js +375 -67
- package/dist/web/index.web148.js +832 -34
- package/dist/web/index.web149.js +38 -20
- package/dist/web/index.web15.js +8 -0
- package/dist/web/index.web150.js +2 -8
- package/dist/web/index.web151.js +70 -2
- package/dist/web/index.web152.js +30 -373
- package/dist/web/index.web153.js +20 -832
- package/dist/web/index.web155.js +17 -14
- package/dist/web/index.web156.js +28 -18
- package/dist/web/index.web157.js +6 -26
- package/dist/web/index.web158.js +9 -6
- package/dist/web/index.web159.js +13 -11
- package/dist/web/index.web160.js +8 -11
- package/dist/web/index.web161.js +14 -7
- package/dist/web/index.web162.js +80 -16
- package/dist/web/index.web163.js +14 -80
- package/dist/web/index.web164.js +2 -2
- package/dist/web/index.web165.js +2 -2
- package/dist/web/index.web166.js +2 -2
- package/dist/web/index.web23.js +1 -1
- package/dist/web/index.web27.js +10 -2
- package/dist/web/index.web40.js +1 -1
- package/dist/web/index.web41.js +3 -3
- package/dist/web/index.web46.js +377 -2
- package/dist/web/index.web47.js +2 -379
- package/dist/web/index.web48.js +65 -28
- package/dist/web/index.web49.js +364 -28
- package/dist/web/index.web50.js +4 -2
- package/dist/web/index.web51.js +28 -65
- package/dist/web/index.web52.js +28 -364
- package/dist/web/index.web53.js +1 -1
- package/dist/web/index.web55.js +4 -4
- package/dist/web/index.web6.js +52 -51
- package/dist/web/index.web73.js +1 -1
- package/dist/web/index.web91.js +1 -1
- package/dist/web/index.web92.js +1 -1
- package/dist/web/index.web97.js +4 -4
- package/dist/web/index.web98.js +53 -17
- package/dist/web/index.web99.js +10 -7
- package/dist/web-types/auth/authManager.d.ts +1 -0
- package/dist/web-types/auth/types.d.ts +1 -0
- package/dist/web-types/core.d.ts +1 -0
- package/dist/web-types/mocks/mockAuthManager.d.ts +1 -0
- package/dist/web-types/types.d.ts +4 -0
- package/dist/web-types/version.d.ts +1 -1
- package/package.json +2 -2
package/dist/web/index.web6.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { b as m } from "./index.web21.js";
|
|
2
|
-
import { configureCdpApiClient as C, setAuthManager as M, initiateAuthentication as
|
|
2
|
+
import { configureCdpApiClient as C, setAuthManager as M, initiateAuthentication as T, createEndUserEvmAccount as O, createEndUserEvmSmartAccount as A, createEndUserSolanaAccount as P, verifyEmailAuthentication as b, verifySmsAuthentication as x, verifyOAuthCode as j, signEvmHashWithEndUserAccount as K, signEvmTransactionWithEndUserAccount as W, signSolanaTransactionWithEndUserAccount as H, sendEvmTransactionWithEndUserAccount as B, sendSolanaTransactionWithEndUserAccount as D, signEvmMessageWithEndUserAccount as L, signSolanaMessageWithEndUserAccount as N, signEvmTypedDataWithEndUserAccount as F, sendUserOperationWithEndUserAccount as z, getUserOperationWithEndUserAccount as R, exportEndUserEvmAccount as $, exportEndUserSolanaAccount as V } from "@coinbase/cdp-api-client";
|
|
3
3
|
import { Analytics as c } from "./index.web22.js";
|
|
4
4
|
import "./index.web23.js";
|
|
5
5
|
import { Keypair as v } from "@solana/web3.js";
|
|
6
6
|
import w from "bs58";
|
|
7
7
|
import { AuthManager as q } from "./index.web15.js";
|
|
8
8
|
import { OAuthManager as G } from "./index.web24.js";
|
|
9
|
-
import { toAuthState as
|
|
9
|
+
import { toAuthState as p } from "./index.web25.js";
|
|
10
10
|
import { withAuth as u } from "./index.web26.js";
|
|
11
11
|
import { MockAuthManager as J } from "./index.web27.js";
|
|
12
12
|
import { MockOAuthManager as Q } from "./index.web28.js";
|
|
13
13
|
import { mockUser as k } from "./index.web29.js";
|
|
14
14
|
import { getPlatformServices as g, getPlatformCrypto as _ } from "./index.web2.js";
|
|
15
15
|
import { isChainSupportedForCDPSends as X } from "./index.web30.js";
|
|
16
|
-
import { getConfig as a, setCoreAuthManager as
|
|
16
|
+
import { getConfig as a, setCoreAuthManager as E, setCoreOAuthManager as I, getCoreAuthManager as o, getCoreOAuthManager as Y, setConfig as Z } from "./index.web31.js";
|
|
17
17
|
import "viem";
|
|
18
18
|
import { serializeTransaction as U } from "./index.web32.js";
|
|
19
19
|
const we = async (e) => {
|
|
@@ -27,7 +27,7 @@ const we = async (e) => {
|
|
|
27
27
|
r = !0;
|
|
28
28
|
}
|
|
29
29
|
if (Z(e), a().useMock) {
|
|
30
|
-
|
|
30
|
+
E(new J(a().projectId)), I(new Q());
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
let n;
|
|
@@ -54,18 +54,18 @@ const we = async (e) => {
|
|
|
54
54
|
refreshTokenStorage: n
|
|
55
55
|
}), r) {
|
|
56
56
|
const t = new G();
|
|
57
|
-
|
|
57
|
+
I(t);
|
|
58
58
|
const s = new q(a().projectId);
|
|
59
|
-
|
|
59
|
+
E(s), M(s);
|
|
60
60
|
}
|
|
61
61
|
await o().ensureInitialized();
|
|
62
62
|
}, ke = async (e) => (c.sendActionCallEvent({ name: "sign_in_with_email" }), f({
|
|
63
63
|
email: e.email,
|
|
64
64
|
type: "email"
|
|
65
|
-
})),
|
|
65
|
+
})), Ee = async (e) => (c.sendActionCallEvent({ name: "sign_in_with_sms" }), f({
|
|
66
66
|
phoneNumber: e.phoneNumber,
|
|
67
67
|
type: "sms"
|
|
68
|
-
})),
|
|
68
|
+
})), Ie = async (e) => {
|
|
69
69
|
c.sendActionCallEvent({ name: "sign_in_with_oauth" });
|
|
70
70
|
const r = g().oauth.getRedirectUrl();
|
|
71
71
|
if (a().useMock) {
|
|
@@ -85,12 +85,12 @@ const we = async (e) => {
|
|
|
85
85
|
)), _e = async (e) => (c.sendActionCallEvent({ name: "verify_sms_otp" }), y(
|
|
86
86
|
e,
|
|
87
87
|
"Mock SMS OTP verified",
|
|
88
|
-
(r, n) =>
|
|
88
|
+
(r, n) => x(r, n)
|
|
89
89
|
)), Ue = async (e) => (c.sendActionCallEvent({ name: "verify_oauth" }), y(
|
|
90
90
|
e,
|
|
91
91
|
"Mock OAuth code verified",
|
|
92
|
-
(r, n) =>
|
|
93
|
-
)), Ce = async () => (c.sendActionCallEvent({ name: "get_current_user" }), o().getUser()), Me = async () => (c.sendActionCallEvent({ name: "is_signed_in" }), o().isSignedIn()),
|
|
92
|
+
(r, n) => j(r, n.providerType, n)
|
|
93
|
+
)), Ce = async () => (c.sendActionCallEvent({ name: "get_current_user" }), o().getUser()), Me = async () => (c.sendActionCallEvent({ name: "is_signed_in" }), o().isSignedIn()), Te = async () => {
|
|
94
94
|
if (c.sendActionCallEvent({ name: "sign_out" }), a().useMock) {
|
|
95
95
|
await o().signOut();
|
|
96
96
|
return;
|
|
@@ -98,9 +98,9 @@ const we = async (e) => {
|
|
|
98
98
|
if (!await o().isSignedIn())
|
|
99
99
|
throw new Error("User not signed in");
|
|
100
100
|
await o().signOut();
|
|
101
|
-
},
|
|
101
|
+
}, Oe = async () => (c.sendActionCallEvent({ name: "get_access_token" }), o().getToken()), Pe = async () => (c.sendActionCallEvent({ name: "get_access_token_expiration" }), o().getTokenExpiration()), be = (e) => {
|
|
102
102
|
o().addAuthStateChangeCallback(e);
|
|
103
|
-
},
|
|
103
|
+
}, xe = (e) => {
|
|
104
104
|
Y().addOAuthStateChangeCallback(e);
|
|
105
105
|
}, je = async (e) => (c.sendActionCallEvent({ name: "sign_evm_hash" }), a().useMock ? { signature: "0x0" } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
|
|
106
106
|
signature: (await K(a().projectId, r.userId, {
|
|
@@ -108,7 +108,7 @@ const we = async (e) => {
|
|
|
108
108
|
address: e.evmAccount,
|
|
109
109
|
walletSecretId: n
|
|
110
110
|
})).signature
|
|
111
|
-
}))),
|
|
111
|
+
}))), Ke = async (e) => (c.sendActionCallEvent({ name: "sign_evm_transaction" }), a().useMock ? { signedTransaction: "0x0" } : u(e, o(), async ({ user: r, walletSecretId: n }) => {
|
|
112
112
|
const t = U(e.transaction);
|
|
113
113
|
return {
|
|
114
114
|
signedTransaction: (await W(
|
|
@@ -121,7 +121,7 @@ const we = async (e) => {
|
|
|
121
121
|
}
|
|
122
122
|
)).signedTransaction
|
|
123
123
|
};
|
|
124
|
-
})),
|
|
124
|
+
})), We = async (e) => (c.sendActionCallEvent({ name: "sign_solana_transaction" }), a().useMock ? { signedTransaction: "mock-signed-transaction" } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
|
|
125
125
|
signedTransaction: (await H(
|
|
126
126
|
a().projectId,
|
|
127
127
|
r.userId,
|
|
@@ -131,7 +131,7 @@ const we = async (e) => {
|
|
|
131
131
|
walletSecretId: n
|
|
132
132
|
}
|
|
133
133
|
)).signedTransaction
|
|
134
|
-
}))),
|
|
134
|
+
}))), He = async (e) => {
|
|
135
135
|
if (c.sendActionCallEvent({ name: "send_evm_transaction" }), !X(e.network))
|
|
136
136
|
throw new Error(`Chain ${e.network} is not supported by the CDP Apis`);
|
|
137
137
|
if (a().useMock)
|
|
@@ -149,7 +149,7 @@ const we = async (e) => {
|
|
|
149
149
|
}
|
|
150
150
|
)).transactionHash
|
|
151
151
|
}));
|
|
152
|
-
},
|
|
152
|
+
}, Be = async (e) => (c.sendActionCallEvent({ name: "send_solana_transaction" }), a().useMock ? { transactionSignature: "mock-signature" } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
|
|
153
153
|
transactionSignature: (await D(
|
|
154
154
|
a().projectId,
|
|
155
155
|
r.userId,
|
|
@@ -160,13 +160,13 @@ const we = async (e) => {
|
|
|
160
160
|
network: e.network
|
|
161
161
|
}
|
|
162
162
|
)).transactionSignature
|
|
163
|
-
}))),
|
|
163
|
+
}))), De = async (e) => (c.sendActionCallEvent({ name: "sign_evm_message" }), a().useMock ? { signature: "0x0" } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
|
|
164
164
|
signature: (await L(a().projectId, r.userId, {
|
|
165
165
|
message: e.message,
|
|
166
166
|
address: e.evmAccount,
|
|
167
167
|
walletSecretId: n
|
|
168
168
|
})).signature
|
|
169
|
-
}))),
|
|
169
|
+
}))), Le = async (e) => (c.sendActionCallEvent({ name: "sign_solana_message" }), a().useMock ? { signature: "mockSignature" } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
|
|
170
170
|
signature: (await N(
|
|
171
171
|
a().projectId,
|
|
172
172
|
r.userId,
|
|
@@ -176,13 +176,13 @@ const we = async (e) => {
|
|
|
176
176
|
walletSecretId: n
|
|
177
177
|
}
|
|
178
178
|
)).signature
|
|
179
|
-
}))),
|
|
179
|
+
}))), Ne = async (e) => (c.sendActionCallEvent({ name: "sign_evm_typed_data" }), a().useMock ? { signature: "0x0" } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
|
|
180
180
|
signature: (await F(a().projectId, r.userId, {
|
|
181
181
|
typedData: e.typedData,
|
|
182
182
|
address: e.evmAccount,
|
|
183
183
|
walletSecretId: n
|
|
184
184
|
})).signature
|
|
185
|
-
}))),
|
|
185
|
+
}))), Fe = async (e) => (c.sendActionCallEvent({ name: "send_user_operation" }), a().useMock ? {
|
|
186
186
|
userOperationHash: "0x1234567890123456789012345678901234567890123456789012345678901234"
|
|
187
187
|
} : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
|
|
188
188
|
userOperationHash: (await z(
|
|
@@ -201,7 +201,7 @@ const we = async (e) => {
|
|
|
201
201
|
paymasterUrl: e.paymasterUrl
|
|
202
202
|
}
|
|
203
203
|
)).userOpHash
|
|
204
|
-
}))),
|
|
204
|
+
}))), ze = async (e) => (c.sendActionCallEvent({ name: "get_user_operation" }), a().useMock ? {
|
|
205
205
|
userOpHash: e.userOperationHash,
|
|
206
206
|
network: e.network,
|
|
207
207
|
calls: [
|
|
@@ -219,7 +219,7 @@ const we = async (e) => {
|
|
|
219
219
|
r.userId,
|
|
220
220
|
e.evmSmartAccount,
|
|
221
221
|
e.userOperationHash
|
|
222
|
-
))),
|
|
222
|
+
))), Re = async (e) => {
|
|
223
223
|
if (c.sendActionCallEvent({ name: "export_evm_account" }), a().useMock)
|
|
224
224
|
return {
|
|
225
225
|
privateKey: m.Buffer.from("mock-private-key").toString("hex")
|
|
@@ -238,7 +238,7 @@ const we = async (e) => {
|
|
|
238
238
|
privateKey: m.Buffer.from(d).toString("hex")
|
|
239
239
|
};
|
|
240
240
|
});
|
|
241
|
-
},
|
|
241
|
+
}, $e = async (e) => {
|
|
242
242
|
if (c.sendActionCallEvent({ name: "export_solana_account" }), a().useMock) {
|
|
243
243
|
const t = m.Buffer.from("mock-private-key").subarray(0, 32), s = m.Buffer.alloc(32);
|
|
244
244
|
t.copy(s);
|
|
@@ -256,9 +256,9 @@ const we = async (e) => {
|
|
|
256
256
|
}), d = await r.decryptWithPrivateKey(
|
|
257
257
|
n.privateKey,
|
|
258
258
|
i.encryptedPrivateKey
|
|
259
|
-
), l = v.fromSeed(new Uint8Array(d)),
|
|
259
|
+
), l = v.fromSeed(new Uint8Array(d)), h = m.Buffer.concat([l.secretKey.subarray(0, 32), l.publicKey.toBytes()]);
|
|
260
260
|
return {
|
|
261
|
-
privateKey: w.encode(
|
|
261
|
+
privateKey: w.encode(h)
|
|
262
262
|
};
|
|
263
263
|
});
|
|
264
264
|
}, f = async (e) => {
|
|
@@ -272,7 +272,7 @@ const we = async (e) => {
|
|
|
272
272
|
};
|
|
273
273
|
if (await o().isSignedIn())
|
|
274
274
|
throw new Error("User is already authenticated. Please sign out first.");
|
|
275
|
-
const n = await
|
|
275
|
+
const n = await T(a().projectId, e);
|
|
276
276
|
return "authUrl" in n ? {
|
|
277
277
|
flowId: n.flowId,
|
|
278
278
|
authUrl: n.authUrl
|
|
@@ -292,7 +292,7 @@ const we = async (e) => {
|
|
|
292
292
|
isNewUser: !1
|
|
293
293
|
};
|
|
294
294
|
const t = await n(a().projectId, e);
|
|
295
|
-
let s =
|
|
295
|
+
let s = p(
|
|
296
296
|
t.accessToken,
|
|
297
297
|
t.validUntil,
|
|
298
298
|
t.endUser
|
|
@@ -315,22 +315,22 @@ const we = async (e) => {
|
|
|
315
315
|
if (!r.user.evmAccounts || r.user.evmAccounts.length === 0)
|
|
316
316
|
try {
|
|
317
317
|
const s = await o().getWalletSecretId();
|
|
318
|
-
let i = await
|
|
318
|
+
let i = await O(a().projectId, r.user.userId, {
|
|
319
319
|
walletSecretId: s
|
|
320
320
|
}), d = !1;
|
|
321
321
|
const l = a().ethereum;
|
|
322
322
|
if (l?.createOnLogin === "smart" && (d = l.enableSpendPermissions ?? !1), n === "smart") {
|
|
323
|
-
const [
|
|
323
|
+
const [h] = i.evmAccounts;
|
|
324
324
|
i = await A(
|
|
325
325
|
a().projectId,
|
|
326
326
|
r.user.userId,
|
|
327
327
|
{
|
|
328
|
-
owner:
|
|
328
|
+
owner: h,
|
|
329
329
|
enableSpendPermissions: d
|
|
330
330
|
}
|
|
331
331
|
);
|
|
332
332
|
}
|
|
333
|
-
t =
|
|
333
|
+
t = p(e.accessToken, e.validUntil, i), await o().setAuthState(t);
|
|
334
334
|
} catch (s) {
|
|
335
335
|
throw new Error(`Failed to create EVM account: ${s}`);
|
|
336
336
|
}
|
|
@@ -345,7 +345,7 @@ const we = async (e) => {
|
|
|
345
345
|
// Defaulting to false until the feature is ready.
|
|
346
346
|
}
|
|
347
347
|
);
|
|
348
|
-
t =
|
|
348
|
+
t = p(e.accessToken, e.validUntil, i), await o().setAuthState(t);
|
|
349
349
|
} catch (s) {
|
|
350
350
|
throw new Error(`Failed to create EVM Smart Account: ${s}`);
|
|
351
351
|
}
|
|
@@ -361,35 +361,36 @@ const we = async (e) => {
|
|
|
361
361
|
walletSecretId: t
|
|
362
362
|
}
|
|
363
363
|
);
|
|
364
|
-
n =
|
|
364
|
+
n = p(e.accessToken, e.validUntil, s), await o().setAuthState(n);
|
|
365
365
|
} catch (t) {
|
|
366
366
|
throw new Error(`Failed to create Solana account: ${t}`);
|
|
367
367
|
}
|
|
368
368
|
return n;
|
|
369
369
|
};
|
|
370
370
|
export {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
371
|
+
Re as exportEvmAccount,
|
|
372
|
+
$e as exportSolanaAccount,
|
|
373
|
+
Oe as getAccessToken,
|
|
374
|
+
Pe as getAccessTokenExpiration,
|
|
374
375
|
Ce as getCurrentUser,
|
|
375
|
-
|
|
376
|
+
ze as getUserOperation,
|
|
376
377
|
we as initialize,
|
|
377
378
|
Me as isSignedIn,
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
379
|
+
be as onAuthStateChange,
|
|
380
|
+
xe as onOAuthStateChange,
|
|
381
|
+
He as sendEvmTransaction,
|
|
382
|
+
Be as sendSolanaTransaction,
|
|
383
|
+
Fe as sendUserOperation,
|
|
383
384
|
je as signEvmHash,
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
385
|
+
De as signEvmMessage,
|
|
386
|
+
Ke as signEvmTransaction,
|
|
387
|
+
Ne as signEvmTypedData,
|
|
387
388
|
ke as signInWithEmail,
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
389
|
+
Ie as signInWithOAuth,
|
|
390
|
+
Ee as signInWithSms,
|
|
391
|
+
Te as signOut,
|
|
392
|
+
Le as signSolanaMessage,
|
|
393
|
+
We as signSolanaTransaction,
|
|
393
394
|
Se as verifyEmailOTP,
|
|
394
395
|
Ue as verifyOAuth,
|
|
395
396
|
_e as verifySmsOTP
|
package/dist/web/index.web73.js
CHANGED
package/dist/web/index.web91.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { commitmentToVersionedHash as i } from "./index.
|
|
1
|
+
import { commitmentToVersionedHash as i } from "./index.web132.js";
|
|
2
2
|
function r(o) {
|
|
3
3
|
const { commitments: t, version: n } = o, e = o.to ?? (typeof t[0] == "string" ? "hex" : "bytes"), s = [];
|
|
4
4
|
for (const m of t)
|
package/dist/web/index.web92.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { blobsToCommitments as f } from "./index.web89.js";
|
|
2
2
|
import { blobsToProofs as l } from "./index.web90.js";
|
|
3
|
-
import { toBlobs as p } from "./index.
|
|
3
|
+
import { toBlobs as p } from "./index.web131.js";
|
|
4
4
|
function k(t) {
|
|
5
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
6
|
for (let o = 0; o < s.length; o++)
|
package/dist/web/index.web97.js
CHANGED
package/dist/web/index.web98.js
CHANGED
|
@@ -1,21 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { encode as d } from "./index.web138.js";
|
|
2
|
+
import y from "./index.web139.js";
|
|
3
|
+
import b from "./index.web140.js";
|
|
4
|
+
import { JWSInvalid as r } from "./index.web54.js";
|
|
5
|
+
import { encoder as s, concat as u, decoder as h } from "./index.web99.js";
|
|
6
|
+
import g from "./index.web141.js";
|
|
7
|
+
import H from "./index.web142.js";
|
|
8
|
+
import P from "./index.web143.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;
|
|
17
53
|
}
|
|
18
54
|
}
|
|
19
55
|
export {
|
|
20
|
-
|
|
56
|
+
x as FlattenedSign
|
|
21
57
|
};
|
package/dist/web/index.web99.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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;
|
|
7
8
|
}
|
|
8
9
|
export {
|
|
9
|
-
|
|
10
|
+
f as concat,
|
|
11
|
+
s as decoder,
|
|
12
|
+
d as encoder
|
|
10
13
|
};
|
|
@@ -13,6 +13,7 @@ export declare class AuthManager implements IAuthManager {
|
|
|
13
13
|
signOut(): Promise<void>;
|
|
14
14
|
addAuthStateChangeCallback(callback: OnAuthStateChangeFn): void;
|
|
15
15
|
getToken(): Promise<string | null>;
|
|
16
|
+
getTokenExpiration(): Promise<number | null>;
|
|
16
17
|
getWalletSecretId(): Promise<string>;
|
|
17
18
|
getXWalletAuth(options: {
|
|
18
19
|
requestMethod: string;
|
|
@@ -23,6 +23,7 @@ export interface IAuthManager {
|
|
|
23
23
|
signOut(): Promise<void>;
|
|
24
24
|
addAuthStateChangeCallback(callback: OnAuthStateChangeFn): void;
|
|
25
25
|
getToken(): Promise<string | null>;
|
|
26
|
+
getTokenExpiration(): Promise<number | null>;
|
|
26
27
|
getWalletSecretId(): Promise<string>;
|
|
27
28
|
getXWalletAuth(options: {
|
|
28
29
|
requestMethod: string;
|
package/dist/web-types/core.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare const getCurrentUser: () => Promise<User | null>;
|
|
|
11
11
|
export declare const isSignedIn: () => Promise<boolean>;
|
|
12
12
|
export declare const signOut: () => Promise<void>;
|
|
13
13
|
export declare const getAccessToken: () => Promise<string | null>;
|
|
14
|
+
export declare const getAccessTokenExpiration: () => Promise<number | null>;
|
|
14
15
|
export declare const onAuthStateChange: (callback: OnAuthStateChangeFn) => void;
|
|
15
16
|
export declare const onOAuthStateChange: (callback: OnOAuthStateChangeFn) => void;
|
|
16
17
|
export declare const signEvmHash: (options: SignEvmHashOptions) => Promise<SignEvmHashResult>;
|
|
@@ -10,6 +10,7 @@ export declare class MockAuthManager implements IAuthManager {
|
|
|
10
10
|
signOut(): Promise<void>;
|
|
11
11
|
addAuthStateChangeCallback(callback: OnAuthStateChangeFn): void;
|
|
12
12
|
getToken(): Promise<string | null>;
|
|
13
|
+
getTokenExpiration(): Promise<number | null>;
|
|
13
14
|
getWalletSecretId(): Promise<string>;
|
|
14
15
|
getXWalletAuth(_options: {
|
|
15
16
|
requestMethod: string;
|
|
@@ -6,6 +6,7 @@ export type BaseConfig = {
|
|
|
6
6
|
useMock?: boolean;
|
|
7
7
|
debugging?: boolean;
|
|
8
8
|
basePath?: string;
|
|
9
|
+
secureIframeBasePath?: string;
|
|
9
10
|
disableAnalytics?: boolean;
|
|
10
11
|
nativeOAuthCallback?: string;
|
|
11
12
|
};
|
|
@@ -39,6 +40,9 @@ export type AuthenticationMethods = {
|
|
|
39
40
|
sms?: SmsAuthentication;
|
|
40
41
|
google?: OAuth2Authentication;
|
|
41
42
|
apple?: OAuth2Authentication;
|
|
43
|
+
x?: OAuth2Authentication & {
|
|
44
|
+
username?: string;
|
|
45
|
+
};
|
|
42
46
|
};
|
|
43
47
|
export type User = {
|
|
44
48
|
userId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.0.
|
|
1
|
+
export declare const VERSION = "0.0.59";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cdp-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.60",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"ox": "0.8.1",
|
|
29
29
|
"viem": "^2.33.0",
|
|
30
30
|
"zustand": "^5.0.6",
|
|
31
|
-
"@coinbase/cdp-api-client": "^0.0.
|
|
31
|
+
"@coinbase/cdp-api-client": "^0.0.60"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@react-native-async-storage/async-storage": "^2.0.0",
|