@opendatalabs/vana-sdk 0.1.0-alpha.1bbb6d4 → 0.1.0-alpha.273dc39
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 +42 -0
- package/dist/chains.browser.cjs +2 -2
- package/dist/chains.browser.cjs.map +1 -1
- package/dist/chains.browser.js +2 -2
- package/dist/chains.browser.js.map +1 -1
- package/dist/chains.cjs +2 -2
- package/dist/chains.cjs.map +1 -1
- package/dist/chains.js +2 -2
- package/dist/chains.js.map +1 -1
- package/dist/chains.node.cjs +2 -2
- package/dist/chains.node.cjs.map +1 -1
- package/dist/chains.node.js +2 -2
- package/dist/chains.node.js.map +1 -1
- package/dist/index.browser.d.ts +861 -160
- package/dist/index.browser.js +1802 -693
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.cjs +1824 -714
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.cts +889 -165
- package/dist/index.node.d.ts +889 -165
- package/dist/index.node.js +1809 -700
- package/dist/index.node.js.map +1 -1
- package/package.json +11 -10
package/dist/index.node.js
CHANGED
|
@@ -1139,12 +1139,486 @@ var PermissionError = class extends VanaError {
|
|
|
1139
1139
|
}
|
|
1140
1140
|
};
|
|
1141
1141
|
|
|
1142
|
+
// src/utils/multicall.ts
|
|
1143
|
+
import { encodeFunctionData, size } from "viem";
|
|
1144
|
+
|
|
1145
|
+
// src/config/addresses.ts
|
|
1146
|
+
var CONTRACTS = {
|
|
1147
|
+
// Data Portability Contracts (New Architecture)
|
|
1148
|
+
DataPortabilityPermissions: {
|
|
1149
|
+
addresses: {
|
|
1150
|
+
14800: "0xD54523048AdD05b4d734aFaE7C68324Ebb7373eF",
|
|
1151
|
+
1480: "0xD54523048AdD05b4d734aFaE7C68324Ebb7373eF"
|
|
1152
|
+
}
|
|
1153
|
+
},
|
|
1154
|
+
DataPortabilityServers: {
|
|
1155
|
+
addresses: {
|
|
1156
|
+
14800: "0x1483B1F634DBA75AeaE60da7f01A679aabd5ee2c",
|
|
1157
|
+
1480: "0x1483B1F634DBA75AeaE60da7f01A679aabd5ee2c"
|
|
1158
|
+
}
|
|
1159
|
+
},
|
|
1160
|
+
DataPortabilityGrantees: {
|
|
1161
|
+
addresses: {
|
|
1162
|
+
14800: "0x8325C0A0948483EdA023A1A2Fd895e62C5131234",
|
|
1163
|
+
1480: "0x8325C0A0948483EdA023A1A2Fd895e62C5131234"
|
|
1164
|
+
}
|
|
1165
|
+
},
|
|
1166
|
+
DataRegistry: {
|
|
1167
|
+
addresses: {
|
|
1168
|
+
14800: "0x8C8788f98385F6ba1adD4234e551ABba0f82Cb7C",
|
|
1169
|
+
1480: "0x8C8788f98385F6ba1adD4234e551ABba0f82Cb7C"
|
|
1170
|
+
}
|
|
1171
|
+
},
|
|
1172
|
+
TeePoolPhala: {
|
|
1173
|
+
addresses: {
|
|
1174
|
+
14800: "0xE8EC6BD73b23Ad40E6B9a6f4bD343FAc411bD99A",
|
|
1175
|
+
1480: "0xE8EC6BD73b23Ad40E6B9a6f4bD343FAc411bD99A"
|
|
1176
|
+
}
|
|
1177
|
+
},
|
|
1178
|
+
ComputeEngine: {
|
|
1179
|
+
addresses: {
|
|
1180
|
+
14800: "0xb2BFe33FA420c45F1Cf1287542ad81ae935447bd",
|
|
1181
|
+
1480: "0xb2BFe33FA420c45F1Cf1287542ad81ae935447bd"
|
|
1182
|
+
}
|
|
1183
|
+
},
|
|
1184
|
+
// Data Access Infrastructure
|
|
1185
|
+
DataRefinerRegistry: {
|
|
1186
|
+
addresses: {
|
|
1187
|
+
14800: "0x93c3EF89369fDcf08Be159D9DeF0F18AB6Be008c",
|
|
1188
|
+
1480: "0x93c3EF89369fDcf08Be159D9DeF0F18AB6Be008c"
|
|
1189
|
+
}
|
|
1190
|
+
},
|
|
1191
|
+
QueryEngine: {
|
|
1192
|
+
addresses: {
|
|
1193
|
+
14800: "0xd25Eb66EA2452cf3238A2eC6C1FD1B7F5B320490",
|
|
1194
|
+
1480: "0xd25Eb66EA2452cf3238A2eC6C1FD1B7F5B320490"
|
|
1195
|
+
}
|
|
1196
|
+
},
|
|
1197
|
+
VanaTreasury: {
|
|
1198
|
+
addresses: {
|
|
1199
|
+
14800: "0x94a1E56e555ac48d092f490fB10CDFaB434915eD",
|
|
1200
|
+
1480: "0x94a1E56e555ac48d092f490fB10CDFaB434915eD"
|
|
1201
|
+
}
|
|
1202
|
+
},
|
|
1203
|
+
ComputeInstructionRegistry: {
|
|
1204
|
+
addresses: {
|
|
1205
|
+
14800: "0x5786B12b4c6Ba2bFAF0e77Ed30Bf6d32805563A5",
|
|
1206
|
+
1480: "0x5786B12b4c6Ba2bFAF0e77Ed30Bf6d32805563A5"
|
|
1207
|
+
}
|
|
1208
|
+
},
|
|
1209
|
+
// TEE Pool Variants
|
|
1210
|
+
TeePoolEphemeralStandard: {
|
|
1211
|
+
addresses: {
|
|
1212
|
+
14800: "0xe124bae846D5ec157f75Bd9e68ca87C4d2AB835A",
|
|
1213
|
+
1480: "0xe124bae846D5ec157f75Bd9e68ca87C4d2AB835A"
|
|
1214
|
+
}
|
|
1215
|
+
},
|
|
1216
|
+
TeePoolPersistentStandard: {
|
|
1217
|
+
addresses: {
|
|
1218
|
+
14800: "0xe8bB8d0629651Cf33e0845d743976Dc1f0971d76",
|
|
1219
|
+
1480: "0xe8bB8d0629651Cf33e0845d743976Dc1f0971d76"
|
|
1220
|
+
}
|
|
1221
|
+
},
|
|
1222
|
+
TeePoolPersistentGpu: {
|
|
1223
|
+
addresses: {
|
|
1224
|
+
14800: "0x1c346Cd74f8551f8fa13f3F4b6b8dAE22338E6a9",
|
|
1225
|
+
1480: "0x1c346Cd74f8551f8fa13f3F4b6b8dAE22338E6a9"
|
|
1226
|
+
}
|
|
1227
|
+
},
|
|
1228
|
+
TeePoolDedicatedStandard: {
|
|
1229
|
+
addresses: {
|
|
1230
|
+
14800: "0xf024b7ac5E8417416f53B41ecfa58C8e9396687d",
|
|
1231
|
+
1480: "0xf024b7ac5E8417416f53B41ecfa58C8e9396687d"
|
|
1232
|
+
}
|
|
1233
|
+
},
|
|
1234
|
+
TeePoolDedicatedGpu: {
|
|
1235
|
+
addresses: {
|
|
1236
|
+
14800: "0xB1686FA9620bBf851714d1cB47b8a4Bf4664644E",
|
|
1237
|
+
1480: "0xB1686FA9620bBf851714d1cB47b8a4Bf4664644E"
|
|
1238
|
+
}
|
|
1239
|
+
},
|
|
1240
|
+
// DLP Reward System
|
|
1241
|
+
VanaEpoch: {
|
|
1242
|
+
addresses: {
|
|
1243
|
+
14800: "0x2063cFF0609D59bCCc196E20Eb58A8696a6b15A0",
|
|
1244
|
+
1480: "0x2063cFF0609D59bCCc196E20Eb58A8696a6b15A0"
|
|
1245
|
+
}
|
|
1246
|
+
},
|
|
1247
|
+
DLPRegistry: {
|
|
1248
|
+
addresses: {
|
|
1249
|
+
14800: "0x4D59880a924526d1dD33260552Ff4328b1E18a43",
|
|
1250
|
+
1480: "0x4D59880a924526d1dD33260552Ff4328b1E18a43"
|
|
1251
|
+
}
|
|
1252
|
+
},
|
|
1253
|
+
DLPRegistryTreasury: {
|
|
1254
|
+
addresses: {
|
|
1255
|
+
14800: "0xb12ce1d27bEeFe39b6F0110b1AB77C21Aa0c9F9a",
|
|
1256
|
+
1480: "0xb12ce1d27bEeFe39b6F0110b1AB77C21Aa0c9F9a"
|
|
1257
|
+
}
|
|
1258
|
+
},
|
|
1259
|
+
DLPPerformance: {
|
|
1260
|
+
addresses: {
|
|
1261
|
+
14800: "0x847715C7DB37cF286611182Be0bD333cbfa29cc1",
|
|
1262
|
+
1480: "0x847715C7DB37cF286611182Be0bD333cbfa29cc1"
|
|
1263
|
+
}
|
|
1264
|
+
},
|
|
1265
|
+
DLPRewardDeployer: {
|
|
1266
|
+
addresses: {
|
|
1267
|
+
14800: "0xEFD0F9Ba9De70586b7c4189971cF754adC923B04",
|
|
1268
|
+
1480: "0xEFD0F9Ba9De70586b7c4189971cF754adC923B04"
|
|
1269
|
+
}
|
|
1270
|
+
},
|
|
1271
|
+
DLPRewardDeployerTreasury: {
|
|
1272
|
+
addresses: {
|
|
1273
|
+
14800: "0xb547ca8Fe4990fe330FeAeb1C2EBb42F925Af5b8",
|
|
1274
|
+
1480: "0xb547ca8Fe4990fe330FeAeb1C2EBb42F925Af5b8"
|
|
1275
|
+
}
|
|
1276
|
+
},
|
|
1277
|
+
DLPRewardSwap: {
|
|
1278
|
+
addresses: {
|
|
1279
|
+
14800: "0x7c6862C46830F0fc3bF3FF509EA1bD0EE7267fB0",
|
|
1280
|
+
1480: "0x7c6862C46830F0fc3bF3FF509EA1bD0EE7267fB0"
|
|
1281
|
+
}
|
|
1282
|
+
},
|
|
1283
|
+
SwapHelper: {
|
|
1284
|
+
addresses: {
|
|
1285
|
+
14800: "0x55D5e6F73326315bF2E091e97F04f0770e5C54e2",
|
|
1286
|
+
1480: "0x55D5e6F73326315bF2E091e97F04f0770e5C54e2"
|
|
1287
|
+
}
|
|
1288
|
+
},
|
|
1289
|
+
// VanaPool (Staking)
|
|
1290
|
+
VanaPoolStaking: {
|
|
1291
|
+
addresses: {
|
|
1292
|
+
14800: "0x641C18E2F286c86f96CE95C8ec1EB9fC0415Ca0e",
|
|
1293
|
+
1480: "0x641C18E2F286c86f96CE95C8ec1EB9fC0415Ca0e"
|
|
1294
|
+
}
|
|
1295
|
+
},
|
|
1296
|
+
VanaPoolEntity: {
|
|
1297
|
+
addresses: {
|
|
1298
|
+
14800: "0x44f20490A82e1f1F1cC25Dd3BA8647034eDdce30",
|
|
1299
|
+
1480: "0x44f20490A82e1f1F1cC25Dd3BA8647034eDdce30"
|
|
1300
|
+
}
|
|
1301
|
+
},
|
|
1302
|
+
VanaPoolTreasury: {
|
|
1303
|
+
addresses: {
|
|
1304
|
+
14800: "0x143BE72CF2541604A7691933CAccd6D9cC17c003",
|
|
1305
|
+
1480: "0x143BE72CF2541604A7691933CAccd6D9cC17c003"
|
|
1306
|
+
}
|
|
1307
|
+
},
|
|
1308
|
+
// DLP Deployment Contracts
|
|
1309
|
+
DAT: {
|
|
1310
|
+
addresses: {
|
|
1311
|
+
14800: "0xA706b93ccED89f13340673889e29F0a5cd84212d",
|
|
1312
|
+
1480: "0xA706b93ccED89f13340673889e29F0a5cd84212d"
|
|
1313
|
+
}
|
|
1314
|
+
},
|
|
1315
|
+
DATFactory: {
|
|
1316
|
+
addresses: {
|
|
1317
|
+
14800: "0x40f8bccF35a75ecef63BC3B1B3E06ffEB9220644",
|
|
1318
|
+
1480: "0x40f8bccF35a75ecef63BC3B1B3E06ffEB9220644"
|
|
1319
|
+
}
|
|
1320
|
+
},
|
|
1321
|
+
DATPausable: {
|
|
1322
|
+
addresses: {
|
|
1323
|
+
14800: "0xe69FE86f0B95cC2f8416Fe22815c85DC8887e76e",
|
|
1324
|
+
1480: "0xe69FE86f0B95cC2f8416Fe22815c85DC8887e76e"
|
|
1325
|
+
}
|
|
1326
|
+
},
|
|
1327
|
+
DATVotes: {
|
|
1328
|
+
addresses: {
|
|
1329
|
+
14800: "0xaE04c8A77E9B27869eb563720524A9aE0baf1831",
|
|
1330
|
+
1480: "0xaE04c8A77E9B27869eb563720524A9aE0baf1831"
|
|
1331
|
+
}
|
|
1332
|
+
},
|
|
1333
|
+
// Utility Contracts (no ABIs in SDK)
|
|
1334
|
+
Multicall3: {
|
|
1335
|
+
addresses: {
|
|
1336
|
+
14800: "0xD8d2dFca27E8797fd779F8547166A2d3B29d360E",
|
|
1337
|
+
1480: "0xD8d2dFca27E8797fd779F8547166A2d3B29d360E"
|
|
1338
|
+
}
|
|
1339
|
+
},
|
|
1340
|
+
Multisend: {
|
|
1341
|
+
addresses: {
|
|
1342
|
+
14800: "0x8807e8BCDFbaA8c2761760f3FBA37F6f7F2C5b2d",
|
|
1343
|
+
1480: "0x8807e8BCDFbaA8c2761760f3FBA37F6f7F2C5b2d"
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
var LEGACY_CONTRACTS = {
|
|
1348
|
+
// DEPRECATED: Original Intel SGX TeePool (PRO-347)
|
|
1349
|
+
TeePool: {
|
|
1350
|
+
addresses: {
|
|
1351
|
+
14800: "0x3c92fD91639b41f13338CE62f19131e7d19eaa0D",
|
|
1352
|
+
1480: "0x3c92fD91639b41f13338CE62f19131e7d19eaa0D"
|
|
1353
|
+
}
|
|
1354
|
+
},
|
|
1355
|
+
// DEPRECATED: DLPRoot system (replaced by VanaPool + DLPRewards)
|
|
1356
|
+
DLPRootEpoch: {
|
|
1357
|
+
addresses: {
|
|
1358
|
+
14800: "0xc3d176cF6BccFCB9225b53B87a95147218e1537F",
|
|
1359
|
+
1480: "0xc3d176cF6BccFCB9225b53B87a95147218e1537F"
|
|
1360
|
+
}
|
|
1361
|
+
},
|
|
1362
|
+
DLPRootCore: {
|
|
1363
|
+
addresses: {
|
|
1364
|
+
14800: "0x0aBa5e28228c323A67712101d61a54d4ff5720FD",
|
|
1365
|
+
1480: "0x0aBa5e28228c323A67712101d61a54d4ff5720FD"
|
|
1366
|
+
}
|
|
1367
|
+
},
|
|
1368
|
+
DLPRoot: {
|
|
1369
|
+
addresses: {
|
|
1370
|
+
14800: "0xff14346dF2B8Fd0c95BF34f1c92e49417b508AD5",
|
|
1371
|
+
1480: "0xff14346dF2B8Fd0c95BF34f1c92e49417b508AD5"
|
|
1372
|
+
}
|
|
1373
|
+
},
|
|
1374
|
+
DLPRootMetrics: {
|
|
1375
|
+
addresses: {
|
|
1376
|
+
14800: "0xbb532917B6407c060Afd9Cb7d53527eCb91d6662",
|
|
1377
|
+
1480: "0xbb532917B6407c060Afd9Cb7d53527eCb91d6662"
|
|
1378
|
+
}
|
|
1379
|
+
},
|
|
1380
|
+
DLPRootStakesTreasury: {
|
|
1381
|
+
addresses: {
|
|
1382
|
+
14800: "0x52c3260ED5C235fcA43524CF508e29c897318775",
|
|
1383
|
+
1480: "0x52c3260ED5C235fcA43524CF508e29c897318775"
|
|
1384
|
+
}
|
|
1385
|
+
},
|
|
1386
|
+
DLPRootRewardsTreasury: {
|
|
1387
|
+
addresses: {
|
|
1388
|
+
14800: "0xDBFb6B8b9E2eCAEbdE64d665cD553dB81e524479",
|
|
1389
|
+
1480: "0xDBFb6B8b9E2eCAEbdE64d665cD553dB81e524479"
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
};
|
|
1393
|
+
var CONTRACT_ADDRESSES = {
|
|
1394
|
+
14800: Object.fromEntries(
|
|
1395
|
+
Object.entries(CONTRACTS).map(([name, info]) => [name, info.addresses[14800]]).filter(([, addr]) => addr)
|
|
1396
|
+
),
|
|
1397
|
+
1480: Object.fromEntries(
|
|
1398
|
+
Object.entries(CONTRACTS).map(([name, info]) => [name, info.addresses[1480]]).filter(([, addr]) => addr)
|
|
1399
|
+
)
|
|
1400
|
+
};
|
|
1401
|
+
var UTILITY_ADDRESSES = {
|
|
1402
|
+
14800: {
|
|
1403
|
+
Multicall3: CONTRACTS.Multicall3.addresses[14800],
|
|
1404
|
+
Multisend: CONTRACTS.Multisend.addresses[14800]
|
|
1405
|
+
},
|
|
1406
|
+
1480: {
|
|
1407
|
+
Multicall3: CONTRACTS.Multicall3.addresses[1480],
|
|
1408
|
+
Multisend: CONTRACTS.Multisend.addresses[1480]
|
|
1409
|
+
}
|
|
1410
|
+
};
|
|
1411
|
+
var LEGACY_ADDRESSES = {
|
|
1412
|
+
14800: Object.fromEntries(
|
|
1413
|
+
Object.entries(LEGACY_CONTRACTS).map(([name, info]) => [name, info.addresses[14800]]).filter(([, addr]) => addr)
|
|
1414
|
+
),
|
|
1415
|
+
1480: Object.fromEntries(
|
|
1416
|
+
Object.entries(LEGACY_CONTRACTS).map(([name, info]) => [name, info.addresses[1480]]).filter(([, addr]) => addr)
|
|
1417
|
+
)
|
|
1418
|
+
};
|
|
1419
|
+
var getContractAddress = (chainId, contract) => {
|
|
1420
|
+
const contractAddress = CONTRACT_ADDRESSES[chainId]?.[contract];
|
|
1421
|
+
if (!contractAddress) {
|
|
1422
|
+
throw new Error(
|
|
1423
|
+
`Contract address not found for ${contract} on chain ${chainId}`
|
|
1424
|
+
);
|
|
1425
|
+
}
|
|
1426
|
+
return contractAddress;
|
|
1427
|
+
};
|
|
1428
|
+
var getUtilityAddress = (chainId, contract) => {
|
|
1429
|
+
return UTILITY_ADDRESSES[chainId][contract];
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
// src/utils/multicall.ts
|
|
1433
|
+
var DEFAULT_OPTIONS = {
|
|
1434
|
+
maxGasPerBatch: 10000000n,
|
|
1435
|
+
// 10M gas - conservative default
|
|
1436
|
+
maxCalldataBytes: 1e5,
|
|
1437
|
+
// 100KB - works with most RPC providers
|
|
1438
|
+
checkpointFrequency: {
|
|
1439
|
+
calls: 32,
|
|
1440
|
+
bytes: 8192
|
|
1441
|
+
// 8KB
|
|
1442
|
+
},
|
|
1443
|
+
allowFailure: false
|
|
1444
|
+
};
|
|
1445
|
+
async function gasAwareMulticall(client, parameters, options = {}) {
|
|
1446
|
+
const chainId = await client.getChainId();
|
|
1447
|
+
const multicall3Address = options.multicallAddress || getUtilityAddress(chainId, "Multicall3");
|
|
1448
|
+
const opts = {
|
|
1449
|
+
...DEFAULT_OPTIONS,
|
|
1450
|
+
...options,
|
|
1451
|
+
multicallAddress: multicall3Address,
|
|
1452
|
+
checkpointFrequency: {
|
|
1453
|
+
...DEFAULT_OPTIONS.checkpointFrequency,
|
|
1454
|
+
...options.checkpointFrequency
|
|
1455
|
+
}
|
|
1456
|
+
};
|
|
1457
|
+
if (parameters.allowFailure !== void 0) {
|
|
1458
|
+
opts.allowFailure = parameters.allowFailure;
|
|
1459
|
+
}
|
|
1460
|
+
const { contracts } = parameters;
|
|
1461
|
+
if (!contracts || contracts.length === 0) {
|
|
1462
|
+
return [];
|
|
1463
|
+
}
|
|
1464
|
+
const batches = await createBatches(
|
|
1465
|
+
client,
|
|
1466
|
+
contracts,
|
|
1467
|
+
opts
|
|
1468
|
+
);
|
|
1469
|
+
const batchResults = await Promise.all(
|
|
1470
|
+
batches.map((batch, index) => {
|
|
1471
|
+
if (opts.onProgress && index > 0) {
|
|
1472
|
+
const completed = batches.slice(0, index).reduce((sum, b) => sum + b.length, 0);
|
|
1473
|
+
opts.onProgress(completed, contracts.length);
|
|
1474
|
+
}
|
|
1475
|
+
return client.multicall({
|
|
1476
|
+
...parameters,
|
|
1477
|
+
contracts: batch,
|
|
1478
|
+
multicallAddress: opts.multicallAddress,
|
|
1479
|
+
allowFailure: opts.allowFailure
|
|
1480
|
+
});
|
|
1481
|
+
})
|
|
1482
|
+
);
|
|
1483
|
+
if (opts.onProgress) {
|
|
1484
|
+
opts.onProgress(contracts.length, contracts.length);
|
|
1485
|
+
}
|
|
1486
|
+
return batchResults.flat();
|
|
1487
|
+
}
|
|
1488
|
+
async function createBatches(client, contracts, options) {
|
|
1489
|
+
const batches = [];
|
|
1490
|
+
let currentBatch = [];
|
|
1491
|
+
let currentBytes = 0;
|
|
1492
|
+
let lastCheckpointIndex = 0;
|
|
1493
|
+
let lastCheckpointBytes = 0;
|
|
1494
|
+
let lastEstimatedGas = 0n;
|
|
1495
|
+
for (let i = 0; i < contracts.length; i++) {
|
|
1496
|
+
const contract = contracts[i];
|
|
1497
|
+
const encoded = encodeContractCall(contract);
|
|
1498
|
+
const callBytes = size(encoded);
|
|
1499
|
+
const callsSinceCheckpoint = i - lastCheckpointIndex;
|
|
1500
|
+
const bytesSinceCheckpoint = currentBytes - lastCheckpointBytes;
|
|
1501
|
+
const needsCheckpoint = callsSinceCheckpoint >= options.checkpointFrequency.calls || bytesSinceCheckpoint >= options.checkpointFrequency.bytes;
|
|
1502
|
+
if (needsCheckpoint && currentBatch.length > 0) {
|
|
1503
|
+
try {
|
|
1504
|
+
lastEstimatedGas = await estimateBatchGas(
|
|
1505
|
+
client,
|
|
1506
|
+
currentBatch,
|
|
1507
|
+
options.multicallAddress
|
|
1508
|
+
);
|
|
1509
|
+
lastCheckpointIndex = i;
|
|
1510
|
+
lastCheckpointBytes = currentBytes;
|
|
1511
|
+
} catch (error) {
|
|
1512
|
+
if (currentBatch.length > 1) {
|
|
1513
|
+
const halfBatch = currentBatch.slice(
|
|
1514
|
+
0,
|
|
1515
|
+
Math.floor(currentBatch.length / 2)
|
|
1516
|
+
);
|
|
1517
|
+
batches.push(halfBatch);
|
|
1518
|
+
currentBatch = currentBatch.slice(halfBatch.length);
|
|
1519
|
+
currentBytes = calculateBatchSize(currentBatch);
|
|
1520
|
+
lastCheckpointIndex = i;
|
|
1521
|
+
lastCheckpointBytes = currentBytes;
|
|
1522
|
+
lastEstimatedGas = 0n;
|
|
1523
|
+
} else {
|
|
1524
|
+
if (!options.allowFailure) {
|
|
1525
|
+
throw new Error(`Gas estimation failed for call ${i}: ${error}`);
|
|
1526
|
+
}
|
|
1527
|
+
currentBatch = [];
|
|
1528
|
+
currentBytes = 0;
|
|
1529
|
+
continue;
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
const wouldExceedCalldata = currentBytes + callBytes > options.maxCalldataBytes;
|
|
1534
|
+
const wouldExceedGas = lastEstimatedGas > 0n && estimateNextGas(lastEstimatedGas, callsSinceCheckpoint + 1) > options.maxGasPerBatch;
|
|
1535
|
+
if ((wouldExceedCalldata || wouldExceedGas) && currentBatch.length > 0) {
|
|
1536
|
+
batches.push(currentBatch);
|
|
1537
|
+
currentBatch = [];
|
|
1538
|
+
currentBytes = 0;
|
|
1539
|
+
lastCheckpointIndex = i;
|
|
1540
|
+
lastCheckpointBytes = 0;
|
|
1541
|
+
lastEstimatedGas = 0n;
|
|
1542
|
+
}
|
|
1543
|
+
currentBatch.push(contract);
|
|
1544
|
+
currentBytes += callBytes;
|
|
1545
|
+
}
|
|
1546
|
+
if (currentBatch.length > 0) {
|
|
1547
|
+
batches.push(currentBatch);
|
|
1548
|
+
}
|
|
1549
|
+
return batches;
|
|
1550
|
+
}
|
|
1551
|
+
function encodeContractCall(contract) {
|
|
1552
|
+
const { abi, functionName, args } = contract;
|
|
1553
|
+
return encodeFunctionData({
|
|
1554
|
+
abi,
|
|
1555
|
+
functionName,
|
|
1556
|
+
args
|
|
1557
|
+
});
|
|
1558
|
+
}
|
|
1559
|
+
function calculateBatchSize(batch) {
|
|
1560
|
+
return batch.reduce((total, contract) => {
|
|
1561
|
+
const encoded = encodeContractCall(contract);
|
|
1562
|
+
return total + size(encoded);
|
|
1563
|
+
}, 0);
|
|
1564
|
+
}
|
|
1565
|
+
async function estimateBatchGas(client, batch, multicallAddress) {
|
|
1566
|
+
const calls = batch.map((contract) => ({
|
|
1567
|
+
target: contract.address,
|
|
1568
|
+
allowFailure: false,
|
|
1569
|
+
callData: encodeContractCall(contract)
|
|
1570
|
+
}));
|
|
1571
|
+
const gas = await client.estimateGas({
|
|
1572
|
+
to: multicallAddress,
|
|
1573
|
+
data: encodeFunctionData({
|
|
1574
|
+
abi: multicall3Abi,
|
|
1575
|
+
functionName: "aggregate3",
|
|
1576
|
+
args: [calls]
|
|
1577
|
+
})
|
|
1578
|
+
});
|
|
1579
|
+
return gas;
|
|
1580
|
+
}
|
|
1581
|
+
function estimateNextGas(lastGas, callsSinceCheckpoint) {
|
|
1582
|
+
if (callsSinceCheckpoint === 0) return lastGas;
|
|
1583
|
+
const avgGasPerCall = lastGas / BigInt(Math.max(1, callsSinceCheckpoint - 1));
|
|
1584
|
+
const estimatedGas = lastGas + avgGasPerCall;
|
|
1585
|
+
return estimatedGas * 110n / 100n;
|
|
1586
|
+
}
|
|
1587
|
+
var multicall3Abi = [
|
|
1588
|
+
{
|
|
1589
|
+
name: "aggregate3",
|
|
1590
|
+
type: "function",
|
|
1591
|
+
stateMutability: "payable",
|
|
1592
|
+
inputs: [
|
|
1593
|
+
{
|
|
1594
|
+
name: "calls",
|
|
1595
|
+
type: "tuple[]",
|
|
1596
|
+
components: [
|
|
1597
|
+
{ name: "target", type: "address" },
|
|
1598
|
+
{ name: "allowFailure", type: "bool" },
|
|
1599
|
+
{ name: "callData", type: "bytes" }
|
|
1600
|
+
]
|
|
1601
|
+
}
|
|
1602
|
+
],
|
|
1603
|
+
outputs: [
|
|
1604
|
+
{
|
|
1605
|
+
name: "returnData",
|
|
1606
|
+
type: "tuple[]",
|
|
1607
|
+
components: [
|
|
1608
|
+
{ name: "success", type: "bool" },
|
|
1609
|
+
{ name: "returnData", type: "bytes" }
|
|
1610
|
+
]
|
|
1611
|
+
}
|
|
1612
|
+
]
|
|
1613
|
+
}
|
|
1614
|
+
];
|
|
1615
|
+
|
|
1142
1616
|
// src/utils/transactionParsing.ts
|
|
1143
1617
|
import { parseEventLogs } from "viem";
|
|
1144
1618
|
|
|
1145
1619
|
// src/config/eventMappings.ts
|
|
1146
1620
|
var EVENT_MAPPINGS = {
|
|
1147
|
-
//
|
|
1621
|
+
// DataPortabilityPermissions operations
|
|
1148
1622
|
grant: {
|
|
1149
1623
|
contract: "DataPortabilityPermissions",
|
|
1150
1624
|
event: "PermissionAdded"
|
|
@@ -1153,6 +1627,15 @@ var EVENT_MAPPINGS = {
|
|
|
1153
1627
|
contract: "DataPortabilityPermissions",
|
|
1154
1628
|
event: "PermissionRevoked"
|
|
1155
1629
|
},
|
|
1630
|
+
revokePermission: {
|
|
1631
|
+
contract: "DataPortabilityPermissions",
|
|
1632
|
+
event: "PermissionRevoked"
|
|
1633
|
+
},
|
|
1634
|
+
addServerFilesAndPermissions: {
|
|
1635
|
+
contract: "DataPortabilityPermissions",
|
|
1636
|
+
event: "PermissionAdded"
|
|
1637
|
+
},
|
|
1638
|
+
// DataPortabilityServers operations
|
|
1156
1639
|
trustServer: {
|
|
1157
1640
|
contract: "DataPortabilityServers",
|
|
1158
1641
|
event: "ServerTrusted"
|
|
@@ -1161,15 +1644,51 @@ var EVENT_MAPPINGS = {
|
|
|
1161
1644
|
contract: "DataPortabilityServers",
|
|
1162
1645
|
event: "ServerUntrusted"
|
|
1163
1646
|
},
|
|
1164
|
-
|
|
1647
|
+
registerServer: {
|
|
1648
|
+
contract: "DataPortabilityServers",
|
|
1649
|
+
event: "ServerRegistered"
|
|
1650
|
+
},
|
|
1651
|
+
updateServer: {
|
|
1652
|
+
contract: "DataPortabilityServers",
|
|
1653
|
+
event: "ServerUpdated"
|
|
1654
|
+
},
|
|
1655
|
+
addAndTrustServer: {
|
|
1656
|
+
contract: "DataPortabilityServers",
|
|
1657
|
+
event: "ServerTrusted"
|
|
1658
|
+
},
|
|
1659
|
+
// DataRegistry operations
|
|
1165
1660
|
addFile: {
|
|
1166
1661
|
contract: "DataRegistry",
|
|
1167
1662
|
event: "FileAdded"
|
|
1168
1663
|
},
|
|
1664
|
+
addFileWithPermissionsAndSchema: {
|
|
1665
|
+
contract: "DataRegistry",
|
|
1666
|
+
event: "FileAdded"
|
|
1667
|
+
},
|
|
1668
|
+
addFileWithSchema: {
|
|
1669
|
+
contract: "DataRegistry",
|
|
1670
|
+
event: "FileAdded"
|
|
1671
|
+
},
|
|
1672
|
+
addFileWithPermissions: {
|
|
1673
|
+
contract: "DataRegistry",
|
|
1674
|
+
event: "FileAdded"
|
|
1675
|
+
},
|
|
1169
1676
|
addRefinement: {
|
|
1170
1677
|
contract: "DataRegistry",
|
|
1171
1678
|
event: "RefinementAdded"
|
|
1172
1679
|
},
|
|
1680
|
+
addRefiner: {
|
|
1681
|
+
contract: "DataRefinerRegistry",
|
|
1682
|
+
event: "RefinerAdded"
|
|
1683
|
+
},
|
|
1684
|
+
updateSchemaId: {
|
|
1685
|
+
contract: "DataRefinerRegistry",
|
|
1686
|
+
event: "SchemaAdded"
|
|
1687
|
+
},
|
|
1688
|
+
addSchema: {
|
|
1689
|
+
contract: "DataRefinerRegistry",
|
|
1690
|
+
event: "SchemaAdded"
|
|
1691
|
+
},
|
|
1173
1692
|
updateRefinement: {
|
|
1174
1693
|
contract: "DataRegistry",
|
|
1175
1694
|
event: "RefinementUpdated"
|
|
@@ -1177,10 +1696,15 @@ var EVENT_MAPPINGS = {
|
|
|
1177
1696
|
addFilePermission: {
|
|
1178
1697
|
contract: "DataRegistry",
|
|
1179
1698
|
event: "PermissionGranted"
|
|
1699
|
+
},
|
|
1700
|
+
// DataPortabilityGrantees operations
|
|
1701
|
+
registerGrantee: {
|
|
1702
|
+
contract: "DataPortabilityGrantees",
|
|
1703
|
+
event: "GranteeRegistered"
|
|
1180
1704
|
}
|
|
1181
1705
|
};
|
|
1182
1706
|
|
|
1183
|
-
// src/abi/ComputeEngineImplementation.ts
|
|
1707
|
+
// src/generated/abi/ComputeEngineImplementation.ts
|
|
1184
1708
|
var ComputeEngineABI = [
|
|
1185
1709
|
{
|
|
1186
1710
|
inputs: [],
|
|
@@ -2465,7 +2989,7 @@ var ComputeEngineABI = [
|
|
|
2465
2989
|
}
|
|
2466
2990
|
];
|
|
2467
2991
|
|
|
2468
|
-
// src/abi/DataRegistryImplementation.ts
|
|
2992
|
+
// src/generated/abi/DataRegistryImplementation.ts
|
|
2469
2993
|
var DataRegistryABI = [
|
|
2470
2994
|
{
|
|
2471
2995
|
inputs: [],
|
|
@@ -3655,7 +4179,7 @@ var DataRegistryABI = [
|
|
|
3655
4179
|
}
|
|
3656
4180
|
];
|
|
3657
4181
|
|
|
3658
|
-
// src/abi/TeePoolImplementation.ts
|
|
4182
|
+
// src/generated/abi/TeePoolImplementation.ts
|
|
3659
4183
|
var TeePoolABI = [
|
|
3660
4184
|
{
|
|
3661
4185
|
inputs: [],
|
|
@@ -4940,7 +5464,7 @@ var TeePoolABI = [
|
|
|
4940
5464
|
}
|
|
4941
5465
|
];
|
|
4942
5466
|
|
|
4943
|
-
// src/abi/TeePoolPhalaImplementation.ts
|
|
5467
|
+
// src/generated/abi/TeePoolPhalaImplementation.ts
|
|
4944
5468
|
var TeePoolPhalaABI = [
|
|
4945
5469
|
{
|
|
4946
5470
|
inputs: [],
|
|
@@ -6225,7 +6749,7 @@ var TeePoolPhalaABI = [
|
|
|
6225
6749
|
}
|
|
6226
6750
|
];
|
|
6227
6751
|
|
|
6228
|
-
// src/abi/DataPortabilityPermissionsImplementation.ts
|
|
6752
|
+
// src/generated/abi/DataPortabilityPermissionsImplementation.ts
|
|
6229
6753
|
var DataPortabilityPermissionsABI = [
|
|
6230
6754
|
{
|
|
6231
6755
|
inputs: [],
|
|
@@ -7493,7 +8017,7 @@ var DataPortabilityPermissionsABI = [
|
|
|
7493
8017
|
}
|
|
7494
8018
|
];
|
|
7495
8019
|
|
|
7496
|
-
// src/abi/DataPortabilityServersImplementation.ts
|
|
8020
|
+
// src/generated/abi/DataPortabilityServersImplementation.ts
|
|
7497
8021
|
var DataPortabilityServersABI = [
|
|
7498
8022
|
{
|
|
7499
8023
|
inputs: [],
|
|
@@ -8885,7 +9409,7 @@ var DataPortabilityServersABI = [
|
|
|
8885
9409
|
}
|
|
8886
9410
|
];
|
|
8887
9411
|
|
|
8888
|
-
// src/abi/DataPortabilityGranteesImplementation.ts
|
|
9412
|
+
// src/generated/abi/DataPortabilityGranteesImplementation.ts
|
|
8889
9413
|
var DataPortabilityGranteesABI = [
|
|
8890
9414
|
{
|
|
8891
9415
|
inputs: [],
|
|
@@ -9745,7 +10269,7 @@ var DataPortabilityGranteesABI = [
|
|
|
9745
10269
|
}
|
|
9746
10270
|
];
|
|
9747
10271
|
|
|
9748
|
-
// src/abi/DataRefinerRegistryImplementation.ts
|
|
10272
|
+
// src/generated/abi/DataRefinerRegistryImplementation.ts
|
|
9749
10273
|
var DataRefinerRegistryABI = [
|
|
9750
10274
|
{
|
|
9751
10275
|
inputs: [],
|
|
@@ -10701,7 +11225,7 @@ var DataRefinerRegistryABI = [
|
|
|
10701
11225
|
}
|
|
10702
11226
|
];
|
|
10703
11227
|
|
|
10704
|
-
// src/abi/QueryEngineImplementation.ts
|
|
11228
|
+
// src/generated/abi/QueryEngineImplementation.ts
|
|
10705
11229
|
var QueryEngineABI = [
|
|
10706
11230
|
{
|
|
10707
11231
|
inputs: [],
|
|
@@ -11992,7 +12516,7 @@ var QueryEngineABI = [
|
|
|
11992
12516
|
}
|
|
11993
12517
|
];
|
|
11994
12518
|
|
|
11995
|
-
// src/abi/ComputeInstructionRegistryImplementation.ts
|
|
12519
|
+
// src/generated/abi/ComputeInstructionRegistryImplementation.ts
|
|
11996
12520
|
var ComputeInstructionRegistryABI = [
|
|
11997
12521
|
{
|
|
11998
12522
|
inputs: [],
|
|
@@ -12698,7 +13222,7 @@ var ComputeInstructionRegistryABI = [
|
|
|
12698
13222
|
}
|
|
12699
13223
|
];
|
|
12700
13224
|
|
|
12701
|
-
// src/abi/TeePoolEphemeralStandardImplementation.ts
|
|
13225
|
+
// src/generated/abi/TeePoolEphemeralStandardImplementation.ts
|
|
12702
13226
|
var TeePoolEphemeralStandardABI = [
|
|
12703
13227
|
{
|
|
12704
13228
|
inputs: [],
|
|
@@ -13606,7 +14130,7 @@ var TeePoolEphemeralStandardABI = [
|
|
|
13606
14130
|
}
|
|
13607
14131
|
];
|
|
13608
14132
|
|
|
13609
|
-
// src/abi/TeePoolPersistentStandardImplementation.ts
|
|
14133
|
+
// src/generated/abi/TeePoolPersistentStandardImplementation.ts
|
|
13610
14134
|
var TeePoolPersistentStandardABI = [
|
|
13611
14135
|
{
|
|
13612
14136
|
inputs: [],
|
|
@@ -14514,7 +15038,7 @@ var TeePoolPersistentStandardABI = [
|
|
|
14514
15038
|
}
|
|
14515
15039
|
];
|
|
14516
15040
|
|
|
14517
|
-
// src/abi/TeePoolPersistentGpuImplementation.ts
|
|
15041
|
+
// src/generated/abi/TeePoolPersistentGpuImplementation.ts
|
|
14518
15042
|
var TeePoolPersistentGpuABI = [
|
|
14519
15043
|
{
|
|
14520
15044
|
inputs: [],
|
|
@@ -15422,7 +15946,7 @@ var TeePoolPersistentGpuABI = [
|
|
|
15422
15946
|
}
|
|
15423
15947
|
];
|
|
15424
15948
|
|
|
15425
|
-
// src/abi/TeePoolDedicatedStandardImplementation.ts
|
|
15949
|
+
// src/generated/abi/TeePoolDedicatedStandardImplementation.ts
|
|
15426
15950
|
var TeePoolDedicatedStandardABI = [
|
|
15427
15951
|
{
|
|
15428
15952
|
inputs: [],
|
|
@@ -16330,7 +16854,7 @@ var TeePoolDedicatedStandardABI = [
|
|
|
16330
16854
|
}
|
|
16331
16855
|
];
|
|
16332
16856
|
|
|
16333
|
-
// src/abi/TeePoolDedicatedGpuImplementation.ts
|
|
16857
|
+
// src/generated/abi/TeePoolDedicatedGpuImplementation.ts
|
|
16334
16858
|
var TeePoolDedicatedGpuABI = [
|
|
16335
16859
|
{
|
|
16336
16860
|
inputs: [],
|
|
@@ -17238,7 +17762,7 @@ var TeePoolDedicatedGpuABI = [
|
|
|
17238
17762
|
}
|
|
17239
17763
|
];
|
|
17240
17764
|
|
|
17241
|
-
// src/abi/VanaEpochImplementation.ts
|
|
17765
|
+
// src/generated/abi/VanaEpochImplementation.ts
|
|
17242
17766
|
var VanaEpochABI = [
|
|
17243
17767
|
{
|
|
17244
17768
|
inputs: [],
|
|
@@ -18398,7 +18922,7 @@ var VanaEpochABI = [
|
|
|
18398
18922
|
}
|
|
18399
18923
|
];
|
|
18400
18924
|
|
|
18401
|
-
// src/abi/DLPRegistryImplementation.ts
|
|
18925
|
+
// src/generated/abi/DLPRegistryImplementation.ts
|
|
18402
18926
|
var DLPRegistryABI = [
|
|
18403
18927
|
{
|
|
18404
18928
|
inputs: [],
|
|
@@ -19839,7 +20363,7 @@ var DLPRegistryABI = [
|
|
|
19839
20363
|
}
|
|
19840
20364
|
];
|
|
19841
20365
|
|
|
19842
|
-
// src/abi/DLPTreasuryImplementation.ts
|
|
20366
|
+
// src/generated/abi/DLPTreasuryImplementation.ts
|
|
19843
20367
|
var DLPRegistryTreasuryABI = [
|
|
19844
20368
|
{
|
|
19845
20369
|
inputs: [],
|
|
@@ -20423,7 +20947,7 @@ var DLPRegistryTreasuryABI = [
|
|
|
20423
20947
|
}
|
|
20424
20948
|
];
|
|
20425
20949
|
|
|
20426
|
-
// src/abi/DLPRewardDeployerTreasuryImplementation.ts
|
|
20950
|
+
// src/generated/abi/DLPRewardDeployerTreasuryImplementation.ts
|
|
20427
20951
|
var DLPRewardDeployerTreasuryABI = [
|
|
20428
20952
|
{
|
|
20429
20953
|
inputs: [],
|
|
@@ -21007,7 +21531,7 @@ var DLPRewardDeployerTreasuryABI = [
|
|
|
21007
21531
|
}
|
|
21008
21532
|
];
|
|
21009
21533
|
|
|
21010
|
-
// src/abi/DLPPerformanceImplementation.ts
|
|
21534
|
+
// src/generated/abi/DLPPerformanceImplementation.ts
|
|
21011
21535
|
var DLPPerformanceABI = [
|
|
21012
21536
|
{
|
|
21013
21537
|
inputs: [],
|
|
@@ -22139,7 +22663,7 @@ var DLPPerformanceABI = [
|
|
|
22139
22663
|
}
|
|
22140
22664
|
];
|
|
22141
22665
|
|
|
22142
|
-
// src/abi/DLPRewardDeployerImplementation.ts
|
|
22666
|
+
// src/generated/abi/DLPRewardDeployerImplementation.ts
|
|
22143
22667
|
var DLPRewardDeployerABI = [
|
|
22144
22668
|
{
|
|
22145
22669
|
inputs: [],
|
|
@@ -23059,7 +23583,7 @@ var DLPRewardDeployerABI = [
|
|
|
23059
23583
|
}
|
|
23060
23584
|
];
|
|
23061
23585
|
|
|
23062
|
-
// src/abi/DLPRewardSwapImplementation.ts
|
|
23586
|
+
// src/generated/abi/DLPRewardSwapImplementation.ts
|
|
23063
23587
|
var DLPRewardSwapABI = [
|
|
23064
23588
|
{
|
|
23065
23589
|
inputs: [],
|
|
@@ -23970,7 +24494,7 @@ var DLPRewardSwapABI = [
|
|
|
23970
24494
|
}
|
|
23971
24495
|
];
|
|
23972
24496
|
|
|
23973
|
-
// src/abi/SwapHelperImplementation.ts
|
|
24497
|
+
// src/generated/abi/SwapHelperImplementation.ts
|
|
23974
24498
|
var SwapHelperABI = [
|
|
23975
24499
|
{
|
|
23976
24500
|
inputs: [],
|
|
@@ -24961,7 +25485,7 @@ var SwapHelperABI = [
|
|
|
24961
25485
|
}
|
|
24962
25486
|
];
|
|
24963
25487
|
|
|
24964
|
-
// src/abi/DLPRootImplementation.ts
|
|
25488
|
+
// src/generated/abi/DLPRootImplementation.ts
|
|
24965
25489
|
var DLPRootImplementation2Abi = [
|
|
24966
25490
|
{
|
|
24967
25491
|
inputs: [],
|
|
@@ -26579,7 +27103,7 @@ var DLPRootImplementation2Abi = [
|
|
|
26579
27103
|
}
|
|
26580
27104
|
];
|
|
26581
27105
|
|
|
26582
|
-
// src/abi/DataLiquidityPoolImplementation.ts
|
|
27106
|
+
// src/generated/abi/DataLiquidityPoolImplementation.ts
|
|
26583
27107
|
var DataLiquidityPoolImplementationAbi = [
|
|
26584
27108
|
{
|
|
26585
27109
|
inputs: [],
|
|
@@ -27538,7 +28062,7 @@ var DataLiquidityPoolImplementationAbi = [
|
|
|
27538
28062
|
}
|
|
27539
28063
|
];
|
|
27540
28064
|
|
|
27541
|
-
// src/abi/DLPRegistryTreasuryImplementation.ts
|
|
28065
|
+
// src/generated/abi/DLPRegistryTreasuryImplementation.ts
|
|
27542
28066
|
var DLPRegistryTreasuryABI2 = [
|
|
27543
28067
|
{
|
|
27544
28068
|
inputs: [],
|
|
@@ -28122,7 +28646,7 @@ var DLPRegistryTreasuryABI2 = [
|
|
|
28122
28646
|
}
|
|
28123
28647
|
];
|
|
28124
28648
|
|
|
28125
|
-
// src/abi/VanaPoolStakingImplementation.ts
|
|
28649
|
+
// src/generated/abi/VanaPoolStakingImplementation.ts
|
|
28126
28650
|
var VanaPoolStakingABI = [
|
|
28127
28651
|
{
|
|
28128
28652
|
inputs: [],
|
|
@@ -29015,7 +29539,7 @@ var VanaPoolStakingABI = [
|
|
|
29015
29539
|
}
|
|
29016
29540
|
];
|
|
29017
29541
|
|
|
29018
|
-
// src/abi/VanaPoolEntityImplementation.ts
|
|
29542
|
+
// src/generated/abi/VanaPoolEntityImplementation.ts
|
|
29019
29543
|
var VanaPoolEntityABI = [
|
|
29020
29544
|
{
|
|
29021
29545
|
inputs: [],
|
|
@@ -30221,7 +30745,7 @@ var VanaPoolEntityABI = [
|
|
|
30221
30745
|
}
|
|
30222
30746
|
];
|
|
30223
30747
|
|
|
30224
|
-
// src/abi/VanaPoolTreasuryImplementation.ts
|
|
30748
|
+
// src/generated/abi/VanaPoolTreasuryImplementation.ts
|
|
30225
30749
|
var VanaPoolTreasuryABI = [
|
|
30226
30750
|
{
|
|
30227
30751
|
inputs: [],
|
|
@@ -30731,7 +31255,7 @@ var VanaPoolTreasuryABI = [
|
|
|
30731
31255
|
}
|
|
30732
31256
|
];
|
|
30733
31257
|
|
|
30734
|
-
// src/abi/DATImplementation.ts
|
|
31258
|
+
// src/generated/abi/DATImplementation.ts
|
|
30735
31259
|
var DATABI = [
|
|
30736
31260
|
{
|
|
30737
31261
|
inputs: [],
|
|
@@ -31637,7 +32161,7 @@ var DATABI = [
|
|
|
31637
32161
|
}
|
|
31638
32162
|
];
|
|
31639
32163
|
|
|
31640
|
-
// src/abi/DATFactoryImplementation.ts
|
|
32164
|
+
// src/generated/abi/DATFactoryImplementation.ts
|
|
31641
32165
|
var DATFactoryABI = [
|
|
31642
32166
|
{
|
|
31643
32167
|
inputs: [],
|
|
@@ -32491,7 +33015,7 @@ var DATFactoryABI = [
|
|
|
32491
33015
|
}
|
|
32492
33016
|
];
|
|
32493
33017
|
|
|
32494
|
-
// src/abi/DATPausableImplementation.ts
|
|
33018
|
+
// src/generated/abi/DATPausableImplementation.ts
|
|
32495
33019
|
var DATPausableABI = [
|
|
32496
33020
|
{
|
|
32497
33021
|
inputs: [],
|
|
@@ -33986,7 +34510,7 @@ var DATPausableABI = [
|
|
|
33986
34510
|
}
|
|
33987
34511
|
];
|
|
33988
34512
|
|
|
33989
|
-
// src/abi/DATVotesImplementation.ts
|
|
34513
|
+
// src/generated/abi/DATVotesImplementation.ts
|
|
33990
34514
|
var DATVotesABI = [
|
|
33991
34515
|
{
|
|
33992
34516
|
inputs: [],
|
|
@@ -35418,7 +35942,7 @@ var DATVotesABI = [
|
|
|
35418
35942
|
}
|
|
35419
35943
|
];
|
|
35420
35944
|
|
|
35421
|
-
// src/abi/index.ts
|
|
35945
|
+
// src/generated/abi/index.ts
|
|
35422
35946
|
var contractAbis = {
|
|
35423
35947
|
DataPortabilityPermissions: DataPortabilityPermissionsABI,
|
|
35424
35948
|
DataPortabilityServers: DataPortabilityServersABI,
|
|
@@ -35524,288 +36048,99 @@ async function parseTransactionResult(context, hash, operation) {
|
|
|
35524
36048
|
}
|
|
35525
36049
|
}
|
|
35526
36050
|
|
|
35527
|
-
// src/
|
|
35528
|
-
var
|
|
35529
|
-
|
|
35530
|
-
|
|
35531
|
-
|
|
35532
|
-
|
|
35533
|
-
1480: "0xD54523048AdD05b4d734aFaE7C68324Ebb7373eF"
|
|
35534
|
-
}
|
|
35535
|
-
},
|
|
35536
|
-
DataPortabilityServers: {
|
|
35537
|
-
addresses: {
|
|
35538
|
-
14800: "0x1483B1F634DBA75AeaE60da7f01A679aabd5ee2c",
|
|
35539
|
-
1480: "0x1483B1F634DBA75AeaE60da7f01A679aabd5ee2c"
|
|
35540
|
-
}
|
|
35541
|
-
},
|
|
35542
|
-
DataPortabilityGrantees: {
|
|
35543
|
-
addresses: {
|
|
35544
|
-
14800: "0x8325C0A0948483EdA023A1A2Fd895e62C5131234",
|
|
35545
|
-
1480: "0x8325C0A0948483EdA023A1A2Fd895e62C5131234"
|
|
35546
|
-
}
|
|
35547
|
-
},
|
|
35548
|
-
DataRegistry: {
|
|
35549
|
-
addresses: {
|
|
35550
|
-
14800: "0x8C8788f98385F6ba1adD4234e551ABba0f82Cb7C",
|
|
35551
|
-
1480: "0x8C8788f98385F6ba1adD4234e551ABba0f82Cb7C"
|
|
35552
|
-
}
|
|
35553
|
-
},
|
|
35554
|
-
TeePoolPhala: {
|
|
35555
|
-
addresses: {
|
|
35556
|
-
14800: "0xE8EC6BD73b23Ad40E6B9a6f4bD343FAc411bD99A",
|
|
35557
|
-
1480: "0xE8EC6BD73b23Ad40E6B9a6f4bD343FAc411bD99A"
|
|
35558
|
-
}
|
|
35559
|
-
},
|
|
35560
|
-
ComputeEngine: {
|
|
35561
|
-
addresses: {
|
|
35562
|
-
14800: "0xb2BFe33FA420c45F1Cf1287542ad81ae935447bd",
|
|
35563
|
-
1480: "0xb2BFe33FA420c45F1Cf1287542ad81ae935447bd"
|
|
35564
|
-
}
|
|
35565
|
-
},
|
|
35566
|
-
// Data Access Infrastructure
|
|
35567
|
-
DataRefinerRegistry: {
|
|
35568
|
-
addresses: {
|
|
35569
|
-
14800: "0x93c3EF89369fDcf08Be159D9DeF0F18AB6Be008c",
|
|
35570
|
-
1480: "0x93c3EF89369fDcf08Be159D9DeF0F18AB6Be008c"
|
|
35571
|
-
}
|
|
35572
|
-
},
|
|
35573
|
-
QueryEngine: {
|
|
35574
|
-
addresses: {
|
|
35575
|
-
14800: "0xd25Eb66EA2452cf3238A2eC6C1FD1B7F5B320490",
|
|
35576
|
-
1480: "0xd25Eb66EA2452cf3238A2eC6C1FD1B7F5B320490"
|
|
35577
|
-
}
|
|
35578
|
-
},
|
|
35579
|
-
VanaTreasury: {
|
|
35580
|
-
addresses: {
|
|
35581
|
-
14800: "0x94a1E56e555ac48d092f490fB10CDFaB434915eD",
|
|
35582
|
-
1480: "0x94a1E56e555ac48d092f490fB10CDFaB434915eD"
|
|
35583
|
-
}
|
|
35584
|
-
},
|
|
35585
|
-
ComputeInstructionRegistry: {
|
|
35586
|
-
addresses: {
|
|
35587
|
-
14800: "0x5786B12b4c6Ba2bFAF0e77Ed30Bf6d32805563A5",
|
|
35588
|
-
1480: "0x5786B12b4c6Ba2bFAF0e77Ed30Bf6d32805563A5"
|
|
35589
|
-
}
|
|
35590
|
-
},
|
|
35591
|
-
// TEE Pool Variants
|
|
35592
|
-
TeePoolEphemeralStandard: {
|
|
35593
|
-
addresses: {
|
|
35594
|
-
14800: "0xe124bae846D5ec157f75Bd9e68ca87C4d2AB835A",
|
|
35595
|
-
1480: "0xe124bae846D5ec157f75Bd9e68ca87C4d2AB835A"
|
|
35596
|
-
}
|
|
35597
|
-
},
|
|
35598
|
-
TeePoolPersistentStandard: {
|
|
35599
|
-
addresses: {
|
|
35600
|
-
14800: "0xe8bB8d0629651Cf33e0845d743976Dc1f0971d76",
|
|
35601
|
-
1480: "0xe8bB8d0629651Cf33e0845d743976Dc1f0971d76"
|
|
35602
|
-
}
|
|
35603
|
-
},
|
|
35604
|
-
TeePoolPersistentGpu: {
|
|
35605
|
-
addresses: {
|
|
35606
|
-
14800: "0x1c346Cd74f8551f8fa13f3F4b6b8dAE22338E6a9",
|
|
35607
|
-
1480: "0x1c346Cd74f8551f8fa13f3F4b6b8dAE22338E6a9"
|
|
35608
|
-
}
|
|
35609
|
-
},
|
|
35610
|
-
TeePoolDedicatedStandard: {
|
|
35611
|
-
addresses: {
|
|
35612
|
-
14800: "0xf024b7ac5E8417416f53B41ecfa58C8e9396687d",
|
|
35613
|
-
1480: "0xf024b7ac5E8417416f53B41ecfa58C8e9396687d"
|
|
35614
|
-
}
|
|
35615
|
-
},
|
|
35616
|
-
TeePoolDedicatedGpu: {
|
|
35617
|
-
addresses: {
|
|
35618
|
-
14800: "0xB1686FA9620bBf851714d1cB47b8a4Bf4664644E",
|
|
35619
|
-
1480: "0xB1686FA9620bBf851714d1cB47b8a4Bf4664644E"
|
|
35620
|
-
}
|
|
35621
|
-
},
|
|
35622
|
-
// DLP Reward System
|
|
35623
|
-
VanaEpoch: {
|
|
35624
|
-
addresses: {
|
|
35625
|
-
14800: "0x2063cFF0609D59bCCc196E20Eb58A8696a6b15A0",
|
|
35626
|
-
1480: "0x2063cFF0609D59bCCc196E20Eb58A8696a6b15A0"
|
|
35627
|
-
}
|
|
35628
|
-
},
|
|
35629
|
-
DLPRegistry: {
|
|
35630
|
-
addresses: {
|
|
35631
|
-
14800: "0x4D59880a924526d1dD33260552Ff4328b1E18a43",
|
|
35632
|
-
1480: "0x4D59880a924526d1dD33260552Ff4328b1E18a43"
|
|
35633
|
-
}
|
|
35634
|
-
},
|
|
35635
|
-
DLPRegistryTreasury: {
|
|
35636
|
-
addresses: {
|
|
35637
|
-
14800: "0xb12ce1d27bEeFe39b6F0110b1AB77C21Aa0c9F9a",
|
|
35638
|
-
1480: "0xb12ce1d27bEeFe39b6F0110b1AB77C21Aa0c9F9a"
|
|
35639
|
-
}
|
|
35640
|
-
},
|
|
35641
|
-
DLPPerformance: {
|
|
35642
|
-
addresses: {
|
|
35643
|
-
14800: "0x847715C7DB37cF286611182Be0bD333cbfa29cc1",
|
|
35644
|
-
1480: "0x847715C7DB37cF286611182Be0bD333cbfa29cc1"
|
|
35645
|
-
}
|
|
35646
|
-
},
|
|
35647
|
-
DLPRewardDeployer: {
|
|
35648
|
-
addresses: {
|
|
35649
|
-
14800: "0xEFD0F9Ba9De70586b7c4189971cF754adC923B04",
|
|
35650
|
-
1480: "0xEFD0F9Ba9De70586b7c4189971cF754adC923B04"
|
|
35651
|
-
}
|
|
35652
|
-
},
|
|
35653
|
-
DLPRewardDeployerTreasury: {
|
|
35654
|
-
addresses: {
|
|
35655
|
-
14800: "0xb547ca8Fe4990fe330FeAeb1C2EBb42F925Af5b8",
|
|
35656
|
-
1480: "0xb547ca8Fe4990fe330FeAeb1C2EBb42F925Af5b8"
|
|
35657
|
-
}
|
|
35658
|
-
},
|
|
35659
|
-
DLPRewardSwap: {
|
|
35660
|
-
addresses: {
|
|
35661
|
-
14800: "0x7c6862C46830F0fc3bF3FF509EA1bD0EE7267fB0",
|
|
35662
|
-
1480: "0x7c6862C46830F0fc3bF3FF509EA1bD0EE7267fB0"
|
|
35663
|
-
}
|
|
35664
|
-
},
|
|
35665
|
-
SwapHelper: {
|
|
35666
|
-
addresses: {
|
|
35667
|
-
14800: "0x55D5e6F73326315bF2E091e97F04f0770e5C54e2",
|
|
35668
|
-
1480: "0x55D5e6F73326315bF2E091e97F04f0770e5C54e2"
|
|
35669
|
-
}
|
|
35670
|
-
},
|
|
35671
|
-
// VanaPool (Staking)
|
|
35672
|
-
VanaPoolStaking: {
|
|
35673
|
-
addresses: {
|
|
35674
|
-
14800: "0x641C18E2F286c86f96CE95C8ec1EB9fC0415Ca0e",
|
|
35675
|
-
1480: "0x641C18E2F286c86f96CE95C8ec1EB9fC0415Ca0e"
|
|
35676
|
-
}
|
|
35677
|
-
},
|
|
35678
|
-
VanaPoolEntity: {
|
|
35679
|
-
addresses: {
|
|
35680
|
-
14800: "0x44f20490A82e1f1F1cC25Dd3BA8647034eDdce30",
|
|
35681
|
-
1480: "0x44f20490A82e1f1F1cC25Dd3BA8647034eDdce30"
|
|
35682
|
-
}
|
|
35683
|
-
},
|
|
35684
|
-
VanaPoolTreasury: {
|
|
35685
|
-
addresses: {
|
|
35686
|
-
14800: "0x143BE72CF2541604A7691933CAccd6D9cC17c003",
|
|
35687
|
-
1480: "0x143BE72CF2541604A7691933CAccd6D9cC17c003"
|
|
35688
|
-
}
|
|
35689
|
-
},
|
|
35690
|
-
// DLP Deployment Contracts
|
|
35691
|
-
DAT: {
|
|
35692
|
-
addresses: {
|
|
35693
|
-
14800: "0xA706b93ccED89f13340673889e29F0a5cd84212d",
|
|
35694
|
-
1480: "0xA706b93ccED89f13340673889e29F0a5cd84212d"
|
|
35695
|
-
}
|
|
35696
|
-
},
|
|
35697
|
-
DATFactory: {
|
|
35698
|
-
addresses: {
|
|
35699
|
-
14800: "0x40f8bccF35a75ecef63BC3B1B3E06ffEB9220644",
|
|
35700
|
-
1480: "0x40f8bccF35a75ecef63BC3B1B3E06ffEB9220644"
|
|
35701
|
-
}
|
|
35702
|
-
},
|
|
35703
|
-
DATPausable: {
|
|
35704
|
-
addresses: {
|
|
35705
|
-
14800: "0xe69FE86f0B95cC2f8416Fe22815c85DC8887e76e",
|
|
35706
|
-
1480: "0xe69FE86f0B95cC2f8416Fe22815c85DC8887e76e"
|
|
35707
|
-
}
|
|
35708
|
-
},
|
|
35709
|
-
DATVotes: {
|
|
35710
|
-
addresses: {
|
|
35711
|
-
14800: "0xaE04c8A77E9B27869eb563720524A9aE0baf1831",
|
|
35712
|
-
1480: "0xaE04c8A77E9B27869eb563720524A9aE0baf1831"
|
|
35713
|
-
}
|
|
35714
|
-
},
|
|
35715
|
-
// Utility Contracts (no ABIs in SDK)
|
|
35716
|
-
Multicall3: {
|
|
35717
|
-
addresses: {
|
|
35718
|
-
14800: "0xD8d2dFca27E8797fd779F8547166A2d3B29d360E",
|
|
35719
|
-
1480: "0xD8d2dFca27E8797fd779F8547166A2d3B29d360E"
|
|
35720
|
-
}
|
|
35721
|
-
},
|
|
35722
|
-
Multisend: {
|
|
35723
|
-
addresses: {
|
|
35724
|
-
14800: "0x8807e8BCDFbaA8c2761760f3FBA37F6f7F2C5b2d",
|
|
35725
|
-
1480: "0x8807e8BCDFbaA8c2761760f3FBA37F6f7F2C5b2d"
|
|
35726
|
-
}
|
|
36051
|
+
// src/utils/transactionHandle.ts
|
|
36052
|
+
var TransactionHandle = class {
|
|
36053
|
+
constructor(context, hash, operation) {
|
|
36054
|
+
this.context = context;
|
|
36055
|
+
this.hash = hash;
|
|
36056
|
+
this.operation = operation;
|
|
35727
36057
|
}
|
|
35728
|
-
|
|
35729
|
-
|
|
35730
|
-
|
|
35731
|
-
|
|
35732
|
-
|
|
35733
|
-
|
|
35734
|
-
|
|
35735
|
-
|
|
35736
|
-
|
|
35737
|
-
|
|
35738
|
-
|
|
35739
|
-
|
|
35740
|
-
|
|
35741
|
-
|
|
35742
|
-
|
|
35743
|
-
|
|
35744
|
-
|
|
35745
|
-
|
|
35746
|
-
|
|
35747
|
-
|
|
35748
|
-
|
|
35749
|
-
|
|
35750
|
-
|
|
35751
|
-
|
|
35752
|
-
14800: "0xff14346dF2B8Fd0c95BF34f1c92e49417b508AD5",
|
|
35753
|
-
1480: "0xff14346dF2B8Fd0c95BF34f1c92e49417b508AD5"
|
|
35754
|
-
}
|
|
35755
|
-
},
|
|
35756
|
-
DLPRootMetrics: {
|
|
35757
|
-
addresses: {
|
|
35758
|
-
14800: "0xbb532917B6407c060Afd9Cb7d53527eCb91d6662",
|
|
35759
|
-
1480: "0xbb532917B6407c060Afd9Cb7d53527eCb91d6662"
|
|
36058
|
+
_receipt;
|
|
36059
|
+
_eventData;
|
|
36060
|
+
_receiptPromise;
|
|
36061
|
+
_eventPromise;
|
|
36062
|
+
/**
|
|
36063
|
+
* Waits for transaction confirmation and returns the receipt.
|
|
36064
|
+
* Results are memoized - multiple calls return the same promise.
|
|
36065
|
+
*
|
|
36066
|
+
* @param options Optional timeout configuration
|
|
36067
|
+
* @param options.timeout Timeout in milliseconds (default: 30000)
|
|
36068
|
+
* @returns Transaction receipt with gas usage, logs, and status
|
|
36069
|
+
*/
|
|
36070
|
+
async waitForReceipt(options) {
|
|
36071
|
+
if (this._receipt) {
|
|
36072
|
+
return this._receipt;
|
|
36073
|
+
}
|
|
36074
|
+
if (!this._receiptPromise) {
|
|
36075
|
+
this._receiptPromise = this.context.publicClient.waitForTransactionReceipt({
|
|
36076
|
+
hash: this.hash,
|
|
36077
|
+
timeout: options?.timeout ?? 3e4
|
|
36078
|
+
}).then((receipt) => {
|
|
36079
|
+
this._receipt = receipt;
|
|
36080
|
+
return receipt;
|
|
36081
|
+
});
|
|
35760
36082
|
}
|
|
35761
|
-
|
|
35762
|
-
|
|
35763
|
-
|
|
35764
|
-
|
|
35765
|
-
|
|
36083
|
+
return this._receiptPromise;
|
|
36084
|
+
}
|
|
36085
|
+
/**
|
|
36086
|
+
* Waits for transaction confirmation and parses emitted events.
|
|
36087
|
+
* Results are memoized - multiple calls return the same promise.
|
|
36088
|
+
*
|
|
36089
|
+
* @returns Parsed event data with transaction metadata
|
|
36090
|
+
* @throws {Error} If no operation was specified for event parsing
|
|
36091
|
+
*/
|
|
36092
|
+
async waitForEvents() {
|
|
36093
|
+
if (this._eventData) {
|
|
36094
|
+
return this._eventData;
|
|
35766
36095
|
}
|
|
35767
|
-
|
|
35768
|
-
|
|
35769
|
-
|
|
35770
|
-
|
|
35771
|
-
|
|
36096
|
+
if (!this._eventPromise) {
|
|
36097
|
+
if (!this.operation) {
|
|
36098
|
+
throw new Error(
|
|
36099
|
+
"Cannot parse events: no operation specified. Use waitForReceipt() instead or ensure the operation is configured."
|
|
36100
|
+
);
|
|
36101
|
+
}
|
|
36102
|
+
this._eventPromise = parseTransactionResult(
|
|
36103
|
+
this.context,
|
|
36104
|
+
this.hash,
|
|
36105
|
+
this.operation
|
|
36106
|
+
).then((eventData) => {
|
|
36107
|
+
this._eventData = eventData;
|
|
36108
|
+
return eventData;
|
|
36109
|
+
});
|
|
35772
36110
|
}
|
|
36111
|
+
return this._eventPromise;
|
|
35773
36112
|
}
|
|
35774
|
-
|
|
35775
|
-
|
|
35776
|
-
|
|
35777
|
-
|
|
35778
|
-
|
|
35779
|
-
|
|
35780
|
-
|
|
35781
|
-
|
|
35782
|
-
|
|
35783
|
-
|
|
35784
|
-
|
|
35785
|
-
|
|
35786
|
-
|
|
35787
|
-
},
|
|
35788
|
-
1480: {
|
|
35789
|
-
Multicall3: CONTRACTS.Multicall3.addresses[1480],
|
|
35790
|
-
Multisend: CONTRACTS.Multisend.addresses[1480]
|
|
36113
|
+
/**
|
|
36114
|
+
* Enables string coercion for backwards compatibility.
|
|
36115
|
+
* Allows TransactionHandle to be used anywhere a Hash is expected.
|
|
36116
|
+
*
|
|
36117
|
+
* @example
|
|
36118
|
+
* ```typescript
|
|
36119
|
+
* const hash: Hash = tx; // Works via toString()
|
|
36120
|
+
* console.log(`Transaction: ${tx}`); // Prints hash
|
|
36121
|
+
* ```
|
|
36122
|
+
* @returns The transaction hash as a string
|
|
36123
|
+
*/
|
|
36124
|
+
toString() {
|
|
36125
|
+
return this.hash;
|
|
35791
36126
|
}
|
|
35792
|
-
|
|
35793
|
-
|
|
35794
|
-
|
|
35795
|
-
|
|
35796
|
-
|
|
35797
|
-
|
|
35798
|
-
|
|
35799
|
-
|
|
35800
|
-
}
|
|
35801
|
-
|
|
35802
|
-
|
|
35803
|
-
|
|
35804
|
-
|
|
35805
|
-
|
|
35806
|
-
|
|
36127
|
+
/**
|
|
36128
|
+
* JSON serialization support.
|
|
36129
|
+
* Returns the hash when serialized to JSON.
|
|
36130
|
+
*
|
|
36131
|
+
* @returns The transaction hash for JSON serialization
|
|
36132
|
+
*/
|
|
36133
|
+
toJSON() {
|
|
36134
|
+
return this.hash;
|
|
36135
|
+
}
|
|
36136
|
+
/**
|
|
36137
|
+
* Custom inspect for Node.js console.log
|
|
36138
|
+
*
|
|
36139
|
+
* @returns Formatted string representation for debugging
|
|
36140
|
+
*/
|
|
36141
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
36142
|
+
return `TransactionHandle { hash: '${this.hash}', operation: '${this.operation ?? "none"}' }`;
|
|
35807
36143
|
}
|
|
35808
|
-
return contractAddress;
|
|
35809
36144
|
};
|
|
35810
36145
|
|
|
35811
36146
|
// src/utils/grantFiles.ts
|
|
@@ -36437,31 +36772,32 @@ var PermissionsController = class {
|
|
|
36437
36772
|
* ```
|
|
36438
36773
|
*/
|
|
36439
36774
|
async grant(params) {
|
|
36440
|
-
const
|
|
36441
|
-
return
|
|
36775
|
+
const txHandle = await this.submitPermissionGrant(params);
|
|
36776
|
+
return await txHandle.waitForEvents();
|
|
36442
36777
|
}
|
|
36443
36778
|
/**
|
|
36444
|
-
* Submits a permission grant transaction and returns
|
|
36779
|
+
* Submits a permission grant transaction and returns a handle for flexible result access.
|
|
36445
36780
|
*
|
|
36446
|
-
*
|
|
36447
|
-
*
|
|
36448
|
-
*
|
|
36781
|
+
* @remarks
|
|
36782
|
+
* This lower-level method provides maximum control over transaction timing.
|
|
36783
|
+
* Returns a TransactionHandle that allows immediate hash access or optional event parsing.
|
|
36784
|
+
* Use this when handling multiple transactions or when you need granular control.
|
|
36449
36785
|
*
|
|
36450
36786
|
* @param params - The permission grant configuration object
|
|
36451
|
-
* @returns Promise
|
|
36787
|
+
* @returns Promise resolving to TransactionHandle with hash and event parsing capabilities
|
|
36452
36788
|
* @throws {RelayerError} When gasless transaction submission fails
|
|
36453
36789
|
* @throws {SignatureError} When user rejects the signature request
|
|
36454
36790
|
* @throws {SerializationError} When grant data cannot be serialized
|
|
36455
36791
|
* @throws {BlockchainError} When permission grant preparation fails
|
|
36456
36792
|
* @example
|
|
36457
36793
|
* ```typescript
|
|
36458
|
-
* // Submit transaction and
|
|
36459
|
-
* const
|
|
36460
|
-
* console.log(`Transaction submitted: ${
|
|
36794
|
+
* // Submit transaction and get immediate hash access
|
|
36795
|
+
* const tx = await vana.permissions.submitPermissionGrant(params);
|
|
36796
|
+
* console.log(`Transaction submitted: ${tx.hash}`);
|
|
36461
36797
|
*
|
|
36462
|
-
* //
|
|
36463
|
-
* const
|
|
36464
|
-
* console.log(`Permission ID: ${
|
|
36798
|
+
* // Optionally wait for and parse events
|
|
36799
|
+
* const eventData = await tx.waitForEvents();
|
|
36800
|
+
* console.log(`Permission ID: ${eventData.permissionId}`);
|
|
36465
36801
|
* ```
|
|
36466
36802
|
*/
|
|
36467
36803
|
async submitPermissionGrant(params) {
|
|
@@ -36519,12 +36855,18 @@ var PermissionsController = class {
|
|
|
36519
36855
|
}
|
|
36520
36856
|
}
|
|
36521
36857
|
/**
|
|
36522
|
-
*
|
|
36523
|
-
*
|
|
36858
|
+
* Completes the grant process after user confirmation.
|
|
36859
|
+
*
|
|
36860
|
+
* @remarks
|
|
36861
|
+
* This internal method is called by the confirm() function returned from prepareGrant().
|
|
36862
|
+
* It handles IPFS upload, signature creation, and transaction submission.
|
|
36524
36863
|
*
|
|
36525
36864
|
* @param params - The permission grant parameters containing user and operation details
|
|
36526
36865
|
* @param grantFile - The prepared grant file with permissions and metadata
|
|
36527
|
-
* @returns Promise resolving to
|
|
36866
|
+
* @returns Promise resolving to TransactionHandle for flexible result access
|
|
36867
|
+
* @throws {BlockchainError} When permission grant confirmation fails
|
|
36868
|
+
* @throws {NetworkError} When IPFS upload fails
|
|
36869
|
+
* @throws {SignatureError} When user rejects the signature
|
|
36528
36870
|
*/
|
|
36529
36871
|
async confirmGrantInternal(params, grantFile) {
|
|
36530
36872
|
try {
|
|
@@ -36713,14 +37055,20 @@ var PermissionsController = class {
|
|
|
36713
37055
|
2
|
|
36714
37056
|
)
|
|
36715
37057
|
);
|
|
37058
|
+
let hash;
|
|
36716
37059
|
if (this.context.relayerCallbacks?.submitPermissionGrant) {
|
|
36717
|
-
|
|
37060
|
+
hash = await this.context.relayerCallbacks.submitPermissionGrant(
|
|
36718
37061
|
typedData,
|
|
36719
37062
|
signature
|
|
36720
37063
|
);
|
|
36721
37064
|
} else {
|
|
36722
|
-
|
|
37065
|
+
hash = await this.submitDirectTransaction(typedData, signature);
|
|
36723
37066
|
}
|
|
37067
|
+
return new TransactionHandle(
|
|
37068
|
+
this.context,
|
|
37069
|
+
hash,
|
|
37070
|
+
"grant"
|
|
37071
|
+
);
|
|
36724
37072
|
} catch (error) {
|
|
36725
37073
|
if (error instanceof RelayerError || error instanceof NetworkError || error instanceof UserRejectedRequestError || error instanceof SignatureError || error instanceof NonceError) {
|
|
36726
37074
|
throw error;
|
|
@@ -36733,11 +37081,24 @@ var PermissionsController = class {
|
|
|
36733
37081
|
}
|
|
36734
37082
|
/**
|
|
36735
37083
|
* Submits an already-signed trust server transaction to the blockchain.
|
|
37084
|
+
*
|
|
37085
|
+
* @remarks
|
|
36736
37086
|
* This method extracts the trust server input from typed data and submits it directly.
|
|
37087
|
+
* Used internally by trust server methods after signature collection.
|
|
36737
37088
|
*
|
|
36738
37089
|
* @param typedData - The EIP-712 typed data for TrustServer
|
|
36739
|
-
* @param signature - The user's signature
|
|
36740
|
-
* @returns Promise resolving to
|
|
37090
|
+
* @param signature - The user's signature obtained via `signTypedData()`
|
|
37091
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
37092
|
+
* @throws {BlockchainError} When contract submission fails
|
|
37093
|
+
* @throws {NetworkError} When blockchain communication fails
|
|
37094
|
+
* @example
|
|
37095
|
+
* ```typescript
|
|
37096
|
+
* const txHandle = await vana.permissions.submitSignedTrustServer(
|
|
37097
|
+
* typedData,
|
|
37098
|
+
* "0x1234..."
|
|
37099
|
+
* );
|
|
37100
|
+
* const result = await txHandle.waitForEvents();
|
|
37101
|
+
* ```
|
|
36741
37102
|
*/
|
|
36742
37103
|
async submitSignedTrustServer(typedData, signature) {
|
|
36743
37104
|
try {
|
|
@@ -36745,10 +37106,15 @@ var PermissionsController = class {
|
|
|
36745
37106
|
nonce: BigInt(typedData.message.nonce),
|
|
36746
37107
|
serverId: typedData.message.serverId
|
|
36747
37108
|
};
|
|
36748
|
-
|
|
37109
|
+
const hash = await this.submitTrustServerTransaction(
|
|
36749
37110
|
trustServerInput,
|
|
36750
37111
|
signature
|
|
36751
37112
|
);
|
|
37113
|
+
return new TransactionHandle(
|
|
37114
|
+
this.context,
|
|
37115
|
+
hash,
|
|
37116
|
+
"trustServer"
|
|
37117
|
+
);
|
|
36752
37118
|
} catch (error) {
|
|
36753
37119
|
if (error instanceof RelayerError || error instanceof NetworkError || error instanceof UserRejectedRequestError || error instanceof SignatureError || error instanceof NonceError) {
|
|
36754
37120
|
throw error;
|
|
@@ -36775,11 +37141,24 @@ var PermissionsController = class {
|
|
|
36775
37141
|
}
|
|
36776
37142
|
/**
|
|
36777
37143
|
* Submits an already-signed add and trust server transaction to the blockchain.
|
|
37144
|
+
*
|
|
37145
|
+
* @remarks
|
|
36778
37146
|
* This method extracts the add and trust server input from typed data and submits it directly.
|
|
37147
|
+
* Combines server registration and trust operations in a single transaction.
|
|
36779
37148
|
*
|
|
36780
37149
|
* @param typedData - The EIP-712 typed data for AddAndTrustServer
|
|
36781
|
-
* @param signature - The user's signature
|
|
36782
|
-
* @returns Promise resolving to
|
|
37150
|
+
* @param signature - The user's signature obtained via `signTypedData()`
|
|
37151
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
37152
|
+
* @throws {BlockchainError} When contract submission fails
|
|
37153
|
+
* @throws {NetworkError} When blockchain communication fails
|
|
37154
|
+
* @example
|
|
37155
|
+
* ```typescript
|
|
37156
|
+
* const txHandle = await vana.permissions.submitSignedAddAndTrustServer(
|
|
37157
|
+
* typedData,
|
|
37158
|
+
* "0x1234..."
|
|
37159
|
+
* );
|
|
37160
|
+
* const result = await txHandle.waitForEvents();
|
|
37161
|
+
* ```
|
|
36783
37162
|
*/
|
|
36784
37163
|
async submitSignedAddAndTrustServer(typedData, signature) {
|
|
36785
37164
|
try {
|
|
@@ -36789,10 +37168,15 @@ var PermissionsController = class {
|
|
|
36789
37168
|
serverUrl: typedData.message.serverUrl,
|
|
36790
37169
|
publicKey: typedData.message.publicKey
|
|
36791
37170
|
};
|
|
36792
|
-
|
|
37171
|
+
const hash = await this.submitAddAndTrustServerTransaction(
|
|
36793
37172
|
addAndTrustServerInput,
|
|
36794
37173
|
signature
|
|
36795
37174
|
);
|
|
37175
|
+
return new TransactionHandle(
|
|
37176
|
+
this.context,
|
|
37177
|
+
hash,
|
|
37178
|
+
"addAndTrustServer"
|
|
37179
|
+
);
|
|
36796
37180
|
} catch (error) {
|
|
36797
37181
|
if (error instanceof RelayerError || error instanceof NetworkError || error instanceof UserRejectedRequestError || error instanceof SignatureError || error instanceof NonceError) {
|
|
36798
37182
|
throw error;
|
|
@@ -36805,22 +37189,41 @@ var PermissionsController = class {
|
|
|
36805
37189
|
}
|
|
36806
37190
|
/**
|
|
36807
37191
|
* Submits an already-signed permission revoke transaction to the blockchain.
|
|
37192
|
+
*
|
|
37193
|
+
* @remarks
|
|
36808
37194
|
* This method handles the revocation of previously granted permissions.
|
|
37195
|
+
* Used internally by revocation methods after signature collection.
|
|
36809
37196
|
*
|
|
36810
37197
|
* @param typedData - The EIP-712 typed data for PermissionRevoke
|
|
36811
|
-
* @param signature - The user's signature
|
|
36812
|
-
* @returns Promise resolving to
|
|
37198
|
+
* @param signature - The user's signature obtained via `signTypedData()`
|
|
37199
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
37200
|
+
* @throws {BlockchainError} When contract submission fails
|
|
37201
|
+
* @throws {NetworkError} When blockchain communication fails
|
|
37202
|
+
* @example
|
|
37203
|
+
* ```typescript
|
|
37204
|
+
* const txHandle = await vana.permissions.submitSignedRevoke(
|
|
37205
|
+
* typedData,
|
|
37206
|
+
* "0x1234..."
|
|
37207
|
+
* );
|
|
37208
|
+
* const result = await txHandle.waitForEvents();
|
|
37209
|
+
* ```
|
|
36813
37210
|
*/
|
|
36814
37211
|
async submitSignedRevoke(typedData, signature) {
|
|
36815
37212
|
try {
|
|
37213
|
+
let hash;
|
|
36816
37214
|
if (this.context.relayerCallbacks?.submitPermissionRevoke) {
|
|
36817
|
-
|
|
37215
|
+
hash = await this.context.relayerCallbacks.submitPermissionRevoke(
|
|
36818
37216
|
typedData,
|
|
36819
37217
|
signature
|
|
36820
37218
|
);
|
|
36821
37219
|
} else {
|
|
36822
|
-
|
|
37220
|
+
hash = await this.submitDirectRevokeTransaction(typedData, signature);
|
|
36823
37221
|
}
|
|
37222
|
+
return new TransactionHandle(
|
|
37223
|
+
this.context,
|
|
37224
|
+
hash,
|
|
37225
|
+
"revoke"
|
|
37226
|
+
);
|
|
36824
37227
|
} catch (error) {
|
|
36825
37228
|
if (error instanceof RelayerError || error instanceof NetworkError || error instanceof UserRejectedRequestError || error instanceof SignatureError || error instanceof NonceError) {
|
|
36826
37229
|
throw error;
|
|
@@ -36833,22 +37236,41 @@ var PermissionsController = class {
|
|
|
36833
37236
|
}
|
|
36834
37237
|
/**
|
|
36835
37238
|
* Submits an already-signed untrust server transaction to the blockchain.
|
|
37239
|
+
*
|
|
37240
|
+
* @remarks
|
|
36836
37241
|
* This method handles the removal of trusted servers.
|
|
37242
|
+
* Used internally by untrust server methods after signature collection.
|
|
36837
37243
|
*
|
|
36838
37244
|
* @param typedData - The EIP-712 typed data for UntrustServer
|
|
36839
|
-
* @param signature - The user's signature
|
|
36840
|
-
* @returns Promise resolving to
|
|
37245
|
+
* @param signature - The user's signature obtained via `signTypedData()`
|
|
37246
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
37247
|
+
* @throws {BlockchainError} When contract submission fails
|
|
37248
|
+
* @throws {NetworkError} When blockchain communication fails
|
|
37249
|
+
* @example
|
|
37250
|
+
* ```typescript
|
|
37251
|
+
* const txHandle = await vana.permissions.submitSignedUntrustServer(
|
|
37252
|
+
* typedData,
|
|
37253
|
+
* "0x1234..."
|
|
37254
|
+
* );
|
|
37255
|
+
* const result = await txHandle.waitForEvents();
|
|
37256
|
+
* ```
|
|
36841
37257
|
*/
|
|
36842
37258
|
async submitSignedUntrustServer(typedData, signature) {
|
|
36843
37259
|
try {
|
|
37260
|
+
let hash;
|
|
36844
37261
|
if (this.context.relayerCallbacks?.submitUntrustServer) {
|
|
36845
|
-
|
|
37262
|
+
hash = await this.context.relayerCallbacks.submitUntrustServer(
|
|
36846
37263
|
typedData,
|
|
36847
37264
|
signature
|
|
36848
37265
|
);
|
|
36849
37266
|
} else {
|
|
36850
|
-
|
|
37267
|
+
hash = await this.submitSignedUntrustTransaction(typedData, signature);
|
|
36851
37268
|
}
|
|
37269
|
+
return new TransactionHandle(
|
|
37270
|
+
this.context,
|
|
37271
|
+
hash,
|
|
37272
|
+
"untrustServer"
|
|
37273
|
+
);
|
|
36852
37274
|
} catch (error) {
|
|
36853
37275
|
if (error instanceof RelayerError || error instanceof NetworkError || error instanceof UserRejectedRequestError || error instanceof SignatureError || error instanceof NonceError) {
|
|
36854
37276
|
throw error;
|
|
@@ -36862,9 +37284,14 @@ var PermissionsController = class {
|
|
|
36862
37284
|
/**
|
|
36863
37285
|
* Submits a signed transaction directly to the blockchain.
|
|
36864
37286
|
*
|
|
37287
|
+
* @remarks
|
|
37288
|
+
* Internal method used when relayer callbacks are not available. Formats the signature
|
|
37289
|
+
* and submits the permission grant directly to the smart contract.
|
|
37290
|
+
*
|
|
36865
37291
|
* @param typedData - The typed data structure for the permission grant
|
|
36866
37292
|
* @param signature - The cryptographic signature authorizing the transaction
|
|
36867
37293
|
* @returns Promise resolving to the transaction hash
|
|
37294
|
+
* @throws {BlockchainError} When contract submission fails
|
|
36868
37295
|
*/
|
|
36869
37296
|
async submitDirectTransaction(typedData, signature) {
|
|
36870
37297
|
const chainId = await this.context.walletClient.getChainId();
|
|
@@ -36925,8 +37352,8 @@ var PermissionsController = class {
|
|
|
36925
37352
|
* ```
|
|
36926
37353
|
*/
|
|
36927
37354
|
async revoke(params) {
|
|
36928
|
-
const
|
|
36929
|
-
return
|
|
37355
|
+
const txHandle = await this.submitPermissionRevoke(params);
|
|
37356
|
+
return await txHandle.waitForEvents();
|
|
36930
37357
|
}
|
|
36931
37358
|
/**
|
|
36932
37359
|
* Submits a permission revocation transaction and returns the transaction hash immediately.
|
|
@@ -36968,7 +37395,11 @@ var PermissionsController = class {
|
|
|
36968
37395
|
account: this.context.walletClient.account || await this.getUserAddress(),
|
|
36969
37396
|
chain: this.context.walletClient.chain || null
|
|
36970
37397
|
});
|
|
36971
|
-
return
|
|
37398
|
+
return new TransactionHandle(
|
|
37399
|
+
this.context,
|
|
37400
|
+
txHash,
|
|
37401
|
+
"revoke"
|
|
37402
|
+
);
|
|
36972
37403
|
} catch (error) {
|
|
36973
37404
|
if (error instanceof Error) {
|
|
36974
37405
|
if (error instanceof RelayerError || error instanceof UserRejectedRequestError || error instanceof SerializationError || error instanceof SignatureError || error instanceof NetworkError || error instanceof NonceError) {
|
|
@@ -36983,15 +37414,29 @@ var PermissionsController = class {
|
|
|
36983
37414
|
}
|
|
36984
37415
|
}
|
|
36985
37416
|
/**
|
|
36986
|
-
* Revokes a permission with a signature
|
|
37417
|
+
* Revokes a permission with a signature for gasless transactions.
|
|
37418
|
+
*
|
|
37419
|
+
* @remarks
|
|
37420
|
+
* This method creates an EIP-712 signature for permission revocation and submits
|
|
37421
|
+
* it either through relayer callbacks or directly to the blockchain. Provides
|
|
37422
|
+
* gasless revocation when relayer is configured.
|
|
36987
37423
|
*
|
|
36988
37424
|
* @param params - Parameters for revoking the permission
|
|
36989
|
-
* @
|
|
37425
|
+
* @param params.permissionId - Permission identifier to revoke (accepts bigint, number, or string)
|
|
37426
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
36990
37427
|
* @throws {BlockchainError} When chain ID is not available
|
|
36991
37428
|
* @throws {NonceError} When retrieving user nonce fails
|
|
36992
37429
|
* @throws {SignatureError} When user rejects the signature request
|
|
36993
37430
|
* @throws {RelayerError} When gasless submission fails
|
|
36994
37431
|
* @throws {PermissionError} When revocation fails for any other reason
|
|
37432
|
+
* @example
|
|
37433
|
+
* ```typescript
|
|
37434
|
+
* const txHandle = await vana.permissions.submitRevokeWithSignature({
|
|
37435
|
+
* permissionId: 123n
|
|
37436
|
+
* });
|
|
37437
|
+
* const result = await txHandle.waitForEvents();
|
|
37438
|
+
* console.log(`Permission ${result.permissionId} revoked`);
|
|
37439
|
+
* ```
|
|
36995
37440
|
*/
|
|
36996
37441
|
async submitRevokeWithSignature(params) {
|
|
36997
37442
|
try {
|
|
@@ -37015,14 +37460,20 @@ var PermissionsController = class {
|
|
|
37015
37460
|
message: revokePermissionInput
|
|
37016
37461
|
};
|
|
37017
37462
|
const signature = await this.signTypedData(typedData);
|
|
37463
|
+
let hash;
|
|
37018
37464
|
if (this.context.relayerCallbacks?.submitPermissionRevoke) {
|
|
37019
|
-
|
|
37465
|
+
hash = await this.context.relayerCallbacks.submitPermissionRevoke(
|
|
37020
37466
|
typedData,
|
|
37021
37467
|
signature
|
|
37022
37468
|
);
|
|
37023
37469
|
} else {
|
|
37024
|
-
|
|
37470
|
+
hash = await this.submitDirectRevokeTransaction(typedData, signature);
|
|
37025
37471
|
}
|
|
37472
|
+
return new TransactionHandle(
|
|
37473
|
+
this.context,
|
|
37474
|
+
hash,
|
|
37475
|
+
"revoke"
|
|
37476
|
+
);
|
|
37026
37477
|
} catch (error) {
|
|
37027
37478
|
throw new PermissionError(
|
|
37028
37479
|
`Failed to revoke permission with signature: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
@@ -37054,6 +37505,18 @@ var PermissionsController = class {
|
|
|
37054
37505
|
* const serversNonce = await this.getServersUserNonce();
|
|
37055
37506
|
* ```
|
|
37056
37507
|
*/
|
|
37508
|
+
/**
|
|
37509
|
+
* @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
|
|
37510
|
+
*
|
|
37511
|
+
* Retrieves the user's current nonce from the DataPortabilityServers contract.
|
|
37512
|
+
*
|
|
37513
|
+
* @remarks
|
|
37514
|
+
* This method is deprecated in favor of more specific nonce methods that target
|
|
37515
|
+
* the appropriate contract for the operation being performed.
|
|
37516
|
+
*
|
|
37517
|
+
* @returns Promise resolving to the user's current nonce as a bigint
|
|
37518
|
+
* @throws {NonceError} When retrieving the nonce fails
|
|
37519
|
+
*/
|
|
37057
37520
|
async getUserNonce() {
|
|
37058
37521
|
try {
|
|
37059
37522
|
const userAddress = await this.getUserAddress();
|
|
@@ -37090,6 +37553,16 @@ var PermissionsController = class {
|
|
|
37090
37553
|
* console.log(`Current servers nonce: ${nonce}`);
|
|
37091
37554
|
* ```
|
|
37092
37555
|
*/
|
|
37556
|
+
/**
|
|
37557
|
+
* Retrieves the user's current nonce from the DataPortabilityServers contract.
|
|
37558
|
+
*
|
|
37559
|
+
* @remarks
|
|
37560
|
+
* Used for server-related operations (trust/untrust) to prevent replay attacks.
|
|
37561
|
+
* The nonce must be incremented with each server operation.
|
|
37562
|
+
*
|
|
37563
|
+
* @returns Promise resolving to the user's current nonce as a bigint
|
|
37564
|
+
* @throws {NonceError} When retrieving the nonce fails
|
|
37565
|
+
*/
|
|
37093
37566
|
async getServersUserNonce() {
|
|
37094
37567
|
try {
|
|
37095
37568
|
const userAddress = await this.getUserAddress();
|
|
@@ -37126,6 +37599,16 @@ var PermissionsController = class {
|
|
|
37126
37599
|
* console.log(`Current permissions nonce: ${nonce}`);
|
|
37127
37600
|
* ```
|
|
37128
37601
|
*/
|
|
37602
|
+
/**
|
|
37603
|
+
* Retrieves the user's current nonce from the DataPortabilityPermissions contract.
|
|
37604
|
+
*
|
|
37605
|
+
* @remarks
|
|
37606
|
+
* Used for permission-related operations (grant/revoke) to prevent replay attacks.
|
|
37607
|
+
* The nonce must be incremented with each permission operation.
|
|
37608
|
+
*
|
|
37609
|
+
* @returns Promise resolving to the user's current nonce as a bigint
|
|
37610
|
+
* @throws {NonceError} When retrieving the nonce fails
|
|
37611
|
+
*/
|
|
37129
37612
|
async getPermissionsUserNonce() {
|
|
37130
37613
|
try {
|
|
37131
37614
|
const userAddress = await this.getUserAddress();
|
|
@@ -37531,7 +38014,11 @@ var PermissionsController = class {
|
|
|
37531
38014
|
account: this.context.walletClient.account || await this.getUserAddress(),
|
|
37532
38015
|
chain: this.context.walletClient.chain || null
|
|
37533
38016
|
});
|
|
37534
|
-
return
|
|
38017
|
+
return new TransactionHandle(
|
|
38018
|
+
this.context,
|
|
38019
|
+
txHash,
|
|
38020
|
+
"addAndTrustServer"
|
|
38021
|
+
);
|
|
37535
38022
|
} catch (error) {
|
|
37536
38023
|
if (error instanceof Error && error.message.includes("rejected")) {
|
|
37537
38024
|
throw new UserRejectedRequestError();
|
|
@@ -37565,7 +38052,11 @@ var PermissionsController = class {
|
|
|
37565
38052
|
account: this.context.walletClient.account || await this.getUserAddress(),
|
|
37566
38053
|
chain: this.context.walletClient.chain || null
|
|
37567
38054
|
});
|
|
37568
|
-
return
|
|
38055
|
+
return new TransactionHandle(
|
|
38056
|
+
this.context,
|
|
38057
|
+
txHash,
|
|
38058
|
+
"trustServer"
|
|
38059
|
+
);
|
|
37569
38060
|
} catch (error) {
|
|
37570
38061
|
if (error instanceof Error && error.message.includes("rejected")) {
|
|
37571
38062
|
throw new UserRejectedRequestError();
|
|
@@ -37580,7 +38071,7 @@ var PermissionsController = class {
|
|
|
37580
38071
|
* Adds and trusts a server using a signature (gasless transaction).
|
|
37581
38072
|
*
|
|
37582
38073
|
* @param params - Parameters for adding and trusting the server
|
|
37583
|
-
* @returns Promise resolving to
|
|
38074
|
+
* @returns Promise resolving to TransactionHandle with ServerTrustResult event data
|
|
37584
38075
|
*/
|
|
37585
38076
|
async submitAddAndTrustServerWithSignature(params) {
|
|
37586
38077
|
try {
|
|
@@ -37604,17 +38095,23 @@ var PermissionsController = class {
|
|
|
37604
38095
|
});
|
|
37605
38096
|
const signature = await this.signTypedData(typedData);
|
|
37606
38097
|
console.debug("\u{1F50D} Generated signature:", signature);
|
|
38098
|
+
let hash;
|
|
37607
38099
|
if (this.context.relayerCallbacks?.submitAddAndTrustServer) {
|
|
37608
|
-
|
|
38100
|
+
hash = await this.context.relayerCallbacks.submitAddAndTrustServer(
|
|
37609
38101
|
typedData,
|
|
37610
38102
|
signature
|
|
37611
38103
|
);
|
|
37612
38104
|
} else {
|
|
37613
|
-
|
|
38105
|
+
hash = await this.submitAddAndTrustServerTransaction(
|
|
37614
38106
|
addAndTrustServerInput,
|
|
37615
38107
|
signature
|
|
37616
38108
|
);
|
|
37617
38109
|
}
|
|
38110
|
+
return new TransactionHandle(
|
|
38111
|
+
this.context,
|
|
38112
|
+
hash,
|
|
38113
|
+
"addAndTrustServer"
|
|
38114
|
+
);
|
|
37618
38115
|
} catch (error) {
|
|
37619
38116
|
if (error instanceof Error) {
|
|
37620
38117
|
if (error instanceof RelayerError || error instanceof UserRejectedRequestError || error instanceof SerializationError || error instanceof SignatureError || error instanceof NetworkError || error instanceof NonceError) {
|
|
@@ -37652,17 +38149,23 @@ var PermissionsController = class {
|
|
|
37652
38149
|
};
|
|
37653
38150
|
const typedData = await this.composeTrustServerMessage(trustServerInput);
|
|
37654
38151
|
const signature = await this.signTypedData(typedData);
|
|
38152
|
+
let hash;
|
|
37655
38153
|
if (this.context.relayerCallbacks?.submitTrustServer) {
|
|
37656
|
-
|
|
38154
|
+
hash = await this.context.relayerCallbacks.submitTrustServer(
|
|
37657
38155
|
typedData,
|
|
37658
38156
|
signature
|
|
37659
38157
|
);
|
|
37660
38158
|
} else {
|
|
37661
|
-
|
|
38159
|
+
hash = await this.submitTrustServerTransaction(
|
|
37662
38160
|
trustServerInput,
|
|
37663
38161
|
signature
|
|
37664
38162
|
);
|
|
37665
38163
|
}
|
|
38164
|
+
return new TransactionHandle(
|
|
38165
|
+
this.context,
|
|
38166
|
+
hash,
|
|
38167
|
+
"trustServer"
|
|
38168
|
+
);
|
|
37666
38169
|
} catch (error) {
|
|
37667
38170
|
if (error instanceof Error) {
|
|
37668
38171
|
if (error instanceof RelayerError || error instanceof UserRejectedRequestError || error instanceof SerializationError || error instanceof SignatureError || error instanceof NetworkError || error instanceof NonceError) {
|
|
@@ -37682,6 +38185,17 @@ var PermissionsController = class {
|
|
|
37682
38185
|
* @param params - The untrust server parameters containing server details
|
|
37683
38186
|
* @returns Promise resolving to the transaction hash
|
|
37684
38187
|
*/
|
|
38188
|
+
/**
|
|
38189
|
+
* Submits an untrust server transaction directly to the blockchain.
|
|
38190
|
+
*
|
|
38191
|
+
* @remarks
|
|
38192
|
+
* Internal method used for direct blockchain submission of untrust server operations
|
|
38193
|
+
* when relayer callbacks are not available.
|
|
38194
|
+
*
|
|
38195
|
+
* @param params - The untrust server parameters
|
|
38196
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
38197
|
+
* @throws {BlockchainError} When contract submission fails
|
|
38198
|
+
*/
|
|
37685
38199
|
async submitDirectUntrustTransaction(params) {
|
|
37686
38200
|
try {
|
|
37687
38201
|
const chainId = await this.context.walletClient.getChainId();
|
|
@@ -37698,7 +38212,11 @@ var PermissionsController = class {
|
|
|
37698
38212
|
account: this.context.walletClient.account || await this.getUserAddress(),
|
|
37699
38213
|
chain: this.context.walletClient.chain || null
|
|
37700
38214
|
});
|
|
37701
|
-
return
|
|
38215
|
+
return new TransactionHandle(
|
|
38216
|
+
this.context,
|
|
38217
|
+
txHash,
|
|
38218
|
+
"untrustServer"
|
|
38219
|
+
);
|
|
37702
38220
|
} catch (error) {
|
|
37703
38221
|
if (error instanceof Error && error.message.includes("rejected")) {
|
|
37704
38222
|
throw new UserRejectedRequestError();
|
|
@@ -37766,14 +38284,20 @@ var PermissionsController = class {
|
|
|
37766
38284
|
};
|
|
37767
38285
|
const typedData = await this.composeUntrustServerMessage(untrustServerInput);
|
|
37768
38286
|
const signature = await this.signTypedData(typedData);
|
|
38287
|
+
let hash;
|
|
37769
38288
|
if (this.context.relayerCallbacks?.submitUntrustServer) {
|
|
37770
|
-
|
|
38289
|
+
hash = await this.context.relayerCallbacks.submitUntrustServer(
|
|
37771
38290
|
typedData,
|
|
37772
38291
|
signature
|
|
37773
38292
|
);
|
|
37774
38293
|
} else {
|
|
37775
|
-
|
|
38294
|
+
hash = await this.submitSignedUntrustTransaction(typedData, signature);
|
|
37776
38295
|
}
|
|
38296
|
+
return new TransactionHandle(
|
|
38297
|
+
this.context,
|
|
38298
|
+
hash,
|
|
38299
|
+
"untrustServer"
|
|
38300
|
+
);
|
|
37777
38301
|
} catch (error) {
|
|
37778
38302
|
if (error instanceof Error) {
|
|
37779
38303
|
if (error instanceof RelayerError || error instanceof UserRejectedRequestError || error instanceof SerializationError || error instanceof SignatureError || error instanceof NetworkError || error instanceof NonceError) {
|
|
@@ -37897,18 +38421,19 @@ var PermissionsController = class {
|
|
|
37897
38421
|
};
|
|
37898
38422
|
}
|
|
37899
38423
|
const endIndex = Math.min(offset + limit, total);
|
|
37900
|
-
const
|
|
38424
|
+
const serverIdCalls = [];
|
|
37901
38425
|
for (let i = offset; i < endIndex; i++) {
|
|
37902
|
-
|
|
38426
|
+
serverIdCalls.push({
|
|
37903
38427
|
address: DataPortabilityServersAddress,
|
|
37904
38428
|
abi: DataPortabilityServersAbi,
|
|
37905
38429
|
functionName: "userServerIdsAt",
|
|
37906
38430
|
args: [user, BigInt(i)]
|
|
37907
38431
|
});
|
|
37908
|
-
serverPromises.push(promise);
|
|
37909
38432
|
}
|
|
37910
|
-
const
|
|
37911
|
-
|
|
38433
|
+
const serverIdResults = await gasAwareMulticall(this.context.publicClient, {
|
|
38434
|
+
contracts: serverIdCalls
|
|
38435
|
+
});
|
|
38436
|
+
const servers = serverIdResults.map((result) => Number(result)).filter((id) => id > 0);
|
|
37912
38437
|
return {
|
|
37913
38438
|
servers,
|
|
37914
38439
|
total,
|
|
@@ -37933,35 +38458,51 @@ var PermissionsController = class {
|
|
|
37933
38458
|
async getTrustedServersWithInfo(options = {}) {
|
|
37934
38459
|
try {
|
|
37935
38460
|
const paginatedResult = await this.getTrustedServersPaginated(options);
|
|
37936
|
-
const
|
|
37937
|
-
|
|
37938
|
-
|
|
37939
|
-
|
|
37940
|
-
|
|
37941
|
-
|
|
37942
|
-
|
|
37943
|
-
|
|
37944
|
-
|
|
37945
|
-
|
|
37946
|
-
|
|
37947
|
-
|
|
37948
|
-
|
|
37949
|
-
// 0 means still active
|
|
37950
|
-
};
|
|
37951
|
-
} catch {
|
|
37952
|
-
return {
|
|
37953
|
-
id: BigInt(serverId),
|
|
37954
|
-
owner: "0x0000000000000000000000000000000000000000",
|
|
37955
|
-
serverAddress: "0x0000000000000000000000000000000000000000",
|
|
37956
|
-
publicKey: "",
|
|
37957
|
-
url: "",
|
|
37958
|
-
startBlock: 0n,
|
|
37959
|
-
endBlock: 0n
|
|
37960
|
-
};
|
|
37961
|
-
}
|
|
37962
|
-
}
|
|
38461
|
+
const chainId = await this.context.publicClient.getChainId();
|
|
38462
|
+
const DataPortabilityServersAddress = getContractAddress(
|
|
38463
|
+
chainId,
|
|
38464
|
+
"DataPortabilityServers"
|
|
38465
|
+
);
|
|
38466
|
+
const DataPortabilityServersAbi = getAbi("DataPortabilityServers");
|
|
38467
|
+
const serverInfoCalls = paginatedResult.servers.map(
|
|
38468
|
+
(serverId) => ({
|
|
38469
|
+
address: DataPortabilityServersAddress,
|
|
38470
|
+
abi: DataPortabilityServersAbi,
|
|
38471
|
+
functionName: "servers",
|
|
38472
|
+
args: [BigInt(serverId)]
|
|
38473
|
+
})
|
|
37963
38474
|
);
|
|
37964
|
-
|
|
38475
|
+
const serverInfoResults = await gasAwareMulticall(this.context.publicClient, {
|
|
38476
|
+
contracts: serverInfoCalls,
|
|
38477
|
+
allowFailure: true
|
|
38478
|
+
});
|
|
38479
|
+
return serverInfoResults.map((result, index) => {
|
|
38480
|
+
const serverId = paginatedResult.servers[index];
|
|
38481
|
+
if (result.status === "success" && result.result) {
|
|
38482
|
+
const serverInfo = result.result;
|
|
38483
|
+
return {
|
|
38484
|
+
id: BigInt(serverId),
|
|
38485
|
+
owner: serverInfo.owner,
|
|
38486
|
+
serverAddress: serverInfo.serverAddress,
|
|
38487
|
+
publicKey: serverInfo.publicKey,
|
|
38488
|
+
url: serverInfo.url,
|
|
38489
|
+
startBlock: 0n,
|
|
38490
|
+
// We don't have this info from the old method structure
|
|
38491
|
+
endBlock: 0n
|
|
38492
|
+
// 0 means still active
|
|
38493
|
+
};
|
|
38494
|
+
} else {
|
|
38495
|
+
return {
|
|
38496
|
+
id: BigInt(serverId),
|
|
38497
|
+
owner: "0x0000000000000000000000000000000000000000",
|
|
38498
|
+
serverAddress: "0x0000000000000000000000000000000000000000",
|
|
38499
|
+
publicKey: "",
|
|
38500
|
+
url: "",
|
|
38501
|
+
startBlock: 0n,
|
|
38502
|
+
endBlock: 0n
|
|
38503
|
+
};
|
|
38504
|
+
}
|
|
38505
|
+
});
|
|
37965
38506
|
} catch (error) {
|
|
37966
38507
|
throw new BlockchainError(
|
|
37967
38508
|
`Failed to get trusted servers with info: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
@@ -37972,9 +38513,28 @@ var PermissionsController = class {
|
|
|
37972
38513
|
/**
|
|
37973
38514
|
* Gets server information for multiple servers efficiently.
|
|
37974
38515
|
*
|
|
37975
|
-
* @
|
|
37976
|
-
*
|
|
38516
|
+
* @remarks
|
|
38517
|
+
* This method uses multicall to fetch information for multiple servers in a single
|
|
38518
|
+
* blockchain call, improving performance when querying many servers. Failed lookups
|
|
38519
|
+
* are returned separately for error handling.
|
|
38520
|
+
*
|
|
38521
|
+
* @param serverIds - Array of numeric server IDs to query
|
|
38522
|
+
* @returns Promise resolving to batch result containing successful lookups and failed IDs
|
|
37977
38523
|
* @throws {BlockchainError} When reading from contract fails or chain is unavailable
|
|
38524
|
+
* @example
|
|
38525
|
+
* ```typescript
|
|
38526
|
+
* const result = await vana.permissions.getServerInfoBatch([1, 2, 3, 999]);
|
|
38527
|
+
*
|
|
38528
|
+
* // Process successful lookups
|
|
38529
|
+
* result.servers.forEach((server, id) => {
|
|
38530
|
+
* console.log(`Server ${id}: ${server.url}`);
|
|
38531
|
+
* });
|
|
38532
|
+
*
|
|
38533
|
+
* // Handle failed lookups
|
|
38534
|
+
* if (result.failed.length > 0) {
|
|
38535
|
+
* console.log(`Failed to fetch: ${result.failed.join(', ')}`);
|
|
38536
|
+
* }
|
|
38537
|
+
* ```
|
|
37978
38538
|
*/
|
|
37979
38539
|
async getServerInfoBatch(serverIds) {
|
|
37980
38540
|
if (serverIds.length === 0) {
|
|
@@ -37990,14 +38550,22 @@ var PermissionsController = class {
|
|
|
37990
38550
|
"DataPortabilityServers"
|
|
37991
38551
|
);
|
|
37992
38552
|
const DataPortabilityServersAbi = getAbi("DataPortabilityServers");
|
|
37993
|
-
const
|
|
37994
|
-
|
|
37995
|
-
|
|
37996
|
-
|
|
37997
|
-
|
|
37998
|
-
|
|
37999
|
-
|
|
38000
|
-
|
|
38553
|
+
const serverInfoCalls = serverIds.map(
|
|
38554
|
+
(serverId) => ({
|
|
38555
|
+
address: DataPortabilityServersAddress,
|
|
38556
|
+
abi: DataPortabilityServersAbi,
|
|
38557
|
+
functionName: "servers",
|
|
38558
|
+
args: [BigInt(serverId)]
|
|
38559
|
+
})
|
|
38560
|
+
);
|
|
38561
|
+
const serverInfoResults = await gasAwareMulticall(this.context.publicClient, {
|
|
38562
|
+
contracts: serverInfoCalls,
|
|
38563
|
+
allowFailure: true
|
|
38564
|
+
});
|
|
38565
|
+
const results = serverInfoResults.map((result, index) => {
|
|
38566
|
+
const serverId = serverIds[index];
|
|
38567
|
+
if (result.status === "success" && result.result) {
|
|
38568
|
+
const serverInfo = result.result;
|
|
38001
38569
|
const server = {
|
|
38002
38570
|
id: Number(serverInfo.id),
|
|
38003
38571
|
owner: serverInfo.owner,
|
|
@@ -38006,11 +38574,10 @@ var PermissionsController = class {
|
|
|
38006
38574
|
publicKey: serverInfo.publicKey
|
|
38007
38575
|
};
|
|
38008
38576
|
return { serverId, server, success: true };
|
|
38009
|
-
}
|
|
38577
|
+
} else {
|
|
38010
38578
|
return { serverId, server: null, success: false };
|
|
38011
38579
|
}
|
|
38012
38580
|
});
|
|
38013
|
-
const results = await Promise.all(serverInfoPromises);
|
|
38014
38581
|
const servers = /* @__PURE__ */ new Map();
|
|
38015
38582
|
const failed = [];
|
|
38016
38583
|
for (const result of results) {
|
|
@@ -38031,9 +38598,24 @@ var PermissionsController = class {
|
|
|
38031
38598
|
/**
|
|
38032
38599
|
* Checks whether a specific server is trusted by a user.
|
|
38033
38600
|
*
|
|
38034
|
-
* @
|
|
38601
|
+
* @remarks
|
|
38602
|
+
* This method queries the user's trusted server list and checks if the specified
|
|
38603
|
+
* server is present. Returns both the trust status and the index in the trust list
|
|
38604
|
+
* if trusted.
|
|
38605
|
+
*
|
|
38606
|
+
* @param serverId - Numeric server ID to check
|
|
38035
38607
|
* @param userAddress - Optional user address (defaults to current user)
|
|
38036
|
-
* @returns Promise resolving to server trust status
|
|
38608
|
+
* @returns Promise resolving to server trust status with trust index if applicable
|
|
38609
|
+
* @throws {BlockchainError} When reading from contract fails
|
|
38610
|
+
* @example
|
|
38611
|
+
* ```typescript
|
|
38612
|
+
* const status = await vana.permissions.checkServerTrustStatus(1);
|
|
38613
|
+
* if (status.isTrusted) {
|
|
38614
|
+
* console.log(`Server is trusted at index ${status.trustIndex}`);
|
|
38615
|
+
* } else {
|
|
38616
|
+
* console.log('Server is not trusted');
|
|
38617
|
+
* }
|
|
38618
|
+
* ```
|
|
38037
38619
|
*/
|
|
38038
38620
|
async checkServerTrustStatus(serverId, userAddress) {
|
|
38039
38621
|
try {
|
|
@@ -38057,6 +38639,10 @@ var PermissionsController = class {
|
|
|
38057
38639
|
/**
|
|
38058
38640
|
* Composes EIP-712 typed data for AddAndTrustServer.
|
|
38059
38641
|
*
|
|
38642
|
+
* @remarks
|
|
38643
|
+
* Creates the complete typed data structure required for EIP-712 signature generation
|
|
38644
|
+
* when adding and trusting a new server in a single transaction.
|
|
38645
|
+
*
|
|
38060
38646
|
* @param input - The add and trust server input data containing server details
|
|
38061
38647
|
* @returns Promise resolving to the typed data structure for server add and trust
|
|
38062
38648
|
*/
|
|
@@ -38305,7 +38891,11 @@ var PermissionsController = class {
|
|
|
38305
38891
|
account: this.context.walletClient.account || await this.getUserAddress(),
|
|
38306
38892
|
chain: this.context.walletClient.chain || null
|
|
38307
38893
|
});
|
|
38308
|
-
return
|
|
38894
|
+
return new TransactionHandle(
|
|
38895
|
+
this.context,
|
|
38896
|
+
txHash,
|
|
38897
|
+
"registerGrantee"
|
|
38898
|
+
);
|
|
38309
38899
|
}
|
|
38310
38900
|
/**
|
|
38311
38901
|
* Registers a grantee with a signature (gasless transaction)
|
|
@@ -38332,7 +38922,15 @@ var PermissionsController = class {
|
|
|
38332
38922
|
};
|
|
38333
38923
|
const typedData = await this.buildRegisterGranteeTypedData(registerGranteeInput);
|
|
38334
38924
|
const signature = await this.signTypedData(typedData);
|
|
38335
|
-
|
|
38925
|
+
const hash = await this.submitSignedRegisterGranteeTransaction(
|
|
38926
|
+
typedData,
|
|
38927
|
+
signature
|
|
38928
|
+
);
|
|
38929
|
+
return new TransactionHandle(
|
|
38930
|
+
this.context,
|
|
38931
|
+
hash,
|
|
38932
|
+
"registerGrantee"
|
|
38933
|
+
);
|
|
38336
38934
|
}
|
|
38337
38935
|
/**
|
|
38338
38936
|
* Submits a signed register grantee transaction via relayer
|
|
@@ -38347,7 +38945,15 @@ var PermissionsController = class {
|
|
|
38347
38945
|
* ```
|
|
38348
38946
|
*/
|
|
38349
38947
|
async submitSignedRegisterGrantee(typedData, signature) {
|
|
38350
|
-
|
|
38948
|
+
const hash = await this.submitSignedRegisterGranteeTransaction(
|
|
38949
|
+
typedData,
|
|
38950
|
+
signature
|
|
38951
|
+
);
|
|
38952
|
+
return new TransactionHandle(
|
|
38953
|
+
this.context,
|
|
38954
|
+
hash,
|
|
38955
|
+
"registerGrantee"
|
|
38956
|
+
);
|
|
38351
38957
|
}
|
|
38352
38958
|
/**
|
|
38353
38959
|
* Retrieves all registered grantees from the DataPortabilityGrantees contract.
|
|
@@ -39333,7 +39939,11 @@ var PermissionsController = class {
|
|
|
39333
39939
|
chain: this.context.walletClient.chain,
|
|
39334
39940
|
account: this.context.walletClient.account || null
|
|
39335
39941
|
});
|
|
39336
|
-
return
|
|
39942
|
+
return new TransactionHandle(
|
|
39943
|
+
this.context,
|
|
39944
|
+
hash,
|
|
39945
|
+
"updateServer"
|
|
39946
|
+
);
|
|
39337
39947
|
} catch (error) {
|
|
39338
39948
|
throw new BlockchainError(
|
|
39339
39949
|
`Failed to update server: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
@@ -39514,24 +40124,30 @@ var PermissionsController = class {
|
|
|
39514
40124
|
*
|
|
39515
40125
|
* @param typedData - The EIP-712 typed data for AddPermission
|
|
39516
40126
|
* @param signature - The user's signature
|
|
39517
|
-
* @returns Promise resolving to
|
|
40127
|
+
* @returns Promise resolving to TransactionHandle with PermissionGrantResult event data
|
|
39518
40128
|
* @throws {RelayerError} When gasless transaction submission fails
|
|
39519
40129
|
* @throws {BlockchainError} When permission addition fails
|
|
39520
40130
|
* @throws {NetworkError} When network communication fails
|
|
39521
40131
|
*/
|
|
39522
40132
|
async submitSignedAddPermission(typedData, signature) {
|
|
39523
40133
|
try {
|
|
40134
|
+
let hash;
|
|
39524
40135
|
if (this.context.relayerCallbacks?.submitAddPermission) {
|
|
39525
|
-
|
|
40136
|
+
hash = await this.context.relayerCallbacks.submitAddPermission(
|
|
39526
40137
|
typedData,
|
|
39527
40138
|
signature
|
|
39528
40139
|
);
|
|
39529
40140
|
} else {
|
|
39530
|
-
|
|
40141
|
+
hash = await this.submitDirectAddPermissionTransaction(
|
|
39531
40142
|
typedData,
|
|
39532
40143
|
signature
|
|
39533
40144
|
);
|
|
39534
40145
|
}
|
|
40146
|
+
return new TransactionHandle(
|
|
40147
|
+
this.context,
|
|
40148
|
+
hash,
|
|
40149
|
+
"addServerFilesAndPermissions"
|
|
40150
|
+
);
|
|
39535
40151
|
} catch (error) {
|
|
39536
40152
|
if (error instanceof RelayerError || error instanceof NetworkError || error instanceof UserRejectedRequestError || error instanceof SignatureError || error instanceof NonceError) {
|
|
39537
40153
|
throw error;
|
|
@@ -39585,14 +40201,31 @@ var PermissionsController = class {
|
|
|
39585
40201
|
}
|
|
39586
40202
|
/**
|
|
39587
40203
|
* Submits an already-signed add server files and permissions transaction to the blockchain.
|
|
39588
|
-
*
|
|
40204
|
+
*
|
|
40205
|
+
* @remarks
|
|
40206
|
+
* This method returns a TransactionHandle that provides immediate access to the transaction hash
|
|
40207
|
+
* while allowing lazy-loaded access to parsed event data. Use `waitForEvents()` to retrieve
|
|
40208
|
+
* the permission ID and other event details after transaction confirmation.
|
|
39589
40209
|
*
|
|
39590
40210
|
* @param typedData - The EIP-712 typed data for AddServerFilesAndPermissions
|
|
39591
40211
|
* @param signature - The user's signature
|
|
39592
|
-
* @returns
|
|
40212
|
+
* @returns TransactionHandle with immediate hash access and optional event parsing
|
|
39593
40213
|
* @throws {RelayerError} When gasless transaction submission fails
|
|
39594
40214
|
* @throws {BlockchainError} When server files and permissions addition fails
|
|
39595
40215
|
* @throws {NetworkError} When network communication fails
|
|
40216
|
+
*
|
|
40217
|
+
* @example
|
|
40218
|
+
* ```typescript
|
|
40219
|
+
* const tx = await vana.permissions.submitSignedAddServerFilesAndPermissions(
|
|
40220
|
+
* typedData,
|
|
40221
|
+
* signature
|
|
40222
|
+
* );
|
|
40223
|
+
* console.log(`Transaction submitted: ${tx.hash}`);
|
|
40224
|
+
*
|
|
40225
|
+
* // Wait for confirmation and get the permission ID
|
|
40226
|
+
* const { permissionId } = await tx.waitForEvents();
|
|
40227
|
+
* console.log(`Permission created with ID: ${permissionId}`);
|
|
40228
|
+
* ```
|
|
39596
40229
|
*/
|
|
39597
40230
|
async submitSignedAddServerFilesAndPermissions(typedData, signature) {
|
|
39598
40231
|
try {
|
|
@@ -39605,18 +40238,28 @@ var PermissionsController = class {
|
|
|
39605
40238
|
console.debug(
|
|
39606
40239
|
"\u{1F680} Using relayer for submitAddServerFilesAndPermissions"
|
|
39607
40240
|
);
|
|
39608
|
-
|
|
40241
|
+
const hash = await this.context.relayerCallbacks.submitAddServerFilesAndPermissions(
|
|
39609
40242
|
typedData,
|
|
39610
40243
|
signature
|
|
39611
40244
|
);
|
|
40245
|
+
return new TransactionHandle(
|
|
40246
|
+
this.context,
|
|
40247
|
+
hash,
|
|
40248
|
+
"addServerFilesAndPermissions"
|
|
40249
|
+
);
|
|
39612
40250
|
} else {
|
|
39613
40251
|
console.debug(
|
|
39614
40252
|
"\u{1F4DD} Using direct transaction for submitAddServerFilesAndPermissions"
|
|
39615
40253
|
);
|
|
39616
|
-
|
|
40254
|
+
const hash = await this.submitDirectAddServerFilesAndPermissionsTransaction(
|
|
39617
40255
|
typedData,
|
|
39618
40256
|
signature
|
|
39619
40257
|
);
|
|
40258
|
+
return new TransactionHandle(
|
|
40259
|
+
this.context,
|
|
40260
|
+
hash,
|
|
40261
|
+
"addServerFilesAndPermissions"
|
|
40262
|
+
);
|
|
39620
40263
|
}
|
|
39621
40264
|
} catch (error) {
|
|
39622
40265
|
if (error instanceof RelayerError || error instanceof NetworkError || error instanceof UserRejectedRequestError || error instanceof SignatureError || error instanceof NonceError) {
|
|
@@ -39652,7 +40295,11 @@ var PermissionsController = class {
|
|
|
39652
40295
|
chain: this.context.walletClient.chain,
|
|
39653
40296
|
account: this.context.walletClient.account || null
|
|
39654
40297
|
});
|
|
39655
|
-
return
|
|
40298
|
+
return new TransactionHandle(
|
|
40299
|
+
this.context,
|
|
40300
|
+
hash,
|
|
40301
|
+
"revokePermission"
|
|
40302
|
+
);
|
|
39656
40303
|
} catch (error) {
|
|
39657
40304
|
throw new BlockchainError(
|
|
39658
40305
|
`Failed to revoke permission: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
@@ -39730,7 +40377,7 @@ var PermissionsController = class {
|
|
|
39730
40377
|
};
|
|
39731
40378
|
|
|
39732
40379
|
// src/controllers/data.ts
|
|
39733
|
-
import { getContract as getContract2
|
|
40380
|
+
import { getContract as getContract2 } from "viem";
|
|
39734
40381
|
|
|
39735
40382
|
// src/utils/blockchain/registry.ts
|
|
39736
40383
|
import { getContract } from "viem";
|
|
@@ -39754,13 +40401,13 @@ async function fetchSchemaFromChain(context, schemaId) {
|
|
|
39754
40401
|
throw new Error(`Schema with ID ${schemaId} not found`);
|
|
39755
40402
|
}
|
|
39756
40403
|
const schemaObj = schemaData;
|
|
39757
|
-
if (!schemaObj.name || !schemaObj.
|
|
40404
|
+
if (!schemaObj.name || !schemaObj.dialect || !schemaObj.definitionUrl) {
|
|
39758
40405
|
throw new Error("Incomplete schema data");
|
|
39759
40406
|
}
|
|
39760
40407
|
return {
|
|
39761
40408
|
id: schemaId,
|
|
39762
40409
|
name: schemaObj.name,
|
|
39763
|
-
|
|
40410
|
+
dialect: schemaObj.dialect,
|
|
39764
40411
|
definitionUrl: schemaObj.definitionUrl
|
|
39765
40412
|
};
|
|
39766
40413
|
}
|
|
@@ -40207,8 +40854,8 @@ var DataController = class {
|
|
|
40207
40854
|
*/
|
|
40208
40855
|
async getUserFiles(params) {
|
|
40209
40856
|
const { owner, subgraphUrl } = params;
|
|
40210
|
-
const
|
|
40211
|
-
if (!
|
|
40857
|
+
const endpoint = subgraphUrl || this.context.subgraphUrl;
|
|
40858
|
+
if (!endpoint) {
|
|
40212
40859
|
throw new Error(
|
|
40213
40860
|
"subgraphUrl is required. Please provide a valid subgraph endpoint or configure it in Vana constructor."
|
|
40214
40861
|
);
|
|
@@ -40232,7 +40879,7 @@ var DataController = class {
|
|
|
40232
40879
|
}
|
|
40233
40880
|
}
|
|
40234
40881
|
`;
|
|
40235
|
-
const response = await fetch(
|
|
40882
|
+
const response = await fetch(endpoint, {
|
|
40236
40883
|
method: "POST",
|
|
40237
40884
|
headers: {
|
|
40238
40885
|
"Content-Type": "application/json"
|
|
@@ -40290,28 +40937,45 @@ var DataController = class {
|
|
|
40290
40937
|
}
|
|
40291
40938
|
}
|
|
40292
40939
|
/**
|
|
40293
|
-
* Retrieves a list of permissions granted by a user
|
|
40940
|
+
* Retrieves a list of permissions granted by a user.
|
|
40294
40941
|
*
|
|
40295
|
-
* This method
|
|
40296
|
-
*
|
|
40297
|
-
*
|
|
40298
|
-
*
|
|
40299
|
-
* 3. No need for additional contract calls as all data comes from subgraph
|
|
40942
|
+
* This method supports automatic fallback between subgraph and RPC modes:
|
|
40943
|
+
* - If subgraph URL is available, tries subgraph query first
|
|
40944
|
+
* - Falls back to direct contract queries via RPC if subgraph fails
|
|
40945
|
+
* - RPC mode uses gasAwareMulticall for efficient batch queries
|
|
40300
40946
|
*
|
|
40301
40947
|
* @param params - Object containing the user address and optional subgraph URL
|
|
40302
40948
|
* @param params.user - The wallet address of the user to query permissions for
|
|
40303
40949
|
* @param params.subgraphUrl - Optional subgraph URL to override the default
|
|
40304
40950
|
* @returns Promise resolving to an array of permission objects
|
|
40305
|
-
* @throws Error if subgraph
|
|
40951
|
+
* @throws Error if both subgraph and RPC queries fail
|
|
40306
40952
|
*/
|
|
40307
40953
|
async getUserPermissions(params) {
|
|
40308
40954
|
const { user, subgraphUrl } = params;
|
|
40309
|
-
const
|
|
40310
|
-
if (
|
|
40311
|
-
|
|
40312
|
-
|
|
40313
|
-
|
|
40955
|
+
const endpoint = subgraphUrl || this.context.subgraphUrl;
|
|
40956
|
+
if (endpoint) {
|
|
40957
|
+
try {
|
|
40958
|
+
const permissions = await this._getUserPermissionsViaSubgraph({
|
|
40959
|
+
user,
|
|
40960
|
+
subgraphUrl: endpoint
|
|
40961
|
+
});
|
|
40962
|
+
return permissions;
|
|
40963
|
+
} catch (error) {
|
|
40964
|
+
console.warn("Subgraph query failed, falling back to RPC:", error);
|
|
40965
|
+
}
|
|
40314
40966
|
}
|
|
40967
|
+
return await this._getUserPermissionsViaRpc({ user });
|
|
40968
|
+
}
|
|
40969
|
+
/**
|
|
40970
|
+
* Internal method: Query user permissions via subgraph
|
|
40971
|
+
*
|
|
40972
|
+
* @param params - Query parameters object
|
|
40973
|
+
* @param params.user - The user address to query permissions for
|
|
40974
|
+
* @param params.subgraphUrl - The subgraph URL endpoint to query
|
|
40975
|
+
* @returns Promise resolving to an array of permission objects
|
|
40976
|
+
*/
|
|
40977
|
+
async _getUserPermissionsViaSubgraph(params) {
|
|
40978
|
+
const { user, subgraphUrl } = params;
|
|
40315
40979
|
try {
|
|
40316
40980
|
const query = `
|
|
40317
40981
|
query GetUserPermissions($userId: ID!) {
|
|
@@ -40332,7 +40996,7 @@ var DataController = class {
|
|
|
40332
40996
|
}
|
|
40333
40997
|
}
|
|
40334
40998
|
`;
|
|
40335
|
-
const response = await fetch(
|
|
40999
|
+
const response = await fetch(subgraphUrl, {
|
|
40336
41000
|
method: "POST",
|
|
40337
41001
|
headers: {
|
|
40338
41002
|
"Content-Type": "application/json"
|
|
@@ -40352,15 +41016,14 @@ var DataController = class {
|
|
|
40352
41016
|
const result = await response.json();
|
|
40353
41017
|
if (result.errors) {
|
|
40354
41018
|
throw new Error(
|
|
40355
|
-
`Subgraph errors: ${result.errors.map((e) => e.message).join(", ")}`
|
|
41019
|
+
`Subgraph query errors: ${result.errors.map((e) => e.message).join(", ")}`
|
|
40356
41020
|
);
|
|
40357
41021
|
}
|
|
40358
41022
|
const userData = result.data?.user;
|
|
40359
41023
|
if (!userData || !userData.permissions?.length) {
|
|
40360
|
-
console.warn("No permissions found for user:", user);
|
|
40361
41024
|
return [];
|
|
40362
41025
|
}
|
|
40363
|
-
|
|
41026
|
+
return userData.permissions.map((permission) => ({
|
|
40364
41027
|
id: permission.id,
|
|
40365
41028
|
grant: permission.grant,
|
|
40366
41029
|
nonce: BigInt(permission.nonce),
|
|
@@ -40370,131 +41033,158 @@ var DataController = class {
|
|
|
40370
41033
|
transactionHash: permission.transactionHash,
|
|
40371
41034
|
user: permission.user.id
|
|
40372
41035
|
})).sort((a, b) => Number(b.addedAtTimestamp - a.addedAtTimestamp));
|
|
41036
|
+
} catch (error) {
|
|
41037
|
+
console.error("Failed to query user permissions from subgraph:", error);
|
|
41038
|
+
throw error;
|
|
41039
|
+
}
|
|
41040
|
+
}
|
|
41041
|
+
/**
|
|
41042
|
+
* Internal method: Query user permissions via direct RPC
|
|
41043
|
+
*
|
|
41044
|
+
* @param params - Query parameters object
|
|
41045
|
+
* @param params.user - The user address to query permissions for
|
|
41046
|
+
* @returns Promise resolving to an array of permission objects
|
|
41047
|
+
*/
|
|
41048
|
+
async _getUserPermissionsViaRpc(params) {
|
|
41049
|
+
const { user } = params;
|
|
41050
|
+
try {
|
|
41051
|
+
const chainId = this.context.walletClient.chain?.id;
|
|
41052
|
+
if (!chainId) {
|
|
41053
|
+
throw new Error("Chain ID not available");
|
|
41054
|
+
}
|
|
41055
|
+
const permissionsAddress = getContractAddress(
|
|
41056
|
+
chainId,
|
|
41057
|
+
"DataPortabilityPermissions"
|
|
41058
|
+
);
|
|
41059
|
+
const permissionsAbi = getAbi("DataPortabilityPermissions");
|
|
41060
|
+
const totalCount = await this.context.publicClient.readContract({
|
|
41061
|
+
address: permissionsAddress,
|
|
41062
|
+
abi: permissionsAbi,
|
|
41063
|
+
functionName: "userPermissionIdsLength",
|
|
41064
|
+
args: [user]
|
|
41065
|
+
});
|
|
41066
|
+
const total = Number(totalCount);
|
|
41067
|
+
if (total === 0) {
|
|
41068
|
+
return [];
|
|
41069
|
+
}
|
|
41070
|
+
const permissionIdCalls = [];
|
|
41071
|
+
for (let i = 0; i < total; i++) {
|
|
41072
|
+
permissionIdCalls.push({
|
|
41073
|
+
address: permissionsAddress,
|
|
41074
|
+
abi: permissionsAbi,
|
|
41075
|
+
functionName: "userPermissionIdsAt",
|
|
41076
|
+
args: [user, BigInt(i)]
|
|
41077
|
+
});
|
|
41078
|
+
}
|
|
41079
|
+
const permissionIdResults = await gasAwareMulticall(this.context.publicClient, {
|
|
41080
|
+
contracts: permissionIdCalls
|
|
41081
|
+
});
|
|
41082
|
+
const permissionIds = permissionIdResults.map((result) => result).filter((id) => id && id > 0n);
|
|
41083
|
+
const permissionInfoCalls = permissionIds.map(
|
|
41084
|
+
(permissionId) => ({
|
|
41085
|
+
address: permissionsAddress,
|
|
41086
|
+
abi: permissionsAbi,
|
|
41087
|
+
functionName: "permissions",
|
|
41088
|
+
args: [permissionId]
|
|
41089
|
+
})
|
|
41090
|
+
);
|
|
41091
|
+
const permissionInfoResults = await gasAwareMulticall(this.context.publicClient, {
|
|
41092
|
+
contracts: permissionInfoCalls,
|
|
41093
|
+
allowFailure: true
|
|
41094
|
+
});
|
|
41095
|
+
const permissions = permissionInfoResults.map((result, index) => {
|
|
41096
|
+
const permissionId = permissionIds[index];
|
|
41097
|
+
if (result.status === "success" && result.result) {
|
|
41098
|
+
const permissionInfo = result.result;
|
|
41099
|
+
return {
|
|
41100
|
+
id: permissionId.toString(),
|
|
41101
|
+
grant: permissionInfo.grant,
|
|
41102
|
+
nonce: permissionInfo.nonce,
|
|
41103
|
+
signature: "",
|
|
41104
|
+
// Not available from RPC, will be empty
|
|
41105
|
+
addedAtBlock: permissionInfo.startBlock,
|
|
41106
|
+
addedAtTimestamp: BigInt(0),
|
|
41107
|
+
// Not available from RPC
|
|
41108
|
+
transactionHash: "0x0000000000000000000000000000000000000000",
|
|
41109
|
+
// Not available from RPC
|
|
41110
|
+
user
|
|
41111
|
+
};
|
|
41112
|
+
} else {
|
|
41113
|
+
return {
|
|
41114
|
+
id: permissionId.toString(),
|
|
41115
|
+
grant: "",
|
|
41116
|
+
nonce: BigInt(0),
|
|
41117
|
+
signature: "",
|
|
41118
|
+
addedAtBlock: BigInt(0),
|
|
41119
|
+
addedAtTimestamp: BigInt(0),
|
|
41120
|
+
transactionHash: "0x0000000000000000000000000000000000000000",
|
|
41121
|
+
user
|
|
41122
|
+
};
|
|
41123
|
+
}
|
|
41124
|
+
}).filter((permission) => permission.grant !== "");
|
|
40373
41125
|
return permissions;
|
|
40374
41126
|
} catch (error) {
|
|
40375
|
-
console.error("Failed to fetch user permissions from subgraph:", error);
|
|
40376
41127
|
throw new Error(
|
|
40377
|
-
`
|
|
41128
|
+
`RPC query failed: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
40378
41129
|
);
|
|
40379
41130
|
}
|
|
40380
41131
|
}
|
|
40381
41132
|
/**
|
|
40382
|
-
* Retrieves a list of trusted servers for a user
|
|
41133
|
+
* Retrieves a list of trusted servers for a user.
|
|
40383
41134
|
*
|
|
40384
|
-
* This method
|
|
40385
|
-
*
|
|
41135
|
+
* This method supports automatic fallback between subgraph and RPC modes:
|
|
41136
|
+
* - If subgraph URL is available, tries subgraph query first for fast results
|
|
41137
|
+
* - Falls back to direct contract queries via RPC if subgraph fails
|
|
41138
|
+
* - RPC mode uses gasAwareMulticall for efficient batch queries
|
|
40386
41139
|
*
|
|
40387
|
-
*
|
|
40388
|
-
* -
|
|
40389
|
-
*
|
|
40390
|
-
* -
|
|
40391
|
-
*
|
|
40392
|
-
* @
|
|
40393
|
-
* @
|
|
40394
|
-
* @throws Error if query fails in both modes (when using 'auto')
|
|
41140
|
+
* @param params - Query parameters including user address and optional pagination
|
|
41141
|
+
* @param params.user - The wallet address of the user to query trusted servers for
|
|
41142
|
+
* @param params.subgraphUrl - Optional subgraph URL to override the default
|
|
41143
|
+
* @param params.limit - Maximum number of results to return (default: 50)
|
|
41144
|
+
* @param params.offset - Number of results to skip for pagination (default: 0)
|
|
41145
|
+
* @returns Promise resolving to an array of trusted server objects
|
|
41146
|
+
* @throws Error if both subgraph and RPC queries fail
|
|
40395
41147
|
* @example
|
|
40396
41148
|
* ```typescript
|
|
40397
|
-
* //
|
|
40398
|
-
* const
|
|
40399
|
-
* user: '0x...'
|
|
40400
|
-
* mode: 'subgraph',
|
|
40401
|
-
* subgraphUrl: 'https://...'
|
|
41149
|
+
* // Basic usage with automatic fallback
|
|
41150
|
+
* const servers = await vana.data.getUserTrustedServers({
|
|
41151
|
+
* user: '0x...'
|
|
40402
41152
|
* });
|
|
40403
41153
|
*
|
|
40404
|
-
* //
|
|
40405
|
-
* const
|
|
41154
|
+
* // With pagination
|
|
41155
|
+
* const servers = await vana.data.getUserTrustedServers({
|
|
40406
41156
|
* user: '0x...',
|
|
40407
|
-
*
|
|
40408
|
-
*
|
|
41157
|
+
* limit: 10,
|
|
41158
|
+
* offset: 20
|
|
40409
41159
|
* });
|
|
40410
41160
|
*
|
|
40411
|
-
* //
|
|
40412
|
-
* const
|
|
41161
|
+
* // With custom subgraph URL
|
|
41162
|
+
* const servers = await vana.data.getUserTrustedServers({
|
|
40413
41163
|
* user: '0x...',
|
|
40414
|
-
*
|
|
41164
|
+
* subgraphUrl: 'https://custom-subgraph.com/graphql'
|
|
40415
41165
|
* });
|
|
40416
41166
|
* ```
|
|
40417
41167
|
*/
|
|
40418
41168
|
async getUserTrustedServers(params) {
|
|
40419
|
-
const { user,
|
|
40420
|
-
const
|
|
40421
|
-
|
|
40422
|
-
let tryRpc = false;
|
|
40423
|
-
switch (mode) {
|
|
40424
|
-
case "subgraph":
|
|
40425
|
-
trySubgraph = true;
|
|
40426
|
-
break;
|
|
40427
|
-
case "rpc":
|
|
40428
|
-
tryRpc = true;
|
|
40429
|
-
break;
|
|
40430
|
-
case "auto":
|
|
40431
|
-
trySubgraph = true;
|
|
40432
|
-
tryRpc = true;
|
|
40433
|
-
break;
|
|
40434
|
-
}
|
|
40435
|
-
if (trySubgraph) {
|
|
40436
|
-
const subgraphUrl = params.subgraphUrl || this.context.subgraphUrl;
|
|
40437
|
-
if (!subgraphUrl) {
|
|
40438
|
-
if (mode === "subgraph") {
|
|
40439
|
-
throw new Error(
|
|
40440
|
-
"subgraphUrl is required for subgraph mode. Please provide a valid subgraph endpoint or configure it in Vana constructor."
|
|
40441
|
-
);
|
|
40442
|
-
}
|
|
40443
|
-
warnings.push(
|
|
40444
|
-
"Subgraph mode not available for trusted servers - using direct contract calls"
|
|
40445
|
-
);
|
|
40446
|
-
} else {
|
|
40447
|
-
try {
|
|
40448
|
-
const servers = await this._getUserTrustedServersViaSubgraph({
|
|
40449
|
-
user,
|
|
40450
|
-
subgraphUrl
|
|
40451
|
-
});
|
|
40452
|
-
const paginatedServers = limit ? servers.slice(offset, offset + limit) : servers;
|
|
40453
|
-
return {
|
|
40454
|
-
servers: paginatedServers,
|
|
40455
|
-
usedMode: "subgraph",
|
|
40456
|
-
total: servers.length,
|
|
40457
|
-
hasMore: limit ? offset + limit < servers.length : false,
|
|
40458
|
-
warnings: warnings.length > 0 ? warnings : void 0
|
|
40459
|
-
};
|
|
40460
|
-
} catch (error) {
|
|
40461
|
-
if (mode === "subgraph") {
|
|
40462
|
-
throw error;
|
|
40463
|
-
}
|
|
40464
|
-
warnings.push(
|
|
40465
|
-
`Subgraph query failed: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
40466
|
-
);
|
|
40467
|
-
console.warn(
|
|
40468
|
-
"Subgraph query failed, falling back to RPC mode:",
|
|
40469
|
-
error
|
|
40470
|
-
);
|
|
40471
|
-
}
|
|
40472
|
-
}
|
|
40473
|
-
}
|
|
40474
|
-
if (tryRpc) {
|
|
41169
|
+
const { user, limit = 50, offset = 0 } = params;
|
|
41170
|
+
const subgraphUrl = params.subgraphUrl || this.context.subgraphUrl;
|
|
41171
|
+
if (subgraphUrl) {
|
|
40475
41172
|
try {
|
|
40476
|
-
const
|
|
41173
|
+
const servers = await this._getUserTrustedServersViaSubgraph({
|
|
40477
41174
|
user,
|
|
40478
|
-
|
|
40479
|
-
offset
|
|
41175
|
+
subgraphUrl
|
|
40480
41176
|
});
|
|
40481
|
-
return
|
|
40482
|
-
servers: rpcResult.servers,
|
|
40483
|
-
usedMode: "rpc",
|
|
40484
|
-
total: rpcResult.total,
|
|
40485
|
-
hasMore: rpcResult.hasMore,
|
|
40486
|
-
warnings: warnings.length > 0 ? warnings : void 0
|
|
40487
|
-
};
|
|
41177
|
+
return limit ? servers.slice(offset, offset + limit) : servers;
|
|
40488
41178
|
} catch (error) {
|
|
40489
|
-
|
|
40490
|
-
throw error;
|
|
40491
|
-
}
|
|
40492
|
-
throw new Error(
|
|
40493
|
-
`Both query methods failed. Subgraph: ${warnings[0] || "Unknown error"}. RPC: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
40494
|
-
);
|
|
41179
|
+
console.warn("Subgraph query failed, falling back to RPC:", error);
|
|
40495
41180
|
}
|
|
40496
41181
|
}
|
|
40497
|
-
|
|
41182
|
+
const rpcResult = await this._getUserTrustedServersViaRpc({
|
|
41183
|
+
user,
|
|
41184
|
+
limit,
|
|
41185
|
+
offset
|
|
41186
|
+
});
|
|
41187
|
+
return rpcResult.servers;
|
|
40498
41188
|
}
|
|
40499
41189
|
/**
|
|
40500
41190
|
* Internal method: Query trusted servers via subgraph
|
|
@@ -40610,35 +41300,44 @@ var DataController = class {
|
|
|
40610
41300
|
};
|
|
40611
41301
|
}
|
|
40612
41302
|
const endIndex = Math.min(offset + limit, total);
|
|
40613
|
-
const
|
|
41303
|
+
const serverIdCalls = [];
|
|
40614
41304
|
for (let i = offset; i < endIndex; i++) {
|
|
40615
|
-
|
|
41305
|
+
serverIdCalls.push({
|
|
40616
41306
|
address: DataPortabilityServersAddress,
|
|
40617
41307
|
abi: DataPortabilityServersAbi,
|
|
40618
41308
|
functionName: "userServerIdsAt",
|
|
40619
41309
|
args: [user, BigInt(i)]
|
|
40620
41310
|
});
|
|
40621
|
-
serverIdPromises.push(promise);
|
|
40622
41311
|
}
|
|
40623
|
-
const
|
|
40624
|
-
|
|
40625
|
-
|
|
40626
|
-
|
|
40627
|
-
|
|
40628
|
-
|
|
40629
|
-
|
|
40630
|
-
|
|
40631
|
-
|
|
41312
|
+
const serverIdResults = await gasAwareMulticall(this.context.publicClient, {
|
|
41313
|
+
contracts: serverIdCalls
|
|
41314
|
+
});
|
|
41315
|
+
const serverIds = serverIdResults.map((result) => result).filter((id) => id && id > 0n);
|
|
41316
|
+
const serverInfoCalls = serverIds.map(
|
|
41317
|
+
(serverId) => ({
|
|
41318
|
+
address: DataPortabilityServersAddress,
|
|
41319
|
+
abi: DataPortabilityServersAbi,
|
|
41320
|
+
functionName: "servers",
|
|
41321
|
+
args: [serverId]
|
|
41322
|
+
})
|
|
41323
|
+
);
|
|
41324
|
+
const serverInfoResults = await gasAwareMulticall(this.context.publicClient, {
|
|
41325
|
+
contracts: serverInfoCalls,
|
|
41326
|
+
allowFailure: true
|
|
41327
|
+
});
|
|
41328
|
+
const servers = serverInfoResults.map((result, index) => {
|
|
41329
|
+
const serverId = serverIds[index];
|
|
41330
|
+
if (result.status === "success" && result.result) {
|
|
41331
|
+
const serverInfo = result.result;
|
|
40632
41332
|
return {
|
|
40633
41333
|
id: `${user.toLowerCase()}-${serverId.toString()}`,
|
|
40634
41334
|
serverAddress: serverInfo.serverAddress,
|
|
40635
41335
|
serverUrl: serverInfo.url,
|
|
40636
41336
|
trustedAt: BigInt(Date.now()),
|
|
40637
|
-
// RPC mode doesn't have timestamp, use current time
|
|
40638
41337
|
user,
|
|
40639
41338
|
trustIndex: offset + index
|
|
40640
41339
|
};
|
|
40641
|
-
}
|
|
41340
|
+
} else {
|
|
40642
41341
|
return {
|
|
40643
41342
|
id: `${user.toLowerCase()}-${serverId.toString()}`,
|
|
40644
41343
|
serverAddress: "0x0000000000000000000000000000000000000000",
|
|
@@ -40649,7 +41348,6 @@ var DataController = class {
|
|
|
40649
41348
|
};
|
|
40650
41349
|
}
|
|
40651
41350
|
});
|
|
40652
|
-
const servers = await Promise.all(serverInfoPromises);
|
|
40653
41351
|
return {
|
|
40654
41352
|
servers,
|
|
40655
41353
|
total,
|
|
@@ -40776,12 +41474,25 @@ var DataController = class {
|
|
|
40776
41474
|
/**
|
|
40777
41475
|
* Registers a file URL directly on the blockchain with a schema ID.
|
|
40778
41476
|
*
|
|
40779
|
-
* @
|
|
41477
|
+
* @remarks
|
|
41478
|
+
* This method registers an existing file URL on the DataRegistry contract
|
|
41479
|
+
* with a schema ID, without uploading any data. Useful when you have already
|
|
41480
|
+
* uploaded content to storage and just need to register it on-chain.
|
|
41481
|
+
*
|
|
41482
|
+
* @param url - The URL of the file to register (IPFS or HTTP/HTTPS)
|
|
40780
41483
|
* @param schemaId - The schema ID to associate with the file
|
|
40781
41484
|
* @returns Promise resolving to the file ID and transaction hash
|
|
40782
|
-
*
|
|
40783
|
-
*
|
|
40784
|
-
*
|
|
41485
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
41486
|
+
* @throws {Error} When wallet address is unavailable - "No addresses available"
|
|
41487
|
+
* @throws {Error} When transaction fails - "Failed to register file with schema"
|
|
41488
|
+
* @example
|
|
41489
|
+
* ```typescript
|
|
41490
|
+
* const { fileId, transactionHash } = await vana.data.registerFileWithSchema(
|
|
41491
|
+
* "ipfs://QmXxx...",
|
|
41492
|
+
* 1
|
|
41493
|
+
* );
|
|
41494
|
+
* console.log(`File ${fileId} registered with schema in tx ${transactionHash}`);
|
|
41495
|
+
* ```
|
|
40785
41496
|
*/
|
|
40786
41497
|
async registerFileWithSchema(url, schemaId) {
|
|
40787
41498
|
try {
|
|
@@ -40800,30 +41511,14 @@ var DataController = class {
|
|
|
40800
41511
|
account: this.context.walletClient.account || userAddress,
|
|
40801
41512
|
chain: this.context.walletClient.chain || null
|
|
40802
41513
|
});
|
|
40803
|
-
const
|
|
40804
|
-
|
|
40805
|
-
|
|
40806
|
-
|
|
40807
|
-
}
|
|
41514
|
+
const txHandle = new TransactionHandle(
|
|
41515
|
+
this.context,
|
|
41516
|
+
txHash,
|
|
41517
|
+
"addFileWithSchema"
|
|
40808
41518
|
);
|
|
40809
|
-
|
|
40810
|
-
for (const log of receipt.logs) {
|
|
40811
|
-
try {
|
|
40812
|
-
const decoded = decodeEventLog({
|
|
40813
|
-
abi: dataRegistryAbi,
|
|
40814
|
-
data: log.data,
|
|
40815
|
-
topics: log.topics
|
|
40816
|
-
});
|
|
40817
|
-
if (decoded.eventName === "FileAdded") {
|
|
40818
|
-
fileId = Number(decoded.args.fileId);
|
|
40819
|
-
break;
|
|
40820
|
-
}
|
|
40821
|
-
} catch {
|
|
40822
|
-
continue;
|
|
40823
|
-
}
|
|
40824
|
-
}
|
|
41519
|
+
const result = await txHandle.waitForEvents();
|
|
40825
41520
|
return {
|
|
40826
|
-
fileId,
|
|
41521
|
+
fileId: Number(result.fileId),
|
|
40827
41522
|
transactionHash: txHash
|
|
40828
41523
|
};
|
|
40829
41524
|
} catch (error) {
|
|
@@ -40878,31 +41573,14 @@ var DataController = class {
|
|
|
40878
41573
|
account: this.context.walletClient.account || ownerAddress,
|
|
40879
41574
|
chain: this.context.walletClient.chain || null
|
|
40880
41575
|
});
|
|
40881
|
-
const
|
|
40882
|
-
|
|
40883
|
-
|
|
40884
|
-
|
|
40885
|
-
// 30 seconds timeout
|
|
40886
|
-
}
|
|
41576
|
+
const txHandle = new TransactionHandle(
|
|
41577
|
+
this.context,
|
|
41578
|
+
txHash,
|
|
41579
|
+
"addFileWithPermissions"
|
|
40887
41580
|
);
|
|
40888
|
-
|
|
40889
|
-
for (const log of receipt.logs) {
|
|
40890
|
-
try {
|
|
40891
|
-
const decoded = decodeEventLog({
|
|
40892
|
-
abi: dataRegistryAbi,
|
|
40893
|
-
data: log.data,
|
|
40894
|
-
topics: log.topics
|
|
40895
|
-
});
|
|
40896
|
-
if (decoded.eventName === "FileAdded") {
|
|
40897
|
-
fileId = Number(decoded.args.fileId);
|
|
40898
|
-
break;
|
|
40899
|
-
}
|
|
40900
|
-
} catch {
|
|
40901
|
-
continue;
|
|
40902
|
-
}
|
|
40903
|
-
}
|
|
41581
|
+
const result = await txHandle.waitForEvents();
|
|
40904
41582
|
return {
|
|
40905
|
-
fileId,
|
|
41583
|
+
fileId: Number(result.fileId),
|
|
40906
41584
|
transactionHash: txHash
|
|
40907
41585
|
};
|
|
40908
41586
|
} catch (error) {
|
|
@@ -40942,31 +41620,14 @@ var DataController = class {
|
|
|
40942
41620
|
account: this.context.walletClient.account || ownerAddress,
|
|
40943
41621
|
chain: this.context.walletClient.chain || null
|
|
40944
41622
|
});
|
|
40945
|
-
const
|
|
40946
|
-
|
|
40947
|
-
|
|
40948
|
-
|
|
40949
|
-
// 30 seconds timeout
|
|
40950
|
-
}
|
|
41623
|
+
const txHandle = new TransactionHandle(
|
|
41624
|
+
this.context,
|
|
41625
|
+
txHash,
|
|
41626
|
+
"addFileWithPermissionsAndSchema"
|
|
40951
41627
|
);
|
|
40952
|
-
|
|
40953
|
-
for (const log of receipt.logs) {
|
|
40954
|
-
try {
|
|
40955
|
-
const decoded = decodeEventLog({
|
|
40956
|
-
abi: dataRegistryAbi,
|
|
40957
|
-
data: log.data,
|
|
40958
|
-
topics: log.topics
|
|
40959
|
-
});
|
|
40960
|
-
if (decoded.eventName === "FileAdded") {
|
|
40961
|
-
fileId = Number(decoded.args.fileId);
|
|
40962
|
-
break;
|
|
40963
|
-
}
|
|
40964
|
-
} catch {
|
|
40965
|
-
continue;
|
|
40966
|
-
}
|
|
40967
|
-
}
|
|
41628
|
+
const result = await txHandle.waitForEvents();
|
|
40968
41629
|
return {
|
|
40969
|
-
fileId,
|
|
41630
|
+
fileId: Number(result.fileId),
|
|
40970
41631
|
transactionHash: txHash
|
|
40971
41632
|
};
|
|
40972
41633
|
} catch (error) {
|
|
@@ -40979,8 +41640,30 @@ var DataController = class {
|
|
|
40979
41640
|
/**
|
|
40980
41641
|
* Adds a new refiner to the DataRefinerRegistry.
|
|
40981
41642
|
*
|
|
40982
|
-
* @
|
|
41643
|
+
* @remarks
|
|
41644
|
+
* Refiners are data processing templates that define how raw data should be
|
|
41645
|
+
* transformed into structured formats. Each refiner is associated with a DLP
|
|
41646
|
+
* (Data Liquidity Pool), has a specific schema for output, and includes
|
|
41647
|
+
* instructions for the refinement process.
|
|
41648
|
+
*
|
|
41649
|
+
* @param params - Refiner configuration parameters
|
|
41650
|
+
* @param params.dlpId - The Data Liquidity Pool ID this refiner belongs to
|
|
41651
|
+
* @param params.name - Human-readable name for the refiner
|
|
41652
|
+
* @param params.schemaId - Schema ID that defines the output format
|
|
41653
|
+
* @param params.refinementInstructionUrl - URL containing processing instructions
|
|
40983
41654
|
* @returns Promise resolving to the new refiner ID and transaction hash
|
|
41655
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
41656
|
+
* @throws {Error} When transaction fails - "Failed to add refiner: {error}"
|
|
41657
|
+
* @example
|
|
41658
|
+
* ```typescript
|
|
41659
|
+
* const result = await vana.data.addRefiner({
|
|
41660
|
+
* dlpId: 1,
|
|
41661
|
+
* name: "Social Media Sentiment Analyzer",
|
|
41662
|
+
* schemaId: 42,
|
|
41663
|
+
* refinementInstructionUrl: "ipfs://QmXxx..."
|
|
41664
|
+
* });
|
|
41665
|
+
* console.log(`Created refiner ${result.refinerId} in tx ${result.transactionHash}`);
|
|
41666
|
+
* ```
|
|
40984
41667
|
*/
|
|
40985
41668
|
async addRefiner(params) {
|
|
40986
41669
|
try {
|
|
@@ -41006,30 +41689,14 @@ var DataController = class {
|
|
|
41006
41689
|
account: this.context.walletClient.account || await this.getUserAddress(),
|
|
41007
41690
|
chain: this.context.walletClient.chain || null
|
|
41008
41691
|
});
|
|
41009
|
-
const
|
|
41010
|
-
|
|
41011
|
-
|
|
41012
|
-
|
|
41013
|
-
}
|
|
41692
|
+
const txHandle = new TransactionHandle(
|
|
41693
|
+
this.context,
|
|
41694
|
+
txHash,
|
|
41695
|
+
"addRefiner"
|
|
41014
41696
|
);
|
|
41015
|
-
|
|
41016
|
-
for (const log of receipt.logs) {
|
|
41017
|
-
try {
|
|
41018
|
-
const decoded = decodeEventLog({
|
|
41019
|
-
abi: dataRefinerRegistryAbi,
|
|
41020
|
-
data: log.data,
|
|
41021
|
-
topics: log.topics
|
|
41022
|
-
});
|
|
41023
|
-
if (decoded.eventName === "RefinerAdded") {
|
|
41024
|
-
refinerId = Number(decoded.args.refinerId);
|
|
41025
|
-
break;
|
|
41026
|
-
}
|
|
41027
|
-
} catch {
|
|
41028
|
-
continue;
|
|
41029
|
-
}
|
|
41030
|
-
}
|
|
41697
|
+
const result = await txHandle.waitForEvents();
|
|
41031
41698
|
return {
|
|
41032
|
-
refinerId,
|
|
41699
|
+
refinerId: Number(result.refinerId),
|
|
41033
41700
|
transactionHash: txHash
|
|
41034
41701
|
};
|
|
41035
41702
|
} catch (error) {
|
|
@@ -41042,8 +41709,25 @@ var DataController = class {
|
|
|
41042
41709
|
/**
|
|
41043
41710
|
* Retrieves a refiner by its ID.
|
|
41044
41711
|
*
|
|
41045
|
-
* @
|
|
41046
|
-
*
|
|
41712
|
+
* @remarks
|
|
41713
|
+
* Queries the DataRefinerRegistry contract to get complete information about
|
|
41714
|
+
* a specific refiner including its DLP association, schema, and instructions.
|
|
41715
|
+
*
|
|
41716
|
+
* @param refinerId - The numeric refiner ID to retrieve
|
|
41717
|
+
* @returns Promise resolving to the refiner information object
|
|
41718
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
41719
|
+
* @throws {Error} When refiner doesn't exist - "Refiner with ID {refinerId} does not exist"
|
|
41720
|
+
* @throws {Error} When contract read fails - "Failed to fetch refiner: {error}"
|
|
41721
|
+
* @example
|
|
41722
|
+
* ```typescript
|
|
41723
|
+
* const refiner = await vana.data.getRefiner(1);
|
|
41724
|
+
* console.log({
|
|
41725
|
+
* name: refiner.name,
|
|
41726
|
+
* dlp: refiner.dlpId,
|
|
41727
|
+
* schema: refiner.schemaId,
|
|
41728
|
+
* instructions: refiner.refinementInstructionUrl
|
|
41729
|
+
* });
|
|
41730
|
+
* ```
|
|
41047
41731
|
*/
|
|
41048
41732
|
async getRefiner(refinerId) {
|
|
41049
41733
|
try {
|
|
@@ -41085,8 +41769,21 @@ var DataController = class {
|
|
|
41085
41769
|
/**
|
|
41086
41770
|
* Validates if a schema ID exists in the registry.
|
|
41087
41771
|
*
|
|
41088
|
-
* @
|
|
41089
|
-
*
|
|
41772
|
+
* @remarks
|
|
41773
|
+
* Checks the DataRefinerRegistry contract to determine if a given schema ID
|
|
41774
|
+
* has been registered and is available for use.
|
|
41775
|
+
*
|
|
41776
|
+
* @param schemaId - The numeric schema ID to validate
|
|
41777
|
+
* @returns Promise resolving to true if schema exists, false otherwise
|
|
41778
|
+
* @example
|
|
41779
|
+
* ```typescript
|
|
41780
|
+
* const isValid = await vana.data.isValidSchemaId(42);
|
|
41781
|
+
* if (isValid) {
|
|
41782
|
+
* console.log('Schema 42 is available for use');
|
|
41783
|
+
* } else {
|
|
41784
|
+
* console.log('Schema 42 does not exist');
|
|
41785
|
+
* }
|
|
41786
|
+
* ```
|
|
41090
41787
|
*/
|
|
41091
41788
|
async isValidSchemaId(schemaId) {
|
|
41092
41789
|
try {
|
|
@@ -41116,7 +41813,16 @@ var DataController = class {
|
|
|
41116
41813
|
/**
|
|
41117
41814
|
* Gets the total number of refiners in the registry.
|
|
41118
41815
|
*
|
|
41816
|
+
* @remarks
|
|
41817
|
+
* Queries the DataRefinerRegistry contract to get the total count of all
|
|
41818
|
+
* registered refiners across all DLPs.
|
|
41819
|
+
*
|
|
41119
41820
|
* @returns Promise resolving to the total refiner count
|
|
41821
|
+
* @example
|
|
41822
|
+
* ```typescript
|
|
41823
|
+
* const count = await vana.data.getRefinersCount();
|
|
41824
|
+
* console.log(`Total refiners registered: ${count}`);
|
|
41825
|
+
* ```
|
|
41120
41826
|
*/
|
|
41121
41827
|
async getRefinersCount() {
|
|
41122
41828
|
try {
|
|
@@ -41144,8 +41850,24 @@ var DataController = class {
|
|
|
41144
41850
|
/**
|
|
41145
41851
|
* Updates the schema ID for an existing refiner.
|
|
41146
41852
|
*
|
|
41147
|
-
* @
|
|
41853
|
+
* @remarks
|
|
41854
|
+
* Allows the owner of a refiner to update its associated schema ID.
|
|
41855
|
+
* This is useful when refiner output format needs to change.
|
|
41856
|
+
*
|
|
41857
|
+
* @param params - Update parameters
|
|
41858
|
+
* @param params.refinerId - The refiner ID to update
|
|
41859
|
+
* @param params.newSchemaId - The new schema ID to set
|
|
41148
41860
|
* @returns Promise resolving to the transaction hash
|
|
41861
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
41862
|
+
* @throws {Error} When transaction fails - "Failed to update schema ID: {error}"
|
|
41863
|
+
* @example
|
|
41864
|
+
* ```typescript
|
|
41865
|
+
* const result = await vana.data.updateSchemaId({
|
|
41866
|
+
* refinerId: 1,
|
|
41867
|
+
* newSchemaId: 55
|
|
41868
|
+
* });
|
|
41869
|
+
* console.log(`Schema updated in tx ${result.transactionHash}`);
|
|
41870
|
+
* ```
|
|
41149
41871
|
*/
|
|
41150
41872
|
async updateSchemaId(params) {
|
|
41151
41873
|
try {
|
|
@@ -41341,8 +42063,7 @@ var DataController = class {
|
|
|
41341
42063
|
* ```
|
|
41342
42064
|
*/
|
|
41343
42065
|
async addPermissionToFile(fileId, account, publicKey) {
|
|
41344
|
-
|
|
41345
|
-
return parseTransactionResult(this.context, txHash, "addFilePermission");
|
|
42066
|
+
return await this.submitFilePermission(fileId, account, publicKey);
|
|
41346
42067
|
}
|
|
41347
42068
|
/**
|
|
41348
42069
|
* Submits a file permission transaction and returns the transaction hash immediately.
|
|
@@ -41386,7 +42107,11 @@ var DataController = class {
|
|
|
41386
42107
|
account: this.context.walletClient.account || await this.getUserAddress(),
|
|
41387
42108
|
chain: this.context.walletClient.chain || null
|
|
41388
42109
|
});
|
|
41389
|
-
return
|
|
42110
|
+
return new TransactionHandle(
|
|
42111
|
+
this.context,
|
|
42112
|
+
txHash,
|
|
42113
|
+
"addFilePermission"
|
|
42114
|
+
);
|
|
41390
42115
|
} catch (error) {
|
|
41391
42116
|
console.error("Failed to add permission to file:", error);
|
|
41392
42117
|
throw new Error(
|
|
@@ -41757,8 +42482,203 @@ var DataController = class {
|
|
|
41757
42482
|
}
|
|
41758
42483
|
};
|
|
41759
42484
|
|
|
42485
|
+
// src/generated/subgraph.ts
|
|
42486
|
+
var GetSchemaDocument = {
|
|
42487
|
+
kind: "Document",
|
|
42488
|
+
definitions: [
|
|
42489
|
+
{
|
|
42490
|
+
kind: "OperationDefinition",
|
|
42491
|
+
operation: "query",
|
|
42492
|
+
name: { kind: "Name", value: "GetSchema" },
|
|
42493
|
+
variableDefinitions: [
|
|
42494
|
+
{
|
|
42495
|
+
kind: "VariableDefinition",
|
|
42496
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "id" } },
|
|
42497
|
+
type: {
|
|
42498
|
+
kind: "NonNullType",
|
|
42499
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "ID" } }
|
|
42500
|
+
}
|
|
42501
|
+
}
|
|
42502
|
+
],
|
|
42503
|
+
selectionSet: {
|
|
42504
|
+
kind: "SelectionSet",
|
|
42505
|
+
selections: [
|
|
42506
|
+
{
|
|
42507
|
+
kind: "Field",
|
|
42508
|
+
name: { kind: "Name", value: "schema" },
|
|
42509
|
+
arguments: [
|
|
42510
|
+
{
|
|
42511
|
+
kind: "Argument",
|
|
42512
|
+
name: { kind: "Name", value: "id" },
|
|
42513
|
+
value: {
|
|
42514
|
+
kind: "Variable",
|
|
42515
|
+
name: { kind: "Name", value: "id" }
|
|
42516
|
+
}
|
|
42517
|
+
}
|
|
42518
|
+
],
|
|
42519
|
+
selectionSet: {
|
|
42520
|
+
kind: "SelectionSet",
|
|
42521
|
+
selections: [
|
|
42522
|
+
{ kind: "Field", name: { kind: "Name", value: "id" } },
|
|
42523
|
+
{ kind: "Field", name: { kind: "Name", value: "name" } },
|
|
42524
|
+
{ kind: "Field", name: { kind: "Name", value: "dialect" } },
|
|
42525
|
+
{
|
|
42526
|
+
kind: "Field",
|
|
42527
|
+
name: { kind: "Name", value: "definitionUrl" }
|
|
42528
|
+
},
|
|
42529
|
+
{ kind: "Field", name: { kind: "Name", value: "createdAt" } },
|
|
42530
|
+
{
|
|
42531
|
+
kind: "Field",
|
|
42532
|
+
name: { kind: "Name", value: "createdAtBlock" }
|
|
42533
|
+
},
|
|
42534
|
+
{
|
|
42535
|
+
kind: "Field",
|
|
42536
|
+
name: { kind: "Name", value: "createdTxHash" }
|
|
42537
|
+
},
|
|
42538
|
+
{
|
|
42539
|
+
kind: "Field",
|
|
42540
|
+
name: { kind: "Name", value: "refiners" },
|
|
42541
|
+
selectionSet: {
|
|
42542
|
+
kind: "SelectionSet",
|
|
42543
|
+
selections: [
|
|
42544
|
+
{ kind: "Field", name: { kind: "Name", value: "id" } },
|
|
42545
|
+
{ kind: "Field", name: { kind: "Name", value: "name" } },
|
|
42546
|
+
{ kind: "Field", name: { kind: "Name", value: "owner" } }
|
|
42547
|
+
]
|
|
42548
|
+
}
|
|
42549
|
+
}
|
|
42550
|
+
]
|
|
42551
|
+
}
|
|
42552
|
+
}
|
|
42553
|
+
]
|
|
42554
|
+
}
|
|
42555
|
+
}
|
|
42556
|
+
]
|
|
42557
|
+
};
|
|
42558
|
+
var ListSchemasDocument = {
|
|
42559
|
+
kind: "Document",
|
|
42560
|
+
definitions: [
|
|
42561
|
+
{
|
|
42562
|
+
kind: "OperationDefinition",
|
|
42563
|
+
operation: "query",
|
|
42564
|
+
name: { kind: "Name", value: "ListSchemas" },
|
|
42565
|
+
variableDefinitions: [
|
|
42566
|
+
{
|
|
42567
|
+
kind: "VariableDefinition",
|
|
42568
|
+
variable: {
|
|
42569
|
+
kind: "Variable",
|
|
42570
|
+
name: { kind: "Name", value: "first" }
|
|
42571
|
+
},
|
|
42572
|
+
type: {
|
|
42573
|
+
kind: "NonNullType",
|
|
42574
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }
|
|
42575
|
+
}
|
|
42576
|
+
},
|
|
42577
|
+
{
|
|
42578
|
+
kind: "VariableDefinition",
|
|
42579
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "skip" } },
|
|
42580
|
+
type: {
|
|
42581
|
+
kind: "NonNullType",
|
|
42582
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }
|
|
42583
|
+
}
|
|
42584
|
+
}
|
|
42585
|
+
],
|
|
42586
|
+
selectionSet: {
|
|
42587
|
+
kind: "SelectionSet",
|
|
42588
|
+
selections: [
|
|
42589
|
+
{
|
|
42590
|
+
kind: "Field",
|
|
42591
|
+
name: { kind: "Name", value: "schemas" },
|
|
42592
|
+
arguments: [
|
|
42593
|
+
{
|
|
42594
|
+
kind: "Argument",
|
|
42595
|
+
name: { kind: "Name", value: "first" },
|
|
42596
|
+
value: {
|
|
42597
|
+
kind: "Variable",
|
|
42598
|
+
name: { kind: "Name", value: "first" }
|
|
42599
|
+
}
|
|
42600
|
+
},
|
|
42601
|
+
{
|
|
42602
|
+
kind: "Argument",
|
|
42603
|
+
name: { kind: "Name", value: "skip" },
|
|
42604
|
+
value: {
|
|
42605
|
+
kind: "Variable",
|
|
42606
|
+
name: { kind: "Name", value: "skip" }
|
|
42607
|
+
}
|
|
42608
|
+
},
|
|
42609
|
+
{
|
|
42610
|
+
kind: "Argument",
|
|
42611
|
+
name: { kind: "Name", value: "orderBy" },
|
|
42612
|
+
value: { kind: "EnumValue", value: "createdAt" }
|
|
42613
|
+
},
|
|
42614
|
+
{
|
|
42615
|
+
kind: "Argument",
|
|
42616
|
+
name: { kind: "Name", value: "orderDirection" },
|
|
42617
|
+
value: { kind: "EnumValue", value: "desc" }
|
|
42618
|
+
}
|
|
42619
|
+
],
|
|
42620
|
+
selectionSet: {
|
|
42621
|
+
kind: "SelectionSet",
|
|
42622
|
+
selections: [
|
|
42623
|
+
{ kind: "Field", name: { kind: "Name", value: "id" } },
|
|
42624
|
+
{ kind: "Field", name: { kind: "Name", value: "name" } },
|
|
42625
|
+
{ kind: "Field", name: { kind: "Name", value: "dialect" } },
|
|
42626
|
+
{
|
|
42627
|
+
kind: "Field",
|
|
42628
|
+
name: { kind: "Name", value: "definitionUrl" }
|
|
42629
|
+
},
|
|
42630
|
+
{ kind: "Field", name: { kind: "Name", value: "createdAt" } },
|
|
42631
|
+
{
|
|
42632
|
+
kind: "Field",
|
|
42633
|
+
name: { kind: "Name", value: "createdAtBlock" }
|
|
42634
|
+
},
|
|
42635
|
+
{
|
|
42636
|
+
kind: "Field",
|
|
42637
|
+
name: { kind: "Name", value: "createdTxHash" }
|
|
42638
|
+
}
|
|
42639
|
+
]
|
|
42640
|
+
}
|
|
42641
|
+
}
|
|
42642
|
+
]
|
|
42643
|
+
}
|
|
42644
|
+
}
|
|
42645
|
+
]
|
|
42646
|
+
};
|
|
42647
|
+
var CountSchemasDocument = {
|
|
42648
|
+
kind: "Document",
|
|
42649
|
+
definitions: [
|
|
42650
|
+
{
|
|
42651
|
+
kind: "OperationDefinition",
|
|
42652
|
+
operation: "query",
|
|
42653
|
+
name: { kind: "Name", value: "CountSchemas" },
|
|
42654
|
+
selectionSet: {
|
|
42655
|
+
kind: "SelectionSet",
|
|
42656
|
+
selections: [
|
|
42657
|
+
{
|
|
42658
|
+
kind: "Field",
|
|
42659
|
+
name: { kind: "Name", value: "schemas" },
|
|
42660
|
+
arguments: [
|
|
42661
|
+
{
|
|
42662
|
+
kind: "Argument",
|
|
42663
|
+
name: { kind: "Name", value: "first" },
|
|
42664
|
+
value: { kind: "IntValue", value: "1000" }
|
|
42665
|
+
}
|
|
42666
|
+
],
|
|
42667
|
+
selectionSet: {
|
|
42668
|
+
kind: "SelectionSet",
|
|
42669
|
+
selections: [
|
|
42670
|
+
{ kind: "Field", name: { kind: "Name", value: "id" } }
|
|
42671
|
+
]
|
|
42672
|
+
}
|
|
42673
|
+
}
|
|
42674
|
+
]
|
|
42675
|
+
}
|
|
42676
|
+
}
|
|
42677
|
+
]
|
|
42678
|
+
};
|
|
42679
|
+
|
|
41760
42680
|
// src/controllers/schemas.ts
|
|
41761
|
-
import {
|
|
42681
|
+
import { print } from "graphql";
|
|
41762
42682
|
var SchemaController = class {
|
|
41763
42683
|
constructor(context) {
|
|
41764
42684
|
this.context = context;
|
|
@@ -41860,30 +42780,14 @@ var SchemaController = class {
|
|
|
41860
42780
|
account: this.context.walletClient.account || userAddress,
|
|
41861
42781
|
chain: this.context.walletClient.chain || null
|
|
41862
42782
|
});
|
|
41863
|
-
const
|
|
41864
|
-
|
|
41865
|
-
|
|
41866
|
-
|
|
41867
|
-
// 30 seconds timeout
|
|
41868
|
-
}
|
|
42783
|
+
const txHandle = new TransactionHandle(
|
|
42784
|
+
this.context,
|
|
42785
|
+
txHash,
|
|
42786
|
+
"addSchema"
|
|
41869
42787
|
);
|
|
41870
|
-
|
|
41871
|
-
for (const log of receipt.logs) {
|
|
41872
|
-
try {
|
|
41873
|
-
const decoded = decodeEventLog2({
|
|
41874
|
-
abi: dataRefinerRegistryAbi,
|
|
41875
|
-
data: log.data,
|
|
41876
|
-
topics: log.topics
|
|
41877
|
-
});
|
|
41878
|
-
if (decoded.eventName === "SchemaAdded") {
|
|
41879
|
-
schemaId = Number(decoded.args.schemaId);
|
|
41880
|
-
break;
|
|
41881
|
-
}
|
|
41882
|
-
} catch {
|
|
41883
|
-
}
|
|
41884
|
-
}
|
|
42788
|
+
const result = await txHandle.waitForEvents();
|
|
41885
42789
|
return {
|
|
41886
|
-
schemaId,
|
|
42790
|
+
schemaId: Number(result.schemaId),
|
|
41887
42791
|
definitionUrl: uploadResult.url,
|
|
41888
42792
|
transactionHash: txHash
|
|
41889
42793
|
};
|
|
@@ -41900,15 +42804,30 @@ var SchemaController = class {
|
|
|
41900
42804
|
* Retrieves a schema by its ID.
|
|
41901
42805
|
*
|
|
41902
42806
|
* @param schemaId - The ID of the schema to retrieve
|
|
42807
|
+
* @param options - Optional parameters
|
|
42808
|
+
* @param options.subgraphUrl - Custom subgraph URL to use instead of default
|
|
41903
42809
|
* @returns Promise resolving to the schema object
|
|
41904
42810
|
* @throws {Error} When the schema is not found or chain is unavailable
|
|
41905
42811
|
* @example
|
|
41906
42812
|
* ```typescript
|
|
41907
42813
|
* const schema = await vana.schemas.get(1);
|
|
41908
42814
|
* console.log(`Schema: ${schema.name} (${schema.type})`);
|
|
42815
|
+
*
|
|
42816
|
+
* // With custom subgraph
|
|
42817
|
+
* const schema = await vana.schemas.get(1, {
|
|
42818
|
+
* subgraphUrl: 'https://custom-subgraph.com/graphql'
|
|
42819
|
+
* });
|
|
41909
42820
|
* ```
|
|
41910
42821
|
*/
|
|
41911
|
-
async get(schemaId) {
|
|
42822
|
+
async get(schemaId, options = {}) {
|
|
42823
|
+
const subgraphUrl = options.subgraphUrl || this.context.subgraphUrl;
|
|
42824
|
+
if (subgraphUrl) {
|
|
42825
|
+
try {
|
|
42826
|
+
return await this._getSchemaViaSubgraph({ schemaId, subgraphUrl });
|
|
42827
|
+
} catch (error) {
|
|
42828
|
+
console.debug("Subgraph query failed, falling back to RPC:", error);
|
|
42829
|
+
}
|
|
42830
|
+
}
|
|
41912
42831
|
try {
|
|
41913
42832
|
return await fetchSchemaFromChain(this.context, schemaId);
|
|
41914
42833
|
} catch (error) {
|
|
@@ -41920,15 +42839,30 @@ var SchemaController = class {
|
|
|
41920
42839
|
/**
|
|
41921
42840
|
* Gets the total number of schemas registered on the network.
|
|
41922
42841
|
*
|
|
42842
|
+
* @param options - Optional parameters
|
|
42843
|
+
* @param options.subgraphUrl - Custom subgraph URL to use instead of default
|
|
41923
42844
|
* @returns Promise resolving to the total schema count
|
|
41924
42845
|
* @throws {Error} When the count cannot be retrieved
|
|
41925
42846
|
* @example
|
|
41926
42847
|
* ```typescript
|
|
41927
42848
|
* const count = await vana.schemas.count();
|
|
41928
42849
|
* console.log(`Total schemas: ${count}`);
|
|
42850
|
+
*
|
|
42851
|
+
* // With custom subgraph
|
|
42852
|
+
* const count = await vana.schemas.count({
|
|
42853
|
+
* subgraphUrl: 'https://custom-subgraph.com/graphql'
|
|
42854
|
+
* });
|
|
41929
42855
|
* ```
|
|
41930
42856
|
*/
|
|
41931
|
-
async count() {
|
|
42857
|
+
async count(options = {}) {
|
|
42858
|
+
const subgraphUrl = options.subgraphUrl || this.context.subgraphUrl;
|
|
42859
|
+
if (subgraphUrl) {
|
|
42860
|
+
try {
|
|
42861
|
+
return await this._countSchemasViaSubgraph({ subgraphUrl });
|
|
42862
|
+
} catch (error) {
|
|
42863
|
+
console.debug("Subgraph query failed, falling back to RPC:", error);
|
|
42864
|
+
}
|
|
42865
|
+
}
|
|
41932
42866
|
try {
|
|
41933
42867
|
return await fetchSchemaCountFromChain(this.context);
|
|
41934
42868
|
} catch (error) {
|
|
@@ -41943,6 +42877,7 @@ var SchemaController = class {
|
|
|
41943
42877
|
* @param options - Optional parameters for listing schemas
|
|
41944
42878
|
* @param options.limit - Maximum number of schemas to return
|
|
41945
42879
|
* @param options.offset - Number of schemas to skip
|
|
42880
|
+
* @param options.subgraphUrl - Custom subgraph URL to use instead of default
|
|
41946
42881
|
* @returns Promise resolving to an array of schemas
|
|
41947
42882
|
* @example
|
|
41948
42883
|
* ```typescript
|
|
@@ -41951,23 +42886,78 @@ var SchemaController = class {
|
|
|
41951
42886
|
*
|
|
41952
42887
|
* // Get schemas with pagination
|
|
41953
42888
|
* const schemas = await vana.schemas.list({ limit: 10, offset: 0 });
|
|
42889
|
+
*
|
|
42890
|
+
* // With custom subgraph
|
|
42891
|
+
* const schemas = await vana.schemas.list({
|
|
42892
|
+
* limit: 10,
|
|
42893
|
+
* offset: 0,
|
|
42894
|
+
* subgraphUrl: 'https://custom-subgraph.com/graphql'
|
|
42895
|
+
* });
|
|
41954
42896
|
* ```
|
|
41955
42897
|
*/
|
|
41956
42898
|
async list(options = {}) {
|
|
41957
42899
|
const { limit = 100, offset = 0 } = options;
|
|
42900
|
+
const subgraphUrl = options.subgraphUrl || this.context.subgraphUrl;
|
|
42901
|
+
if (subgraphUrl) {
|
|
42902
|
+
try {
|
|
42903
|
+
return await this._listSchemasViaSubgraph({
|
|
42904
|
+
limit,
|
|
42905
|
+
offset,
|
|
42906
|
+
subgraphUrl
|
|
42907
|
+
});
|
|
42908
|
+
} catch (error) {
|
|
42909
|
+
console.debug("Subgraph query failed, falling back to RPC:", error);
|
|
42910
|
+
}
|
|
42911
|
+
}
|
|
41958
42912
|
try {
|
|
41959
42913
|
const totalCount = await this.count();
|
|
41960
|
-
const schemas = [];
|
|
41961
42914
|
const start = offset;
|
|
41962
42915
|
const end = Math.min(start + limit, totalCount);
|
|
42916
|
+
if (end <= start) {
|
|
42917
|
+
return [];
|
|
42918
|
+
}
|
|
42919
|
+
const chainId = this.context.walletClient.chain?.id;
|
|
42920
|
+
if (!chainId) {
|
|
42921
|
+
throw new Error("Chain ID not available");
|
|
42922
|
+
}
|
|
42923
|
+
const dataRefinerRegistryAddress = getContractAddress(
|
|
42924
|
+
chainId,
|
|
42925
|
+
"DataRefinerRegistry"
|
|
42926
|
+
);
|
|
42927
|
+
const dataRefinerRegistryAbi = getAbi("DataRefinerRegistry");
|
|
42928
|
+
const schemaCalls = [];
|
|
41963
42929
|
for (let i = start; i < end; i++) {
|
|
41964
|
-
|
|
41965
|
-
|
|
41966
|
-
|
|
41967
|
-
|
|
41968
|
-
|
|
41969
|
-
|
|
42930
|
+
schemaCalls.push({
|
|
42931
|
+
address: dataRefinerRegistryAddress,
|
|
42932
|
+
abi: dataRefinerRegistryAbi,
|
|
42933
|
+
functionName: "schemas",
|
|
42934
|
+
args: [BigInt(i + 1)]
|
|
42935
|
+
// Schema IDs are 1-based
|
|
42936
|
+
});
|
|
41970
42937
|
}
|
|
42938
|
+
const schemaResults = await gasAwareMulticall(this.context.publicClient, {
|
|
42939
|
+
contracts: schemaCalls,
|
|
42940
|
+
allowFailure: true
|
|
42941
|
+
});
|
|
42942
|
+
const schemas = [];
|
|
42943
|
+
schemaResults.forEach((result, index) => {
|
|
42944
|
+
if (result.status === "success" && result.result) {
|
|
42945
|
+
const schemaId = start + index + 1;
|
|
42946
|
+
const schemaData = result.result;
|
|
42947
|
+
if (schemaData.name && schemaData.dialect && schemaData.definitionUrl) {
|
|
42948
|
+
schemas.push({
|
|
42949
|
+
id: schemaId,
|
|
42950
|
+
name: schemaData.name,
|
|
42951
|
+
dialect: schemaData.dialect,
|
|
42952
|
+
definitionUrl: schemaData.definitionUrl
|
|
42953
|
+
});
|
|
42954
|
+
} else {
|
|
42955
|
+
console.warn(`Incomplete schema data for ID ${schemaId}`);
|
|
42956
|
+
}
|
|
42957
|
+
} else {
|
|
42958
|
+
console.warn(`Failed to retrieve schema ${start + index + 1}`);
|
|
42959
|
+
}
|
|
42960
|
+
});
|
|
41971
42961
|
return schemas;
|
|
41972
42962
|
} catch (error) {
|
|
41973
42963
|
throw new Error(
|
|
@@ -41998,7 +42988,7 @@ var SchemaController = class {
|
|
|
41998
42988
|
address: dataRefinerRegistryAddress,
|
|
41999
42989
|
abi: dataRefinerRegistryAbi,
|
|
42000
42990
|
functionName: "addSchema",
|
|
42001
|
-
args: [params.name, params.
|
|
42991
|
+
args: [params.name, params.dialect, params.definitionUrl],
|
|
42002
42992
|
account: this.context.walletClient.account || userAddress,
|
|
42003
42993
|
chain: this.context.walletClient.chain || null
|
|
42004
42994
|
});
|
|
@@ -42013,6 +43003,119 @@ var SchemaController = class {
|
|
|
42013
43003
|
);
|
|
42014
43004
|
}
|
|
42015
43005
|
}
|
|
43006
|
+
/**
|
|
43007
|
+
* Internal method: Query schema via subgraph
|
|
43008
|
+
*
|
|
43009
|
+
* @param params - Query parameters
|
|
43010
|
+
* @param params.schemaId - The ID of the schema to retrieve
|
|
43011
|
+
* @param params.subgraphUrl - The subgraph URL to query
|
|
43012
|
+
* @returns Promise resolving to the schema object
|
|
43013
|
+
* @private
|
|
43014
|
+
*/
|
|
43015
|
+
async _getSchemaViaSubgraph(params) {
|
|
43016
|
+
const { schemaId, subgraphUrl } = params;
|
|
43017
|
+
const response = await fetch(subgraphUrl, {
|
|
43018
|
+
method: "POST",
|
|
43019
|
+
headers: { "Content-Type": "application/json" },
|
|
43020
|
+
body: JSON.stringify({
|
|
43021
|
+
query: print(GetSchemaDocument),
|
|
43022
|
+
variables: { id: schemaId.toString() }
|
|
43023
|
+
})
|
|
43024
|
+
});
|
|
43025
|
+
if (!response.ok) {
|
|
43026
|
+
throw new Error(
|
|
43027
|
+
`Subgraph request failed: ${response.status} ${response.statusText}`
|
|
43028
|
+
);
|
|
43029
|
+
}
|
|
43030
|
+
const result = await response.json();
|
|
43031
|
+
if (result.errors) {
|
|
43032
|
+
throw new Error(
|
|
43033
|
+
`Subgraph query errors: ${result.errors.map((e) => e.message).join(", ")}`
|
|
43034
|
+
);
|
|
43035
|
+
}
|
|
43036
|
+
if (!result.data?.schema) {
|
|
43037
|
+
throw new Error(`Schema ${schemaId} not found in subgraph`);
|
|
43038
|
+
}
|
|
43039
|
+
const subgraphSchema = result.data.schema;
|
|
43040
|
+
return {
|
|
43041
|
+
id: parseInt(subgraphSchema.id),
|
|
43042
|
+
name: subgraphSchema.name,
|
|
43043
|
+
dialect: subgraphSchema.dialect,
|
|
43044
|
+
definitionUrl: subgraphSchema.definitionUrl
|
|
43045
|
+
};
|
|
43046
|
+
}
|
|
43047
|
+
/**
|
|
43048
|
+
* Internal method: List schemas via subgraph
|
|
43049
|
+
*
|
|
43050
|
+
* @param params - Query parameters
|
|
43051
|
+
* @param params.limit - Maximum number of schemas to return
|
|
43052
|
+
* @param params.offset - Number of schemas to skip
|
|
43053
|
+
* @param params.subgraphUrl - The subgraph URL to query
|
|
43054
|
+
* @returns Promise resolving to an array of schemas
|
|
43055
|
+
* @private
|
|
43056
|
+
*/
|
|
43057
|
+
async _listSchemasViaSubgraph(params) {
|
|
43058
|
+
const { limit, offset, subgraphUrl } = params;
|
|
43059
|
+
const response = await fetch(subgraphUrl, {
|
|
43060
|
+
method: "POST",
|
|
43061
|
+
headers: { "Content-Type": "application/json" },
|
|
43062
|
+
body: JSON.stringify({
|
|
43063
|
+
query: print(ListSchemasDocument),
|
|
43064
|
+
variables: { first: limit, skip: offset }
|
|
43065
|
+
})
|
|
43066
|
+
});
|
|
43067
|
+
if (!response.ok) {
|
|
43068
|
+
throw new Error(
|
|
43069
|
+
`Subgraph request failed: ${response.status} ${response.statusText}`
|
|
43070
|
+
);
|
|
43071
|
+
}
|
|
43072
|
+
const result = await response.json();
|
|
43073
|
+
if (result.errors) {
|
|
43074
|
+
throw new Error(
|
|
43075
|
+
`Subgraph query errors: ${result.errors.map((e) => e.message).join(", ")}`
|
|
43076
|
+
);
|
|
43077
|
+
}
|
|
43078
|
+
if (!result.data?.schemas) {
|
|
43079
|
+
return [];
|
|
43080
|
+
}
|
|
43081
|
+
return result.data.schemas.map((schema) => ({
|
|
43082
|
+
id: parseInt(schema.id),
|
|
43083
|
+
name: schema.name,
|
|
43084
|
+
dialect: schema.dialect,
|
|
43085
|
+
definitionUrl: schema.definitionUrl
|
|
43086
|
+
}));
|
|
43087
|
+
}
|
|
43088
|
+
/**
|
|
43089
|
+
* Internal method: Count schemas via subgraph
|
|
43090
|
+
*
|
|
43091
|
+
* @param params - Query parameters
|
|
43092
|
+
* @param params.subgraphUrl - The subgraph URL to query
|
|
43093
|
+
* @returns Promise resolving to the total schema count
|
|
43094
|
+
* @private
|
|
43095
|
+
*/
|
|
43096
|
+
async _countSchemasViaSubgraph(params) {
|
|
43097
|
+
const { subgraphUrl } = params;
|
|
43098
|
+
const response = await fetch(subgraphUrl, {
|
|
43099
|
+
method: "POST",
|
|
43100
|
+
headers: { "Content-Type": "application/json" },
|
|
43101
|
+
body: JSON.stringify({
|
|
43102
|
+
query: print(CountSchemasDocument),
|
|
43103
|
+
variables: {}
|
|
43104
|
+
})
|
|
43105
|
+
});
|
|
43106
|
+
if (!response.ok) {
|
|
43107
|
+
throw new Error(
|
|
43108
|
+
`Subgraph request failed: ${response.status} ${response.statusText}`
|
|
43109
|
+
);
|
|
43110
|
+
}
|
|
43111
|
+
const result = await response.json();
|
|
43112
|
+
if (result.errors) {
|
|
43113
|
+
throw new Error(
|
|
43114
|
+
`Subgraph query errors: ${result.errors.map((e) => e.message).join(", ")}`
|
|
43115
|
+
);
|
|
43116
|
+
}
|
|
43117
|
+
return result.data?.schemas?.length || 0;
|
|
43118
|
+
}
|
|
42016
43119
|
/**
|
|
42017
43120
|
* Gets the user's wallet address.
|
|
42018
43121
|
*
|
|
@@ -42453,7 +43556,12 @@ var chains = {
|
|
|
42453
43556
|
};
|
|
42454
43557
|
|
|
42455
43558
|
// src/core/client.ts
|
|
42456
|
-
var
|
|
43559
|
+
var defaultFromBlocks = {
|
|
43560
|
+
14800: BigInt(732312),
|
|
43561
|
+
// Moksha Testnet - earliest contract deployment
|
|
43562
|
+
1480: BigInt(758584)
|
|
43563
|
+
// Vana Mainnet - earliest contract deployment
|
|
43564
|
+
};
|
|
42457
43565
|
var _client;
|
|
42458
43566
|
var createClient = (chainId = mokshaTestnet.id) => {
|
|
42459
43567
|
if (!_client || _client.chain?.id !== chainId) {
|
|
@@ -44098,7 +45206,7 @@ var vanaMainnet2 = {
|
|
|
44098
45206
|
url: "https://vanascan.io"
|
|
44099
45207
|
}
|
|
44100
45208
|
},
|
|
44101
|
-
subgraphUrl: "https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/vana/7.0.
|
|
45209
|
+
subgraphUrl: "https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/vana/7.0.7/gn"
|
|
44102
45210
|
};
|
|
44103
45211
|
var moksha = {
|
|
44104
45212
|
id: 14800,
|
|
@@ -44119,7 +45227,7 @@ var moksha = {
|
|
|
44119
45227
|
url: "https://moksha.vanascan.io"
|
|
44120
45228
|
}
|
|
44121
45229
|
},
|
|
44122
|
-
subgraphUrl: "https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/moksha/7.0.
|
|
45230
|
+
subgraphUrl: "https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/moksha/7.0.7/gn"
|
|
44123
45231
|
};
|
|
44124
45232
|
function getChainConfig(chainId) {
|
|
44125
45233
|
switch (chainId) {
|
|
@@ -45099,37 +46207,37 @@ async function handleRelayerRequest(sdk, payload) {
|
|
|
45099
46207
|
}
|
|
45100
46208
|
switch (typedData.primaryType) {
|
|
45101
46209
|
case "Permission":
|
|
45102
|
-
return
|
|
46210
|
+
return sdk.permissions.submitSignedGrant(
|
|
45103
46211
|
typedData,
|
|
45104
46212
|
signature
|
|
45105
46213
|
);
|
|
45106
46214
|
case "PermissionRevoke":
|
|
45107
|
-
return
|
|
46215
|
+
return sdk.permissions.submitSignedRevoke(
|
|
45108
46216
|
typedData,
|
|
45109
46217
|
signature
|
|
45110
46218
|
);
|
|
45111
46219
|
case "TrustServer":
|
|
45112
|
-
return
|
|
46220
|
+
return sdk.permissions.submitSignedTrustServer(
|
|
45113
46221
|
typedData,
|
|
45114
46222
|
signature
|
|
45115
46223
|
);
|
|
45116
46224
|
case "AddServer":
|
|
45117
|
-
return
|
|
46225
|
+
return sdk.permissions.submitSignedAddAndTrustServer(
|
|
45118
46226
|
typedData,
|
|
45119
46227
|
signature
|
|
45120
46228
|
);
|
|
45121
46229
|
case "UntrustServer":
|
|
45122
|
-
return
|
|
46230
|
+
return sdk.permissions.submitSignedUntrustServer(
|
|
45123
46231
|
typedData,
|
|
45124
46232
|
signature
|
|
45125
46233
|
);
|
|
45126
46234
|
case "RegisterGrantee":
|
|
45127
|
-
return
|
|
46235
|
+
return sdk.permissions.submitSignedRegisterGrantee(
|
|
45128
46236
|
typedData,
|
|
45129
46237
|
signature
|
|
45130
46238
|
);
|
|
45131
46239
|
case "ServerFilesAndPermission":
|
|
45132
|
-
return
|
|
46240
|
+
return sdk.permissions.submitSignedAddServerFilesAndPermissions(
|
|
45133
46241
|
typedData,
|
|
45134
46242
|
signature
|
|
45135
46243
|
);
|
|
@@ -45592,6 +46700,7 @@ export {
|
|
|
45592
46700
|
SignatureError,
|
|
45593
46701
|
StorageError,
|
|
45594
46702
|
StorageManager,
|
|
46703
|
+
TransactionHandle,
|
|
45595
46704
|
UserRejectedRequestError,
|
|
45596
46705
|
Vana,
|
|
45597
46706
|
VanaCore,
|