Skip to content

Commit 2196f1c

Browse files
committed
fmt
1 parent 3de858f commit 2196f1c

File tree

14 files changed

+8024
-29132
lines changed

14 files changed

+8024
-29132
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<div align="center">
22
<h1>Lit Protocol Javascript/Typescript SDK V8.x.x</h1>
33

4-
54
<img src="https://i.ibb.co/p2xfzK1/Screenshot-2022-11-15-at-09-56-57.png">
65
<br/>
76
<a href="https://twitter.com/LitProtocol"><img src="https://img.shields.io/twitter/follow/litprotocol?label=Follow&style=social"/></a>
@@ -25,7 +24,6 @@ The Lit JavaScript SDK provides developers with a framework for implementing Lit
2524
<br/>
2625
<br/>
2726

28-
2927
<a href="https://developer.litprotocol.com/v3/sdk/installation"><img src="https://i.ibb.co/fDqdXLq/button-go-to-docs.png" /></a>
3028

3129
<a href="https://developer.litprotocol.com/v3/sdk/installation">

bun.lock

Lines changed: 405 additions & 783 deletions
Large diffs are not rendered by default.

e2e/src/e2e.spec.ts

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,41 @@ describe('all', () => {
124124

125125
describe('endpoints', () => {
126126
it('pkpSign', () =>
127-
createPkpSignTest(ctx, () => eveCustomAuthContext, ctx.eveViemAccountPkp.pubkey)());
127+
createPkpSignTest(
128+
ctx,
129+
() => eveCustomAuthContext,
130+
ctx.eveViemAccountPkp.pubkey
131+
)());
128132
it('executeJs', () =>
129-
createExecuteJsTest(ctx, () => eveCustomAuthContext, ctx.eveViemAccountPkp.pubkey)());
133+
createExecuteJsTest(
134+
ctx,
135+
() => eveCustomAuthContext,
136+
ctx.eveViemAccountPkp.pubkey
137+
)());
130138
it('viewPKPsByAddress', () =>
131-
createViewPKPsByAddressTest(ctx, () => eveCustomAuthContext, ctx.eveViemAccountPkp.pubkey)());
139+
createViewPKPsByAddressTest(
140+
ctx,
141+
() => eveCustomAuthContext,
142+
ctx.eveViemAccountPkp.pubkey
143+
)());
132144
it('viewPKPsByAuthData', () =>
133-
createViewPKPsByAuthDataTest(ctx, () => eveCustomAuthContext, ctx.eveCustomAuthData)());
145+
createViewPKPsByAuthDataTest(
146+
ctx,
147+
() => eveCustomAuthContext,
148+
ctx.eveCustomAuthData
149+
)());
134150
it('pkpEncryptDecrypt', () =>
135-
createPkpEncryptDecryptTest(ctx, () => eveCustomAuthContext, ctx.eveViemAccountPkp.ethAddress)());
151+
createPkpEncryptDecryptTest(
152+
ctx,
153+
() => eveCustomAuthContext,
154+
ctx.eveViemAccountPkp.ethAddress
155+
)());
136156
it('encryptDecryptFlow', () =>
137-
createEncryptDecryptFlowTest(ctx, () => eveCustomAuthContext, ctx.eveViemAccountPkp.pubkey)());
157+
createEncryptDecryptFlowTest(
158+
ctx,
159+
() => eveCustomAuthContext,
160+
ctx.eveViemAccountPkp.pubkey
161+
)());
138162

139163
// Disable for now because it requires a different flow
140164
// it('pkpPermissionsManagerFlow', () =>

