@aptos-labs/wallet-adapter-react 4.1.5 → 5.0.1

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/index.mjs CHANGED
@@ -1,3 +1,55 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ var __async = (__this, __arguments, generator) => {
33
+ return new Promise((resolve, reject) => {
34
+ var fulfilled = (value) => {
35
+ try {
36
+ step(generator.next(value));
37
+ } catch (e) {
38
+ reject(e);
39
+ }
40
+ };
41
+ var rejected = (value) => {
42
+ try {
43
+ step(generator.throw(value));
44
+ } catch (e) {
45
+ reject(e);
46
+ }
47
+ };
48
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
49
+ step((generator = generator.apply(__this, __arguments)).next());
50
+ });
51
+ };
52
+
1
53
  // src/index.tsx
2
54
  export * from "@aptos-labs/wallet-adapter-core";
3
55
 
@@ -25,6 +77,10 @@ function useWallet() {
25
77
  }
26
78
 
27
79
  // src/WalletProvider.tsx
80
+ import {
81
+ SolanaDerivedWallet
82
+ } from "@aptos-labs/derived-wallet-solana";
83
+ import { EIP1193DerivedWallet } from "@aptos-labs/derived-wallet-ethereum";
28
84
  import { jsx } from "react/jsx-runtime";
29
85
  var initialState = {
30
86
  connected: false,
@@ -81,170 +137,152 @@ var AptosWalletAdapterProvider = ({
81
137
  return;
82
138
  }
83
139
  if (!connected) {
84
- (async () => {
140
+ (() => __async(void 0, null, function* () {
85
141
  try {
86
142
  let shouldConnect = true;
87
143
  if (typeof autoConnect === "function") {
88
- shouldConnect = await autoConnect(walletCore, selectedWallet);
144
+ shouldConnect = yield autoConnect(walletCore, selectedWallet);
89
145
  } else {
90
146
  shouldConnect = autoConnect;
91
147
  }
92
- if (shouldConnect)
93
- await connect(walletName);
148
+ if (shouldConnect) yield connect(walletName);
94
149
  } catch (error) {
95
- if (onError)
96
- onError(error);
150
+ if (onError) onError(error);
97
151
  return Promise.reject(error);
98
152
  } finally {
99
153
  setIsLoading(false);
100
154
  }
101
- })();
155
+ }))();
102
156
  } else {
103
157
  setIsLoading(false);
104
158
  }
105
159
  }, [autoConnect, wallets]);
