@coinbase/cdp-core 0.0.34 → 0.0.36
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 +9 -5
- package/dist/esm/index.native6.js +172 -173
- package/dist/esm/index.native77.js +6 -6
- package/dist/esm/index.native86.js +1 -1
- package/dist/esm/index.native89.js +77 -19
- 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.web26.js +1 -1
- package/dist/esm/index.web5.js +172 -173
- package/dist/esm/index.web55.js +2 -2
- package/dist/esm/index.web57.js +1 -1
- package/dist/esm/index.web75.js +6 -6
- package/dist/esm/index.web82.js +102 -18
- package/dist/esm/index.web83.js +20 -80
- package/dist/esm/index.web84.js +79 -103
- package/dist/esm/index.web87.js +77 -19
- package/dist/esm/index.web88.js +21 -10
- package/dist/esm/index.web89.js +9 -19
- package/dist/esm/index.web90.js +15 -89
- package/dist/esm/index.web91.js +92 -19
- package/dist/esm/index.web92.js +18 -115
- package/dist/esm/index.web93.js +117 -9
- package/dist/esm/index.web94.js +10 -79
- package/dist/native/index.native6.js +172 -173
- package/dist/native/index.native77.js +6 -6
- package/dist/native/index.native86.js +1 -1
- package/dist/native/index.native89.js +77 -19
- 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-types/types.d.ts +19 -2
- package/dist/types/types.d.ts +19 -2
- package/dist/web/index.web26.js +1 -1
- package/dist/web/index.web5.js +172 -173
- package/dist/web/index.web55.js +2 -2
- package/dist/web/index.web57.js +1 -1
- package/dist/web/index.web75.js +6 -6
- package/dist/web/index.web82.js +102 -18
- package/dist/web/index.web83.js +20 -80
- package/dist/web/index.web84.js +79 -103
- package/dist/web/index.web87.js +77 -19
- package/dist/web/index.web88.js +21 -10
- package/dist/web/index.web89.js +9 -19
- package/dist/web/index.web90.js +15 -89
- package/dist/web/index.web91.js +92 -19
- package/dist/web/index.web92.js +18 -115
- package/dist/web/index.web93.js +117 -9
- package/dist/web/index.web94.js +10 -79
- package/dist/web-types/types.d.ts +19 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -56,13 +56,15 @@ You can configure the SDK to create different types of accounts for new users:
|
|
|
56
56
|
```ts lines
|
|
57
57
|
const config: Config = {
|
|
58
58
|
projectId: "your-project-id",
|
|
59
|
-
|
|
59
|
+
ethereum: {
|
|
60
|
+
createOnLogin: "smart", // Creates Smart Accounts instead of EOAs
|
|
61
|
+
},
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
await initialize(config);
|
|
63
65
|
```
|
|
64
66
|
|
|
65
|
-
When `
|
|
67
|
+
When `ethereum.createOnLogin` is set to `"smart"`, the SDK will:
|
|
66
68
|
1. Create an EOA (Externally Owned Account) first
|
|
67
69
|
2. Use that EOA as the owner to create a Smart Account
|
|
68
70
|
3. Both accounts will be available on the user object
|
|
@@ -71,13 +73,15 @@ When `createAccountOnLogin` is set to `"evm-smart"`, the SDK will:
|
|
|
71
73
|
```ts lines
|
|
72
74
|
const config: Config = {
|
|
73
75
|
projectId: "your-project-id",
|
|
74
|
-
|
|
76
|
+
solana: {
|
|
77
|
+
createOnLogin: true, // Creates Solana accounts
|
|
78
|
+
},
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
await initialize(config);
|
|
78
82
|
```
|
|
79
83
|
|
|
80
|
-
When `
|
|
84
|
+
When `solana.createOnLogin` is set to `true`, the SDK will:
|
|
81
85
|
1. Create a Solana account for new users
|
|
82
86
|
2. The Solana account will be available on the `solanaAccounts` property
|
|
83
87
|
|
|
@@ -213,7 +217,7 @@ Smart Accounts provide advanced account abstraction features, including user ope
|
|
|
213
217
|
|
|
214
218
|
### Sign a Solana Transaction
|
|
215
219
|
|
|
216
|
-
When your application is configured with `
|
|
220
|
+
When your application is configured with `solana: { createOnLogin: true }`, you can sign Solana transactions:
|
|
217
221
|
|
|
218
222
|
```typescript lines
|
|
219
223
|
import { signSolanaTransaction, getCurrentUser } from "@coinbase/cdp-core";
|
|
@@ -1,171 +1,171 @@
|
|
|
1
|
-
import { configureCdpApiClient as
|
|
2
|
-
import { AuthManager as
|
|
3
|
-
import { toAuthState as
|
|
4
|
-
import { withAuth as
|
|
5
|
-
import { MockAuthManager as
|
|
6
|
-
import { mockUser as
|
|
7
|
-
import { getPlatformServices as
|
|
8
|
-
import { isChainSupportedForCDPSends as
|
|
9
|
-
import { getConfig as n, setCoreAuthManager as
|
|
1
|
+
import { configureCdpApiClient as A, setAuthManager as v, initiateAuthentication as S, createEndUserEvmAccount as k, createEndUserEvmSmartAccount as m, createEndUserSolanaAccount as E, verifyEmailAuthentication as U, verifySmsAuthentication as T, signEvmHashWithEndUserAccount as M, signEvmTransactionWithEndUserAccount as j, signSolanaTransactionWithEndUserAccount as O, sendEvmTransactionWithEndUserAccount as P, sendSolanaTransactionWithEndUserAccount as C, signEvmMessageWithEndUserAccount as x, signEvmTypedDataWithEndUserAccount as W, sendUserOperationWithEndUserAccount as H, getUserOperationWithEndUserAccount as b, exportEndUserEvmAccount as K } from "@coinbase/cdp-api-client";
|
|
2
|
+
import { AuthManager as D } from "./index.native7.js";
|
|
3
|
+
import { toAuthState as d } from "./index.native14.js";
|
|
4
|
+
import { withAuth as i } from "./index.native15.js";
|
|
5
|
+
import { MockAuthManager as _ } from "./index.native16.js";
|
|
6
|
+
import { mockUser as l } from "./index.native17.js";
|
|
7
|
+
import { getPlatformServices as w, getPlatformCrypto as N } from "./index.native5.js";
|
|
8
|
+
import { isChainSupportedForCDPSends as z } from "./index.native18.js";
|
|
9
|
+
import { getConfig as n, setCoreAuthManager as h, getCoreAuthManager as c, setConfig as F } from "./index.native19.js";
|
|
10
10
|
import "viem";
|
|
11
|
-
import { serializeTransaction as
|
|
12
|
-
const
|
|
11
|
+
import { serializeTransaction as f } from "./index.native20.js";
|
|
12
|
+
const ee = async (e) => {
|
|
13
13
|
if (!e.projectId)
|
|
14
14
|
throw new Error("Project ID is required");
|
|
15
|
-
let
|
|
15
|
+
let t;
|
|
16
16
|
try {
|
|
17
|
-
|
|
17
|
+
t = n().projectId !== e.projectId;
|
|
18
18
|
} catch {
|
|
19
|
-
|
|
19
|
+
t = !0;
|
|
20
20
|
}
|
|
21
|
-
if (
|
|
22
|
-
|
|
21
|
+
if (F(e), n().useMock) {
|
|
22
|
+
h(new _(n().projectId));
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
|
-
let
|
|
25
|
+
let r;
|
|
26
26
|
try {
|
|
27
|
-
const s =
|
|
28
|
-
|
|
27
|
+
const s = w();
|
|
28
|
+
r = s.secureStorage ? {
|
|
29
29
|
getRefreshToken: () => s.secureStorage.getItem("cdp_refresh_token"),
|
|
30
|
-
setRefreshToken: (
|
|
30
|
+
setRefreshToken: (a) => s.secureStorage.setItem("cdp_refresh_token", a),
|
|
31
31
|
removeRefreshToken: () => s.secureStorage.removeItem("cdp_refresh_token")
|
|
32
32
|
} : void 0;
|
|
33
33
|
} catch {
|
|
34
|
-
|
|
34
|
+
r = void 0;
|
|
35
35
|
}
|
|
36
|
-
if (
|
|
36
|
+
if (A({
|
|
37
37
|
debugging: n().debugging,
|
|
38
38
|
basePath: n().basePath,
|
|
39
|
-
refreshTokenStorage:
|
|
40
|
-
}),
|
|
41
|
-
const s = new
|
|
42
|
-
|
|
39
|
+
refreshTokenStorage: r
|
|
40
|
+
}), t) {
|
|
41
|
+
const s = new D(n().projectId);
|
|
42
|
+
h(s), v(s);
|
|
43
43
|
}
|
|
44
|
-
await
|
|
45
|
-
},
|
|
44
|
+
await c().ensureInitialized();
|
|
45
|
+
}, te = async (e) => y({
|
|
46
46
|
email: e.email,
|
|
47
47
|
type: "email"
|
|
48
|
-
}), re = async (e) =>
|
|
48
|
+
}), re = async (e) => y({
|
|
49
49
|
phoneNumber: e.phoneNumber,
|
|
50
50
|
type: "sms"
|
|
51
|
-
}),
|
|
51
|
+
}), ne = async (e) => I(
|
|
52
52
|
e,
|
|
53
53
|
"Mock email OTP verified",
|
|
54
|
-
(
|
|
55
|
-
),
|
|
54
|
+
(t, r) => U(t, r)
|
|
55
|
+
), se = async (e) => I(
|
|
56
56
|
e,
|
|
57
57
|
"Mock SMS OTP verified",
|
|
58
|
-
(
|
|
59
|
-
),
|
|
58
|
+
(t, r) => T(t, r)
|
|
59
|
+
), ae = async () => c().getUser(), ce = async () => c().isSignedIn(), oe = async () => {
|
|
60
60
|
if (n().useMock) {
|
|
61
|
-
await
|
|
61
|
+
await c().signOut();
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
if (!await
|
|
64
|
+
if (!await c().isSignedIn())
|
|
65
65
|
throw new Error("User not signed in");
|
|
66
|
-
await
|
|
66
|
+
await c().signOut();
|
|
67
67
|
try {
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
68
|
+
const t = w();
|
|
69
|
+
if (t.secureStorage)
|
|
70
70
|
try {
|
|
71
|
-
await
|
|
72
|
-
} catch (
|
|
73
|
-
console.warn("Failed to clear stored refresh token:",
|
|
71
|
+
await t.secureStorage.removeItem("cdp_refresh_token");
|
|
72
|
+
} catch (r) {
|
|
73
|
+
console.warn("Failed to clear stored refresh token:", r);
|
|
74
74
|
}
|
|
75
75
|
} catch {
|
|
76
76
|
}
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
signature: (await
|
|
77
|
+
}, ie = async () => c().getToken(), ue = (e) => {
|
|
78
|
+
c().addAuthStateChangeCallback(e);
|
|
79
|
+
}, de = async (e) => n().useMock ? { signature: "0x0" } : i(e, c(), async ({ user: t, walletSecretId: r }) => ({
|
|
80
|
+
signature: (await M(n().projectId, t.userId, {
|
|
81
81
|
hash: e.hash,
|
|
82
82
|
address: e.evmAccount,
|
|
83
|
-
walletSecretId:
|
|
83
|
+
walletSecretId: r
|
|
84
84
|
})).signature
|
|
85
|
-
})),
|
|
86
|
-
const s =
|
|
85
|
+
})), ge = async (e) => n().useMock ? { signedTransaction: "0x0" } : i(e, c(), async ({ user: t, walletSecretId: r }) => {
|
|
86
|
+
const s = f(e.transaction);
|
|
87
87
|
return {
|
|
88
|
-
signedTransaction: (await
|
|
88
|
+
signedTransaction: (await j(
|
|
89
89
|
n().projectId,
|
|
90
|
-
|
|
90
|
+
t.userId,
|
|
91
91
|
{
|
|
92
92
|
transaction: s,
|
|
93
93
|
address: e.evmAccount,
|
|
94
|
-
walletSecretId:
|
|
94
|
+
walletSecretId: r
|
|
95
95
|
}
|
|
96
96
|
)).signedTransaction
|
|
97
97
|
};
|
|
98
|
-
}),
|
|
99
|
-
signedTransaction: (await
|
|
98
|
+
}), me = async (e) => n().useMock ? { signedTransaction: "mock-signed-transaction" } : i(e, c(), async ({ user: t, walletSecretId: r }) => ({
|
|
99
|
+
signedTransaction: (await O(
|
|
100
100
|
n().projectId,
|
|
101
|
-
|
|
101
|
+
t.userId,
|
|
102
102
|
{
|
|
103
103
|
transaction: e.transaction,
|
|
104
104
|
address: e.solanaAccount,
|
|
105
|
-
walletSecretId:
|
|
105
|
+
walletSecretId: r
|
|
106
106
|
}
|
|
107
107
|
)).signedTransaction
|
|
108
|
-
})),
|
|
109
|
-
if (!
|
|
108
|
+
})), le = async (e) => {
|
|
109
|
+
if (!z(e.network))
|
|
110
110
|
throw new Error(`Chain ${e.network} is not supported by the CDP Apis`);
|
|
111
111
|
if (n().useMock)
|
|
112
112
|
return { transactionHash: "0x0" };
|
|
113
|
-
const
|
|
114
|
-
return
|
|
115
|
-
transactionHash: (await
|
|
113
|
+
const t = f(e.transaction);
|
|
114
|
+
return i(e, c(), async ({ user: r, walletSecretId: s }) => ({
|
|
115
|
+
transactionHash: (await P(
|
|
116
116
|
n().projectId,
|
|
117
|
-
|
|
117
|
+
r.userId,
|
|
118
118
|
{
|
|
119
|
-
transaction:
|
|
119
|
+
transaction: t,
|
|
120
120
|
address: e.evmAccount,
|
|
121
121
|
walletSecretId: s,
|
|
122
122
|
network: e.network
|
|
123
123
|
}
|
|
124
124
|
)).transactionHash
|
|
125
125
|
}));
|
|
126
|
-
},
|
|
127
|
-
transactionSignature: (await
|
|
126
|
+
}, he = async (e) => n().useMock ? { transactionSignature: "mock-signature" } : i(e, c(), async ({ user: t, walletSecretId: r }) => ({
|
|
127
|
+
transactionSignature: (await C(
|
|
128
128
|
n().projectId,
|
|
129
|
-
|
|
129
|
+
t.userId,
|
|
130
130
|
{
|
|
131
131
|
transaction: e.transaction,
|
|
132
132
|
address: e.solanaAccount,
|
|
133
|
-
walletSecretId:
|
|
133
|
+
walletSecretId: r,
|
|
134
134
|
network: e.network
|
|
135
135
|
}
|
|
136
136
|
)).transactionSignature
|
|
137
|
-
})),
|
|
138
|
-
signature: (await
|
|
137
|
+
})), pe = async (e) => n().useMock ? { signature: "0x0" } : i(e, c(), async ({ user: t, walletSecretId: r }) => ({
|
|
138
|
+
signature: (await x(n().projectId, t.userId, {
|
|
139
139
|
message: e.message,
|
|
140
140
|
address: e.evmAccount,
|
|
141
|
-
walletSecretId:
|
|
141
|
+
walletSecretId: r
|
|
142
142
|
})).signature
|
|
143
|
-
})),
|
|
144
|
-
signature: (await
|
|
143
|
+
})), we = async (e) => n().useMock ? { signature: "0x0" } : i(e, c(), async ({ user: t, walletSecretId: r }) => ({
|
|
144
|
+
signature: (await W(n().projectId, t.userId, {
|
|
145
145
|
typedData: e.typedData,
|
|
146
146
|
address: e.evmAccount,
|
|
147
|
-
walletSecretId:
|
|
147
|
+
walletSecretId: r
|
|
148
148
|
})).signature
|
|
149
|
-
})),
|
|
149
|
+
})), fe = async (e) => n().useMock ? {
|
|
150
150
|
userOperationHash: "0x1234567890123456789012345678901234567890123456789012345678901234"
|
|
151
|
-
} :
|
|
152
|
-
userOperationHash: (await
|
|
151
|
+
} : i(e, c(), async ({ user: t, walletSecretId: r }) => ({
|
|
152
|
+
userOperationHash: (await H(
|
|
153
153
|
n().projectId,
|
|
154
|
-
|
|
154
|
+
t.userId,
|
|
155
155
|
e.evmSmartAccount,
|
|
156
156
|
{
|
|
157
157
|
network: e.network,
|
|
158
|
-
calls: e.calls.map((
|
|
159
|
-
to:
|
|
160
|
-
value: String(
|
|
161
|
-
data:
|
|
158
|
+
calls: e.calls.map((a) => ({
|
|
159
|
+
to: a.to,
|
|
160
|
+
value: String(a.value ?? 0n),
|
|
161
|
+
data: a.data ?? "0x"
|
|
162
162
|
})),
|
|
163
|
-
walletSecretId:
|
|
163
|
+
walletSecretId: r,
|
|
164
164
|
useCdpPaymaster: e.useCdpPaymaster ?? !1,
|
|
165
165
|
paymasterUrl: e.paymasterUrl
|
|
166
166
|
}
|
|
167
167
|
)).userOpHash
|
|
168
|
-
})),
|
|
168
|
+
})), ye = async (e) => n().useMock ? {
|
|
169
169
|
userOpHash: e.userOperationHash,
|
|
170
170
|
network: e.network,
|
|
171
171
|
calls: [
|
|
@@ -178,155 +178,154 @@ const R = async (e) => {
|
|
|
178
178
|
status: "complete",
|
|
179
179
|
transactionHash: "0x9876543210987654321098765432109876543210987654321098765432109876",
|
|
180
180
|
receipts: []
|
|
181
|
-
} :
|
|
181
|
+
} : i(e, c(), async ({ user: t }) => await b(
|
|
182
182
|
n().projectId,
|
|
183
|
-
|
|
183
|
+
t.userId,
|
|
184
184
|
e.evmSmartAccount,
|
|
185
185
|
e.userOperationHash
|
|
186
|
-
)),
|
|
186
|
+
)), Ie = async (e) => {
|
|
187
187
|
if (n().useMock)
|
|
188
188
|
return {
|
|
189
189
|
privateKey: "mock-private-key"
|
|
190
190
|
};
|
|
191
|
-
const
|
|
192
|
-
return
|
|
193
|
-
const
|
|
191
|
+
const t = N(), r = await t.createExportKeyPair();
|
|
192
|
+
return i(e, c(), async ({ user: s, walletSecretId: a }) => {
|
|
193
|
+
const o = await K(n().projectId, s.userId, {
|
|
194
194
|
address: e.evmAccount,
|
|
195
|
-
walletSecretId:
|
|
196
|
-
exportEncryptionKey:
|
|
195
|
+
walletSecretId: a,
|
|
196
|
+
exportEncryptionKey: r.publicKeyBase64
|
|
197
197
|
});
|
|
198
198
|
return {
|
|
199
|
-
privateKey: await
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
privateKey: await t.decryptWithPrivateKey(
|
|
200
|
+
r.privateKey,
|
|
201
|
+
o.encryptedPrivateKey
|
|
202
202
|
)
|
|
203
203
|
};
|
|
204
204
|
});
|
|
205
|
-
},
|
|
205
|
+
}, y = async (e) => {
|
|
206
206
|
if (n().useMock)
|
|
207
207
|
return {
|
|
208
208
|
message: "Mock sign in initiated",
|
|
209
209
|
flowId: "mock-flow-id"
|
|
210
210
|
};
|
|
211
|
-
if (await
|
|
211
|
+
if (await c().isSignedIn())
|
|
212
212
|
throw new Error("User is already authenticated. Please sign out first.");
|
|
213
|
-
const
|
|
213
|
+
const r = await S(n().projectId, e);
|
|
214
214
|
return {
|
|
215
|
-
flowId:
|
|
216
|
-
message:
|
|
215
|
+
flowId: r.flowId,
|
|
216
|
+
message: r.message
|
|
217
217
|
};
|
|
218
|
-
},
|
|
218
|
+
}, I = async (e, t, r) => {
|
|
219
219
|
if (n().useMock)
|
|
220
|
-
return await
|
|
220
|
+
return await c().setAuthState({
|
|
221
221
|
accessToken: "mock-access-token",
|
|
222
222
|
expiresAt: Date.now() + 1e3 * 60 * 60 * 24,
|
|
223
|
-
user:
|
|
223
|
+
user: l
|
|
224
224
|
}), {
|
|
225
|
-
message:
|
|
226
|
-
user:
|
|
225
|
+
message: t,
|
|
226
|
+
user: l,
|
|
227
227
|
isNewUser: !1
|
|
228
228
|
};
|
|
229
|
-
if (await
|
|
229
|
+
if (await c().isSignedIn())
|
|
230
230
|
throw new Error("User is already authenticated. Please sign out first.");
|
|
231
|
-
const
|
|
231
|
+
const a = await r(n().projectId, {
|
|
232
232
|
flowId: e.flowId,
|
|
233
233
|
otp: e.otp
|
|
234
|
-
})
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
234
|
+
});
|
|
235
|
+
let o = d(
|
|
236
|
+
a.accessToken,
|
|
237
|
+
a.validUntil,
|
|
238
|
+
a.endUser
|
|
238
239
|
);
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
240
|
+
await c().setAuthState(o);
|
|
241
|
+
const u = n();
|
|
242
|
+
u.ethereum?.createOnLogin && (o = await p(
|
|
243
|
+
a,
|
|
244
|
+
o,
|
|
245
|
+
u.ethereum.createOnLogin
|
|
246
|
+
)), u.solana?.createOnLogin && (o = await L(a, o)), !u.ethereum?.createOnLogin && !u.solana?.createOnLogin && (o = await p(a, o, "eoa"));
|
|
247
|
+
const g = await c().getUser();
|
|
248
|
+
return {
|
|
249
|
+
message: a.message,
|
|
250
|
+
user: g,
|
|
251
|
+
isNewUser: a.isNewEndUser
|
|
252
|
+
};
|
|
253
|
+
}, p = async (e, t, r) => {
|
|
254
|
+
let s = t;
|
|
255
|
+
if (!t.user.evmAccounts || t.user.evmAccounts.length === 0)
|
|
245
256
|
try {
|
|
246
|
-
const
|
|
247
|
-
let
|
|
248
|
-
walletSecretId:
|
|
257
|
+
const a = await c().getWalletSecretId();
|
|
258
|
+
let o = await k(n().projectId, t.user.userId, {
|
|
259
|
+
walletSecretId: a
|
|
249
260
|
});
|
|
250
|
-
if (
|
|
251
|
-
const [
|
|
252
|
-
|
|
261
|
+
if (r === "smart") {
|
|
262
|
+
const [u] = o.evmAccounts;
|
|
263
|
+
o = await m(
|
|
253
264
|
n().projectId,
|
|
254
|
-
|
|
265
|
+
t.user.userId,
|
|
255
266
|
{
|
|
256
|
-
owner:
|
|
267
|
+
owner: u,
|
|
257
268
|
enableSpendPermissions: !1
|
|
258
269
|
// Defaulting to false until the feature is ready.
|
|
259
270
|
}
|
|
260
271
|
);
|
|
261
272
|
}
|
|
262
|
-
|
|
263
|
-
} catch (
|
|
264
|
-
throw new Error(`Failed to create EVM account: ${
|
|
273
|
+
s = d(e.accessToken, e.validUntil, o), await c().setAuthState(s);
|
|
274
|
+
} catch (a) {
|
|
275
|
+
throw new Error(`Failed to create EVM account: ${a}`);
|
|
265
276
|
}
|
|
266
|
-
if (
|
|
277
|
+
if (r === "smart" && (!s.user.evmSmartAccounts || s.user.evmSmartAccounts.length === 0))
|
|
267
278
|
try {
|
|
268
|
-
const [
|
|
279
|
+
const [a] = s.user.evmAccounts, o = await m(
|
|
269
280
|
n().projectId,
|
|
270
|
-
|
|
281
|
+
s.user.userId,
|
|
271
282
|
{
|
|
272
|
-
owner:
|
|
283
|
+
owner: a,
|
|
273
284
|
enableSpendPermissions: !1
|
|
274
285
|
// Defaulting to false until the feature is ready.
|
|
275
286
|
}
|
|
276
287
|
);
|
|
277
|
-
|
|
278
|
-
} catch (
|
|
279
|
-
throw new Error(`Failed to create EVM Smart Account: ${
|
|
288
|
+
s = d(e.accessToken, e.validUntil, o), await c().setAuthState(s);
|
|
289
|
+
} catch (a) {
|
|
290
|
+
throw new Error(`Failed to create EVM Smart Account: ${a}`);
|
|
280
291
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
isNewUser: e.isNewEndUser
|
|
286
|
-
};
|
|
287
|
-
}, F = async ({
|
|
288
|
-
authResponse: e,
|
|
289
|
-
authState: r
|
|
290
|
-
}) => {
|
|
291
|
-
if (!r.user.solanaAccounts || r.user.solanaAccounts.length === 0)
|
|
292
|
+
return s;
|
|
293
|
+
}, L = async (e, t) => {
|
|
294
|
+
let r = t;
|
|
295
|
+
if (!t.user.solanaAccounts || t.user.solanaAccounts.length === 0)
|
|
292
296
|
try {
|
|
293
|
-
const s = await
|
|
297
|
+
const s = await c().getWalletSecretId(), a = await E(
|
|
294
298
|
n().projectId,
|
|
295
|
-
|
|
299
|
+
t.user.userId,
|
|
296
300
|
{
|
|
297
301
|
walletSecretId: s
|
|
298
302
|
}
|
|
299
303
|
);
|
|
300
|
-
r =
|
|
304
|
+
r = d(e.accessToken, e.validUntil, a), await c().setAuthState(r);
|
|
301
305
|
} catch (s) {
|
|
302
306
|
throw new Error(`Failed to create Solana account: ${s}`);
|
|
303
307
|
}
|
|
304
|
-
|
|
305
|
-
return {
|
|
306
|
-
message: e.message,
|
|
307
|
-
user: t,
|
|
308
|
-
isNewUser: e.isNewEndUser
|
|
309
|
-
};
|
|
308
|
+
return r;
|
|
310
309
|
};
|
|
311
310
|
export {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
311
|
+
Ie as exportEvmAccount,
|
|
312
|
+
ie as getAccessToken,
|
|
313
|
+
ae as getCurrentUser,
|
|
314
|
+
ye as getUserOperation,
|
|
315
|
+
ee as initialize,
|
|
316
|
+
ce as isSignedIn,
|
|
317
|
+
ue as onAuthStateChange,
|
|
318
|
+
le as sendEvmTransaction,
|
|
319
|
+
he as sendSolanaTransaction,
|
|
320
|
+
fe as sendUserOperation,
|
|
321
|
+
de as signEvmHash,
|
|
322
|
+
pe as signEvmMessage,
|
|
323
|
+
ge as signEvmTransaction,
|
|
324
|
+
we as signEvmTypedData,
|
|
325
|
+
te as signInWithEmail,
|
|
327
326
|
re as signInWithSms,
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
327
|
+
oe as signOut,
|
|
328
|
+
me as signSolanaTransaction,
|
|
329
|
+
ne as verifyEmailOTP,
|
|
330
|
+
se as verifySmsOTP
|
|
332
331
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { encode as d } from "./index.
|
|
2
|
-
import y from "./index.
|
|
3
|
-
import b from "./index.
|
|
1
|
+
import { encode as d } from "./index.native90.js";
|
|
2
|
+
import y from "./index.native91.js";
|
|
3
|
+
import b from "./index.native92.js";
|
|
4
4
|
import { JWSInvalid as r } from "./index.native30.js";
|
|
5
5
|
import { encoder as s, concat as u, decoder as h } from "./index.native78.js";
|
|
6
|
-
import g from "./index.
|
|
7
|
-
import H from "./index.
|
|
8
|
-
import P from "./index.
|
|
6
|
+
import g from "./index.native93.js";
|
|
7
|
+
import H from "./index.native94.js";
|
|
8
|
+
import P from "./index.native95.js";
|
|
9
9
|
class x {
|
|
10
10
|
#r;
|
|
11
11
|
#e;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HashMD as D, SHA256_IV as b, Chi as g, Maj as p } from "./index.
|
|
1
|
+
import { HashMD as D, SHA256_IV as b, Chi as g, Maj as p } from "./index.native89.js";
|
|
2
2
|
import { createHasher as u, clean as C, rotr as i } from "./index.native85.js";
|
|
3
3
|
const B = /* @__PURE__ */ Uint32Array.from([
|
|
4
4
|
1116352408,
|