Skip to content

Commit c03e76f

Browse files
committed
chore(e2e-test-utils): avoid circular reference, policy config example, export return type of vincent dev env
1 parent 03dea82 commit c03e76f

File tree

3 files changed

+31
-16
lines changed

3 files changed

+31
-16
lines changed

packages/libs/e2e-test-utils/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ export {
1313
} from './lib';
1414

1515
export type { PkpInfo } from './lib/mint-new-pkp';
16+
export type { VincentDevEnvironment } from './lib/setup-vincent-development-environment';

packages/libs/e2e-test-utils/src/lib/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ export { ensureUnexpiredCapacityToken } from './ensure-capacity-credit';
1818
export { getEnv } from './env';
1919
export { getChainHelpers } from './chain';
2020
export { createRandomVincentWallets } from './create-random-vincent-wallets';
21-
export { setupVincentDevelopmentEnvironment } from './setup-vincent-development-environment';
21+
export {
22+
setupVincentDevelopmentEnvironment,
23+
type VincentDevEnvironment,
24+
} from './setup-vincent-development-environment';

packages/libs/e2e-test-utils/src/lib/setup-vincent-development-environment.ts

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
import {
2-
delegator,
3-
delegatee,
4-
appManager,
5-
funder,
6-
getChainHelpers,
7-
ensureUnexpiredCapacityToken,
8-
type PkpInfo,
9-
} from '../index';
10-
import { type PermissionData } from '@lit-protocol/vincent-contracts-sdk';
11-
import { type Wallet } from 'ethers';
1+
import type { Wallet } from 'ethers';
122

13-
export interface SetupResult {
3+
import type { PermissionData } from '@lit-protocol/vincent-contracts-sdk';
4+
5+
import type { PkpInfo } from './mint-new-pkp';
6+
7+
import * as appManager from './appManager';
8+
import { getChainHelpers } from './chain';
9+
import * as delegatee from './delegatee';
10+
import * as delegator from './delegator';
11+
import { ensureUnexpiredCapacityToken } from './ensure-capacity-credit';
12+
import * as funder from './funder';
13+
14+
export interface VincentDevEnvironment {
1415
agentPkpInfo: PkpInfo;
1516
wallets: {
1617
appDelegatee: Wallet;
@@ -35,19 +36,29 @@ export interface SetupResult {
3536
* @returns the setup result including agent PKP info, wallets, app ID, and app version
3637
* @example
3738
* ```typescript
39+
* // Example with no policies
3840
* const permissionData = {
39-
* // EVM Transaction Signer Ability has no policies
40-
* // If yours does, you would add the policies to this object
4141
* [bundledVincentAbility.ipfsCid]: {},
4242
* };
43+
*
44+
* // Example with policies
45+
* const permissionDataWithPolicies = {
46+
* [bundledVincentAbility.ipfsCid]: {
47+
* [spendingLimitPolicy.ipfsCid]: {
48+
* limit: '1000000',
49+
* period: '86400',
50+
* },
51+
* },
52+
* };
53+
*
4354
* const result = await setupVincentDevelopmentEnvironment({ permissionData });
4455
* ```
4556
*/
4657
export const setupVincentDevelopmentEnvironment = async ({
4758
permissionData,
4859
}: {
4960
permissionData: PermissionData;
50-
}): Promise<SetupResult> => {
61+
}): Promise<VincentDevEnvironment> => {
5162
// Check and fund all required accounts
5263
await funder.checkFunderBalance();
5364
await delegatee.ensureAppDelegateeFunded();

0 commit comments

Comments
 (0)