106
- const connect = async (walletName) => {
160
+ const connect = (walletName) => __async(void 0, null, function* () {
107
161
  try {
108
162
  setIsLoading(true);
109
- await (walletCore == null ? void 0 : walletCore.connect(walletName));
163
+ yield walletCore == null ? void 0 : walletCore.connect(walletName);
110
164
  } catch (error) {
111
- if (onError)
112
- onError(error);
165
+ if (onError) onError(error);
113
166
  return Promise.reject(error);
114
167
  } finally {
115
168
  setIsLoading(false);
116
169
  }
117
- };
118
- const signIn = async (args) => {
170
+ });
171
+ const signIn = (args) => __async(void 0, null, function* () {
119
172
  try {
120
173
  setIsLoading(true);
121
- return await (walletCore == null ? void 0 : walletCore.signIn(args));
174
+ return yield walletCore == null ? void 0 : walletCore.signIn(args);
122
175
  } catch (error) {
123
- if (onError)
124
- onError(error);
176
+ if (onError) onError(error);
125
177
  return Promise.reject(error);
126
178
  } finally {
127
179
  setIsLoading(false);
128
180
  }
129
- };
130
- const disconnect = async () => {
181
+ });
182
+ const disconnect = () => __async(void 0, null, function* () {
131
183
  try {
132
- await (walletCore == null ? void 0 : walletCore.disconnect());
184
+ yield walletCore == null ? void 0 : walletCore.disconnect();
133
185
  } catch (error) {
134
- if (onError)
135
- onError(error);
186
+ if (onError) onError(error);
136
187
  return Promise.reject(error);
137
188
  }
138
- };
139
- const signAndSubmitTransaction = async (transaction) => {
189
+ });
190
+ const signAndSubmitTransaction = (transaction) => __async(void 0, null, function* () {
140
191
  try {
141
192
  if (!walletCore) {
142
193
  throw new Error("WalletCore is not initialized");
143
194
  }
144
- return await walletCore.signAndSubmitTransaction(transaction);
195
+ return yield walletCore.signAndSubmitTransaction(transaction);
145
196
  } catch (error) {
146
- if (onError)
147
- onError(error);
197
+ if (onError) onError(error);
148
198
  return Promise.reject(error);
149
199
  }
150
- };
151
- const signTransaction = async (args) => {
200
+ });
201
+ const signTransaction = (args) => __async(void 0, null, function* () {
152
202
  const { transactionOrPayload, asFeePayer, options } = args;
153
203
  if (!walletCore) {
154
204
  throw new Error("WalletCore is not initialized");
155
205
  }
156
206
  try {
157
- return await walletCore.signTransaction({
207
+ return yield walletCore.signTransaction({
158
208
  transactionOrPayload,
159
209
  asFeePayer
160
210
  });
161
211
  } catch (error) {
162
- if (onError)
163
- onError(error);
212
+ if (onError) onError(error);
164
213
  return Promise.reject(error);
165
214
  }
166
- };
167
- const submitTransaction = async (transaction) => {
215
+ });
216
+ const submitTransaction = (transaction) => __async(void 0, null, function* () {
168
217
  if (!walletCore) {
169
218
  throw new Error("WalletCore is not initialized");
170
219
  }
171
220
  try {
172
- return await (walletCore == null ? void 0 : walletCore.submitTransaction(transaction));
221
+ return yield walletCore == null ? void 0 : walletCore.submitTransaction(transaction);
173
222
  } catch (error) {
174
- if (onError)
175
- onError(error);
223
+ if (onError) onError(error);
176
224
  return Promise.reject(error);
177
225
  }
178
- };
179
- const signMessage = async (message) => {
226
+ });
227
+ const signMessage = (message) => __async(void 0, null, function* () {
180
228
  if (!walletCore) {
181
229
  throw new Error("WalletCore is not initialized");
182
230
  }
183
231
  try {
184
- return await (walletCore == null ? void 0 : walletCore.signMessage(message));
232
+ return yield walletCore == null ? void 0 : walletCore.signMessage(message);
185
233
  } catch (error) {
186
- if (onError)
187
- onError(error);
234
+ if (onError) onError(error);
188
235
  return Promise.reject(error);
189
236
  }
190
- };
191
- const signMessageAndVerify = async (message) => {
237
+ });
238
+ const signMessageAndVerify = (message) => __async(void 0, null, function* () {
192
239
  if (!walletCore) {
193
240
  throw new Error("WalletCore is not initialized");
194
241
  }
195
242
  try {
196
- return await (walletCore == null ? void 0 : walletCore.signMessageAndVerify(message));
243
+ return yield walletCore == null ? void 0 : walletCore.signMessageAndVerify(message);
197
244
  } catch (error) {
198
- if (onError)
199
- onError(error);
245
+ if (onError) onError(error);
200
246
  return Promise.reject(error);
201
247
  }
202
- };
203
- const changeNetwork = async (network2) => {
248
+ });
249
+ const changeNetwork = (network2) => __async(void 0, null, function* () {
204
250
  if (!walletCore) {
205
251
  throw new Error("WalletCore is not initialized");
206
252
  }
207
253
  try {
208
- return await (walletCore == null ? void 0 : walletCore.changeNetwork(network2));
254
+ return yield walletCore == null ? void 0 : walletCore.changeNetwork(network2);
209
255
  } catch (error) {
210
- if (onError)
211
- onError(error);
256
+ if (onError) onError(error);
212
257
  return Promise.reject(error);
213
258
  }
214
- };
259
+ });
215
260
  const handleConnect = () => {
216
261
  setState((state) => {
217
- return {
218
- ...state,
262
+ return __spreadProps(__spreadValues({}, state), {
219
263
  connected: true,
220
264
  account: (walletCore == null ? void 0 : walletCore.account) || null,
221
265
  network: (walletCore == null ? void 0 : walletCore.network) || null,
222
266
  wallet: (walletCore == null ? void 0 : walletCore.wallet) || null
223
- };
267
+ });
224
268
  });
225
269
  };
226
270
  const handleAccountChange = useCallback(() => {
227
- if (!connected)
228
- return;
229
- if (!(walletCore == null ? void 0 : walletCore.wallet))
230
- return;
271
+ if (!connected) return;
272
+ if (!(walletCore == null ? void 0 : walletCore.wallet)) return;
231
273
  setState((state) => {
232
- return {
233
- ...state,
274
+ return __spreadProps(__spreadValues({}, state), {
234
275
  account: (walletCore == null ? void 0 : walletCore.account) || null
235
- };
276
+ });
236
277
  });
237
278
  }, [connected]);
238
279
  const handleNetworkChange = useCallback(() => {
239
- if (!connected)
240
- return;
241
- if (!(walletCore == null ? void 0 : walletCore.wallet))
242
- return;
280
+ if (!connected) return;
281
+ if (!(walletCore == null ? void 0 : walletCore.wallet)) return;
243
282
  setState((state) => {
244
- return {
245
- ...state,
283
+ return __spreadProps(__spreadValues({}, state), {
246
284
  network: (walletCore == null ? void 0 : walletCore.network) || null
247
- };
285
+ });
248
286
  });
249
287
  }, [connected]);
250
288
  useEffect(() => {
@@ -254,16 +292,14 @@ var AptosWalletAdapterProvider = ({
254
292
  }
255
293
  }, [connected]);
256
294
  const handleDisconnect = () => {
257
- if (!connected)
258
- return;
295
+ if (!connected) return;
259
296
  setState((state) => {
260
- return {
261
- ...state,
297
+ return __spreadProps(__spreadValues({}, state), {
262
298
  connected: false,
263
299
  account: (walletCore == null ? void 0 : walletCore.account) || null,
264
300
  network: (walletCore == null ? void 0 : walletCore.network) || null,
265
301
  wallet: null
266
- };
302
+ });
267
303
  });
268
304
  };
269
305
  const handleStandardWalletsAdded = (standardWallet) => {
@@ -316,27 +352,60 @@ var AptosWalletAdapterProvider = ({
316
352
  );
317
353
  };
318
354
  }, [wallets, account]);
319
- return /* @__PURE__ */ jsx(WalletContext.Provider, {
320
- value: {
321
- connect,
322
- signIn,
323
- disconnect,
324
- signAndSubmitTransaction,
325
- signTransaction,
326
- signMessage,
327
- signMessageAndVerify,
328
- changeNetwork,
329
- submitTransaction,
330
- account,
331
- network,
332
- connected,
333
- wallet,
334
- wallets,
335
- notDetectedWallets,
336
- isLoading
337
- },
338
- children
339
- });
355
+ function getOriginWalletDetails(wallet2) {
356
+ return __async(this, null, function* () {
357
+ var _a;
358
+ if (isSolanaDerivedWallet(wallet2)) {
359
+ const publicKey = wallet2.solanaWallet.publicKey;
360
+ return {
361
+ publicKey: publicKey != null ? publicKey : void 0,
362
+ address: (_a = publicKey == null ? void 0 : publicKey.toBase58()) != null ? _a : ""
363
+ };
364
+ } else if (isEIP1193DerivedWallet(wallet2)) {
365
+ const [activeAccount] = yield wallet2.eip1193Ethers.listAccounts();
366
+ return {
367
+ publicKey: void 0,
368
+ // No public key for EVM wallets
369
+ address: activeAccount.address
370
+ };
371
+ } else {
372
+ return void 0;
373
+ }
374
+ });
375
+ }
376
+ function isSolanaDerivedWallet(wallet2) {
377
+ return wallet2 instanceof SolanaDerivedWallet;
378
+ }
379
+ function isEIP1193DerivedWallet(wallet2) {
380
+ return wallet2 instanceof EIP1193DerivedWallet;
381
+ }
382
+ return /* @__PURE__ */ jsx(
383
+ WalletContext.Provider,
384
+ {
385
+ value: {
386
+ connect,
387
+ signIn,
388
+ disconnect,
389
+ signAndSubmitTransaction,
390
+ signTransaction,
391
+ signMessage,
392
+ signMessageAndVerify,
393
+ changeNetwork,
394
+ submitTransaction,
395
+ getOriginWalletDetails,
396
+ isSolanaDerivedWallet,
397
+ isEIP1193DerivedWallet,
398
+ account,
399
+ network,
400
+ connected,
401
+ wallet,
402
+ wallets,
403
+ notDetectedWallets,
404
+ isLoading
405
+ },
406
+ children
407
+ }
408
+ );
340
409
  };
341
410
 
342
411
  // src/components/AboutAptosConnect.tsx
@@ -352,38 +421,25 @@ import { forwardRef } from "react";
352
421
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
353
422
  var LinkGraphic = forwardRef(
354
423
  (props, ref) => {
355
- return /* @__PURE__ */ jsx2("svg", {
356
- ref,
357
- width: "102",
358
- height: "132",
359
- viewBox: "0 0 102 132",
360
- fill: "none",
361
- ...props,
362
- children: /* @__PURE__ */ jsxs("g", {
363
- stroke: "currentColor",
364
- strokeMiterlimit: "10",
365
- children: [
366
- /* @__PURE__ */ jsx2("path", {
367
- d: "M59.633 80.66c11.742-2.814 17.48-7.018 20.925-13.254l17.518-31.69c6.257-11.317 2.142-25.55-9.189-31.798C82.737.53 75.723.188 69.593 2.398M60.7 69.565a14.09 14.09 0 0 1-6.907-1.767l-.228-.108"
368
- }),
369
- /* @__PURE__ */ jsx2("path", {
370
- d: "m52.365 41.075 12.507-22.627a14.146 14.146 0 0 1 4.727-5.062M32.407 118.619a14.139 14.139 0 0 1-7.034-1.768c-6.857-3.78-9.353-12.402-5.561-19.25l16.634-30.1a14.097 14.097 0 0 1 4.518-4.923"
371
- }),
372
- /* @__PURE__ */ jsx2("path", {
373
- d: "M41.211 78.85c11.332 6.248 25.583 2.14 31.84-9.177l17.518-31.691c6.256-11.317 2.142-25.55-9.19-31.798-6.085-3.357-13.018-3.724-19.104-1.59A23.31 23.31 0 0 0 49.541 15.36L36.863 38.298l7.989 5.036 12.506-22.627c3.786-6.848 12.419-9.34 19.276-5.554 6.856 3.78 9.353 12.402 5.561 19.25l-16.634 30.1c-3.785 6.848-12.418 9.341-19.275 5.555l-5.075 8.791ZM29.5 130.447c12.361-1.37 19.2-6.994 22.966-13.804l12.678-22.936-8.305-5.239"
374
- }),
375
- /* @__PURE__ */ jsx2("path", {
376
- d: "m55.72 61.947-.442.764 5.511-9.55c-6.901-3.806-18.65-3.124-27.105.814M44.85 43.523l7.635-2.486m-4.221 23.264 7.217-1.723m-9.316 7.517 7.59-2.405m-.562-12.156 7.508-2.221m10.136-51.32L62.761 4.43M49.642 90.778l7.514-2.26m.474 7.448 7.514-2.26m-50.306-60.13c7.135 0 12.918-5.776 12.918-12.9 0-7.126-5.783-12.902-12.918-12.902-7.134 0-12.917 5.776-12.917 12.901s5.783 12.901 12.918 12.901Z"
377
- }),
378
- /* @__PURE__ */ jsx2("path", {
379
- d: "M15.724 7.774h3.197c7.135 0 12.918 5.776 12.918 12.901 0 7.126-5.783 12.901-12.918 12.901h-3.425m65.112 66.935h3.198c7.135 0 12.918 5.775 12.918 12.901 0 7.125-5.783 12.9-12.918 12.9h-3.425"
380
- }),
381
- /* @__PURE__ */ jsx2("path", {
382
- d: "M79.717 126.312c7.135 0 12.918-5.775 12.918-12.9s-5.783-12.901-12.918-12.901c-7.134 0-12.917 5.776-12.917 12.901s5.783 12.9 12.917 12.9ZM53.281 55.414c-11.33-6.248-25.582-2.14-31.839 9.177L3.924 96.281c-6.257 11.318-2.142 25.55 9.189 31.799 11.331 6.248 25.582 2.139 31.839-9.177l12.677-22.937-7.988-5.036-12.507 22.627c-3.785 6.848-12.418 9.341-19.275 5.554-6.857-3.781-9.353-12.402-5.561-19.25l16.633-30.1c3.786-6.848 12.419-9.341 19.276-5.555l5.074-8.792Z"
383
- })
384
- ]
424
+ return /* @__PURE__ */ jsx2(
425
+ "svg",
426
+ __spreadProps(__spreadValues({
427
+ ref,
428
+ width: "102",
429
+ height: "132",
430
+ viewBox: "0 0 102 132",
431
+ fill: "none"
432
+ }, props), {
433
+ children: /* @__PURE__ */ jsxs("g", { stroke: "currentColor", strokeMiterlimit: "10", children: [
434
+ /* @__PURE__ */ jsx2("path", { d: "M59.633 80.66c11.742-2.814 17.48-7.018 20.925-13.254l17.518-31.69c6.257-11.317 2.142-25.55-9.189-31.798C82.737.53 75.723.188 69.593 2.398M60.7 69.565a14.09 14.09 0 0 1-6.907-1.767l-.228-.108" }),
435
+ /* @__PURE__ */ jsx2("path", { d: "m52.365 41.075 12.507-22.627a14.146 14.146 0 0 1 4.727-5.062M32.407 118.619a14.139 14.139 0 0 1-7.034-1.768c-6.857-3.78-9.353-12.402-5.561-19.25l16.634-30.1a14.097 14.097 0 0 1 4.518-4.923" }),
436
+ /* @__PURE__ */ jsx2("path", { d: "M41.211 78.85c11.332 6.248 25.583 2.14 31.84-9.177l17.518-31.691c6.256-11.317 2.142-25.55-9.19-31.798-6.085-3.357-13.018-3.724-19.104-1.59A23.31 23.31 0 0 0 49.541 15.36L36.863 38.298l7.989 5.036 12.506-22.627c3.786-6.848 12.419-9.34 19.276-5.554 6.856 3.78 9.353 12.402 5.561 19.25l-16.634 30.1c-3.785 6.848-12.418 9.341-19.275 5.555l-5.075 8.791ZM29.5 130.447c12.361-1.37 19.2-6.994 22.966-13.804l12.678-22.936-8.305-5.239" }),
437
+ /* @__PURE__ */ jsx2("path", { d: "m55.72 61.947-.442.764 5.511-9.55c-6.901-3.806-18.65-3.124-27.105.814M44.85 43.523l7.635-2.486m-4.221 23.264 7.217-1.723m-9.316 7.517 7.59-2.405m-.562-12.156 7.508-2.221m10.136-51.32L62.761 4.43M49.642 90.778l7.514-2.26m.474 7.448 7.514-2.26m-50.306-60.13c7.135 0 12.918-5.776 12.918-12.9 0-7.126-5.783-12.902-12.918-12.902-7.134 0-12.917 5.776-12.917 12.901s5.783 12.901 12.918 12.901Z" }),
438
+ /* @__PURE__ */ jsx2("path", { d: "M15.724 7.774h3.197c7.135 0 12.918 5.776 12.918 12.901 0 7.126-5.783 12.901-12.918 12.901h-3.425m65.112 66.935h3.198c7.135 0 12.918 5.775 12.918 12.901 0 7.125-5.783 12.9-12.918 12.9h-3.425" }),
439
+ /* @__PURE__ */ jsx2("path", { d: "M79.717 126.312c7.135 0 12.918-5.775 12.918-12.9s-5.783-12.901-12.918-12.901c-7.134 0-12.917 5.776-12.917 12.901s5.783 12.9 12.917 12.9ZM53.281 55.414c-11.33-6.248-25.582-2.14-31.839 9.177L3.924 96.281c-6.257 11.318-2.142 25.55 9.189 31.799 11.331 6.248 25.582 2.139 31.839-9.177l12.677-22.937-7.988-5.036-12.507 22.627c-3.785 6.848-12.418 9.341-19.275 5.554-6.857-3.781-9.353-12.402-5.561-19.25l16.633-30.1c3.786-6.848 12.419-9.341 19.276-5.555l5.074-8.792Z" })
440
+ ] })
385
441
  })
386
- });
442
+ );
387
443
  }
388
444
  );
389
445
  LinkGraphic.displayName = "LinkGraphic";
@@ -393,40 +449,58 @@ import { forwardRef as forwardRef2 } from "react";
393
449
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
394
450
  var WalletGraphic = forwardRef2(
395
451
  (props, ref) => {
396
- return /* @__PURE__ */ jsxs2("svg", {
397
- ref,
398
- width: "128",
399
- height: "102",
400
- viewBox: "0 0 128 102",
401
- fill: "none",
402
- ...props,
403
- children: [
404
- /* @__PURE__ */ jsx3("path", {
405
- fill: "currentColor",
406
- d: "m.96 25.93-.36-.35.36.85v-.5Zm7.79-7.81v-.5h-.21l-.15.15.36.35ZM1.3 26.28l7.79-7.8-.7-.71-7.8 7.8.7.71Zm7.44-7.66H10v-1H8.75v1Zm29.22 6.8h-37v1h37.01v-1Z"
407
- }),
408
- /* @__PURE__ */ jsx3("path", {
409
- stroke: "currentColor",
410
- strokeMiterlimit: "10",
411
- d: "M82.25 26.08c0 12.25-9.92 22.2-22.14 22.2a22.17 22.17 0 0 1-22.14-22.2H1.1v74.82h118.02V26.08H82.25Zm44.33 67.02h.33V18.27h-5.7"
412
- }),
413
- /* @__PURE__ */ jsx3("path", {
414
- stroke: "currentColor",
415
- strokeMiterlimit: "10",
416
- d: "M74.52 42.92a22.4 22.4 0 0 1-11.43 3.3 22.5 22.5 0 0 1-22.46-22.53H9.52M119.22 101l7.78-7.82m-7.88-67.1 7.79-7.81m-44.78 7.72 2.73-2.3m-46.89 2.39 2.39-2.4"
417
- }),
418
- /* @__PURE__ */ jsx3("path", {
419
- stroke: "currentColor",
420
- strokeMiterlimit: "10",
421
- d: "M9.86 23.69V5.72h107.97v18.04H84.65"
422
- }),
423
- /* @__PURE__ */ jsx3("path", {
424
- stroke: "currentColor",
425
- strokeMiterlimit: "10",
426
- d: "M117.83 20.46h3.39V1H13.25v4.72M9.36 23.69h31.78"
427
- })
428
- ]
429
- });
452
+ return /* @__PURE__ */ jsxs2(
453
+ "svg",
454
+ __spreadProps(__spreadValues({
455
+ ref,
456
+ width: "128",
457
+ height: "102",
458
+ viewBox: "0 0 128 102",
459
+ fill: "none"
460
+ }, props), {
461
+ children: [
462
+ /* @__PURE__ */ jsx3(
463
+ "path",
464
+ {
465
+ fill: "currentColor",
466
+ d: "m.96 25.93-.36-.35.36.85v-.5Zm7.79-7.81v-.5h-.21l-.15.15.36.35ZM1.3 26.28l7.79-7.8-.7-.71-7.8 7.8.7.71Zm7.44-7.66H10v-1H8.75v1Zm29.22 6.8h-37v1h37.01v-1Z"
467
+ }
468
+ ),
469
+ /* @__PURE__ */ jsx3(
470
+ "path",
471
+ {
472
+ stroke: "currentColor",
473
+ strokeMiterlimit: "10",
474
+ d: "M82.25 26.08c0 12.25-9.92 22.2-22.14 22.2a22.17 22.17 0 0 1-22.14-22.2H1.1v74.82h118.02V26.08H82.25Zm44.33 67.02h.33V18.27h-5.7"
475
+ }
476
+ ),
477
+ /* @__PURE__ */ jsx3(
478
+ "path",
479
+ {
480
+ stroke: "currentColor",
481
+ strokeMiterlimit: "10",
482
+ d: "M74.52 42.92a22.4 22.4 0 0 1-11.43 3.3 22.5 22.5 0 0 1-22.46-22.53H9.52M119.22 101l7.78-7.82m-7.88-67.1 7.79-7.81m-44.78 7.72 2.73-2.3m-46.89 2.39 2.39-2.4"
483
+ }
484
+ ),
485
+ /* @__PURE__ */ jsx3(
486
+ "path",
487
+ {
488
+ stroke: "currentColor",
489
+ strokeMiterlimit: "10",
490
+ d: "M9.86 23.69V5.72h107.97v18.04H84.65"
491
+ }
492
+ ),
493
+ /* @__PURE__ */ jsx3(
494
+ "path",
495
+ {
496
+ stroke: "currentColor",
497
+ strokeMiterlimit: "10",
498
+ d: "M117.83 20.46h3.39V1H13.25v4.72M9.36 23.69h31.78"
499
+ }
500
+ )
501
+ ]
502
+ })
503
+ );
430
504
  }
431
505
  );
432
506
  WalletGraphic.displayName = "WalletGraphic";
@@ -436,53 +510,30 @@ import { forwardRef as forwardRef3 } from "react";
436
510
  import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
437
511
  var Web3Graphic = forwardRef3(
438
512
  (props, ref) => {
439
- return /* @__PURE__ */ jsx4("svg", {
440
- ref,
441
- width: "142",
442
- height: "108",
443
- viewBox: "0 0 142 108",
444
- fill: "none",
445
- ...props,
446
- children: /* @__PURE__ */ jsxs3("g", {
447
- stroke: "currentColor",
448
- strokeLinejoin: "round",
449
- children: [
450
- /* @__PURE__ */ jsx4("path", {
451
- d: "m91.26 35.8.06-10.46L71.3 1v10.53L87 30.5m-36.11 5.24-.06-10.45L71.3 1v10.53L55 30.5"
452
- }),
453
- /* @__PURE__ */ jsx4("path", {
454
- d: "M71 59.55V49.17L50.83 25.3l.06 10.45L57 42.5m14 17.05V49.18l20.33-23.84-.07 10.45L86 42M1 59.68l.22-9.07 35.33-19.8-.1 9L9 55"
455
- }),
456
- /* @__PURE__ */ jsx4("path", {
457
- d: "M36.55 30.8s-.08 5.92-.1 9l.1-9ZM71 59.51v-9.07L36.55 30.8l-.1 9L63.5 55"
458
- }),
459
- /* @__PURE__ */ jsx4("path", {
460
- d: "M71 59.51v-9.07L36.44 70.78l-.1 9.14L55.5 68.5"
461
- }),
462
- /* @__PURE__ */ jsx4("path", {
463
- d: "M1.22 50.6a77387.2 77387.2 0 0 0 35.22 20.18l-.1 9.14L1 59.68l.23-9.07h-.01ZM141 59.68l-.23-9.07-35.33-19.8.11 9L133 55"
464
- }),
465
- /* @__PURE__ */ jsx4("path", {
466
- d: "m105.44 30.8.11 9-.1-9Z"
467
- }),
468
- /* @__PURE__ */ jsx4("path", {
469
- d: "M71 59.51v-9.07l34.44-19.64.11 9L78.5 55"
470
- }),
471
- /* @__PURE__ */ jsx4("path", {
472
- d: "M71 59.51v-9.07l34.56 20.34.1 9.14L87 69"
473
- }),
474
- /* @__PURE__ */ jsx4("path", {
475
- d: "M140.78 50.6a78487.3 78487.3 0 0 1-35.23 20.18l.11 9.14L141 59.68l-.23-9.07ZM50.83 80.15l.06-6.33 20.1-23.38H71v9.26L55 79"
476
- }),
477
- /* @__PURE__ */ jsx4("path", {
478
- d: "M71.3 97.6 50.89 73.81l-.06 9.33L71.3 107v-9.4Zm20.03-14.5-.07-9.33L71 50.44v9.26l16 18.8"
479
- }),
480
- /* @__PURE__ */ jsx4("path", {
481
- d: "m71.3 97.6 19.96-23.83.06 9.33L71.3 107v-9.4Z"
482
- })
483
- ]
513
+ return /* @__PURE__ */ jsx4(
514
+ "svg",
515
+ __spreadProps(__spreadValues({
516
+ ref,
517
+ width: "142",
518
+ height: "108",
519
+ viewBox: "0 0 142 108",
520
+ fill: "none"
521
+ }, props), {
522
+ children: /* @__PURE__ */ jsxs3("g", { stroke: "currentColor", strokeLinejoin: "round", children: [
523
+ /* @__PURE__ */ jsx4("path", { d: "m91.26 35.8.06-10.46L71.3 1v10.53L87 30.5m-36.11 5.24-.06-10.45L71.3 1v10.53L55 30.5" }),
524
+ /* @__PURE__ */ jsx4("path", { d: "M71 59.55V49.17L50.83 25.3l.06 10.45L57 42.5m14 17.05V49.18l20.33-23.84-.07 10.45L86 42M1 59.68l.22-9.07 35.33-19.8-.1 9L9 55" }),
525
+ /* @__PURE__ */ jsx4("path", { d: "M36.55 30.8s-.08 5.92-.1 9l.1-9ZM71 59.51v-9.07L36.55 30.8l-.1 9L63.5 55" }),
526
+ /* @__PURE__ */ jsx4("path", { d: "M71 59.51v-9.07L36.44 70.78l-.1 9.14L55.5 68.5" }),
527
+ /* @__PURE__ */ jsx4("path", { d: "M1.22 50.6a77387.2 77387.2 0 0 0 35.22 20.18l-.1 9.14L1 59.68l.23-9.07h-.01ZM141 59.68l-.23-9.07-35.33-19.8.11 9L133 55" }),
528
+ /* @__PURE__ */ jsx4("path", { d: "m105.44 30.8.11 9-.1-9Z" }),
529
+ /* @__PURE__ */ jsx4("path", { d: "M71 59.51v-9.07l34.44-19.64.11 9L78.5 55" }),
530
+ /* @__PURE__ */ jsx4("path", { d: "M71 59.51v-9.07l34.56 20.34.1 9.14L87 69" }),
531
+ /* @__PURE__ */ jsx4("path", { d: "M140.78 50.6a78487.3 78487.3 0 0 1-35.23 20.18l.11 9.14L141 59.68l-.23-9.07ZM50.83 80.15l.06-6.33 20.1-23.38H71v9.26L55 79" }),
532
+ /* @__PURE__ */ jsx4("path", { d: "M71.3 97.6 50.89 73.81l-.06 9.33L71.3 107v-9.4Zm20.03-14.5-.07-9.33L71 50.44v9.26l16 18.8" }),
533
+ /* @__PURE__ */ jsx4("path", { d: "m71.3 97.6 19.96-23.83.06 9.33L71.3 107v-9.4Z" })
534
+ ] })
484
535
  })
485
- });
536
+ );
486
537
  }
487
538
  );
488
539
  Web3Graphic.displayName = "Web3Graphic";
@@ -494,14 +545,27 @@ import { jsx as jsx5 } from "react/jsx-runtime";
494
545
  function createHeadlessComponent(displayName, elementType, props) {
495
546
  const component = forwardRef4(({ className, asChild, children }, ref) => {
496
547
  const Component = asChild ? Slot : elementType;
497
- const { children: defaultChildren, ...resolvedProps } = typeof props === "function" ? props(displayName) : props != null ? props : {};
498
- const resolvedChildren = asChild && isValidElement(children) && !children.props.children ? cloneElement(children, {}, defaultChildren) : children != null ? children : defaultChildren;
499
- return /* @__PURE__ */ jsx5(Component, {
500
- ref,
501
- className,
502
- ...resolvedProps,
503
- children: resolvedChildren
504
- });
548
+ const _a = typeof props === "function" ? props(displayName) : props != null ? props : {}, { children: defaultChildren } = _a, resolvedProps = __objRest(_a, ["children"]);
549
+ const resolvedChildren = (
550
+ /**
551
+ * Use props' default children if no children are set in the component element's children and when asChild is true.
552
+ */
553
+ asChild && isValidElement(children) && !children.props.children ? cloneElement(children, {}, defaultChildren) : children != null ? children : defaultChildren
554
+ );
555
+ return (
556
+ /**
557
+ * Due to the complexity of the types at play, TypeScript reports the
558
+ * following error for our JSX below:
559
+ *
560
+ * `Expression produces a union type that is too complex to represent.`
561
+ *
562
+ * We can safely ignore this error and retain accurate return types for
563
+ * consumers of this function. The only drawback is that type-checking is
564
+ * ignored for the JSX block below.
565
+ */
566
+ // @ts-expect-error
567
+ /* @__PURE__ */ jsx5(Component, __spreadProps(__spreadValues({ ref, className }, resolvedProps), { children: resolvedChildren }))
568
+ );
505
569
  });
506
570
  component.displayName = displayName;
507
571
  return component;
@@ -545,19 +609,20 @@ var educationScreens = [
545
609
  children: "Explore more of web3."
546
610
  }),
547
611
  Description: createHeadlessComponent("EducationScreen.Description", "p", {
548
- children: /* @__PURE__ */ jsxs4(Fragment, {
549
- children: [
550
- "Aptos Connect lets you take one account across any application built on Aptos.",
551
- " ",
552
- /* @__PURE__ */ jsx6("a", {
612
+ children: /* @__PURE__ */ jsxs4(Fragment, { children: [
613
+ "Aptos Connect lets you take one account across any application built on Aptos.",
614
+ " ",
615
+ /* @__PURE__ */ jsx6(
616
+ "a",
617
+ {
553
618
  href: EXPLORE_ECOSYSTEM_URL,
554
619
  target: "_blank",
555
620
  rel: "noopener noreferrer",
556
621
  children: "Explore the ecosystem"
557
- }),
558
- "."
559
- ]
560
- })
622
+ }
623
+ ),
624
+ "."
625
+ ] })
561
626
  })
562
627
  }
563
628
  ];
@@ -582,8 +647,7 @@ var educationScreenIndicators = Array(educationScreens.length).fill(null).map(
582
647
  var Root = ({ renderEducationScreen, children }) => {
583
648
  const [screenIndex, setScreenIndex] = useState2(0);
584
649
  const currentEducationScreen = useMemo(
585
- () => educationScreens.map((screen, i) => ({
586
- ...screen,
650
+ () => educationScreens.map((screen, i) => __spreadProps(__spreadValues({}, screen), {
587
651
  screenIndex: i,
588
652
  totalScreens: educationScreens.length,
589
653
  screenIndicators: educationScreenIndicators,
@@ -601,10 +665,7 @@ var Root = ({ renderEducationScreen, children }) => {
601
665
  }))[screenIndex - 1],
602
666
  [screenIndex]
603
667
  );
604
- return /* @__PURE__ */ jsx6(AboutAptosConnectContext.Provider, {
605
- value: { screenIndex, setScreenIndex },
606
- children: screenIndex === 0 ? children : renderEducationScreen(currentEducationScreen)
607
- });
668
+ return /* @__PURE__ */ jsx6(AboutAptosConnectContext.Provider, { value: { screenIndex, setScreenIndex }, children: screenIndex === 0 ? children : renderEducationScreen(currentEducationScreen) });
608
669
  };
609
670
  Root.displayName = "AboutAptosConnect";
610
671
  var Trigger = createHeadlessComponent(
@@ -630,20 +691,26 @@ import { forwardRef as forwardRef6 } from "react";
630
691
  import { forwardRef as forwardRef5 } from "react";
631
692
  import { jsx as jsx7 } from "react/jsx-runtime";
632
693
  var SmallAptosLogo = forwardRef5((props, ref) => {
633
- return /* @__PURE__ */ jsx7("svg", {
634
- ref,
635
- width: "12",
636
- height: "12",
637
- viewBox: "0 0 12 12",
638
- fill: "none",
639
- ...props,
640
- children: /* @__PURE__ */ jsx7("path", {
641
- fillRule: "evenodd",
642
- clipRule: "evenodd",
643
- d: "M6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12ZM7.17547 3.67976C7.13401 3.72309 7.07649 3.74757 7.01648 3.74757H3.00775C3.69185 2.83824 4.77995 2.25 6.00569 2.25C7.23142 2.25 8.31953 2.83824 9.00362 3.74757H8.28524C8.20824 3.74757 8.13498 3.71468 8.08401 3.65701L7.81608 3.35416C7.77618 3.30896 7.71882 3.28308 7.6585 3.28308H7.6454C7.58805 3.28308 7.53318 3.30646 7.49343 3.34792L7.17547 3.67976ZM8.05656 4.75897H7.39569C7.31869 4.75897 7.24543 4.72593 7.19447 4.66842L6.92638 4.36557C6.88647 4.32036 6.82896 4.29465 6.7688 4.29465C6.70863 4.29465 6.65112 4.32052 6.61121 4.36557L6.38131 4.6254C6.30603 4.71034 6.19801 4.75913 6.08454 4.75913H2.46703C2.36401 5.05278 2.29683 5.36296 2.27002 5.68467H5.68505C5.74506 5.68467 5.80258 5.66019 5.84404 5.61686L6.16201 5.28502C6.20175 5.24356 6.25662 5.22018 6.31398 5.22018H6.32707C6.38739 5.22018 6.44475 5.24606 6.48465 5.29126L6.75258 5.59411C6.80355 5.65178 6.87681 5.68467 6.95381 5.68467H9.74133C9.71452 5.3628 9.64734 5.05263 9.54431 4.75913H8.05641L8.05656 4.75897ZM4.33651 7.63095C4.39652 7.63095 4.45404 7.60648 4.4955 7.56315L4.81347 7.23131C4.85321 7.18985 4.90808 7.16647 4.96544 7.16647H4.97853C5.03885 7.16647 5.09621 7.19234 5.13611 7.23739L5.40404 7.54024C5.45501 7.59791 5.52827 7.6308 5.60527 7.6308H9.38285C9.52438 7.33839 9.62803 7.02463 9.68975 6.69591H6.06383C5.98683 6.69591 5.91357 6.66287 5.8626 6.60535L5.59467 6.3025C5.55477 6.2573 5.49725 6.23158 5.43709 6.23158C5.37692 6.23158 5.31941 6.25746 5.27951 6.3025L5.0496 6.56233C4.97432 6.64728 4.86631 6.69606 4.75268 6.69606H2.32147C2.3832 7.02479 2.487 7.33855 2.62837 7.63095H4.33651ZM5.57359 8.55745H4.59116C4.51417 8.55745 4.44091 8.52441 4.38994 8.46689L4.12201 8.16404C4.0821 8.11884 4.02459 8.09312 3.96442 8.09312C3.90426 8.09312 3.84675 8.119 3.80684 8.16404L3.57694 8.42387C3.50166 8.50882 3.39364 8.55761 3.28001 8.55761H3.26474C3.94915 9.29096 4.92378 9.74998 6.00596 9.74998C7.08815 9.74998 8.06262 9.29096 8.74719 8.55761H5.57359V8.55745Z",
644
- fill: "currentColor"
694
+ return /* @__PURE__ */ jsx7(
695
+ "svg",
696
+ __spreadProps(__spreadValues({
697
+ ref,
698
+ width: "12",
699
+ height: "12",
700
+ viewBox: "0 0 12 12",
701
+ fill: "none"
702
+ }, props), {
703
+ children: /* @__PURE__ */ jsx7(
704
+ "path",
705
+ {
706
+ fillRule: "evenodd",
707
+ clipRule: "evenodd",
708
+ d: "M6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12ZM7.17547 3.67976C7.13401 3.72309 7.07649 3.74757 7.01648 3.74757H3.00775C3.69185 2.83824 4.77995 2.25 6.00569 2.25C7.23142 2.25 8.31953 2.83824 9.00362 3.74757H8.28524C8.20824 3.74757 8.13498 3.71468 8.08401 3.65701L7.81608 3.35416C7.77618 3.30896 7.71882 3.28308 7.6585 3.28308H7.6454C7.58805 3.28308 7.53318 3.30646 7.49343 3.34792L7.17547 3.67976ZM8.05656 4.75897H7.39569C7.31869 4.75897 7.24543 4.72593 7.19447 4.66842L6.92638 4.36557C6.88647 4.32036 6.82896 4.29465 6.7688 4.29465C6.70863 4.29465 6.65112 4.32052 6.61121 4.36557L6.38131 4.6254C6.30603 4.71034 6.19801 4.75913 6.08454 4.75913H2.46703C2.36401 5.05278 2.29683 5.36296 2.27002 5.68467H5.68505C5.74506 5.68467 5.80258 5.66019 5.84404 5.61686L6.16201 5.28502C6.20175 5.24356 6.25662 5.22018 6.31398 5.22018H6.32707C6.38739 5.22018 6.44475 5.24606 6.48465 5.29126L6.75258 5.59411C6.80355 5.65178 6.87681 5.68467 6.95381 5.68467H9.74133C9.71452 5.3628 9.64734 5.05263 9.54431 4.75913H8.05641L8.05656 4.75897ZM4.33651 7.63095C4.39652 7.63095 4.45404 7.60648 4.4955 7.56315L4.81347 7.23131C4.85321 7.18985 4.90808 7.16647 4.96544 7.16647H4.97853C5.03885 7.16647 5.09621 7.19234 5.13611 7.23739L5.40404 7.54024C5.45501 7.59791 5.52827 7.6308 5.60527 7.6308H9.38285C9.52438 7.33839 9.62803 7.02463 9.68975 6.69591H6.06383C5.98683 6.69591 5.91357 6.66287 5.8626 6.60535L5.59467 6.3025C5.55477 6.2573 5.49725 6.23158 5.43709 6.23158C5.37692 6.23158 5.31941 6.25746 5.27951 6.3025L5.0496 6.56233C4.97432 6.64728 4.86631 6.69606 4.75268 6.69606H2.32147C2.3832 7.02479 2.487 7.33855 2.62837 7.63095H4.33651ZM5.57359 8.55745H4.59116C4.51417 8.55745 4.44091 8.52441 4.38994 8.46689L4.12201 8.16404C4.0821 8.11884 4.02459 8.09312 3.96442 8.09312C3.90426 8.09312 3.84675 8.119 3.80684 8.16404L3.57694 8.42387C3.50166 8.50882 3.39364 8.55761 3.28001 8.55761H3.26474C3.94915 9.29096 4.92378 9.74998 6.00596 9.74998C7.08815 9.74998 8.06262 9.29096 8.74719 8.55761H5.57359V8.55745Z",
709
+ fill: "currentColor"
710
+ }
711
+ )
645
712
  })
646
- });
713
+ );
647
714
  });
648
715
  SmallAptosLogo.displayName = "SmallAptosLogo";
649
716
 
@@ -663,19 +730,11 @@ var Link = createHeadlessComponent("AptosPrivacyPolicy.Disclaimer", "a", {
663
730
  children: "Privacy Policy"
664
731
  });
665
732
  var PoweredBy = forwardRef6(({ className }, ref) => {
666
- return /* @__PURE__ */ jsxs5("div", {
667
- ref,
668
- className,
669
- children: [
670
- /* @__PURE__ */ jsx8("span", {
671
- children: "Powered by"
672
- }),
673
- /* @__PURE__ */ jsx8(SmallAptosLogo, {}),
674
- /* @__PURE__ */ jsx8("span", {
675
- children: "Aptos Labs"
676
- })
677
- ]
678
- });
733
+ return /* @__PURE__ */ jsxs5("div", { ref, className, children: [
734
+ /* @__PURE__ */ jsx8("span", { children: "Powered by" }),
735
+ /* @__PURE__ */ jsx8(SmallAptosLogo, {}),
736
+ /* @__PURE__ */ jsx8("span", { children: "Aptos Labs" })
737
+ ] });
679
738
  });
680
739
  PoweredBy.displayName = "AptosPrivacyPolicy.PoweredBy";
681
740
  var AptosPrivacyPolicy = Object.assign(Root2, {
@@ -709,17 +768,9 @@ var Root3 = forwardRef7(
709
768
  }, [connect, wallet.name, onConnect]);
710
769
  const isWalletReady = wallet.readyState === WalletReadyState2.Installed;
711
770
  const mobileSupport = "deeplinkProvider" in wallet && wallet.deeplinkProvider;
712
- if (!isWalletReady && isRedirectable() && !mobileSupport)
713
- return null;
771
+ if (!isWalletReady && isRedirectable() && !mobileSupport) return null;
714
772
  const Component = asChild ? Slot2 : "div";
715
- return /* @__PURE__ */ jsx9(WalletItemContext.Provider, {
716
- value: { wallet, connectWallet },
717
- children: /* @__PURE__ */ jsx9(Component, {
718
- ref,
719
- className,
720
- children
721
- })
722
- });
773
+ return /* @__PURE__ */ jsx9(WalletItemContext.Provider, { value: { wallet, connectWallet }, children: /* @__PURE__ */ jsx9(Component, { ref, className, children }) });
723
774
  }
724
775
  );
725
776
  Root3.displayName = "WalletItem";