@naculus/connect-appkit-vue 0.7.0 → 0.8.0
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 +10 -0
- package/dist/index.cjs +588 -499
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -5
- package/dist/index.d.ts +22 -5
- package/dist/index.js +341 -248
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -209,6 +209,55 @@ function useAccounts(accounts) {
|
|
|
209
209
|
};
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
// src/useAuthorizations.ts
|
|
213
|
+
import {
|
|
214
|
+
listAuthorizations,
|
|
215
|
+
revokeListedAuthorization
|
|
216
|
+
} from "@naculus/connect-core";
|
|
217
|
+
import { onScopeDispose, shallowRef, unref, watch } from "vue";
|
|
218
|
+
function useAuthorizations({
|
|
219
|
+
managers
|
|
220
|
+
}) {
|
|
221
|
+
const entries = shallowRef([]);
|
|
222
|
+
const loading = shallowRef(false);
|
|
223
|
+
const error = shallowRef(null);
|
|
224
|
+
let generation = 0;
|
|
225
|
+
let disposed = false;
|
|
226
|
+
const refresh = async () => {
|
|
227
|
+
const own = ++generation;
|
|
228
|
+
loading.value = true;
|
|
229
|
+
error.value = null;
|
|
230
|
+
try {
|
|
231
|
+
const next = await listAuthorizations(unref(managers));
|
|
232
|
+
if (!disposed && own === generation) entries.value = next;
|
|
233
|
+
} catch (cause) {
|
|
234
|
+
if (!disposed && own === generation) {
|
|
235
|
+
error.value = cause instanceof Error ? cause : new Error("Failed to list authorizations");
|
|
236
|
+
}
|
|
237
|
+
} finally {
|
|
238
|
+
if (!disposed && own === generation) loading.value = false;
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
const stop = watch(() => unref(managers), refresh, { immediate: true });
|
|
242
|
+
onScopeDispose(() => {
|
|
243
|
+
disposed = true;
|
|
244
|
+
generation += 1;
|
|
245
|
+
stop();
|
|
246
|
+
});
|
|
247
|
+
const revoke = async (entry) => {
|
|
248
|
+
try {
|
|
249
|
+
const result = await revokeListedAuthorization(unref(managers), entry);
|
|
250
|
+
await refresh();
|
|
251
|
+
return result;
|
|
252
|
+
} catch (cause) {
|
|
253
|
+
const normalized = cause instanceof Error ? cause : new Error("Failed to revoke authorization");
|
|
254
|
+
if (!disposed) error.value = normalized;
|
|
255
|
+
throw normalized;
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
return { entries, loading, error, refresh, revoke };
|
|
259
|
+
}
|
|
260
|
+
|
|
212
261
|
// src/useNotification.ts
|
|
213
262
|
import {
|
|
214
263
|
addInAppNotification,
|
|
@@ -225,12 +274,12 @@ import {
|
|
|
225
274
|
import {
|
|
226
275
|
InAppChannel
|
|
227
276
|
} from "@naculus/connect-core";
|
|
228
|
-
import { computed as computed2, onScopeDispose, shallowRef, unref } from "vue";
|
|
277
|
+
import { computed as computed2, onScopeDispose as onScopeDispose2, shallowRef as shallowRef2, unref as unref2 } from "vue";
|
|
229
278
|
function useNotification(options = {}) {
|
|
230
|
-
const channel =
|
|
231
|
-
const storage =
|
|
232
|
-
const notifications =
|
|
233
|
-
const settings =
|
|
279
|
+
const channel = unref2(options.channel) ?? new InAppChannel();
|
|
280
|
+
const storage = unref2(options.storage) ?? createNotificationSettingsStorage();
|
|
281
|
+
const notifications = shallowRef2(channel.getHistory());
|
|
282
|
+
const settings = shallowRef2(
|
|
234
283
|
DEFAULT_NOTIFICATION_SETTINGS
|
|
235
284
|
);
|
|
236
285
|
const unreadCount = computed2(
|
|
@@ -256,7 +305,7 @@ function useNotification(options = {}) {
|
|
|
256
305
|
void channel.restore().then(() => {
|
|
257
306
|
if (!disposed) notifications.value = channel.getHistory();
|
|
258
307
|
});
|
|
259
|
-
|
|
308
|
+
onScopeDispose2(() => {
|
|
260
309
|
disposed = true;
|
|
261
310
|
channel.onNotification = void 0;
|
|
262
311
|
});
|
|
@@ -308,13 +357,13 @@ import { resolveSimulationEndpoint } from "@naculus/connect-appkit-core";
|
|
|
308
357
|
import {
|
|
309
358
|
SimulationManager
|
|
310
359
|
} from "@naculus/connect-core";
|
|
311
|
-
import { shallowRef as
|
|
360
|
+
import { shallowRef as shallowRef4, unref as unref3 } from "vue";
|
|
312
361
|
|
|
313
362
|
// src/internal/action-guard.ts
|
|
314
|
-
import { onScopeDispose as
|
|
363
|
+
import { onScopeDispose as onScopeDispose3, shallowRef as shallowRef3 } from "vue";
|
|
315
364
|
function useActionGuard() {
|
|
316
|
-
const busy =
|
|
317
|
-
const error =
|
|
365
|
+
const busy = shallowRef3(false);
|
|
366
|
+
const error = shallowRef3(null);
|
|
318
367
|
let active = 0;
|
|
319
368
|
let generation = 0;
|
|
320
369
|
let disposed = false;
|
|
@@ -355,24 +404,24 @@ function useActionGuard() {
|
|
|
355
404
|
disposed = true;
|
|
356
405
|
generation++;
|
|
357
406
|
};
|
|
358
|
-
|
|
407
|
+
onScopeDispose3(dispose);
|
|
359
408
|
return { busy, error, run, clearError, reset, invalidate, dispose };
|
|
360
409
|
}
|
|
361
410
|
|
|
362
411
|
// src/useSimulateTransfer.ts
|
|
363
412
|
function useSimulateTransfer(options = {}) {
|
|
364
413
|
const guard = useActionGuard();
|
|
365
|
-
const result =
|
|
366
|
-
const loading =
|
|
414
|
+
const result = shallowRef4(null);
|
|
415
|
+
const loading = shallowRef4(false);
|
|
367
416
|
let manager;
|
|
368
417
|
const simulate = async (tokenAddress, from, to, amount, callOptions) => {
|
|
369
418
|
loading.value = true;
|
|
370
419
|
return await guard.run(
|
|
371
420
|
async (commit) => {
|
|
372
|
-
const fallbackRpcUrl =
|
|
421
|
+
const fallbackRpcUrl = unref3(options.rpcUrl);
|
|
373
422
|
const endpoint = resolveSimulationEndpoint(
|
|
374
423
|
callOptions?.chainId,
|
|
375
|
-
|
|
424
|
+
unref3(options.chainId),
|
|
376
425
|
callOptions?.rpcUrl,
|
|
377
426
|
fallbackRpcUrl
|
|
378
427
|
);
|
|
@@ -416,11 +465,11 @@ function useSimulateTransfer(options = {}) {
|
|
|
416
465
|
import {
|
|
417
466
|
simulateTransactionPreview
|
|
418
467
|
} from "@naculus/connect-appkit-core";
|
|
419
|
-
import { onScopeDispose as
|
|
468
|
+
import { onScopeDispose as onScopeDispose4, shallowRef as shallowRef5, toValue as toValue2, unref as unref4, watch as watch2 } from "vue";
|
|
420
469
|
function useTransactionSimulation(tx, options = {}) {
|
|
421
470
|
const guard = useActionGuard();
|
|
422
|
-
const result =
|
|
423
|
-
const isSimulating =
|
|
471
|
+
const result = shallowRef5(void 0);
|
|
472
|
+
const isSimulating = shallowRef5(false);
|
|
424
473
|
let timer;
|
|
425
474
|
const simulate = async () => {
|
|
426
475
|
const transaction = toValue2(tx);
|
|
@@ -428,10 +477,10 @@ function useTransactionSimulation(tx, options = {}) {
|
|
|
428
477
|
return await guard.run(
|
|
429
478
|
async (commit) => {
|
|
430
479
|
const value = await simulateTransactionPreview(transaction, {
|
|
431
|
-
chainId:
|
|
432
|
-
currentChain:
|
|
433
|
-
publicClient:
|
|
434
|
-
evmAccount:
|
|
480
|
+
chainId: unref4(options.chainId),
|
|
481
|
+
currentChain: unref4(options.currentChain),
|
|
482
|
+
publicClient: unref4(options.publicClient),
|
|
483
|
+
evmAccount: unref4(options.evmAccount)
|
|
435
484
|
});
|
|
436
485
|
commit(() => {
|
|
437
486
|
result.value = value;
|
|
@@ -448,13 +497,13 @@ function useTransactionSimulation(tx, options = {}) {
|
|
|
448
497
|
}
|
|
449
498
|
);
|
|
450
499
|
};
|
|
451
|
-
|
|
500
|
+
watch2(
|
|
452
501
|
[
|
|
453
502
|
() => toValue2(tx),
|
|
454
|
-
() =>
|
|
455
|
-
() =>
|
|
456
|
-
() =>
|
|
457
|
-
() =>
|
|
503
|
+
() => unref4(options.chainId),
|
|
504
|
+
() => unref4(options.currentChain),
|
|
505
|
+
() => unref4(options.publicClient),
|
|
506
|
+
() => unref4(options.evmAccount)
|
|
458
507
|
],
|
|
459
508
|
([transaction]) => {
|
|
460
509
|
guard.invalidate();
|
|
@@ -476,7 +525,7 @@ function useTransactionSimulation(tx, options = {}) {
|
|
|
476
525
|
result.value = void 0;
|
|
477
526
|
isSimulating.value = false;
|
|
478
527
|
};
|
|
479
|
-
|
|
528
|
+
onScopeDispose4(() => {
|
|
480
529
|
if (timer) clearTimeout(timer);
|
|
481
530
|
});
|
|
482
531
|
return { result, isSimulating, error: guard.error, simulate, reset };
|
|
@@ -494,7 +543,7 @@ import {
|
|
|
494
543
|
parseUnits,
|
|
495
544
|
WalletError as WalletError2
|
|
496
545
|
} from "@naculus/connect-core";
|
|
497
|
-
import { onScopeDispose as
|
|
546
|
+
import { onScopeDispose as onScopeDispose5, shallowRef as shallowRef6, toValue as toValue3, unref as unref5, watch as watch3 } from "vue";
|
|
498
547
|
|
|
499
548
|
// src/erc20.ts
|
|
500
549
|
import {
|
|
@@ -519,11 +568,11 @@ function assertErc20Context(token, chainId, account, connected) {
|
|
|
519
568
|
function useERC20Transfer(options) {
|
|
520
569
|
const initialToken = toValue3(options.token);
|
|
521
570
|
const decimals = createDecimalsCache(initialToken, initialToken.decimals);
|
|
522
|
-
const isSending =
|
|
523
|
-
const error =
|
|
571
|
+
const isSending = shallowRef6(false);
|
|
572
|
+
const error = shallowRef6(null);
|
|
524
573
|
let generation = 0;
|
|
525
574
|
let disposed = false;
|
|
526
|
-
|
|
575
|
+
watch3(
|
|
527
576
|
[
|
|
528
577
|
() => toValue3(options.token).address,
|
|
529
578
|
() => toValue3(options.token).chainId,
|
|
@@ -532,7 +581,7 @@ function useERC20Transfer(options) {
|
|
|
532
581
|
() => toValue3(options.chainId),
|
|
533
582
|
() => toValue3(options.connected),
|
|
534
583
|
() => toValue3(options.publicClient),
|
|
535
|
-
() =>
|
|
584
|
+
() => unref5(options.sendTransaction)
|
|
536
585
|
],
|
|
537
586
|
() => {
|
|
538
587
|
generation++;
|
|
@@ -579,7 +628,7 @@ function useERC20Transfer(options) {
|
|
|
579
628
|
writeDecimals(decimals, token, precision);
|
|
580
629
|
}
|
|
581
630
|
const data = encodeErc20Transfer(to, parseUnits(amount, precision));
|
|
582
|
-
return await
|
|
631
|
+
return await unref5(options.sendTransaction)({
|
|
583
632
|
to: token.address,
|
|
584
633
|
data,
|
|
585
634
|
value: "0"
|
|
@@ -592,7 +641,7 @@ function useERC20Transfer(options) {
|
|
|
592
641
|
if (stillCurrent()) isSending.value = false;
|
|
593
642
|
}
|
|
594
643
|
};
|
|
595
|
-
|
|
644
|
+
onScopeDispose5(() => {
|
|
596
645
|
disposed = true;
|
|
597
646
|
generation++;
|
|
598
647
|
});
|
|
@@ -614,24 +663,24 @@ import {
|
|
|
614
663
|
} from "@naculus/connect-core";
|
|
615
664
|
import {
|
|
616
665
|
computed as computed3,
|
|
617
|
-
onScopeDispose as
|
|
618
|
-
shallowRef as
|
|
666
|
+
onScopeDispose as onScopeDispose6,
|
|
667
|
+
shallowRef as shallowRef7,
|
|
619
668
|
toValue as toValue4,
|
|
620
|
-
unref as
|
|
621
|
-
watch as
|
|
669
|
+
unref as unref6,
|
|
670
|
+
watch as watch4
|
|
622
671
|
} from "vue";
|
|
623
672
|
var MAX_UINT256 = (1n << 256n) - 1n;
|
|
624
673
|
function useERC20Approve(options) {
|
|
625
674
|
const initialToken = toValue4(options.token);
|
|
626
675
|
const decimals = createDecimalsCache2(initialToken, initialToken.decimals);
|
|
627
|
-
const allowanceRaw =
|
|
628
|
-
const isApproving =
|
|
629
|
-
const isFetchingAllowance =
|
|
630
|
-
const error =
|
|
676
|
+
const allowanceRaw = shallowRef7(null);
|
|
677
|
+
const isApproving = shallowRef7(false);
|
|
678
|
+
const isFetchingAllowance = shallowRef7(false);
|
|
679
|
+
const error = shallowRef7(null);
|
|
631
680
|
let generation = 0;
|
|
632
681
|
let allowanceGeneration = 0;
|
|
633
682
|
let disposed = false;
|
|
634
|
-
|
|
683
|
+
watch4(
|
|
635
684
|
[
|
|
636
685
|
() => toValue4(options.token).address,
|
|
637
686
|
() => toValue4(options.token).chainId,
|
|
@@ -641,7 +690,7 @@ function useERC20Approve(options) {
|
|
|
641
690
|
() => toValue4(options.chainId),
|
|
642
691
|
() => toValue4(options.connected),
|
|
643
692
|
() => toValue4(options.publicClient),
|
|
644
|
-
() =>
|
|
693
|
+
() => unref6(options.sendTransaction)
|
|
645
694
|
],
|
|
646
695
|
() => {
|
|
647
696
|
generation++;
|
|
@@ -715,7 +764,7 @@ function useERC20Approve(options) {
|
|
|
715
764
|
isApproving.value = true;
|
|
716
765
|
try {
|
|
717
766
|
const { token, spender } = context();
|
|
718
|
-
const hash = await
|
|
767
|
+
const hash = await unref6(options.sendTransaction)({
|
|
719
768
|
to: token.address,
|
|
720
769
|
data: encodeErc20Approve(spender, rawAmount),
|
|
721
770
|
value: "0"
|
|
@@ -762,7 +811,7 @@ function useERC20Approve(options) {
|
|
|
762
811
|
const precision = readDecimals2(decimals, token, token.decimals);
|
|
763
812
|
return precision === void 0 ? null : formatUnits(allowanceRaw.value, precision);
|
|
764
813
|
});
|
|
765
|
-
|
|
814
|
+
onScopeDispose6(() => {
|
|
766
815
|
disposed = true;
|
|
767
816
|
generation++;
|
|
768
817
|
allowanceGeneration++;
|
|
@@ -848,7 +897,7 @@ function useAccount(accounts, connected) {
|
|
|
848
897
|
}
|
|
849
898
|
|
|
850
899
|
// src/useSession.ts
|
|
851
|
-
import { computed as computed6, shallowRef as
|
|
900
|
+
import { computed as computed6, shallowRef as shallowRef8, toValue as toValue7, watch as watch5 } from "vue";
|
|
852
901
|
function readSession(manager) {
|
|
853
902
|
const bundle = manager?.getActiveBundle();
|
|
854
903
|
if (!bundle) {
|
|
@@ -867,8 +916,8 @@ function readSession(manager) {
|
|
|
867
916
|
};
|
|
868
917
|
}
|
|
869
918
|
function useSession(manager) {
|
|
870
|
-
const snapshot =
|
|
871
|
-
|
|
919
|
+
const snapshot = shallowRef8(readSession(toValue7(manager)));
|
|
920
|
+
watch5(
|
|
872
921
|
() => toValue7(manager),
|
|
873
922
|
(current, _previous, onCleanup) => {
|
|
874
923
|
const update = () => {
|
|
@@ -902,13 +951,13 @@ function useSession(manager) {
|
|
|
902
951
|
|
|
903
952
|
// src/useConnect.ts
|
|
904
953
|
import { WalletError as WalletError4 } from "@naculus/connect-core";
|
|
905
|
-
import { computed as computed7, toValue as toValue8, unref as
|
|
954
|
+
import { computed as computed7, toValue as toValue8, unref as unref7 } from "vue";
|
|
906
955
|
function useConnect(action, status) {
|
|
907
956
|
const guard = useActionGuard();
|
|
908
957
|
let inFlight = null;
|
|
909
958
|
const connect = () => {
|
|
910
959
|
if (inFlight) return inFlight;
|
|
911
|
-
const invoke =
|
|
960
|
+
const invoke = unref7(action);
|
|
912
961
|
const pending = guard.run(
|
|
913
962
|
() => Promise.resolve().then(() => invoke()),
|
|
914
963
|
"Connection failed",
|
|
@@ -933,14 +982,14 @@ function useConnect(action, status) {
|
|
|
933
982
|
}
|
|
934
983
|
|
|
935
984
|
// src/useDisconnect.ts
|
|
936
|
-
import { toValue as toValue9, unref as
|
|
985
|
+
import { toValue as toValue9, unref as unref8 } from "vue";
|
|
937
986
|
function useDisconnect(action, status) {
|
|
938
987
|
const guard = useActionGuard();
|
|
939
988
|
let inFlight = null;
|
|
940
989
|
const disconnect = () => {
|
|
941
990
|
if (inFlight) return inFlight;
|
|
942
991
|
if (toValue9(status) === "disconnected") return Promise.resolve();
|
|
943
|
-
const invoke =
|
|
992
|
+
const invoke = unref8(action);
|
|
944
993
|
const pending = guard.run(() => Promise.resolve().then(() => invoke()), "Disconnect failed").catch(() => {
|
|
945
994
|
}).finally(() => {
|
|
946
995
|
if (inFlight === pending) inFlight = null;
|
|
@@ -961,11 +1010,11 @@ function useDisconnect(action, status) {
|
|
|
961
1010
|
|
|
962
1011
|
// src/useSwitchChain.ts
|
|
963
1012
|
import { toChainSwitchError } from "@naculus/connect-appkit-core";
|
|
964
|
-
import { computed as computed8, toValue as toValue10, unref as
|
|
1013
|
+
import { computed as computed8, toValue as toValue10, unref as unref9 } from "vue";
|
|
965
1014
|
function useSwitchChain(action, chainId) {
|
|
966
1015
|
const guard = useActionGuard();
|
|
967
1016
|
const switchChain = (targetChainId) => {
|
|
968
|
-
const invoke =
|
|
1017
|
+
const invoke = unref9(action);
|
|
969
1018
|
return guard.run(async () => {
|
|
970
1019
|
try {
|
|
971
1020
|
await invoke(targetChainId);
|
|
@@ -984,11 +1033,11 @@ function useSwitchChain(action, chainId) {
|
|
|
984
1033
|
}
|
|
985
1034
|
|
|
986
1035
|
// src/useSignMessage.ts
|
|
987
|
-
import { unref as
|
|
1036
|
+
import { unref as unref10 } from "vue";
|
|
988
1037
|
function useSignMessage(action) {
|
|
989
1038
|
const guard = useActionGuard();
|
|
990
1039
|
const signMessage = (message) => {
|
|
991
|
-
const invoke =
|
|
1040
|
+
const invoke = unref10(action);
|
|
992
1041
|
return guard.run(() => invoke(message), "Signing failed");
|
|
993
1042
|
};
|
|
994
1043
|
return {
|
|
@@ -1000,12 +1049,12 @@ function useSignMessage(action) {
|
|
|
1000
1049
|
}
|
|
1001
1050
|
|
|
1002
1051
|
// src/useSendTransaction.ts
|
|
1003
|
-
import { computed as computed9, shallowRef as
|
|
1052
|
+
import { computed as computed9, shallowRef as shallowRef9, unref as unref11 } from "vue";
|
|
1004
1053
|
function useSendTransaction(action) {
|
|
1005
1054
|
const guard = useActionGuard();
|
|
1006
|
-
const status =
|
|
1055
|
+
const status = shallowRef9("idle");
|
|
1007
1056
|
const sendTransaction = (transaction) => {
|
|
1008
|
-
const invoke =
|
|
1057
|
+
const invoke = unref11(action);
|
|
1009
1058
|
status.value = "awaiting_approval";
|
|
1010
1059
|
return guard.run(async (commit) => {
|
|
1011
1060
|
const hash = await invoke(transaction);
|
|
@@ -1032,15 +1081,15 @@ function useSendTransaction(action) {
|
|
|
1032
1081
|
}
|
|
1033
1082
|
|
|
1034
1083
|
// src/useSolanaTransaction.ts
|
|
1035
|
-
import { shallowRef as
|
|
1084
|
+
import { shallowRef as shallowRef10, unref as unref12 } from "vue";
|
|
1036
1085
|
function useSolanaTransaction(options) {
|
|
1037
1086
|
const guard = useActionGuard();
|
|
1038
|
-
const isSigning =
|
|
1039
|
-
const isSending =
|
|
1087
|
+
const isSigning = shallowRef10(false);
|
|
1088
|
+
const isSending = shallowRef10(false);
|
|
1040
1089
|
let signing = 0;
|
|
1041
1090
|
let sending = 0;
|
|
1042
1091
|
const signTransaction = (transaction) => {
|
|
1043
|
-
const invoke =
|
|
1092
|
+
const invoke = unref12(options.signTransaction);
|
|
1044
1093
|
signing++;
|
|
1045
1094
|
isSigning.value = true;
|
|
1046
1095
|
return guard.run(() => invoke(transaction), "Signing failed").finally(() => {
|
|
@@ -1049,7 +1098,7 @@ function useSolanaTransaction(options) {
|
|
|
1049
1098
|
});
|
|
1050
1099
|
};
|
|
1051
1100
|
const sendTransaction = (transaction) => {
|
|
1052
|
-
const invoke =
|
|
1101
|
+
const invoke = unref12(options.sendTransaction);
|
|
1053
1102
|
sending++;
|
|
1054
1103
|
isSending.value = true;
|
|
1055
1104
|
return guard.run(() => invoke(transaction), "Send failed").finally(() => {
|
|
@@ -1057,7 +1106,7 @@ function useSolanaTransaction(options) {
|
|
|
1057
1106
|
isSending.value = sending > 0;
|
|
1058
1107
|
});
|
|
1059
1108
|
};
|
|
1060
|
-
const getStatus = (signature) =>
|
|
1109
|
+
const getStatus = (signature) => unref12(options.getStatus)(signature);
|
|
1061
1110
|
return {
|
|
1062
1111
|
signTransaction,
|
|
1063
1112
|
sendTransaction,
|
|
@@ -1070,12 +1119,12 @@ function useSolanaTransaction(options) {
|
|
|
1070
1119
|
}
|
|
1071
1120
|
|
|
1072
1121
|
// src/useSignInWithX.ts
|
|
1073
|
-
import { shallowRef as
|
|
1122
|
+
import { shallowRef as shallowRef11, unref as unref13 } from "vue";
|
|
1074
1123
|
function useSignInWithX(action) {
|
|
1075
1124
|
const guard = useActionGuard();
|
|
1076
|
-
const result =
|
|
1125
|
+
const result = shallowRef11(null);
|
|
1077
1126
|
const signIn = (options) => {
|
|
1078
|
-
const invoke =
|
|
1127
|
+
const invoke = unref13(action);
|
|
1079
1128
|
return guard.run(async (commit) => {
|
|
1080
1129
|
const next = await invoke(options);
|
|
1081
1130
|
commit(() => {
|
|
@@ -1104,17 +1153,17 @@ function useSignInWithEthereum(action) {
|
|
|
1104
1153
|
}
|
|
1105
1154
|
|
|
1106
1155
|
// src/useExecuteCalls.ts
|
|
1107
|
-
import { computed as computed10, toValue as toValue11, unref as
|
|
1156
|
+
import { computed as computed10, toValue as toValue11, unref as unref14 } from "vue";
|
|
1108
1157
|
function useExecuteCalls(options) {
|
|
1109
1158
|
const guard = useActionGuard();
|
|
1110
|
-
const preview = (callCount, atomicity) =>
|
|
1159
|
+
const preview = (callCount, atomicity) => unref14(options.preview)(callCount, atomicity);
|
|
1111
1160
|
const execute = (calls, atomicity) => {
|
|
1112
|
-
const invoke =
|
|
1161
|
+
const invoke = unref14(options.execute);
|
|
1113
1162
|
return guard.run(() => invoke(calls, atomicity), "Execution failed");
|
|
1114
1163
|
};
|
|
1115
1164
|
const reset = () => {
|
|
1116
1165
|
guard.reset();
|
|
1117
|
-
|
|
1166
|
+
unref14(options.reset)();
|
|
1118
1167
|
};
|
|
1119
1168
|
return {
|
|
1120
1169
|
preview,
|
|
@@ -1135,24 +1184,24 @@ import {
|
|
|
1135
1184
|
} from "@naculus/connect-appkit-core";
|
|
1136
1185
|
import {
|
|
1137
1186
|
computed as computed12,
|
|
1138
|
-
onScopeDispose as
|
|
1139
|
-
shallowRef as
|
|
1187
|
+
onScopeDispose as onScopeDispose8,
|
|
1188
|
+
shallowRef as shallowRef13,
|
|
1140
1189
|
toValue as toValue13,
|
|
1141
|
-
unref as
|
|
1142
|
-
watch as
|
|
1190
|
+
unref as unref15,
|
|
1191
|
+
watch as watch7
|
|
1143
1192
|
} from "vue";
|
|
1144
1193
|
|
|
1145
1194
|
// src/useSessionKeys.ts
|
|
1146
1195
|
import { getSharedSessionKeyManager } from "@naculus/connect-appkit-core";
|
|
1147
|
-
import { computed as computed11, onScopeDispose as
|
|
1196
|
+
import { computed as computed11, onScopeDispose as onScopeDispose7, shallowRef as shallowRef12, toValue as toValue12, watch as watch6 } from "vue";
|
|
1148
1197
|
function resolveManager(config, options) {
|
|
1149
1198
|
return options.manager ?? getSharedSessionKeyManager(config);
|
|
1150
1199
|
}
|
|
1151
1200
|
function useSessionKeys(connected, config, options = {}) {
|
|
1152
1201
|
const manager = resolveManager(config, options);
|
|
1153
|
-
const sessions =
|
|
1154
|
-
const loading =
|
|
1155
|
-
const error =
|
|
1202
|
+
const sessions = shallowRef12([]);
|
|
1203
|
+
const loading = shallowRef12(false);
|
|
1204
|
+
const error = shallowRef12(null);
|
|
1156
1205
|
let generation = 0;
|
|
1157
1206
|
let disposed = false;
|
|
1158
1207
|
const refresh = async () => {
|
|
@@ -1174,14 +1223,14 @@ function useSessionKeys(connected, config, options = {}) {
|
|
|
1174
1223
|
if (!disposed && own === generation) loading.value = false;
|
|
1175
1224
|
}
|
|
1176
1225
|
};
|
|
1177
|
-
|
|
1226
|
+
watch6(
|
|
1178
1227
|
() => toValue12(connected),
|
|
1179
1228
|
() => {
|
|
1180
1229
|
void refresh();
|
|
1181
1230
|
},
|
|
1182
1231
|
{ immediate: true }
|
|
1183
1232
|
);
|
|
1184
|
-
|
|
1233
|
+
onScopeDispose7(() => {
|
|
1185
1234
|
disposed = true;
|
|
1186
1235
|
generation++;
|
|
1187
1236
|
});
|
|
@@ -1202,7 +1251,7 @@ function useSessionKeys(connected, config, options = {}) {
|
|
|
1202
1251
|
function useCreateSessionKey(config, options = {}) {
|
|
1203
1252
|
const manager = resolveManager(config, options);
|
|
1204
1253
|
const guard = useActionGuard();
|
|
1205
|
-
const lastCreated =
|
|
1254
|
+
const lastCreated = shallowRef12(null);
|
|
1206
1255
|
return {
|
|
1207
1256
|
createSessionKey: (scope, signerAddress) => guard.run(async () => {
|
|
1208
1257
|
const info = await manager.createSessionKey(scope, signerAddress);
|
|
@@ -1253,9 +1302,9 @@ function useDelegationPolicy(options) {
|
|
|
1253
1302
|
manager
|
|
1254
1303
|
});
|
|
1255
1304
|
const guard = useActionGuard();
|
|
1256
|
-
const verifiedIds =
|
|
1257
|
-
const isVerifying =
|
|
1258
|
-
const verifyError =
|
|
1305
|
+
const verifiedIds = shallowRef13(/* @__PURE__ */ new Set());
|
|
1306
|
+
const isVerifying = shallowRef13(false);
|
|
1307
|
+
const verifyError = shallowRef13(null);
|
|
1259
1308
|
let verifyGeneration = 0;
|
|
1260
1309
|
let disposed = false;
|
|
1261
1310
|
const origin = options.origin ?? (typeof window !== "undefined" ? window.location.origin : "unknown");
|
|
@@ -1263,12 +1312,12 @@ function useDelegationPolicy(options) {
|
|
|
1263
1312
|
manager,
|
|
1264
1313
|
origin,
|
|
1265
1314
|
signer: () => bareEvmAddress2(toValue13(options.account)),
|
|
1266
|
-
signMessage: (message) =>
|
|
1267
|
-
verifySignature: (input) =>
|
|
1268
|
-
previewExecution: (callCount, atomicity) =>
|
|
1315
|
+
signMessage: (message) => unref15(options.signMessage)(message),
|
|
1316
|
+
verifySignature: (input) => unref15(options.verifySignature)(input),
|
|
1317
|
+
previewExecution: (callCount, atomicity) => unref15(options.previewExecution)(callCount, atomicity),
|
|
1269
1318
|
sponsorship: options.sponsorship,
|
|
1270
1319
|
adapter: options.adapter,
|
|
1271
|
-
signTypedData: options.signTypedData ? (typedData) =>
|
|
1320
|
+
signTypedData: options.signTypedData ? (typedData) => unref15(
|
|
1272
1321
|
options.signTypedData
|
|
1273
1322
|
)(typedData) : void 0,
|
|
1274
1323
|
chainId: () => toValue13(options.chainId) ?? null,
|
|
@@ -1277,7 +1326,7 @@ function useDelegationPolicy(options) {
|
|
|
1277
1326
|
storageAvailable: () => sessionKeys.storageAvailable,
|
|
1278
1327
|
refresh: sessionKeys.refresh
|
|
1279
1328
|
});
|
|
1280
|
-
|
|
1329
|
+
watch7(
|
|
1281
1330
|
() => sessionKeys.sessions.value,
|
|
1282
1331
|
(sessions) => {
|
|
1283
1332
|
const own = ++verifyGeneration;
|
|
@@ -1307,7 +1356,7 @@ function useDelegationPolicy(options) {
|
|
|
1307
1356
|
},
|
|
1308
1357
|
{ immediate: true }
|
|
1309
1358
|
);
|
|
1310
|
-
|
|
1359
|
+
onScopeDispose8(() => {
|
|
1311
1360
|
disposed = true;
|
|
1312
1361
|
verifyGeneration++;
|
|
1313
1362
|
});
|
|
@@ -1350,18 +1399,18 @@ import {
|
|
|
1350
1399
|
import { WalletError as WalletError5 } from "@naculus/connect-core";
|
|
1351
1400
|
import {
|
|
1352
1401
|
computed as computed13,
|
|
1353
|
-
onScopeDispose as
|
|
1354
|
-
shallowRef as
|
|
1402
|
+
onScopeDispose as onScopeDispose9,
|
|
1403
|
+
shallowRef as shallowRef14,
|
|
1355
1404
|
toValue as toValue14,
|
|
1356
|
-
unref as
|
|
1357
|
-
watch as
|
|
1405
|
+
unref as unref16,
|
|
1406
|
+
watch as watch8
|
|
1358
1407
|
} from "vue";
|
|
1359
1408
|
function useSmartAccount(options) {
|
|
1360
|
-
const address =
|
|
1361
|
-
const isDeployed =
|
|
1362
|
-
const accountInfo =
|
|
1409
|
+
const address = shallowRef14(null);
|
|
1410
|
+
const isDeployed = shallowRef14(false);
|
|
1411
|
+
const accountInfo = shallowRef14(null);
|
|
1363
1412
|
const guard = useActionGuard();
|
|
1364
|
-
const managerRef =
|
|
1413
|
+
const managerRef = shallowRef14(null);
|
|
1365
1414
|
let generation = 0;
|
|
1366
1415
|
let inFlight = false;
|
|
1367
1416
|
let disposed = false;
|
|
@@ -1371,7 +1420,7 @@ function useSmartAccount(options) {
|
|
|
1371
1420
|
toValue14(options.connectedChainId)
|
|
1372
1421
|
)
|
|
1373
1422
|
);
|
|
1374
|
-
|
|
1423
|
+
watch8(
|
|
1375
1424
|
[
|
|
1376
1425
|
() => toValue14(options.manager),
|
|
1377
1426
|
() => toValue14(options.rpcUrl),
|
|
@@ -1451,7 +1500,7 @@ function useSmartAccount(options) {
|
|
|
1451
1500
|
return info;
|
|
1452
1501
|
}, "Failed to create smart account");
|
|
1453
1502
|
const deployWallet = () => operate(async (manager, cfg, commit) => {
|
|
1454
|
-
const send =
|
|
1503
|
+
const send = unref16(options.sendTransaction);
|
|
1455
1504
|
if (!send) {
|
|
1456
1505
|
throw new WalletError5(
|
|
1457
1506
|
"wallet_unavailable",
|
|
@@ -1481,7 +1530,7 @@ function useSmartAccount(options) {
|
|
|
1481
1530
|
});
|
|
1482
1531
|
return addr;
|
|
1483
1532
|
}, "Failed to get smart account address");
|
|
1484
|
-
|
|
1533
|
+
onScopeDispose9(() => {
|
|
1485
1534
|
disposed = true;
|
|
1486
1535
|
generation++;
|
|
1487
1536
|
});
|
|
@@ -1505,13 +1554,13 @@ import {
|
|
|
1505
1554
|
resolveUserOpChain
|
|
1506
1555
|
} from "@naculus/connect-appkit-core";
|
|
1507
1556
|
import { WalletError as WalletError6 } from "@naculus/connect-core";
|
|
1508
|
-
import { onScopeDispose as
|
|
1557
|
+
import { onScopeDispose as onScopeDispose10, shallowRef as shallowRef15, toValue as toValue15, unref as unref17 } from "vue";
|
|
1509
1558
|
function useSendUserOperation(options) {
|
|
1510
|
-
const userOpHash =
|
|
1511
|
-
const receipt =
|
|
1512
|
-
const isPending =
|
|
1513
|
-
const isEstimating =
|
|
1514
|
-
const error =
|
|
1559
|
+
const userOpHash = shallowRef15(null);
|
|
1560
|
+
const receipt = shallowRef15(null);
|
|
1561
|
+
const isPending = shallowRef15(false);
|
|
1562
|
+
const isEstimating = shallowRef15(false);
|
|
1563
|
+
const error = shallowRef15(null);
|
|
1515
1564
|
let requestId = 0;
|
|
1516
1565
|
let inFlight = false;
|
|
1517
1566
|
let disposed = false;
|
|
@@ -1545,7 +1594,7 @@ function useSendUserOperation(options) {
|
|
|
1545
1594
|
} catch (chainError) {
|
|
1546
1595
|
return fail(chainError);
|
|
1547
1596
|
}
|
|
1548
|
-
const signer =
|
|
1597
|
+
const signer = unref17(options.signer);
|
|
1549
1598
|
const own = ++requestId;
|
|
1550
1599
|
inFlight = true;
|
|
1551
1600
|
isPending.value = true;
|
|
@@ -1596,7 +1645,7 @@ function useSendUserOperation(options) {
|
|
|
1596
1645
|
isEstimating.value = false;
|
|
1597
1646
|
error.value = null;
|
|
1598
1647
|
};
|
|
1599
|
-
|
|
1648
|
+
onScopeDispose10(() => {
|
|
1600
1649
|
disposed = true;
|
|
1601
1650
|
requestId++;
|
|
1602
1651
|
});
|
|
@@ -1616,15 +1665,15 @@ import {
|
|
|
1616
1665
|
fetchUserOperationReceipt,
|
|
1617
1666
|
InvalidUserOperationReceiptError
|
|
1618
1667
|
} from "@naculus/connect-appkit-core";
|
|
1619
|
-
import { onScopeDispose as
|
|
1668
|
+
import { onScopeDispose as onScopeDispose11, shallowRef as shallowRef16, toValue as toValue16 } from "vue";
|
|
1620
1669
|
function useUserOpStatus(options) {
|
|
1621
|
-
const status =
|
|
1622
|
-
const receipt =
|
|
1623
|
-
const userOpHash =
|
|
1624
|
-
const error =
|
|
1625
|
-
const isPolling =
|
|
1626
|
-
const elapsedMs =
|
|
1627
|
-
const attempts =
|
|
1670
|
+
const status = shallowRef16("idle");
|
|
1671
|
+
const receipt = shallowRef16(null);
|
|
1672
|
+
const userOpHash = shallowRef16(null);
|
|
1673
|
+
const error = shallowRef16(null);
|
|
1674
|
+
const isPolling = shallowRef16(false);
|
|
1675
|
+
const elapsedMs = shallowRef16(0);
|
|
1676
|
+
const attempts = shallowRef16(0);
|
|
1628
1677
|
const pollInterval = options.pollInterval ?? 2e3;
|
|
1629
1678
|
const maxRetries = options.maxRetries ?? 30;
|
|
1630
1679
|
let generation = 0;
|
|
@@ -1730,7 +1779,7 @@ function useUserOpStatus(options) {
|
|
|
1730
1779
|
attempts.value = 0;
|
|
1731
1780
|
elapsedMs.value = 0;
|
|
1732
1781
|
};
|
|
1733
|
-
|
|
1782
|
+
onScopeDispose11(stop);
|
|
1734
1783
|
return {
|
|
1735
1784
|
status,
|
|
1736
1785
|
receipt,
|
|
@@ -1746,17 +1795,17 @@ function useUserOpStatus(options) {
|
|
|
1746
1795
|
}
|
|
1747
1796
|
|
|
1748
1797
|
// src/useSendCalls.ts
|
|
1749
|
-
import { computed as computed14, onScopeDispose as
|
|
1798
|
+
import { computed as computed14, onScopeDispose as onScopeDispose12, shallowRef as shallowRef17, toValue as toValue17, unref as unref18 } from "vue";
|
|
1750
1799
|
function useSendCalls(options) {
|
|
1751
|
-
const status =
|
|
1752
|
-
const error =
|
|
1753
|
-
const batchHash =
|
|
1754
|
-
const callsStatus =
|
|
1800
|
+
const status = shallowRef17("idle");
|
|
1801
|
+
const error = shallowRef17(null);
|
|
1802
|
+
const batchHash = shallowRef17(null);
|
|
1803
|
+
const callsStatus = shallowRef17(null);
|
|
1755
1804
|
let sendGeneration = 0;
|
|
1756
1805
|
let statusGeneration = 0;
|
|
1757
1806
|
let disposed = false;
|
|
1758
1807
|
const sendCalls = async (calls, input) => {
|
|
1759
|
-
const invoke =
|
|
1808
|
+
const invoke = unref18(options.sendCalls);
|
|
1760
1809
|
const own = ++sendGeneration;
|
|
1761
1810
|
status.value = "awaiting_approval";
|
|
1762
1811
|
error.value = null;
|
|
@@ -1778,13 +1827,13 @@ function useSendCalls(options) {
|
|
|
1778
1827
|
}
|
|
1779
1828
|
};
|
|
1780
1829
|
const getCallsStatus = async (hash) => {
|
|
1781
|
-
const invoke =
|
|
1830
|
+
const invoke = unref18(options.getCallsStatus);
|
|
1782
1831
|
const own = ++statusGeneration;
|
|
1783
1832
|
const result = await invoke(hash);
|
|
1784
1833
|
if (!disposed && own === statusGeneration) callsStatus.value = result;
|
|
1785
1834
|
return result;
|
|
1786
1835
|
};
|
|
1787
|
-
const showCallsStatus = (hash) =>
|
|
1836
|
+
const showCallsStatus = (hash) => unref18(options.showCallsStatus)(hash);
|
|
1788
1837
|
const reset = () => {
|
|
1789
1838
|
sendGeneration++;
|
|
1790
1839
|
statusGeneration++;
|
|
@@ -1793,7 +1842,7 @@ function useSendCalls(options) {
|
|
|
1793
1842
|
batchHash.value = null;
|
|
1794
1843
|
callsStatus.value = null;
|
|
1795
1844
|
};
|
|
1796
|
-
|
|
1845
|
+
onScopeDispose12(() => {
|
|
1797
1846
|
disposed = true;
|
|
1798
1847
|
sendGeneration++;
|
|
1799
1848
|
statusGeneration++;
|
|
@@ -1813,7 +1862,7 @@ function useSendCalls(options) {
|
|
|
1813
1862
|
}
|
|
1814
1863
|
|
|
1815
1864
|
// src/useEmbeddedWallet.ts
|
|
1816
|
-
import { computed as computed15, toValue as toValue18, unref as
|
|
1865
|
+
import { computed as computed15, toValue as toValue18, unref as unref19 } from "vue";
|
|
1817
1866
|
function useEmbeddedWallet(options) {
|
|
1818
1867
|
const guard = useActionGuard();
|
|
1819
1868
|
const run = (action) => guard.run(action, "Embedded wallet action failed");
|
|
@@ -1827,17 +1876,17 @@ function useEmbeddedWallet(options) {
|
|
|
1827
1876
|
backupPending: computed15(() => toValue18(options.backupPending)),
|
|
1828
1877
|
storageSecurityLevel: computed15(() => toValue18(options.storageSecurityLevel)),
|
|
1829
1878
|
securityReport: computed15(() => toValue18(options.securityReport)),
|
|
1830
|
-
connectEmbedded: () => run(() =>
|
|
1831
|
-
restoreWallet: () => run(() =>
|
|
1832
|
-
generateWallet: () => run(() =>
|
|
1833
|
-
importFromMnemonic: (value) => run(() =>
|
|
1834
|
-
importFromPrivateKey: (value) => run(() =>
|
|
1835
|
-
wipe: () => run(() =>
|
|
1836
|
-
setActiveNamespace: (value) =>
|
|
1837
|
-
backfillAccounts: () => run(() =>
|
|
1838
|
-
getSeedPhrase: () =>
|
|
1839
|
-
getPrivateKey: () =>
|
|
1840
|
-
confirmBackup: () =>
|
|
1879
|
+
connectEmbedded: () => run(() => unref19(options.connectEmbedded)()),
|
|
1880
|
+
restoreWallet: () => run(() => unref19(options.restoreWallet)()),
|
|
1881
|
+
generateWallet: () => run(() => unref19(options.generateWallet)()),
|
|
1882
|
+
importFromMnemonic: (value) => run(() => unref19(options.importFromMnemonic)(value)),
|
|
1883
|
+
importFromPrivateKey: (value) => run(() => unref19(options.importFromPrivateKey)(value)),
|
|
1884
|
+
wipe: () => run(() => unref19(options.wipe)()),
|
|
1885
|
+
setActiveNamespace: (value) => unref19(options.setActiveNamespace)(value),
|
|
1886
|
+
backfillAccounts: () => run(() => unref19(options.backfillAccounts)()),
|
|
1887
|
+
getSeedPhrase: () => unref19(options.getSeedPhrase)(),
|
|
1888
|
+
getPrivateKey: () => unref19(options.getPrivateKey)(),
|
|
1889
|
+
confirmBackup: () => unref19(options.confirmBackup)(),
|
|
1841
1890
|
isBusy: guard.busy,
|
|
1842
1891
|
error: guard.error,
|
|
1843
1892
|
clearError: guard.clearError
|
|
@@ -1856,7 +1905,7 @@ function useSIWxLogin(action) {
|
|
|
1856
1905
|
}
|
|
1857
1906
|
|
|
1858
1907
|
// src/useSIWxSession.ts
|
|
1859
|
-
import { computed as computed16, toValue as toValue19, unref as
|
|
1908
|
+
import { computed as computed16, toValue as toValue19, unref as unref20 } from "vue";
|
|
1860
1909
|
function useSIWxSession(options) {
|
|
1861
1910
|
const guard = useActionGuard();
|
|
1862
1911
|
return {
|
|
@@ -1868,25 +1917,25 @@ function useSIWxSession(options) {
|
|
|
1868
1917
|
isSigningIn: guard.busy,
|
|
1869
1918
|
isExpired: computed16(() => toValue19(options.isExpired)),
|
|
1870
1919
|
timeUntilExpiry: computed16(() => toValue19(options.timeUntilExpiry)),
|
|
1871
|
-
signIn: (input) => guard.run(() =>
|
|
1920
|
+
signIn: (input) => guard.run(() => unref20(options.signIn)(input), "SIWX sign-in failed"),
|
|
1872
1921
|
signOut: async () => {
|
|
1873
|
-
await
|
|
1922
|
+
await unref20(options.signOut)();
|
|
1874
1923
|
guard.clearError();
|
|
1875
1924
|
},
|
|
1876
|
-
refresh: () => guard.run(() =>
|
|
1925
|
+
refresh: () => guard.run(() => unref20(options.refresh)(), "Session refresh failed"),
|
|
1877
1926
|
error: guard.error,
|
|
1878
1927
|
clearError: guard.clearError
|
|
1879
1928
|
};
|
|
1880
1929
|
}
|
|
1881
1930
|
|
|
1882
1931
|
// src/useSiwxAuthSession.ts
|
|
1883
|
-
import { computed as computed17, toValue as toValue20, unref as
|
|
1932
|
+
import { computed as computed17, toValue as toValue20, unref as unref21 } from "vue";
|
|
1884
1933
|
function useSiwxAuthSession(options) {
|
|
1885
1934
|
const guard = useActionGuard();
|
|
1886
|
-
const signIn = (input) => guard.run(() =>
|
|
1935
|
+
const signIn = (input) => guard.run(() => unref21(options.signIn)(input), "SIWX sign-in failed");
|
|
1887
1936
|
const signOut = async () => {
|
|
1888
1937
|
guard.reset();
|
|
1889
|
-
await
|
|
1938
|
+
await unref21(options.signOut)();
|
|
1890
1939
|
guard.clearError();
|
|
1891
1940
|
};
|
|
1892
1941
|
const siwxResult = computed17(() => toValue20(options.result));
|
|
@@ -1905,11 +1954,11 @@ function useSiwxAuthSession(options) {
|
|
|
1905
1954
|
// src/useBalance.ts
|
|
1906
1955
|
import { bareEvmAddress as bareEvmAddress5 } from "@naculus/connect-appkit-core";
|
|
1907
1956
|
import { formatUnits as formatUnits2 } from "@naculus/connect-core";
|
|
1908
|
-
import { computed as computed18, onScopeDispose as
|
|
1957
|
+
import { computed as computed18, onScopeDispose as onScopeDispose13, shallowRef as shallowRef18, toValue as toValue21, watch as watch9 } from "vue";
|
|
1909
1958
|
function useBalance(account, client, options = {}) {
|
|
1910
1959
|
const guard = useActionGuard();
|
|
1911
|
-
const balance =
|
|
1912
|
-
const isFetching =
|
|
1960
|
+
const balance = shallowRef18(null);
|
|
1961
|
+
const isFetching = shallowRef18(false);
|
|
1913
1962
|
let timer = null;
|
|
1914
1963
|
const refetch = async () => {
|
|
1915
1964
|
const reader = toValue21(client);
|
|
@@ -1949,7 +1998,7 @@ function useBalance(account, client, options = {}) {
|
|
|
1949
1998
|
if (timer) clearInterval(timer);
|
|
1950
1999
|
timer = null;
|
|
1951
2000
|
};
|
|
1952
|
-
|
|
2001
|
+
watch9(
|
|
1953
2002
|
[
|
|
1954
2003
|
() => toValue21(account),
|
|
1955
2004
|
() => toValue21(client),
|
|
@@ -1962,7 +2011,7 @@ function useBalance(account, client, options = {}) {
|
|
|
1962
2011
|
},
|
|
1963
2012
|
{ immediate: true }
|
|
1964
2013
|
);
|
|
1965
|
-
|
|
2014
|
+
onScopeDispose13(stopTimer);
|
|
1966
2015
|
return {
|
|
1967
2016
|
balance,
|
|
1968
2017
|
formatted: computed18(
|
|
@@ -1979,11 +2028,11 @@ function useBalance(account, client, options = {}) {
|
|
|
1979
2028
|
import {
|
|
1980
2029
|
isQuotableInput
|
|
1981
2030
|
} from "@naculus/connect-appkit-core";
|
|
1982
|
-
import { onScopeDispose as
|
|
2031
|
+
import { onScopeDispose as onScopeDispose14, shallowRef as shallowRef19, toValue as toValue22, unref as unref22, watch as watch10 } from "vue";
|
|
1983
2032
|
function useRouteQuote(input, getQuotes, options = {}) {
|
|
1984
2033
|
const guard = useActionGuard();
|
|
1985
|
-
const quotes =
|
|
1986
|
-
const loading =
|
|
2034
|
+
const quotes = shallowRef19([]);
|
|
2035
|
+
const loading = shallowRef19(false);
|
|
1987
2036
|
let timer = null;
|
|
1988
2037
|
const clearTimer = () => {
|
|
1989
2038
|
if (timer) clearTimeout(timer);
|
|
@@ -1996,7 +2045,7 @@ function useRouteQuote(input, getQuotes, options = {}) {
|
|
|
1996
2045
|
quotes.value = [];
|
|
1997
2046
|
return null;
|
|
1998
2047
|
}
|
|
1999
|
-
const fn =
|
|
2048
|
+
const fn = unref22(getQuotes);
|
|
2000
2049
|
if (!fn) {
|
|
2001
2050
|
guard.invalidate();
|
|
2002
2051
|
loading.value = false;
|
|
@@ -2040,14 +2089,14 @@ function useRouteQuote(input, getQuotes, options = {}) {
|
|
|
2040
2089
|
).catch(() => {
|
|
2041
2090
|
});
|
|
2042
2091
|
};
|
|
2043
|
-
|
|
2092
|
+
watch10(
|
|
2044
2093
|
[
|
|
2045
2094
|
() => toValue22(input).fromChain,
|
|
2046
2095
|
() => toValue22(input).toChain,
|
|
2047
2096
|
() => toValue22(input).fromToken,
|
|
2048
2097
|
() => toValue22(input).toToken,
|
|
2049
2098
|
() => toValue22(input).amount,
|
|
2050
|
-
() =>
|
|
2099
|
+
() => unref22(getQuotes)
|
|
2051
2100
|
],
|
|
2052
2101
|
() => {
|
|
2053
2102
|
clearTimer();
|
|
@@ -2060,7 +2109,7 @@ function useRouteQuote(input, getQuotes, options = {}) {
|
|
|
2060
2109
|
},
|
|
2061
2110
|
{ immediate: true }
|
|
2062
2111
|
);
|
|
2063
|
-
|
|
2112
|
+
onScopeDispose14(clearTimer);
|
|
2064
2113
|
return {
|
|
2065
2114
|
quotes,
|
|
2066
2115
|
loading,
|
|
@@ -2079,14 +2128,14 @@ function useRouteQuote(input, getQuotes, options = {}) {
|
|
|
2079
2128
|
import {
|
|
2080
2129
|
compareCostsKey
|
|
2081
2130
|
} from "@naculus/connect-appkit-core";
|
|
2082
|
-
import { shallowRef as
|
|
2131
|
+
import { shallowRef as shallowRef20, toValue as toValue23, unref as unref23, watch as watch11 } from "vue";
|
|
2083
2132
|
function useCompareCosts(input, compareCosts) {
|
|
2084
2133
|
const guard = useActionGuard();
|
|
2085
|
-
const comparisons =
|
|
2086
|
-
const loading =
|
|
2134
|
+
const comparisons = shallowRef20([]);
|
|
2135
|
+
const loading = shallowRef20(false);
|
|
2087
2136
|
const fetchComparisons = async () => {
|
|
2088
2137
|
const { operation, chains, options } = toValue23(input);
|
|
2089
|
-
const fn =
|
|
2138
|
+
const fn = unref23(compareCosts);
|
|
2090
2139
|
if (!chains || chains.length === 0) {
|
|
2091
2140
|
guard.invalidate();
|
|
2092
2141
|
loading.value = false;
|
|
@@ -2123,8 +2172,8 @@ function useCompareCosts(input, compareCosts) {
|
|
|
2123
2172
|
).catch(() => {
|
|
2124
2173
|
});
|
|
2125
2174
|
};
|
|
2126
|
-
|
|
2127
|
-
[() => compareCostsKey(toValue23(input)), () =>
|
|
2175
|
+
watch11(
|
|
2176
|
+
[() => compareCostsKey(toValue23(input)), () => unref23(compareCosts)],
|
|
2128
2177
|
() => {
|
|
2129
2178
|
void fetchComparisons();
|
|
2130
2179
|
},
|
|
@@ -2143,15 +2192,15 @@ import {
|
|
|
2143
2192
|
toExecuteRouteError,
|
|
2144
2193
|
validateRouteRecipient
|
|
2145
2194
|
} from "@naculus/connect-appkit-core";
|
|
2146
|
-
import { onScopeDispose as
|
|
2195
|
+
import { onScopeDispose as onScopeDispose15, shallowRef as shallowRef21, unref as unref24 } from "vue";
|
|
2147
2196
|
function useExecuteRoute(executeRoute) {
|
|
2148
|
-
const executing =
|
|
2149
|
-
const result =
|
|
2150
|
-
const error =
|
|
2197
|
+
const executing = shallowRef21(false);
|
|
2198
|
+
const result = shallowRef21(null);
|
|
2199
|
+
const error = shallowRef21(null);
|
|
2151
2200
|
let inFlight = false;
|
|
2152
2201
|
let disposed = false;
|
|
2153
2202
|
const execute = async (quote, recipient, options) => {
|
|
2154
|
-
const fn =
|
|
2203
|
+
const fn = unref24(executeRoute);
|
|
2155
2204
|
if (!fn) {
|
|
2156
2205
|
error.value = {
|
|
2157
2206
|
code: "no_executor",
|
|
@@ -2189,7 +2238,7 @@ function useExecuteRoute(executeRoute) {
|
|
|
2189
2238
|
if (!disposed) executing.value = false;
|
|
2190
2239
|
}
|
|
2191
2240
|
};
|
|
2192
|
-
|
|
2241
|
+
onScopeDispose15(() => {
|
|
2193
2242
|
disposed = true;
|
|
2194
2243
|
});
|
|
2195
2244
|
return {
|
|
@@ -2210,15 +2259,15 @@ import { eip155ChainIdToNumber } from "@naculus/connect-appkit-core";
|
|
|
2210
2259
|
import {
|
|
2211
2260
|
TokenListManager
|
|
2212
2261
|
} from "@naculus/connect-core";
|
|
2213
|
-
import { shallowRef as
|
|
2262
|
+
import { shallowRef as shallowRef22, toValue as toValue24, watch as watch12 } from "vue";
|
|
2214
2263
|
function useTokenList(chainId, options = {}) {
|
|
2215
2264
|
const config = {};
|
|
2216
2265
|
if (options.sources) config.sources = options.sources;
|
|
2217
2266
|
const manager = options.manager ?? new TokenListManager(config);
|
|
2218
2267
|
const guard = useActionGuard();
|
|
2219
|
-
const tokens =
|
|
2220
|
-
const isLoading =
|
|
2221
|
-
const isLoaded =
|
|
2268
|
+
const tokens = shallowRef22([]);
|
|
2269
|
+
const isLoading = shallowRef22(options.autoLoad !== false);
|
|
2270
|
+
const isLoaded = shallowRef22(false);
|
|
2222
2271
|
const select = () => {
|
|
2223
2272
|
const id = toValue24(chainId);
|
|
2224
2273
|
const numeric = id ? eip155ChainIdToNumber(id) : void 0;
|
|
@@ -2246,7 +2295,7 @@ function useTokenList(chainId, options = {}) {
|
|
|
2246
2295
|
).catch(() => {
|
|
2247
2296
|
});
|
|
2248
2297
|
};
|
|
2249
|
-
|
|
2298
|
+
watch12(
|
|
2250
2299
|
() => toValue24(chainId),
|
|
2251
2300
|
() => {
|
|
2252
2301
|
if (options.autoLoad !== false) void run(() => manager.load());
|
|
@@ -2267,7 +2316,7 @@ import { eip155ChainIdToNumber as eip155ChainIdToNumber2 } from "@naculus/connec
|
|
|
2267
2316
|
import {
|
|
2268
2317
|
TokenListManager as TokenListManager2
|
|
2269
2318
|
} from "@naculus/connect-core";
|
|
2270
|
-
import { onScopeDispose as
|
|
2319
|
+
import { onScopeDispose as onScopeDispose16, shallowRef as shallowRef23, toValue as toValue25, watch as watch13 } from "vue";
|
|
2271
2320
|
var DEBOUNCE_MS = 300;
|
|
2272
2321
|
var EMPTY = { exact: [], fuzzy: [], hasMore: false };
|
|
2273
2322
|
var sharedManager = null;
|
|
@@ -2280,14 +2329,14 @@ function getSharedManager() {
|
|
|
2280
2329
|
return sharedManager;
|
|
2281
2330
|
}
|
|
2282
2331
|
function useTokenSearch(query, chainId, options = {}) {
|
|
2283
|
-
const results =
|
|
2284
|
-
const isSearching =
|
|
2332
|
+
const results = shallowRef23(EMPTY);
|
|
2333
|
+
const isSearching = shallowRef23(false);
|
|
2285
2334
|
let timer = null;
|
|
2286
2335
|
const clear = () => {
|
|
2287
2336
|
if (timer) clearTimeout(timer);
|
|
2288
2337
|
timer = null;
|
|
2289
2338
|
};
|
|
2290
|
-
|
|
2339
|
+
watch13(
|
|
2291
2340
|
[() => (toValue25(query) ?? "").trim(), () => toValue25(chainId)],
|
|
2292
2341
|
([q, id]) => {
|
|
2293
2342
|
clear();
|
|
@@ -2310,7 +2359,7 @@ function useTokenSearch(query, chainId, options = {}) {
|
|
|
2310
2359
|
},
|
|
2311
2360
|
{ immediate: true }
|
|
2312
2361
|
);
|
|
2313
|
-
|
|
2362
|
+
onScopeDispose16(clear);
|
|
2314
2363
|
return { results, isSearching };
|
|
2315
2364
|
}
|
|
2316
2365
|
|
|
@@ -2328,14 +2377,14 @@ function useValidateDestination(address) {
|
|
|
2328
2377
|
// src/useTokenBalance.ts
|
|
2329
2378
|
import { bareEvmAddress as bareEvmAddress6 } from "@naculus/connect-appkit-core";
|
|
2330
2379
|
import { ERC20_MIN_ABI as ERC20_MIN_ABI3, formatUnits as formatUnits3 } from "@naculus/connect-core";
|
|
2331
|
-
import { onScopeDispose as
|
|
2380
|
+
import { onScopeDispose as onScopeDispose17, shallowRef as shallowRef24, toValue as toValue27, watch as watch14 } from "vue";
|
|
2332
2381
|
function tokensKey(tokens) {
|
|
2333
2382
|
return tokens.map((t) => `${t.address.toLowerCase()}|${t.decimals}|${t.symbol}`).join(",");
|
|
2334
2383
|
}
|
|
2335
2384
|
function useTokenBalance(account, client, tokens, options = {}) {
|
|
2336
2385
|
const guard = useActionGuard();
|
|
2337
|
-
const tokenBalances =
|
|
2338
|
-
const isFetching =
|
|
2386
|
+
const tokenBalances = shallowRef24([]);
|
|
2387
|
+
const isFetching = shallowRef24(false);
|
|
2339
2388
|
let timer = null;
|
|
2340
2389
|
const refetch = async () => {
|
|
2341
2390
|
const reader = toValue27(client);
|
|
@@ -2395,7 +2444,7 @@ function useTokenBalance(account, client, tokens, options = {}) {
|
|
|
2395
2444
|
if (timer) clearInterval(timer);
|
|
2396
2445
|
timer = null;
|
|
2397
2446
|
};
|
|
2398
|
-
|
|
2447
|
+
watch14(
|
|
2399
2448
|
[
|
|
2400
2449
|
() => toValue27(account),
|
|
2401
2450
|
() => toValue27(client),
|
|
@@ -2409,7 +2458,7 @@ function useTokenBalance(account, client, tokens, options = {}) {
|
|
|
2409
2458
|
},
|
|
2410
2459
|
{ immediate: true }
|
|
2411
2460
|
);
|
|
2412
|
-
|
|
2461
|
+
onScopeDispose17(stopTimer);
|
|
2413
2462
|
return {
|
|
2414
2463
|
tokenBalances,
|
|
2415
2464
|
isFetching,
|
|
@@ -2429,11 +2478,11 @@ import {
|
|
|
2429
2478
|
REVOKE_DELEGATE,
|
|
2430
2479
|
WalletError as WalletError7
|
|
2431
2480
|
} from "@naculus/connect-core";
|
|
2432
|
-
import { onScopeDispose as
|
|
2481
|
+
import { onScopeDispose as onScopeDispose18, shallowRef as shallowRef25, toValue as toValue28, watch as watch15 } from "vue";
|
|
2433
2482
|
function useDelegate(options) {
|
|
2434
|
-
const result =
|
|
2435
|
-
const isPending =
|
|
2436
|
-
const error =
|
|
2483
|
+
const result = shallowRef25(null);
|
|
2484
|
+
const isPending = shallowRef25(false);
|
|
2485
|
+
const error = shallowRef25(null);
|
|
2437
2486
|
let requestId = 0;
|
|
2438
2487
|
let inFlight = false;
|
|
2439
2488
|
let disposed = false;
|
|
@@ -2495,7 +2544,7 @@ function useDelegate(options) {
|
|
|
2495
2544
|
isPending.value = false;
|
|
2496
2545
|
error.value = null;
|
|
2497
2546
|
};
|
|
2498
|
-
|
|
2547
|
+
watch15(
|
|
2499
2548
|
[
|
|
2500
2549
|
() => toValue28(options.session),
|
|
2501
2550
|
() => toValue28(options.account),
|
|
@@ -2504,7 +2553,7 @@ function useDelegate(options) {
|
|
|
2504
2553
|
reset,
|
|
2505
2554
|
{ flush: "sync" }
|
|
2506
2555
|
);
|
|
2507
|
-
|
|
2556
|
+
onScopeDispose18(() => {
|
|
2508
2557
|
disposed = true;
|
|
2509
2558
|
requestId++;
|
|
2510
2559
|
});
|
|
@@ -2524,11 +2573,11 @@ import {
|
|
|
2524
2573
|
readDelegation,
|
|
2525
2574
|
UNKNOWN_DELEGATION
|
|
2526
2575
|
} from "@naculus/connect-core";
|
|
2527
|
-
import { computed as computed20, shallowRef as
|
|
2576
|
+
import { computed as computed20, shallowRef as shallowRef26, toValue as toValue29, watch as watch16 } from "vue";
|
|
2528
2577
|
function useDelegation(account, client, chainId) {
|
|
2529
2578
|
const guard = useActionGuard();
|
|
2530
|
-
const status =
|
|
2531
|
-
const isFetching =
|
|
2579
|
+
const status = shallowRef26(UNKNOWN_DELEGATION);
|
|
2580
|
+
const isFetching = shallowRef26(false);
|
|
2532
2581
|
const refetch = async () => {
|
|
2533
2582
|
const reader = toValue29(client);
|
|
2534
2583
|
const address = bareEvmAddress8(toValue29(account));
|
|
@@ -2563,7 +2612,7 @@ function useDelegation(account, client, chainId) {
|
|
|
2563
2612
|
).catch(() => {
|
|
2564
2613
|
});
|
|
2565
2614
|
};
|
|
2566
|
-
|
|
2615
|
+
watch16(
|
|
2567
2616
|
[() => toValue29(account), () => toValue29(client), () => toValue29(chainId)],
|
|
2568
2617
|
() => {
|
|
2569
2618
|
void refetch();
|
|
@@ -2581,23 +2630,65 @@ function useDelegation(account, client, chainId) {
|
|
|
2581
2630
|
|
|
2582
2631
|
// src/usePaymentFetch.ts
|
|
2583
2632
|
import {
|
|
2633
|
+
applySettlementVerification,
|
|
2634
|
+
DEFAULT_VERIFY_RETRY,
|
|
2584
2635
|
describePayment
|
|
2585
2636
|
} from "@naculus/connect-appkit-core";
|
|
2586
|
-
import { onScopeDispose as
|
|
2587
|
-
function usePaymentFetch(pay) {
|
|
2637
|
+
import { onScopeDispose as onScopeDispose19, shallowRef as shallowRef27, unref as unref25 } from "vue";
|
|
2638
|
+
function usePaymentFetch(pay, options = {}) {
|
|
2588
2639
|
const guard = useActionGuard();
|
|
2589
|
-
const lastPayment =
|
|
2640
|
+
const lastPayment = shallowRef27(null);
|
|
2590
2641
|
let epoch = 0;
|
|
2591
|
-
|
|
2642
|
+
let verification = 0;
|
|
2643
|
+
onScopeDispose19(() => {
|
|
2592
2644
|
epoch++;
|
|
2645
|
+
verification++;
|
|
2593
2646
|
});
|
|
2594
2647
|
const payFetch = (input, init) => {
|
|
2595
|
-
const invoke =
|
|
2648
|
+
const invoke = unref25(pay);
|
|
2596
2649
|
const own = epoch;
|
|
2597
2650
|
return guard.run(async () => {
|
|
2598
2651
|
const result = await invoke(input, init);
|
|
2599
|
-
|
|
2600
|
-
if (payment && own === epoch)
|
|
2652
|
+
let payment = describePayment(input, result);
|
|
2653
|
+
if (payment && own === epoch) {
|
|
2654
|
+
const verify = options.verify;
|
|
2655
|
+
if (!verify) {
|
|
2656
|
+
lastPayment.value = payment;
|
|
2657
|
+
} else {
|
|
2658
|
+
payment = applySettlementVerification(payment, { status: "pending" });
|
|
2659
|
+
lastPayment.value = payment;
|
|
2660
|
+
const verificationOwn = ++verification;
|
|
2661
|
+
const retry = options.verifyRetry ?? DEFAULT_VERIFY_RETRY;
|
|
2662
|
+
void Promise.resolve().then(async () => {
|
|
2663
|
+
let outcome = { status: "pending" };
|
|
2664
|
+
for (let attempt = 0; attempt < retry.attempts; attempt += 1) {
|
|
2665
|
+
if (attempt > 0) {
|
|
2666
|
+
await new Promise(
|
|
2667
|
+
(resolve) => setTimeout(resolve, retry.delayMs)
|
|
2668
|
+
);
|
|
2669
|
+
}
|
|
2670
|
+
if (own !== epoch || verificationOwn !== verification) return;
|
|
2671
|
+
try {
|
|
2672
|
+
outcome = await verify(result);
|
|
2673
|
+
} catch (cause) {
|
|
2674
|
+
outcome = {
|
|
2675
|
+
status: "unavailable",
|
|
2676
|
+
reason: cause instanceof Error ? cause.message : "Settlement verification failed"
|
|
2677
|
+
};
|
|
2678
|
+
}
|
|
2679
|
+
if (outcome.status !== "pending") break;
|
|
2680
|
+
}
|
|
2681
|
+
if (own === epoch && verificationOwn === verification) {
|
|
2682
|
+
const current = lastPayment.value;
|
|
2683
|
+
if (current)
|
|
2684
|
+
lastPayment.value = applySettlementVerification(
|
|
2685
|
+
current,
|
|
2686
|
+
outcome
|
|
2687
|
+
);
|
|
2688
|
+
}
|
|
2689
|
+
});
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2601
2692
|
return result;
|
|
2602
2693
|
}, "Paid request failed");
|
|
2603
2694
|
};
|
|
@@ -2608,6 +2699,7 @@ function usePaymentFetch(pay) {
|
|
|
2608
2699
|
error: guard.error,
|
|
2609
2700
|
reset: () => {
|
|
2610
2701
|
epoch++;
|
|
2702
|
+
verification++;
|
|
2611
2703
|
guard.reset();
|
|
2612
2704
|
lastPayment.value = null;
|
|
2613
2705
|
}
|
|
@@ -2620,23 +2712,23 @@ import {
|
|
|
2620
2712
|
readMppRecoveryChannelId,
|
|
2621
2713
|
readMppSessionReceipt
|
|
2622
2714
|
} from "@naculus/connect-appkit-core";
|
|
2623
|
-
import { onScopeDispose as
|
|
2715
|
+
import { onScopeDispose as onScopeDispose20, shallowRef as shallowRef28, unref as unref26, watch as watch17 } from "vue";
|
|
2624
2716
|
function useMppSession(session) {
|
|
2625
|
-
const current = () =>
|
|
2626
|
-
const pending =
|
|
2627
|
-
const channel =
|
|
2717
|
+
const current = () => unref26(session);
|
|
2718
|
+
const pending = shallowRef28(current().meter.pending);
|
|
2719
|
+
const channel = shallowRef28(
|
|
2628
2720
|
readCurrentMppSessionChannel(current())
|
|
2629
2721
|
);
|
|
2630
|
-
const lastReceipt =
|
|
2631
|
-
const recoveryChannelId =
|
|
2632
|
-
const isPending =
|
|
2633
|
-
const error =
|
|
2722
|
+
const lastReceipt = shallowRef28(null);
|
|
2723
|
+
const recoveryChannelId = shallowRef28(null);
|
|
2724
|
+
const isPending = shallowRef28(false);
|
|
2725
|
+
const error = shallowRef28(null);
|
|
2634
2726
|
let active = 0;
|
|
2635
2727
|
let generation = 0;
|
|
2636
2728
|
let epoch = 0;
|
|
2637
2729
|
let disposed = false;
|
|
2638
|
-
|
|
2639
|
-
() =>
|
|
2730
|
+
watch17(
|
|
2731
|
+
() => unref26(session),
|
|
2640
2732
|
(value) => {
|
|
2641
2733
|
generation++;
|
|
2642
2734
|
epoch++;
|
|
@@ -2650,7 +2742,7 @@ function useMppSession(session) {
|
|
|
2650
2742
|
},
|
|
2651
2743
|
{ flush: "sync" }
|
|
2652
2744
|
);
|
|
2653
|
-
|
|
2745
|
+
onScopeDispose20(() => {
|
|
2654
2746
|
disposed = true;
|
|
2655
2747
|
generation++;
|
|
2656
2748
|
epoch++;
|
|
@@ -2749,14 +2841,14 @@ function useMppSession(session) {
|
|
|
2749
2841
|
import {
|
|
2750
2842
|
createSolanaSessionKeyFlow
|
|
2751
2843
|
} from "@naculus/connect-appkit-core";
|
|
2752
|
-
import { onScopeDispose as
|
|
2844
|
+
import { onScopeDispose as onScopeDispose21, shallowRef as shallowRef29, unref as unref27, watch as watch18 } from "vue";
|
|
2753
2845
|
function useSolanaSessionKey(deps) {
|
|
2754
2846
|
const guard = useActionGuard();
|
|
2755
|
-
const keys =
|
|
2847
|
+
const keys = shallowRef29([]);
|
|
2756
2848
|
let flow = null;
|
|
2757
2849
|
let generation = 0;
|
|
2758
2850
|
let disposed = false;
|
|
2759
|
-
|
|
2851
|
+
onScopeDispose21(() => {
|
|
2760
2852
|
disposed = true;
|
|
2761
2853
|
});
|
|
2762
2854
|
const refresh = async () => {
|
|
@@ -2764,8 +2856,8 @@ function useSolanaSessionKey(deps) {
|
|
|
2764
2856
|
const next = flow ? await flow.list() : [];
|
|
2765
2857
|
if (!disposed && own === generation) keys.value = next;
|
|
2766
2858
|
};
|
|
2767
|
-
|
|
2768
|
-
() =>
|
|
2859
|
+
watch18(
|
|
2860
|
+
() => unref27(deps),
|
|
2769
2861
|
(next) => {
|
|
2770
2862
|
flow = next ? createSolanaSessionKeyFlow(next) : null;
|
|
2771
2863
|
guard.invalidate();
|
|
@@ -2799,11 +2891,11 @@ function useSolanaSessionKey(deps) {
|
|
|
2799
2891
|
|
|
2800
2892
|
// src/name-lookup.ts
|
|
2801
2893
|
import { getResolver } from "@naculus/connect-appkit-core";
|
|
2802
|
-
import { computed as computed21, shallowRef as
|
|
2894
|
+
import { computed as computed21, shallowRef as shallowRef30, toValue as toValue30, watch as watch19 } from "vue";
|
|
2803
2895
|
function useNameLookup(options) {
|
|
2804
2896
|
const guard = useActionGuard();
|
|
2805
|
-
const data =
|
|
2806
|
-
const loading =
|
|
2897
|
+
const data = shallowRef30(null);
|
|
2898
|
+
const loading = shallowRef30(false);
|
|
2807
2899
|
const run = () => {
|
|
2808
2900
|
const input = toValue30(options.input).trim();
|
|
2809
2901
|
const skip = toValue30(options.skip) ?? false;
|
|
@@ -2843,7 +2935,7 @@ function useNameLookup(options) {
|
|
|
2843
2935
|
).catch(() => {
|
|
2844
2936
|
});
|
|
2845
2937
|
};
|
|
2846
|
-
|
|
2938
|
+
watch19(
|
|
2847
2939
|
() => [
|
|
2848
2940
|
toValue30(options.input),
|
|
2849
2941
|
toValue30(options.skip),
|
|
@@ -2931,13 +3023,13 @@ function useChain(chains, chainId) {
|
|
|
2931
3023
|
}
|
|
2932
3024
|
|
|
2933
3025
|
// src/usePassphraseGate.ts
|
|
2934
|
-
import { onScopeDispose as
|
|
3026
|
+
import { onScopeDispose as onScopeDispose22, readonly, shallowRef as shallowRef31 } from "vue";
|
|
2935
3027
|
function usePassphraseGate(gate) {
|
|
2936
|
-
const request =
|
|
3028
|
+
const request = shallowRef31(gate.getSnapshot());
|
|
2937
3029
|
const unsubscribe = gate.subscribe(() => {
|
|
2938
3030
|
request.value = gate.getSnapshot();
|
|
2939
3031
|
});
|
|
2940
|
-
|
|
3032
|
+
onScopeDispose22(unsubscribe);
|
|
2941
3033
|
return {
|
|
2942
3034
|
request: readonly(request),
|
|
2943
3035
|
submit: (passphrase) => gate.submit(passphrase),
|
|
@@ -2948,10 +3040,10 @@ function usePassphraseGate(gate) {
|
|
|
2948
3040
|
|
|
2949
3041
|
// src/useSolanaBalance.ts
|
|
2950
3042
|
import { getSolanaBalance } from "@naculus/connect-core";
|
|
2951
|
-
import { ref, shallowRef as
|
|
3043
|
+
import { ref, shallowRef as shallowRef32, toValue as toValue33, watchEffect } from "vue";
|
|
2952
3044
|
function useSolanaBalance(address, rpcUrl) {
|
|
2953
3045
|
const guard = useActionGuard();
|
|
2954
|
-
const balance =
|
|
3046
|
+
const balance = shallowRef32(null);
|
|
2955
3047
|
const isFetching = ref(false);
|
|
2956
3048
|
const refetch = async () => {
|
|
2957
3049
|
const addr = toValue33(address);
|
|
@@ -2996,12 +3088,12 @@ function useSolanaBalance(address, rpcUrl) {
|
|
|
2996
3088
|
}
|
|
2997
3089
|
|
|
2998
3090
|
// src/useLastTx.ts
|
|
2999
|
-
import { shallowRef as
|
|
3091
|
+
import { shallowRef as shallowRef33, toValue as toValue34, watch as watch20 } from "vue";
|
|
3000
3092
|
function useLastTx(monitor) {
|
|
3001
|
-
const lastTx =
|
|
3002
|
-
const lastConfirmedTx =
|
|
3003
|
-
const lastFailedTx =
|
|
3004
|
-
|
|
3093
|
+
const lastTx = shallowRef33(null);
|
|
3094
|
+
const lastConfirmedTx = shallowRef33(null);
|
|
3095
|
+
const lastFailedTx = shallowRef33(null);
|
|
3096
|
+
watch20(
|
|
3005
3097
|
() => toValue34(monitor),
|
|
3006
3098
|
(activeMonitor, _previous, onCleanup) => {
|
|
3007
3099
|
if (!activeMonitor) return;
|
|
@@ -3040,11 +3132,11 @@ function useLastTx(monitor) {
|
|
|
3040
3132
|
}
|
|
3041
3133
|
|
|
3042
3134
|
// src/useTxHistory.ts
|
|
3043
|
-
import { computed as computed24, shallowRef as
|
|
3135
|
+
import { computed as computed24, shallowRef as shallowRef34, toValue as toValue35, watch as watch21 } from "vue";
|
|
3044
3136
|
function useTxHistory(address, chainId, monitor) {
|
|
3045
3137
|
const guard = useActionGuard();
|
|
3046
|
-
const entries =
|
|
3047
|
-
const isLoading =
|
|
3138
|
+
const entries = shallowRef34([]);
|
|
3139
|
+
const isLoading = shallowRef34(false);
|
|
3048
3140
|
const refresh = async () => {
|
|
3049
3141
|
const activeMonitor = toValue35(monitor);
|
|
3050
3142
|
if (!activeMonitor) {
|
|
@@ -3074,7 +3166,7 @@ function useTxHistory(address, chainId, monitor) {
|
|
|
3074
3166
|
).catch(() => {
|
|
3075
3167
|
});
|
|
3076
3168
|
};
|
|
3077
|
-
|
|
3169
|
+
watch21(
|
|
3078
3170
|
[() => toValue35(monitor), () => toValue35(address), () => toValue35(chainId)],
|
|
3079
3171
|
([activeMonitor], _previous, onCleanup) => {
|
|
3080
3172
|
if (!activeMonitor) {
|
|
@@ -3104,11 +3196,11 @@ function useTxHistory(address, chainId, monitor) {
|
|
|
3104
3196
|
}
|
|
3105
3197
|
|
|
3106
3198
|
// src/useTxMonitor.ts
|
|
3107
|
-
import { computed as computed25, shallowRef as
|
|
3199
|
+
import { computed as computed25, shallowRef as shallowRef35, toValue as toValue36, watch as watch22 } from "vue";
|
|
3108
3200
|
function useTxMonitor(hash, chainId, monitor) {
|
|
3109
|
-
const entry =
|
|
3110
|
-
const isLoading =
|
|
3111
|
-
const isWatching =
|
|
3201
|
+
const entry = shallowRef35(null);
|
|
3202
|
+
const isLoading = shallowRef35(false);
|
|
3203
|
+
const isWatching = shallowRef35(false);
|
|
3112
3204
|
const guard = useActionGuard();
|
|
3113
3205
|
const error = guard.error;
|
|
3114
3206
|
let generation = 0;
|
|
@@ -3165,7 +3257,7 @@ function useTxMonitor(hash, chainId, monitor) {
|
|
|
3165
3257
|
activeMonitor.stopWatching(activeHash, activeChainId ?? void 0);
|
|
3166
3258
|
isWatching.value = false;
|
|
3167
3259
|
};
|
|
3168
|
-
|
|
3260
|
+
watch22(
|
|
3169
3261
|
[() => toValue36(monitor), () => toValue36(hash), () => toValue36(chainId)],
|
|
3170
3262
|
([activeMonitor, activeHash, activeChainId], _previous, onCleanup) => {
|
|
3171
3263
|
const mine = ++generation;
|
|
@@ -3223,13 +3315,13 @@ import {
|
|
|
3223
3315
|
normalizeCapabilities,
|
|
3224
3316
|
selectChainCapabilities
|
|
3225
3317
|
} from "@naculus/connect-appkit-core";
|
|
3226
|
-
import { computed as computed26, shallowRef as
|
|
3318
|
+
import { computed as computed26, shallowRef as shallowRef36, toValue as toValue37, watchEffect as watchEffect2 } from "vue";
|
|
3227
3319
|
function useCapabilities(client, session, chainId) {
|
|
3228
3320
|
const guard = useActionGuard();
|
|
3229
|
-
const capabilities =
|
|
3321
|
+
const capabilities = shallowRef36(
|
|
3230
3322
|
null
|
|
3231
3323
|
);
|
|
3232
|
-
const isFetching =
|
|
3324
|
+
const isFetching = shallowRef36(false);
|
|
3233
3325
|
const refetch = async () => {
|
|
3234
3326
|
const activeClient = toValue37(client);
|
|
3235
3327
|
const activeSession = toValue37(session);
|
|
@@ -3331,6 +3423,7 @@ export {
|
|
|
3331
3423
|
AppkitTooltip,
|
|
3332
3424
|
useAccount,
|
|
3333
3425
|
useAccounts,
|
|
3426
|
+
useAuthorizations,
|
|
3334
3427
|
useBalance,
|
|
3335
3428
|
useCapabilities,
|
|
3336
3429
|
useChain,
|