e2e/src/helper/tests/view-pkps-by-auth-data.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import { assert } from '../assertions';
44
export const createViewPKPsByAuthDataTest = (
55
ctx: Awaited<ReturnType<typeof init>>,
66
getAuthContext: () => any,
7-
authData?: any,
7+
authData?: any
88
) => {
99
return async () => {
1010
const { ViemAccountAuthenticator } = await import('@lit-protocol/auth');
11-
const _authData = authData || await ViemAccountAuthenticator.authenticate(
12-
ctx.aliceViemAccount
13-
);
11+
const _authData =
12+
authData ||
13+
(await ViemAccountAuthenticator.authenticate(ctx.aliceViemAccount));
1414

1515
const pkps = await ctx.litClient.viewPKPsByAuthData({
1616
authData: {

e2e/src/init.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ export const init = async (
4848
alicePkpAuthContext: any;
4949
eveViemAccount: any;
5050
eveCustomAuthData: Awaited<ReturnType<typeof litUtils.generateAuthData>>;
51-
eveViemAccountPkp: Awaited<ReturnType<typeof litClient.mintWithCustomAuth>>['pkpData']['data'];
51+
eveViemAccountPkp: Awaited<
52+
ReturnType<typeof litClient.mintWithCustomAuth>
53+
>['pkpData']['data'];
5254
eveValidationIpfsCid: string;
5355
masterDepositForUser: (userAddress: string) => Promise<void>;
5456
// alicePkpViemAccountPermissionsManager: any,

e2e/src/v7-compatability.spec.ts

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import { createAuthManager, storagePlugins, ViemAccountAuthenticator } from "@lit-protocol/auth";
2-
import { createLitClient } from "@lit-protocol/lit-client";
3-
import { nagaDev } from "@lit-protocol/networks";
4-
import { privateKeyToAccount } from "viem/accounts";
5-
1+
import {
2+
createAuthManager,
3+
storagePlugins,
4+
ViemAccountAuthenticator,
5+
} from '@lit-protocol/auth';
6+
import { createLitClient } from '@lit-protocol/lit-client';
7+
import { nagaDev } from '@lit-protocol/networks';
8+
import { privateKeyToAccount } from 'viem/accounts';
69

710
describe('v7 compatability', () => {
811
it('should be able to use the v7 api', async () => {
9-
10-
1112
const liveMasterAccount = privateKeyToAccount(
1213
process.env['LIVE_MASTER_ACCOUNT'] as `0x${string}`
1314
);
1415

15-
1616
const litClient = await createLitClient({ network: nagaDev });
1717

1818
const authManager = createAuthManager({
@@ -46,40 +46,38 @@ describe('v7 compatability', () => {
4646
litClient: litClient,
4747
});
4848

49-
50-
51-
5249
const { createAccBuilder } = await import(
5350
'@lit-protocol/access-control-conditions'
5451
);
5552

56-
57-
const unifiedAccs = createAccBuilder().unifiedAccs({
58-
conditionType: 'evmBasic',
59-
contractAddress: '',
60-
standardContractType: '',
61-
chain: 'ethereum',
62-
method: '',
63-
parameters: [':userAddress'],
64-
returnValueTest: {
65-
comparator: '=',
66-
value: liveMasterAccount.address,
67-
},
68-
}).build();
69-
70-
71-
const accs = createAccBuilder().evmBasic({
72-
contractAddress: '',
73-
standardContractType: '',
74-
chain: 'ethereum',
75-
method: '',
76-
parameters: [':userAddress'],
77-
returnValueTest: {
78-
comparator: '=',
79-
value: liveMasterAccount.address,
80-
},
81-
}).build();
82-
53+
const unifiedAccs = createAccBuilder()
54+
.unifiedAccs({
55+
conditionType: 'evmBasic',
56+
contractAddress: '',
57+
standardContractType: '',
58+
chain: 'ethereum',
59+
method: '',
60+
parameters: [':userAddress'],
61+
returnValueTest: {
62+
comparator: '=',
63+
value: liveMasterAccount.address,
64+
},
65+
})
66+
.build();
67+
68+
const accs = createAccBuilder()
69+
.evmBasic({
70+
contractAddress: '',
71+
standardContractType: '',
72+
chain: 'ethereum',
73+
method: '',
74+
parameters: [':userAddress'],
75+
returnValueTest: {
76+
comparator: '=',
77+
value: liveMasterAccount.address,
78+
},
79+
})
80+
.build();
8381

8482
const stringData = 'Hello from encrypt-decrypt flow test!';
8583
const encryptedStringData = await litClient.encrypt({
@@ -88,10 +86,8 @@ describe('v7 compatability', () => {
8886
chain: 'ethereum',
8987
});
9088

91-
9289
console.log(encryptedStringData);
9390

94-
9591
const decryptedStringResponse = await litClient.decrypt({
9692
data: encryptedStringData,
9793
unifiedAccessControlConditions: accs,
@@ -100,4 +96,4 @@ describe('v7 compatability', () => {
10096
});
10197
console.log(decryptedStringResponse);
10298
});
103-
});
99+
});

packages/access-control-conditions/src/lib/createAccBuilder.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,4 +852,4 @@ describe('Access Control Conditions Builder', () => {
852852
expect(condition.parameters).toEqual(['param1', 'param2', 'param3']);
853853
});
854854
});
855-
});
855+
});

packages/access-control-conditions/src/lib/createAccBuilder.ts

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -549,11 +549,9 @@ class AccessControlConditionBuilder implements AccBuilder {
549549
return this;
550550
}
551551

552-
evmBasic(
553-
params: Omit<EvmBasicAcc, 'conditionType'>
554-
): AccBuilder {
552+
evmBasic(params: Omit<EvmBasicAcc, 'conditionType'>): AccBuilder {
555553
const p = params as Partial<EvmBasicAcc>;
556-
554+
557555
// For raw evmBasic, chain must be provided in params
558556
if (!p.chain) {
559557
throw new Error('Chain must be specified in params for evmBasic method');
@@ -568,14 +566,14 @@ class AccessControlConditionBuilder implements AccBuilder {
568566
return this;
569567
}
570568

571-
evmContract(
572-
params: Omit<EvmContractAcc, 'conditionType'>
573-
): AccBuilder {
569+
evmContract(params: Omit<EvmContractAcc, 'conditionType'>): AccBuilder {
574570
const p = params as Partial<EvmContractAcc>;
575-
571+
576572
// For raw evmContract, chain must be provided in params
577573
if (!p.chain) {
578-
throw new Error('Chain must be specified in params for evmContract method');
574+
throw new Error(
575+
'Chain must be specified in params for evmContract method'
576+
);
579577
}
580578

581579
this.pendingCondition = {
@@ -587,11 +585,9 @@ class AccessControlConditionBuilder implements AccBuilder {
587585
return this;
588586
}
589587

590-
solRpc(
591-
params: Omit<SolAcc, 'conditionType'>
592-
): AccBuilder {
588+
solRpc(params: Omit<SolAcc, 'conditionType'>): AccBuilder {
593589
const p = params as Partial<SolAcc>;
594-
590+
595591
// For raw solRpc, chain must be provided in params
596592
if (!p.chain) {
597593
throw new Error('Chain must be specified in params for solRpc method');
@@ -606,11 +602,9 @@ class AccessControlConditionBuilder implements AccBuilder {
606602
return this;
607603
}
608604

609-
cosmos(
610-
params: Omit<AtomAcc, 'conditionType'>
611-
): AccBuilder {
605+
cosmos(params: Omit<AtomAcc, 'conditionType'>): AccBuilder {
612606
const p = params as Partial<AtomAcc>;
613-
607+
614608
// For raw cosmos, chain must be provided in params
615609
if (!p.chain) {
616610
throw new Error('Chain must be specified in params for cosmos method');
@@ -938,4 +932,4 @@ export const createLitActionCondition = (
938932
comparator: comparator as any,
939933
value: expectedValue,
940934
},
941-
});
935+
});

0 commit comments

Comments
 (0)