@lit-protocol/vincent-e2e-test-utils 1.0.0 → 1.2.0
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/CHANGELOG.md +22 -0
- package/README.md +51 -9
- package/dist/package.json +2 -2
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib/index.d.ts +1 -0
- package/dist/src/lib/index.d.ts.map +1 -1
- package/dist/src/lib/index.js +3 -1
- package/dist/src/lib/index.js.map +1 -1
- package/dist/src/lib/setup-vincent-development-environment.d.ts +49 -0
- package/dist/src/lib/setup-vincent-development-environment.d.ts.map +1 -0
- package/dist/src/lib/setup-vincent-development-environment.js +89 -0
- package/dist/src/lib/setup-vincent-development-environment.js.map +1 -0
- package/package.json +3 -3
- package/dist/CHANGELOG.md +0 -5
- package/dist/CONTRIBUTING.md +0 -0
- package/dist/README.md +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## 1.2.0 (2025-12-09)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- Adds a `smartAccountType` parameter to the `setupVincentDevelopmentEnvironment`. Supports `safe`, `crossmint` and `zerodev` smart accounts. When the parameter is set, the development environment will create a Smart Account owned by the `agentWalletOwner` (currently owns the Agent PKP for development). It will then add the Agent PKP as a signer on the Smart Account. ([](https://github.com/LIT-Protocol/Vincent/commit/))
|
|
6
|
+
|
|
7
|
+
## 1.1.3 (2025-11-23)
|
|
8
|
+
|
|
9
|
+
### 🧱 Updated Dependencies
|
|
10
|
+
|
|
11
|
+
- Updated contracts-sdk to 5.0.0
|
|
12
|
+
|
|
13
|
+
## 1.1.0 (2025-11-07)
|
|
14
|
+
|
|
15
|
+
### 🚀 Features
|
|
16
|
+
|
|
17
|
+
- Adds a `setupVincentDevelopmentEnvironment` function to streamline/abstract the developer experience. ([4ddce811](https://github.com/LIT-Protocol/Vincent/commit/4ddce811))
|
|
18
|
+
|
|
19
|
+
### ❤️ Thank You
|
|
20
|
+
|
|
21
|
+
- awisniew207 @awisniew207
|
|
22
|
+
|
|
1
23
|
# 1.0.0 (2025-11-06)
|
|
2
24
|
|
|
3
25
|
### 🚀 Features
|
package/README.md
CHANGED
|
@@ -1,17 +1,59 @@
|
|
|
1
|
-
|
|
1
|
+
E2E test utilities for the Vincent protocol, providing helper functions for setting up test environments, managing wallets, minting PKPs, and handling permissions.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Installation
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<CodeGroup>
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```bash npm
|
|
8
|
+
npm install @lit-protocol/vincent-e2e-test-utils
|
|
9
|
+
```
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
```bash yarn
|
|
12
|
+
yarn add @lit-protocol/vincent-e2e-test-utils
|
|
13
|
+
```
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
```bash pnpm
|
|
16
|
+
pnpm add @lit-protocol/vincent-e2e-test-utils
|
|
17
|
+
```
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
</CodeGroup>
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
## Features
|
|
16
22
|
|
|
17
|
-
|
|
23
|
+
- **Quick Environment Setup**: `setupVincentDevelopmentEnvironment()` handles all the boilerplate for setting up a complete Vincent test environment
|
|
24
|
+
- **Wallet Management**: Create random wallets and manage test accounts with automatic funding
|
|
25
|
+
- **PKP Management**: Mint new PKPs and configure permissions
|
|
26
|
+
- **Capacity Token Handling**: Ensure unexpired capacity tokens for testing
|
|
27
|
+
- **Chain Helpers**: Access pre-configured providers and wallets for different networks
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
The easiest way to get started is with `setupVincentDevelopmentEnvironment()`:
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { setupVincentDevelopmentEnvironment } from '@lit-protocol/vincent-e2e-test-utils';
|
|
35
|
+
|
|
36
|
+
// Define your abilities and policies
|
|
37
|
+
const permissionData = {
|
|
38
|
+
[myAbility.ipfsCid]: {
|
|
39
|
+
[myPolicy.ipfsCid]: {
|
|
40
|
+
// policy configuration
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// Set up everything with one call
|
|
46
|
+
const { agentPkpInfo, wallets, appId, appVersion } = await setupVincentDevelopmentEnvironment({
|
|
47
|
+
permissionData,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Now you're ready to test!
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This single function:
|
|
54
|
+
|
|
55
|
+
- Checks and funds all required accounts (funder, app delegatee, app manager)
|
|
56
|
+
- Registers or updates your app with abilities and policies
|
|
57
|
+
- Creates or uses an existing agent PKP
|
|
58
|
+
- Sets up permissions for the agent PKP
|
|
59
|
+
- Ensures a valid capacity token exists
|
package/dist/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lit-protocol/vincent-e2e-test-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@lit-protocol/constants": "^8.0.4",
|
|
9
9
|
"@lit-protocol/contracts-sdk": "^7.2.3",
|
|
10
|
-
"@lit-protocol/vincent-contracts-sdk": "
|
|
10
|
+
"@lit-protocol/vincent-contracts-sdk": "workspace:*",
|
|
11
11
|
"@t3-oss/env-core": "^0.13.8",
|
|
12
12
|
"ethers": "^5.7.2",
|
|
13
13
|
"tslib": "^2.8.1",
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { delegator, delegatee, funder, chain, appManager, mintNewPkp, ensureUnexpiredCapacityToken, getEnv, getChainHelpers, createRandomVincentWallets, } from './lib';
|
|
1
|
+
export { delegator, delegatee, funder, chain, appManager, mintNewPkp, ensureUnexpiredCapacityToken, getEnv, getChainHelpers, createRandomVincentWallets, setupVincentDevelopmentEnvironment, } from './lib';
|
|
2
2
|
export type { PkpInfo } from './lib/mint-new-pkp';
|
|
3
|
+
export type { VincentDevEnvironment } from './lib/setup-vincent-development-environment';
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,SAAS,EACT,MAAM,EACN,KAAK,EACL,UAAU,EACV,UAAU,EACV,4BAA4B,EAC5B,MAAM,EACN,eAAe,EACf,0BAA0B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,SAAS,EACT,MAAM,EACN,KAAK,EACL,UAAU,EACV,UAAU,EACV,4BAA4B,EAC5B,MAAM,EACN,eAAe,EACf,0BAA0B,EAC1B,kCAAkC,GACnC,MAAM,OAAO,CAAC;AAEf,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createRandomVincentWallets = exports.getChainHelpers = exports.getEnv = exports.ensureUnexpiredCapacityToken = exports.mintNewPkp = exports.appManager = exports.chain = exports.funder = exports.delegatee = exports.delegator = void 0;
|
|
3
|
+
exports.setupVincentDevelopmentEnvironment = exports.createRandomVincentWallets = exports.getChainHelpers = exports.getEnv = exports.ensureUnexpiredCapacityToken = exports.mintNewPkp = exports.appManager = exports.chain = exports.funder = exports.delegatee = exports.delegator = void 0;
|
|
4
4
|
var lib_1 = require("./lib");
|
|
5
5
|
Object.defineProperty(exports, "delegator", { enumerable: true, get: function () { return lib_1.delegator; } });
|
|
6
6
|
Object.defineProperty(exports, "delegatee", { enumerable: true, get: function () { return lib_1.delegatee; } });
|
|
@@ -12,4 +12,5 @@ Object.defineProperty(exports, "ensureUnexpiredCapacityToken", { enumerable: tru
|
|
|
12
12
|
Object.defineProperty(exports, "getEnv", { enumerable: true, get: function () { return lib_1.getEnv; } });
|
|
13
13
|
Object.defineProperty(exports, "getChainHelpers", { enumerable: true, get: function () { return lib_1.getChainHelpers; } });
|
|
14
14
|
Object.defineProperty(exports, "createRandomVincentWallets", { enumerable: true, get: function () { return lib_1.createRandomVincentWallets; } });
|
|
15
|
+
Object.defineProperty(exports, "setupVincentDevelopmentEnvironment", { enumerable: true, get: function () { return lib_1.setupVincentDevelopmentEnvironment; } });
|
|
15
16
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,6BAYe;AAXb,gGAAA,SAAS,OAAA;AACT,gGAAA,SAAS,OAAA;AACT,6FAAA,MAAM,OAAA;AACN,4FAAA,KAAK,OAAA;AACL,iGAAA,UAAU,OAAA;AACV,iGAAA,UAAU,OAAA;AACV,mHAAA,4BAA4B,OAAA;AAC5B,6FAAA,MAAM,OAAA;AACN,sGAAA,eAAe,OAAA;AACf,iHAAA,0BAA0B,OAAA;AAC1B,yHAAA,kCAAkC,OAAA"}
|
package/dist/src/lib/index.d.ts
CHANGED
|
@@ -13,4 +13,5 @@ export { ensureUnexpiredCapacityToken } from './ensure-capacity-credit';
|
|
|
13
13
|
export { getEnv } from './env';
|
|
14
14
|
export { getChainHelpers } from './chain';
|
|
15
15
|
export { createRandomVincentWallets } from './create-random-vincent-wallets';
|
|
16
|
+
export { setupVincentDevelopmentEnvironment, type VincentDevEnvironment, } from './setup-vincent-development-environment';
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EACL,kCAAkC,EAClC,KAAK,qBAAqB,GAC3B,MAAM,yCAAyC,CAAC"}
|
package/dist/src/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createRandomVincentWallets = exports.getChainHelpers = exports.getEnv = exports.ensureUnexpiredCapacityToken = exports.mintNewPkp = exports.appManager = exports.chain = exports.funder = exports.delegatee = exports.delegator = void 0;
|
|
3
|
+
exports.setupVincentDevelopmentEnvironment = exports.createRandomVincentWallets = exports.getChainHelpers = exports.getEnv = exports.ensureUnexpiredCapacityToken = exports.mintNewPkp = exports.appManager = exports.chain = exports.funder = exports.delegatee = exports.delegator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const delegator = tslib_1.__importStar(require("./delegator"));
|
|
6
6
|
exports.delegator = delegator;
|
|
@@ -22,4 +22,6 @@ var chain_1 = require("./chain");
|
|
|
22
22
|
Object.defineProperty(exports, "getChainHelpers", { enumerable: true, get: function () { return chain_1.getChainHelpers; } });
|
|
23
23
|
var create_random_vincent_wallets_1 = require("./create-random-vincent-wallets");
|
|
24
24
|
Object.defineProperty(exports, "createRandomVincentWallets", { enumerable: true, get: function () { return create_random_vincent_wallets_1.createRandomVincentWallets; } });
|
|
25
|
+
var setup_vincent_development_environment_1 = require("./setup-vincent-development-environment");
|
|
26
|
+
Object.defineProperty(exports, "setupVincentDevelopmentEnvironment", { enumerable: true, get: function () { return setup_vincent_development_environment_1.setupVincentDevelopmentEnvironment; } });
|
|
25
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAyC;AAChC,8BAAS;AAElB,+DAAyC;AAChC,8BAAS;AAElB,yDAAmC;AAC1B,wBAAM;AAEf,uDAAiC;AACxB,sBAAK;AAEd,iEAA2C;AAClC,gCAAU;AAEnB,+CAA4C;AAAnC,0GAAA,UAAU,OAAA;AACnB,mEAAwE;AAA/D,sIAAA,4BAA4B,OAAA;AACrC,6BAA+B;AAAtB,6FAAA,MAAM,OAAA;AACf,iCAA0C;AAAjC,wGAAA,eAAe,OAAA;AACxB,iFAA6E;AAApE,2IAAA,0BAA0B,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAyC;AAChC,8BAAS;AAElB,+DAAyC;AAChC,8BAAS;AAElB,yDAAmC;AAC1B,wBAAM;AAEf,uDAAiC;AACxB,sBAAK;AAEd,iEAA2C;AAClC,gCAAU;AAEnB,+CAA4C;AAAnC,0GAAA,UAAU,OAAA;AACnB,mEAAwE;AAA/D,sIAAA,4BAA4B,OAAA;AACrC,6BAA+B;AAAtB,6FAAA,MAAM,OAAA;AACf,iCAA0C;AAAjC,wGAAA,eAAe,OAAA;AACxB,iFAA6E;AAApE,2IAAA,0BAA0B,OAAA;AACnC,iGAGiD;AAF/C,2JAAA,kCAAkC,OAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Wallet } from 'ethers';
|
|
2
|
+
import type { PermissionData } from '@lit-protocol/vincent-contracts-sdk';
|
|
3
|
+
import type { PkpInfo } from './mint-new-pkp';
|
|
4
|
+
export interface VincentDevEnvironment {
|
|
5
|
+
agentPkpInfo: PkpInfo;
|
|
6
|
+
wallets: {
|
|
7
|
+
appDelegatee: Wallet;
|
|
8
|
+
funder: Wallet;
|
|
9
|
+
appManager: Wallet;
|
|
10
|
+
agentWalletOwner: Wallet;
|
|
11
|
+
};
|
|
12
|
+
appId: number;
|
|
13
|
+
appVersion: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Helper function to set up a Vincent development environment.
|
|
17
|
+
* This function handles all the necessary setup steps including:
|
|
18
|
+
* - Checking and funding all required accounts (funder, app delegatee, app manager)
|
|
19
|
+
* - Registering or updating your app with abilities and policies
|
|
20
|
+
* - Creating or using an existing agent PKP
|
|
21
|
+
* - Setting up permissions for the agent PKP
|
|
22
|
+
* - Ensuring a valid capacity token exists
|
|
23
|
+
*
|
|
24
|
+
* @param permissionData permission data containing abilities and their policies
|
|
25
|
+
* @returns the setup result including agent PKP info, wallets, app ID, and app version
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* // Example with no policies
|
|
29
|
+
* const permissionData = {
|
|
30
|
+
* [bundledVincentAbility.ipfsCid]: {},
|
|
31
|
+
* };
|
|
32
|
+
*
|
|
33
|
+
* // Example with policies
|
|
34
|
+
* const permissionDataWithPolicies = {
|
|
35
|
+
* [bundledVincentAbility.ipfsCid]: {
|
|
36
|
+
* [spendingLimitPolicy.ipfsCid]: {
|
|
37
|
+
* limit: '1000000',
|
|
38
|
+
* period: '86400',
|
|
39
|
+
* },
|
|
40
|
+
* },
|
|
41
|
+
* };
|
|
42
|
+
*
|
|
43
|
+
* const result = await setupVincentDevelopmentEnvironment({ permissionData });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare const setupVincentDevelopmentEnvironment: ({ permissionData, }: {
|
|
47
|
+
permissionData: PermissionData;
|
|
48
|
+
}) => Promise<VincentDevEnvironment>;
|
|
49
|
+
//# sourceMappingURL=setup-vincent-development-environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-vincent-development-environment.d.ts","sourceRoot":"","sources":["../../../src/lib/setup-vincent-development-environment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAS9C,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE;QACP,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,kCAAkC,GAAU,qBAEtD;IACD,cAAc,EAAE,cAAc,CAAC;CAChC,KAAG,OAAO,CAAC,qBAAqB,CAwDhC,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupVincentDevelopmentEnvironment = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const appManager = tslib_1.__importStar(require("./appManager"));
|
|
6
|
+
const chain_1 = require("./chain");
|
|
7
|
+
const delegatee = tslib_1.__importStar(require("./delegatee"));
|
|
8
|
+
const delegator = tslib_1.__importStar(require("./delegator"));
|
|
9
|
+
const ensure_capacity_credit_1 = require("./ensure-capacity-credit");
|
|
10
|
+
const funder = tslib_1.__importStar(require("./funder"));
|
|
11
|
+
/**
|
|
12
|
+
* Helper function to set up a Vincent development environment.
|
|
13
|
+
* This function handles all the necessary setup steps including:
|
|
14
|
+
* - Checking and funding all required accounts (funder, app delegatee, app manager)
|
|
15
|
+
* - Registering or updating your app with abilities and policies
|
|
16
|
+
* - Creating or using an existing agent PKP
|
|
17
|
+
* - Setting up permissions for the agent PKP
|
|
18
|
+
* - Ensuring a valid capacity token exists
|
|
19
|
+
*
|
|
20
|
+
* @param permissionData permission data containing abilities and their policies
|
|
21
|
+
* @returns the setup result including agent PKP info, wallets, app ID, and app version
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // Example with no policies
|
|
25
|
+
* const permissionData = {
|
|
26
|
+
* [bundledVincentAbility.ipfsCid]: {},
|
|
27
|
+
* };
|
|
28
|
+
*
|
|
29
|
+
* // Example with policies
|
|
30
|
+
* const permissionDataWithPolicies = {
|
|
31
|
+
* [bundledVincentAbility.ipfsCid]: {
|
|
32
|
+
* [spendingLimitPolicy.ipfsCid]: {
|
|
33
|
+
* limit: '1000000',
|
|
34
|
+
* period: '86400',
|
|
35
|
+
* },
|
|
36
|
+
* },
|
|
37
|
+
* };
|
|
38
|
+
*
|
|
39
|
+
* const result = await setupVincentDevelopmentEnvironment({ permissionData });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
const setupVincentDevelopmentEnvironment = async ({ permissionData, }) => {
|
|
43
|
+
// Check and fund all required accounts
|
|
44
|
+
await funder.checkFunderBalance();
|
|
45
|
+
await delegatee.ensureAppDelegateeFunded();
|
|
46
|
+
await appManager.ensureAppManagerFunded();
|
|
47
|
+
const chainHelpers = await (0, chain_1.getChainHelpers)();
|
|
48
|
+
const wallets = chainHelpers.wallets;
|
|
49
|
+
const abilityIpfsCids = Object.keys(permissionData);
|
|
50
|
+
const abilityPolicies = abilityIpfsCids.map((abilityIpfsCid) => {
|
|
51
|
+
return Object.keys(permissionData[abilityIpfsCid]);
|
|
52
|
+
});
|
|
53
|
+
// If an app exists for the delegatee, we will create a new app version with the new ipfs cids
|
|
54
|
+
// Otherwise, we will create an app w/ version 1 appVersion with the new ipfs cids
|
|
55
|
+
const existingApp = await delegatee.getAppInfo();
|
|
56
|
+
let appId;
|
|
57
|
+
let appVersion;
|
|
58
|
+
if (!existingApp) {
|
|
59
|
+
const newApp = await appManager.registerNewApp({ abilityIpfsCids, abilityPolicies });
|
|
60
|
+
appId = newApp.appId;
|
|
61
|
+
appVersion = newApp.appVersion;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const newAppVersion = await appManager.registerNewAppVersion({
|
|
65
|
+
abilityIpfsCids,
|
|
66
|
+
abilityPolicies,
|
|
67
|
+
});
|
|
68
|
+
appId = existingApp.appId;
|
|
69
|
+
appVersion = newAppVersion.appVersion;
|
|
70
|
+
}
|
|
71
|
+
const agentPkpInfo = await delegator.getFundedAgentPkp();
|
|
72
|
+
await delegator.permitAppVersionForAgentWalletPkp({
|
|
73
|
+
permissionData,
|
|
74
|
+
appId,
|
|
75
|
+
appVersion,
|
|
76
|
+
agentPkpInfo,
|
|
77
|
+
});
|
|
78
|
+
await delegator.addPermissionForAbilities(wallets.agentWalletOwner, agentPkpInfo.tokenId, abilityIpfsCids);
|
|
79
|
+
// Ensure capacity token is valid and unexpired
|
|
80
|
+
await (0, ensure_capacity_credit_1.ensureUnexpiredCapacityToken)(wallets.appDelegatee);
|
|
81
|
+
return {
|
|
82
|
+
agentPkpInfo,
|
|
83
|
+
wallets,
|
|
84
|
+
appId,
|
|
85
|
+
appVersion,
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
exports.setupVincentDevelopmentEnvironment = setupVincentDevelopmentEnvironment;
|
|
89
|
+
//# sourceMappingURL=setup-vincent-development-environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-vincent-development-environment.js","sourceRoot":"","sources":["../../../src/lib/setup-vincent-development-environment.ts"],"names":[],"mappings":";;;;AAMA,iEAA2C;AAC3C,mCAA0C;AAC1C,+DAAyC;AACzC,+DAAyC;AACzC,qEAAwE;AACxE,yDAAmC;AAcnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACI,MAAM,kCAAkC,GAAG,KAAK,EAAE,EACvD,cAAc,GAGf,EAAkC,EAAE;IACnC,uCAAuC;IACvC,MAAM,MAAM,CAAC,kBAAkB,EAAE,CAAC;IAClC,MAAM,SAAS,CAAC,wBAAwB,EAAE,CAAC;IAC3C,MAAM,UAAU,CAAC,sBAAsB,EAAE,CAAC;IAE1C,MAAM,YAAY,GAAG,MAAM,IAAA,uBAAe,GAAE,CAAC;IAC7C,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC;IAErC,MAAM,eAAe,GAAa,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC9D,MAAM,eAAe,GAAe,eAAe,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE;QACzE,OAAO,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,8FAA8F;IAC9F,kFAAkF;IAClF,MAAM,WAAW,GAAG,MAAM,SAAS,CAAC,UAAU,EAAE,CAAC;IACjD,IAAI,KAAa,CAAC;IAClB,IAAI,UAAkB,CAAC;IACvB,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,cAAc,CAAC,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC,CAAC;QACrF,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QACrB,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IACjC,CAAC;SAAM,CAAC;QACN,MAAM,aAAa,GAAG,MAAM,UAAU,CAAC,qBAAqB,CAAC;YAC3D,eAAe;YACf,eAAe;SAChB,CAAC,CAAC;QACH,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC;QAC1B,UAAU,GAAG,aAAa,CAAC,UAAU,CAAC;IACxC,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,SAAS,CAAC,iBAAiB,EAAE,CAAC;IAEzD,MAAM,SAAS,CAAC,iCAAiC,CAAC;QAChD,cAAc;QACd,KAAK;QACL,UAAU;QACV,YAAY;KACb,CAAC,CAAC;IAEH,MAAM,SAAS,CAAC,yBAAyB,CACvC,OAAO,CAAC,gBAAgB,EACxB,YAAY,CAAC,OAAO,EACpB,eAAe,CAChB,CAAC;IAEF,+CAA+C;IAC/C,MAAM,IAAA,qDAA4B,EAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAEzD,OAAO;QACL,YAAY;QACZ,OAAO;QACP,KAAK;QACL,UAAU;KACX,CAAC;AACJ,CAAC,CAAC;AA5DW,QAAA,kCAAkC,sCA4D7C"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lit-protocol/vincent-e2e-test-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@lit-protocol/constants": "^8.0.4",
|
|
9
9
|
"@lit-protocol/contracts-sdk": "^7.2.3",
|
|
10
|
-
"@lit-protocol/vincent-contracts-sdk": "^2.0.0",
|
|
11
10
|
"@t3-oss/env-core": "^0.13.8",
|
|
12
11
|
"ethers": "^5.7.2",
|
|
13
12
|
"tslib": "^2.8.1",
|
|
14
|
-
"zod": "^3.25.64"
|
|
13
|
+
"zod": "^3.25.64",
|
|
14
|
+
"@lit-protocol/vincent-contracts-sdk": "5.0.0"
|
|
15
15
|
},
|
|
16
16
|
"main": "./dist/src/index.js",
|
|
17
17
|
"types": "./dist/src/index.d.ts",
|
package/dist/CHANGELOG.md
DELETED
package/dist/CONTRIBUTING.md
DELETED
|
File without changes
|
package/dist/README.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# @lit-protocol/vincent-e2e-test-utils
|
|
2
|
-
|
|
3
|
-
This library was generated with [Nx](https://nx.dev).
|
|
4
|
-
|
|
5
|
-
## Building
|
|
6
|
-
|
|
7
|
-
Run `nx build e2e-test-utils` to build the library.
|
|
8
|
-
|
|
9
|
-
## Usage
|
|
10
|
-
|
|
11
|
-
This package provides E2E test utilities for the Vincent protocol.
|
|
12
|
-
|
|
13
|
-
## Development
|
|
14
|
-
|
|
15
|
-
### Documentation
|
|
16
|
-
|
|
17
|
-
Documentation is generated using TypeDoc. Build the docs with the appropriate Nx command.
|