@coinbase/cdp-core 0.0.43 → 0.0.44
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.native34.js +1 -1
- package/dist/esm/index.native6.js +119 -122
- package/dist/esm/index.native94.js +1 -1
- package/dist/esm/index.native97.js +10 -79
- package/dist/esm/index.native98.js +79 -10
- package/dist/esm/index.web100.js +92 -19
- package/dist/esm/index.web101.js +18 -115
- package/dist/esm/index.web102.js +117 -9
- package/dist/esm/index.web103.js +10 -79
- package/dist/esm/index.web33.js +1 -1
- package/dist/esm/index.web5.js +119 -122
- package/dist/esm/index.web84.js +6 -6
- package/dist/esm/index.web93.js +1 -1
- package/dist/esm/index.web96.js +77 -19
- package/dist/esm/index.web97.js +21 -10
- package/dist/esm/index.web98.js +9 -19
- package/dist/esm/index.web99.js +15 -89
- package/dist/native/index.native34.js +1 -1
- package/dist/native/index.native6.js +119 -122
- package/dist/native/index.native94.js +1 -1
- package/dist/native/index.native97.js +10 -79
- package/dist/native/index.native98.js +79 -10
- package/dist/web/index.web100.js +92 -19
- package/dist/web/index.web101.js +18 -115
- package/dist/web/index.web102.js +117 -9
- package/dist/web/index.web103.js +10 -79
- package/dist/web/index.web33.js +1 -1
- package/dist/web/index.web5.js +119 -122
- package/dist/web/index.web84.js +6 -6
- package/dist/web/index.web93.js +1 -1
- package/dist/web/index.web96.js +77 -19
- package/dist/web/index.web97.js +21 -10
- package/dist/web/index.web98.js +9 -19
- package/dist/web/index.web99.js +15 -89
- package/package.json +2 -2
package/dist/web/index.web5.js
CHANGED
|
@@ -1,106 +1,103 @@
|
|
|
1
1
|
import { b as m } from "./index.web13.js";
|
|
2
|
-
import { configureCdpApiClient as
|
|
3
|
-
import { Keypair as
|
|
4
|
-
import
|
|
5
|
-
import { AuthManager as
|
|
2
|
+
import { configureCdpApiClient as E, setAuthManager as U, initiateAuthentication as T, createEndUserEvmAccount as M, createEndUserEvmSmartAccount as f, createEndUserSolanaAccount as P, verifyEmailAuthentication as j, verifySmsAuthentication as K, signEvmHashWithEndUserAccount as O, signEvmTransactionWithEndUserAccount as x, signSolanaTransactionWithEndUserAccount as b, sendEvmTransactionWithEndUserAccount as C, sendSolanaTransactionWithEndUserAccount as W, signEvmMessageWithEndUserAccount as H, signSolanaMessageWithEndUserAccount as _, signEvmTypedDataWithEndUserAccount as B, sendUserOperationWithEndUserAccount as D, getUserOperationWithEndUserAccount as N, exportEndUserEvmAccount as L, exportEndUserSolanaAccount as z } from "@coinbase/cdp-api-client";
|
|
3
|
+
import { Keypair as y } from "@solana/web3.js";
|
|
4
|
+
import l from "bs58";
|
|
5
|
+
import { AuthManager as F } from "./index.web7.js";
|
|
6
6
|
import { toAuthState as g } from "./index.web14.js";
|
|
7
7
|
import { withAuth as u } from "./index.web15.js";
|
|
8
|
-
import { MockAuthManager as
|
|
8
|
+
import { MockAuthManager as $ } from "./index.web16.js";
|
|
9
9
|
import { mockUser as h } from "./index.web17.js";
|
|
10
|
-
import { getPlatformServices as
|
|
11
|
-
import { isChainSupportedForCDPSends as
|
|
12
|
-
import { getConfig as
|
|
10
|
+
import { getPlatformServices as R, getPlatformCrypto as k } from "./index.web2.js";
|
|
11
|
+
import { isChainSupportedForCDPSends as V } from "./index.web18.js";
|
|
12
|
+
import { getConfig as s, setCoreAuthManager as w, getCoreAuthManager as c, setConfig as q } from "./index.web19.js";
|
|
13
13
|
import "viem";
|
|
14
|
-
import { serializeTransaction as
|
|
14
|
+
import { serializeTransaction as A } from "./index.web20.js";
|
|
15
15
|
const de = async (e) => {
|
|
16
16
|
if (!e.projectId)
|
|
17
17
|
throw new Error("Project ID is required");
|
|
18
18
|
let t;
|
|
19
19
|
try {
|
|
20
|
-
t =
|
|
20
|
+
t = s().projectId !== e.projectId;
|
|
21
21
|
} catch {
|
|
22
22
|
t = !0;
|
|
23
23
|
}
|
|
24
|
-
if (
|
|
25
|
-
w(new
|
|
24
|
+
if (q(e), s().useMock) {
|
|
25
|
+
w(new $(s().projectId));
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
let r;
|
|
29
29
|
try {
|
|
30
|
-
const
|
|
31
|
-
r =
|
|
32
|
-
getRefreshToken: () =>
|
|
33
|
-
setRefreshToken: (a) =>
|
|
34
|
-
removeRefreshToken: () =>
|
|
35
|
-
} :
|
|
30
|
+
const n = R();
|
|
31
|
+
r = n.secureStorage ? {
|
|
32
|
+
getRefreshToken: () => n.secureStorage.getItem("cdp_refresh_token"),
|
|
33
|
+
setRefreshToken: (a) => n.secureStorage.setItem("cdp_refresh_token", a),
|
|
34
|
+
removeRefreshToken: () => n.secureStorage.removeItem("cdp_refresh_token")
|
|
35
|
+
} : (
|
|
36
|
+
// This is used only in WebKit browsers by virtue of the API
|
|
37
|
+
{
|
|
38
|
+
getRefreshToken: () => n.storage.getItem("cdp_refresh_token"),
|
|
39
|
+
setRefreshToken: (a) => n.storage.setItem("cdp_refresh_token", a),
|
|
40
|
+
removeRefreshToken: () => n.storage.removeItem("cdp_refresh_token")
|
|
41
|
+
}
|
|
42
|
+
);
|
|
36
43
|
} catch {
|
|
37
44
|
r = void 0;
|
|
38
45
|
}
|
|
39
|
-
if (
|
|
40
|
-
debugging:
|
|
41
|
-
basePath:
|
|
46
|
+
if (E({
|
|
47
|
+
debugging: s().debugging,
|
|
48
|
+
basePath: s().basePath,
|
|
42
49
|
refreshTokenStorage: r
|
|
43
50
|
}), t) {
|
|
44
|
-
const
|
|
45
|
-
w(
|
|
51
|
+
const n = new F(s().projectId);
|
|
52
|
+
w(n), U(n);
|
|
46
53
|
}
|
|
47
54
|
await c().ensureInitialized();
|
|
48
|
-
}, me = async (e) =>
|
|
55
|
+
}, me = async (e) => S({
|
|
49
56
|
email: e.email,
|
|
50
57
|
type: "email"
|
|
51
|
-
}), ge = async (e) =>
|
|
58
|
+
}), ge = async (e) => S({
|
|
52
59
|
phoneNumber: e.phoneNumber,
|
|
53
60
|
type: "sms"
|
|
54
|
-
}), pe = async (e) =>
|
|
61
|
+
}), pe = async (e) => v(
|
|
55
62
|
e,
|
|
56
63
|
"Mock email OTP verified",
|
|
57
|
-
(t, r) =>
|
|
58
|
-
),
|
|
64
|
+
(t, r) => j(t, r)
|
|
65
|
+
), fe = async (e) => v(
|
|
59
66
|
e,
|
|
60
67
|
"Mock SMS OTP verified",
|
|
61
|
-
(t, r) =>
|
|
62
|
-
),
|
|
63
|
-
if (
|
|
68
|
+
(t, r) => K(t, r)
|
|
69
|
+
), ye = async () => c().getUser(), le = async () => c().isSignedIn(), he = async () => {
|
|
70
|
+
if (s().useMock) {
|
|
64
71
|
await c().signOut();
|
|
65
72
|
return;
|
|
66
73
|
}
|
|
67
74
|
if (!await c().isSignedIn())
|
|
68
75
|
throw new Error("User not signed in");
|
|
69
76
|
await c().signOut();
|
|
70
|
-
try {
|
|
71
|
-
const t = S();
|
|
72
|
-
if (t.secureStorage)
|
|
73
|
-
try {
|
|
74
|
-
await t.secureStorage.removeItem("cdp_refresh_token");
|
|
75
|
-
} catch (r) {
|
|
76
|
-
console.warn("Failed to clear stored refresh token:", r);
|
|
77
|
-
}
|
|
78
|
-
} catch {
|
|
79
|
-
}
|
|
80
77
|
}, we = async () => c().getToken(), Ie = (e) => {
|
|
81
78
|
c().addAuthStateChangeCallback(e);
|
|
82
|
-
},
|
|
83
|
-
signature: (await
|
|
79
|
+
}, ke = async (e) => s().useMock ? { signature: "0x0" } : u(e, c(), async ({ user: t, walletSecretId: r }) => ({
|
|
80
|
+
signature: (await O(s().projectId, t.userId, {
|
|
84
81
|
hash: e.hash,
|
|
85
82
|
address: e.evmAccount,
|
|
86
83
|
walletSecretId: r
|
|
87
84
|
})).signature
|
|
88
|
-
})), Ae = async (e) =>
|
|
89
|
-
const
|
|
85
|
+
})), Ae = async (e) => s().useMock ? { signedTransaction: "0x0" } : u(e, c(), async ({ user: t, walletSecretId: r }) => {
|
|
86
|
+
const n = A(e.transaction);
|
|
90
87
|
return {
|
|
91
|
-
signedTransaction: (await
|
|
92
|
-
|
|
88
|
+
signedTransaction: (await x(
|
|
89
|
+
s().projectId,
|
|
93
90
|
t.userId,
|
|
94
91
|
{
|
|
95
|
-
transaction:
|
|
92
|
+
transaction: n,
|
|
96
93
|
address: e.evmAccount,
|
|
97
94
|
walletSecretId: r
|
|
98
95
|
}
|
|
99
96
|
)).signedTransaction
|
|
100
97
|
};
|
|
101
|
-
}),
|
|
102
|
-
signedTransaction: (await
|
|
103
|
-
|
|
98
|
+
}), Se = async (e) => s().useMock ? { signedTransaction: "mock-signed-transaction" } : u(e, c(), async ({ user: t, walletSecretId: r }) => ({
|
|
99
|
+
signedTransaction: (await b(
|
|
100
|
+
s().projectId,
|
|
104
101
|
t.userId,
|
|
105
102
|
{
|
|
106
103
|
transaction: e.transaction,
|
|
@@ -108,27 +105,27 @@ const de = async (e) => {
|
|
|
108
105
|
walletSecretId: r
|
|
109
106
|
}
|
|
110
107
|
)).signedTransaction
|
|
111
|
-
})),
|
|
112
|
-
if (!
|
|
108
|
+
})), ve = async (e) => {
|
|
109
|
+
if (!V(e.network))
|
|
113
110
|
throw new Error(`Chain ${e.network} is not supported by the CDP Apis`);
|
|
114
|
-
if (
|
|
111
|
+
if (s().useMock)
|
|
115
112
|
return { transactionHash: "0x0" };
|
|
116
|
-
const t =
|
|
117
|
-
return u(e, c(), async ({ user: r, walletSecretId:
|
|
118
|
-
transactionHash: (await
|
|
119
|
-
|
|
113
|
+
const t = A(e.transaction);
|
|
114
|
+
return u(e, c(), async ({ user: r, walletSecretId: n }) => ({
|
|
115
|
+
transactionHash: (await C(
|
|
116
|
+
s().projectId,
|
|
120
117
|
r.userId,
|
|
121
118
|
{
|
|
122
119
|
transaction: t,
|
|
123
120
|
address: e.evmAccount,
|
|
124
|
-
walletSecretId:
|
|
121
|
+
walletSecretId: n,
|
|
125
122
|
network: e.network
|
|
126
123
|
}
|
|
127
124
|
)).transactionHash
|
|
128
125
|
}));
|
|
129
|
-
}, Ee = async (e) =>
|
|
130
|
-
transactionSignature: (await
|
|
131
|
-
|
|
126
|
+
}, Ee = async (e) => s().useMock ? { transactionSignature: "mock-signature" } : u(e, c(), async ({ user: t, walletSecretId: r }) => ({
|
|
127
|
+
transactionSignature: (await W(
|
|
128
|
+
s().projectId,
|
|
132
129
|
t.userId,
|
|
133
130
|
{
|
|
134
131
|
transaction: e.transaction,
|
|
@@ -137,15 +134,15 @@ const de = async (e) => {
|
|
|
137
134
|
network: e.network
|
|
138
135
|
}
|
|
139
136
|
)).transactionSignature
|
|
140
|
-
})), Ue = async (e) =>
|
|
141
|
-
signature: (await
|
|
137
|
+
})), Ue = async (e) => s().useMock ? { signature: "0x0" } : u(e, c(), async ({ user: t, walletSecretId: r }) => ({
|
|
138
|
+
signature: (await H(s().projectId, t.userId, {
|
|
142
139
|
message: e.message,
|
|
143
140
|
address: e.evmAccount,
|
|
144
141
|
walletSecretId: r
|
|
145
142
|
})).signature
|
|
146
|
-
})), Te = async (e) =>
|
|
147
|
-
signature: (await
|
|
148
|
-
|
|
143
|
+
})), Te = async (e) => s().useMock ? { signature: "mockSignature" } : u(e, c(), async ({ user: t, walletSecretId: r }) => ({
|
|
144
|
+
signature: (await _(
|
|
145
|
+
s().projectId,
|
|
149
146
|
t.userId,
|
|
150
147
|
{
|
|
151
148
|
message: e.message,
|
|
@@ -153,17 +150,17 @@ const de = async (e) => {
|
|
|
153
150
|
walletSecretId: r
|
|
154
151
|
}
|
|
155
152
|
)).signature
|
|
156
|
-
})), Me = async (e) =>
|
|
157
|
-
signature: (await
|
|
153
|
+
})), Me = async (e) => s().useMock ? { signature: "0x0" } : u(e, c(), async ({ user: t, walletSecretId: r }) => ({
|
|
154
|
+
signature: (await B(s().projectId, t.userId, {
|
|
158
155
|
typedData: e.typedData,
|
|
159
156
|
address: e.evmAccount,
|
|
160
157
|
walletSecretId: r
|
|
161
158
|
})).signature
|
|
162
|
-
})), Pe = async (e) =>
|
|
159
|
+
})), Pe = async (e) => s().useMock ? {
|
|
163
160
|
userOperationHash: "0x1234567890123456789012345678901234567890123456789012345678901234"
|
|
164
161
|
} : u(e, c(), async ({ user: t, walletSecretId: r }) => ({
|
|
165
|
-
userOperationHash: (await
|
|
166
|
-
|
|
162
|
+
userOperationHash: (await D(
|
|
163
|
+
s().projectId,
|
|
167
164
|
t.userId,
|
|
168
165
|
e.evmSmartAccount,
|
|
169
166
|
{
|
|
@@ -178,7 +175,7 @@ const de = async (e) => {
|
|
|
178
175
|
paymasterUrl: e.paymasterUrl
|
|
179
176
|
}
|
|
180
177
|
)).userOpHash
|
|
181
|
-
})), je = async (e) =>
|
|
178
|
+
})), je = async (e) => s().useMock ? {
|
|
182
179
|
userOpHash: e.userOperationHash,
|
|
183
180
|
network: e.network,
|
|
184
181
|
calls: [
|
|
@@ -191,19 +188,19 @@ const de = async (e) => {
|
|
|
191
188
|
status: "complete",
|
|
192
189
|
transactionHash: "0x9876543210987654321098765432109876543210987654321098765432109876",
|
|
193
190
|
receipts: []
|
|
194
|
-
} : u(e, c(), async ({ user: t }) => await
|
|
195
|
-
|
|
191
|
+
} : u(e, c(), async ({ user: t }) => await N(
|
|
192
|
+
s().projectId,
|
|
196
193
|
t.userId,
|
|
197
194
|
e.evmSmartAccount,
|
|
198
195
|
e.userOperationHash
|
|
199
196
|
)), Ke = async (e) => {
|
|
200
|
-
if (
|
|
197
|
+
if (s().useMock)
|
|
201
198
|
return {
|
|
202
199
|
privateKey: m.Buffer.from("mock-private-key").toString("hex")
|
|
203
200
|
};
|
|
204
|
-
const t =
|
|
205
|
-
return u(e, c(), async ({ user:
|
|
206
|
-
const o = await
|
|
201
|
+
const t = k(), r = await t.createExportKeyPair();
|
|
202
|
+
return u(e, c(), async ({ user: n, walletSecretId: a }) => {
|
|
203
|
+
const o = await L(s().projectId, n.userId, {
|
|
207
204
|
address: e.evmAccount,
|
|
208
205
|
walletSecretId: a,
|
|
209
206
|
exportEncryptionKey: r.publicKeyBase64
|
|
@@ -216,43 +213,43 @@ const de = async (e) => {
|
|
|
216
213
|
};
|
|
217
214
|
});
|
|
218
215
|
}, Oe = async (e) => {
|
|
219
|
-
if (
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
const o =
|
|
216
|
+
if (s().useMock) {
|
|
217
|
+
const n = m.Buffer.from("mock-private-key").subarray(0, 32), a = m.Buffer.alloc(32);
|
|
218
|
+
n.copy(a);
|
|
219
|
+
const o = y.fromSeed(a), i = m.Buffer.concat([o.secretKey.subarray(0, 32), o.publicKey.toBytes()]);
|
|
223
220
|
return {
|
|
224
|
-
privateKey:
|
|
221
|
+
privateKey: l.encode(i)
|
|
225
222
|
};
|
|
226
223
|
}
|
|
227
|
-
const t =
|
|
228
|
-
return u(e, c(), async ({ user:
|
|
229
|
-
const o = await
|
|
224
|
+
const t = k(), r = await t.createExportKeyPair();
|
|
225
|
+
return u(e, c(), async ({ user: n, walletSecretId: a }) => {
|
|
226
|
+
const o = await z(s().projectId, n.userId, {
|
|
230
227
|
address: e.solanaAccount,
|
|
231
228
|
walletSecretId: a,
|
|
232
229
|
exportEncryptionKey: r.publicKeyBase64
|
|
233
230
|
}), i = await t.decryptWithPrivateKey(
|
|
234
231
|
r.privateKey,
|
|
235
232
|
o.encryptedPrivateKey
|
|
236
|
-
), d =
|
|
233
|
+
), d = y.fromSeed(new Uint8Array(i)), p = m.Buffer.concat([d.secretKey.subarray(0, 32), d.publicKey.toBytes()]);
|
|
237
234
|
return {
|
|
238
|
-
privateKey:
|
|
235
|
+
privateKey: l.encode(p)
|
|
239
236
|
};
|
|
240
237
|
});
|
|
241
|
-
},
|
|
242
|
-
if (
|
|
238
|
+
}, S = async (e) => {
|
|
239
|
+
if (s().useMock)
|
|
243
240
|
return {
|
|
244
241
|
message: "Mock sign in initiated",
|
|
245
242
|
flowId: "mock-flow-id"
|
|
246
243
|
};
|
|
247
244
|
if (await c().isSignedIn())
|
|
248
245
|
throw new Error("User is already authenticated. Please sign out first.");
|
|
249
|
-
const r = await
|
|
246
|
+
const r = await T(s().projectId, e);
|
|
250
247
|
return {
|
|
251
248
|
flowId: r.flowId,
|
|
252
|
-
message: r.message
|
|
249
|
+
message: "message" in r ? r.message : ""
|
|
253
250
|
};
|
|
254
|
-
},
|
|
255
|
-
if (
|
|
251
|
+
}, v = async (e, t, r) => {
|
|
252
|
+
if (s().useMock)
|
|
256
253
|
return await c().setAuthState({
|
|
257
254
|
accessToken: "mock-access-token",
|
|
258
255
|
expiresAt: Date.now() + 1e3 * 60 * 60 * 24,
|
|
@@ -264,7 +261,7 @@ const de = async (e) => {
|
|
|
264
261
|
};
|
|
265
262
|
if (await c().isSignedIn())
|
|
266
263
|
throw new Error("User is already authenticated. Please sign out first.");
|
|
267
|
-
const a = await r(
|
|
264
|
+
const a = await r(s().projectId, {
|
|
268
265
|
flowId: e.flowId,
|
|
269
266
|
otp: e.otp
|
|
270
267
|
});
|
|
@@ -274,12 +271,12 @@ const de = async (e) => {
|
|
|
274
271
|
a.endUser
|
|
275
272
|
);
|
|
276
273
|
await c().setAuthState(o);
|
|
277
|
-
const i =
|
|
274
|
+
const i = s();
|
|
278
275
|
i.ethereum?.createOnLogin && (o = await I(
|
|
279
276
|
a,
|
|
280
277
|
o,
|
|
281
278
|
i.ethereum.createOnLogin
|
|
282
|
-
)), i.solana?.createOnLogin && (o = await
|
|
279
|
+
)), i.solana?.createOnLogin && (o = await G(a, o)), !i.ethereum?.createOnLogin && !i.solana?.createOnLogin && (o = await I(a, o, "eoa"));
|
|
283
280
|
const d = await c().getUser();
|
|
284
281
|
return {
|
|
285
282
|
message: a.message,
|
|
@@ -287,18 +284,18 @@ const de = async (e) => {
|
|
|
287
284
|
isNewUser: a.isNewEndUser
|
|
288
285
|
};
|
|
289
286
|
}, I = async (e, t, r) => {
|
|
290
|
-
let
|
|
287
|
+
let n = t;
|
|
291
288
|
if (!t.user.evmAccounts || t.user.evmAccounts.length === 0)
|
|
292
289
|
try {
|
|
293
290
|
const a = await c().getWalletSecretId();
|
|
294
|
-
let o = await
|
|
291
|
+
let o = await M(s().projectId, t.user.userId, {
|
|
295
292
|
walletSecretId: a
|
|
296
293
|
}), i = !1;
|
|
297
|
-
const d =
|
|
294
|
+
const d = s().ethereum;
|
|
298
295
|
if (d?.createOnLogin === "smart" && (i = d.enableSpendPermissions ?? !1), r === "smart") {
|
|
299
296
|
const [p] = o.evmAccounts;
|
|
300
|
-
o = await
|
|
301
|
-
|
|
297
|
+
o = await f(
|
|
298
|
+
s().projectId,
|
|
302
299
|
t.user.userId,
|
|
303
300
|
{
|
|
304
301
|
owner: p,
|
|
@@ -306,40 +303,40 @@ const de = async (e) => {
|
|
|
306
303
|
}
|
|
307
304
|
);
|
|
308
305
|
}
|
|
309
|
-
|
|
306
|
+
n = g(e.accessToken, e.validUntil, o), await c().setAuthState(n);
|
|
310
307
|
} catch (a) {
|
|
311
308
|
throw new Error(`Failed to create EVM account: ${a}`);
|
|
312
309
|
}
|
|
313
|
-
if (r === "smart" && (!
|
|
310
|
+
if (r === "smart" && (!n.user.evmSmartAccounts || n.user.evmSmartAccounts.length === 0))
|
|
314
311
|
try {
|
|
315
|
-
const [a] =
|
|
316
|
-
|
|
317
|
-
|
|
312
|
+
const [a] = n.user.evmAccounts, o = await f(
|
|
313
|
+
s().projectId,
|
|
314
|
+
n.user.userId,
|
|
318
315
|
{
|
|
319
316
|
owner: a,
|
|
320
317
|
enableSpendPermissions: !1
|
|
321
318
|
// Defaulting to false until the feature is ready.
|
|
322
319
|
}
|
|
323
320
|
);
|
|
324
|
-
|
|
321
|
+
n = g(e.accessToken, e.validUntil, o), await c().setAuthState(n);
|
|
325
322
|
} catch (a) {
|
|
326
323
|
throw new Error(`Failed to create EVM Smart Account: ${a}`);
|
|
327
324
|
}
|
|
328
|
-
return
|
|
329
|
-
},
|
|
325
|
+
return n;
|
|
326
|
+
}, G = async (e, t) => {
|
|
330
327
|
let r = t;
|
|
331
328
|
if (!t.user.solanaAccounts || t.user.solanaAccounts.length === 0)
|
|
332
329
|
try {
|
|
333
|
-
const
|
|
334
|
-
|
|
330
|
+
const n = await c().getWalletSecretId(), a = await P(
|
|
331
|
+
s().projectId,
|
|
335
332
|
t.user.userId,
|
|
336
333
|
{
|
|
337
|
-
walletSecretId:
|
|
334
|
+
walletSecretId: n
|
|
338
335
|
}
|
|
339
336
|
);
|
|
340
337
|
r = g(e.accessToken, e.validUntil, a), await c().setAuthState(r);
|
|
341
|
-
} catch (
|
|
342
|
-
throw new Error(`Failed to create Solana account: ${
|
|
338
|
+
} catch (n) {
|
|
339
|
+
throw new Error(`Failed to create Solana account: ${n}`);
|
|
343
340
|
}
|
|
344
341
|
return r;
|
|
345
342
|
};
|
|
@@ -347,15 +344,15 @@ export {
|
|
|
347
344
|
Ke as exportEvmAccount,
|
|
348
345
|
Oe as exportSolanaAccount,
|
|
349
346
|
we as getAccessToken,
|
|
350
|
-
|
|
347
|
+
ye as getCurrentUser,
|
|
351
348
|
je as getUserOperation,
|
|
352
349
|
de as initialize,
|
|
353
|
-
|
|
350
|
+
le as isSignedIn,
|
|
354
351
|
Ie as onAuthStateChange,
|
|
355
|
-
|
|
352
|
+
ve as sendEvmTransaction,
|
|
356
353
|
Ee as sendSolanaTransaction,
|
|
357
354
|
Pe as sendUserOperation,
|
|
358
|
-
|
|
355
|
+
ke as signEvmHash,
|
|
359
356
|
Ue as signEvmMessage,
|
|
360
357
|
Ae as signEvmTransaction,
|
|
361
358
|
Me as signEvmTypedData,
|
|
@@ -363,7 +360,7 @@ export {
|
|
|
363
360
|
ge as signInWithSms,
|
|
364
361
|
he as signOut,
|
|
365
362
|
Te as signSolanaMessage,
|
|
366
|
-
|
|
363
|
+
Se as signSolanaTransaction,
|
|
367
364
|
pe as verifyEmailOTP,
|
|
368
|
-
|
|
365
|
+
fe as verifySmsOTP
|
|
369
366
|
};
|
package/dist/web/index.web84.js
CHANGED
|
@@ -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.web97.js";
|
|
2
|
+
import y from "./index.web98.js";
|
|
3
|
+
import b from "./index.web99.js";
|
|
4
4
|
import { JWSInvalid as r } from "./index.web35.js";
|
|
5
5
|
import { encoder as s, concat as u, decoder as h } from "./index.web85.js";
|
|
6
|
-
import g from "./index.
|
|
7
|
-
import H from "./index.
|
|
8
|
-
import P from "./index.
|
|
6
|
+
import g from "./index.web100.js";
|
|
7
|
+
import H from "./index.web101.js";
|
|
8
|
+
import P from "./index.web102.js";
|
|
9
9
|
class x {
|
|
10
10
|
#r;
|
|
11
11
|
#e;
|
package/dist/web/index.web93.js
CHANGED
|
@@ -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.web96.js";
|
|
2
2
|
import { createHasher as u, clean as C, rotr as i } from "./index.web92.js";
|
|
3
3
|
const B = /* @__PURE__ */ Uint32Array.from([
|
|
4
4
|
1116352408,
|
package/dist/web/index.web96.js
CHANGED
|
@@ -1,23 +1,81 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
throw new TypeError("The input to be decoded is not correctly encoded.");
|
|
14
|
-
}
|
|
1
|
+
import { Hash as g, createView as l, aexists as b, toBytes as a, abytes as d, aoutput as x, clean as w } from "./index.web92.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);
|
|
7
|
+
}
|
|
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;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
+
}
|
|
19
64
|
}
|
|
65
|
+
const B = /* @__PURE__ */ Uint32Array.from([
|
|
66
|
+
1779033703,
|
|
67
|
+
3144134277,
|
|
68
|
+
1013904242,
|
|
69
|
+
2773480762,
|
|
70
|
+
1359893119,
|
|
71
|
+
2600822924,
|
|
72
|
+
528734635,
|
|
73
|
+
1541459225
|
|
74
|
+
]);
|
|
20
75
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
76
|
+
U as Chi,
|
|
77
|
+
m as HashMD,
|
|
78
|
+
_ as Maj,
|
|
79
|
+
B as SHA256_IV,
|
|
80
|
+
y as setBigUint64
|
|
23
81
|
};
|
package/dist/web/index.web97.js
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { encoder as t, decoder as o } from "./index.web85.js";
|
|
2
|
+
import { encodeBase64 as c, decodeBase64 as a } from "./index.web105.js";
|
|
3
|
+
function i(r) {
|
|
4
|
+
if (Uint8Array.fromBase64)
|
|
5
|
+
return Uint8Array.fromBase64(typeof r == "string" ? r : o.decode(r), {
|
|
6
|
+
alphabet: "base64url"
|
|
7
|
+
});
|
|
8
|
+
let e = r;
|
|
9
|
+
e instanceof Uint8Array && (e = o.decode(e)), e = e.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
10
|
+
try {
|
|
11
|
+
return a(e);
|
|
12
|
+
} catch {
|
|
13
|
+
throw new TypeError("The input to be decoded is not correctly encoded.");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function p(r) {
|
|
17
|
+
let e = r;
|
|
18
|
+
return typeof e == "string" && (e = t.encode(e)), Uint8Array.prototype.toBase64 ? e.toBase64({ alphabet: "base64url", omitPadding: !0 }) : c(e).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
19
|
+
}
|
|
10
20
|
export {
|
|
11
|
-
|
|
21
|
+
i as decode,
|
|
22
|
+
p as encode
|
|
12
23
|
};
|
package/dist/web/index.web98.js
CHANGED
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
e = new Set(r);
|
|
10
|
-
continue;
|
|
11
|
-
}
|
|
12
|
-
for (const n of r) {
|
|
13
|
-
if (e.has(n))
|
|
14
|
-
return !1;
|
|
15
|
-
e.add(n);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return !0;
|
|
1
|
+
import n from "./index.web106.js";
|
|
2
|
+
import s from "./index.web107.js";
|
|
3
|
+
import a from "./index.web108.js";
|
|
4
|
+
const y = async (t, o, e) => {
|
|
5
|
+
const r = await a(t, o, "sign");
|
|
6
|
+
s(t, r);
|
|
7
|
+
const i = await crypto.subtle.sign(n(t, r.algorithm), r, e);
|
|
8
|
+
return new Uint8Array(i);
|
|
19
9
|
};
|
|
20
10
|
export {
|
|
21
|
-
|
|
11
|
+
y as default
|
|
22
12
|
};
|