@naculus/connect-appkit-vue 0.9.0 → 0.10.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 +6 -0
- package/dist/index.cjs +413 -393
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +249 -228
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
package/dist/index.cjs
CHANGED
|
@@ -113,7 +113,8 @@ __export(index_exports, {
|
|
|
113
113
|
useTxHistory: () => useTxHistory,
|
|
114
114
|
useTxMonitor: () => useTxMonitor,
|
|
115
115
|
useUserOpStatus: () => useUserOpStatus,
|
|
116
|
-
useValidateDestination: () => useValidateDestination
|
|
116
|
+
useValidateDestination: () => useValidateDestination,
|
|
117
|
+
useX402Signer: () => useX402Signer
|
|
117
118
|
});
|
|
118
119
|
module.exports = __toCommonJS(index_exports);
|
|
119
120
|
|
|
@@ -1102,12 +1103,30 @@ function useSwitchChain(action, chainId) {
|
|
|
1102
1103
|
};
|
|
1103
1104
|
}
|
|
1104
1105
|
|
|
1105
|
-
// src/
|
|
1106
|
+
// src/useX402Signer.ts
|
|
1107
|
+
var import_connect_appkit_core9 = require("@naculus/connect-appkit-core");
|
|
1106
1108
|
var import_vue15 = require("vue");
|
|
1109
|
+
function useX402Signer(session, provider, switchChain, chainId) {
|
|
1110
|
+
const resolved = (0, import_vue15.computed)(() => {
|
|
1111
|
+
(0, import_vue15.toValue)(chainId);
|
|
1112
|
+
return (0, import_connect_appkit_core9.createX402WalletSigner)(
|
|
1113
|
+
(0, import_vue15.toValue)(session),
|
|
1114
|
+
(0, import_vue15.toValue)(provider),
|
|
1115
|
+
(0, import_vue15.unref)(switchChain)
|
|
1116
|
+
);
|
|
1117
|
+
});
|
|
1118
|
+
return {
|
|
1119
|
+
signer: (0, import_vue15.computed)(() => resolved.value.signer),
|
|
1120
|
+
reason: (0, import_vue15.computed)(() => resolved.value.reason)
|
|
1121
|
+
};
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
// src/useSignMessage.ts
|
|
1125
|
+
var import_vue16 = require("vue");
|
|
1107
1126
|
function useSignMessage(action) {
|
|
1108
1127
|
const guard = useActionGuard();
|
|
1109
1128
|
const signMessage = (message) => {
|
|
1110
|
-
const invoke = (0,
|
|
1129
|
+
const invoke = (0, import_vue16.unref)(action);
|
|
1111
1130
|
return guard.run(() => invoke(message), "Signing failed");
|
|
1112
1131
|
};
|
|
1113
1132
|
return {
|
|
@@ -1119,12 +1138,12 @@ function useSignMessage(action) {
|
|
|
1119
1138
|
}
|
|
1120
1139
|
|
|
1121
1140
|
// src/useSendTransaction.ts
|
|
1122
|
-
var
|
|
1141
|
+
var import_vue17 = require("vue");
|
|
1123
1142
|
function useSendTransaction(action) {
|
|
1124
1143
|
const guard = useActionGuard();
|
|
1125
|
-
const status = (0,
|
|
1144
|
+
const status = (0, import_vue17.shallowRef)("idle");
|
|
1126
1145
|
const sendTransaction = (transaction) => {
|
|
1127
|
-
const invoke = (0,
|
|
1146
|
+
const invoke = (0, import_vue17.unref)(action);
|
|
1128
1147
|
status.value = "awaiting_approval";
|
|
1129
1148
|
return guard.run(async (commit) => {
|
|
1130
1149
|
const hash = await invoke(transaction);
|
|
@@ -1146,20 +1165,20 @@ function useSendTransaction(action) {
|
|
|
1146
1165
|
status,
|
|
1147
1166
|
error: guard.error,
|
|
1148
1167
|
reset,
|
|
1149
|
-
isSending: (0,
|
|
1168
|
+
isSending: (0, import_vue17.computed)(() => status.value === "awaiting_approval")
|
|
1150
1169
|
};
|
|
1151
1170
|
}
|
|
1152
1171
|
|
|
1153
1172
|
// src/useSolanaTransaction.ts
|
|
1154
|
-
var
|
|
1173
|
+
var import_vue18 = require("vue");
|
|
1155
1174
|
function useSolanaTransaction(options) {
|
|
1156
1175
|
const guard = useActionGuard();
|
|
1157
|
-
const isSigning = (0,
|
|
1158
|
-
const isSending = (0,
|
|
1176
|
+
const isSigning = (0, import_vue18.shallowRef)(false);
|
|
1177
|
+
const isSending = (0, import_vue18.shallowRef)(false);
|
|
1159
1178
|
let signing = 0;
|
|
1160
1179
|
let sending = 0;
|
|
1161
1180
|
const signTransaction = (transaction) => {
|
|
1162
|
-
const invoke = (0,
|
|
1181
|
+
const invoke = (0, import_vue18.unref)(options.signTransaction);
|
|
1163
1182
|
signing++;
|
|
1164
1183
|
isSigning.value = true;
|
|
1165
1184
|
return guard.run(() => invoke(transaction), "Signing failed").finally(() => {
|
|
@@ -1168,7 +1187,7 @@ function useSolanaTransaction(options) {
|
|
|
1168
1187
|
});
|
|
1169
1188
|
};
|
|
1170
1189
|
const sendTransaction = (transaction) => {
|
|
1171
|
-
const invoke = (0,
|
|
1190
|
+
const invoke = (0, import_vue18.unref)(options.sendTransaction);
|
|
1172
1191
|
sending++;
|
|
1173
1192
|
isSending.value = true;
|
|
1174
1193
|
return guard.run(() => invoke(transaction), "Send failed").finally(() => {
|
|
@@ -1176,7 +1195,7 @@ function useSolanaTransaction(options) {
|
|
|
1176
1195
|
isSending.value = sending > 0;
|
|
1177
1196
|
});
|
|
1178
1197
|
};
|
|
1179
|
-
const getStatus = (signature) => (0,
|
|
1198
|
+
const getStatus = (signature) => (0, import_vue18.unref)(options.getStatus)(signature);
|
|
1180
1199
|
return {
|
|
1181
1200
|
signTransaction,
|
|
1182
1201
|
sendTransaction,
|
|
@@ -1189,12 +1208,12 @@ function useSolanaTransaction(options) {
|
|
|
1189
1208
|
}
|
|
1190
1209
|
|
|
1191
1210
|
// src/useSignInWithX.ts
|
|
1192
|
-
var
|
|
1211
|
+
var import_vue19 = require("vue");
|
|
1193
1212
|
function useSignInWithX(action) {
|
|
1194
1213
|
const guard = useActionGuard();
|
|
1195
|
-
const result = (0,
|
|
1214
|
+
const result = (0, import_vue19.shallowRef)(null);
|
|
1196
1215
|
const signIn = (options) => {
|
|
1197
|
-
const invoke = (0,
|
|
1216
|
+
const invoke = (0, import_vue19.unref)(action);
|
|
1198
1217
|
return guard.run(async (commit) => {
|
|
1199
1218
|
const next = await invoke(options);
|
|
1200
1219
|
commit(() => {
|
|
@@ -1223,48 +1242,48 @@ function useSignInWithEthereum(action) {
|
|
|
1223
1242
|
}
|
|
1224
1243
|
|
|
1225
1244
|
// src/useExecuteCalls.ts
|
|
1226
|
-
var
|
|
1245
|
+
var import_vue20 = require("vue");
|
|
1227
1246
|
function useExecuteCalls(options) {
|
|
1228
1247
|
const guard = useActionGuard();
|
|
1229
|
-
const preview = (callCount, atomicity) => (0,
|
|
1248
|
+
const preview = (callCount, atomicity) => (0, import_vue20.unref)(options.preview)(callCount, atomicity);
|
|
1230
1249
|
const execute = (calls, atomicity) => {
|
|
1231
|
-
const invoke = (0,
|
|
1250
|
+
const invoke = (0, import_vue20.unref)(options.execute);
|
|
1232
1251
|
return guard.run(() => invoke(calls, atomicity), "Execution failed");
|
|
1233
1252
|
};
|
|
1234
1253
|
const reset = () => {
|
|
1235
1254
|
guard.reset();
|
|
1236
|
-
(0,
|
|
1255
|
+
(0, import_vue20.unref)(options.reset)();
|
|
1237
1256
|
};
|
|
1238
1257
|
return {
|
|
1239
1258
|
preview,
|
|
1240
1259
|
execute,
|
|
1241
1260
|
isExecuting: guard.busy,
|
|
1242
1261
|
error: guard.error,
|
|
1243
|
-
lastRoute: (0,
|
|
1262
|
+
lastRoute: (0, import_vue20.computed)(() => (0, import_vue20.toValue)(options.lastRoute)),
|
|
1244
1263
|
reset
|
|
1245
1264
|
};
|
|
1246
1265
|
}
|
|
1247
1266
|
|
|
1248
1267
|
// src/useDelegationPolicy.ts
|
|
1249
|
-
var
|
|
1250
|
-
var
|
|
1268
|
+
var import_connect_appkit_core11 = require("@naculus/connect-appkit-core");
|
|
1269
|
+
var import_vue22 = require("vue");
|
|
1251
1270
|
|
|
1252
1271
|
// src/useSessionKeys.ts
|
|
1253
|
-
var
|
|
1254
|
-
var
|
|
1272
|
+
var import_connect_appkit_core10 = require("@naculus/connect-appkit-core");
|
|
1273
|
+
var import_vue21 = require("vue");
|
|
1255
1274
|
function resolveManager(config, options) {
|
|
1256
|
-
return options.manager ?? (0,
|
|
1275
|
+
return options.manager ?? (0, import_connect_appkit_core10.getSharedSessionKeyManager)(config);
|
|
1257
1276
|
}
|
|
1258
1277
|
function useSessionKeys(connected, config, options = {}) {
|
|
1259
1278
|
const manager = resolveManager(config, options);
|
|
1260
|
-
const sessions = (0,
|
|
1261
|
-
const loading = (0,
|
|
1262
|
-
const error = (0,
|
|
1279
|
+
const sessions = (0, import_vue21.shallowRef)([]);
|
|
1280
|
+
const loading = (0, import_vue21.shallowRef)(false);
|
|
1281
|
+
const error = (0, import_vue21.shallowRef)(null);
|
|
1263
1282
|
let generation = 0;
|
|
1264
1283
|
let disposed = false;
|
|
1265
1284
|
const refresh = async () => {
|
|
1266
1285
|
const own = ++generation;
|
|
1267
|
-
if (!(0,
|
|
1286
|
+
if (!(0, import_vue21.toValue)(connected)) {
|
|
1268
1287
|
sessions.value = [];
|
|
1269
1288
|
return;
|
|
1270
1289
|
}
|
|
@@ -1281,20 +1300,20 @@ function useSessionKeys(connected, config, options = {}) {
|
|
|
1281
1300
|
if (!disposed && own === generation) loading.value = false;
|
|
1282
1301
|
}
|
|
1283
1302
|
};
|
|
1284
|
-
(0,
|
|
1285
|
-
() => (0,
|
|
1303
|
+
(0, import_vue21.watch)(
|
|
1304
|
+
() => (0, import_vue21.toValue)(connected),
|
|
1286
1305
|
() => {
|
|
1287
1306
|
void refresh();
|
|
1288
1307
|
},
|
|
1289
1308
|
{ immediate: true }
|
|
1290
1309
|
);
|
|
1291
|
-
(0,
|
|
1310
|
+
(0, import_vue21.onScopeDispose)(() => {
|
|
1292
1311
|
disposed = true;
|
|
1293
1312
|
generation++;
|
|
1294
1313
|
});
|
|
1295
1314
|
return {
|
|
1296
1315
|
sessions,
|
|
1297
|
-
activeSessions: (0,
|
|
1316
|
+
activeSessions: (0, import_vue21.computed)(
|
|
1298
1317
|
() => sessions.value.filter((s) => s.status === "active")
|
|
1299
1318
|
),
|
|
1300
1319
|
loading,
|
|
@@ -1309,7 +1328,7 @@ function useSessionKeys(connected, config, options = {}) {
|
|
|
1309
1328
|
function useCreateSessionKey(config, options = {}) {
|
|
1310
1329
|
const manager = resolveManager(config, options);
|
|
1311
1330
|
const guard = useActionGuard();
|
|
1312
|
-
const lastCreated = (0,
|
|
1331
|
+
const lastCreated = (0, import_vue21.shallowRef)(null);
|
|
1313
1332
|
return {
|
|
1314
1333
|
createSessionKey: (scope, signerAddress) => guard.run(async () => {
|
|
1315
1334
|
const info = await manager.createSessionKey(scope, signerAddress);
|
|
@@ -1355,40 +1374,40 @@ function useSendWithSession(config, options = {}) {
|
|
|
1355
1374
|
|
|
1356
1375
|
// src/useDelegationPolicy.ts
|
|
1357
1376
|
function useDelegationPolicy(options) {
|
|
1358
|
-
const manager = options.manager ?? (0,
|
|
1377
|
+
const manager = options.manager ?? (0, import_connect_appkit_core11.getSharedSessionKeyManager)(options.managerConfig);
|
|
1359
1378
|
const sessionKeys = useSessionKeys(options.connected, options.managerConfig, {
|
|
1360
1379
|
manager
|
|
1361
1380
|
});
|
|
1362
1381
|
const guard = useActionGuard();
|
|
1363
|
-
const verifiedIds = (0,
|
|
1364
|
-
const isVerifying = (0,
|
|
1365
|
-
const verifyError = (0,
|
|
1382
|
+
const verifiedIds = (0, import_vue22.shallowRef)(/* @__PURE__ */ new Set());
|
|
1383
|
+
const isVerifying = (0, import_vue22.shallowRef)(false);
|
|
1384
|
+
const verifyError = (0, import_vue22.shallowRef)(null);
|
|
1366
1385
|
let verifyGeneration = 0;
|
|
1367
1386
|
let disposed = false;
|
|
1368
1387
|
const origin = options.origin ?? (typeof window !== "undefined" ? window.location.origin : "unknown");
|
|
1369
|
-
const flow = (0,
|
|
1388
|
+
const flow = (0, import_connect_appkit_core11.createDelegationPolicyFlow)({
|
|
1370
1389
|
manager,
|
|
1371
1390
|
origin,
|
|
1372
|
-
signer: () => (0,
|
|
1373
|
-
signMessage: (message) => (0,
|
|
1374
|
-
verifySignature: (input) => (0,
|
|
1375
|
-
previewExecution: (callCount, atomicity) => (0,
|
|
1391
|
+
signer: () => (0, import_connect_appkit_core11.bareEvmAddress)((0, import_vue22.toValue)(options.account)),
|
|
1392
|
+
signMessage: (message) => (0, import_vue22.unref)(options.signMessage)(message),
|
|
1393
|
+
verifySignature: (input) => (0, import_vue22.unref)(options.verifySignature)(input),
|
|
1394
|
+
previewExecution: (callCount, atomicity) => (0, import_vue22.unref)(options.previewExecution)(callCount, atomicity),
|
|
1376
1395
|
sponsorship: options.sponsorship,
|
|
1377
1396
|
adapter: options.adapter,
|
|
1378
|
-
signTypedData: options.signTypedData ? (typedData) => (0,
|
|
1397
|
+
signTypedData: options.signTypedData ? (typedData) => (0, import_vue22.unref)(
|
|
1379
1398
|
options.signTypedData
|
|
1380
1399
|
)(typedData) : void 0,
|
|
1381
|
-
chainId: () => (0,
|
|
1382
|
-
delegation: () => (0,
|
|
1400
|
+
chainId: () => (0, import_vue22.toValue)(options.chainId) ?? null,
|
|
1401
|
+
delegation: () => (0, import_vue22.toValue)(options.delegation),
|
|
1383
1402
|
encryptionKeyConfigured: Boolean(options.managerConfig?.encryptionKey),
|
|
1384
1403
|
storageAvailable: () => sessionKeys.storageAvailable,
|
|
1385
1404
|
refresh: sessionKeys.refresh
|
|
1386
1405
|
});
|
|
1387
|
-
(0,
|
|
1406
|
+
(0, import_vue22.watch)(
|
|
1388
1407
|
() => sessionKeys.sessions.value,
|
|
1389
1408
|
(sessions) => {
|
|
1390
1409
|
const own = ++verifyGeneration;
|
|
1391
|
-
const candidates = sessions.filter(
|
|
1410
|
+
const candidates = sessions.filter(import_connect_appkit_core11.isVerifiablePolicy);
|
|
1392
1411
|
if (candidates.length === 0) {
|
|
1393
1412
|
verifiedIds.value = /* @__PURE__ */ new Set();
|
|
1394
1413
|
isVerifying.value = false;
|
|
@@ -1414,21 +1433,21 @@ function useDelegationPolicy(options) {
|
|
|
1414
1433
|
},
|
|
1415
1434
|
{ immediate: true }
|
|
1416
1435
|
);
|
|
1417
|
-
(0,
|
|
1436
|
+
(0, import_vue22.onScopeDispose)(() => {
|
|
1418
1437
|
disposed = true;
|
|
1419
1438
|
verifyGeneration++;
|
|
1420
1439
|
});
|
|
1421
1440
|
return {
|
|
1422
1441
|
policies: sessionKeys.sessions,
|
|
1423
|
-
activePolicies: (0,
|
|
1442
|
+
activePolicies: (0, import_vue22.computed)(
|
|
1424
1443
|
() => sessionKeys.activeSessions.value.filter(
|
|
1425
1444
|
(p) => verifiedIds.value.has(p.id)
|
|
1426
1445
|
)
|
|
1427
1446
|
),
|
|
1428
1447
|
storageAvailable: sessionKeys.storageAvailable,
|
|
1429
|
-
loading: (0,
|
|
1448
|
+
loading: (0, import_vue22.computed)(() => sessionKeys.loading.value || isVerifying.value),
|
|
1430
1449
|
isBusy: guard.busy,
|
|
1431
|
-
error: (0,
|
|
1450
|
+
error: (0, import_vue22.computed)(
|
|
1432
1451
|
() => guard.error.value ?? verifyError.value ?? sessionKeys.error.value
|
|
1433
1452
|
),
|
|
1434
1453
|
createPolicy: (scope) => guard.run(() => flow.createPolicy(scope), "Policy creation failed"),
|
|
@@ -1449,29 +1468,29 @@ function useDelegationPolicy(options) {
|
|
|
1449
1468
|
}
|
|
1450
1469
|
|
|
1451
1470
|
// src/useSmartAccount.ts
|
|
1452
|
-
var
|
|
1471
|
+
var import_connect_appkit_core12 = require("@naculus/connect-appkit-core");
|
|
1453
1472
|
var import_connect_core10 = require("@naculus/connect-core");
|
|
1454
|
-
var
|
|
1473
|
+
var import_vue23 = require("vue");
|
|
1455
1474
|
function useSmartAccount(options) {
|
|
1456
|
-
const address = (0,
|
|
1457
|
-
const isDeployed = (0,
|
|
1458
|
-
const accountInfo = (0,
|
|
1475
|
+
const address = (0, import_vue23.shallowRef)(null);
|
|
1476
|
+
const isDeployed = (0, import_vue23.shallowRef)(false);
|
|
1477
|
+
const accountInfo = (0, import_vue23.shallowRef)(null);
|
|
1459
1478
|
const guard = useActionGuard();
|
|
1460
|
-
const managerRef = (0,
|
|
1479
|
+
const managerRef = (0, import_vue23.shallowRef)(null);
|
|
1461
1480
|
let generation = 0;
|
|
1462
1481
|
let inFlight = false;
|
|
1463
1482
|
let disposed = false;
|
|
1464
|
-
const chainId = (0,
|
|
1465
|
-
() => (0,
|
|
1466
|
-
(0,
|
|
1467
|
-
(0,
|
|
1483
|
+
const chainId = (0, import_vue23.computed)(
|
|
1484
|
+
() => (0, import_connect_appkit_core12.resolveEvmChainId)(
|
|
1485
|
+
(0, import_vue23.toValue)(options.chainId),
|
|
1486
|
+
(0, import_vue23.toValue)(options.connectedChainId)
|
|
1468
1487
|
)
|
|
1469
1488
|
);
|
|
1470
|
-
(0,
|
|
1489
|
+
(0, import_vue23.watch)(
|
|
1471
1490
|
[
|
|
1472
|
-
() => (0,
|
|
1473
|
-
() => (0,
|
|
1474
|
-
() => (0,
|
|
1491
|
+
() => (0, import_vue23.toValue)(options.manager),
|
|
1492
|
+
() => (0, import_vue23.toValue)(options.rpcUrl),
|
|
1493
|
+
() => (0, import_vue23.toValue)(options.bundlerUrl),
|
|
1475
1494
|
() => chainId.value
|
|
1476
1495
|
],
|
|
1477
1496
|
([supplied, rpcUrl, bundlerUrl, chain]) => {
|
|
@@ -1496,11 +1515,11 @@ function useSmartAccount(options) {
|
|
|
1496
1515
|
},
|
|
1497
1516
|
{ immediate: true }
|
|
1498
1517
|
);
|
|
1499
|
-
const config = (0,
|
|
1500
|
-
const owner = (0,
|
|
1518
|
+
const config = (0, import_vue23.computed)(() => {
|
|
1519
|
+
const owner = (0, import_connect_appkit_core12.bareEvmAddress)((0, import_vue23.toValue)(options.account));
|
|
1501
1520
|
const chain = chainId.value;
|
|
1502
1521
|
if (!owner || !chain || !managerRef.value) return null;
|
|
1503
|
-
return (0,
|
|
1522
|
+
return (0, import_connect_appkit_core12.buildSmartAccountConfig)(owner, chain, {
|
|
1504
1523
|
accountType: options.accountType,
|
|
1505
1524
|
entryPoint: options.entryPoint,
|
|
1506
1525
|
salt: options.salt
|
|
@@ -1547,7 +1566,7 @@ function useSmartAccount(options) {
|
|
|
1547
1566
|
return info;
|
|
1548
1567
|
}, "Failed to create smart account");
|
|
1549
1568
|
const deployWallet = () => operate(async (manager, cfg, commit) => {
|
|
1550
|
-
const send = (0,
|
|
1569
|
+
const send = (0, import_vue23.unref)(options.sendTransaction);
|
|
1551
1570
|
if (!send) {
|
|
1552
1571
|
throw new import_connect_core10.WalletError(
|
|
1553
1572
|
"wallet_unavailable",
|
|
@@ -1577,7 +1596,7 @@ function useSmartAccount(options) {
|
|
|
1577
1596
|
});
|
|
1578
1597
|
return addr;
|
|
1579
1598
|
}, "Failed to get smart account address");
|
|
1580
|
-
(0,
|
|
1599
|
+
(0, import_vue23.onScopeDispose)(() => {
|
|
1581
1600
|
disposed = true;
|
|
1582
1601
|
generation++;
|
|
1583
1602
|
});
|
|
@@ -1595,15 +1614,15 @@ function useSmartAccount(options) {
|
|
|
1595
1614
|
}
|
|
1596
1615
|
|
|
1597
1616
|
// src/useSendUserOperation.ts
|
|
1598
|
-
var
|
|
1617
|
+
var import_connect_appkit_core13 = require("@naculus/connect-appkit-core");
|
|
1599
1618
|
var import_connect_core11 = require("@naculus/connect-core");
|
|
1600
|
-
var
|
|
1619
|
+
var import_vue24 = require("vue");
|
|
1601
1620
|
function useSendUserOperation(options) {
|
|
1602
|
-
const userOpHash = (0,
|
|
1603
|
-
const receipt = (0,
|
|
1604
|
-
const isPending = (0,
|
|
1605
|
-
const isEstimating = (0,
|
|
1606
|
-
const error = (0,
|
|
1621
|
+
const userOpHash = (0, import_vue24.shallowRef)(null);
|
|
1622
|
+
const receipt = (0, import_vue24.shallowRef)(null);
|
|
1623
|
+
const isPending = (0, import_vue24.shallowRef)(false);
|
|
1624
|
+
const isEstimating = (0, import_vue24.shallowRef)(false);
|
|
1625
|
+
const error = (0, import_vue24.shallowRef)(null);
|
|
1607
1626
|
let requestId = 0;
|
|
1608
1627
|
let inFlight = false;
|
|
1609
1628
|
let disposed = false;
|
|
@@ -1612,16 +1631,16 @@ function useSendUserOperation(options) {
|
|
|
1612
1631
|
return null;
|
|
1613
1632
|
};
|
|
1614
1633
|
const sendUserOp = async (calls, opts) => {
|
|
1615
|
-
const rpcUrl = (0,
|
|
1616
|
-
const bundlerUrl = (0,
|
|
1634
|
+
const rpcUrl = (0, import_vue24.toValue)(options.rpcUrl);
|
|
1635
|
+
const bundlerUrl = (0, import_vue24.toValue)(options.bundlerUrl);
|
|
1617
1636
|
if (!rpcUrl) return fail(new Error("RPC URL not configured"));
|
|
1618
1637
|
if (!bundlerUrl) return fail(new Error("Bundler URL not configured"));
|
|
1619
1638
|
if (!calls.length) return fail(new Error("At least one call is required"));
|
|
1620
1639
|
if (inFlight) {
|
|
1621
1640
|
return fail(new Error("A UserOperation is already in progress"));
|
|
1622
1641
|
}
|
|
1623
|
-
const owner = (0,
|
|
1624
|
-
(0,
|
|
1642
|
+
const owner = (0, import_connect_appkit_core13.bareEvmAddress)(
|
|
1643
|
+
(0, import_vue24.toValue)(options.owner) ?? (0, import_vue24.toValue)(options.account)
|
|
1625
1644
|
);
|
|
1626
1645
|
if (!owner) {
|
|
1627
1646
|
return fail(
|
|
@@ -1630,14 +1649,14 @@ function useSendUserOperation(options) {
|
|
|
1630
1649
|
}
|
|
1631
1650
|
let targetChainId;
|
|
1632
1651
|
try {
|
|
1633
|
-
targetChainId = (0,
|
|
1634
|
-
(0,
|
|
1635
|
-
(0,
|
|
1652
|
+
targetChainId = (0, import_connect_appkit_core13.resolveUserOpChain)(
|
|
1653
|
+
(0, import_vue24.toValue)(options.chainId),
|
|
1654
|
+
(0, import_vue24.toValue)(options.connectedChainId)
|
|
1636
1655
|
);
|
|
1637
1656
|
} catch (chainError) {
|
|
1638
1657
|
return fail(chainError);
|
|
1639
1658
|
}
|
|
1640
|
-
const signer = (0,
|
|
1659
|
+
const signer = (0, import_vue24.unref)(options.signer);
|
|
1641
1660
|
const own = ++requestId;
|
|
1642
1661
|
inFlight = true;
|
|
1643
1662
|
isPending.value = true;
|
|
@@ -1654,7 +1673,7 @@ function useSendUserOperation(options) {
|
|
|
1654
1673
|
signer,
|
|
1655
1674
|
signerMode: options.signerMode ?? "eip191"
|
|
1656
1675
|
});
|
|
1657
|
-
const config = (0,
|
|
1676
|
+
const config = (0, import_connect_appkit_core13.buildSmartAccountConfig)(owner, targetChainId, {
|
|
1658
1677
|
accountType: options.accountType,
|
|
1659
1678
|
entryPoint: options.entryPoint,
|
|
1660
1679
|
salt: options.salt
|
|
@@ -1688,7 +1707,7 @@ function useSendUserOperation(options) {
|
|
|
1688
1707
|
isEstimating.value = false;
|
|
1689
1708
|
error.value = null;
|
|
1690
1709
|
};
|
|
1691
|
-
(0,
|
|
1710
|
+
(0, import_vue24.onScopeDispose)(() => {
|
|
1692
1711
|
disposed = true;
|
|
1693
1712
|
requestId++;
|
|
1694
1713
|
});
|
|
@@ -1704,16 +1723,16 @@ function useSendUserOperation(options) {
|
|
|
1704
1723
|
}
|
|
1705
1724
|
|
|
1706
1725
|
// src/useUserOpStatus.ts
|
|
1707
|
-
var
|
|
1708
|
-
var
|
|
1726
|
+
var import_connect_appkit_core14 = require("@naculus/connect-appkit-core");
|
|
1727
|
+
var import_vue25 = require("vue");
|
|
1709
1728
|
function useUserOpStatus(options) {
|
|
1710
|
-
const status = (0,
|
|
1711
|
-
const receipt = (0,
|
|
1712
|
-
const userOpHash = (0,
|
|
1713
|
-
const error = (0,
|
|
1714
|
-
const isPolling = (0,
|
|
1715
|
-
const elapsedMs = (0,
|
|
1716
|
-
const attempts = (0,
|
|
1729
|
+
const status = (0, import_vue25.shallowRef)("idle");
|
|
1730
|
+
const receipt = (0, import_vue25.shallowRef)(null);
|
|
1731
|
+
const userOpHash = (0, import_vue25.shallowRef)(null);
|
|
1732
|
+
const error = (0, import_vue25.shallowRef)(null);
|
|
1733
|
+
const isPolling = (0, import_vue25.shallowRef)(false);
|
|
1734
|
+
const elapsedMs = (0, import_vue25.shallowRef)(0);
|
|
1735
|
+
const attempts = (0, import_vue25.shallowRef)(0);
|
|
1717
1736
|
const pollInterval = options.pollInterval ?? 2e3;
|
|
1718
1737
|
const maxRetries = options.maxRetries ?? 30;
|
|
1719
1738
|
let generation = 0;
|
|
@@ -1734,13 +1753,13 @@ function useUserOpStatus(options) {
|
|
|
1734
1753
|
clearTimers();
|
|
1735
1754
|
};
|
|
1736
1755
|
const poll = async (hash, own) => {
|
|
1737
|
-
const bundlerUrl = (0,
|
|
1756
|
+
const bundlerUrl = (0, import_vue25.toValue)(options.bundlerUrl);
|
|
1738
1757
|
if (!bundlerUrl || own !== generation) return;
|
|
1739
1758
|
const attempt = ++attempts.value;
|
|
1740
1759
|
const abort = new AbortController();
|
|
1741
1760
|
controller = abort;
|
|
1742
1761
|
try {
|
|
1743
|
-
const next = await (0,
|
|
1762
|
+
const next = await (0, import_connect_appkit_core14.fetchUserOperationReceipt)(
|
|
1744
1763
|
bundlerUrl,
|
|
1745
1764
|
hash,
|
|
1746
1765
|
abort.signal
|
|
@@ -1763,7 +1782,7 @@ function useUserOpStatus(options) {
|
|
|
1763
1782
|
} catch (cause) {
|
|
1764
1783
|
if (own !== generation || abort.signal.aborted) return;
|
|
1765
1784
|
const next = cause instanceof Error ? cause : new Error("Unknown bundler response failure");
|
|
1766
|
-
if (next instanceof
|
|
1785
|
+
if (next instanceof import_connect_appkit_core14.InvalidUserOperationReceiptError) {
|
|
1767
1786
|
finish("not_found", next);
|
|
1768
1787
|
return;
|
|
1769
1788
|
}
|
|
@@ -1791,7 +1810,7 @@ function useUserOpStatus(options) {
|
|
|
1791
1810
|
error.value = null;
|
|
1792
1811
|
attempts.value = 0;
|
|
1793
1812
|
elapsedMs.value = 0;
|
|
1794
|
-
if (!(0,
|
|
1813
|
+
if (!(0, import_vue25.toValue)(options.bundlerUrl)) {
|
|
1795
1814
|
finish("not_found", new Error("Bundler URL not configured"));
|
|
1796
1815
|
return;
|
|
1797
1816
|
}
|
|
@@ -1819,7 +1838,7 @@ function useUserOpStatus(options) {
|
|
|
1819
1838
|
attempts.value = 0;
|
|
1820
1839
|
elapsedMs.value = 0;
|
|
1821
1840
|
};
|
|
1822
|
-
(0,
|
|
1841
|
+
(0, import_vue25.onScopeDispose)(stop);
|
|
1823
1842
|
return {
|
|
1824
1843
|
status,
|
|
1825
1844
|
receipt,
|
|
@@ -1835,17 +1854,17 @@ function useUserOpStatus(options) {
|
|
|
1835
1854
|
}
|
|
1836
1855
|
|
|
1837
1856
|
// src/useSendCalls.ts
|
|
1838
|
-
var
|
|
1857
|
+
var import_vue26 = require("vue");
|
|
1839
1858
|
function useSendCalls(options) {
|
|
1840
|
-
const status = (0,
|
|
1841
|
-
const error = (0,
|
|
1842
|
-
const batchHash = (0,
|
|
1843
|
-
const callsStatus = (0,
|
|
1859
|
+
const status = (0, import_vue26.shallowRef)("idle");
|
|
1860
|
+
const error = (0, import_vue26.shallowRef)(null);
|
|
1861
|
+
const batchHash = (0, import_vue26.shallowRef)(null);
|
|
1862
|
+
const callsStatus = (0, import_vue26.shallowRef)(null);
|
|
1844
1863
|
let sendGeneration = 0;
|
|
1845
1864
|
let statusGeneration = 0;
|
|
1846
1865
|
let disposed = false;
|
|
1847
1866
|
const sendCalls = async (calls, input) => {
|
|
1848
|
-
const invoke = (0,
|
|
1867
|
+
const invoke = (0, import_vue26.unref)(options.sendCalls);
|
|
1849
1868
|
const own = ++sendGeneration;
|
|
1850
1869
|
status.value = "awaiting_approval";
|
|
1851
1870
|
error.value = null;
|
|
@@ -1867,13 +1886,13 @@ function useSendCalls(options) {
|
|
|
1867
1886
|
}
|
|
1868
1887
|
};
|
|
1869
1888
|
const getCallsStatus = async (hash) => {
|
|
1870
|
-
const invoke = (0,
|
|
1889
|
+
const invoke = (0, import_vue26.unref)(options.getCallsStatus);
|
|
1871
1890
|
const own = ++statusGeneration;
|
|
1872
1891
|
const result = await invoke(hash);
|
|
1873
1892
|
if (!disposed && own === statusGeneration) callsStatus.value = result;
|
|
1874
1893
|
return result;
|
|
1875
1894
|
};
|
|
1876
|
-
const showCallsStatus = (hash) => (0,
|
|
1895
|
+
const showCallsStatus = (hash) => (0, import_vue26.unref)(options.showCallsStatus)(hash);
|
|
1877
1896
|
const reset = () => {
|
|
1878
1897
|
sendGeneration++;
|
|
1879
1898
|
statusGeneration++;
|
|
@@ -1882,7 +1901,7 @@ function useSendCalls(options) {
|
|
|
1882
1901
|
batchHash.value = null;
|
|
1883
1902
|
callsStatus.value = null;
|
|
1884
1903
|
};
|
|
1885
|
-
(0,
|
|
1904
|
+
(0, import_vue26.onScopeDispose)(() => {
|
|
1886
1905
|
disposed = true;
|
|
1887
1906
|
sendGeneration++;
|
|
1888
1907
|
statusGeneration++;
|
|
@@ -1895,38 +1914,38 @@ function useSendCalls(options) {
|
|
|
1895
1914
|
error,
|
|
1896
1915
|
batchHash,
|
|
1897
1916
|
callsStatus,
|
|
1898
|
-
execution: (0,
|
|
1899
|
-
isSending: (0,
|
|
1917
|
+
execution: (0, import_vue26.computed)(() => (0, import_vue26.toValue)(options.execution) ?? null),
|
|
1918
|
+
isSending: (0, import_vue26.computed)(() => status.value === "awaiting_approval"),
|
|
1900
1919
|
reset
|
|
1901
1920
|
};
|
|
1902
1921
|
}
|
|
1903
1922
|
|
|
1904
1923
|
// src/useEmbeddedWallet.ts
|
|
1905
|
-
var
|
|
1924
|
+
var import_vue27 = require("vue");
|
|
1906
1925
|
function useEmbeddedWallet(options) {
|
|
1907
1926
|
const guard = useActionGuard();
|
|
1908
1927
|
const run = (action) => guard.run(action, "Embedded wallet action failed");
|
|
1909
|
-
const wallet = (0,
|
|
1928
|
+
const wallet = (0, import_vue27.computed)(() => (0, import_vue27.toValue)(options.wallet));
|
|
1910
1929
|
return {
|
|
1911
1930
|
wallet,
|
|
1912
|
-
hasWallet: (0,
|
|
1913
|
-
address: (0,
|
|
1914
|
-
accounts: (0,
|
|
1915
|
-
activeNamespace: (0,
|
|
1916
|
-
backupPending: (0,
|
|
1917
|
-
storageSecurityLevel: (0,
|
|
1918
|
-
securityReport: (0,
|
|
1919
|
-
connectEmbedded: () => run(() => (0,
|
|
1920
|
-
restoreWallet: () => run(() => (0,
|
|
1921
|
-
generateWallet: () => run(() => (0,
|
|
1922
|
-
importFromMnemonic: (value) => run(() => (0,
|
|
1923
|
-
importFromPrivateKey: (value) => run(() => (0,
|
|
1924
|
-
wipe: () => run(() => (0,
|
|
1925
|
-
setActiveNamespace: (value) => (0,
|
|
1926
|
-
backfillAccounts: () => run(() => (0,
|
|
1927
|
-
getSeedPhrase: () => (0,
|
|
1928
|
-
getPrivateKey: () => (0,
|
|
1929
|
-
confirmBackup: () => (0,
|
|
1931
|
+
hasWallet: (0, import_vue27.computed)(() => wallet.value !== null),
|
|
1932
|
+
address: (0, import_vue27.computed)(() => wallet.value?.address ?? null),
|
|
1933
|
+
accounts: (0, import_vue27.computed)(() => wallet.value?.accounts ?? []),
|
|
1934
|
+
activeNamespace: (0, import_vue27.computed)(() => wallet.value?.activeNamespace ?? null),
|
|
1935
|
+
backupPending: (0, import_vue27.computed)(() => (0, import_vue27.toValue)(options.backupPending)),
|
|
1936
|
+
storageSecurityLevel: (0, import_vue27.computed)(() => (0, import_vue27.toValue)(options.storageSecurityLevel)),
|
|
1937
|
+
securityReport: (0, import_vue27.computed)(() => (0, import_vue27.toValue)(options.securityReport)),
|
|
1938
|
+
connectEmbedded: () => run(() => (0, import_vue27.unref)(options.connectEmbedded)()),
|
|
1939
|
+
restoreWallet: () => run(() => (0, import_vue27.unref)(options.restoreWallet)()),
|
|
1940
|
+
generateWallet: () => run(() => (0, import_vue27.unref)(options.generateWallet)()),
|
|
1941
|
+
importFromMnemonic: (value) => run(() => (0, import_vue27.unref)(options.importFromMnemonic)(value)),
|
|
1942
|
+
importFromPrivateKey: (value) => run(() => (0, import_vue27.unref)(options.importFromPrivateKey)(value)),
|
|
1943
|
+
wipe: () => run(() => (0, import_vue27.unref)(options.wipe)()),
|
|
1944
|
+
setActiveNamespace: (value) => (0, import_vue27.unref)(options.setActiveNamespace)(value),
|
|
1945
|
+
backfillAccounts: () => run(() => (0, import_vue27.unref)(options.backfillAccounts)()),
|
|
1946
|
+
getSeedPhrase: () => (0, import_vue27.unref)(options.getSeedPhrase)(),
|
|
1947
|
+
getPrivateKey: () => (0, import_vue27.unref)(options.getPrivateKey)(),
|
|
1948
|
+
confirmBackup: () => (0, import_vue27.unref)(options.confirmBackup)(),
|
|
1930
1949
|
isBusy: guard.busy,
|
|
1931
1950
|
error: guard.error,
|
|
1932
1951
|
clearError: guard.clearError
|
|
@@ -1945,43 +1964,43 @@ function useSIWxLogin(action) {
|
|
|
1945
1964
|
}
|
|
1946
1965
|
|
|
1947
1966
|
// src/useSIWxSession.ts
|
|
1948
|
-
var
|
|
1967
|
+
var import_vue28 = require("vue");
|
|
1949
1968
|
function useSIWxSession(options) {
|
|
1950
1969
|
const guard = useActionGuard();
|
|
1951
1970
|
return {
|
|
1952
|
-
session: (0,
|
|
1953
|
-
isAuthenticated: (0,
|
|
1954
|
-
() => (0,
|
|
1971
|
+
session: (0, import_vue28.computed)(() => (0, import_vue28.toValue)(options.session)),
|
|
1972
|
+
isAuthenticated: (0, import_vue28.computed)(
|
|
1973
|
+
() => (0, import_vue28.toValue)(options.session) !== null && !(0, import_vue28.toValue)(options.isExpired)
|
|
1955
1974
|
),
|
|
1956
|
-
isRestoring: (0,
|
|
1975
|
+
isRestoring: (0, import_vue28.computed)(() => (0, import_vue28.toValue)(options.isRestoring)),
|
|
1957
1976
|
isSigningIn: guard.busy,
|
|
1958
|
-
isExpired: (0,
|
|
1959
|
-
timeUntilExpiry: (0,
|
|
1960
|
-
signIn: (input) => guard.run(() => (0,
|
|
1977
|
+
isExpired: (0, import_vue28.computed)(() => (0, import_vue28.toValue)(options.isExpired)),
|
|
1978
|
+
timeUntilExpiry: (0, import_vue28.computed)(() => (0, import_vue28.toValue)(options.timeUntilExpiry)),
|
|
1979
|
+
signIn: (input) => guard.run(() => (0, import_vue28.unref)(options.signIn)(input), "SIWX sign-in failed"),
|
|
1961
1980
|
signOut: async () => {
|
|
1962
|
-
await (0,
|
|
1981
|
+
await (0, import_vue28.unref)(options.signOut)();
|
|
1963
1982
|
guard.clearError();
|
|
1964
1983
|
},
|
|
1965
|
-
refresh: () => guard.run(() => (0,
|
|
1984
|
+
refresh: () => guard.run(() => (0, import_vue28.unref)(options.refresh)(), "Session refresh failed"),
|
|
1966
1985
|
error: guard.error,
|
|
1967
1986
|
clearError: guard.clearError
|
|
1968
1987
|
};
|
|
1969
1988
|
}
|
|
1970
1989
|
|
|
1971
1990
|
// src/useSiwxAuthSession.ts
|
|
1972
|
-
var
|
|
1991
|
+
var import_vue29 = require("vue");
|
|
1973
1992
|
function useSiwxAuthSession(options) {
|
|
1974
1993
|
const guard = useActionGuard();
|
|
1975
|
-
const signIn = (input) => guard.run(() => (0,
|
|
1994
|
+
const signIn = (input) => guard.run(() => (0, import_vue29.unref)(options.signIn)(input), "SIWX sign-in failed");
|
|
1976
1995
|
const signOut = async () => {
|
|
1977
1996
|
guard.reset();
|
|
1978
|
-
await (0,
|
|
1997
|
+
await (0, import_vue29.unref)(options.signOut)();
|
|
1979
1998
|
guard.clearError();
|
|
1980
1999
|
};
|
|
1981
|
-
const siwxResult = (0,
|
|
2000
|
+
const siwxResult = (0, import_vue29.computed)(() => (0, import_vue29.toValue)(options.result));
|
|
1982
2001
|
return {
|
|
1983
|
-
isSignedIn: (0,
|
|
1984
|
-
isRestoring: (0,
|
|
2002
|
+
isSignedIn: (0, import_vue29.computed)(() => siwxResult.value !== null),
|
|
2003
|
+
isRestoring: (0, import_vue29.computed)(() => (0, import_vue29.toValue)(options.isRestoring)),
|
|
1985
2004
|
siwxResult,
|
|
1986
2005
|
isSigningIn: guard.busy,
|
|
1987
2006
|
error: guard.error,
|
|
@@ -1992,17 +2011,17 @@ function useSiwxAuthSession(options) {
|
|
|
1992
2011
|
}
|
|
1993
2012
|
|
|
1994
2013
|
// src/useBalance.ts
|
|
1995
|
-
var
|
|
2014
|
+
var import_connect_appkit_core15 = require("@naculus/connect-appkit-core");
|
|
1996
2015
|
var import_connect_core12 = require("@naculus/connect-core");
|
|
1997
|
-
var
|
|
2016
|
+
var import_vue30 = require("vue");
|
|
1998
2017
|
function useBalance(account, client, options = {}) {
|
|
1999
2018
|
const guard = useActionGuard();
|
|
2000
|
-
const balance = (0,
|
|
2001
|
-
const isFetching = (0,
|
|
2019
|
+
const balance = (0, import_vue30.shallowRef)(null);
|
|
2020
|
+
const isFetching = (0, import_vue30.shallowRef)(false);
|
|
2002
2021
|
let timer = null;
|
|
2003
2022
|
const refetch = async () => {
|
|
2004
|
-
const reader = (0,
|
|
2005
|
-
const address = (0,
|
|
2023
|
+
const reader = (0, import_vue30.toValue)(client);
|
|
2024
|
+
const address = (0, import_connect_appkit_core15.bareEvmAddress)((0, import_vue30.toValue)(account));
|
|
2006
2025
|
if (!reader || !address) {
|
|
2007
2026
|
guard.reset();
|
|
2008
2027
|
balance.value = null;
|
|
@@ -2038,11 +2057,11 @@ function useBalance(account, client, options = {}) {
|
|
|
2038
2057
|
if (timer) clearInterval(timer);
|
|
2039
2058
|
timer = null;
|
|
2040
2059
|
};
|
|
2041
|
-
(0,
|
|
2060
|
+
(0, import_vue30.watch)(
|
|
2042
2061
|
[
|
|
2043
|
-
() => (0,
|
|
2044
|
-
() => (0,
|
|
2045
|
-
() => (0,
|
|
2062
|
+
() => (0, import_vue30.toValue)(account),
|
|
2063
|
+
() => (0, import_vue30.toValue)(client),
|
|
2064
|
+
() => (0, import_vue30.toValue)(options.refreshInterval) ?? 0
|
|
2046
2065
|
],
|
|
2047
2066
|
([, , interval]) => {
|
|
2048
2067
|
stopTimer();
|
|
@@ -2051,13 +2070,13 @@ function useBalance(account, client, options = {}) {
|
|
|
2051
2070
|
},
|
|
2052
2071
|
{ immediate: true }
|
|
2053
2072
|
);
|
|
2054
|
-
(0,
|
|
2073
|
+
(0, import_vue30.onScopeDispose)(stopTimer);
|
|
2055
2074
|
return {
|
|
2056
2075
|
balance,
|
|
2057
|
-
formatted: (0,
|
|
2058
|
-
() => balance.value === null ? null : (0, import_connect_core12.formatUnits)(BigInt(balance.value), (0,
|
|
2076
|
+
formatted: (0, import_vue30.computed)(
|
|
2077
|
+
() => balance.value === null ? null : (0, import_connect_core12.formatUnits)(BigInt(balance.value), (0, import_vue30.toValue)(options.decimals) ?? 18)
|
|
2059
2078
|
),
|
|
2060
|
-
symbol: (0,
|
|
2079
|
+
symbol: (0, import_vue30.computed)(() => (0, import_vue30.toValue)(options.symbol) ?? null),
|
|
2061
2080
|
isFetching,
|
|
2062
2081
|
error: guard.error,
|
|
2063
2082
|
refetch
|
|
@@ -2065,25 +2084,25 @@ function useBalance(account, client, options = {}) {
|
|
|
2065
2084
|
}
|
|
2066
2085
|
|
|
2067
2086
|
// src/useRouteQuote.ts
|
|
2068
|
-
var
|
|
2069
|
-
var
|
|
2087
|
+
var import_connect_appkit_core16 = require("@naculus/connect-appkit-core");
|
|
2088
|
+
var import_vue31 = require("vue");
|
|
2070
2089
|
function useRouteQuote(input, getQuotes, options = {}) {
|
|
2071
2090
|
const guard = useActionGuard();
|
|
2072
|
-
const quotes = (0,
|
|
2073
|
-
const loading = (0,
|
|
2091
|
+
const quotes = (0, import_vue31.shallowRef)([]);
|
|
2092
|
+
const loading = (0, import_vue31.shallowRef)(false);
|
|
2074
2093
|
let timer = null;
|
|
2075
2094
|
const clearTimer = () => {
|
|
2076
2095
|
if (timer) clearTimeout(timer);
|
|
2077
2096
|
timer = null;
|
|
2078
2097
|
};
|
|
2079
2098
|
const requestable = (current) => {
|
|
2080
|
-
if (!(0,
|
|
2099
|
+
if (!(0, import_connect_appkit_core16.isQuotableInput)(current)) {
|
|
2081
2100
|
guard.invalidate();
|
|
2082
2101
|
loading.value = false;
|
|
2083
2102
|
quotes.value = [];
|
|
2084
2103
|
return null;
|
|
2085
2104
|
}
|
|
2086
|
-
const fn = (0,
|
|
2105
|
+
const fn = (0, import_vue31.unref)(getQuotes);
|
|
2087
2106
|
if (!fn) {
|
|
2088
2107
|
guard.invalidate();
|
|
2089
2108
|
loading.value = false;
|
|
@@ -2092,7 +2111,7 @@ function useRouteQuote(input, getQuotes, options = {}) {
|
|
|
2092
2111
|
return fn;
|
|
2093
2112
|
};
|
|
2094
2113
|
const fetchQuotes = async () => {
|
|
2095
|
-
const current = (0,
|
|
2114
|
+
const current = (0, import_vue31.toValue)(input);
|
|
2096
2115
|
const fn = requestable(current);
|
|
2097
2116
|
if (!fn) return;
|
|
2098
2117
|
loading.value = true;
|
|
@@ -2127,19 +2146,19 @@ function useRouteQuote(input, getQuotes, options = {}) {
|
|
|
2127
2146
|
).catch(() => {
|
|
2128
2147
|
});
|
|
2129
2148
|
};
|
|
2130
|
-
(0,
|
|
2149
|
+
(0, import_vue31.watch)(
|
|
2131
2150
|
[
|
|
2132
|
-
() => (0,
|
|
2133
|
-
() => (0,
|
|
2134
|
-
() => (0,
|
|
2135
|
-
() => (0,
|
|
2136
|
-
() => (0,
|
|
2137
|
-
() => (0,
|
|
2151
|
+
() => (0, import_vue31.toValue)(input).fromChain,
|
|
2152
|
+
() => (0, import_vue31.toValue)(input).toChain,
|
|
2153
|
+
() => (0, import_vue31.toValue)(input).fromToken,
|
|
2154
|
+
() => (0, import_vue31.toValue)(input).toToken,
|
|
2155
|
+
() => (0, import_vue31.toValue)(input).amount,
|
|
2156
|
+
() => (0, import_vue31.unref)(getQuotes)
|
|
2138
2157
|
],
|
|
2139
2158
|
() => {
|
|
2140
2159
|
clearTimer();
|
|
2141
2160
|
guard.invalidate();
|
|
2142
|
-
if (!requestable((0,
|
|
2161
|
+
if (!requestable((0, import_vue31.toValue)(input))) return;
|
|
2143
2162
|
timer = setTimeout(() => {
|
|
2144
2163
|
timer = null;
|
|
2145
2164
|
void fetchQuotes();
|
|
@@ -2147,7 +2166,7 @@ function useRouteQuote(input, getQuotes, options = {}) {
|
|
|
2147
2166
|
},
|
|
2148
2167
|
{ immediate: true }
|
|
2149
2168
|
);
|
|
2150
|
-
(0,
|
|
2169
|
+
(0, import_vue31.onScopeDispose)(clearTimer);
|
|
2151
2170
|
return {
|
|
2152
2171
|
quotes,
|
|
2153
2172
|
loading,
|
|
@@ -2163,15 +2182,15 @@ function useRouteQuote(input, getQuotes, options = {}) {
|
|
|
2163
2182
|
}
|
|
2164
2183
|
|
|
2165
2184
|
// src/useCompareCosts.ts
|
|
2166
|
-
var
|
|
2167
|
-
var
|
|
2185
|
+
var import_connect_appkit_core17 = require("@naculus/connect-appkit-core");
|
|
2186
|
+
var import_vue32 = require("vue");
|
|
2168
2187
|
function useCompareCosts(input, compareCosts) {
|
|
2169
2188
|
const guard = useActionGuard();
|
|
2170
|
-
const comparisons = (0,
|
|
2171
|
-
const loading = (0,
|
|
2189
|
+
const comparisons = (0, import_vue32.shallowRef)([]);
|
|
2190
|
+
const loading = (0, import_vue32.shallowRef)(false);
|
|
2172
2191
|
const fetchComparisons = async () => {
|
|
2173
|
-
const { operation, chains, options } = (0,
|
|
2174
|
-
const fn = (0,
|
|
2192
|
+
const { operation, chains, options } = (0, import_vue32.toValue)(input);
|
|
2193
|
+
const fn = (0, import_vue32.unref)(compareCosts);
|
|
2175
2194
|
if (!chains || chains.length === 0) {
|
|
2176
2195
|
guard.invalidate();
|
|
2177
2196
|
loading.value = false;
|
|
@@ -2208,8 +2227,8 @@ function useCompareCosts(input, compareCosts) {
|
|
|
2208
2227
|
).catch(() => {
|
|
2209
2228
|
});
|
|
2210
2229
|
};
|
|
2211
|
-
(0,
|
|
2212
|
-
[() => (0,
|
|
2230
|
+
(0, import_vue32.watch)(
|
|
2231
|
+
[() => (0, import_connect_appkit_core17.compareCostsKey)((0, import_vue32.toValue)(input)), () => (0, import_vue32.unref)(compareCosts)],
|
|
2213
2232
|
() => {
|
|
2214
2233
|
void fetchComparisons();
|
|
2215
2234
|
},
|
|
@@ -2224,16 +2243,16 @@ function useCompareCosts(input, compareCosts) {
|
|
|
2224
2243
|
}
|
|
2225
2244
|
|
|
2226
2245
|
// src/useExecuteRoute.ts
|
|
2227
|
-
var
|
|
2228
|
-
var
|
|
2246
|
+
var import_connect_appkit_core18 = require("@naculus/connect-appkit-core");
|
|
2247
|
+
var import_vue33 = require("vue");
|
|
2229
2248
|
function useExecuteRoute(executeRoute) {
|
|
2230
|
-
const executing = (0,
|
|
2231
|
-
const result = (0,
|
|
2232
|
-
const error = (0,
|
|
2249
|
+
const executing = (0, import_vue33.shallowRef)(false);
|
|
2250
|
+
const result = (0, import_vue33.shallowRef)(null);
|
|
2251
|
+
const error = (0, import_vue33.shallowRef)(null);
|
|
2233
2252
|
let inFlight = false;
|
|
2234
2253
|
let disposed = false;
|
|
2235
2254
|
const execute = async (quote, recipient, options) => {
|
|
2236
|
-
const fn = (0,
|
|
2255
|
+
const fn = (0, import_vue33.unref)(executeRoute);
|
|
2237
2256
|
if (!fn) {
|
|
2238
2257
|
error.value = {
|
|
2239
2258
|
code: "no_executor",
|
|
@@ -2242,7 +2261,7 @@ function useExecuteRoute(executeRoute) {
|
|
|
2242
2261
|
result.value = null;
|
|
2243
2262
|
return null;
|
|
2244
2263
|
}
|
|
2245
|
-
const recipientError = (0,
|
|
2264
|
+
const recipientError = (0, import_connect_appkit_core18.validateRouteRecipient)(quote, recipient);
|
|
2246
2265
|
if (recipientError) {
|
|
2247
2266
|
error.value = recipientError;
|
|
2248
2267
|
result.value = null;
|
|
@@ -2264,14 +2283,14 @@ function useExecuteRoute(executeRoute) {
|
|
|
2264
2283
|
if (!disposed) result.value = execResult;
|
|
2265
2284
|
return execResult;
|
|
2266
2285
|
} catch (cause) {
|
|
2267
|
-
if (!disposed) error.value = (0,
|
|
2286
|
+
if (!disposed) error.value = (0, import_connect_appkit_core18.toExecuteRouteError)(cause);
|
|
2268
2287
|
return null;
|
|
2269
2288
|
} finally {
|
|
2270
2289
|
inFlight = false;
|
|
2271
2290
|
if (!disposed) executing.value = false;
|
|
2272
2291
|
}
|
|
2273
2292
|
};
|
|
2274
|
-
(0,
|
|
2293
|
+
(0, import_vue33.onScopeDispose)(() => {
|
|
2275
2294
|
disposed = true;
|
|
2276
2295
|
});
|
|
2277
2296
|
return {
|
|
@@ -2288,20 +2307,20 @@ function useExecuteRoute(executeRoute) {
|
|
|
2288
2307
|
}
|
|
2289
2308
|
|
|
2290
2309
|
// src/useTokenList.ts
|
|
2291
|
-
var
|
|
2310
|
+
var import_connect_appkit_core19 = require("@naculus/connect-appkit-core");
|
|
2292
2311
|
var import_connect_core13 = require("@naculus/connect-core");
|
|
2293
|
-
var
|
|
2312
|
+
var import_vue34 = require("vue");
|
|
2294
2313
|
function useTokenList(chainId, options = {}) {
|
|
2295
2314
|
const config = {};
|
|
2296
2315
|
if (options.sources) config.sources = options.sources;
|
|
2297
2316
|
const manager = options.manager ?? new import_connect_core13.TokenListManager(config);
|
|
2298
2317
|
const guard = useActionGuard();
|
|
2299
|
-
const tokens = (0,
|
|
2300
|
-
const isLoading = (0,
|
|
2301
|
-
const isLoaded = (0,
|
|
2318
|
+
const tokens = (0, import_vue34.shallowRef)([]);
|
|
2319
|
+
const isLoading = (0, import_vue34.shallowRef)(options.autoLoad !== false);
|
|
2320
|
+
const isLoaded = (0, import_vue34.shallowRef)(false);
|
|
2302
2321
|
const select = () => {
|
|
2303
|
-
const id = (0,
|
|
2304
|
-
const numeric = id ? (0,
|
|
2322
|
+
const id = (0, import_vue34.toValue)(chainId);
|
|
2323
|
+
const numeric = id ? (0, import_connect_appkit_core19.eip155ChainIdToNumber)(id) : void 0;
|
|
2305
2324
|
return manager.getTokens(
|
|
2306
2325
|
numeric !== void 0 ? { chainId: numeric } : void 0
|
|
2307
2326
|
);
|
|
@@ -2326,8 +2345,8 @@ function useTokenList(chainId, options = {}) {
|
|
|
2326
2345
|
).catch(() => {
|
|
2327
2346
|
});
|
|
2328
2347
|
};
|
|
2329
|
-
(0,
|
|
2330
|
-
() => (0,
|
|
2348
|
+
(0, import_vue34.watch)(
|
|
2349
|
+
() => (0, import_vue34.toValue)(chainId),
|
|
2331
2350
|
() => {
|
|
2332
2351
|
if (options.autoLoad !== false) void run(() => manager.load());
|
|
2333
2352
|
},
|
|
@@ -2343,9 +2362,9 @@ function useTokenList(chainId, options = {}) {
|
|
|
2343
2362
|
}
|
|
2344
2363
|
|
|
2345
2364
|
// src/useTokenSearch.ts
|
|
2346
|
-
var
|
|
2365
|
+
var import_connect_appkit_core20 = require("@naculus/connect-appkit-core");
|
|
2347
2366
|
var import_connect_core14 = require("@naculus/connect-core");
|
|
2348
|
-
var
|
|
2367
|
+
var import_vue35 = require("vue");
|
|
2349
2368
|
var DEBOUNCE_MS = 300;
|
|
2350
2369
|
var EMPTY = { exact: [], fuzzy: [], hasMore: false };
|
|
2351
2370
|
var sharedManager = null;
|
|
@@ -2358,15 +2377,15 @@ function getSharedManager() {
|
|
|
2358
2377
|
return sharedManager;
|
|
2359
2378
|
}
|
|
2360
2379
|
function useTokenSearch(query, chainId, options = {}) {
|
|
2361
|
-
const results = (0,
|
|
2362
|
-
const isSearching = (0,
|
|
2380
|
+
const results = (0, import_vue35.shallowRef)(EMPTY);
|
|
2381
|
+
const isSearching = (0, import_vue35.shallowRef)(false);
|
|
2363
2382
|
let timer = null;
|
|
2364
2383
|
const clear = () => {
|
|
2365
2384
|
if (timer) clearTimeout(timer);
|
|
2366
2385
|
timer = null;
|
|
2367
2386
|
};
|
|
2368
|
-
(0,
|
|
2369
|
-
[() => ((0,
|
|
2387
|
+
(0, import_vue35.watch)(
|
|
2388
|
+
[() => ((0, import_vue35.toValue)(query) ?? "").trim(), () => (0, import_vue35.toValue)(chainId)],
|
|
2370
2389
|
([q, id]) => {
|
|
2371
2390
|
clear();
|
|
2372
2391
|
if (!q) {
|
|
@@ -2378,7 +2397,7 @@ function useTokenSearch(query, chainId, options = {}) {
|
|
|
2378
2397
|
timer = setTimeout(() => {
|
|
2379
2398
|
timer = null;
|
|
2380
2399
|
const manager = options.manager ?? getSharedManager();
|
|
2381
|
-
const numeric = id ? (0,
|
|
2400
|
+
const numeric = id ? (0, import_connect_appkit_core20.eip155ChainIdToNumber)(id) : void 0;
|
|
2382
2401
|
results.value = manager.search(q, {
|
|
2383
2402
|
chainId: numeric,
|
|
2384
2403
|
limit: options.limit ?? 20
|
|
@@ -2388,35 +2407,35 @@ function useTokenSearch(query, chainId, options = {}) {
|
|
|
2388
2407
|
},
|
|
2389
2408
|
{ immediate: true }
|
|
2390
2409
|
);
|
|
2391
|
-
(0,
|
|
2410
|
+
(0, import_vue35.onScopeDispose)(clear);
|
|
2392
2411
|
return { results, isSearching };
|
|
2393
2412
|
}
|
|
2394
2413
|
|
|
2395
2414
|
// src/useValidateDestination.ts
|
|
2396
|
-
var
|
|
2397
|
-
var
|
|
2415
|
+
var import_connect_appkit_core21 = require("@naculus/connect-appkit-core");
|
|
2416
|
+
var import_vue36 = require("vue");
|
|
2398
2417
|
function useValidateDestination(address) {
|
|
2399
2418
|
return {
|
|
2400
|
-
validation: (0,
|
|
2419
|
+
validation: (0, import_vue36.computed)(() => (0, import_connect_appkit_core21.validateDestination)((0, import_vue36.toValue)(address) ?? ""))
|
|
2401
2420
|
};
|
|
2402
2421
|
}
|
|
2403
2422
|
|
|
2404
2423
|
// src/useTokenBalance.ts
|
|
2405
|
-
var
|
|
2424
|
+
var import_connect_appkit_core22 = require("@naculus/connect-appkit-core");
|
|
2406
2425
|
var import_connect_core15 = require("@naculus/connect-core");
|
|
2407
|
-
var
|
|
2426
|
+
var import_vue37 = require("vue");
|
|
2408
2427
|
function tokensKey(tokens) {
|
|
2409
2428
|
return tokens.map((t) => `${t.address.toLowerCase()}|${t.decimals}|${t.symbol}`).join(",");
|
|
2410
2429
|
}
|
|
2411
2430
|
function useTokenBalance(account, client, tokens, options = {}) {
|
|
2412
2431
|
const guard = useActionGuard();
|
|
2413
|
-
const tokenBalances = (0,
|
|
2414
|
-
const isFetching = (0,
|
|
2432
|
+
const tokenBalances = (0, import_vue37.shallowRef)([]);
|
|
2433
|
+
const isFetching = (0, import_vue37.shallowRef)(false);
|
|
2415
2434
|
let timer = null;
|
|
2416
2435
|
const refetch = async () => {
|
|
2417
|
-
const reader = (0,
|
|
2418
|
-
const address = (0,
|
|
2419
|
-
const list = (0,
|
|
2436
|
+
const reader = (0, import_vue37.toValue)(client);
|
|
2437
|
+
const address = (0, import_connect_appkit_core22.bareEvmAddress)((0, import_vue37.toValue)(account));
|
|
2438
|
+
const list = (0, import_vue37.toValue)(tokens) ?? [];
|
|
2420
2439
|
if (!reader || !address || list.length === 0) {
|
|
2421
2440
|
guard.reset();
|
|
2422
2441
|
tokenBalances.value = [];
|
|
@@ -2471,12 +2490,12 @@ function useTokenBalance(account, client, tokens, options = {}) {
|
|
|
2471
2490
|
if (timer) clearInterval(timer);
|
|
2472
2491
|
timer = null;
|
|
2473
2492
|
};
|
|
2474
|
-
(0,
|
|
2493
|
+
(0, import_vue37.watch)(
|
|
2475
2494
|
[
|
|
2476
|
-
() => (0,
|
|
2477
|
-
() => (0,
|
|
2478
|
-
() => tokensKey((0,
|
|
2479
|
-
() => (0,
|
|
2495
|
+
() => (0, import_vue37.toValue)(account),
|
|
2496
|
+
() => (0, import_vue37.toValue)(client),
|
|
2497
|
+
() => tokensKey((0, import_vue37.toValue)(tokens) ?? []),
|
|
2498
|
+
() => (0, import_vue37.toValue)(options.refreshInterval) ?? 0
|
|
2480
2499
|
],
|
|
2481
2500
|
([, , , interval]) => {
|
|
2482
2501
|
stopTimer();
|
|
@@ -2485,7 +2504,7 @@ function useTokenBalance(account, client, tokens, options = {}) {
|
|
|
2485
2504
|
},
|
|
2486
2505
|
{ immediate: true }
|
|
2487
2506
|
);
|
|
2488
|
-
(0,
|
|
2507
|
+
(0, import_vue37.onScopeDispose)(stopTimer);
|
|
2489
2508
|
return {
|
|
2490
2509
|
tokenBalances,
|
|
2491
2510
|
isFetching,
|
|
@@ -2498,13 +2517,13 @@ function useTokenBalance(account, client, tokens, options = {}) {
|
|
|
2498
2517
|
}
|
|
2499
2518
|
|
|
2500
2519
|
// src/useDelegate.ts
|
|
2501
|
-
var
|
|
2520
|
+
var import_connect_appkit_core23 = require("@naculus/connect-appkit-core");
|
|
2502
2521
|
var import_connect_core16 = require("@naculus/connect-core");
|
|
2503
|
-
var
|
|
2522
|
+
var import_vue38 = require("vue");
|
|
2504
2523
|
function useDelegate(options) {
|
|
2505
|
-
const result = (0,
|
|
2506
|
-
const isPending = (0,
|
|
2507
|
-
const error = (0,
|
|
2524
|
+
const result = (0, import_vue38.shallowRef)(null);
|
|
2525
|
+
const isPending = (0, import_vue38.shallowRef)(false);
|
|
2526
|
+
const error = (0, import_vue38.shallowRef)(null);
|
|
2508
2527
|
let requestId = 0;
|
|
2509
2528
|
let inFlight = false;
|
|
2510
2529
|
let disposed = false;
|
|
@@ -2514,15 +2533,15 @@ function useDelegate(options) {
|
|
|
2514
2533
|
};
|
|
2515
2534
|
const run = async (target, allowlist) => {
|
|
2516
2535
|
if (inFlight) return fail(new Error("A delegation is already in progress"));
|
|
2517
|
-
const session = (0,
|
|
2518
|
-
const account = (0,
|
|
2519
|
-
const chainId = (0,
|
|
2536
|
+
const session = (0, import_vue38.toValue)(options.session);
|
|
2537
|
+
const account = (0, import_connect_appkit_core23.bareEvmAddress)((0, import_vue38.toValue)(options.account));
|
|
2538
|
+
const chainId = (0, import_vue38.toValue)(options.chainId);
|
|
2520
2539
|
if (!session || !account || !chainId) {
|
|
2521
2540
|
return fail(
|
|
2522
2541
|
new import_connect_core16.WalletError("wallet_unavailable", "No connected EVM account")
|
|
2523
2542
|
);
|
|
2524
2543
|
}
|
|
2525
|
-
const reader = (0,
|
|
2544
|
+
const reader = (0, import_vue38.toValue)(options.client);
|
|
2526
2545
|
if (!reader || reader.chain?.id !== (0, import_connect_core16.eip155Reference)(chainId)) {
|
|
2527
2546
|
return fail(
|
|
2528
2547
|
new import_connect_core16.WalletError(
|
|
@@ -2531,7 +2550,7 @@ function useDelegate(options) {
|
|
|
2531
2550
|
)
|
|
2532
2551
|
);
|
|
2533
2552
|
}
|
|
2534
|
-
const connector = (0,
|
|
2553
|
+
const connector = (0, import_vue38.toValue)(options.connector) ?? {};
|
|
2535
2554
|
const own = ++requestId;
|
|
2536
2555
|
inFlight = true;
|
|
2537
2556
|
isPending.value = true;
|
|
@@ -2566,21 +2585,21 @@ function useDelegate(options) {
|
|
|
2566
2585
|
isPending.value = false;
|
|
2567
2586
|
error.value = null;
|
|
2568
2587
|
};
|
|
2569
|
-
(0,
|
|
2588
|
+
(0, import_vue38.watch)(
|
|
2570
2589
|
[
|
|
2571
|
-
() => (0,
|
|
2572
|
-
() => (0,
|
|
2573
|
-
() => (0,
|
|
2590
|
+
() => (0, import_vue38.toValue)(options.session),
|
|
2591
|
+
() => (0, import_vue38.toValue)(options.account),
|
|
2592
|
+
() => (0, import_vue38.toValue)(options.chainId)
|
|
2574
2593
|
],
|
|
2575
2594
|
reset,
|
|
2576
2595
|
{ flush: "sync" }
|
|
2577
2596
|
);
|
|
2578
|
-
(0,
|
|
2597
|
+
(0, import_vue38.onScopeDispose)(() => {
|
|
2579
2598
|
disposed = true;
|
|
2580
2599
|
requestId++;
|
|
2581
2600
|
});
|
|
2582
2601
|
return {
|
|
2583
|
-
delegate: (target) => run(target, (0,
|
|
2602
|
+
delegate: (target) => run(target, (0, import_vue38.toValue)(options.allowlist)),
|
|
2584
2603
|
revoke: () => run(import_connect_core16.REVOKE_DELEGATE, []),
|
|
2585
2604
|
result,
|
|
2586
2605
|
isPending,
|
|
@@ -2590,16 +2609,16 @@ function useDelegate(options) {
|
|
|
2590
2609
|
}
|
|
2591
2610
|
|
|
2592
2611
|
// src/useDelegation.ts
|
|
2593
|
-
var
|
|
2612
|
+
var import_connect_appkit_core24 = require("@naculus/connect-appkit-core");
|
|
2594
2613
|
var import_connect_core17 = require("@naculus/connect-core");
|
|
2595
|
-
var
|
|
2614
|
+
var import_vue39 = require("vue");
|
|
2596
2615
|
function useDelegation(account, client, chainId) {
|
|
2597
2616
|
const guard = useActionGuard();
|
|
2598
|
-
const status = (0,
|
|
2599
|
-
const isFetching = (0,
|
|
2617
|
+
const status = (0, import_vue39.shallowRef)(import_connect_core17.UNKNOWN_DELEGATION);
|
|
2618
|
+
const isFetching = (0, import_vue39.shallowRef)(false);
|
|
2600
2619
|
const refetch = async () => {
|
|
2601
|
-
const reader = (0,
|
|
2602
|
-
const address = (0,
|
|
2620
|
+
const reader = (0, import_vue39.toValue)(client);
|
|
2621
|
+
const address = (0, import_connect_appkit_core24.bareEvmAddress)((0, import_vue39.toValue)(account));
|
|
2603
2622
|
status.value = import_connect_core17.UNKNOWN_DELEGATION;
|
|
2604
2623
|
if (!reader || !address) {
|
|
2605
2624
|
guard.reset();
|
|
@@ -2631,16 +2650,16 @@ function useDelegation(account, client, chainId) {
|
|
|
2631
2650
|
).catch(() => {
|
|
2632
2651
|
});
|
|
2633
2652
|
};
|
|
2634
|
-
(0,
|
|
2635
|
-
[() => (0,
|
|
2653
|
+
(0, import_vue39.watch)(
|
|
2654
|
+
[() => (0, import_vue39.toValue)(account), () => (0, import_vue39.toValue)(client), () => (0, import_vue39.toValue)(chainId)],
|
|
2636
2655
|
() => {
|
|
2637
2656
|
void refetch();
|
|
2638
2657
|
},
|
|
2639
2658
|
{ immediate: true, flush: "sync" }
|
|
2640
2659
|
);
|
|
2641
2660
|
return {
|
|
2642
|
-
delegated: (0,
|
|
2643
|
-
delegate: (0,
|
|
2661
|
+
delegated: (0, import_vue39.computed)(() => status.value.delegated),
|
|
2662
|
+
delegate: (0, import_vue39.computed)(() => status.value.delegate),
|
|
2644
2663
|
isFetching,
|
|
2645
2664
|
error: guard.error,
|
|
2646
2665
|
refetch
|
|
@@ -2648,32 +2667,32 @@ function useDelegation(account, client, chainId) {
|
|
|
2648
2667
|
}
|
|
2649
2668
|
|
|
2650
2669
|
// src/usePaymentFetch.ts
|
|
2651
|
-
var
|
|
2652
|
-
var
|
|
2670
|
+
var import_connect_appkit_core25 = require("@naculus/connect-appkit-core");
|
|
2671
|
+
var import_vue40 = require("vue");
|
|
2653
2672
|
function usePaymentFetch(pay, options = {}) {
|
|
2654
2673
|
const guard = useActionGuard();
|
|
2655
|
-
const lastPayment = (0,
|
|
2674
|
+
const lastPayment = (0, import_vue40.shallowRef)(null);
|
|
2656
2675
|
let epoch = 0;
|
|
2657
2676
|
let verification = 0;
|
|
2658
|
-
(0,
|
|
2677
|
+
(0, import_vue40.onScopeDispose)(() => {
|
|
2659
2678
|
epoch++;
|
|
2660
2679
|
verification++;
|
|
2661
2680
|
});
|
|
2662
2681
|
const payFetch = (input, init) => {
|
|
2663
|
-
const invoke = (0,
|
|
2682
|
+
const invoke = (0, import_vue40.unref)(pay);
|
|
2664
2683
|
const own = epoch;
|
|
2665
2684
|
return guard.run(async () => {
|
|
2666
2685
|
const result = await invoke(input, init);
|
|
2667
|
-
let payment = (0,
|
|
2686
|
+
let payment = (0, import_connect_appkit_core25.describePayment)(input, result);
|
|
2668
2687
|
if (payment && own === epoch) {
|
|
2669
2688
|
const verify = options.verify;
|
|
2670
2689
|
if (!verify) {
|
|
2671
2690
|
lastPayment.value = payment;
|
|
2672
2691
|
} else {
|
|
2673
|
-
payment = (0,
|
|
2692
|
+
payment = (0, import_connect_appkit_core25.applySettlementVerification)(payment, { status: "pending" });
|
|
2674
2693
|
lastPayment.value = payment;
|
|
2675
2694
|
const verificationOwn = ++verification;
|
|
2676
|
-
const retry = options.verifyRetry ??
|
|
2695
|
+
const retry = options.verifyRetry ?? import_connect_appkit_core25.DEFAULT_VERIFY_RETRY;
|
|
2677
2696
|
void Promise.resolve().then(async () => {
|
|
2678
2697
|
let outcome = { status: "pending" };
|
|
2679
2698
|
for (let attempt = 0; attempt < retry.attempts; attempt += 1) {
|
|
@@ -2696,7 +2715,7 @@ function usePaymentFetch(pay, options = {}) {
|
|
|
2696
2715
|
if (own === epoch && verificationOwn === verification) {
|
|
2697
2716
|
const current = lastPayment.value;
|
|
2698
2717
|
if (current)
|
|
2699
|
-
lastPayment.value = (0,
|
|
2718
|
+
lastPayment.value = (0, import_connect_appkit_core25.applySettlementVerification)(
|
|
2700
2719
|
current,
|
|
2701
2720
|
outcome
|
|
2702
2721
|
);
|
|
@@ -2722,38 +2741,38 @@ function usePaymentFetch(pay, options = {}) {
|
|
|
2722
2741
|
}
|
|
2723
2742
|
|
|
2724
2743
|
// src/useMppSession.ts
|
|
2725
|
-
var
|
|
2726
|
-
var
|
|
2744
|
+
var import_connect_appkit_core26 = require("@naculus/connect-appkit-core");
|
|
2745
|
+
var import_vue41 = require("vue");
|
|
2727
2746
|
function useMppSession(session) {
|
|
2728
|
-
const current = () => (0,
|
|
2729
|
-
const pending = (0,
|
|
2730
|
-
const channel = (0,
|
|
2731
|
-
(0,
|
|
2747
|
+
const current = () => (0, import_vue41.unref)(session);
|
|
2748
|
+
const pending = (0, import_vue41.shallowRef)(current().meter.pending);
|
|
2749
|
+
const channel = (0, import_vue41.shallowRef)(
|
|
2750
|
+
(0, import_connect_appkit_core26.readCurrentMppSessionChannel)(current())
|
|
2732
2751
|
);
|
|
2733
|
-
const lastReceipt = (0,
|
|
2734
|
-
const recoveryChannelId = (0,
|
|
2735
|
-
const isPending = (0,
|
|
2736
|
-
const error = (0,
|
|
2752
|
+
const lastReceipt = (0, import_vue41.shallowRef)(null);
|
|
2753
|
+
const recoveryChannelId = (0, import_vue41.shallowRef)(null);
|
|
2754
|
+
const isPending = (0, import_vue41.shallowRef)(false);
|
|
2755
|
+
const error = (0, import_vue41.shallowRef)(null);
|
|
2737
2756
|
let active = 0;
|
|
2738
2757
|
let generation = 0;
|
|
2739
2758
|
let epoch = 0;
|
|
2740
2759
|
let disposed = false;
|
|
2741
|
-
(0,
|
|
2742
|
-
() => (0,
|
|
2760
|
+
(0, import_vue41.watch)(
|
|
2761
|
+
() => (0, import_vue41.unref)(session),
|
|
2743
2762
|
(value) => {
|
|
2744
2763
|
generation++;
|
|
2745
2764
|
epoch++;
|
|
2746
2765
|
active = 0;
|
|
2747
2766
|
isPending.value = false;
|
|
2748
2767
|
pending.value = value.meter.pending;
|
|
2749
|
-
channel.value = (0,
|
|
2768
|
+
channel.value = (0, import_connect_appkit_core26.readCurrentMppSessionChannel)(value);
|
|
2750
2769
|
lastReceipt.value = null;
|
|
2751
2770
|
recoveryChannelId.value = null;
|
|
2752
2771
|
error.value = null;
|
|
2753
2772
|
},
|
|
2754
2773
|
{ flush: "sync" }
|
|
2755
2774
|
);
|
|
2756
|
-
(0,
|
|
2775
|
+
(0, import_vue41.onScopeDispose)(() => {
|
|
2757
2776
|
disposed = true;
|
|
2758
2777
|
generation++;
|
|
2759
2778
|
epoch++;
|
|
@@ -2768,7 +2787,7 @@ function useMppSession(session) {
|
|
|
2768
2787
|
return operation(invokedSession).then((result) => {
|
|
2769
2788
|
if (!disposed && ownEpoch === epoch) {
|
|
2770
2789
|
publish?.(result);
|
|
2771
|
-
const currentChannel = (0,
|
|
2790
|
+
const currentChannel = (0, import_connect_appkit_core26.readCurrentMppSessionChannel)(invokedSession);
|
|
2772
2791
|
channel.value = currentChannel;
|
|
2773
2792
|
pending.value = invokedSession.meter.pending;
|
|
2774
2793
|
if (clearsRecovery || !currentChannel) {
|
|
@@ -2779,10 +2798,10 @@ function useMppSession(session) {
|
|
|
2779
2798
|
}).catch((cause) => {
|
|
2780
2799
|
const normalized = cause instanceof Error ? cause : new Error("MPP session operation failed");
|
|
2781
2800
|
if (!disposed && ownEpoch === epoch) {
|
|
2782
|
-
const currentChannel = (0,
|
|
2801
|
+
const currentChannel = (0, import_connect_appkit_core26.readCurrentMppSessionChannel)(invokedSession);
|
|
2783
2802
|
channel.value = currentChannel;
|
|
2784
2803
|
pending.value = invokedSession.meter.pending;
|
|
2785
|
-
const recovery = (0,
|
|
2804
|
+
const recovery = (0, import_connect_appkit_core26.readMppRecoveryChannelId)(cause);
|
|
2786
2805
|
if (recovery) recoveryChannelId.value = recovery;
|
|
2787
2806
|
else if (!currentChannel) recoveryChannelId.value = null;
|
|
2788
2807
|
if (own === generation) error.value = normalized;
|
|
@@ -2798,14 +2817,14 @@ function useMppSession(session) {
|
|
|
2798
2817
|
const fetch = (input, init) => run(
|
|
2799
2818
|
(value) => value(input, init),
|
|
2800
2819
|
(result) => {
|
|
2801
|
-
const receipt = (0,
|
|
2820
|
+
const receipt = (0, import_connect_appkit_core26.readMppSessionReceipt)(result.receipt);
|
|
2802
2821
|
if (receipt) lastReceipt.value = receipt;
|
|
2803
2822
|
}
|
|
2804
2823
|
);
|
|
2805
2824
|
const close = () => run(
|
|
2806
2825
|
(value) => value.close(),
|
|
2807
2826
|
(result) => {
|
|
2808
|
-
const receipt = (0,
|
|
2827
|
+
const receipt = (0, import_connect_appkit_core26.readMppSessionReceipt)(result.receipt);
|
|
2809
2828
|
if (receipt) lastReceipt.value = receipt;
|
|
2810
2829
|
},
|
|
2811
2830
|
true
|
|
@@ -2819,7 +2838,7 @@ function useMppSession(session) {
|
|
|
2819
2838
|
} catch (cause) {
|
|
2820
2839
|
const normalized = cause instanceof Error ? cause : new Error("MPP session operation failed");
|
|
2821
2840
|
error.value = normalized;
|
|
2822
|
-
recoveryChannelId.value = (0,
|
|
2841
|
+
recoveryChannelId.value = (0, import_connect_appkit_core26.readMppRecoveryChannelId)(cause);
|
|
2823
2842
|
throw normalized;
|
|
2824
2843
|
}
|
|
2825
2844
|
};
|
|
@@ -2840,7 +2859,7 @@ function useMppSession(session) {
|
|
|
2840
2859
|
active = 0;
|
|
2841
2860
|
isPending.value = false;
|
|
2842
2861
|
pending.value = current().meter.pending;
|
|
2843
|
-
channel.value = (0,
|
|
2862
|
+
channel.value = (0, import_connect_appkit_core26.readCurrentMppSessionChannel)(current());
|
|
2844
2863
|
lastReceipt.value = null;
|
|
2845
2864
|
recoveryChannelId.value = null;
|
|
2846
2865
|
error.value = null;
|
|
@@ -2849,15 +2868,15 @@ function useMppSession(session) {
|
|
|
2849
2868
|
}
|
|
2850
2869
|
|
|
2851
2870
|
// src/useSolanaSessionKey.ts
|
|
2852
|
-
var
|
|
2853
|
-
var
|
|
2871
|
+
var import_connect_appkit_core27 = require("@naculus/connect-appkit-core");
|
|
2872
|
+
var import_vue42 = require("vue");
|
|
2854
2873
|
function useSolanaSessionKey(deps) {
|
|
2855
2874
|
const guard = useActionGuard();
|
|
2856
|
-
const keys = (0,
|
|
2875
|
+
const keys = (0, import_vue42.shallowRef)([]);
|
|
2857
2876
|
let flow = null;
|
|
2858
2877
|
let generation = 0;
|
|
2859
2878
|
let disposed = false;
|
|
2860
|
-
(0,
|
|
2879
|
+
(0, import_vue42.onScopeDispose)(() => {
|
|
2861
2880
|
disposed = true;
|
|
2862
2881
|
});
|
|
2863
2882
|
const refresh = async () => {
|
|
@@ -2865,10 +2884,10 @@ function useSolanaSessionKey(deps) {
|
|
|
2865
2884
|
const next = flow ? await flow.list() : [];
|
|
2866
2885
|
if (!disposed && own === generation) keys.value = next;
|
|
2867
2886
|
};
|
|
2868
|
-
(0,
|
|
2869
|
-
() => (0,
|
|
2887
|
+
(0, import_vue42.watch)(
|
|
2888
|
+
() => (0, import_vue42.unref)(deps),
|
|
2870
2889
|
(next) => {
|
|
2871
|
-
flow = next ? (0,
|
|
2890
|
+
flow = next ? (0, import_connect_appkit_core27.createSolanaSessionKeyFlow)(next) : null;
|
|
2872
2891
|
guard.invalidate();
|
|
2873
2892
|
void refresh().catch(() => {
|
|
2874
2893
|
});
|
|
@@ -2899,17 +2918,17 @@ function useSolanaSessionKey(deps) {
|
|
|
2899
2918
|
}
|
|
2900
2919
|
|
|
2901
2920
|
// src/name-lookup.ts
|
|
2902
|
-
var
|
|
2903
|
-
var
|
|
2921
|
+
var import_connect_appkit_core28 = require("@naculus/connect-appkit-core");
|
|
2922
|
+
var import_vue43 = require("vue");
|
|
2904
2923
|
function useNameLookup(options) {
|
|
2905
2924
|
const guard = useActionGuard();
|
|
2906
|
-
const data = (0,
|
|
2907
|
-
const loading = (0,
|
|
2925
|
+
const data = (0, import_vue43.shallowRef)(null);
|
|
2926
|
+
const loading = (0, import_vue43.shallowRef)(false);
|
|
2908
2927
|
const run = () => {
|
|
2909
|
-
const input = (0,
|
|
2910
|
-
const skip = (0,
|
|
2911
|
-
const scope = (0,
|
|
2912
|
-
const config = (0,
|
|
2928
|
+
const input = (0, import_vue43.toValue)(options.input).trim();
|
|
2929
|
+
const skip = (0, import_vue43.toValue)(options.skip) ?? false;
|
|
2930
|
+
const scope = (0, import_vue43.toValue)(options.scope);
|
|
2931
|
+
const config = (0, import_vue43.toValue)(options.resolverConfig);
|
|
2913
2932
|
if (!input || skip) {
|
|
2914
2933
|
guard.reset();
|
|
2915
2934
|
data.value = null;
|
|
@@ -2922,7 +2941,7 @@ function useNameLookup(options) {
|
|
|
2922
2941
|
async (commit) => {
|
|
2923
2942
|
try {
|
|
2924
2943
|
const result = await Promise.resolve().then(
|
|
2925
|
-
() => options.query((0,
|
|
2944
|
+
() => options.query((0, import_connect_appkit_core28.getResolver)(config), input, scope)
|
|
2926
2945
|
);
|
|
2927
2946
|
commit(() => {
|
|
2928
2947
|
data.value = result;
|
|
@@ -2944,19 +2963,19 @@ function useNameLookup(options) {
|
|
|
2944
2963
|
).catch(() => {
|
|
2945
2964
|
});
|
|
2946
2965
|
};
|
|
2947
|
-
(0,
|
|
2966
|
+
(0, import_vue43.watch)(
|
|
2948
2967
|
() => [
|
|
2949
|
-
(0,
|
|
2950
|
-
(0,
|
|
2951
|
-
(0,
|
|
2952
|
-
(0,
|
|
2968
|
+
(0, import_vue43.toValue)(options.input),
|
|
2969
|
+
(0, import_vue43.toValue)(options.skip),
|
|
2970
|
+
(0, import_vue43.toValue)(options.scope),
|
|
2971
|
+
(0, import_vue43.toValue)(options.resolverConfig)
|
|
2953
2972
|
],
|
|
2954
2973
|
run,
|
|
2955
2974
|
{ immediate: true, flush: "sync", deep: true }
|
|
2956
2975
|
);
|
|
2957
2976
|
return {
|
|
2958
2977
|
data,
|
|
2959
|
-
isLoading: (0,
|
|
2978
|
+
isLoading: (0, import_vue43.computed)(() => loading.value),
|
|
2960
2979
|
error: guard.error,
|
|
2961
2980
|
refetch: run
|
|
2962
2981
|
};
|
|
@@ -2984,21 +3003,21 @@ function useLookupAddress(address, options) {
|
|
|
2984
3003
|
}
|
|
2985
3004
|
|
|
2986
3005
|
// src/useSolanaAccount.ts
|
|
2987
|
-
var
|
|
3006
|
+
var import_vue44 = require("vue");
|
|
2988
3007
|
function useSolanaAccount(accounts, connected) {
|
|
2989
|
-
const isConnected = (0,
|
|
2990
|
-
const caip10 = (0,
|
|
2991
|
-
() => isConnected.value ? ((0,
|
|
3008
|
+
const isConnected = (0, import_vue44.computed)(() => (0, import_vue44.toValue)(connected));
|
|
3009
|
+
const caip10 = (0, import_vue44.computed)(
|
|
3010
|
+
() => isConnected.value ? ((0, import_vue44.toValue)(accounts) ?? []).find(
|
|
2992
3011
|
(account) => account.startsWith("solana:")
|
|
2993
3012
|
) ?? null : null
|
|
2994
3013
|
);
|
|
2995
|
-
const parts = (0,
|
|
3014
|
+
const parts = (0, import_vue44.computed)(() => caip10.value?.split(":") ?? []);
|
|
2996
3015
|
return {
|
|
2997
|
-
address: (0,
|
|
3016
|
+
address: (0, import_vue44.computed)(
|
|
2998
3017
|
() => parts.value.length >= 3 ? parts.value.at(-1) ?? null : null
|
|
2999
3018
|
),
|
|
3000
3019
|
caip10,
|
|
3001
|
-
chainId: (0,
|
|
3020
|
+
chainId: (0, import_vue44.computed)(
|
|
3002
3021
|
() => parts.value.length >= 3 ? parts.value.slice(0, -1).join(":") : null
|
|
3003
3022
|
),
|
|
3004
3023
|
isConnected
|
|
@@ -3006,35 +3025,35 @@ function useSolanaAccount(accounts, connected) {
|
|
|
3006
3025
|
}
|
|
3007
3026
|
|
|
3008
3027
|
// src/useChain.ts
|
|
3009
|
-
var
|
|
3010
|
-
var
|
|
3028
|
+
var import_connect_appkit_core29 = require("@naculus/connect-appkit-core");
|
|
3029
|
+
var import_vue45 = require("vue");
|
|
3011
3030
|
function useChain(chains, chainId) {
|
|
3012
|
-
const list = (0,
|
|
3013
|
-
const id = (0,
|
|
3014
|
-
const currentChain = (0,
|
|
3031
|
+
const list = (0, import_vue45.computed)(() => (0, import_vue45.toValue)(chains) ?? []);
|
|
3032
|
+
const id = (0, import_vue45.computed)(() => (0, import_vue45.toValue)(chainId) ?? null);
|
|
3033
|
+
const currentChain = (0, import_vue45.computed)(() => (0, import_connect_appkit_core29.resolveChain)(list.value, id.value));
|
|
3015
3034
|
return {
|
|
3016
3035
|
currentChain,
|
|
3017
|
-
chainInfo: (0,
|
|
3018
|
-
availableChains: (0,
|
|
3019
|
-
currentChainNumber: (0,
|
|
3020
|
-
() => currentChain.value ? (0,
|
|
3036
|
+
chainInfo: (0, import_vue45.computed)(() => (0, import_connect_appkit_core29.describeChain)(list.value, id.value)),
|
|
3037
|
+
availableChains: (0, import_vue45.computed)(() => (0, import_connect_appkit_core29.chainsForNamespace)(list.value, id.value)),
|
|
3038
|
+
currentChainNumber: (0, import_vue45.computed)(
|
|
3039
|
+
() => currentChain.value ? (0, import_connect_appkit_core29.chainNumber)(currentChain.value) : null
|
|
3021
3040
|
),
|
|
3022
|
-
namespace: (0,
|
|
3023
|
-
() => currentChain.value ? (0,
|
|
3041
|
+
namespace: (0, import_vue45.computed)(
|
|
3042
|
+
() => currentChain.value ? (0, import_connect_appkit_core29.chainNamespace)(currentChain.value) : null
|
|
3024
3043
|
)
|
|
3025
3044
|
};
|
|
3026
3045
|
}
|
|
3027
3046
|
|
|
3028
3047
|
// src/usePassphraseGate.ts
|
|
3029
|
-
var
|
|
3048
|
+
var import_vue46 = require("vue");
|
|
3030
3049
|
function usePassphraseGate(gate) {
|
|
3031
|
-
const request = (0,
|
|
3050
|
+
const request = (0, import_vue46.shallowRef)(gate.getSnapshot());
|
|
3032
3051
|
const unsubscribe = gate.subscribe(() => {
|
|
3033
3052
|
request.value = gate.getSnapshot();
|
|
3034
3053
|
});
|
|
3035
|
-
(0,
|
|
3054
|
+
(0, import_vue46.onScopeDispose)(unsubscribe);
|
|
3036
3055
|
return {
|
|
3037
|
-
request: (0,
|
|
3056
|
+
request: (0, import_vue46.readonly)(request),
|
|
3038
3057
|
submit: (passphrase) => gate.submit(passphrase),
|
|
3039
3058
|
cancel: (reason) => gate.cancel(reason),
|
|
3040
3059
|
forget: (reason) => gate.forget(reason)
|
|
@@ -3043,14 +3062,14 @@ function usePassphraseGate(gate) {
|
|
|
3043
3062
|
|
|
3044
3063
|
// src/useSolanaBalance.ts
|
|
3045
3064
|
var import_connect_core18 = require("@naculus/connect-core");
|
|
3046
|
-
var
|
|
3065
|
+
var import_vue47 = require("vue");
|
|
3047
3066
|
function useSolanaBalance(address, rpcUrl) {
|
|
3048
3067
|
const guard = useActionGuard();
|
|
3049
|
-
const balance = (0,
|
|
3050
|
-
const isFetching = (0,
|
|
3068
|
+
const balance = (0, import_vue47.shallowRef)(null);
|
|
3069
|
+
const isFetching = (0, import_vue47.ref)(false);
|
|
3051
3070
|
const refetch = async () => {
|
|
3052
|
-
const addr = (0,
|
|
3053
|
-
const url = (0,
|
|
3071
|
+
const addr = (0, import_vue47.toValue)(address);
|
|
3072
|
+
const url = (0, import_vue47.toValue)(rpcUrl);
|
|
3054
3073
|
if (!addr || !url) {
|
|
3055
3074
|
guard.invalidate();
|
|
3056
3075
|
isFetching.value = false;
|
|
@@ -3082,22 +3101,22 @@ function useSolanaBalance(address, rpcUrl) {
|
|
|
3082
3101
|
).catch(() => {
|
|
3083
3102
|
});
|
|
3084
3103
|
};
|
|
3085
|
-
(0,
|
|
3086
|
-
(0,
|
|
3087
|
-
(0,
|
|
3104
|
+
(0, import_vue47.watchEffect)(() => {
|
|
3105
|
+
(0, import_vue47.toValue)(address);
|
|
3106
|
+
(0, import_vue47.toValue)(rpcUrl);
|
|
3088
3107
|
void refetch();
|
|
3089
3108
|
});
|
|
3090
3109
|
return { balance, isFetching, error: guard.error, refetch };
|
|
3091
3110
|
}
|
|
3092
3111
|
|
|
3093
3112
|
// src/useLastTx.ts
|
|
3094
|
-
var
|
|
3113
|
+
var import_vue48 = require("vue");
|
|
3095
3114
|
function useLastTx(monitor) {
|
|
3096
|
-
const lastTx = (0,
|
|
3097
|
-
const lastConfirmedTx = (0,
|
|
3098
|
-
const lastFailedTx = (0,
|
|
3099
|
-
(0,
|
|
3100
|
-
() => (0,
|
|
3115
|
+
const lastTx = (0, import_vue48.shallowRef)(null);
|
|
3116
|
+
const lastConfirmedTx = (0, import_vue48.shallowRef)(null);
|
|
3117
|
+
const lastFailedTx = (0, import_vue48.shallowRef)(null);
|
|
3118
|
+
(0, import_vue48.watch)(
|
|
3119
|
+
() => (0, import_vue48.toValue)(monitor),
|
|
3101
3120
|
(activeMonitor, _previous, onCleanup) => {
|
|
3102
3121
|
if (!activeMonitor) return;
|
|
3103
3122
|
const recordLatest = (entry) => {
|
|
@@ -3135,13 +3154,13 @@ function useLastTx(monitor) {
|
|
|
3135
3154
|
}
|
|
3136
3155
|
|
|
3137
3156
|
// src/useTxHistory.ts
|
|
3138
|
-
var
|
|
3157
|
+
var import_vue49 = require("vue");
|
|
3139
3158
|
function useTxHistory(address, chainId, monitor) {
|
|
3140
3159
|
const guard = useActionGuard();
|
|
3141
|
-
const entries = (0,
|
|
3142
|
-
const isLoading = (0,
|
|
3160
|
+
const entries = (0, import_vue49.shallowRef)([]);
|
|
3161
|
+
const isLoading = (0, import_vue49.shallowRef)(false);
|
|
3143
3162
|
const refresh = async () => {
|
|
3144
|
-
const activeMonitor = (0,
|
|
3163
|
+
const activeMonitor = (0, import_vue49.toValue)(monitor);
|
|
3145
3164
|
if (!activeMonitor) {
|
|
3146
3165
|
guard.reset();
|
|
3147
3166
|
entries.value = [];
|
|
@@ -3152,8 +3171,8 @@ function useTxHistory(address, chainId, monitor) {
|
|
|
3152
3171
|
await guard.run(
|
|
3153
3172
|
async (commit) => {
|
|
3154
3173
|
const result = await activeMonitor.getTxHistory(
|
|
3155
|
-
(0,
|
|
3156
|
-
(0,
|
|
3174
|
+
(0, import_vue49.toValue)(address) ?? void 0,
|
|
3175
|
+
(0, import_vue49.toValue)(chainId) ?? void 0
|
|
3157
3176
|
);
|
|
3158
3177
|
commit(() => {
|
|
3159
3178
|
entries.value = result;
|
|
@@ -3169,8 +3188,8 @@ function useTxHistory(address, chainId, monitor) {
|
|
|
3169
3188
|
).catch(() => {
|
|
3170
3189
|
});
|
|
3171
3190
|
};
|
|
3172
|
-
(0,
|
|
3173
|
-
[() => (0,
|
|
3191
|
+
(0, import_vue49.watch)(
|
|
3192
|
+
[() => (0, import_vue49.toValue)(monitor), () => (0, import_vue49.toValue)(address), () => (0, import_vue49.toValue)(chainId)],
|
|
3174
3193
|
([activeMonitor], _previous, onCleanup) => {
|
|
3175
3194
|
if (!activeMonitor) {
|
|
3176
3195
|
void refresh();
|
|
@@ -3190,7 +3209,7 @@ function useTxHistory(address, chainId, monitor) {
|
|
|
3190
3209
|
isLoading,
|
|
3191
3210
|
error: guard.error,
|
|
3192
3211
|
refresh,
|
|
3193
|
-
summary: (0,
|
|
3212
|
+
summary: (0, import_vue49.computed)(() => ({
|
|
3194
3213
|
pending: entries.value.filter((item) => item.status === "pending").length,
|
|
3195
3214
|
confirmed: entries.value.filter((item) => item.status === "confirmed").length,
|
|
3196
3215
|
failed: entries.value.filter((item) => item.status === "failed").length
|
|
@@ -3199,25 +3218,25 @@ function useTxHistory(address, chainId, monitor) {
|
|
|
3199
3218
|
}
|
|
3200
3219
|
|
|
3201
3220
|
// src/useTxMonitor.ts
|
|
3202
|
-
var
|
|
3221
|
+
var import_vue50 = require("vue");
|
|
3203
3222
|
function useTxMonitor(hash, chainId, monitor) {
|
|
3204
|
-
const entry = (0,
|
|
3205
|
-
const isLoading = (0,
|
|
3206
|
-
const isWatching = (0,
|
|
3223
|
+
const entry = (0, import_vue50.shallowRef)(null);
|
|
3224
|
+
const isLoading = (0, import_vue50.shallowRef)(false);
|
|
3225
|
+
const isWatching = (0, import_vue50.shallowRef)(false);
|
|
3207
3226
|
const guard = useActionGuard();
|
|
3208
3227
|
const error = guard.error;
|
|
3209
3228
|
let generation = 0;
|
|
3210
3229
|
let refreshed = [];
|
|
3211
3230
|
const currentInputs = () => [
|
|
3212
|
-
(0,
|
|
3213
|
-
(0,
|
|
3214
|
-
(0,
|
|
3231
|
+
(0, import_vue50.toValue)(monitor),
|
|
3232
|
+
(0, import_vue50.toValue)(hash),
|
|
3233
|
+
(0, import_vue50.toValue)(chainId)
|
|
3215
3234
|
];
|
|
3216
3235
|
const sameInputs = (a, b) => a.every((value, i) => Object.is(value, b[i]));
|
|
3217
3236
|
const refresh = async () => {
|
|
3218
|
-
const activeMonitor = (0,
|
|
3219
|
-
const activeHash = (0,
|
|
3220
|
-
const activeChainId = (0,
|
|
3237
|
+
const activeMonitor = (0, import_vue50.toValue)(monitor);
|
|
3238
|
+
const activeHash = (0, import_vue50.toValue)(hash);
|
|
3239
|
+
const activeChainId = (0, import_vue50.toValue)(chainId);
|
|
3221
3240
|
if (!activeMonitor || !activeHash) return;
|
|
3222
3241
|
const started = [activeMonitor, activeHash, activeChainId];
|
|
3223
3242
|
refreshed = started;
|
|
@@ -3253,15 +3272,15 @@ function useTxMonitor(hash, chainId, monitor) {
|
|
|
3253
3272
|
});
|
|
3254
3273
|
};
|
|
3255
3274
|
const stopWatching = () => {
|
|
3256
|
-
const activeMonitor = (0,
|
|
3257
|
-
const activeHash = (0,
|
|
3258
|
-
const activeChainId = (0,
|
|
3275
|
+
const activeMonitor = (0, import_vue50.toValue)(monitor);
|
|
3276
|
+
const activeHash = (0, import_vue50.toValue)(hash);
|
|
3277
|
+
const activeChainId = (0, import_vue50.toValue)(chainId);
|
|
3259
3278
|
if (!activeMonitor || !activeHash) return;
|
|
3260
3279
|
activeMonitor.stopWatching(activeHash, activeChainId ?? void 0);
|
|
3261
3280
|
isWatching.value = false;
|
|
3262
3281
|
};
|
|
3263
|
-
(0,
|
|
3264
|
-
[() => (0,
|
|
3282
|
+
(0, import_vue50.watch)(
|
|
3283
|
+
[() => (0, import_vue50.toValue)(monitor), () => (0, import_vue50.toValue)(hash), () => (0, import_vue50.toValue)(chainId)],
|
|
3265
3284
|
([activeMonitor, activeHash, activeChainId], _previous, onCleanup) => {
|
|
3266
3285
|
const mine = ++generation;
|
|
3267
3286
|
if (!sameInputs([activeMonitor, activeHash, activeChainId], refreshed)) {
|
|
@@ -3303,7 +3322,7 @@ function useTxMonitor(hash, chainId, monitor) {
|
|
|
3303
3322
|
);
|
|
3304
3323
|
return {
|
|
3305
3324
|
entry,
|
|
3306
|
-
status: (0,
|
|
3325
|
+
status: (0, import_vue50.computed)(() => entry.value?.status ?? "idle"),
|
|
3307
3326
|
isLoading,
|
|
3308
3327
|
isWatching,
|
|
3309
3328
|
error,
|
|
@@ -3313,17 +3332,17 @@ function useTxMonitor(hash, chainId, monitor) {
|
|
|
3313
3332
|
}
|
|
3314
3333
|
|
|
3315
3334
|
// src/useCapabilities.ts
|
|
3316
|
-
var
|
|
3317
|
-
var
|
|
3335
|
+
var import_connect_appkit_core30 = require("@naculus/connect-appkit-core");
|
|
3336
|
+
var import_vue51 = require("vue");
|
|
3318
3337
|
function useCapabilities(client, session, chainId) {
|
|
3319
3338
|
const guard = useActionGuard();
|
|
3320
|
-
const capabilities = (0,
|
|
3339
|
+
const capabilities = (0, import_vue51.shallowRef)(
|
|
3321
3340
|
null
|
|
3322
3341
|
);
|
|
3323
|
-
const isFetching = (0,
|
|
3342
|
+
const isFetching = (0, import_vue51.shallowRef)(false);
|
|
3324
3343
|
const refetch = async () => {
|
|
3325
|
-
const activeClient = (0,
|
|
3326
|
-
const activeSession = (0,
|
|
3344
|
+
const activeClient = (0, import_vue51.toValue)(client);
|
|
3345
|
+
const activeSession = (0, import_vue51.toValue)(session);
|
|
3327
3346
|
if (!activeClient?.getCapabilities || !activeSession) {
|
|
3328
3347
|
guard.reset();
|
|
3329
3348
|
capabilities.value = null;
|
|
@@ -3336,7 +3355,7 @@ function useCapabilities(client, session, chainId) {
|
|
|
3336
3355
|
try {
|
|
3337
3356
|
const raw = await activeClient.getCapabilities(activeSession);
|
|
3338
3357
|
commit(() => {
|
|
3339
|
-
capabilities.value = (0,
|
|
3358
|
+
capabilities.value = (0, import_connect_appkit_core30.normalizeCapabilities)(raw);
|
|
3340
3359
|
});
|
|
3341
3360
|
} catch (err) {
|
|
3342
3361
|
commit(() => {
|
|
@@ -3355,18 +3374,18 @@ function useCapabilities(client, session, chainId) {
|
|
|
3355
3374
|
).catch(() => {
|
|
3356
3375
|
});
|
|
3357
3376
|
};
|
|
3358
|
-
(0,
|
|
3359
|
-
void (0,
|
|
3360
|
-
void (0,
|
|
3377
|
+
(0, import_vue51.watchEffect)(() => {
|
|
3378
|
+
void (0, import_vue51.toValue)(client);
|
|
3379
|
+
void (0, import_vue51.toValue)(session);
|
|
3361
3380
|
void refetch();
|
|
3362
3381
|
});
|
|
3363
3382
|
return {
|
|
3364
3383
|
capabilities,
|
|
3365
|
-
current: (0,
|
|
3366
|
-
() => (0,
|
|
3384
|
+
current: (0, import_vue51.computed)(
|
|
3385
|
+
() => (0, import_connect_appkit_core30.selectChainCapabilities)(capabilities.value, (0, import_vue51.toValue)(chainId))
|
|
3367
3386
|
),
|
|
3368
|
-
atomic: (0,
|
|
3369
|
-
() => (0,
|
|
3387
|
+
atomic: (0, import_vue51.computed)(
|
|
3388
|
+
() => (0, import_connect_appkit_core30.atomicSupportFor)(capabilities.value, (0, import_vue51.toValue)(chainId))
|
|
3370
3389
|
),
|
|
3371
3390
|
isFetching,
|
|
3372
3391
|
error: guard.error,
|
|
@@ -3375,18 +3394,18 @@ function useCapabilities(client, session, chainId) {
|
|
|
3375
3394
|
}
|
|
3376
3395
|
|
|
3377
3396
|
// src/useSolanaRoles.ts
|
|
3378
|
-
var
|
|
3379
|
-
var
|
|
3397
|
+
var import_connect_appkit_core31 = require("@naculus/connect-appkit-core");
|
|
3398
|
+
var import_vue52 = require("vue");
|
|
3380
3399
|
function useSolanaRoles(connector, session) {
|
|
3381
|
-
const state = (0,
|
|
3382
|
-
() => (0,
|
|
3400
|
+
const state = (0, import_vue52.computed)(
|
|
3401
|
+
() => (0, import_connect_appkit_core31.readSolanaRoles)((0, import_vue52.toValue)(connector), (0, import_vue52.toValue)(session))
|
|
3383
3402
|
);
|
|
3384
3403
|
return {
|
|
3385
|
-
roles: (0,
|
|
3386
|
-
absence: (0,
|
|
3387
|
-
identity: (0,
|
|
3388
|
-
signer: (0,
|
|
3389
|
-
payer: (0,
|
|
3404
|
+
roles: (0, import_vue52.computed)(() => state.value.roles),
|
|
3405
|
+
absence: (0, import_vue52.computed)(() => state.value.absence),
|
|
3406
|
+
identity: (0, import_vue52.computed)(() => state.value.roles?.identity ?? null),
|
|
3407
|
+
signer: (0, import_vue52.computed)(() => state.value.roles?.signer ?? null),
|
|
3408
|
+
payer: (0, import_vue52.computed)(() => state.value.roles?.payer ?? null)
|
|
3390
3409
|
};
|
|
3391
3410
|
}
|
|
3392
3411
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -3474,6 +3493,7 @@ function useSolanaRoles(connector, session) {
|
|
|
3474
3493
|
useTxHistory,
|
|
3475
3494
|
useTxMonitor,
|
|
3476
3495
|
useUserOpStatus,
|
|
3477
|
-
useValidateDestination
|
|
3496
|
+
useValidateDestination,
|
|
3497
|
+
useX402Signer
|
|
3478
3498
|
});
|
|
3479
3499
|
//# sourceMappingURL=index.cjs.map
|