@opendatalabs/vana-sdk 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/controllers/permissions.cjs +19 -14
- package/dist/controllers/permissions.cjs.map +1 -1
- package/dist/controllers/permissions.js +19 -14
- package/dist/controllers/permissions.js.map +1 -1
- package/dist/types/permissions.cjs.map +1 -1
- package/dist/types/permissions.d.ts +2 -0
- package/package.json +1 -1
|
@@ -19,6 +19,7 @@ import { validateGrant } from "../utils/grantValidation";
|
|
|
19
19
|
import { withSignatureCache } from "../utils/signatureCache";
|
|
20
20
|
import { formatSignatureForContract } from "../utils/signatureFormatter";
|
|
21
21
|
import { toViemTypedDataDefinition } from "../utils/typedDataConverter";
|
|
22
|
+
const MAX_UINT256 = 115792089237316195423570985008687907853269984665640564039457584007913129639935n;
|
|
22
23
|
import { BaseController } from "./base";
|
|
23
24
|
class PermissionsController extends BaseController {
|
|
24
25
|
constructor(context) {
|
|
@@ -1476,20 +1477,24 @@ class PermissionsController extends BaseController {
|
|
|
1476
1477
|
}
|
|
1477
1478
|
}
|
|
1478
1479
|
const onChainGrants = allPermissions.map(
|
|
1479
|
-
(permission) =>
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1480
|
+
(permission) => {
|
|
1481
|
+
const endBlock = permission.endBlock === void 0 || permission.endBlock === null ? 0n : BigInt(permission.endBlock);
|
|
1482
|
+
const active = !permission.endBlock || endBlock === 0n || endBlock === MAX_UINT256;
|
|
1483
|
+
return {
|
|
1484
|
+
id: BigInt(permission.id),
|
|
1485
|
+
grantUrl: permission.grant,
|
|
1486
|
+
grantSignature: permission.signature,
|
|
1487
|
+
nonce: BigInt(permission.nonce),
|
|
1488
|
+
startBlock: BigInt(permission.startBlock),
|
|
1489
|
+
endBlock,
|
|
1490
|
+
addedAtBlock: BigInt(permission.addedAtBlock),
|
|
1491
|
+
addedAtTimestamp: BigInt(permission.addedAtTimestamp ?? "0"),
|
|
1492
|
+
transactionHash: permission.transactionHash ?? "",
|
|
1493
|
+
grantor: userAddress,
|
|
1494
|
+
grantee: permission.grantee,
|
|
1495
|
+
active
|
|
1496
|
+
};
|
|
1497
|
+
}
|
|
1493
1498
|
);
|
|
1494
1499
|
return onChainGrants.sort((a, b) => {
|
|
1495
1500
|
if (a.id < b.id) return 1;
|