Skip to content

Commit 7e9628f

Browse files
committed
fix(linter): permissions directory
1 parent 2c703e8 commit 7e9628f

File tree

12 files changed

+123
-125
lines changed

12 files changed

+123
-125
lines changed

packages/networks/src/lib/networks/vNaga/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedActions.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// import { networkContext } from "../../../_config";
2-
import { NagaContext } from "services/lit/LitNetwork/vNaga/types";
3-
import { toBigInt } from "services/lit/utils/z-transformers";
4-
import { logger } from "utils/logger";
5-
import { z } from "zod";
6-
import { createLitContracts } from "../../../utils/createLitContracts";
2+
import { NagaContext } from '../../../../../../types';
3+
import { z } from 'zod';
4+
import { logger } from '../../../../../../../shared/logger';
5+
import { toBigInt } from '../../../../../../../shared/utils/z-transformers';
6+
import { createLitContracts } from '../../../utils/createLitContracts';
77

88
const getPermittedActionsSchema = z.object({
99
tokenId: toBigInt,

packages/networks/src/lib/networks/vNaga/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAddresses.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// import { networkContext } from "../../../_config";
2-
import { NagaContext } from "services/lit/LitNetwork/vNaga/types";
3-
import { toBigInt } from "services/lit/utils/z-transformers";
4-
import { logger } from "utils/logger";
5-
import { z } from "zod";
6-
import { createLitContracts } from "../../../utils/createLitContracts";
2+
import { z } from 'zod';
3+
import { logger } from '../../../../../../../shared/logger';
4+
import { toBigInt } from '../../../../../../../shared/utils/z-transformers';
5+
import { NagaContext } from '../../../../../../types';
6+
import { createLitContracts } from '../../../utils/createLitContracts';
77

88
const getPermittedAddressesSchema = z.object({
99
tokenId: toBigInt,

packages/networks/src/lib/networks/vNaga/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethodScopes.ts

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// import { networkContext } from "../../../_config";
2-
import { NagaContext } from "services/lit/LitNetwork/vNaga/types";
3-
import { toBigInt } from "services/lit/utils/z-transformers";
4-
import { logger } from "utils/logger";
5-
import { z } from "zod";
6-
import { networkContext } from "../../../../_config";
7-
import { createLitContracts } from "../../../utils/createLitContracts";
2+
import { z } from 'zod';
3+
import { logger } from '../../../../../../../shared/logger';
4+
import { toBigInt } from '../../../../../../../shared/utils/z-transformers';
5+
import { NagaContext } from '../../../../../../types';
6+
import { createLitContracts } from '../../../utils/createLitContracts';
87

98
const getPermittedAuthMethodScopesSchema = z.object({
109
tokenId: toBigInt,
@@ -44,18 +43,18 @@ export async function getPermittedAuthMethodScopes(
4443
}
4544

4645
// Example usage when running as main
47-
if (import.meta.main) {
48-
const networkCtx = networkContext;
46+
// if (import.meta.main) {
47+
// const networkCtx = networkContext;
4948

50-
const res = await getPermittedAuthMethodScopes(
51-
{
52-
tokenId:
53-
"76136736151863037541847315168980811654782785653773679312890341037699996601290",
54-
authMethodType: 1,
55-
authMethodId: "0x1234567890abcdef1234567890abcdef12345678",
56-
// scopeId: 0,
57-
},
58-
networkCtx
59-
);
60-
console.log("permittedAuthMethodScopes", res);
61-
}
49+
// const res = await getPermittedAuthMethodScopes(
50+
// {
51+
// tokenId:
52+
// "76136736151863037541847315168980811654782785653773679312890341037699996601290",
53+
// authMethodType: 1,
54+
// authMethodId: "0x1234567890abcdef1234567890abcdef12345678",
55+
// // scopeId: 0,
56+
// },
57+
// networkCtx
58+
// );
59+
// console.log("permittedAuthMethodScopes", res);
60+
// }

packages/networks/src/lib/networks/vNaga/common/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethods.ts

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// import { networkContext } from "../../../_config";
2-
import { NagaContext } from "services/lit/LitNetwork/vNaga/types";
3-
import { toBigInt } from "services/lit/utils/z-transformers";
4-
import { logger } from "utils/logger";
5-
import { z } from "zod";
6-
import { networkContext } from "../../../../_config";
7-
import { createLitContracts } from "../../../utils/createLitContracts";
2+
import { z } from 'zod';
3+
import { logger } from '../../../../../../../shared/logger';
4+
import { toBigInt } from '../../../../../../../shared/utils/z-transformers';
5+
import { NagaContext } from '../../../../../../types';
6+
import { createLitContracts } from '../../../utils/createLitContracts';
87

98
const getPermittedAuthMethodsSchema = z.object({
109
tokenId: toBigInt,
@@ -43,15 +42,15 @@ export async function getPermittedAuthMethods(
4342
}
4443

4544
// Example usage when running as main
46-
if (import.meta.main) {
47-
const networkCtx = networkContext;
48-
49-
const res = await getPermittedAuthMethods(
50-
{
51-
tokenId:
52-
"76136736151863037541847315168980811654782785653773679312890341037699996601290",
53-
},
54-
networkCtx
55-
);
56-
console.log("permittedAuthMethods", res);
57-
}
45+
// if (import.meta.main) {
46+
// const networkCtx = networkContext;
47+
48+
// const res = await getPermittedAuthMethods(
49+
// {
50+
// tokenId:
51+
// "76136736151863037541847315168980811654782785653773679312890341037699996601290",
52+
// },
53+
// networkCtx
54+
// );
55+
// console.log("permittedAuthMethods", res);
56+
// }

packages/networks/src/lib/networks/vNaga/common/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAction.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// import { networkContext } from "../../../_config";
2-
import { NagaContext } from "services/lit/LitNetwork/vNaga/types";
3-
import { ipfsCidV0ToHex } from "services/lit/utils/transformers/ipfsCidV0ToHex";
4-
import { toBigInt } from "services/lit/utils/z-transformers";
5-
import { isIpfsCidV0 } from "services/lit/utils/z-validate";
6-
import { logger } from "utils/logger";
7-
import { z } from "zod";
8-
import { createLitContracts } from "../../../utils/createLitContracts";
2+
import { z } from 'zod';
3+
import { logger } from '../../../../../../../shared/logger';
4+
import { ipfsCidV0ToHex } from '../../../../../../../shared/utils/transformers/ipfsCidV0ToHex';
5+
import { toBigInt } from '../../../../../../../shared/utils/z-transformers';
6+
import { isIpfsCidV0 } from '../../../../../../../shared/utils/z-validate';
7+
import { NagaContext } from '../../../../../../types';
8+
import { createLitContracts } from '../../../utils/createLitContracts';
99

1010
const isPermittedActionSchema = z
1111
.object({

packages/networks/src/lib/networks/vNaga/common/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAddress.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// import { networkContext } from "../../../_config";
2-
import { NagaContext } from "services/lit/LitNetwork/vNaga/types";
3-
import { toBigInt } from "services/lit/utils/z-transformers";
4-
import { logger } from "utils/logger";
5-
import { z } from "zod";
6-
import { createLitContracts } from "../../../utils/createLitContracts";
2+
import { z } from 'zod';
3+
import { logger } from '../../../../../../../shared/logger';
4+
import { toBigInt } from '../../../../../../../shared/utils/z-transformers';
5+
import { NagaContext } from '../../../../../../types';
6+
import { createLitContracts } from '../../../utils/createLitContracts';
77

88
const isPermittedAddressSchema = z.object({
99
tokenId: toBigInt,

packages/networks/src/lib/networks/vNaga/common/LitChainClient/apis/rawContractApis/permissions/utils/pubkeyToTokenId.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { hexToBigInt, keccak256, toBytes } from "viem";
1+
import { hexToBigInt, keccak256, toBytes } from 'viem';
22

33
/**
44
* Convert a public key to a token ID

packages/networks/src/lib/networks/vNaga/common/LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@
33
* This module provides a consistent way to obtain PKP token IDs regardless of the input format.
44
*/
55

6-
import { NagaContext } from "services/lit/LitNetwork/vNaga/types";
7-
import { toBigInt } from "services/lit/utils/z-transformers";
8-
import { isEthAddress } from "services/lit/utils/z-validate";
9-
import { logger } from "utils/logger";
10-
import { z } from "zod";
11-
import { createLitContracts } from "../../../utils/createLitContracts";
12-
import { pubkeyToTokenId } from "./pubkeyToTokenId";
6+
import { z } from 'zod';
7+
import { logger } from '../../../../../../../shared/logger';
8+
import { toBigInt } from '../../../../../../../shared/utils/z-transformers';
9+
import { isEthAddress } from '../../../../../../../shared/utils/z-validate';
10+
import { NagaContext } from '../../../../../../types';
11+
import { createLitContracts } from '../../../utils/createLitContracts';
12+
import { pubkeyToTokenId } from './pubkeyToTokenId';
1313

1414
// Input validation schema
15-
export const PkpIdentifierSchema = z.discriminatedUnion("field", [
15+
export const PkpIdentifierSchema = z.discriminatedUnion('field', [
1616
z
1717
.object({
18-
field: z.literal("tokenId"),
18+
field: z.literal('tokenId'),
1919
tokenId: toBigInt,
2020
})
2121
.strict(),
2222
z
2323
.object({
24-
field: z.literal("address"),
24+
field: z.literal('address'),
2525
address: isEthAddress,
2626
})
2727
.strict(),
2828
z
2929
.object({
30-
field: z.literal("pubkey"),
30+
field: z.literal('pubkey'),
3131
pubkey: z.string(),
3232
})
3333
.strict(),
@@ -61,23 +61,23 @@ export async function resolvePkpTokenId(
6161
if (providedFields.length !== 1) {
6262
throw new Error(
6363
`Invalid identifier: exactly one of tokenId, address, or pubkey must be provided. Found: ${providedFields.join(
64-
", "
64+
', '
6565
)}`
6666
);
6767
}
6868

6969
// Determine the field type and validate input
7070
const validatedInput = PkpIdentifierSchema.parse({
7171
field:
72-
"tokenId" in identifier
73-
? "tokenId"
74-
: "address" in identifier
75-
? "address"
76-
: "pubkey" in identifier
77-
? "pubkey"
72+
'tokenId' in identifier
73+
? 'tokenId'
74+
: 'address' in identifier
75+
? 'address'
76+
: 'pubkey' in identifier
77+
? 'pubkey'
7878
: (() => {
7979
throw new Error(
80-
"Invalid identifier: must provide tokenId, address, or pubkey"
80+
'Invalid identifier: must provide tokenId, address, or pubkey'
8181
);
8282
})(),
8383
...identifier,
@@ -86,19 +86,19 @@ export async function resolvePkpTokenId(
8686
logger.debug({ validatedInput });
8787

8888
// Handle direct token ID
89-
if (validatedInput.field === "tokenId") {
89+
if (validatedInput.field === 'tokenId') {
9090
return validatedInput.tokenId;
9191
}
9292

9393
// Handle pubkey
94-
if (validatedInput.field === "pubkey") {
94+
if (validatedInput.field === 'pubkey') {
9595
return pubkeyToTokenId(validatedInput.pubkey);
9696
}
9797

9898
// Handle address (requires network context)
99-
if (validatedInput.field === "address") {
99+
if (validatedInput.field === 'address') {
100100
if (!networkCtx) {
101-
throw new Error("Network context required for address resolution");
101+
throw new Error('Network context required for address resolution');
102102
}
103103

104104
const { pubkeyRouterContract } = createLitContracts(networkCtx);
@@ -107,11 +107,11 @@ export async function resolvePkpTokenId(
107107
]);
108108

109109
if (!pkpTokenId) {
110-
throw new Error("PKP token ID not found for address");
110+
throw new Error('PKP token ID not found for address');
111111
}
112112

113113
return pkpTokenId;
114114
}
115115

116-
throw new Error("Unable to resolve PKP token ID");
116+
throw new Error('Unable to resolve PKP token ID');
117117
}

packages/networks/src/lib/networks/vNaga/common/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAction.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// import { networkContext } from "../../../_config";
2-
import { NagaContext } from "services/lit/LitNetwork/vNaga/types";
3-
import { ipfsCidV0ToHex } from "services/lit/utils/transformers/ipfsCidV0ToHex";
4-
import { toBigInt } from "services/lit/utils/z-transformers";
5-
import { isIpfsCidV0 } from "services/lit/utils/z-validate";
6-
import { logger } from "utils/logger";
7-
import { z } from "zod";
8-
import { ScopeSchemaRaw } from "../../../../schemas/shared/ScopeSchema";
9-
import { LitTxVoid } from "../../../types";
10-
import { callWithAdjustedOverrides } from "../../../utils/callWithAdjustedOverrides";
11-
import { createLitContracts } from "../../../utils/createLitContracts";
12-
import { decodeLogs } from "../../../utils/decodeLogs";
2+
import { z } from 'zod';
3+
import { logger } from '../../../../../../../shared/logger';
4+
import { ipfsCidV0ToHex } from '../../../../../../../shared/utils/transformers/ipfsCidV0ToHex';
5+
import { toBigInt } from '../../../../../../../shared/utils/z-transformers';
6+
import { isIpfsCidV0 } from '../../../../../../../shared/utils/z-validate';
7+
import { NagaContext } from '../../../../../../types';
8+
import { ScopeSchemaRaw } from '../../../../schemas/shared/ScopeSchema';
9+
import { LitTxVoid } from '../../../types';
10+
import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides';
11+
import { createLitContracts } from '../../../utils/createLitContracts';
12+
import { decodeLogs } from '../../../utils/decodeLogs';
1313

1414
const addPermittedActionSchema = z
1515
.object({

packages/networks/src/lib/networks/vNaga/common/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAddress.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// import { networkContext } from "../../../_config";
2-
import { NagaContext } from "services/lit/LitNetwork/vNaga/types";
3-
import { toBigInt } from "services/lit/utils/z-transformers";
4-
import { logger } from "utils/logger";
5-
import { z } from "zod";
6-
import { ScopeSchemaRaw } from "../../../../schemas/shared/ScopeSchema";
7-
import { LitTxVoid } from "../../../types";
8-
import { callWithAdjustedOverrides } from "../../../utils/callWithAdjustedOverrides";
9-
import { createLitContracts } from "../../../utils/createLitContracts";
10-
import { decodeLogs } from "../../../utils/decodeLogs";
2+
import { z } from 'zod';
3+
import { logger } from '../../../../../../../shared/logger';
4+
import { toBigInt } from '../../../../../../../shared/utils/z-transformers';
5+
import { NagaContext } from '../../../../../../types';
6+
import { ScopeSchemaRaw } from '../../../../schemas/shared/ScopeSchema';
7+
import { LitTxVoid } from '../../../types';
8+
import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides';
9+
import { createLitContracts } from '../../../utils/createLitContracts';
10+
import { decodeLogs } from '../../../utils/decodeLogs';
1111

1212
const addPermittedAddressSchema = z.object({
1313
tokenId: toBigInt,

0 commit comments

Comments
 (0)