Skip to content

Commit d38c96f

Browse files
committed
fix(vNaga): fmt
1 parent 51e0ee9 commit d38c96f

File tree

23 files changed

+5446
-5419
lines changed

23 files changed

+5446
-5419
lines changed

packages/networks/src/lib/networks/vNaga/common/LitChainClient/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ The client provides three main API objects:
5151
### Using High-Level API
5252

5353
```typescript
54-
import { LitChainClientAPI } from "../LitChainClient/apis";
54+
import { LitChainClientAPI } from '../LitChainClient/apis';
5555

5656
// Minting a PKP with simplified API
5757
const result = await LitChainClientAPI.mintPKP(
5858
{
5959
authMethod: {
6060
authMethodType: 1,
61-
id: "example-id",
62-
pubkey: "0x...", // webAuthn only
61+
id: 'example-id',
62+
pubkey: '0x...', // webAuthn only
6363
},
6464
},
6565
networkContext
@@ -75,15 +75,15 @@ await permissionsManager.addPermittedAction(tokenId, actionId);
7575
### Using Raw API
7676

7777
```typescript
78-
import { LitChainClientRawAPI } from "../LitChainClient/apis";
78+
import { LitChainClientRawAPI } from '../LitChainClient/apis';
7979

8080
// Using the raw API
8181
const result = await LitChainClientRawAPI.pkp.write.mintNextAndAddAuthMethods(
8282
{
8383
keyType: 2,
8484
permittedAuthMethodTypes: [1],
85-
permittedAuthMethodIds: ["example-id"],
86-
permittedAuthMethodPubkeys: ["0x..."],
85+
permittedAuthMethodIds: ['example-id'],
86+
permittedAuthMethodPubkeys: ['0x...'],
8787
permittedAuthMethodScopes: [[1, 2, 3]],
8888
addPkpEthAddressAsPermittedAddress: true,
8989
sendPkpToItself: false,
@@ -102,7 +102,7 @@ const isPermitted =
102102
### Using Utilities
103103

104104
```typescript
105-
import { LitChainClientUtils } from "../LitChainClient/apis";
105+
import { LitChainClientUtils } from '../LitChainClient/apis';
106106

107107
// Create contract instances
108108
const contracts = LitChainClientUtils.createLitContracts(networkContext);

packages/networks/src/lib/networks/vNaga/common/LitChainClient/_config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ const GAS_LIMIT_INCREASE_PERCENTAGE = 10;
1111
export const GAS_LIMIT_ADJUSTMENT = BigInt(100 + GAS_LIMIT_INCREASE_PERCENTAGE);
1212

1313
export const networkContext = nagaLocalDevelopNetworkContext; // we shall change this later
14+
1415
export type NetworkContext = NagaLocalDevelopNetworkContext;

packages/networks/src/lib/networks/vNaga/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/PKPPermissionsManager.test.ts

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import { networkContext } from "../../../_config";
2-
import { PKPPermissionsManager } from "./PKPPermissionsManager";
1+
import { networkContext } from '../../../_config';
2+
import { PKPPermissionsManager } from './PKPPermissionsManager';
33

44
// Configuration constants
55
const TEST_TOKEN_ID =
6-
"76136736151863037541847315168980811654782785653773679312890341037699996601290";
7-
const PKP_TEST_ADDRESS = "0xef3eE1bD838aF5B36482FAe8a6Fc394C68d5Fa9F";
6+
'76136736151863037541847315168980811654782785653773679312890341037699996601290';
7+
const PKP_TEST_ADDRESS = '0xef3eE1bD838aF5B36482FAe8a6Fc394C68d5Fa9F';
88

9-
const MASTER_ADDRESS = "0xC434D4B9c307111a1CA6752AC47B77C571FcA500";
9+
const MASTER_ADDRESS = '0xC434D4B9c307111a1CA6752AC47B77C571FcA500';
1010

1111
// Using valid IPFS CID format for v0 (Qm... format)
12-
const TEST_ACTION_IPFS_ID = "QmPK1s3pNYLi9ERiq3BDxKa4XosgWwFRQUydHUtz4YgpqB";
12+
const TEST_ACTION_IPFS_ID = 'QmPK1s3pNYLi9ERiq3BDxKa4XosgWwFRQUydHUtz4YgpqB';
1313
// Add a hex version of the IPFS ID for comparisons
1414
const TEST_ACTION_IPFS_ID_HEX =
15-
"0x12200e7071c59df3b9454d1d18a15270aa36d54f89606a576dc621757afd44ad1d2e";
15+
'0x12200e7071c59df3b9454d1d18a15270aa36d54f89606a576dc621757afd44ad1d2e';
1616

17-
describe("PKPPermissionsManager", () => {
17+
describe('PKPPermissionsManager', () => {
1818
let manager: PKPPermissionsManager;
1919

2020
// Set up the test environment
@@ -25,42 +25,42 @@ describe("PKPPermissionsManager", () => {
2525
);
2626
});
2727

28-
test("should get permissions context initially", async () => {
28+
test('should get permissions context initially', async () => {
2929
const context = await manager.getPermissionsContext();
3030
expect(context).toBeDefined();
3131
});
3232

33-
test("should check if an address is permitted", async () => {
33+
test('should check if an address is permitted', async () => {
3434
const isPermitted = await manager.isPermittedAddress({
3535
address: PKP_TEST_ADDRESS,
3636
});
3737
expect(isPermitted).toBeDefined();
3838
});
3939

40-
test("should check if an action is permitted", async () => {
40+
test('should check if an action is permitted', async () => {
4141
const isPermitted = await manager.isPermittedAction({
4242
ipfsId: TEST_ACTION_IPFS_ID,
4343
});
4444
expect(isPermitted).toBeDefined();
4545
});
4646

47-
test("should get permitted addresses", async () => {
47+
test('should get permitted addresses', async () => {
4848
const addresses = await manager.getPermittedAddresses();
4949
expect(addresses).toBeDefined();
5050
expect(Array.isArray(addresses)).toBe(true);
5151
});
5252

53-
test("should get permitted actions", async () => {
53+
test('should get permitted actions', async () => {
5454
const actions = await manager.getPermittedActions();
5555
expect(actions).toBeDefined();
5656
expect(Array.isArray(actions)).toBe(true);
5757
});
5858

59-
test("should add and check a permitted address", async () => {
59+
test('should add and check a permitted address', async () => {
6060
// For test purposes we just verify the call doesn't throw
6161
await manager.addPermittedAddress({
6262
address: PKP_TEST_ADDRESS,
63-
scopes: ["sign-anything"],
63+
scopes: ['sign-anything'],
6464
});
6565

6666
const context = await manager.getPermissionsContext();
@@ -70,11 +70,11 @@ describe("PKPPermissionsManager", () => {
7070
expect(hasAddress).toBe(true);
7171
});
7272

73-
test("should add and check a permitted action", async () => {
73+
test('should add and check a permitted action', async () => {
7474
// For test purposes we just verify the call doesn't throw
7575
await manager.addPermittedAction({
7676
ipfsId: TEST_ACTION_IPFS_ID,
77-
scopes: ["sign-anything"],
77+
scopes: ['sign-anything'],
7878
});
7979

8080
const context = await manager.getPermissionsContext();
@@ -85,17 +85,17 @@ describe("PKPPermissionsManager", () => {
8585
expect(hasAction).toBe(true);
8686
});
8787

88-
test("should batch update permissions", async () => {
88+
test('should batch update permissions', async () => {
8989
await manager.batchUpdatePermissions([
9090
{
91-
type: "addAction",
91+
type: 'addAction',
9292
ipfsId: TEST_ACTION_IPFS_ID,
93-
scopes: ["sign-anything"],
93+
scopes: ['sign-anything'],
9494
},
9595
{
96-
type: "addAddress",
96+
type: 'addAddress',
9797
address: PKP_TEST_ADDRESS,
98-
scopes: ["sign-anything"],
98+
scopes: ['sign-anything'],
9999
},
100100
]);
101101

@@ -112,7 +112,7 @@ describe("PKPPermissionsManager", () => {
112112
expect(hasAddress).toBe(true);
113113
});
114114

115-
test("should get PKPs by address", async () => {
115+
test('should get PKPs by address', async () => {
116116
const pkps = await PKPPermissionsManager.getPKPsByAddress(
117117
MASTER_ADDRESS,
118118
networkContext
@@ -121,18 +121,18 @@ describe("PKPPermissionsManager", () => {
121121
expect(Array.isArray(pkps)).toBe(true);
122122
});
123123

124-
test("should revoke all permissions", async () => {
124+
test('should revoke all permissions', async () => {
125125
// First ensure we have permissions to revoke by adding our test address and action
126126
await manager.batchUpdatePermissions([
127127
{
128-
type: "addAction",
128+
type: 'addAction',
129129
ipfsId: TEST_ACTION_IPFS_ID,
130-
scopes: ["sign-anything"],
130+
scopes: ['sign-anything'],
131131
},
132132
{
133-
type: "addAddress",
133+
type: 'addAddress',
134134
address: PKP_TEST_ADDRESS,
135-
scopes: ["sign-anything"],
135+
scopes: ['sign-anything'],
136136
},
137137
]);
138138

@@ -169,11 +169,11 @@ describe("PKPPermissionsManager", () => {
169169
expect(hasAddressAfter).toBe(false);
170170
});
171171

172-
test("should remove a permitted action", async () => {
172+
test('should remove a permitted action', async () => {
173173
// First add the action
174174
await manager.addPermittedAction({
175175
ipfsId: TEST_ACTION_IPFS_ID,
176-
scopes: ["sign-anything"],
176+
scopes: ['sign-anything'],
177177
});
178178

179179
// Then remove it
@@ -192,11 +192,11 @@ describe("PKPPermissionsManager", () => {
192192
expect(hasAction).toBeDefined();
193193
});
194194

195-
test("should remove a permitted address", async () => {
195+
test('should remove a permitted address', async () => {
196196
// First add the address
197197
await manager.addPermittedAddress({
198198
address: PKP_TEST_ADDRESS,
199-
scopes: ["sign-anything"],
199+
scopes: ['sign-anything'],
200200
});
201201

202202
// Then remove it
@@ -215,80 +215,80 @@ describe("PKPPermissionsManager", () => {
215215
expect(hasAddress).toBeDefined();
216216
});
217217

218-
test("should get permissions context with auth methods", async () => {
218+
test('should get permissions context with auth methods', async () => {
219219
const context = await manager.getPermissionsContext();
220220
expect(context).toBeDefined();
221221
expect(Array.isArray(context.actions)).toBe(true);
222222
expect(Array.isArray(context.addresses)).toBe(true);
223223
expect(Array.isArray(context.authMethods)).toBe(true);
224-
expect(typeof context.isActionPermitted).toBe("function");
225-
expect(typeof context.isAddressPermitted).toBe("function");
226-
expect(typeof context.isAuthMethodPermitted).toBe("function");
224+
expect(typeof context.isActionPermitted).toBe('function');
225+
expect(typeof context.isAddressPermitted).toBe('function');
226+
expect(typeof context.isAuthMethodPermitted).toBe('function');
227227
});
228228

229-
test("should get permitted auth methods", async () => {
229+
test('should get permitted auth methods', async () => {
230230
const authMethods = await manager.getPermittedAuthMethods();
231231
expect(authMethods).toBeDefined();
232232
expect(Array.isArray(authMethods)).toBe(true);
233-
233+
234234
// If there are auth methods, verify their structure
235235
if (authMethods.length > 0) {
236236
const firstMethod = authMethods[0];
237-
expect(typeof firstMethod.authMethodType).toBe("bigint");
238-
expect(typeof firstMethod.id).toBe("string");
239-
expect(typeof firstMethod.userPubkey).toBe("string");
237+
expect(typeof firstMethod.authMethodType).toBe('bigint');
238+
expect(typeof firstMethod.id).toBe('string');
239+
expect(typeof firstMethod.userPubkey).toBe('string');
240240
}
241241
});
242242

243-
test("should get permitted auth method scopes", async () => {
243+
test('should get permitted auth method scopes', async () => {
244244
// If there are auth methods, test getting scopes for the first one
245245
const authMethods = await manager.getPermittedAuthMethods();
246-
246+
247247
if (authMethods.length > 0) {
248248
const firstMethod = authMethods[0];
249249
const scopes = await manager.getPermittedAuthMethodScopes({
250250
authMethodType: Number(firstMethod.authMethodType),
251251
authMethodId: firstMethod.id,
252252
});
253-
253+
254254
expect(scopes).toBeDefined();
255255
expect(Array.isArray(scopes)).toBe(true);
256-
256+
257257
// Verify each scope is a boolean
258-
scopes.forEach(scope => {
259-
expect(typeof scope).toBe("boolean");
258+
scopes.forEach((scope) => {
259+
expect(typeof scope).toBe('boolean');
260260
});
261261
} else {
262262
// If no auth methods exist, test with a mock auth method
263263
const scopes = await manager.getPermittedAuthMethodScopes({
264264
authMethodType: 1, // EthWallet type
265-
authMethodId: "0x1234567890abcdef1234567890abcdef12345678",
265+
authMethodId: '0x1234567890abcdef1234567890abcdef12345678',
266266
});
267-
267+
268268
expect(scopes).toBeDefined();
269269
expect(Array.isArray(scopes)).toBe(true);
270270
}
271271
});
272272

273-
test("should verify auth method in permissions context", async () => {
273+
test('should verify auth method in permissions context', async () => {
274274
const context = await manager.getPermissionsContext();
275-
275+
276276
// If there are auth methods, test the helper function
277277
if (context.authMethods.length > 0) {
278278
const firstMethod = context.authMethods[0];
279279
const isPermitted = context.isAuthMethodPermitted(
280280
Number(firstMethod.authMethodType),
281281
firstMethod.id
282282
);
283-
283+
284284
expect(isPermitted).toBe(true);
285285
} else {
286286
// If no auth methods, test with a non-existent auth method
287287
const isPermitted = context.isAuthMethodPermitted(
288288
1, // EthWallet type
289-
"0x1234567890abcdef1234567890abcdef12345678"
289+
'0x1234567890abcdef1234567890abcdef12345678'
290290
);
291-
291+
292292
expect(isPermitted).toBe(false);
293293
}
294294
});

0 commit comments

Comments
 (0)