@naculus/connect-appkit-vue 0.2.6 → 0.2.8

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.cjs CHANGED
@@ -66,6 +66,7 @@ __export(index_exports, {
66
66
  useCompareCosts: () => useCompareCosts,
67
67
  useConnect: () => useConnect,
68
68
  useCreateSessionKey: () => useCreateSessionKey,
69
+ useDelegate: () => useDelegate,
69
70
  useDelegation: () => useDelegation,
70
71
  useDelegationPolicy: () => useDelegationPolicy,
71
72
  useDisconnect: () => useDisconnect,
@@ -886,10 +887,14 @@ function useSession(manager) {
886
887
  current.on("sessionConnected", update);
887
888
  current.on("sessionDisconnected", update);
888
889
  current.on("chainChanged", update);
890
+ current.on("sessionScopeChanged", update);
891
+ current.on("sessionRevoked", update);
889
892
  onCleanup(() => {
890
893
  current.off("sessionConnected", update);
891
894
  current.off("sessionDisconnected", update);
892
895
  current.off("chainChanged", update);
896
+ current.off("sessionScopeChanged", update);
897
+ current.off("sessionRevoked", update);
893
898
  });
894
899
  },
895
900
  { immediate: true }
@@ -905,266 +910,228 @@ function useSession(manager) {
905
910
 
906
911
  // src/useConnect.ts
907
912
  var import_connect_core8 = require("@naculus/connect-core");
913
+ var import_vue11 = require("vue");
914
+
915
+ // src/internal/action-guard.ts
908
916
  var import_vue10 = require("vue");
909
- function useConnect(action, status) {
910
- const isLoading = (0, import_vue10.shallowRef)(false);
917
+ function useActionGuard() {
918
+ const busy = (0, import_vue10.shallowRef)(false);
911
919
  const error = (0, import_vue10.shallowRef)(null);
920
+ let active = 0;
921
+ let generation = 0;
912
922
  let disposed = false;
923
+ const run = async (action, fallbackMessage, normalizeError) => {
924
+ const own = ++generation;
925
+ const commit = (write) => {
926
+ if (!disposed && own === generation) write();
927
+ };
928
+ active++;
929
+ busy.value = true;
930
+ error.value = null;
931
+ try {
932
+ return await action(commit);
933
+ } catch (cause) {
934
+ const normalized = normalizeError ? normalizeError(cause) : cause instanceof Error ? cause : new Error(fallbackMessage);
935
+ if (!disposed && own === generation) error.value = normalized;
936
+ throw normalized;
937
+ } finally {
938
+ active--;
939
+ if (!disposed) busy.value = active > 0;
940
+ }
941
+ };
942
+ const reset = () => {
943
+ generation++;
944
+ error.value = null;
945
+ };
946
+ const clearError = () => {
947
+ error.value = null;
948
+ };
949
+ const dispose = () => {
950
+ disposed = true;
951
+ generation++;
952
+ };
953
+ (0, import_vue10.onScopeDispose)(dispose);
954
+ return { busy, error, run, clearError, reset, dispose };
955
+ }
956
+
957
+ // src/useConnect.ts
958
+ function useConnect(action, status) {
959
+ const guard = useActionGuard();
913
960
  let inFlight = null;
914
961
  const connect = () => {
915
962
  if (inFlight) return inFlight;
916
- const invoke = (0, import_vue10.unref)(action);
917
- isLoading.value = true;
918
- error.value = null;
919
- const pending = Promise.resolve().then(() => invoke()).catch((cause) => {
920
- if (disposed) return;
921
- const message = cause instanceof Error ? cause.message : "Connection failed";
922
- error.value = cause instanceof import_connect_core8.WalletError ? cause : new Error(message);
963
+ const invoke = (0, import_vue11.unref)(action);
964
+ const pending = guard.run(
965
+ () => Promise.resolve().then(() => invoke()),
966
+ "Connection failed",
967
+ (cause) => {
968
+ const message = cause instanceof Error ? cause.message : "Connection failed";
969
+ return cause instanceof import_connect_core8.WalletError ? cause : new Error(message);
970
+ }
971
+ ).catch(() => {
923
972
  }).finally(() => {
924
973
  if (inFlight === pending) inFlight = null;
925
- if (!disposed) isLoading.value = false;
926
974
  });
927
975
  inFlight = pending;
928
976
  return pending;
929
977
  };
930
- (0, import_vue10.onScopeDispose)(() => {
931
- disposed = true;
932
- });
933
978
  return {
934
979
  connect,
935
- isConnecting: (0, import_vue10.computed)(
936
- () => isLoading.value || (0, import_vue10.toValue)(status) === "connecting"
980
+ isConnecting: (0, import_vue11.computed)(
981
+ () => guard.busy.value || (0, import_vue11.toValue)(status) === "connecting"
937
982
  ),
938
- error
983
+ error: guard.error
939
984
  };
940
985
  }
941
986
 
942
987
  // src/useDisconnect.ts
943
- var import_vue11 = require("vue");
988
+ var import_vue12 = require("vue");
944
989
  function useDisconnect(action, status) {
945
- const isDisconnecting = (0, import_vue11.shallowRef)(false);
946
- const error = (0, import_vue11.shallowRef)(null);
947
- let disposed = false;
990
+ const guard = useActionGuard();
948
991
  let inFlight = null;
949
992
  const disconnect = () => {
950
993
  if (inFlight) return inFlight;
951
- if ((0, import_vue11.toValue)(status) === "disconnected") return Promise.resolve();
952
- const invoke = (0, import_vue11.unref)(action);
953
- isDisconnecting.value = true;
954
- error.value = null;
955
- const pending = Promise.resolve().then(() => invoke()).catch((cause) => {
956
- if (!disposed) {
957
- error.value = cause instanceof Error ? cause : new Error("Disconnect failed");
958
- }
994
+ if ((0, import_vue12.toValue)(status) === "disconnected") return Promise.resolve();
995
+ const invoke = (0, import_vue12.unref)(action);
996
+ const pending = guard.run(() => Promise.resolve().then(() => invoke()), "Disconnect failed").catch(() => {
959
997
  }).finally(() => {
960
998
  if (inFlight === pending) inFlight = null;
961
- if (!disposed) isDisconnecting.value = false;
962
999
  });
963
1000
  inFlight = pending;
964
1001
  return pending;
965
1002
  };
966
1003
  const cleanup = () => {
967
- disposed = true;
1004
+ guard.dispose();
1005
+ };
1006
+ return {
1007
+ disconnect,
1008
+ isDisconnecting: guard.busy,
1009
+ error: guard.error,
1010
+ cleanup
968
1011
  };
969
- (0, import_vue11.onScopeDispose)(cleanup);
970
- return { disconnect, isDisconnecting, error, cleanup };
971
1012
  }
972
1013
 
973
1014
  // src/useSwitchChain.ts
974
1015
  var import_connect_appkit_core8 = require("@naculus/connect-appkit-core");
975
- var import_vue12 = require("vue");
1016
+ var import_vue13 = require("vue");
976
1017
  function useSwitchChain(action, chainId) {
977
- const isSwitching = (0, import_vue12.shallowRef)(false);
978
- const error = (0, import_vue12.shallowRef)(null);
979
- let generation = 0;
980
- let active = 0;
981
- let disposed = false;
982
- const switchChain = async (targetChainId) => {
983
- const invoke = (0, import_vue12.unref)(action);
984
- const mine = ++generation;
985
- active++;
986
- isSwitching.value = true;
987
- error.value = null;
988
- try {
989
- await invoke(targetChainId);
990
- } catch (cause) {
991
- const walletError = (0, import_connect_appkit_core8.toChainSwitchError)(cause);
992
- if (!disposed && mine === generation) error.value = walletError;
993
- throw walletError;
994
- } finally {
995
- active--;
996
- if (!disposed) isSwitching.value = active > 0;
997
- }
1018
+ const guard = useActionGuard();
1019
+ const switchChain = (targetChainId) => {
1020
+ const invoke = (0, import_vue13.unref)(action);
1021
+ return guard.run(async () => {
1022
+ try {
1023
+ await invoke(targetChainId);
1024
+ } catch (cause) {
1025
+ throw (0, import_connect_appkit_core8.toChainSwitchError)(cause);
1026
+ }
1027
+ }, "Failed to switch chain");
998
1028
  };
999
- (0, import_vue12.onScopeDispose)(() => {
1000
- disposed = true;
1001
- generation++;
1002
- });
1003
1029
  return {
1004
1030
  switchChain,
1005
- isSwitching,
1006
- currentChainId: (0, import_vue12.computed)(() => (0, import_vue12.toValue)(chainId) ?? null),
1007
- error,
1008
- clearError: () => {
1009
- error.value = null;
1010
- }
1031
+ isSwitching: guard.busy,
1032
+ currentChainId: (0, import_vue13.computed)(() => (0, import_vue13.toValue)(chainId) ?? null),
1033
+ error: guard.error,
1034
+ clearError: guard.clearError
1011
1035
  };
1012
1036
  }
1013
1037
 
1014
1038
  // src/useSignMessage.ts
1015
- var import_vue13 = require("vue");
1039
+ var import_vue14 = require("vue");
1016
1040
  function useSignMessage(action) {
1017
- const isSigning = (0, import_vue13.shallowRef)(false);
1018
- const error = (0, import_vue13.shallowRef)(null);
1019
- let active = 0;
1020
- let generation = 0;
1021
- let disposed = false;
1022
- const signMessage = async (message) => {
1023
- const invoke = (0, import_vue13.unref)(action);
1024
- const own = ++generation;
1025
- active++;
1026
- isSigning.value = true;
1027
- error.value = null;
1028
- try {
1029
- return await invoke(message);
1030
- } catch (cause) {
1031
- const normalized = cause instanceof Error ? cause : new Error("Signing failed");
1032
- if (!disposed && own === generation) error.value = normalized;
1033
- throw normalized;
1034
- } finally {
1035
- active--;
1036
- if (!disposed) isSigning.value = active > 0;
1037
- }
1041
+ const guard = useActionGuard();
1042
+ const signMessage = (message) => {
1043
+ const invoke = (0, import_vue14.unref)(action);
1044
+ return guard.run(() => invoke(message), "Signing failed");
1038
1045
  };
1039
- const reset = () => {
1040
- generation++;
1041
- error.value = null;
1046
+ return {
1047
+ signMessage,
1048
+ isSigning: guard.busy,
1049
+ error: guard.error,
1050
+ reset: guard.reset
1042
1051
  };
1043
- (0, import_vue13.onScopeDispose)(() => {
1044
- disposed = true;
1045
- generation++;
1046
- });
1047
- return { signMessage, isSigning, error, reset };
1048
1052
  }
1049
1053
 
1050
1054
  // src/useSendTransaction.ts
1051
- var import_vue14 = require("vue");
1055
+ var import_vue15 = require("vue");
1052
1056
  function useSendTransaction(action) {
1053
- const status = (0, import_vue14.shallowRef)("idle");
1054
- const error = (0, import_vue14.shallowRef)(null);
1055
- let generation = 0;
1056
- let disposed = false;
1057
- const sendTransaction = async (transaction) => {
1058
- const invoke = (0, import_vue14.unref)(action);
1059
- const own = ++generation;
1057
+ const guard = useActionGuard();
1058
+ const status = (0, import_vue15.shallowRef)("idle");
1059
+ const sendTransaction = (transaction) => {
1060
+ const invoke = (0, import_vue15.unref)(action);
1060
1061
  status.value = "awaiting_approval";
1061
- error.value = null;
1062
- try {
1062
+ return guard.run(async (commit) => {
1063
1063
  const hash = await invoke(transaction);
1064
- if (!disposed && own === generation) status.value = "submitted";
1064
+ commit(() => {
1065
+ status.value = "submitted";
1066
+ });
1065
1067
  return hash;
1066
- } catch (cause) {
1067
- const normalized = cause instanceof Error ? cause : new Error("Transaction failed");
1068
- if (!disposed && own === generation) {
1069
- status.value = "failed";
1070
- error.value = normalized;
1071
- }
1072
- throw normalized;
1073
- }
1068
+ }, "Transaction failed").catch((cause) => {
1069
+ if (guard.error.value === cause) status.value = "failed";
1070
+ throw cause;
1071
+ });
1074
1072
  };
1075
1073
  const reset = () => {
1076
- generation++;
1074
+ guard.reset();
1077
1075
  status.value = "idle";
1078
- error.value = null;
1079
1076
  };
1080
- (0, import_vue14.onScopeDispose)(() => {
1081
- disposed = true;
1082
- generation++;
1083
- });
1084
1077
  return {
1085
1078
  sendTransaction,
1086
1079
  status,
1087
- error,
1080
+ error: guard.error,
1088
1081
  reset,
1089
- isSending: (0, import_vue14.computed)(() => status.value === "awaiting_approval")
1082
+ isSending: (0, import_vue15.computed)(() => status.value === "awaiting_approval")
1090
1083
  };
1091
1084
  }
1092
1085
 
1093
1086
  // src/useSolanaTransaction.ts
1094
- var import_vue15 = require("vue");
1087
+ var import_vue16 = require("vue");
1095
1088
  function useSolanaTransaction(options) {
1096
- const isSigning = (0, import_vue15.shallowRef)(false);
1097
- const isSending = (0, import_vue15.shallowRef)(false);
1098
- const error = (0, import_vue15.shallowRef)(null);
1089
+ const guard = useActionGuard();
1090
+ const isSigning = (0, import_vue16.shallowRef)(false);
1091
+ const isSending = (0, import_vue16.shallowRef)(false);
1099
1092
  let signing = 0;
1100
1093
  let sending = 0;
1101
- let generation = 0;
1102
- let disposed = false;
1103
- const signTransaction = async (transaction) => {
1104
- const invoke = (0, import_vue15.unref)(options.signTransaction);
1105
- const own = ++generation;
1094
+ const signTransaction = (transaction) => {
1095
+ const invoke = (0, import_vue16.unref)(options.signTransaction);
1106
1096
  signing++;
1107
1097
  isSigning.value = true;
1108
- error.value = null;
1109
- try {
1110
- return await invoke(transaction);
1111
- } catch (cause) {
1112
- const normalized = cause instanceof Error ? cause : new Error("Signing failed");
1113
- if (!disposed && own === generation) error.value = normalized;
1114
- throw normalized;
1115
- } finally {
1098
+ return guard.run(() => invoke(transaction), "Signing failed").finally(() => {
1116
1099
  signing--;
1117
- if (!disposed) isSigning.value = signing > 0;
1118
- }
1100
+ isSigning.value = signing > 0;
1101
+ });
1119
1102
  };
1120
- const sendTransaction = async (transaction) => {
1121
- const invoke = (0, import_vue15.unref)(options.sendTransaction);
1122
- const own = ++generation;
1103
+ const sendTransaction = (transaction) => {
1104
+ const invoke = (0, import_vue16.unref)(options.sendTransaction);
1123
1105
  sending++;
1124
1106
  isSending.value = true;
1125
- error.value = null;
1126
- try {
1127
- return await invoke(transaction);
1128
- } catch (cause) {
1129
- const normalized = cause instanceof Error ? cause : new Error("Send failed");
1130
- if (!disposed && own === generation) error.value = normalized;
1131
- throw normalized;
1132
- } finally {
1107
+ return guard.run(() => invoke(transaction), "Send failed").finally(() => {
1133
1108
  sending--;
1134
- if (!disposed) isSending.value = sending > 0;
1135
- }
1136
- };
1137
- const getStatus = (signature) => (0, import_vue15.unref)(options.getStatus)(signature);
1138
- const reset = () => {
1139
- generation++;
1140
- error.value = null;
1109
+ isSending.value = sending > 0;
1110
+ });
1141
1111
  };
1142
- (0, import_vue15.onScopeDispose)(() => {
1143
- disposed = true;
1144
- generation++;
1145
- });
1112
+ const getStatus = (signature) => (0, import_vue16.unref)(options.getStatus)(signature);
1146
1113
  return {
1147
1114
  signTransaction,
1148
1115
  sendTransaction,
1149
1116
  getStatus,
1150
1117
  isSigning,
1151
1118
  isSending,
1152
- error,
1153
- reset
1119
+ error: guard.error,
1120
+ reset: guard.reset
1154
1121
  };
1155
1122
  }
1156
1123
 
1157
1124
  // src/useSignInWithX.ts
1158
- var import_vue16 = require("vue");
1125
+ var import_vue17 = require("vue");
1159
1126
  function useSignInWithX(action) {
1160
- const isSigningIn = (0, import_vue16.shallowRef)(false);
1161
- const result = (0, import_vue16.shallowRef)(null);
1162
- const error = (0, import_vue16.shallowRef)(null);
1127
+ const isSigningIn = (0, import_vue17.shallowRef)(false);
1128
+ const result = (0, import_vue17.shallowRef)(null);
1129
+ const error = (0, import_vue17.shallowRef)(null);
1163
1130
  let generation = 0;
1164
1131
  let active = 0;
1165
1132
  let disposed = false;
1166
1133
  const signIn = async (options) => {
1167
- const invoke = (0, import_vue16.unref)(action);
1134
+ const invoke = (0, import_vue17.unref)(action);
1168
1135
  const own = ++generation;
1169
1136
  active++;
1170
1137
  isSigningIn.value = true;
@@ -1190,7 +1157,7 @@ function useSignInWithX(action) {
1190
1157
  result.value = null;
1191
1158
  error.value = null;
1192
1159
  };
1193
- (0, import_vue16.onScopeDispose)(() => {
1160
+ (0, import_vue17.onScopeDispose)(() => {
1194
1161
  disposed = true;
1195
1162
  generation++;
1196
1163
  });
@@ -1203,46 +1170,24 @@ function useSignInWithEthereum(action) {
1203
1170
  }
1204
1171
 
1205
1172
  // src/useExecuteCalls.ts
1206
- var import_vue17 = require("vue");
1173
+ var import_vue18 = require("vue");
1207
1174
  function useExecuteCalls(options) {
1208
- const isExecuting = (0, import_vue17.shallowRef)(false);
1209
- const error = (0, import_vue17.shallowRef)(null);
1210
- let generation = 0;
1211
- let active = 0;
1212
- let disposed = false;
1213
- const preview = (callCount, atomicity) => (0, import_vue17.unref)(options.preview)(callCount, atomicity);
1214
- const execute = async (calls, atomicity) => {
1215
- const invoke = (0, import_vue17.unref)(options.execute);
1216
- const own = ++generation;
1217
- active++;
1218
- isExecuting.value = true;
1219
- error.value = null;
1220
- try {
1221
- return await invoke(calls, atomicity);
1222
- } catch (cause) {
1223
- const normalized = cause instanceof Error ? cause : new Error("Execution failed");
1224
- if (!disposed && own === generation) error.value = normalized;
1225
- throw normalized;
1226
- } finally {
1227
- active--;
1228
- if (!disposed) isExecuting.value = active > 0;
1229
- }
1175
+ const guard = useActionGuard();
1176
+ const preview = (callCount, atomicity) => (0, import_vue18.unref)(options.preview)(callCount, atomicity);
1177
+ const execute = (calls, atomicity) => {
1178
+ const invoke = (0, import_vue18.unref)(options.execute);
1179
+ return guard.run(() => invoke(calls, atomicity), "Execution failed");
1230
1180
  };
1231
1181
  const reset = () => {
1232
- generation++;
1233
- error.value = null;
1234
- (0, import_vue17.unref)(options.reset)();
1182
+ guard.reset();
1183
+ (0, import_vue18.unref)(options.reset)();
1235
1184
  };
1236
- (0, import_vue17.onScopeDispose)(() => {
1237
- disposed = true;
1238
- generation++;
1239
- });
1240
1185
  return {
1241
1186
  preview,
1242
1187
  execute,
1243
- isExecuting,
1244
- error,
1245
- lastRoute: (0, import_vue17.computed)(() => (0, import_vue17.toValue)(options.lastRoute)),
1188
+ isExecuting: guard.busy,
1189
+ error: guard.error,
1190
+ lastRoute: (0, import_vue18.computed)(() => (0, import_vue18.toValue)(options.lastRoute)),
1246
1191
  reset
1247
1192
  };
1248
1193
  }
@@ -1251,41 +1196,6 @@ function useExecuteCalls(options) {
1251
1196
  var import_connect_appkit_core10 = require("@naculus/connect-appkit-core");
1252
1197
  var import_vue20 = require("vue");
1253
1198
 
1254
- // src/internal/action-guard.ts
1255
- var import_vue18 = require("vue");
1256
- function useActionGuard() {
1257
- const busy = (0, import_vue18.shallowRef)(false);
1258
- const error = (0, import_vue18.shallowRef)(null);
1259
- let active = 0;
1260
- let generation = 0;
1261
- let disposed = false;
1262
- const run = async (action, fallbackMessage) => {
1263
- const own = ++generation;
1264
- active++;
1265
- busy.value = true;
1266
- error.value = null;
1267
- try {
1268
- return await action();
1269
- } catch (cause) {
1270
- const normalized = cause instanceof Error ? cause : new Error(fallbackMessage);
1271
- if (!disposed && own === generation) error.value = normalized;
1272
- throw normalized;
1273
- } finally {
1274
- active--;
1275
- if (!disposed) busy.value = active > 0;
1276
- }
1277
- };
1278
- const reset = () => {
1279
- generation++;
1280
- error.value = null;
1281
- };
1282
- (0, import_vue18.onScopeDispose)(() => {
1283
- disposed = true;
1284
- generation++;
1285
- });
1286
- return { busy, error, run, reset };
1287
- }
1288
-
1289
1199
  // src/useSessionKeys.ts
1290
1200
  var import_connect_appkit_core9 = require("@naculus/connect-appkit-core");
1291
1201
  var import_vue19 = require("vue");
@@ -1937,32 +1847,9 @@ function useSendCalls(options) {
1937
1847
  // src/useEmbeddedWallet.ts
1938
1848
  var import_vue25 = require("vue");
1939
1849
  function useEmbeddedWallet(options) {
1940
- const isBusy = (0, import_vue25.shallowRef)(false);
1941
- const error = (0, import_vue25.shallowRef)(null);
1942
- let active = 0;
1943
- let generation = 0;
1944
- let disposed = false;
1945
- const run = async (action) => {
1946
- const own = ++generation;
1947
- active++;
1948
- isBusy.value = true;
1949
- error.value = null;
1950
- try {
1951
- return await action();
1952
- } catch (cause) {
1953
- const normalized = cause instanceof Error ? cause : new Error("Embedded wallet action failed");
1954
- if (!disposed && own === generation) error.value = normalized;
1955
- throw normalized;
1956
- } finally {
1957
- active--;
1958
- if (!disposed) isBusy.value = active > 0;
1959
- }
1960
- };
1850
+ const guard = useActionGuard();
1851
+ const run = (action) => guard.run(action, "Embedded wallet action failed");
1961
1852
  const wallet = (0, import_vue25.computed)(() => (0, import_vue25.toValue)(options.wallet));
1962
- (0, import_vue25.onScopeDispose)(() => {
1963
- disposed = true;
1964
- generation++;
1965
- });
1966
1853
  return {
1967
1854
  wallet,
1968
1855
  hasWallet: (0, import_vue25.computed)(() => wallet.value !== null),
@@ -1983,11 +1870,9 @@ function useEmbeddedWallet(options) {
1983
1870
  getSeedPhrase: () => (0, import_vue25.unref)(options.getSeedPhrase)(),
1984
1871
  getPrivateKey: () => (0, import_vue25.unref)(options.getPrivateKey)(),
1985
1872
  confirmBackup: () => (0, import_vue25.unref)(options.confirmBackup)(),
1986
- isBusy,
1987
- error,
1988
- clearError: () => {
1989
- error.value = null;
1990
- }
1873
+ isBusy: guard.busy,
1874
+ error: guard.error,
1875
+ clearError: guard.clearError
1991
1876
  };
1992
1877
  }
1993
1878
 
@@ -2005,98 +1890,47 @@ function useSIWxLogin(action) {
2005
1890
  // src/useSIWxSession.ts
2006
1891
  var import_vue26 = require("vue");
2007
1892
  function useSIWxSession(options) {
2008
- const isSigningIn = (0, import_vue26.shallowRef)(false);
2009
- const error = (0, import_vue26.shallowRef)(null);
2010
- let generation = 0;
2011
- let active = 0;
2012
- let disposed = false;
2013
- const run = async (action, message) => {
2014
- const own = ++generation;
2015
- active++;
2016
- isSigningIn.value = true;
2017
- error.value = null;
2018
- try {
2019
- return await action();
2020
- } catch (cause) {
2021
- const normalized = cause instanceof Error ? cause : new Error(message);
2022
- if (!disposed && own === generation) error.value = normalized;
2023
- throw normalized;
2024
- } finally {
2025
- active--;
2026
- if (!disposed) isSigningIn.value = active > 0;
2027
- }
2028
- };
2029
- (0, import_vue26.onScopeDispose)(() => {
2030
- disposed = true;
2031
- generation++;
2032
- });
1893
+ const guard = useActionGuard();
2033
1894
  return {
2034
1895
  session: (0, import_vue26.computed)(() => (0, import_vue26.toValue)(options.session)),
2035
1896
  isAuthenticated: (0, import_vue26.computed)(
2036
1897
  () => (0, import_vue26.toValue)(options.session) !== null && !(0, import_vue26.toValue)(options.isExpired)
2037
1898
  ),
2038
1899
  isRestoring: (0, import_vue26.computed)(() => (0, import_vue26.toValue)(options.isRestoring)),
2039
- isSigningIn,
1900
+ isSigningIn: guard.busy,
2040
1901
  isExpired: (0, import_vue26.computed)(() => (0, import_vue26.toValue)(options.isExpired)),
2041
1902
  timeUntilExpiry: (0, import_vue26.computed)(() => (0, import_vue26.toValue)(options.timeUntilExpiry)),
2042
- signIn: (input) => run(() => (0, import_vue26.unref)(options.signIn)(input), "SIWX sign-in failed"),
1903
+ signIn: (input) => guard.run(() => (0, import_vue26.unref)(options.signIn)(input), "SIWX sign-in failed"),
2043
1904
  signOut: async () => {
2044
1905
  await (0, import_vue26.unref)(options.signOut)();
2045
- error.value = null;
1906
+ guard.clearError();
2046
1907
  },
2047
- refresh: () => run(() => (0, import_vue26.unref)(options.refresh)(), "Session refresh failed"),
2048
- error,
2049
- clearError: () => {
2050
- error.value = null;
2051
- }
1908
+ refresh: () => guard.run(() => (0, import_vue26.unref)(options.refresh)(), "Session refresh failed"),
1909
+ error: guard.error,
1910
+ clearError: guard.clearError
2052
1911
  };
2053
1912
  }
2054
1913
 
2055
1914
  // src/useSiwxAuthSession.ts
2056
1915
  var import_vue27 = require("vue");
2057
1916
  function useSiwxAuthSession(options) {
2058
- const isSigningIn = (0, import_vue27.shallowRef)(false);
2059
- const error = (0, import_vue27.shallowRef)(null);
2060
- let generation = 0;
2061
- let disposed = false;
2062
- const signIn = async (input) => {
2063
- const own = ++generation;
2064
- isSigningIn.value = true;
2065
- error.value = null;
2066
- try {
2067
- return await (0, import_vue27.unref)(options.signIn)(input);
2068
- } catch (cause) {
2069
- const normalized = cause instanceof Error ? cause : new Error("SIWX sign-in failed");
2070
- if (!disposed && own === generation) error.value = normalized;
2071
- throw normalized;
2072
- } finally {
2073
- if (!disposed && own === generation) isSigningIn.value = false;
2074
- }
2075
- };
1917
+ const guard = useActionGuard();
1918
+ const signIn = (input) => guard.run(() => (0, import_vue27.unref)(options.signIn)(input), "SIWX sign-in failed");
2076
1919
  const signOut = async () => {
2077
- generation++;
1920
+ guard.reset();
2078
1921
  await (0, import_vue27.unref)(options.signOut)();
2079
- if (!disposed) {
2080
- isSigningIn.value = false;
2081
- error.value = null;
2082
- }
1922
+ guard.clearError();
2083
1923
  };
2084
- (0, import_vue27.onScopeDispose)(() => {
2085
- disposed = true;
2086
- generation++;
2087
- });
2088
1924
  const siwxResult = (0, import_vue27.computed)(() => (0, import_vue27.toValue)(options.result));
2089
1925
  return {
2090
1926
  isSignedIn: (0, import_vue27.computed)(() => siwxResult.value !== null),
2091
1927
  isRestoring: (0, import_vue27.computed)(() => (0, import_vue27.toValue)(options.isRestoring)),
2092
1928
  siwxResult,
2093
- isSigningIn,
2094
- error,
1929
+ isSigningIn: guard.busy,
1930
+ error: guard.error,
2095
1931
  signIn,
2096
1932
  signOut,
2097
- clearError: () => {
2098
- error.value = null;
2099
- }
1933
+ clearError: guard.clearError
2100
1934
  };
2101
1935
  }
2102
1936
 
@@ -2573,21 +2407,113 @@ function useTokenBalance(account, client, tokens, options = {}) {
2573
2407
  };
2574
2408
  }
2575
2409
 
2576
- // src/useDelegation.ts
2410
+ // src/useDelegate.ts
2577
2411
  var import_connect_appkit_core22 = require("@naculus/connect-appkit-core");
2578
2412
  var import_connect_core15 = require("@naculus/connect-core");
2579
2413
  var import_vue36 = require("vue");
2580
- function useDelegation(account, client, chainId) {
2581
- const status = (0, import_vue36.shallowRef)(import_connect_core15.UNKNOWN_DELEGATION);
2582
- const isFetching = (0, import_vue36.shallowRef)(false);
2414
+ function useDelegate(options) {
2415
+ const result = (0, import_vue36.shallowRef)(null);
2416
+ const isPending = (0, import_vue36.shallowRef)(false);
2583
2417
  const error = (0, import_vue36.shallowRef)(null);
2418
+ let requestId = 0;
2419
+ let inFlight = false;
2420
+ let disposed = false;
2421
+ const fail = (cause) => {
2422
+ error.value = cause;
2423
+ return null;
2424
+ };
2425
+ const run = async (target, allowlist) => {
2426
+ if (inFlight) return fail(new Error("A delegation is already in progress"));
2427
+ const session = (0, import_vue36.toValue)(options.session);
2428
+ const account = (0, import_connect_appkit_core22.bareEvmAddress)((0, import_vue36.toValue)(options.account));
2429
+ const chainId = (0, import_vue36.toValue)(options.chainId);
2430
+ if (!session || !account || !chainId) {
2431
+ return fail(
2432
+ new import_connect_core15.WalletError("wallet_unavailable", "No connected EVM account")
2433
+ );
2434
+ }
2435
+ const reader = (0, import_vue36.toValue)(options.client);
2436
+ if (!reader || reader.chain?.id !== (0, import_connect_core15.eip155Reference)(chainId)) {
2437
+ return fail(
2438
+ new import_connect_core15.WalletError(
2439
+ "chain_mismatch",
2440
+ `No RPC client for ${chainId}; refusing to read the nonce elsewhere.`
2441
+ )
2442
+ );
2443
+ }
2444
+ const connector = (0, import_vue36.toValue)(options.connector) ?? {};
2445
+ const own = ++requestId;
2446
+ inFlight = true;
2447
+ isPending.value = true;
2448
+ error.value = null;
2449
+ result.value = null;
2450
+ try {
2451
+ const sent = await (0, import_connect_core15.delegateAccount)({
2452
+ connector,
2453
+ session,
2454
+ account,
2455
+ chainId,
2456
+ delegate: target,
2457
+ allowlist,
2458
+ getTransactionCount: (address, blockTag) => reader.getTransactionCount({ address, blockTag })
2459
+ });
2460
+ if (disposed || own !== requestId) return null;
2461
+ result.value = sent;
2462
+ return sent;
2463
+ } catch (cause) {
2464
+ if (disposed || own !== requestId) return null;
2465
+ return fail(
2466
+ cause instanceof Error ? cause : new Error("Failed to send delegation")
2467
+ );
2468
+ } finally {
2469
+ inFlight = false;
2470
+ if (!disposed && own === requestId) isPending.value = false;
2471
+ }
2472
+ };
2473
+ const reset = () => {
2474
+ requestId++;
2475
+ result.value = null;
2476
+ isPending.value = false;
2477
+ error.value = null;
2478
+ };
2479
+ (0, import_vue36.watch)(
2480
+ [
2481
+ () => (0, import_vue36.toValue)(options.session),
2482
+ () => (0, import_vue36.toValue)(options.account),
2483
+ () => (0, import_vue36.toValue)(options.chainId)
2484
+ ],
2485
+ reset,
2486
+ { flush: "sync" }
2487
+ );
2488
+ (0, import_vue36.onScopeDispose)(() => {
2489
+ disposed = true;
2490
+ requestId++;
2491
+ });
2492
+ return {
2493
+ delegate: (target) => run(target, (0, import_vue36.toValue)(options.allowlist)),
2494
+ revoke: () => run(import_connect_core15.REVOKE_DELEGATE, []),
2495
+ result,
2496
+ isPending,
2497
+ error,
2498
+ reset
2499
+ };
2500
+ }
2501
+
2502
+ // src/useDelegation.ts
2503
+ var import_connect_appkit_core23 = require("@naculus/connect-appkit-core");
2504
+ var import_connect_core16 = require("@naculus/connect-core");
2505
+ var import_vue37 = require("vue");
2506
+ function useDelegation(account, client, chainId) {
2507
+ const status = (0, import_vue37.shallowRef)(import_connect_core16.UNKNOWN_DELEGATION);
2508
+ const isFetching = (0, import_vue37.shallowRef)(false);
2509
+ const error = (0, import_vue37.shallowRef)(null);
2584
2510
  let generation = 0;
2585
2511
  let disposed = false;
2586
2512
  const refetch = async () => {
2587
2513
  const mine = ++generation;
2588
- const reader = (0, import_vue36.toValue)(client);
2589
- const address = (0, import_connect_appkit_core22.bareEvmAddress)((0, import_vue36.toValue)(account));
2590
- status.value = import_connect_core15.UNKNOWN_DELEGATION;
2514
+ const reader = (0, import_vue37.toValue)(client);
2515
+ const address = (0, import_connect_appkit_core23.bareEvmAddress)((0, import_vue37.toValue)(account));
2516
+ status.value = import_connect_core16.UNKNOWN_DELEGATION;
2591
2517
  error.value = null;
2592
2518
  if (!reader || !address) {
2593
2519
  isFetching.value = false;
@@ -2597,31 +2523,31 @@ function useDelegation(account, client, chainId) {
2597
2523
  try {
2598
2524
  const code = await reader.getCode({ address });
2599
2525
  if (!disposed && mine === generation) {
2600
- status.value = (0, import_connect_core15.readDelegation)(code ?? "0x");
2526
+ status.value = (0, import_connect_core16.readDelegation)(code ?? "0x");
2601
2527
  }
2602
2528
  } catch (cause) {
2603
2529
  if (!disposed && mine === generation) {
2604
- status.value = import_connect_core15.UNKNOWN_DELEGATION;
2530
+ status.value = import_connect_core16.UNKNOWN_DELEGATION;
2605
2531
  error.value = cause instanceof Error ? cause : new Error("Code read failed");
2606
2532
  }
2607
2533
  } finally {
2608
2534
  if (!disposed && mine === generation) isFetching.value = false;
2609
2535
  }
2610
2536
  };
2611
- (0, import_vue36.watch)(
2612
- [() => (0, import_vue36.toValue)(account), () => (0, import_vue36.toValue)(client), () => (0, import_vue36.toValue)(chainId)],
2537
+ (0, import_vue37.watch)(
2538
+ [() => (0, import_vue37.toValue)(account), () => (0, import_vue37.toValue)(client), () => (0, import_vue37.toValue)(chainId)],
2613
2539
  () => {
2614
2540
  void refetch();
2615
2541
  },
2616
2542
  { immediate: true, flush: "sync" }
2617
2543
  );
2618
- (0, import_vue36.onScopeDispose)(() => {
2544
+ (0, import_vue37.onScopeDispose)(() => {
2619
2545
  disposed = true;
2620
2546
  generation++;
2621
2547
  });
2622
2548
  return {
2623
- delegated: (0, import_vue36.computed)(() => status.value.delegated),
2624
- delegate: (0, import_vue36.computed)(() => status.value.delegate),
2549
+ delegated: (0, import_vue37.computed)(() => status.value.delegated),
2550
+ delegate: (0, import_vue37.computed)(() => status.value.delegate),
2625
2551
  isFetching,
2626
2552
  error,
2627
2553
  refetch
@@ -2629,19 +2555,19 @@ function useDelegation(account, client, chainId) {
2629
2555
  }
2630
2556
 
2631
2557
  // src/name-lookup.ts
2632
- var import_connect_appkit_core23 = require("@naculus/connect-appkit-core");
2633
- var import_vue37 = require("vue");
2558
+ var import_connect_appkit_core24 = require("@naculus/connect-appkit-core");
2559
+ var import_vue38 = require("vue");
2634
2560
  function useNameLookup(options) {
2635
- const data = (0, import_vue37.shallowRef)(null);
2636
- const loading = (0, import_vue37.shallowRef)(false);
2637
- const error = (0, import_vue37.shallowRef)(null);
2561
+ const data = (0, import_vue38.shallowRef)(null);
2562
+ const loading = (0, import_vue38.shallowRef)(false);
2563
+ const error = (0, import_vue38.shallowRef)(null);
2638
2564
  let generation = 0;
2639
2565
  let disposed = false;
2640
2566
  const run = () => {
2641
- const input = (0, import_vue37.toValue)(options.input).trim();
2642
- const skip = (0, import_vue37.toValue)(options.skip) ?? false;
2643
- const scope = (0, import_vue37.toValue)(options.scope);
2644
- const config = (0, import_vue37.toValue)(options.resolverConfig);
2567
+ const input = (0, import_vue38.toValue)(options.input).trim();
2568
+ const skip = (0, import_vue38.toValue)(options.skip) ?? false;
2569
+ const scope = (0, import_vue38.toValue)(options.scope);
2570
+ const config = (0, import_vue38.toValue)(options.resolverConfig);
2645
2571
  const mine = ++generation;
2646
2572
  if (!input || skip) {
2647
2573
  data.value = null;
@@ -2652,7 +2578,7 @@ function useNameLookup(options) {
2652
2578
  data.value = null;
2653
2579
  loading.value = true;
2654
2580
  error.value = null;
2655
- Promise.resolve().then(() => options.query((0, import_connect_appkit_core23.getResolver)(config), input, scope)).then((result) => {
2581
+ Promise.resolve().then(() => options.query((0, import_connect_appkit_core24.getResolver)(config), input, scope)).then((result) => {
2656
2582
  if (disposed || mine !== generation) return;
2657
2583
  data.value = result;
2658
2584
  loading.value = false;
@@ -2663,23 +2589,23 @@ function useNameLookup(options) {
2663
2589
  loading.value = false;
2664
2590
  });
2665
2591
  };
2666
- (0, import_vue37.watch)(
2592
+ (0, import_vue38.watch)(
2667
2593
  () => [
2668
- (0, import_vue37.toValue)(options.input),
2669
- (0, import_vue37.toValue)(options.skip),
2670
- (0, import_vue37.toValue)(options.scope),
2671
- (0, import_vue37.toValue)(options.resolverConfig)
2594
+ (0, import_vue38.toValue)(options.input),
2595
+ (0, import_vue38.toValue)(options.skip),
2596
+ (0, import_vue38.toValue)(options.scope),
2597
+ (0, import_vue38.toValue)(options.resolverConfig)
2672
2598
  ],
2673
2599
  run,
2674
2600
  { immediate: true, flush: "sync", deep: true }
2675
2601
  );
2676
- (0, import_vue37.onScopeDispose)(() => {
2602
+ (0, import_vue38.onScopeDispose)(() => {
2677
2603
  disposed = true;
2678
2604
  generation++;
2679
2605
  });
2680
2606
  return {
2681
2607
  data,
2682
- isLoading: (0, import_vue37.computed)(() => loading.value),
2608
+ isLoading: (0, import_vue38.computed)(() => loading.value),
2683
2609
  error,
2684
2610
  refetch: run
2685
2611
  };
@@ -2707,21 +2633,21 @@ function useLookupAddress(address, options) {
2707
2633
  }
2708
2634
 
2709
2635
  // src/useSolanaAccount.ts
2710
- var import_vue38 = require("vue");
2636
+ var import_vue39 = require("vue");
2711
2637
  function useSolanaAccount(accounts, connected) {
2712
- const isConnected = (0, import_vue38.computed)(() => (0, import_vue38.toValue)(connected));
2713
- const caip10 = (0, import_vue38.computed)(
2714
- () => isConnected.value ? ((0, import_vue38.toValue)(accounts) ?? []).find(
2638
+ const isConnected = (0, import_vue39.computed)(() => (0, import_vue39.toValue)(connected));
2639
+ const caip10 = (0, import_vue39.computed)(
2640
+ () => isConnected.value ? ((0, import_vue39.toValue)(accounts) ?? []).find(
2715
2641
  (account) => account.startsWith("solana:")
2716
2642
  ) ?? null : null
2717
2643
  );
2718
- const parts = (0, import_vue38.computed)(() => caip10.value?.split(":") ?? []);
2644
+ const parts = (0, import_vue39.computed)(() => caip10.value?.split(":") ?? []);
2719
2645
  return {
2720
- address: (0, import_vue38.computed)(
2646
+ address: (0, import_vue39.computed)(
2721
2647
  () => parts.value.length >= 3 ? parts.value.at(-1) ?? null : null
2722
2648
  ),
2723
2649
  caip10,
2724
- chainId: (0, import_vue38.computed)(
2650
+ chainId: (0, import_vue39.computed)(
2725
2651
  () => parts.value.length >= 3 ? parts.value.slice(0, -1).join(":") : null
2726
2652
  ),
2727
2653
  isConnected
@@ -2729,35 +2655,35 @@ function useSolanaAccount(accounts, connected) {
2729
2655
  }
2730
2656
 
2731
2657
  // src/useChain.ts
2732
- var import_connect_appkit_core24 = require("@naculus/connect-appkit-core");
2733
- var import_vue39 = require("vue");
2658
+ var import_connect_appkit_core25 = require("@naculus/connect-appkit-core");
2659
+ var import_vue40 = require("vue");
2734
2660
  function useChain(chains, chainId) {
2735
- const list = (0, import_vue39.computed)(() => (0, import_vue39.toValue)(chains) ?? []);
2736
- const id = (0, import_vue39.computed)(() => (0, import_vue39.toValue)(chainId) ?? null);
2737
- const currentChain = (0, import_vue39.computed)(() => (0, import_connect_appkit_core24.resolveChain)(list.value, id.value));
2661
+ const list = (0, import_vue40.computed)(() => (0, import_vue40.toValue)(chains) ?? []);
2662
+ const id = (0, import_vue40.computed)(() => (0, import_vue40.toValue)(chainId) ?? null);
2663
+ const currentChain = (0, import_vue40.computed)(() => (0, import_connect_appkit_core25.resolveChain)(list.value, id.value));
2738
2664
  return {
2739
2665
  currentChain,
2740
- chainInfo: (0, import_vue39.computed)(() => (0, import_connect_appkit_core24.describeChain)(list.value, id.value)),
2741
- availableChains: (0, import_vue39.computed)(() => (0, import_connect_appkit_core24.chainsForNamespace)(list.value, id.value)),
2742
- currentChainNumber: (0, import_vue39.computed)(
2743
- () => currentChain.value ? (0, import_connect_appkit_core24.chainNumber)(currentChain.value) : null
2666
+ chainInfo: (0, import_vue40.computed)(() => (0, import_connect_appkit_core25.describeChain)(list.value, id.value)),
2667
+ availableChains: (0, import_vue40.computed)(() => (0, import_connect_appkit_core25.chainsForNamespace)(list.value, id.value)),
2668
+ currentChainNumber: (0, import_vue40.computed)(
2669
+ () => currentChain.value ? (0, import_connect_appkit_core25.chainNumber)(currentChain.value) : null
2744
2670
  ),
2745
- namespace: (0, import_vue39.computed)(
2746
- () => currentChain.value ? (0, import_connect_appkit_core24.chainNamespace)(currentChain.value) : null
2671
+ namespace: (0, import_vue40.computed)(
2672
+ () => currentChain.value ? (0, import_connect_appkit_core25.chainNamespace)(currentChain.value) : null
2747
2673
  )
2748
2674
  };
2749
2675
  }
2750
2676
 
2751
2677
  // src/usePassphraseGate.ts
2752
- var import_vue40 = require("vue");
2678
+ var import_vue41 = require("vue");
2753
2679
  function usePassphraseGate(gate) {
2754
- const request = (0, import_vue40.shallowRef)(gate.getSnapshot());
2680
+ const request = (0, import_vue41.shallowRef)(gate.getSnapshot());
2755
2681
  const unsubscribe = gate.subscribe(() => {
2756
2682
  request.value = gate.getSnapshot();
2757
2683
  });
2758
- (0, import_vue40.onScopeDispose)(unsubscribe);
2684
+ (0, import_vue41.onScopeDispose)(unsubscribe);
2759
2685
  return {
2760
- request: (0, import_vue40.readonly)(request),
2686
+ request: (0, import_vue41.readonly)(request),
2761
2687
  submit: (passphrase) => gate.submit(passphrase),
2762
2688
  cancel: (reason) => gate.cancel(reason),
2763
2689
  forget: (reason) => gate.forget(reason)
@@ -2765,17 +2691,17 @@ function usePassphraseGate(gate) {
2765
2691
  }
2766
2692
 
2767
2693
  // src/useSolanaBalance.ts
2768
- var import_connect_core16 = require("@naculus/connect-core");
2769
- var import_vue41 = require("vue");
2694
+ var import_connect_core17 = require("@naculus/connect-core");
2695
+ var import_vue42 = require("vue");
2770
2696
  function useSolanaBalance(address, rpcUrl) {
2771
- const balance = (0, import_vue41.shallowRef)(null);
2772
- const isFetching = (0, import_vue41.ref)(false);
2773
- const error = (0, import_vue41.shallowRef)(null);
2697
+ const balance = (0, import_vue42.shallowRef)(null);
2698
+ const isFetching = (0, import_vue42.ref)(false);
2699
+ const error = (0, import_vue42.shallowRef)(null);
2774
2700
  let generation = 0;
2775
2701
  let disposed = false;
2776
2702
  const refetch = async () => {
2777
- const addr = (0, import_vue41.toValue)(address);
2778
- const url = (0, import_vue41.toValue)(rpcUrl);
2703
+ const addr = (0, import_vue42.toValue)(address);
2704
+ const url = (0, import_vue42.toValue)(rpcUrl);
2779
2705
  if (!addr || !url) {
2780
2706
  balance.value = null;
2781
2707
  return;
@@ -2784,7 +2710,7 @@ function useSolanaBalance(address, rpcUrl) {
2784
2710
  isFetching.value = true;
2785
2711
  error.value = null;
2786
2712
  try {
2787
- const next = await (0, import_connect_core16.getSolanaBalance)(url, addr);
2713
+ const next = await (0, import_connect_core17.getSolanaBalance)(url, addr);
2788
2714
  if (disposed || own !== generation) return;
2789
2715
  balance.value = next;
2790
2716
  } catch (err) {
@@ -2795,25 +2721,25 @@ function useSolanaBalance(address, rpcUrl) {
2795
2721
  if (!disposed && own === generation) isFetching.value = false;
2796
2722
  }
2797
2723
  };
2798
- (0, import_vue41.watchEffect)(() => {
2799
- (0, import_vue41.toValue)(address);
2800
- (0, import_vue41.toValue)(rpcUrl);
2724
+ (0, import_vue42.watchEffect)(() => {
2725
+ (0, import_vue42.toValue)(address);
2726
+ (0, import_vue42.toValue)(rpcUrl);
2801
2727
  void refetch();
2802
2728
  });
2803
- (0, import_vue41.onScopeDispose)(() => {
2729
+ (0, import_vue42.onScopeDispose)(() => {
2804
2730
  disposed = true;
2805
2731
  });
2806
2732
  return { balance, isFetching, error, refetch };
2807
2733
  }
2808
2734
 
2809
2735
  // src/useLastTx.ts
2810
- var import_vue42 = require("vue");
2736
+ var import_vue43 = require("vue");
2811
2737
  function useLastTx(monitor) {
2812
- const lastTx = (0, import_vue42.shallowRef)(null);
2813
- const lastConfirmedTx = (0, import_vue42.shallowRef)(null);
2814
- const lastFailedTx = (0, import_vue42.shallowRef)(null);
2815
- (0, import_vue42.watch)(
2816
- () => (0, import_vue42.toValue)(monitor),
2738
+ const lastTx = (0, import_vue43.shallowRef)(null);
2739
+ const lastConfirmedTx = (0, import_vue43.shallowRef)(null);
2740
+ const lastFailedTx = (0, import_vue43.shallowRef)(null);
2741
+ (0, import_vue43.watch)(
2742
+ () => (0, import_vue43.toValue)(monitor),
2817
2743
  (activeMonitor, _previous, onCleanup) => {
2818
2744
  if (!activeMonitor) return;
2819
2745
  const recordLatest = (entry) => {
@@ -2851,15 +2777,15 @@ function useLastTx(monitor) {
2851
2777
  }
2852
2778
 
2853
2779
  // src/useTxHistory.ts
2854
- var import_vue43 = require("vue");
2780
+ var import_vue44 = require("vue");
2855
2781
  function useTxHistory(address, chainId, monitor) {
2856
- const entries = (0, import_vue43.shallowRef)([]);
2857
- const isLoading = (0, import_vue43.shallowRef)(false);
2858
- const error = (0, import_vue43.shallowRef)(null);
2782
+ const entries = (0, import_vue44.shallowRef)([]);
2783
+ const isLoading = (0, import_vue44.shallowRef)(false);
2784
+ const error = (0, import_vue44.shallowRef)(null);
2859
2785
  let generation = 0;
2860
2786
  const refresh = async () => {
2861
2787
  const mine = ++generation;
2862
- const activeMonitor = (0, import_vue43.toValue)(monitor);
2788
+ const activeMonitor = (0, import_vue44.toValue)(monitor);
2863
2789
  if (!activeMonitor) {
2864
2790
  entries.value = [];
2865
2791
  isLoading.value = false;
@@ -2870,8 +2796,8 @@ function useTxHistory(address, chainId, monitor) {
2870
2796
  error.value = null;
2871
2797
  try {
2872
2798
  const result = await activeMonitor.getTxHistory(
2873
- (0, import_vue43.toValue)(address) ?? void 0,
2874
- (0, import_vue43.toValue)(chainId) ?? void 0
2799
+ (0, import_vue44.toValue)(address) ?? void 0,
2800
+ (0, import_vue44.toValue)(chainId) ?? void 0
2875
2801
  );
2876
2802
  if (mine === generation) entries.value = result;
2877
2803
  } catch (err) {
@@ -2881,8 +2807,8 @@ function useTxHistory(address, chainId, monitor) {
2881
2807
  if (mine === generation) isLoading.value = false;
2882
2808
  }
2883
2809
  };
2884
- (0, import_vue43.watch)(
2885
- [() => (0, import_vue43.toValue)(monitor), () => (0, import_vue43.toValue)(address), () => (0, import_vue43.toValue)(chainId)],
2810
+ (0, import_vue44.watch)(
2811
+ [() => (0, import_vue44.toValue)(monitor), () => (0, import_vue44.toValue)(address), () => (0, import_vue44.toValue)(chainId)],
2886
2812
  ([activeMonitor], _previous, onCleanup) => {
2887
2813
  if (!activeMonitor) {
2888
2814
  void refresh();
@@ -2902,7 +2828,7 @@ function useTxHistory(address, chainId, monitor) {
2902
2828
  isLoading,
2903
2829
  error,
2904
2830
  refresh,
2905
- summary: (0, import_vue43.computed)(() => ({
2831
+ summary: (0, import_vue44.computed)(() => ({
2906
2832
  pending: entries.value.filter((item) => item.status === "pending").length,
2907
2833
  confirmed: entries.value.filter((item) => item.status === "confirmed").length,
2908
2834
  failed: entries.value.filter((item) => item.status === "failed").length
@@ -2911,17 +2837,17 @@ function useTxHistory(address, chainId, monitor) {
2911
2837
  }
2912
2838
 
2913
2839
  // src/useTxMonitor.ts
2914
- var import_vue44 = require("vue");
2840
+ var import_vue45 = require("vue");
2915
2841
  function useTxMonitor(hash, chainId, monitor) {
2916
- const entry = (0, import_vue44.shallowRef)(null);
2917
- const isLoading = (0, import_vue44.shallowRef)(false);
2918
- const isWatching = (0, import_vue44.shallowRef)(false);
2919
- const error = (0, import_vue44.shallowRef)(null);
2842
+ const entry = (0, import_vue45.shallowRef)(null);
2843
+ const isLoading = (0, import_vue45.shallowRef)(false);
2844
+ const isWatching = (0, import_vue45.shallowRef)(false);
2845
+ const error = (0, import_vue45.shallowRef)(null);
2920
2846
  let generation = 0;
2921
2847
  const refresh = async () => {
2922
- const activeMonitor = (0, import_vue44.toValue)(monitor);
2923
- const activeHash = (0, import_vue44.toValue)(hash);
2924
- const activeChainId = (0, import_vue44.toValue)(chainId);
2848
+ const activeMonitor = (0, import_vue45.toValue)(monitor);
2849
+ const activeHash = (0, import_vue45.toValue)(hash);
2850
+ const activeChainId = (0, import_vue45.toValue)(chainId);
2925
2851
  if (!activeMonitor || !activeHash) return;
2926
2852
  isLoading.value = true;
2927
2853
  error.value = null;
@@ -2939,15 +2865,15 @@ function useTxMonitor(hash, chainId, monitor) {
2939
2865
  }
2940
2866
  };
2941
2867
  const stopWatching = () => {
2942
- const activeMonitor = (0, import_vue44.toValue)(monitor);
2943
- const activeHash = (0, import_vue44.toValue)(hash);
2944
- const activeChainId = (0, import_vue44.toValue)(chainId);
2868
+ const activeMonitor = (0, import_vue45.toValue)(monitor);
2869
+ const activeHash = (0, import_vue45.toValue)(hash);
2870
+ const activeChainId = (0, import_vue45.toValue)(chainId);
2945
2871
  if (!activeMonitor || !activeHash) return;
2946
2872
  activeMonitor.stopWatching(activeHash, activeChainId ?? void 0);
2947
2873
  isWatching.value = false;
2948
2874
  };
2949
- (0, import_vue44.watch)(
2950
- [() => (0, import_vue44.toValue)(monitor), () => (0, import_vue44.toValue)(hash), () => (0, import_vue44.toValue)(chainId)],
2875
+ (0, import_vue45.watch)(
2876
+ [() => (0, import_vue45.toValue)(monitor), () => (0, import_vue45.toValue)(hash), () => (0, import_vue45.toValue)(chainId)],
2951
2877
  ([activeMonitor, activeHash, activeChainId], _previous, onCleanup) => {
2952
2878
  const mine = ++generation;
2953
2879
  if (!activeMonitor || !activeHash || !activeChainId) {
@@ -2987,7 +2913,7 @@ function useTxMonitor(hash, chainId, monitor) {
2987
2913
  );
2988
2914
  return {
2989
2915
  entry,
2990
- status: (0, import_vue44.computed)(() => entry.value?.status ?? "idle"),
2916
+ status: (0, import_vue45.computed)(() => entry.value?.status ?? "idle"),
2991
2917
  isLoading,
2992
2918
  isWatching,
2993
2919
  error,
@@ -2997,19 +2923,19 @@ function useTxMonitor(hash, chainId, monitor) {
2997
2923
  }
2998
2924
 
2999
2925
  // src/useCapabilities.ts
3000
- var import_connect_appkit_core25 = require("@naculus/connect-appkit-core");
3001
- var import_vue45 = require("vue");
2926
+ var import_connect_appkit_core26 = require("@naculus/connect-appkit-core");
2927
+ var import_vue46 = require("vue");
3002
2928
  function useCapabilities(client, session, chainId) {
3003
- const capabilities = (0, import_vue45.shallowRef)(
2929
+ const capabilities = (0, import_vue46.shallowRef)(
3004
2930
  null
3005
2931
  );
3006
- const isFetching = (0, import_vue45.shallowRef)(false);
3007
- const error = (0, import_vue45.shallowRef)(null);
2932
+ const isFetching = (0, import_vue46.shallowRef)(false);
2933
+ const error = (0, import_vue46.shallowRef)(null);
3008
2934
  let generation = 0;
3009
2935
  const refetch = async () => {
3010
2936
  const mine = ++generation;
3011
- const activeClient = (0, import_vue45.toValue)(client);
3012
- const activeSession = (0, import_vue45.toValue)(session);
2937
+ const activeClient = (0, import_vue46.toValue)(client);
2938
+ const activeSession = (0, import_vue46.toValue)(session);
3013
2939
  if (!activeClient?.getCapabilities || !activeSession) {
3014
2940
  capabilities.value = null;
3015
2941
  isFetching.value = false;
@@ -3021,7 +2947,7 @@ function useCapabilities(client, session, chainId) {
3021
2947
  try {
3022
2948
  const raw = await activeClient.getCapabilities(activeSession);
3023
2949
  if (mine !== generation) return;
3024
- capabilities.value = (0, import_connect_appkit_core25.normalizeCapabilities)(raw);
2950
+ capabilities.value = (0, import_connect_appkit_core26.normalizeCapabilities)(raw);
3025
2951
  } catch (err) {
3026
2952
  if (mine !== generation) return;
3027
2953
  capabilities.value = null;
@@ -3030,18 +2956,18 @@ function useCapabilities(client, session, chainId) {
3030
2956
  if (mine === generation) isFetching.value = false;
3031
2957
  }
3032
2958
  };
3033
- (0, import_vue45.watchEffect)(() => {
3034
- void (0, import_vue45.toValue)(client);
3035
- void (0, import_vue45.toValue)(session);
2959
+ (0, import_vue46.watchEffect)(() => {
2960
+ void (0, import_vue46.toValue)(client);
2961
+ void (0, import_vue46.toValue)(session);
3036
2962
  void refetch();
3037
2963
  });
3038
2964
  return {
3039
2965
  capabilities,
3040
- current: (0, import_vue45.computed)(
3041
- () => (0, import_connect_appkit_core25.selectChainCapabilities)(capabilities.value, (0, import_vue45.toValue)(chainId))
2966
+ current: (0, import_vue46.computed)(
2967
+ () => (0, import_connect_appkit_core26.selectChainCapabilities)(capabilities.value, (0, import_vue46.toValue)(chainId))
3042
2968
  ),
3043
- atomic: (0, import_vue45.computed)(
3044
- () => (0, import_connect_appkit_core25.atomicSupportFor)(capabilities.value, (0, import_vue45.toValue)(chainId))
2969
+ atomic: (0, import_vue46.computed)(
2970
+ () => (0, import_connect_appkit_core26.atomicSupportFor)(capabilities.value, (0, import_vue46.toValue)(chainId))
3045
2971
  ),
3046
2972
  isFetching,
3047
2973
  error,
@@ -3050,18 +2976,18 @@ function useCapabilities(client, session, chainId) {
3050
2976
  }
3051
2977
 
3052
2978
  // src/useSolanaRoles.ts
3053
- var import_connect_appkit_core26 = require("@naculus/connect-appkit-core");
3054
- var import_vue46 = require("vue");
2979
+ var import_connect_appkit_core27 = require("@naculus/connect-appkit-core");
2980
+ var import_vue47 = require("vue");
3055
2981
  function useSolanaRoles(connector, session) {
3056
- const state = (0, import_vue46.computed)(
3057
- () => (0, import_connect_appkit_core26.readSolanaRoles)((0, import_vue46.toValue)(connector), (0, import_vue46.toValue)(session))
2982
+ const state = (0, import_vue47.computed)(
2983
+ () => (0, import_connect_appkit_core27.readSolanaRoles)((0, import_vue47.toValue)(connector), (0, import_vue47.toValue)(session))
3058
2984
  );
3059
2985
  return {
3060
- roles: (0, import_vue46.computed)(() => state.value.roles),
3061
- absence: (0, import_vue46.computed)(() => state.value.absence),
3062
- identity: (0, import_vue46.computed)(() => state.value.roles?.identity ?? null),
3063
- signer: (0, import_vue46.computed)(() => state.value.roles?.signer ?? null),
3064
- payer: (0, import_vue46.computed)(() => state.value.roles?.payer ?? null)
2986
+ roles: (0, import_vue47.computed)(() => state.value.roles),
2987
+ absence: (0, import_vue47.computed)(() => state.value.absence),
2988
+ identity: (0, import_vue47.computed)(() => state.value.roles?.identity ?? null),
2989
+ signer: (0, import_vue47.computed)(() => state.value.roles?.signer ?? null),
2990
+ payer: (0, import_vue47.computed)(() => state.value.roles?.payer ?? null)
3065
2991
  };
3066
2992
  }
3067
2993
  // Annotate the CommonJS export names for ESM import in node:
@@ -3102,6 +3028,7 @@ function useSolanaRoles(connector, session) {
3102
3028
  useCompareCosts,
3103
3029
  useConnect,
3104
3030
  useCreateSessionKey,
3031
+ useDelegate,
3105
3032
  useDelegation,
3106
3033
  useDelegationPolicy,
3107
3034
  useDisconnect,