@lit-protocol/vincent-e2e-test-utils 1.2.0 → 2.0.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 +20 -2
- package/dist/CHANGELOG.md +35 -0
- package/dist/CONTRIBUTING.md +0 -0
- package/dist/README.md +59 -0
- package/dist/package.json +18 -1
- package/dist/src/index.d.ts +2 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib/chain.d.ts +1 -2
- package/dist/src/lib/chain.d.ts.map +1 -1
- package/dist/src/lib/chain.js +2 -4
- package/dist/src/lib/chain.js.map +1 -1
- package/dist/src/lib/create-random-vincent-wallets.d.ts +1 -1
- package/dist/src/lib/create-random-vincent-wallets.js +1 -1
- package/dist/src/lib/create-random-vincent-wallets.js.map +1 -1
- package/dist/src/lib/delegator/add-permission-for-abilities.d.ts +2 -1
- package/dist/src/lib/delegator/add-permission-for-abilities.d.ts.map +1 -1
- package/dist/src/lib/delegator/add-permission-for-abilities.js +4 -3
- package/dist/src/lib/delegator/add-permission-for-abilities.js.map +1 -1
- package/dist/src/lib/delegator/agent-pkp.d.ts +18 -3
- package/dist/src/lib/delegator/agent-pkp.d.ts.map +1 -1
- package/dist/src/lib/delegator/agent-pkp.js +77 -26
- package/dist/src/lib/delegator/agent-pkp.js.map +1 -1
- package/dist/src/lib/delegator/get-platform-user-pkp-wallet.d.ts +8 -0
- package/dist/src/lib/delegator/get-platform-user-pkp-wallet.d.ts.map +1 -0
- package/dist/src/lib/delegator/get-platform-user-pkp-wallet.js +77 -0
- package/dist/src/lib/delegator/get-platform-user-pkp-wallet.js.map +1 -0
- package/dist/src/lib/delegator/index.d.ts +2 -0
- package/dist/src/lib/delegator/index.d.ts.map +1 -1
- package/dist/src/lib/delegator/index.js +7 -1
- package/dist/src/lib/delegator/index.js.map +1 -1
- package/dist/src/lib/delegator/permit-vincent-app-version.d.ts +4 -2
- package/dist/src/lib/delegator/permit-vincent-app-version.d.ts.map +1 -1
- package/dist/src/lib/delegator/permit-vincent-app-version.js +5 -7
- package/dist/src/lib/delegator/permit-vincent-app-version.js.map +1 -1
- package/dist/src/lib/delegator/platform-user-pkp.d.ts +10 -0
- package/dist/src/lib/delegator/platform-user-pkp.d.ts.map +1 -0
- package/dist/src/lib/delegator/platform-user-pkp.js +48 -0
- package/dist/src/lib/delegator/platform-user-pkp.js.map +1 -0
- package/dist/src/lib/ensure-capacity-credit.d.ts +2 -1
- package/dist/src/lib/ensure-capacity-credit.d.ts.map +1 -1
- package/dist/src/lib/ensure-capacity-credit.js +7 -4
- package/dist/src/lib/ensure-capacity-credit.js.map +1 -1
- package/dist/src/lib/env.d.ts +12 -2
- package/dist/src/lib/env.d.ts.map +1 -1
- package/dist/src/lib/env.js +10 -1
- package/dist/src/lib/env.js.map +1 -1
- package/dist/src/lib/environment/crossmint.d.ts +3 -0
- package/dist/src/lib/environment/crossmint.d.ts.map +1 -0
- package/dist/src/lib/environment/crossmint.js +23 -0
- package/dist/src/lib/environment/crossmint.js.map +1 -0
- package/dist/src/lib/environment/safe.d.ts +567 -0
- package/dist/src/lib/environment/safe.d.ts.map +1 -0
- package/dist/src/lib/environment/safe.js +41 -0
- package/dist/src/lib/environment/safe.js.map +1 -0
- package/dist/src/lib/environment/zerodev.d.ts +49 -0
- package/dist/src/lib/environment/zerodev.d.ts.map +1 -0
- package/dist/src/lib/environment/zerodev.js +32 -0
- package/dist/src/lib/environment/zerodev.js.map +1 -0
- package/dist/src/lib/funder/ensure-wallet-has-test-tokens.d.ts +2 -1
- package/dist/src/lib/funder/ensure-wallet-has-test-tokens.d.ts.map +1 -1
- package/dist/src/lib/funder/ensure-wallet-has-test-tokens.js +9 -7
- package/dist/src/lib/funder/ensure-wallet-has-test-tokens.js.map +1 -1
- package/dist/src/lib/index.d.ts +2 -1
- package/dist/src/lib/index.d.ts.map +1 -1
- package/dist/src/lib/index.js +5 -1
- package/dist/src/lib/index.js.map +1 -1
- package/dist/src/lib/litContractsClient/LitContractsInstance.d.ts +2 -1
- package/dist/src/lib/litContractsClient/LitContractsInstance.d.ts.map +1 -1
- package/dist/src/lib/litContractsClient/LitContractsInstance.js.map +1 -1
- package/dist/src/lib/litContractsClient/get-lit-contract-client.d.ts +2 -1
- package/dist/src/lib/litContractsClient/get-lit-contract-client.d.ts.map +1 -1
- package/dist/src/lib/litContractsClient/get-lit-contract-client.js.map +1 -1
- package/dist/src/lib/mint-new-pkp.d.ts +5 -3
- package/dist/src/lib/mint-new-pkp.d.ts.map +1 -1
- package/dist/src/lib/mint-new-pkp.js +10 -4
- package/dist/src/lib/mint-new-pkp.js.map +1 -1
- package/dist/src/lib/setup-vincent-development-environment.d.ts +36 -6
- package/dist/src/lib/setup-vincent-development-environment.d.ts.map +1 -1
- package/dist/src/lib/setup-vincent-development-environment.js +97 -8
- package/dist/src/lib/setup-vincent-development-environment.js.map +1 -1
- package/dist/src/lib/smartAccount/crossmint/setup-crossmint-account.d.ts +3 -0
- package/dist/src/lib/smartAccount/crossmint/setup-crossmint-account.d.ts.map +1 -0
- package/dist/src/lib/smartAccount/crossmint/setup-crossmint-account.js +96 -0
- package/dist/src/lib/smartAccount/crossmint/setup-crossmint-account.js.map +1 -0
- package/dist/src/lib/smartAccount/index.d.ts +5 -0
- package/dist/src/lib/smartAccount/index.d.ts.map +1 -0
- package/dist/src/lib/smartAccount/index.js +10 -0
- package/dist/src/lib/smartAccount/index.js.map +1 -0
- package/dist/src/lib/smartAccount/safe/setup-safe-account.d.ts +15 -0
- package/dist/src/lib/smartAccount/safe/setup-safe-account.d.ts.map +1 -0
- package/dist/src/lib/smartAccount/safe/setup-safe-account.js +92 -0
- package/dist/src/lib/smartAccount/safe/setup-safe-account.js.map +1 -0
- package/dist/src/lib/smartAccount/types.d.ts +27 -0
- package/dist/src/lib/smartAccount/types.d.ts.map +1 -0
- package/dist/src/lib/smartAccount/types.js +3 -0
- package/dist/src/lib/smartAccount/types.js.map +1 -0
- package/dist/src/lib/smartAccount/zerodev/get-permission-empty-validator.d.ts +3 -0
- package/dist/src/lib/smartAccount/zerodev/get-permission-empty-validator.d.ts.map +1 -0
- package/dist/src/lib/smartAccount/zerodev/get-permission-empty-validator.js +24 -0
- package/dist/src/lib/smartAccount/zerodev/get-permission-empty-validator.js.map +1 -0
- package/dist/src/lib/smartAccount/zerodev/setup-zerodev-account.d.ts +15 -0
- package/dist/src/lib/smartAccount/zerodev/setup-zerodev-account.d.ts.map +1 -0
- package/dist/src/lib/smartAccount/zerodev/setup-zerodev-account.js +107 -0
- package/dist/src/lib/smartAccount/zerodev/setup-zerodev-account.js.map +1 -0
- package/package.json +20 -3
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPimlicoTransport = exports.getPimlicoRpc = exports.getSafeTransport = exports.getSafeRpc = exports.entryPoint = exports.safeVersion = void 0;
|
|
4
|
+
exports.createPimlicoPaymaster = createPimlicoPaymaster;
|
|
5
|
+
const pimlico_1 = require("permissionless/clients/pimlico");
|
|
6
|
+
const viem_1 = require("viem");
|
|
7
|
+
const account_abstraction_1 = require("viem/account-abstraction");
|
|
8
|
+
function getSafeRpcUrl() {
|
|
9
|
+
const SAFE_RPC_URL = process.env.SAFE_RPC_URL;
|
|
10
|
+
if (!SAFE_RPC_URL) {
|
|
11
|
+
throw new Error('Missing SAFE_RPC_URL env variable for chain operations');
|
|
12
|
+
}
|
|
13
|
+
return SAFE_RPC_URL;
|
|
14
|
+
}
|
|
15
|
+
function getPimlicoRpcUrl() {
|
|
16
|
+
const PIMLICO_RPC_URL = process.env.PIMLICO_RPC_URL;
|
|
17
|
+
if (!PIMLICO_RPC_URL) {
|
|
18
|
+
throw new Error('Missing PIMLICO_RPC_URL env variable for bundler operations');
|
|
19
|
+
}
|
|
20
|
+
return PIMLICO_RPC_URL;
|
|
21
|
+
}
|
|
22
|
+
exports.safeVersion = '1.4.1';
|
|
23
|
+
exports.entryPoint = {
|
|
24
|
+
address: account_abstraction_1.entryPoint07Address,
|
|
25
|
+
version: '0.7',
|
|
26
|
+
};
|
|
27
|
+
const getSafeRpc = () => getSafeRpcUrl();
|
|
28
|
+
exports.getSafeRpc = getSafeRpc;
|
|
29
|
+
const getSafeTransport = () => (0, viem_1.http)(getSafeRpcUrl());
|
|
30
|
+
exports.getSafeTransport = getSafeTransport;
|
|
31
|
+
const getPimlicoRpc = () => getPimlicoRpcUrl();
|
|
32
|
+
exports.getPimlicoRpc = getPimlicoRpc;
|
|
33
|
+
const getPimlicoTransport = () => (0, viem_1.http)(getPimlicoRpcUrl());
|
|
34
|
+
exports.getPimlicoTransport = getPimlicoTransport;
|
|
35
|
+
function createPimlicoPaymaster() {
|
|
36
|
+
return (0, pimlico_1.createPimlicoClient)({
|
|
37
|
+
entryPoint: exports.entryPoint,
|
|
38
|
+
transport: (0, exports.getPimlicoTransport)(),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=safe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safe.js","sourceRoot":"","sources":["../../../../src/lib/environment/safe.ts"],"names":[],"mappings":";;;AA+BA,wDAKC;AApCD,4DAAqE;AACrE,+BAA4B;AAC5B,kEAA+D;AAE/D,SAAS,aAAa;IACpB,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,YAAkC,CAAC;IACpE,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,gBAAgB;IACvB,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,eAAqC,CAAC;IAC1E,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AAEY,QAAA,WAAW,GAAG,OAAO,CAAC;AACtB,QAAA,UAAU,GAAG;IACxB,OAAO,EAAE,yCAAmB;IAC5B,OAAO,EAAE,KAAK;CACN,CAAC;AAEJ,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC;AAAnC,QAAA,UAAU,cAAyB;AACzC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,IAAA,WAAI,EAAC,aAAa,EAAE,CAAC,CAAC;AAA/C,QAAA,gBAAgB,oBAA+B;AACrD,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC;AAAzC,QAAA,aAAa,iBAA4B;AAC/C,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,IAAA,WAAI,EAAC,gBAAgB,EAAE,CAAC,CAAC;AAArD,QAAA,mBAAmB,uBAAkC;AAElE,SAAgB,sBAAsB;IACpC,OAAO,IAAA,6BAAmB,EAAC;QACzB,UAAU,EAAV,kBAAU;QACV,SAAS,EAAE,IAAA,2BAAmB,GAAE;KACjC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Chain } from 'viem';
|
|
2
|
+
export declare const kernelVersion: import("@zerodev/sdk/types").KERNEL_V3_VERSION_TYPE;
|
|
3
|
+
export declare const entryPoint: import("@zerodev/sdk/types").EntryPointType<"0.7">;
|
|
4
|
+
export declare const getZerodevRpc: () => string;
|
|
5
|
+
export declare const getZerodevTransport: () => import("viem").HttpTransport<undefined, false>;
|
|
6
|
+
/**
|
|
7
|
+
* Creates a ZeroDev paymaster client for the specified chain.
|
|
8
|
+
* This should be called at runtime with the actual chain object.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createZeroDevPaymaster(chain: Chain): {
|
|
11
|
+
account: import("viem/account-abstraction").SmartAccount | undefined;
|
|
12
|
+
batch?: {
|
|
13
|
+
multicall?: boolean | import("viem").Prettify<import("viem").MulticallBatchOptions> | undefined;
|
|
14
|
+
} | undefined;
|
|
15
|
+
cacheTime: number;
|
|
16
|
+
ccipRead?: false | {
|
|
17
|
+
request?: (parameters: import("viem").CcipRequestParameters) => Promise<import("node_modules/viem/_types/utils/ccip").CcipRequestReturnType>;
|
|
18
|
+
} | undefined;
|
|
19
|
+
chain: Chain | undefined;
|
|
20
|
+
experimental_blockTag?: import("viem").BlockTag | undefined;
|
|
21
|
+
key: string;
|
|
22
|
+
name: string;
|
|
23
|
+
pollingInterval: number;
|
|
24
|
+
request: import("viem").EIP1193RequestFn<import("@zerodev/sdk").ZeroDevPaymasterRpcSchema<"0.7">>;
|
|
25
|
+
transport: import("viem").TransportConfig<string, import("viem").EIP1193RequestFn> & Record<string, any>;
|
|
26
|
+
type: string;
|
|
27
|
+
uid: string;
|
|
28
|
+
getPaymasterData: (parameters: import("viem/account-abstraction").GetPaymasterDataParameters) => Promise<import("viem/account-abstraction").GetPaymasterDataReturnType>;
|
|
29
|
+
getPaymasterStubData: (parameters: import("viem/account-abstraction").GetPaymasterStubDataParameters) => Promise<import("viem/account-abstraction").GetPaymasterStubDataReturnType>;
|
|
30
|
+
sponsorUserOperation: (args: import("@zerodev/sdk").SponsorUserOperationParameters) => Promise<import("@zerodev/sdk").SponsorUserOperationReturnType>;
|
|
31
|
+
estimateGasInERC20: (args: import("@zerodev/sdk/actions").EstimateGasInERC20Parameters) => Promise<import("@zerodev/sdk/actions").EstimateGasInERC20ReturnType>;
|
|
32
|
+
extend: <const client extends {
|
|
33
|
+
[x: string]: unknown;
|
|
34
|
+
account?: undefined;
|
|
35
|
+
batch?: undefined;
|
|
36
|
+
cacheTime?: undefined;
|
|
37
|
+
ccipRead?: undefined;
|
|
38
|
+
chain?: undefined;
|
|
39
|
+
experimental_blockTag?: undefined;
|
|
40
|
+
key?: undefined;
|
|
41
|
+
name?: undefined;
|
|
42
|
+
pollingInterval?: undefined;
|
|
43
|
+
request?: undefined;
|
|
44
|
+
transport?: undefined;
|
|
45
|
+
type?: undefined;
|
|
46
|
+
uid?: undefined;
|
|
47
|
+
} & import("viem").ExactPartial<Pick<import("viem").PublicActions<import("viem").Transport, Chain | undefined, import("viem/account-abstraction").SmartAccount | undefined>, "call" | "getChainId" | "prepareTransactionRequest" | "sendRawTransaction" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "readContract" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<import("viem").WalletActions<Chain | undefined, import("viem/account-abstraction").SmartAccount | undefined>, "sendTransaction" | "writeContract">>>(fn: (client: import("viem").Client<import("viem").Transport, Chain | undefined, import("viem/account-abstraction").SmartAccount | undefined, import("@zerodev/sdk").ZeroDevPaymasterRpcSchema<"0.7">, import("viem/account-abstraction").PaymasterActions & import("@zerodev/sdk").ZeroDevPaymasterClientActions>) => client) => import("viem").Client<import("viem").Transport, Chain | undefined, import("viem/account-abstraction").SmartAccount | undefined, import("@zerodev/sdk").ZeroDevPaymasterRpcSchema<"0.7">, { [K in keyof client]: client[K]; } & import("viem/account-abstraction").PaymasterActions & import("@zerodev/sdk").ZeroDevPaymasterClientActions>;
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=zerodev.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zerodev.d.ts","sourceRoot":"","sources":["../../../../src/lib/environment/zerodev.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAclC,eAAO,MAAM,aAAa,qDAAc,CAAC;AACzC,eAAO,MAAM,UAAU,oDAAuB,CAAC;AAG/C,eAAO,MAAM,aAAa,cAA2B,CAAC;AACtD,eAAO,MAAM,mBAAmB,sDAAiC,CAAC;AAElE;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKlD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getZerodevTransport = exports.getZerodevRpc = exports.entryPoint = exports.kernelVersion = void 0;
|
|
4
|
+
exports.createZeroDevPaymaster = createZeroDevPaymaster;
|
|
5
|
+
const sdk_1 = require("@zerodev/sdk");
|
|
6
|
+
const constants_1 = require("@zerodev/sdk/constants");
|
|
7
|
+
const viem_1 = require("viem");
|
|
8
|
+
function getZerodevRpcUrl() {
|
|
9
|
+
const ZERODEV_RPC_URL = process.env.ZERODEV_RPC_URL;
|
|
10
|
+
if (!ZERODEV_RPC_URL) {
|
|
11
|
+
throw new Error('Missing ZERODEV_RPC_URL env variable');
|
|
12
|
+
}
|
|
13
|
+
return ZERODEV_RPC_URL;
|
|
14
|
+
}
|
|
15
|
+
exports.kernelVersion = constants_1.KERNEL_V3_3;
|
|
16
|
+
exports.entryPoint = (0, constants_1.getEntryPoint)('0.7');
|
|
17
|
+
// Lazy getters that only validate when accessed
|
|
18
|
+
const getZerodevRpc = () => getZerodevRpcUrl();
|
|
19
|
+
exports.getZerodevRpc = getZerodevRpc;
|
|
20
|
+
const getZerodevTransport = () => (0, viem_1.http)(getZerodevRpcUrl());
|
|
21
|
+
exports.getZerodevTransport = getZerodevTransport;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a ZeroDev paymaster client for the specified chain.
|
|
24
|
+
* This should be called at runtime with the actual chain object.
|
|
25
|
+
*/
|
|
26
|
+
function createZeroDevPaymaster(chain) {
|
|
27
|
+
return (0, sdk_1.createZeroDevPaymasterClient)({
|
|
28
|
+
chain,
|
|
29
|
+
transport: (0, exports.getZerodevTransport)(),
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=zerodev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zerodev.js","sourceRoot":"","sources":["../../../../src/lib/environment/zerodev.ts"],"names":[],"mappings":";;;AAyBA,wDAKC;AA5BD,sCAA4D;AAC5D,sDAAoE;AACpE,+BAA4B;AAE5B,SAAS,gBAAgB;IACvB,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,eAAqC,CAAC;IAC1E,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AAEY,QAAA,aAAa,GAAG,uBAAW,CAAC;AAC5B,QAAA,UAAU,GAAG,IAAA,yBAAa,EAAC,KAAK,CAAC,CAAC;AAE/C,gDAAgD;AACzC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC;AAAzC,QAAA,aAAa,iBAA4B;AAC/C,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,IAAA,WAAI,EAAC,gBAAgB,EAAE,CAAC,CAAC;AAArD,QAAA,mBAAmB,uBAAkC;AAElE;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,KAAY;IACjD,OAAO,IAAA,kCAA4B,EAAC;QAClC,KAAK;QACL,SAAS,EAAE,IAAA,2BAAmB,GAAE;KACjC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare const ensureWalletHasTestTokens: ({ address }: {
|
|
1
|
+
export declare const ensureWalletHasTestTokens: ({ address, minAmountEther, }: {
|
|
2
2
|
address: string;
|
|
3
|
+
minAmountEther?: string;
|
|
3
4
|
}) => Promise<void>;
|
|
4
5
|
//# sourceMappingURL=ensure-wallet-has-test-tokens.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensure-wallet-has-test-tokens.d.ts","sourceRoot":"","sources":["../../../../src/lib/funder/ensure-wallet-has-test-tokens.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,yBAAyB,GAAU,
|
|
1
|
+
{"version":3,"file":"ensure-wallet-has-test-tokens.d.ts","sourceRoot":"","sources":["../../../../src/lib/funder/ensure-wallet-has-test-tokens.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,yBAAyB,GAAU,8BAG7C;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,kBAmCA,CAAC"}
|
|
@@ -7,26 +7,28 @@ const FUND_AMOUNT = ethers_1.ethers.utils.parseEther('0.01');
|
|
|
7
7
|
const MIN_AMOUNT = ethers_1.ethers.utils.parseEther('0.005');
|
|
8
8
|
// Note that _outside of this test framework_, the agent wallet owner will have funded their own wallet / agent wallets with test tokens,
|
|
9
9
|
// but because we create the agent wallet owner, its agent PKP, and the appManager as part of this e2e test, this code is responsible for funding them with test tokens.
|
|
10
|
-
const ensureWalletHasTestTokens = async ({ address }) => {
|
|
10
|
+
const ensureWalletHasTestTokens = async ({ address, minAmountEther, }) => {
|
|
11
|
+
const minAmount = minAmountEther ? ethers_1.ethers.utils.parseEther(minAmountEther) : MIN_AMOUNT;
|
|
11
12
|
const { wallets: { funder }, } = await (0, chain_1.getChainHelpers)();
|
|
12
13
|
const walletBalance = await funder.provider.getBalance(address);
|
|
13
|
-
|
|
14
|
+
const fundAmount = minAmount.gt(FUND_AMOUNT) ? minAmount.sub(walletBalance) : FUND_AMOUNT;
|
|
15
|
+
if (walletBalance.gte(minAmount)) {
|
|
14
16
|
console.log(`ℹ️ ${address} has ${ethers_1.ethers.utils.formatEther(walletBalance)} Lit test tokens`);
|
|
15
17
|
return;
|
|
16
18
|
}
|
|
17
19
|
else {
|
|
18
|
-
console.log(`ℹ️ ${address} has less than ${ethers_1.ethers.utils.formatEther(
|
|
19
|
-
console.log(`ℹ️ Minimum of ${ethers_1.ethers.utils.formatEther(
|
|
20
|
-
console.log(`ℹ️ Funding ${address} with ${ethers_1.ethers.utils.formatEther(
|
|
20
|
+
console.log(`ℹ️ ${address} has less than ${ethers_1.ethers.utils.formatEther(minAmount)}`);
|
|
21
|
+
console.log(`ℹ️ Minimum of ${ethers_1.ethers.utils.formatEther(minAmount)} Lit test tokens are required`);
|
|
22
|
+
console.log(`ℹ️ Funding ${address} with ${ethers_1.ethers.utils.formatEther(fundAmount)} Lit test tokens from funder account: ${funder.address}...`);
|
|
21
23
|
const tx = await funder.sendTransaction({
|
|
22
24
|
to: address,
|
|
23
|
-
value:
|
|
25
|
+
value: fundAmount,
|
|
24
26
|
});
|
|
25
27
|
const txReceipt = await tx.wait();
|
|
26
28
|
if (txReceipt.status !== 1) {
|
|
27
29
|
throw new Error(`Transaction failed. Tx hash: ${txReceipt.transactionHash}`);
|
|
28
30
|
}
|
|
29
|
-
console.log(`ℹ️ Funded ${address} with
|
|
31
|
+
console.log(`ℹ️ Funded ${address} with ${ethers_1.ethers.utils.formatEther(fundAmount)} Lit test tokens\nTx hash: ${txReceipt.transactionHash}`);
|
|
30
32
|
}
|
|
31
33
|
};
|
|
32
34
|
exports.ensureWalletHasTestTokens = ensureWalletHasTestTokens;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensure-wallet-has-test-tokens.js","sourceRoot":"","sources":["../../../../src/lib/funder/ensure-wallet-has-test-tokens.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAEhC,oCAA2C;AAE3C,MAAM,WAAW,GAAG,eAAM,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACpD,MAAM,UAAU,GAAG,eAAM,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAEpD,yIAAyI;AACzI,wKAAwK;AACjK,MAAM,yBAAyB,GAAG,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ensure-wallet-has-test-tokens.js","sourceRoot":"","sources":["../../../../src/lib/funder/ensure-wallet-has-test-tokens.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAEhC,oCAA2C;AAE3C,MAAM,WAAW,GAAG,eAAM,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACpD,MAAM,UAAU,GAAG,eAAM,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAEpD,yIAAyI;AACzI,wKAAwK;AACjK,MAAM,yBAAyB,GAAG,KAAK,EAAE,EAC9C,OAAO,EACP,cAAc,GAIf,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC,eAAM,CAAC,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;IACxF,MAAM,EACJ,OAAO,EAAE,EAAE,MAAM,EAAE,GACpB,GAAG,MAAM,IAAA,uBAAe,GAAE,CAAC;IAE5B,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAChE,MAAM,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;IAE1F,IAAI,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;QACjC,OAAO,CAAC,GAAG,CAAC,OAAO,OAAO,QAAQ,eAAM,CAAC,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;QAC7F,OAAO;IACT,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,OAAO,OAAO,kBAAkB,eAAM,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACnF,OAAO,CAAC,GAAG,CACT,kBAAkB,eAAM,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,+BAA+B,CACrF,CAAC;QACF,OAAO,CAAC,GAAG,CACT,eAAe,OAAO,SAAS,eAAM,CAAC,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,yCAAyC,MAAM,CAAC,OAAO,KAAK,CAChI,CAAC;QAEF,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC;YACtC,EAAE,EAAE,OAAO;YACX,KAAK,EAAE,UAAU;SAClB,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;QAClC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,gCAAgC,SAAS,CAAC,eAAe,EAAE,CAAC,CAAC;QAC/E,CAAC;QAED,OAAO,CAAC,GAAG,CACT,cAAc,OAAO,SAAS,eAAM,CAAC,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,8BAA8B,SAAS,CAAC,eAAe,EAAE,CAC5H,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAzCW,QAAA,yBAAyB,6BAyCpC"}
|
package/dist/src/lib/index.d.ts
CHANGED
|
@@ -8,10 +8,11 @@ import * as chain from './chain';
|
|
|
8
8
|
export { chain };
|
|
9
9
|
import * as appManager from './appManager';
|
|
10
10
|
export { appManager };
|
|
11
|
-
export { mintNewPkp } from './mint-new-pkp';
|
|
11
|
+
export { mintNewPkp, type PkpInfo } from './mint-new-pkp';
|
|
12
12
|
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
16
|
export { setupVincentDevelopmentEnvironment, type VincentDevEnvironment, } from './setup-vincent-development-environment';
|
|
17
|
+
export { setupZerodevAccount, setupCrossmintAccount, setupSafeAccount, type SmartAccountInfo, type ZerodevSmartAccountInfo, type CrossmintSmartAccountInfo, type SafeSmartAccountInfo, } from './smartAccount';
|
|
17
18
|
//# 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;
|
|
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,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC1D,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;AAEjD,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,GAC1B,MAAM,gBAAgB,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.setupVincentDevelopmentEnvironment = exports.createRandomVincentWallets = exports.getChainHelpers = exports.getEnv = exports.ensureUnexpiredCapacityToken = exports.mintNewPkp = exports.appManager = exports.chain = exports.funder = exports.delegatee = exports.delegator = void 0;
|
|
3
|
+
exports.setupSafeAccount = exports.setupCrossmintAccount = exports.setupZerodevAccount = 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;
|
|
@@ -24,4 +24,8 @@ 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
25
|
var setup_vincent_development_environment_1 = require("./setup-vincent-development-environment");
|
|
26
26
|
Object.defineProperty(exports, "setupVincentDevelopmentEnvironment", { enumerable: true, get: function () { return setup_vincent_development_environment_1.setupVincentDevelopmentEnvironment; } });
|
|
27
|
+
var smartAccount_1 = require("./smartAccount");
|
|
28
|
+
Object.defineProperty(exports, "setupZerodevAccount", { enumerable: true, get: function () { return smartAccount_1.setupZerodevAccount; } });
|
|
29
|
+
Object.defineProperty(exports, "setupCrossmintAccount", { enumerable: true, get: function () { return smartAccount_1.setupCrossmintAccount; } });
|
|
30
|
+
Object.defineProperty(exports, "setupSafeAccount", { enumerable: true, get: function () { return smartAccount_1.setupSafeAccount; } });
|
|
27
31
|
//# 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,+
|
|
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,+CAA0D;AAAjD,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;AAIpC,+CAQwB;AAPtB,mHAAA,mBAAmB,OAAA;AACnB,qHAAA,qBAAqB,OAAA;AACrB,gHAAA,gBAAgB,OAAA"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ethers } from 'ethers';
|
|
2
|
+
import type { PKPEthersWallet } from '@lit-protocol/pkp-ethers';
|
|
2
3
|
import { LitContracts } from '@lit-protocol/contracts-sdk';
|
|
3
4
|
export declare class LitContractsInstance {
|
|
4
5
|
private readonly contractsInstance;
|
|
5
6
|
private isConnected;
|
|
6
7
|
private connectHandle;
|
|
7
8
|
constructor({ wallet }: {
|
|
8
|
-
wallet: ethers.Wallet;
|
|
9
|
+
wallet: ethers.Wallet | PKPEthersWallet;
|
|
9
10
|
});
|
|
10
11
|
connect(): Promise<boolean>;
|
|
11
12
|
get litContracts(): LitContracts;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LitContractsInstance.d.ts","sourceRoot":"","sources":["../../../../src/lib/litContractsClient/LitContractsInstance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAe;IAEjD,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO,CAAC,aAAa,CAAiC;gBAE1C,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAA;KAAE;
|
|
1
|
+
{"version":3,"file":"LitContractsInstance.d.ts","sourceRoot":"","sources":["../../../../src/lib/litContractsClient/LitContractsInstance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAe;IAEjD,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO,CAAC,aAAa,CAAiC;gBAE1C,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,eAAe,CAAA;KAAE;IAS7D,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IA4BjC,IAAI,YAAY,IAAI,YAAY,CAE/B;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LitContractsInstance.js","sourceRoot":"","sources":["../../../../src/lib/litContractsClient/LitContractsInstance.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"LitContractsInstance.js","sourceRoot":"","sources":["../../../../src/lib/litContractsClient/LitContractsInstance.ts"],"names":[],"mappings":";;;AAIA,+DAA2D;AAE3D,MAAa,oBAAoB;IACd,iBAAiB,CAAe;IAEzC,WAAW,GAAG,KAAK,CAAC;IAEpB,aAAa,GAA4B,IAAI,CAAC;IAEtD,YAAY,EAAE,MAAM,EAA+C;QACjE,IAAI,CAAC,iBAAiB,GAAG,IAAI,4BAAY,CAAC;YACxC,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,OAAO;YAChB,MAAM,EAAE,MAAM;YACd,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,4BAA4B;YAC5B,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;gBACvB,OAAO,IAAI,CAAC,aAAa,CAAC;YAC5B,CAAC;YAED,sEAAsE;YACtE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;YAEvE,IAAI,CAAC;gBACH,mEAAmE;gBACnE,MAAM,IAAI,CAAC,aAAa,CAAC;gBACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YAC1B,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,wFAAwF;gBACxF,0DAA0D;gBAC1D,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;gBACzB,MAAM,CAAC,CAAC;YACV,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;YAC5B,CAAC;YACD,OAAO,IAAI,CAAC,WAAW,CAAC;QAC1B,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;CACF;AA/CD,oDA+CC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ethers } from 'ethers';
|
|
2
2
|
import type { LitContracts } from '@lit-protocol/contracts-sdk';
|
|
3
|
+
import type { PKPEthersWallet } from '@lit-protocol/pkp-ethers';
|
|
3
4
|
export declare function getLitContractsClient({ wallet, }: {
|
|
4
|
-
wallet: ethers.Wallet;
|
|
5
|
+
wallet: ethers.Wallet | PKPEthersWallet;
|
|
5
6
|
}): Promise<LitContracts>;
|
|
6
7
|
//# sourceMappingURL=get-lit-contract-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-lit-contract-client.d.ts","sourceRoot":"","sources":["../../../../src/lib/litContractsClient/get-lit-contract-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAMhE,wBAAsB,qBAAqB,CAAC,EAC1C,MAAM,GACP,EAAE;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"get-lit-contract-client.d.ts","sourceRoot":"","sources":["../../../../src/lib/litContractsClient/get-lit-contract-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAMhE,wBAAsB,qBAAqB,CAAC,EAC1C,MAAM,GACP,EAAE;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,eAAe,CAAC;CACzC,GAAG,OAAO,CAAC,YAAY,CAAC,CAcxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-lit-contract-client.js","sourceRoot":"","sources":["../../../../src/lib/litContractsClient/get-lit-contract-client.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"get-lit-contract-client.js","sourceRoot":"","sources":["../../../../src/lib/litContractsClient/get-lit-contract-client.ts"],"names":[],"mappings":";;AASA,sDAkBC;AAtBD,iEAA8D;AAE9D,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAyD,CAAC;AAExF,KAAK,UAAU,qBAAqB,CAAC,EAC1C,MAAM,GAGP;IACC,IAAI,QAAQ,GAAG,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7C,IAAI,QAAQ,EAAE,CAAC;QACb,oFAAoF;QACpF,yFAAyF;QACzF,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;QACzB,OAAO,QAAQ,CAAC,YAAY,CAAC;IAC/B,CAAC;IAED,QAAQ,GAAG,IAAI,2CAAoB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAChD,iBAAiB,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACxC,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;IAEzB,OAAO,QAAQ,CAAC,YAAY,CAAC;AAC/B,CAAC"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
|
+
import type { PKPEthersWallet } from '@lit-protocol/pkp-ethers';
|
|
2
3
|
export type PkpInfo = {
|
|
3
4
|
ethAddress: string;
|
|
4
5
|
tokenId: string;
|
|
6
|
+
publicKey: string;
|
|
5
7
|
};
|
|
6
8
|
/**
|
|
7
9
|
* Helper function to mint a new PKP and return its information
|
|
8
|
-
* @param wallet wallet that will be the PKP owner
|
|
10
|
+
* @param wallet wallet that will be the PKP owner and permitted auth method
|
|
9
11
|
* @returns the newly minted PKP's tokenId and ethAddress
|
|
10
12
|
*/
|
|
11
|
-
export declare const mintNewPkp: ({ wallet }: {
|
|
12
|
-
wallet: ethers.Wallet;
|
|
13
|
+
export declare const mintNewPkp: ({ wallet, }: {
|
|
14
|
+
wallet: ethers.Wallet | PKPEthersWallet;
|
|
13
15
|
}) => Promise<PkpInfo>;
|
|
14
16
|
//# sourceMappingURL=mint-new-pkp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mint-new-pkp.d.ts","sourceRoot":"","sources":["../../../src/lib/mint-new-pkp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"mint-new-pkp.d.ts","sourceRoot":"","sources":["../../../src/lib/mint-new-pkp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAMhE,MAAM,MAAM,OAAO,GAAG;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,aAE9B;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,eAAe,CAAC;CACzC,KAAG,OAAO,CAAC,OAAO,CAgDlB,CAAC"}
|
|
@@ -6,14 +6,18 @@ const constants_1 = require("@lit-protocol/constants");
|
|
|
6
6
|
const get_lit_contract_client_1 = require("./litContractsClient/get-lit-contract-client");
|
|
7
7
|
/**
|
|
8
8
|
* Helper function to mint a new PKP and return its information
|
|
9
|
-
* @param wallet wallet that will be the PKP owner
|
|
9
|
+
* @param wallet wallet that will be the PKP owner and permitted auth method
|
|
10
10
|
* @returns the newly minted PKP's tokenId and ethAddress
|
|
11
11
|
*/
|
|
12
|
-
const mintNewPkp = async ({ wallet }) => {
|
|
12
|
+
const mintNewPkp = async ({ wallet, }) => {
|
|
13
13
|
const litContractClient = await (0, get_lit_contract_client_1.getLitContractsClient)({ wallet });
|
|
14
|
+
await litContractClient.connect();
|
|
14
15
|
const mintPkpTx = await litContractClient.pkpHelperContract.write.mintNextAndAddAuthMethods(constants_1.AUTH_METHOD_TYPE.EthWallet, [constants_1.AUTH_METHOD_TYPE.EthWallet], [wallet.address], ['0x'], [[constants_1.AUTH_METHOD_SCOPE.SignAnything]], true, // addPkpEthAddressAsPermittedAddress
|
|
15
16
|
false, // sendPkpToItself
|
|
16
|
-
{
|
|
17
|
+
{
|
|
18
|
+
value: await litContractClient.pkpNftContract.read.mintCost(),
|
|
19
|
+
gasLimit: 5_000_000,
|
|
20
|
+
});
|
|
17
21
|
const mintPkpReceipt = await mintPkpTx.wait();
|
|
18
22
|
if (!mintPkpReceipt.events) {
|
|
19
23
|
throw new Error('Mint Pkp Receipt does not have events');
|
|
@@ -24,10 +28,12 @@ const mintNewPkp = async ({ wallet }) => {
|
|
|
24
28
|
}
|
|
25
29
|
const tokenId = ethers_1.ethers.utils.keccak256('0x' + pkpMintedEvent.data.slice(130, 260));
|
|
26
30
|
const ethAddress = await litContractClient.pkpNftContract.read.getEthAddress(tokenId);
|
|
27
|
-
|
|
31
|
+
const publicKey = await litContractClient.pkpNftContract.read.getPubkey(tokenId);
|
|
32
|
+
console.log(`ℹ️ Minted new PKP owned by ${await wallet.getAddress()} with ethAddress: ${ethAddress}`);
|
|
28
33
|
return {
|
|
29
34
|
tokenId: ethers_1.ethers.BigNumber.from(tokenId).toString(),
|
|
30
35
|
ethAddress,
|
|
36
|
+
publicKey,
|
|
31
37
|
};
|
|
32
38
|
};
|
|
33
39
|
exports.mintNewPkp = mintNewPkp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mint-new-pkp.js","sourceRoot":"","sources":["../../../src/lib/mint-new-pkp.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;
|
|
1
|
+
{"version":3,"file":"mint-new-pkp.js","sourceRoot":"","sources":["../../../src/lib/mint-new-pkp.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAIhC,uDAA8E;AAE9E,0FAAqF;AAQrF;;;;GAIG;AACI,MAAM,UAAU,GAAG,KAAK,EAAE,EAC/B,MAAM,GAGP,EAAoB,EAAE;IACrB,MAAM,iBAAiB,GAAG,MAAM,IAAA,+CAAqB,EAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAClE,MAAM,iBAAiB,CAAC,OAAO,EAAE,CAAC;IAElC,MAAM,SAAS,GAAG,MAAM,iBAAiB,CAAC,iBAAiB,CAAC,KAAK,CAAC,yBAAyB,CACzF,4BAAgB,CAAC,SAAS,EAC1B,CAAC,4BAAgB,CAAC,SAAS,CAAC,EAC5B,CAAC,MAAM,CAAC,OAAO,CAAC,EAChB,CAAC,IAAI,CAAC,EACN,CAAC,CAAC,6BAAiB,CAAC,YAAY,CAAC,CAAC,EAClC,IAAI,EAAE,qCAAqC;IAC3C,KAAK,EAAE,kBAAkB;IACzB;QACE,KAAK,EAAE,MAAM,iBAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE;QAC7D,QAAQ,EAAE,SAAS;KACpB,CACF,CAAC;IAEF,MAAM,cAAc,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC;IAE9C,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,cAAc,GAAG,cAAc,CAAC,MAAM,CAAC,IAAI,CAC/C,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,oEAAoE,CAC3F,CAAC;IAEF,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,uFAAuF,CACxF,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IACnF,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACtF,MAAM,SAAS,GAAG,MAAM,iBAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAEjF,OAAO,CAAC,GAAG,CACT,+BAA+B,MAAM,MAAM,CAAC,UAAU,EAAE,qBAAqB,UAAU,EAAE,CAC1F,CAAC;IAEF,OAAO;QACL,OAAO,EAAE,eAAM,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE;QAClD,UAAU;QACV,SAAS;KACV,CAAC;AACJ,CAAC,CAAC;AApDW,QAAA,UAAU,cAoDrB"}
|
|
@@ -1,28 +1,38 @@
|
|
|
1
1
|
import type { Wallet } from 'ethers';
|
|
2
|
+
import type { PKPEthersWallet } from '@lit-protocol/pkp-ethers';
|
|
2
3
|
import type { PermissionData } from '@lit-protocol/vincent-contracts-sdk';
|
|
3
4
|
import type { PkpInfo } from './mint-new-pkp';
|
|
5
|
+
import type { SmartAccountInfo } from './smartAccount';
|
|
4
6
|
export interface VincentDevEnvironment {
|
|
5
7
|
agentPkpInfo: PkpInfo;
|
|
8
|
+
platformUserPkpInfo: PkpInfo;
|
|
6
9
|
wallets: {
|
|
7
10
|
appDelegatee: Wallet;
|
|
8
11
|
funder: Wallet;
|
|
9
12
|
appManager: Wallet;
|
|
10
|
-
|
|
13
|
+
platformUserWalletOwner: Wallet;
|
|
14
|
+
platformUserPkpWallet: PKPEthersWallet;
|
|
11
15
|
};
|
|
12
16
|
appId: number;
|
|
13
17
|
appVersion: number;
|
|
18
|
+
smartAccount?: SmartAccountInfo;
|
|
14
19
|
}
|
|
15
20
|
/**
|
|
16
|
-
* Helper function to set up a Vincent development environment.
|
|
21
|
+
* Helper function to set up a Vincent development environment with the new PKP hierarchy.
|
|
17
22
|
* This function handles all the necessary setup steps including:
|
|
18
23
|
* - Checking and funding all required accounts (funder, app delegatee, app manager)
|
|
19
24
|
* - Registering or updating your app with abilities and policies
|
|
20
|
-
* - Creating or using an existing
|
|
21
|
-
* -
|
|
25
|
+
* - Creating or using an existing Platform User PKP (owned by EOA)
|
|
26
|
+
* - Creating or using an existing Agent PKP for the app (owned by Platform User PKP)
|
|
27
|
+
* - Setting up permissions for the Agent PKP
|
|
22
28
|
* - Ensuring a valid capacity token exists
|
|
29
|
+
* - Optionally creating a smart account owned by agentWalletOwner with the PKP as a permitted signer
|
|
30
|
+
*
|
|
31
|
+
* PKP Hierarchy: EOA → Platform User PKP → Agent PKP (per app)
|
|
23
32
|
*
|
|
24
33
|
* @param permissionData permission data containing abilities and their policies
|
|
25
|
-
* @
|
|
34
|
+
* @param smartAccountType type of smart account to create: 'zerodev', 'crossmint', 'safe', or false to disable
|
|
35
|
+
* @returns the setup result including agent PKP info, wallets, app ID, app version, and optional smart account info
|
|
26
36
|
* @example
|
|
27
37
|
* ```typescript
|
|
28
38
|
* // Example with no policies
|
|
@@ -40,10 +50,30 @@ export interface VincentDevEnvironment {
|
|
|
40
50
|
* },
|
|
41
51
|
* };
|
|
42
52
|
*
|
|
53
|
+
* // EOA mode
|
|
43
54
|
* const result = await setupVincentDevelopmentEnvironment({ permissionData });
|
|
55
|
+
*
|
|
56
|
+
* // ZeroDev smart account mode (requires SMART_ACCOUNT_CHAIN_ID and ZERODEV_RPC_URL env vars)
|
|
57
|
+
* const result = await setupVincentDevelopmentEnvironment({
|
|
58
|
+
* permissionData,
|
|
59
|
+
* smartAccountType: 'zerodev',
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* // Crossmint smart account mode (requires SMART_ACCOUNT_CHAIN_ID and CROSSMINT_API_KEY env vars)
|
|
63
|
+
* const result = await setupVincentDevelopmentEnvironment({
|
|
64
|
+
* permissionData,
|
|
65
|
+
* smartAccountType: 'crossmint',
|
|
66
|
+
* });
|
|
67
|
+
*
|
|
68
|
+
* // Safe smart account mode (requires SMART_ACCOUNT_CHAIN_ID, SAFE_RPC_URL, and PIMLICO_RPC_URL env vars)
|
|
69
|
+
* const result = await setupVincentDevelopmentEnvironment({
|
|
70
|
+
* permissionData,
|
|
71
|
+
* smartAccountType: 'safe',
|
|
72
|
+
* });
|
|
44
73
|
* ```
|
|
45
74
|
*/
|
|
46
|
-
export declare const setupVincentDevelopmentEnvironment: ({ permissionData, }: {
|
|
75
|
+
export declare const setupVincentDevelopmentEnvironment: ({ permissionData, smartAccountType, }: {
|
|
47
76
|
permissionData: PermissionData;
|
|
77
|
+
smartAccountType?: "zerodev" | "crossmint" | "safe";
|
|
48
78
|
}) => Promise<VincentDevEnvironment>;
|
|
49
79
|
//# sourceMappingURL=setup-vincent-development-environment.d.ts.map
|
|
@@ -1 +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;
|
|
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;AAMrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAWvD,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,OAAO,CAAC;IACtB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,OAAO,EAAE;QACP,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,uBAAuB,EAAE,MAAM,CAAC;QAChC,qBAAqB,EAAE,eAAe,CAAC;KACxC,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,eAAO,MAAM,kCAAkC,GAAU,uCAGtD;IACD,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;CACrD,KAAG,OAAO,CAAC,qBAAqB,CAgIhC,CAAC"}
|
|
@@ -2,23 +2,33 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setupVincentDevelopmentEnvironment = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const viem_1 = require("viem");
|
|
6
|
+
const accounts_1 = require("viem/accounts");
|
|
7
|
+
const viemChains = tslib_1.__importStar(require("viem/chains"));
|
|
5
8
|
const appManager = tslib_1.__importStar(require("./appManager"));
|
|
6
9
|
const chain_1 = require("./chain");
|
|
7
10
|
const delegatee = tslib_1.__importStar(require("./delegatee"));
|
|
8
11
|
const delegator = tslib_1.__importStar(require("./delegator"));
|
|
9
12
|
const ensure_capacity_credit_1 = require("./ensure-capacity-credit");
|
|
13
|
+
const env_1 = require("./env");
|
|
10
14
|
const funder = tslib_1.__importStar(require("./funder"));
|
|
15
|
+
const smartAccount_1 = require("./smartAccount");
|
|
11
16
|
/**
|
|
12
|
-
* Helper function to set up a Vincent development environment.
|
|
17
|
+
* Helper function to set up a Vincent development environment with the new PKP hierarchy.
|
|
13
18
|
* This function handles all the necessary setup steps including:
|
|
14
19
|
* - Checking and funding all required accounts (funder, app delegatee, app manager)
|
|
15
20
|
* - Registering or updating your app with abilities and policies
|
|
16
|
-
* - Creating or using an existing
|
|
17
|
-
* -
|
|
21
|
+
* - Creating or using an existing Platform User PKP (owned by EOA)
|
|
22
|
+
* - Creating or using an existing Agent PKP for the app (owned by Platform User PKP)
|
|
23
|
+
* - Setting up permissions for the Agent PKP
|
|
18
24
|
* - Ensuring a valid capacity token exists
|
|
25
|
+
* - Optionally creating a smart account owned by agentWalletOwner with the PKP as a permitted signer
|
|
26
|
+
*
|
|
27
|
+
* PKP Hierarchy: EOA → Platform User PKP → Agent PKP (per app)
|
|
19
28
|
*
|
|
20
29
|
* @param permissionData permission data containing abilities and their policies
|
|
21
|
-
* @
|
|
30
|
+
* @param smartAccountType type of smart account to create: 'zerodev', 'crossmint', 'safe', or false to disable
|
|
31
|
+
* @returns the setup result including agent PKP info, wallets, app ID, app version, and optional smart account info
|
|
22
32
|
* @example
|
|
23
33
|
* ```typescript
|
|
24
34
|
* // Example with no policies
|
|
@@ -36,10 +46,29 @@ const funder = tslib_1.__importStar(require("./funder"));
|
|
|
36
46
|
* },
|
|
37
47
|
* };
|
|
38
48
|
*
|
|
49
|
+
* // EOA mode
|
|
39
50
|
* const result = await setupVincentDevelopmentEnvironment({ permissionData });
|
|
51
|
+
*
|
|
52
|
+
* // ZeroDev smart account mode (requires SMART_ACCOUNT_CHAIN_ID and ZERODEV_RPC_URL env vars)
|
|
53
|
+
* const result = await setupVincentDevelopmentEnvironment({
|
|
54
|
+
* permissionData,
|
|
55
|
+
* smartAccountType: 'zerodev',
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* // Crossmint smart account mode (requires SMART_ACCOUNT_CHAIN_ID and CROSSMINT_API_KEY env vars)
|
|
59
|
+
* const result = await setupVincentDevelopmentEnvironment({
|
|
60
|
+
* permissionData,
|
|
61
|
+
* smartAccountType: 'crossmint',
|
|
62
|
+
* });
|
|
63
|
+
*
|
|
64
|
+
* // Safe smart account mode (requires SMART_ACCOUNT_CHAIN_ID, SAFE_RPC_URL, and PIMLICO_RPC_URL env vars)
|
|
65
|
+
* const result = await setupVincentDevelopmentEnvironment({
|
|
66
|
+
* permissionData,
|
|
67
|
+
* smartAccountType: 'safe',
|
|
68
|
+
* });
|
|
40
69
|
* ```
|
|
41
70
|
*/
|
|
42
|
-
const setupVincentDevelopmentEnvironment = async ({ permissionData, }) => {
|
|
71
|
+
const setupVincentDevelopmentEnvironment = async ({ permissionData, smartAccountType, }) => {
|
|
43
72
|
// Check and fund all required accounts
|
|
44
73
|
await funder.checkFunderBalance();
|
|
45
74
|
await delegatee.ensureAppDelegateeFunded();
|
|
@@ -68,21 +97,81 @@ const setupVincentDevelopmentEnvironment = async ({ permissionData, }) => {
|
|
|
68
97
|
appId = existingApp.appId;
|
|
69
98
|
appVersion = newAppVersion.appVersion;
|
|
70
99
|
}
|
|
71
|
-
|
|
100
|
+
// Ensure capacity token for the EOA wallet that owns the Platform User PKP
|
|
101
|
+
await (0, ensure_capacity_credit_1.ensureUnexpiredCapacityToken)(wallets.platformUserWalletOwner);
|
|
102
|
+
// Get or create the Platform User PKP (owned by the EOA)
|
|
103
|
+
// This also ensures the PKP has ETH for gas
|
|
104
|
+
const platformUserPkpInfo = await delegator.getFundedPlatformUserPkp();
|
|
105
|
+
// Get Platform User PKP ethers wallet for signing operations
|
|
106
|
+
const platformUserPkpWallet = await delegator.getPlatformUserPkpWallet(platformUserPkpInfo);
|
|
107
|
+
// Ensure capacity token for the Platform User PKP wallet
|
|
108
|
+
await (0, ensure_capacity_credit_1.ensureUnexpiredCapacityToken)(platformUserPkpWallet);
|
|
109
|
+
// Get or create the Agent PKP for this app (owned by the Platform User PKP)
|
|
110
|
+
const agentPkpInfo = await delegator.getFundedAgentPkp(appId);
|
|
111
|
+
// Permit the app version for the Agent PKP
|
|
72
112
|
await delegator.permitAppVersionForAgentWalletPkp({
|
|
73
113
|
permissionData,
|
|
74
114
|
appId,
|
|
75
115
|
appVersion,
|
|
76
116
|
agentPkpInfo,
|
|
117
|
+
platformUserPkpWallet,
|
|
77
118
|
});
|
|
78
|
-
|
|
119
|
+
// Add permissions for abilities to the Agent PKP
|
|
120
|
+
// Note: This uses the Platform User PKP wallet to add permissions
|
|
121
|
+
await delegator.addPermissionForAbilities(platformUserPkpWallet, agentPkpInfo.tokenId, abilityIpfsCids);
|
|
79
122
|
// Ensure capacity token is valid and unexpired
|
|
80
123
|
await (0, ensure_capacity_credit_1.ensureUnexpiredCapacityToken)(wallets.appDelegatee);
|
|
124
|
+
// Optionally set up smart account
|
|
125
|
+
let smartAccount;
|
|
126
|
+
if (smartAccountType) {
|
|
127
|
+
console.log(`\n🔧 Setting up ${smartAccountType} smart account...\n`);
|
|
128
|
+
const env = (0, env_1.getEnv)();
|
|
129
|
+
const { SMART_ACCOUNT_CHAIN_ID } = env;
|
|
130
|
+
if (!SMART_ACCOUNT_CHAIN_ID) {
|
|
131
|
+
throw new Error('SMART_ACCOUNT_CHAIN_ID env var is required when smartAccountType is set');
|
|
132
|
+
}
|
|
133
|
+
const chainId = parseInt(SMART_ACCOUNT_CHAIN_ID);
|
|
134
|
+
// Extract chain from viem's exported chains using chainId
|
|
135
|
+
const chains = Object.values(viemChains);
|
|
136
|
+
// Type assertion needed: extractChain expects literal union type but we have runtime value from env
|
|
137
|
+
const chain = (0, viem_1.extractChain)({
|
|
138
|
+
chains,
|
|
139
|
+
id: chainId,
|
|
140
|
+
});
|
|
141
|
+
// Convert ethers wallet to viem account
|
|
142
|
+
const ownerAccount = (0, accounts_1.privateKeyToAccount)(wallets.platformUserWalletOwner.privateKey);
|
|
143
|
+
if (smartAccountType === 'zerodev') {
|
|
144
|
+
smartAccount = await (0, smartAccount_1.setupZerodevAccount)({
|
|
145
|
+
ownerAccount,
|
|
146
|
+
permittedAddress: agentPkpInfo.ethAddress,
|
|
147
|
+
chain,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
else if (smartAccountType === 'crossmint') {
|
|
151
|
+
smartAccount = await (0, smartAccount_1.setupCrossmintAccount)({
|
|
152
|
+
ownerAccount,
|
|
153
|
+
permittedAddress: agentPkpInfo.ethAddress,
|
|
154
|
+
chain,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
else if (smartAccountType === 'safe') {
|
|
158
|
+
smartAccount = await (0, smartAccount_1.setupSafeAccount)({
|
|
159
|
+
ownerAccount,
|
|
160
|
+
permittedAddress: agentPkpInfo.ethAddress,
|
|
161
|
+
chain,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
81
165
|
return {
|
|
82
166
|
agentPkpInfo,
|
|
83
|
-
|
|
167
|
+
platformUserPkpInfo,
|
|
168
|
+
wallets: {
|
|
169
|
+
...wallets,
|
|
170
|
+
platformUserPkpWallet,
|
|
171
|
+
},
|
|
84
172
|
appId,
|
|
85
173
|
appVersion,
|
|
174
|
+
smartAccount,
|
|
86
175
|
};
|
|
87
176
|
};
|
|
88
177
|
exports.setupVincentDevelopmentEnvironment = setupVincentDevelopmentEnvironment;
|