@lit-protocol/vincent-e2e-test-utils 3.0.2-alpha.0 → 3.1.0-alpha
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/dist/package.json +2 -2
- package/dist/src/index.d.ts +2 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -8
- package/dist/src/index.js.map +1 -1
- package/dist/src/setup-dev-env/app-registration/areAbilitiesAndPoliciesEqual.d.ts.map +1 -0
- package/dist/src/setup-dev-env/app-registration/areAbilitiesAndPoliciesEqual.js.map +1 -0
- package/dist/src/{lib/setup/app-registration/handleAppRegistration.d.ts → setup-dev-env/app-registration/handeAppRegistration.d.ts} +2 -2
- package/dist/src/setup-dev-env/app-registration/handeAppRegistration.d.ts.map +1 -0
- package/dist/src/{lib/setup/app-registration/handleAppRegistration.js → setup-dev-env/app-registration/handeAppRegistration.js} +1 -1
- package/dist/src/setup-dev-env/app-registration/handeAppRegistration.js.map +1 -0
- package/dist/src/{lib/setup → setup-dev-env}/app-registration/registerNewApp.d.ts +1 -1
- package/dist/src/setup-dev-env/app-registration/registerNewApp.d.ts.map +1 -0
- package/dist/src/{lib/setup → setup-dev-env}/app-registration/registerNewApp.js +2 -2
- package/dist/src/setup-dev-env/app-registration/registerNewApp.js.map +1 -0
- package/dist/src/setup-dev-env/app-registration/registerNewAppVersion.d.ts.map +1 -0
- package/dist/src/{lib/setup → setup-dev-env}/app-registration/registerNewAppVersion.js +2 -2
- package/dist/src/setup-dev-env/app-registration/registerNewAppVersion.js.map +1 -0
- package/dist/src/setup-dev-env/blockchain/installAppUsingUserEoa.d.ts +31 -0
- package/dist/src/setup-dev-env/blockchain/installAppUsingUserEoa.d.ts.map +1 -0
- package/dist/src/setup-dev-env/blockchain/installAppUsingUserEoa.js +40 -0
- package/dist/src/setup-dev-env/blockchain/installAppUsingUserEoa.js.map +1 -0
- package/dist/src/setup-dev-env/blockchain/registerNewAppVersionOnChain.d.ts.map +1 -0
- package/dist/src/setup-dev-env/blockchain/registerNewAppVersionOnChain.js.map +1 -0
- package/dist/src/setup-dev-env/getEnv.d.ts.map +1 -0
- package/dist/src/{lib/setup → setup-dev-env}/getEnv.js +0 -1
- package/dist/src/setup-dev-env/getEnv.js.map +1 -0
- package/dist/src/setup-dev-env/index.d.ts +7 -0
- package/dist/src/setup-dev-env/index.d.ts.map +1 -0
- package/dist/src/setup-dev-env/index.js +12 -0
- package/dist/src/setup-dev-env/index.js.map +1 -0
- package/dist/src/setup-dev-env/setupAgentSmartAccount.d.ts +18 -0
- package/dist/src/setup-dev-env/setupAgentSmartAccount.d.ts.map +1 -0
- package/dist/src/setup-dev-env/setupAgentSmartAccount.js +80 -0
- package/dist/src/setup-dev-env/setupAgentSmartAccount.js.map +1 -0
- package/dist/src/{lib/setup/app-setup.d.ts → setup-dev-env/setupVincentApp.d.ts} +2 -2
- package/dist/src/setup-dev-env/setupVincentApp.d.ts.map +1 -0
- package/dist/src/{lib/setup/app-setup.js → setup-dev-env/setupVincentApp.js} +5 -5
- package/dist/src/setup-dev-env/setupVincentApp.js.map +1 -0
- package/dist/src/{lib/setup/types.d.ts → setup-dev-env/setupVincentDevEnv.d.ts} +36 -51
- package/dist/src/setup-dev-env/setupVincentDevEnv.d.ts.map +1 -0
- package/dist/src/{lib/setupVincentDevelopmentEnv.js → setup-dev-env/setupVincentDevEnv.js} +22 -23
- package/dist/src/setup-dev-env/setupVincentDevEnv.js.map +1 -0
- package/dist/src/setup-dev-env/smart-account/createPermissionApproval.d.ts +25 -0
- package/dist/src/setup-dev-env/smart-account/createPermissionApproval.d.ts.map +1 -0
- package/dist/src/{lib/setup → setup-dev-env}/smart-account/createPermissionApproval.js +17 -2
- package/dist/src/setup-dev-env/smart-account/createPermissionApproval.js.map +1 -0
- package/dist/src/setup-dev-env/smart-account/deploySmartAccount.d.ts +15 -0
- package/dist/src/setup-dev-env/smart-account/deploySmartAccount.d.ts.map +1 -0
- package/dist/src/{lib/setup/smart-account/deploySmartAccountToChain.js → setup-dev-env/smart-account/deploySmartAccount.js} +29 -30
- package/dist/src/setup-dev-env/smart-account/deploySmartAccount.js.map +1 -0
- package/dist/src/setup-dev-env/smart-account/deriveSmartAccountAddress.d.ts +3 -0
- package/dist/src/setup-dev-env/smart-account/deriveSmartAccountAddress.d.ts.map +1 -0
- package/dist/src/setup-dev-env/smart-account/deriveSmartAccountAddress.js +16 -0
- package/dist/src/setup-dev-env/smart-account/deriveSmartAccountAddress.js.map +1 -0
- package/dist/src/setup-dev-env/vincent-registry-api/completeAppInstallation.d.ts +15 -0
- package/dist/src/setup-dev-env/vincent-registry-api/completeAppInstallation.d.ts.map +1 -0
- package/dist/src/setup-dev-env/vincent-registry-api/completeAppInstallation.js +56 -0
- package/dist/src/setup-dev-env/vincent-registry-api/completeAppInstallation.js.map +1 -0
- package/dist/src/setup-dev-env/vincent-registry-api/generateAppManagerJwt.d.ts.map +1 -0
- package/dist/src/setup-dev-env/vincent-registry-api/generateAppManagerJwt.js.map +1 -0
- package/dist/src/setup-dev-env/vincent-registry-api/installApp.d.ts +16 -0
- package/dist/src/setup-dev-env/vincent-registry-api/installApp.d.ts.map +1 -0
- package/dist/src/{lib/setup/vincent-api/installAppViaVincentApi.js → setup-dev-env/vincent-registry-api/installApp.js} +8 -10
- package/dist/src/setup-dev-env/vincent-registry-api/installApp.js.map +1 -0
- package/dist/src/setup-dev-env/vincent-registry-api/registerApp.d.ts +8 -0
- package/dist/src/setup-dev-env/vincent-registry-api/registerApp.d.ts.map +1 -0
- package/dist/src/{lib/setup/vincent-api/registerAppWithVincentApi.js → setup-dev-env/vincent-registry-api/registerApp.js} +3 -3
- package/dist/src/setup-dev-env/vincent-registry-api/registerApp.js.map +1 -0
- package/dist/src/setup-dev-env/vincent-registry-api/registerAppVersion.d.ts +9 -0
- package/dist/src/setup-dev-env/vincent-registry-api/registerAppVersion.d.ts.map +1 -0
- package/dist/src/{lib/setup/vincent-api/registerAppVersionWithVincentApi.js → setup-dev-env/vincent-registry-api/registerAppVersion.js} +3 -3
- package/dist/src/setup-dev-env/vincent-registry-api/registerAppVersion.js.map +1 -0
- package/dist/src/setup-dev-env/vincent-registry-api/setActiveAppVersion.d.ts +7 -0
- package/dist/src/setup-dev-env/vincent-registry-api/setActiveAppVersion.d.ts.map +1 -0
- package/dist/src/{lib/setup/vincent-api/setActiveVersionWithVincentApi.js → setup-dev-env/vincent-registry-api/setActiveAppVersion.js} +3 -3
- package/dist/src/setup-dev-env/vincent-registry-api/setActiveAppVersion.js.map +1 -0
- package/dist/src/{lib/setup/wallets/ensureWalletHasUnexpiredCapacityCredit.d.ts → setup-dev-env/wallets/ensureWalletHasCapacityCredit.d.ts} +2 -2
- package/dist/src/setup-dev-env/wallets/ensureWalletHasCapacityCredit.d.ts.map +1 -0
- package/dist/src/{lib/setup/wallets/ensureWalletHasUnexpiredCapacityCredit.js → setup-dev-env/wallets/ensureWalletHasCapacityCredit.js} +3 -3
- package/dist/src/setup-dev-env/wallets/ensureWalletHasCapacityCredit.js.map +1 -0
- package/dist/src/setup-dev-env/wallets/ensureWalletHasTokens.d.ts.map +1 -0
- package/dist/src/{lib/setup → setup-dev-env}/wallets/ensureWalletHasTokens.js +2 -1
- package/dist/src/setup-dev-env/wallets/ensureWalletHasTokens.js.map +1 -0
- package/dist/src/{lib/setup → setup-dev-env}/wallets/setupWallets.d.ts +1 -1
- package/dist/src/setup-dev-env/wallets/setupWallets.d.ts.map +1 -0
- package/dist/src/{lib/setup → setup-dev-env}/wallets/setupWallets.js +7 -7
- package/dist/src/setup-dev-env/wallets/setupWallets.js.map +1 -0
- package/package.json +5 -5
- package/dist/src/lib/setup/app-registration/areAbilitiesAndPoliciesEqual.d.ts.map +0 -1
- package/dist/src/lib/setup/app-registration/areAbilitiesAndPoliciesEqual.js.map +0 -1
- package/dist/src/lib/setup/app-registration/handleAppRegistration.d.ts.map +0 -1
- package/dist/src/lib/setup/app-registration/handleAppRegistration.js.map +0 -1
- package/dist/src/lib/setup/app-registration/registerNewApp.d.ts.map +0 -1
- package/dist/src/lib/setup/app-registration/registerNewApp.js.map +0 -1
- package/dist/src/lib/setup/app-registration/registerNewAppVersion.d.ts.map +0 -1
- package/dist/src/lib/setup/app-registration/registerNewAppVersion.js.map +0 -1
- package/dist/src/lib/setup/app-setup.d.ts.map +0 -1
- package/dist/src/lib/setup/app-setup.js.map +0 -1
- package/dist/src/lib/setup/blockchain/installAppUsingUserEoa.d.ts +0 -10
- package/dist/src/lib/setup/blockchain/installAppUsingUserEoa.d.ts.map +0 -1
- package/dist/src/lib/setup/blockchain/installAppUsingUserEoa.js +0 -17
- package/dist/src/lib/setup/blockchain/installAppUsingUserEoa.js.map +0 -1
- package/dist/src/lib/setup/blockchain/registerNewAppVersionOnChain.d.ts.map +0 -1
- package/dist/src/lib/setup/blockchain/registerNewAppVersionOnChain.js.map +0 -1
- package/dist/src/lib/setup/getEnv.d.ts.map +0 -1
- package/dist/src/lib/setup/getEnv.js.map +0 -1
- package/dist/src/lib/setup/index.d.ts +0 -9
- package/dist/src/lib/setup/index.d.ts.map +0 -1
- package/dist/src/lib/setup/index.js +0 -18
- package/dist/src/lib/setup/index.js.map +0 -1
- package/dist/src/lib/setup/setupAgentSmartAccount.d.ts +0 -19
- package/dist/src/lib/setup/setupAgentSmartAccount.d.ts.map +0 -1
- package/dist/src/lib/setup/setupAgentSmartAccount.js +0 -100
- package/dist/src/lib/setup/setupAgentSmartAccount.js.map +0 -1
- package/dist/src/lib/setup/smart-account/createPermissionApproval.d.ts +0 -11
- package/dist/src/lib/setup/smart-account/createPermissionApproval.d.ts.map +0 -1
- package/dist/src/lib/setup/smart-account/createPermissionApproval.js.map +0 -1
- package/dist/src/lib/setup/smart-account/deploySmartAccountToChain.d.ts +0 -16
- package/dist/src/lib/setup/smart-account/deploySmartAccountToChain.d.ts.map +0 -1
- package/dist/src/lib/setup/smart-account/deploySmartAccountToChain.js.map +0 -1
- package/dist/src/lib/setup/smart-account/deriveAgentAddress.d.ts +0 -23
- package/dist/src/lib/setup/smart-account/deriveAgentAddress.d.ts.map +0 -1
- package/dist/src/lib/setup/smart-account/deriveAgentAddress.js +0 -36
- package/dist/src/lib/setup/smart-account/deriveAgentAddress.js.map +0 -1
- package/dist/src/lib/setup/smart-account/vincentViemPkpSigner.d.ts +0 -12
- package/dist/src/lib/setup/smart-account/vincentViemPkpSigner.d.ts.map +0 -1
- package/dist/src/lib/setup/smart-account/vincentViemPkpSigner.js +0 -82
- package/dist/src/lib/setup/smart-account/vincentViemPkpSigner.js.map +0 -1
- package/dist/src/lib/setup/smart-account/wrapKernelAccountWithUserOpCapture.d.ts +0 -10
- package/dist/src/lib/setup/smart-account/wrapKernelAccountWithUserOpCapture.d.ts.map +0 -1
- package/dist/src/lib/setup/smart-account/wrapKernelAccountWithUserOpCapture.js +0 -34
- package/dist/src/lib/setup/smart-account/wrapKernelAccountWithUserOpCapture.js.map +0 -1
- package/dist/src/lib/setup/types.d.ts.map +0 -1
- package/dist/src/lib/setup/types.js +0 -3
- package/dist/src/lib/setup/types.js.map +0 -1
- package/dist/src/lib/setup/vincent-api/completeAppInstallationViaVincentApi.d.ts +0 -32
- package/dist/src/lib/setup/vincent-api/completeAppInstallationViaVincentApi.d.ts.map +0 -1
- package/dist/src/lib/setup/vincent-api/completeAppInstallationViaVincentApi.js +0 -58
- package/dist/src/lib/setup/vincent-api/completeAppInstallationViaVincentApi.js.map +0 -1
- package/dist/src/lib/setup/vincent-api/generateAppManagerJwt.d.ts.map +0 -1
- package/dist/src/lib/setup/vincent-api/generateAppManagerJwt.js.map +0 -1
- package/dist/src/lib/setup/vincent-api/installAppViaVincentApi.d.ts +0 -31
- package/dist/src/lib/setup/vincent-api/installAppViaVincentApi.d.ts.map +0 -1
- package/dist/src/lib/setup/vincent-api/installAppViaVincentApi.js.map +0 -1
- package/dist/src/lib/setup/vincent-api/registerAppVersionWithVincentApi.d.ts +0 -9
- package/dist/src/lib/setup/vincent-api/registerAppVersionWithVincentApi.d.ts.map +0 -1
- package/dist/src/lib/setup/vincent-api/registerAppVersionWithVincentApi.js.map +0 -1
- package/dist/src/lib/setup/vincent-api/registerAppWithVincentApi.d.ts +0 -8
- package/dist/src/lib/setup/vincent-api/registerAppWithVincentApi.d.ts.map +0 -1
- package/dist/src/lib/setup/vincent-api/registerAppWithVincentApi.js.map +0 -1
- package/dist/src/lib/setup/vincent-api/setActiveVersionWithVincentApi.d.ts +0 -7
- package/dist/src/lib/setup/vincent-api/setActiveVersionWithVincentApi.d.ts.map +0 -1
- package/dist/src/lib/setup/vincent-api/setActiveVersionWithVincentApi.js.map +0 -1
- package/dist/src/lib/setup/wallets/ensureWalletHasTokens.d.ts.map +0 -1
- package/dist/src/lib/setup/wallets/ensureWalletHasTokens.js.map +0 -1
- package/dist/src/lib/setup/wallets/ensureWalletHasUnexpiredCapacityCredit.d.ts.map +0 -1
- package/dist/src/lib/setup/wallets/ensureWalletHasUnexpiredCapacityCredit.js.map +0 -1
- package/dist/src/lib/setup/wallets/setupWallets.d.ts.map +0 -1
- package/dist/src/lib/setup/wallets/setupWallets.js.map +0 -1
- package/dist/src/lib/setupVincentDevelopmentEnv.d.ts +0 -3
- package/dist/src/lib/setupVincentDevelopmentEnv.d.ts.map +0 -1
- package/dist/src/lib/setupVincentDevelopmentEnv.js.map +0 -1
- /package/dist/src/{lib/setup → setup-dev-env}/app-registration/areAbilitiesAndPoliciesEqual.d.ts +0 -0
- /package/dist/src/{lib/setup → setup-dev-env}/app-registration/areAbilitiesAndPoliciesEqual.js +0 -0
- /package/dist/src/{lib/setup → setup-dev-env}/app-registration/registerNewAppVersion.d.ts +0 -0
- /package/dist/src/{lib/setup → setup-dev-env}/blockchain/registerNewAppVersionOnChain.d.ts +0 -0
- /package/dist/src/{lib/setup → setup-dev-env}/blockchain/registerNewAppVersionOnChain.js +0 -0
- /package/dist/src/{lib/setup → setup-dev-env}/getEnv.d.ts +0 -0
- /package/dist/src/{lib/setup/vincent-api → setup-dev-env/vincent-registry-api}/generateAppManagerJwt.d.ts +0 -0
- /package/dist/src/{lib/setup/vincent-api → setup-dev-env/vincent-registry-api}/generateAppManagerJwt.js +0 -0
- /package/dist/src/{lib/setup → setup-dev-env}/wallets/ensureWalletHasTokens.d.ts +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setupVincentDevelopmentEnvironment = setupVincentDevelopmentEnvironment;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const setupWallets_1 = require("./wallets/setupWallets");
|
|
5
|
+
const setupVincentApp_1 = require("./setupVincentApp");
|
|
6
|
+
const setupAgentSmartAccount_1 = require("./setupAgentSmartAccount");
|
|
6
7
|
async function setupVincentDevelopmentEnvironment(config) {
|
|
7
8
|
console.log('=== Setting up Vincent Development Environment ===');
|
|
8
9
|
console.table({
|
|
@@ -11,14 +12,14 @@ async function setupVincentDevelopmentEnvironment(config) {
|
|
|
11
12
|
VINCENT_REGISTRY_RPC_URL: config.vincentRegistryRpcUrl,
|
|
12
13
|
});
|
|
13
14
|
// Phase 1: Setup wallets and fund them
|
|
14
|
-
const { accounts, ethersWallets, clients } = await (0,
|
|
15
|
+
const { accounts, ethersWallets, clients } = await (0, setupWallets_1.setupWallets)({
|
|
15
16
|
privateKeys: config.privateKeys,
|
|
16
17
|
vincentRegistryChain: config.vincentRegistryChain,
|
|
17
18
|
vincentRegistryRpcUrl: config.vincentRegistryRpcUrl,
|
|
18
19
|
funding: config.funding,
|
|
19
20
|
});
|
|
20
21
|
// Phase 2: Setup Vincent app (registration and API configuration)
|
|
21
|
-
const appInfo = await (0,
|
|
22
|
+
const appInfo = await (0, setupVincentApp_1.setupVincentApp)({
|
|
22
23
|
vincentRegistryRpcUrl: config.vincentRegistryRpcUrl,
|
|
23
24
|
vincentApiUrl: config.vincentApiUrl,
|
|
24
25
|
appManagerPrivateKey: config.privateKeys.appManager,
|
|
@@ -28,37 +29,35 @@ async function setupVincentDevelopmentEnvironment(config) {
|
|
|
28
29
|
abilityIpfsCids: config.abilityIpfsCids,
|
|
29
30
|
abilityPolicies: config.abilityPolicies,
|
|
30
31
|
});
|
|
31
|
-
// Phase 3: Setup user's agent smart account (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
funderPrivateKey: config.privateKeys.funder,
|
|
42
|
-
// Assume the user is deploying to Base Sepolia, and 0.005 ETH is enough for smart account deployment
|
|
43
|
-
fundAmountBeforeDeployment: config.smartAccountFundAmountBeforeDeployment ?? (0, viem_1.parseEther)('0.005'),
|
|
44
|
-
sponsorGasForAppInstallation: config.sponsorGasForAppInstallation,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
32
|
+
// Phase 3: Setup user's agent smart account (sign typed data and complete installation)
|
|
33
|
+
const agentSmartAccountInfo = await (0, setupAgentSmartAccount_1.setupAgentSmartAccount)({
|
|
34
|
+
vincentRegistryRpcUrl: config.vincentRegistryRpcUrl,
|
|
35
|
+
vincentApiUrl: config.vincentApiUrl,
|
|
36
|
+
vincentRegistryChain: config.vincentRegistryChain,
|
|
37
|
+
smartAccountChainRpcUrl: config.smartAccountChainRpcUrl,
|
|
38
|
+
smartAccountChain: config.smartAccountChain,
|
|
39
|
+
userEoaPrivateKey: config.privateKeys.userEoa,
|
|
40
|
+
vincentAppId: appInfo.appId,
|
|
41
|
+
});
|
|
47
42
|
console.log('=== Vincent Development Environment Setup Complete ===');
|
|
48
43
|
return {
|
|
49
44
|
vincentRegistryRpcUrl: config.vincentRegistryRpcUrl,
|
|
50
45
|
vincentRegistryChain: config.vincentRegistryChain,
|
|
46
|
+
smartAccountChainRpcUrl: config.smartAccountChainRpcUrl,
|
|
47
|
+
smartAccountChain: config.smartAccountChain,
|
|
51
48
|
appId: appInfo.appId,
|
|
52
49
|
appVersion: appInfo.appVersion,
|
|
53
50
|
accountIndexHash: appInfo.accountIndexHash,
|
|
54
51
|
accounts,
|
|
55
52
|
ethersWallets,
|
|
56
53
|
clients,
|
|
57
|
-
agentSmartAccount:
|
|
54
|
+
agentSmartAccount: {
|
|
58
55
|
address: agentSmartAccountInfo.agentSmartAccountAddress,
|
|
59
56
|
agentSignerAddress: agentSmartAccountInfo.agentSignerAddress,
|
|
60
57
|
deploymentTxHash: agentSmartAccountInfo.deploymentTxHash,
|
|
61
|
-
|
|
58
|
+
serializedPermissionAccount: agentSmartAccountInfo.serializedPermissionAccount,
|
|
59
|
+
permitAppVersionTxHash: agentSmartAccountInfo.permitAppVersionTxHash,
|
|
60
|
+
},
|
|
62
61
|
};
|
|
63
62
|
}
|
|
64
|
-
//# sourceMappingURL=
|
|
63
|
+
//# sourceMappingURL=setupVincentDevEnv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupVincentDevEnv.js","sourceRoot":"","sources":["../../../src/setup-dev-env/setupVincentDevEnv.ts"],"names":[],"mappings":";;AAmFA,gFA8DC;AA9ID,yDAAsD;AACtD,uDAAoD;AACpD,qEAAkE;AA8E3D,KAAK,UAAU,kCAAkC,CACtD,MAAmB;IAEnB,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;IAClE,OAAO,CAAC,KAAK,CAAC;QACZ,wBAAwB,EAAE,MAAM,CAAC,oBAAoB,CAAC,IAAI;QAC1D,yBAAyB,EAAE,MAAM,CAAC,oBAAoB,CAAC,EAAE;QACzD,wBAAwB,EAAE,MAAM,CAAC,qBAAqB;KACvD,CAAC,CAAC;IAEH,uCAAuC;IACvC,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,2BAAY,EAAC;QAC9D,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,oBAAoB,EAAE,MAAM,CAAC,oBAAoB;QACjD,qBAAqB,EAAE,MAAM,CAAC,qBAAqB;QACnD,OAAO,EAAE,MAAM,CAAC,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B,OAAO,EAAE,qBAAqB,CAAC,wBAAwB;YACvD,kBAAkB,EAAE,qBAAqB,CAAC,kBAAkB;YAC5D,gBAAgB,EAAE,qBAAqB,CAAC,gBAAgB;YACxD,2BAA2B,EAAE,qBAAqB,CAAC,2BAA2B;YAC9E,sBAAsB,EAAE,qBAAqB,CAAC,sBAAsB;SACrE;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Address, Chain } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a serialized permission approval that allows a session key (PKP) to act on behalf of the smart account.
|
|
4
|
+
*
|
|
5
|
+
* This follows the ZeroDev pattern from transaction-automation.ts:
|
|
6
|
+
* 1. Owner creates an account with BOTH validators (EOA sudo + session key permission)
|
|
7
|
+
* 2. Serializes the permission account
|
|
8
|
+
* 3. Session key can later deserialize and use it to sign transactions
|
|
9
|
+
*
|
|
10
|
+
* The serialized approval contains:
|
|
11
|
+
* - Smart account configuration (sudo validator = EOA)
|
|
12
|
+
* - Permission validator configuration (session key = PKP with sudo policy)
|
|
13
|
+
* - All necessary data for the session key to reconstruct the account
|
|
14
|
+
*
|
|
15
|
+
* @param params Configuration for creating the permission approval
|
|
16
|
+
* @returns Serialized permission approval string that can be deserialized by the session key
|
|
17
|
+
*/
|
|
18
|
+
export declare function createPermissionApproval({ userEoaPrivateKey, sessionKeyAddress, accountIndexHash, targetChain, targetChainRpcUrl, }: {
|
|
19
|
+
userEoaPrivateKey: `0x${string}`;
|
|
20
|
+
sessionKeyAddress: Address;
|
|
21
|
+
accountIndexHash: string;
|
|
22
|
+
targetChain: Chain;
|
|
23
|
+
targetChainRpcUrl: string;
|
|
24
|
+
}): Promise<string>;
|
|
25
|
+
//# sourceMappingURL=createPermissionApproval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPermissionApproval.d.ts","sourceRoot":"","sources":["../../../../src/setup-dev-env/smart-account/createPermissionApproval.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAU3C;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,wBAAwB,CAAC,EAC7C,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,GAClB,EAAE;IACD,iBAAiB,EAAE,KAAK,MAAM,EAAE,CAAC;IACjC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,KAAK,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,GAAG,OAAO,CAAC,MAAM,CAAC,CAqClB"}
|
|
@@ -9,7 +9,23 @@ const permissions_1 = require("@zerodev/permissions");
|
|
|
9
9
|
const signers_1 = require("@zerodev/permissions/signers");
|
|
10
10
|
const policies_1 = require("@zerodev/permissions/policies");
|
|
11
11
|
const constants_1 = require("@zerodev/sdk/constants");
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Creates a serialized permission approval that allows a session key (PKP) to act on behalf of the smart account.
|
|
14
|
+
*
|
|
15
|
+
* This follows the ZeroDev pattern from transaction-automation.ts:
|
|
16
|
+
* 1. Owner creates an account with BOTH validators (EOA sudo + session key permission)
|
|
17
|
+
* 2. Serializes the permission account
|
|
18
|
+
* 3. Session key can later deserialize and use it to sign transactions
|
|
19
|
+
*
|
|
20
|
+
* The serialized approval contains:
|
|
21
|
+
* - Smart account configuration (sudo validator = EOA)
|
|
22
|
+
* - Permission validator configuration (session key = PKP with sudo policy)
|
|
23
|
+
* - All necessary data for the session key to reconstruct the account
|
|
24
|
+
*
|
|
25
|
+
* @param params Configuration for creating the permission approval
|
|
26
|
+
* @returns Serialized permission approval string that can be deserialized by the session key
|
|
27
|
+
*/
|
|
28
|
+
async function createPermissionApproval({ userEoaPrivateKey, sessionKeyAddress, accountIndexHash, targetChain, targetChainRpcUrl, }) {
|
|
13
29
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
14
30
|
chain: targetChain,
|
|
15
31
|
transport: (0, viem_1.http)(targetChainRpcUrl),
|
|
@@ -38,7 +54,6 @@ async function createPermissionApproval({ userEoaPrivateKey, sessionKeyAddress,
|
|
|
38
54
|
},
|
|
39
55
|
kernelVersion: constants_1.KERNEL_V3_3,
|
|
40
56
|
index: BigInt(accountIndexHash),
|
|
41
|
-
address: smartAccountAddress,
|
|
42
57
|
});
|
|
43
58
|
return await (0, permissions_1.serializePermissionAccount)(sessionKeyAccount);
|
|
44
59
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPermissionApproval.js","sourceRoot":"","sources":["../../../../src/setup-dev-env/smart-account/createPermissionApproval.ts"],"names":[],"mappings":";;AA0BA,4DAiDC;AA1ED,+BAAgD;AAChD,4CAAoD;AACpD,sCAA0E;AAC1E,8DAAkE;AAClE,sDAAyF;AACzF,0DAA6D;AAC7D,4DAA6D;AAC7D,sDAAoE;AAEpE;;;;;;;;;;;;;;;GAeG;AACI,KAAK,UAAU,wBAAwB,CAAC,EAC7C,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,GAOlB;IACC,MAAM,YAAY,GAAG,IAAA,yBAAkB,EAAC;QACtC,KAAK,EAAE,WAAW;QAClB,SAAS,EAAE,IAAA,WAAI,EAAC,iBAAiB,CAAC;KACnC,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,IAAA,8BAAmB,EAAC,iBAAiB,CAAC,CAAC;IAE9D,MAAM,cAAc,GAAG,MAAM,IAAA,wCAAsB,EAAC,YAAY,EAAE;QAChE,UAAU,EAAE,IAAA,yBAAa,EAAC,KAAK,CAAC;QAChC,MAAM,EAAE,cAAc;QACtB,aAAa,EAAE,uBAAW;KAC3B,CAAC,CAAC;IAEH,MAAM,sBAAsB,GAAG,IAAA,2BAAqB,EAAC,iBAAiB,CAAC,CAAC;IACxE,MAAM,qBAAqB,GAAG,MAAM,IAAA,uBAAa,EAAC;QAChD,MAAM,EAAE,sBAAsB;KAC/B,CAAC,CAAC;IAEH,MAAM,gBAAgB,GAAG,MAAM,IAAA,mCAAqB,EAAC,YAAY,EAAE;QACjE,UAAU,EAAE,IAAA,yBAAa,EAAC,KAAK,CAAC;QAChC,MAAM,EAAE,qBAAqB;QAC7B,QAAQ,EAAE,CAAC,IAAA,uBAAY,EAAC,EAAE,CAAC,CAAC;QAC5B,aAAa,EAAE,uBAAW;KAC3B,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,MAAM,IAAA,yBAAmB,EAAC,YAAY,EAAE;QAChE,UAAU,EAAE,IAAA,yBAAa,EAAC,KAAK,CAAC;QAChC,OAAO,EAAE;YACP,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,gBAAgB;SAC1B;QACD,aAAa,EAAE,uBAAW;QAC1B,KAAK,EAAE,MAAM,CAAC,gBAAgB,CAAC;KAChC,CAAC,CAAC;IAEH,OAAO,MAAM,IAAA,wCAA0B,EAAC,iBAAiB,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Address, Chain, Hex } from 'viem';
|
|
2
|
+
export interface SmartAccountInfo {
|
|
3
|
+
smartAccountAddress: Address;
|
|
4
|
+
deploymentTxHash?: Hex;
|
|
5
|
+
}
|
|
6
|
+
export declare function deploySmartAccount({ userEoaPrivateKey, accountIndexHash, targetChain, targetChainRpcUrl, zerodevProjectId, funderPrivateKey, fundAmountBeforeDeployment, }: {
|
|
7
|
+
userEoaPrivateKey: `0x${string}`;
|
|
8
|
+
accountIndexHash: string;
|
|
9
|
+
targetChain: Chain;
|
|
10
|
+
targetChainRpcUrl: string;
|
|
11
|
+
zerodevProjectId: string;
|
|
12
|
+
funderPrivateKey: `0x${string}`;
|
|
13
|
+
fundAmountBeforeDeployment?: bigint;
|
|
14
|
+
}): Promise<SmartAccountInfo>;
|
|
15
|
+
//# sourceMappingURL=deploySmartAccount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploySmartAccount.d.ts","sourceRoot":"","sources":["../../../../src/setup-dev-env/smart-account/deploySmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAShD,MAAM,WAAW,gBAAgB;IAC/B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,gBAAgB,CAAC,EAAE,GAAG,CAAC;CACxB;AAED,wBAAsB,kBAAkB,CAAC,EACvC,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,0BAA0B,GAC3B,EAAE;IACD,iBAAiB,EAAE,KAAK,MAAM,EAAE,CAAC;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,KAAK,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,KAAK,MAAM,EAAE,CAAC;IAChC,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACrC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAyI5B"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.deploySmartAccount = deploySmartAccount;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
5
|
const accounts_1 = require("viem/accounts");
|
|
6
6
|
const sdk_1 = require("@zerodev/sdk");
|
|
7
7
|
const ecdsa_validator_1 = require("@zerodev/ecdsa-validator");
|
|
8
8
|
const constants_1 = require("@zerodev/sdk/constants");
|
|
9
9
|
const ensureWalletHasTokens_1 = require("../wallets/ensureWalletHasTokens");
|
|
10
|
-
async function
|
|
10
|
+
async function deploySmartAccount({ userEoaPrivateKey, accountIndexHash, targetChain, targetChainRpcUrl, zerodevProjectId, funderPrivateKey, fundAmountBeforeDeployment, }) {
|
|
11
11
|
console.log(`=== Deploying Smart Account to ${targetChain.name} ===`);
|
|
12
12
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
13
13
|
chain: targetChain,
|
|
@@ -56,36 +56,35 @@ async function deploySmartAccountToChain({ userEoaPrivateKey, accountIndexHash,
|
|
|
56
56
|
Status: 'Already Deployed',
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
// Step 2: Fund the smart account (if fundAmountBeforeDeployment is provided)
|
|
60
|
+
if (fundAmountBeforeDeployment !== undefined) {
|
|
61
|
+
console.log('Funding smart account...');
|
|
62
|
+
const { currentBalance, fundingTxHash } = await (0, ensureWalletHasTokens_1.ensureWalletHasTokens)({
|
|
63
|
+
address: userEoaKernelAccount.address,
|
|
64
|
+
funderWalletClient,
|
|
65
|
+
publicClient,
|
|
66
|
+
minAmount: fundAmountBeforeDeployment,
|
|
67
|
+
});
|
|
68
|
+
console.table({
|
|
69
|
+
'Smart Account Address': userEoaKernelAccount.address,
|
|
70
|
+
Balance: (0, viem_1.formatEther)(currentBalance),
|
|
71
|
+
'Funding Tx Hash': fundingTxHash,
|
|
72
|
+
});
|
|
73
|
+
if (fundingTxHash) {
|
|
74
|
+
console.log('Waiting for funding confirmation...');
|
|
75
|
+
await publicClient.waitForTransactionReceipt({
|
|
76
|
+
hash: fundingTxHash,
|
|
77
|
+
confirmations: 2,
|
|
74
78
|
});
|
|
75
|
-
if (fundingTxHash) {
|
|
76
|
-
console.log('Waiting for funding confirmation...');
|
|
77
|
-
await publicClient.waitForTransactionReceipt({
|
|
78
|
-
hash: fundingTxHash,
|
|
79
|
-
confirmations: 2,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
console.log('Skipping funding step (fundAmountBeforeDeployment not provided)');
|
|
85
79
|
}
|
|
86
|
-
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
console.log('Skipping funding step (fundAmountBeforeDeployment not provided)');
|
|
83
|
+
}
|
|
84
|
+
// Step 3: Deploy the smart account (only if not already deployed)
|
|
85
|
+
let deploymentTxHash;
|
|
86
|
+
if (!isAlreadyDeployed) {
|
|
87
87
|
console.log('Deploying smart account...');
|
|
88
|
-
// Deploy with a no-op call to avoid potential fallback/receive reverts
|
|
89
88
|
const userOpHash = await kernelClient.sendUserOperation({
|
|
90
89
|
callData: await userEoaKernelAccount.encodeCalls([
|
|
91
90
|
{
|
|
@@ -125,4 +124,4 @@ async function deploySmartAccountToChain({ userEoaPrivateKey, accountIndexHash,
|
|
|
125
124
|
deploymentTxHash,
|
|
126
125
|
};
|
|
127
126
|
}
|
|
128
|
-
//# sourceMappingURL=
|
|
127
|
+
//# sourceMappingURL=deploySmartAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploySmartAccount.js","sourceRoot":"","sources":["../../../../src/setup-dev-env/smart-account/deploySmartAccount.ts"],"names":[],"mappings":";;AAcA,gDAyJC;AAtKD,+BAAiF;AACjF,4CAAoD;AACpD,sCAA8E;AAC9E,8DAAkE;AAClE,sDAAoE;AAEpE,4EAAyE;AAOlE,KAAK,UAAU,kBAAkB,CAAC,EACvC,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,0BAA0B,GAS3B;IACC,OAAO,CAAC,GAAG,CAAC,kCAAkC,WAAW,CAAC,IAAI,MAAM,CAAC,CAAC;IAEtE,MAAM,YAAY,GAAG,IAAA,yBAAkB,EAAC;QACtC,KAAK,EAAE,WAAW;QAClB,SAAS,EAAE,IAAA,WAAI,EAAC,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CAAC,OAAO;QACjD,gBAAgB;KACjB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deriveSmartAccountAddress.d.ts","sourceRoot":"","sources":["../../../../src/setup-dev-env/smart-account/deriveSmartAccountAddress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,OAAO,EACnB,gBAAgB,EAAE,MAAM,EACxB,YAAY,EAAE,GAAG,GAChB,OAAO,CAAC,OAAO,CAAC,CAUlB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deriveSmartAccountAddress = deriveSmartAccountAddress;
|
|
4
|
+
const ecdsa_validator_1 = require("@zerodev/ecdsa-validator");
|
|
5
|
+
const constants_1 = require("@zerodev/sdk/constants");
|
|
6
|
+
async function deriveSmartAccountAddress(eoaAddress, accountIndexHash, publicClient) {
|
|
7
|
+
const agentAddress = await (0, ecdsa_validator_1.getKernelAddressFromECDSA)({
|
|
8
|
+
entryPoint: (0, constants_1.getEntryPoint)('0.7'),
|
|
9
|
+
kernelVersion: constants_1.KERNEL_V3_1,
|
|
10
|
+
eoaAddress,
|
|
11
|
+
index: BigInt(accountIndexHash),
|
|
12
|
+
publicClient: publicClient,
|
|
13
|
+
});
|
|
14
|
+
return agentAddress;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=deriveSmartAccountAddress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deriveSmartAccountAddress.js","sourceRoot":"","sources":["../../../../src/setup-dev-env/smart-account/deriveSmartAccountAddress.ts"],"names":[],"mappings":";;AAIA,8DAcC;AAjBD,8DAAqE;AACrE,sDAAoE;AAE7D,KAAK,UAAU,yBAAyB,CAC7C,UAAmB,EACnB,gBAAwB,EACxB,YAAiB;IAEjB,MAAM,YAAY,GAAG,MAAM,IAAA,2CAAyB,EAAC;QACnD,UAAU,EAAE,IAAA,yBAAa,EAAC,KAAK,CAAC;QAChC,aAAa,EAAE,uBAAW;QAC1B,UAAU;QACV,KAAK,EAAE,MAAM,CAAC,gBAAgB,CAAC;QAC/B,YAAY,EAAE,YAAmB;KAClC,CAAC,CAAC;IAEH,OAAO,YAAuB,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface CompleteInstallationResult {
|
|
2
|
+
deployAgentSmartAccountTransactionHash: string;
|
|
3
|
+
serializedPermissionAccount: string;
|
|
4
|
+
completeAppInstallationTransactionHash: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function completeAppInstallation({ vincentApiUrl, userEoaPrivateKey, appId, appInstallationDataToSign, agentSmartAccountDeploymentDataToSign, sessionKeyApprovalDataToSign, agentSignerAddress, }: {
|
|
7
|
+
vincentApiUrl: string;
|
|
8
|
+
userEoaPrivateKey: string;
|
|
9
|
+
appId: number;
|
|
10
|
+
appInstallationDataToSign: any;
|
|
11
|
+
agentSmartAccountDeploymentDataToSign: any;
|
|
12
|
+
sessionKeyApprovalDataToSign: any;
|
|
13
|
+
agentSignerAddress: string;
|
|
14
|
+
}): Promise<CompleteInstallationResult>;
|
|
15
|
+
//# sourceMappingURL=completeAppInstallation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completeAppInstallation.d.ts","sourceRoot":"","sources":["../../../../src/setup-dev-env/vincent-registry-api/completeAppInstallation.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,0BAA0B;IACzC,sCAAsC,EAAE,MAAM,CAAC;IAC/C,2BAA2B,EAAE,MAAM,CAAC;IACpC,sCAAsC,EAAE,MAAM,CAAC;CAChD;AAED,wBAAsB,uBAAuB,CAAC,EAC5C,aAAa,EACb,iBAAiB,EACjB,KAAK,EACL,yBAAyB,EACzB,qCAAqC,EACrC,4BAA4B,EAC5B,kBAAkB,GACnB,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB,EAAE,GAAG,CAAC;IAC/B,qCAAqC,EAAE,GAAG,CAAC;IAC3C,4BAA4B,EAAE,GAAG,CAAC;IAClC,kBAAkB,EAAE,MAAM,CAAC;CAC5B,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAgEtC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.completeAppInstallation = completeAppInstallation;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const accounts_1 = require("viem/accounts");
|
|
6
|
+
async function completeAppInstallation({ vincentApiUrl, userEoaPrivateKey, appId, appInstallationDataToSign, agentSmartAccountDeploymentDataToSign, sessionKeyApprovalDataToSign, agentSignerAddress, }) {
|
|
7
|
+
console.log('=== Completing app installation via Vincent API (gas-sponsored) ===');
|
|
8
|
+
// Sign the three pieces of typed data
|
|
9
|
+
const wallet = new ethers_1.Wallet(userEoaPrivateKey);
|
|
10
|
+
const viemAccount = (0, accounts_1.privateKeyToAccount)(userEoaPrivateKey);
|
|
11
|
+
// 1. Sign the app installation EIP-712 typed data (for permitAppVersion)
|
|
12
|
+
const appInstallationTypedData = appInstallationDataToSign.typedData;
|
|
13
|
+
const { EIP712Domain: _, ...appInstallationTypesWithoutDomain } = appInstallationTypedData.types;
|
|
14
|
+
const appInstallationSignature = await wallet._signTypedData(appInstallationTypedData.domain, appInstallationTypesWithoutDomain, appInstallationTypedData.message);
|
|
15
|
+
// 2. Sign the smart account deployment message (raw message from getAppInstallTypedData)
|
|
16
|
+
const agentSmartAccountDeploymentSignature = await viemAccount.signMessage({
|
|
17
|
+
message: { raw: agentSmartAccountDeploymentDataToSign.messageToSign },
|
|
18
|
+
});
|
|
19
|
+
// 3. Sign the session key approval (serialized permission account from getSessionKeyApprovalTypedData)
|
|
20
|
+
const sessionKeyApprovalSignature = await viemAccount.signTypedData(sessionKeyApprovalDataToSign);
|
|
21
|
+
// Submit to Vincent API to complete installation
|
|
22
|
+
const response = await fetch(`${vincentApiUrl}/user/${appId}/complete-installation`, {
|
|
23
|
+
method: 'POST',
|
|
24
|
+
headers: {
|
|
25
|
+
'Content-Type': 'application/json',
|
|
26
|
+
},
|
|
27
|
+
body: JSON.stringify({
|
|
28
|
+
userControllerAddress: viemAccount.address,
|
|
29
|
+
agentSignerAddress,
|
|
30
|
+
appId,
|
|
31
|
+
appInstallation: {
|
|
32
|
+
typedDataSignature: appInstallationSignature,
|
|
33
|
+
dataToSign: appInstallationDataToSign,
|
|
34
|
+
},
|
|
35
|
+
agentSmartAccountDeployment: {
|
|
36
|
+
typedDataSignature: agentSmartAccountDeploymentSignature,
|
|
37
|
+
userOperation: agentSmartAccountDeploymentDataToSign.userOperation,
|
|
38
|
+
},
|
|
39
|
+
sessionKeyApproval: {
|
|
40
|
+
typedDataSignature: sessionKeyApprovalSignature,
|
|
41
|
+
},
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
if (!response.ok) {
|
|
45
|
+
const errorText = await response.text();
|
|
46
|
+
throw new Error(`Complete app installation via Vincent API failed: ${response.status} ${response.statusText} - ${errorText}`);
|
|
47
|
+
}
|
|
48
|
+
const data = (await response.json());
|
|
49
|
+
console.table({
|
|
50
|
+
'Deploy Smart Account Tx': data.deployAgentSmartAccountTransactionHash,
|
|
51
|
+
'Serialized Permission Account': data.serializedPermissionAccount.substring(0, 50) + '...',
|
|
52
|
+
'Complete Installation Tx': data.completeAppInstallationTransactionHash,
|
|
53
|
+
});
|
|
54
|
+
return data;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=completeAppInstallation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completeAppInstallation.js","sourceRoot":"","sources":["../../../../src/setup-dev-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YACL,eAAe,EAAE;gBACf,kBAAkB,EAAE,wBAAwB;gBAC5C,UAAU,EAAE,yBAAyB;aACtC;YACD,2BAA2B,EAAE;gBAC3B,kBAAkB,EAAE,oCAAoC;gBACxD,aAAa,EAAE,qCAAqC,CAAC,aAAa;aACnE;YACD,kBAAkB,EAAE;gBAClB,kBAAkB,EAAE,2BAA2B;aAChD;SACF,CAAC;KACH,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CACb,qDAAqD,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,MAAM,SAAS,EAAE,CAC7G,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAA+B,CAAC;IAEnE,OAAO,CAAC,KAAK,CAAC;QACZ,yBAAyB,EAAE,IAAI,CAAC,sCAAsC;QACtE,+BAA+B,EAAE,IAAI,CAAC,2BAA2B,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK;QAC1F,0BAA0B,EAAE,IAAI,CAAC,sCAAsC;KACxE,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateAppManagerJwt.d.ts","sourceRoot":"","sources":["../../../../src/setup-dev-env/vincent-registry-api/generateAppManagerJwt.ts"],"names":[],"mappings":"AAIA,wBAAsB,qBAAqB,CAAC,EAC1C,oBAAoB,GACrB,EAAE;IACD,oBAAoB,EAAE,KAAK,MAAM,EAAE,CAAC;CACrC,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateAppManagerJwt.js","sourceRoot":"","sources":["../../../../src/setup-dev-env/vincent-registry-api/generateAppManagerJwt.ts"],"names":[],"mappings":";;AAIA,sDA2BC;AA9BD,2DAA0E;AAC1E,mCAAgC;AAEzB,KAAK,UAAU,qBAAqB,CAAC,EAC1C,oBAAoB,GAGrB;IACC,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,oBAAoB,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;IAE1C,MAAM,GAAG,GAAG,MAAM,IAAA,2BAAqB,EAAC;QACtC,SAAS,EAAE,MAAoC;QAC/C,OAAO,EAAE;YACP,OAAO,EAAE,GAAG,EAAE,gCAAgC;YAC9C,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,UAAU,EAAE,OAAO;SACpB;QACD,OAAO,EAAE;YACP,IAAI,EAAE,qBAAqB;SAC5B;QACD,gBAAgB,EAAE,CAAC;QACnB,QAAQ,EAAE,wBAAwB;QAClC,cAAc,EAAE;YACd,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,OAAO;SACf;KACF,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface InstallAppResponse {
|
|
2
|
+
agentSignerAddress: string;
|
|
3
|
+
agentSmartAccountAddress: string;
|
|
4
|
+
appInstallationDataToSign: {
|
|
5
|
+
typedData: any;
|
|
6
|
+
};
|
|
7
|
+
agentSmartAccountDeploymentDataToSign: any;
|
|
8
|
+
sessionKeyApprovalDataToSign: any;
|
|
9
|
+
alreadyInstalled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function installApp({ vincentApiUrl, appId, userEoaPrivateKey, }: {
|
|
12
|
+
vincentApiUrl: string;
|
|
13
|
+
appId: number;
|
|
14
|
+
userEoaPrivateKey: string;
|
|
15
|
+
}): Promise<InstallAppResponse>;
|
|
16
|
+
//# sourceMappingURL=installApp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installApp.d.ts","sourceRoot":"","sources":["../../../../src/setup-dev-env/vincent-registry-api/installApp.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wBAAwB,EAAE,MAAM,CAAC;IACjC,yBAAyB,EAAE;QACzB,SAAS,EAAE,GAAG,CAAC;KAChB,CAAC;IACF,qCAAqC,EAAE,GAAG,CAAC;IAC3C,4BAA4B,EAAE,GAAG,CAAC;IAClC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAsB,UAAU,CAAC,EAC/B,aAAa,EACb,KAAK,EACL,iBAAiB,GAClB,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;CAC3B,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA+B9B"}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
async function installAppViaVincentApi({ vincentApiUrl, appId, userEoaAddress, sponsorGas = false, }) {
|
|
9
|
-
console.log('=== Installing app via Vincent API ===');
|
|
3
|
+
exports.installApp = installApp;
|
|
4
|
+
const accounts_1 = require("viem/accounts");
|
|
5
|
+
async function installApp({ vincentApiUrl, appId, userEoaPrivateKey, }) {
|
|
6
|
+
console.log('=== Installing app via Vincent API (gas-sponsored) ===');
|
|
7
|
+
const userEoaAccount = (0, accounts_1.privateKeyToAccount)(userEoaPrivateKey);
|
|
10
8
|
const response = await fetch(`${vincentApiUrl}/user/${appId}/install-app`, {
|
|
11
9
|
method: 'POST',
|
|
12
10
|
headers: {
|
|
13
11
|
'Content-Type': 'application/json',
|
|
14
12
|
},
|
|
15
13
|
body: JSON.stringify({
|
|
16
|
-
userControllerAddress:
|
|
17
|
-
sponsorGas,
|
|
14
|
+
userControllerAddress: userEoaAccount.address,
|
|
15
|
+
sponsorGas: true, // Always sponsor gas
|
|
18
16
|
}),
|
|
19
17
|
});
|
|
20
18
|
if (!response.ok) {
|
|
@@ -28,4 +26,4 @@ async function installAppViaVincentApi({ vincentApiUrl, appId, userEoaAddress, s
|
|
|
28
26
|
});
|
|
29
27
|
return data;
|
|
30
28
|
}
|
|
31
|
-
//# sourceMappingURL=
|
|
29
|
+
//# sourceMappingURL=installApp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installApp.js","sourceRoot":"","sources":["../../../../src/setup-dev-env/vincent-registry-api/installApp.ts"],"names":[],"mappings":";;AAaA,gCAuCC;AApDD,4CAAoD;AAa7C,KAAK,UAAU,UAAU,CAAC,EAC/B,aAAa,EACb,KAAK,EACL,iBAAiB,GAKlB;IACC,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;IAEtE,MAAM,cAAc,GAAG,IAAA,8BAAmB,EAAC,iBAAkC,CAAC,CAAC;IAE/E,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,aAAa,SAAS,KAAK,cAAc,EAAE;QACzE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,qBAAqB,EAAE,cAAc,CAAC,OAAO;YAC7C,UAAU,EAAE,IAAI,EAAE,qBAAqB;SACxC,CAAC;KACH,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CACb,uCAAuC,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,MAAM,SAAS,EAAE,CAC/F,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAuB,CAAC;IAE3D,OAAO,CAAC,KAAK,CAAC;QACZ,sBAAsB,EAAE,IAAI,CAAC,kBAAkB;QAC/C,6BAA6B,EAAE,IAAI,CAAC,wBAAwB;KAC7D,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AppMetadata } from '../setupVincentDevEnv';
|
|
2
|
+
export declare function registerApp({ vincentApiUrl, appManagerPrivateKey, appId, appMetadata, }: {
|
|
3
|
+
vincentApiUrl: string;
|
|
4
|
+
appManagerPrivateKey: `0x${string}`;
|
|
5
|
+
appId: number;
|
|
6
|
+
appMetadata: AppMetadata;
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=registerApp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerApp.d.ts","sourceRoot":"","sources":["../../../../src/setup-dev-env/vincent-registry-api/registerApp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,wBAAsB,WAAW,CAAC,EAChC,aAAa,EACb,oBAAoB,EACpB,KAAK,EACL,WAAW,GACZ,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,KAAK,MAAM,EAAE,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,WAAW,CAAC;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BhB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.registerApp = registerApp;
|
|
4
4
|
const generateAppManagerJwt_1 = require("./generateAppManagerJwt");
|
|
5
|
-
async function
|
|
5
|
+
async function registerApp({ vincentApiUrl, appManagerPrivateKey, appId, appMetadata, }) {
|
|
6
6
|
const jwtToken = await (0, generateAppManagerJwt_1.generateAppManagerJwt)({
|
|
7
7
|
appManagerPrivateKey,
|
|
8
8
|
});
|
|
@@ -27,4 +27,4 @@ async function registerAppWithVincentApi({ vincentApiUrl, appManagerPrivateKey,
|
|
|
27
27
|
throw new Error(`Register app with Vincent API failed: ${response.status} ${response.statusText} - ${errorText}`);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
//# sourceMappingURL=
|
|
30
|
+
//# sourceMappingURL=registerApp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerApp.js","sourceRoot":"","sources":["../../../../src/setup-dev-env/vincent-registry-api/registerApp.ts"],"names":[],"mappings":";;AAGA,kCAsCC;AAzCD,mEAAgE;AAGzD,KAAK,UAAU,WAAW,CAAC,EAChC,aAAa,EACb,oBAAoB,EACpB,KAAK,EACL,WAAW,GAMZ;IACC,MAAM,QAAQ,GAAG,MAAM,IAAA,6CAAqB,EAAC;QAC3C,oBAAoB;KACrB,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,aAAa,MAAM,EAAE;QACnD,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,QAAQ,EAAE;SACpC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,KAAK;YACL,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,WAAW,EAAE,WAAW,CAAC,WAAW;YACpC,YAAY,EAAE,WAAW,CAAC,YAAY;YACtC,MAAM,EAAE,WAAW,CAAC,MAAM;YAC1B,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,gBAAgB,EAAE,WAAW,CAAC,gBAAgB,IAAI,KAAK;SACxD,CAAC;KACH,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CACb,yCAAyC,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,MAAM,SAAS,EAAE,CACjG,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function registerAppVersion({ vincentApiUrl, appManagerPrivateKey, appId, whatChanged, }: {
|
|
2
|
+
vincentApiUrl: string;
|
|
3
|
+
appManagerPrivateKey: `0x${string}`;
|
|
4
|
+
appId: number;
|
|
5
|
+
whatChanged: string;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
newAppVersion: number;
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=registerAppVersion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerAppVersion.d.ts","sourceRoot":"","sources":["../../../../src/setup-dev-env/vincent-registry-api/registerAppVersion.ts"],"names":[],"mappings":"AAEA,wBAAsB,kBAAkB,CAAC,EACvC,aAAa,EACb,oBAAoB,EACpB,KAAK,EACL,WAAW,GACZ,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,KAAK,MAAM,EAAE,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC,CA0BrC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.registerAppVersion = registerAppVersion;
|
|
4
4
|
const generateAppManagerJwt_1 = require("./generateAppManagerJwt");
|
|
5
|
-
async function
|
|
5
|
+
async function registerAppVersion({ vincentApiUrl, appManagerPrivateKey, appId, whatChanged, }) {
|
|
6
6
|
const jwtToken = await (0, generateAppManagerJwt_1.generateAppManagerJwt)({
|
|
7
7
|
appManagerPrivateKey,
|
|
8
8
|
});
|
|
@@ -24,4 +24,4 @@ async function registerAppVersionWithVincentApi({ vincentApiUrl, appManagerPriva
|
|
|
24
24
|
newAppVersion: (await response.json()).version,
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
//# sourceMappingURL=
|
|
27
|
+
//# sourceMappingURL=registerAppVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerAppVersion.js","sourceRoot":"","sources":["../../../../src/setup-dev-env/vincent-registry-api/registerAppVersion.ts"],"names":[],"mappings":";;AAEA,gDAoCC;AAtCD,mEAAgE;AAEzD,KAAK,UAAU,kBAAkB,CAAC,EACvC,aAAa,EACb,oBAAoB,EACpB,KAAK,EACL,WAAW,GAMZ;IACC,MAAM,QAAQ,GAAG,MAAM,IAAA,6CAAqB,EAAC;QAC3C,oBAAoB;KACrB,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,aAAa,QAAQ,KAAK,UAAU,EAAE;QACpE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,QAAQ,EAAE;SACpC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,OAAO,EAAE,WAAW;SACrB,CAAC;KACH,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CACb,iDAAiD,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,MAAM,SAAS,EAAE,CACzG,CAAC;IACJ,CAAC;IAED,OAAO;QACL,aAAa,EAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAyB,CAAC,OAAO;KACxE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function setActiveVersion({ vincentApiUrl, appManagerPrivateKey, appId, activeVersion, }: {
|
|
2
|
+
vincentApiUrl: string;
|
|
3
|
+
appManagerPrivateKey: `0x${string}`;
|
|
4
|
+
appId: number;
|
|
5
|
+
activeVersion: number;
|
|
6
|
+
}): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=setActiveAppVersion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setActiveAppVersion.d.ts","sourceRoot":"","sources":["../../../../src/setup-dev-env/vincent-registry-api/setActiveAppVersion.ts"],"names":[],"mappings":"AAEA,wBAAsB,gBAAgB,CAAC,EACrC,aAAa,EACb,oBAAoB,EACpB,KAAK,EACL,aAAa,GACd,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,KAAK,MAAM,EAAE,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBhB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.setActiveVersion = setActiveVersion;
|
|
4
4
|
const generateAppManagerJwt_1 = require("./generateAppManagerJwt");
|
|
5
|
-
async function
|
|
5
|
+
async function setActiveVersion({ vincentApiUrl, appManagerPrivateKey, appId, activeVersion, }) {
|
|
6
6
|
console.log('=== Setting active version with Vincent API ===');
|
|
7
7
|
const jwtToken = await (0, generateAppManagerJwt_1.generateAppManagerJwt)({
|
|
8
8
|
appManagerPrivateKey,
|
|
@@ -22,4 +22,4 @@ async function setActiveVersionWithVincentApi({ vincentApiUrl, appManagerPrivate
|
|
|
22
22
|
throw new Error(`Set active version with Vincent API failed: ${response.status} ${response.statusText} - ${errorText}`);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
//# sourceMappingURL=
|
|
25
|
+
//# sourceMappingURL=setActiveAppVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setActiveAppVersion.js","sourceRoot":"","sources":["../../../../src/setup-dev-env/vincent-registry-api/setActiveAppVersion.ts"],"names":[],"mappings":";;AAEA,4CAkCC;AApCD,mEAAgE;AAEzD,KAAK,UAAU,gBAAgB,CAAC,EACrC,aAAa,EACb,oBAAoB,EACpB,KAAK,EACL,aAAa,GAMd;IACC,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;IAE/D,MAAM,QAAQ,GAAG,MAAM,IAAA,6CAAqB,EAAC;QAC3C,oBAAoB;KACrB,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,aAAa,QAAQ,KAAK,mBAAmB,EAAE;QAC7E,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,QAAQ,EAAE;SACpC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,aAAa;SACd,CAAC;KACH,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CACb,+CAA+C,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,MAAM,SAAS,EAAE,CACvG,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -6,10 +6,10 @@ export type NewCapacityCreditInfo = {
|
|
|
6
6
|
mintedAtUtc: string;
|
|
7
7
|
expiresAt: string;
|
|
8
8
|
};
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function ensureWalletHasCapacityCredit({ privateKey, }: {
|
|
10
10
|
privateKey: `0x${string}`;
|
|
11
11
|
}): Promise<{
|
|
12
12
|
mintedNewCapacityCredit: boolean;
|
|
13
13
|
newCapacityCreditInfo?: NewCapacityCreditInfo;
|
|
14
14
|
}>;
|
|
15
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=ensureWalletHasCapacityCredit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensureWalletHasCapacityCredit.d.ts","sourceRoot":"","sources":["../../../../src/setup-dev-env/wallets/ensureWalletHasCapacityCredit.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,qBAAqB,GAAG;IAClC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,8BAA8B,EAAE,MAAM,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAKF,wBAAsB,6BAA6B,CAAC,EAClD,UAAU,GACX,EAAE;IACD,UAAU,EAAE,KAAK,MAAM,EAAE,CAAC;CAC3B,GAAG,OAAO,CAAC;IACV,uBAAuB,EAAE,OAAO,CAAC;IACjC,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;CAC/C,CAAC,CAmFD"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ensureWalletHasCapacityCredit = ensureWalletHasCapacityCredit;
|
|
4
4
|
const ethers_1 = require("ethers");
|
|
5
5
|
const contracts_sdk_1 = require("@lit-protocol/contracts-sdk");
|
|
6
6
|
const DATIL_NETWORK = 'datil';
|
|
7
7
|
const YELLOWSTONE_RPC_URL = 'https://yellowstone-rpc.litprotocol.com/';
|
|
8
|
-
async function
|
|
8
|
+
async function ensureWalletHasCapacityCredit({ privateKey, }) {
|
|
9
9
|
// Create ethers provider and wallet for LitContracts SDK
|
|
10
10
|
const yellowstoneProvider = new ethers_1.providers.JsonRpcProvider(YELLOWSTONE_RPC_URL);
|
|
11
11
|
const ethersWallet = new ethers_1.Wallet(privateKey, yellowstoneProvider);
|
|
@@ -60,4 +60,4 @@ async function ensureWalletHasUnexpiredCapacityCredit({ privateKey, }) {
|
|
|
60
60
|
},
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
//# sourceMappingURL=
|
|
63
|
+
//# sourceMappingURL=ensureWalletHasCapacityCredit.js.map
|