@lit-protocol/vincent-ability-aerodrome-swap 0.4.0 โ 0.4.2
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 +12 -0
- package/dist/CHANGELOG.md +26 -0
- package/dist/package.json +1 -1
- package/dist/src/generated/lit-action.js +2 -2
- package/dist/src/generated/vincent-ability-metadata.json +1 -1
- package/dist/src/test-execution.d.ts +2 -0
- package/dist/src/test-execution.d.ts.map +1 -0
- package/dist/src/test-execution.js +99 -0
- package/dist/src/test-execution.js.map +1 -0
- package/dist/src/vincent-app-setup.d.ts +2 -0
- package/dist/src/vincent-app-setup.d.ts.map +1 -0
- package/dist/src/vincent-app-setup.js +28 -0
- package/dist/src/vincent-app-setup.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-execution.d.ts","sourceRoot":"","sources":["../../src/test-execution.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const dotenvx_1 = require("@dotenvx/dotenvx");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
// Load environment variables from .env file in the same directory
|
|
7
|
+
(0, dotenvx_1.config)({ path: (0, path_1.resolve)(__dirname, '../.env'), override: false });
|
|
8
|
+
const vincent_e2e_test_utils_1 = require("@lit-protocol/vincent-e2e-test-utils");
|
|
9
|
+
const abilityClient_1 = require("@lit-protocol/vincent-app-sdk/abilityClient");
|
|
10
|
+
const ethers_1 = require("ethers");
|
|
11
|
+
const util = tslib_1.__importStar(require("node:util"));
|
|
12
|
+
// Import the EVM Transaction Signer ability
|
|
13
|
+
const vincent_ability_evm_transaction_signer_1 = require("@lit-protocol/vincent-ability-evm-transaction-signer");
|
|
14
|
+
(async () => {
|
|
15
|
+
try {
|
|
16
|
+
console.log('๐ Starting ability execution...\n');
|
|
17
|
+
// Setup permission data with the EVM Transaction Signer ability
|
|
18
|
+
const permissionData = {
|
|
19
|
+
// EVM Transaction Signer Ability has no policies
|
|
20
|
+
[vincent_ability_evm_transaction_signer_1.bundledVincentAbility.ipfsCid]: {},
|
|
21
|
+
};
|
|
22
|
+
// Setup Vincent development environment (handles funding, app registration, permissions, etc.)
|
|
23
|
+
console.log('๐ง Setting up Vincent development environment...');
|
|
24
|
+
const { agentPkpInfo, wallets } = await (0, vincent_e2e_test_utils_1.setupVincentDevelopmentEnvironment)({ permissionData });
|
|
25
|
+
console.log('โ
Setup complete\n');
|
|
26
|
+
// Create ability client with the EVM Transaction Signer ability
|
|
27
|
+
const abilityClient = (0, abilityClient_1.getVincentAbilityClient)({
|
|
28
|
+
bundledVincentAbility: vincent_ability_evm_transaction_signer_1.bundledVincentAbility,
|
|
29
|
+
ethersSigner: wallets.appDelegatee,
|
|
30
|
+
});
|
|
31
|
+
// Create and serialize a sample transaction (ERC20 transfer of USDC)
|
|
32
|
+
// Note: This transaction won't be submitted, so we use example values
|
|
33
|
+
console.log('๐ Creating transaction...');
|
|
34
|
+
const serializedTx = ethers_1.ethers.utils.serializeTransaction({
|
|
35
|
+
to: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // USDC on Base
|
|
36
|
+
value: '0x00',
|
|
37
|
+
data: new ethers_1.ethers.utils.Interface([
|
|
38
|
+
'function transfer(address to, uint256 amount) returns (bool)',
|
|
39
|
+
]).encodeFunctionData('transfer', [
|
|
40
|
+
'0x4200000000000000000000000000000000000006', // Recipient (WETH contract as example)
|
|
41
|
+
'100000', // 0.1 USDC (6 decimals)
|
|
42
|
+
]),
|
|
43
|
+
chainId: 8453, // Base mainnet
|
|
44
|
+
nonce: 0, // Example nonce
|
|
45
|
+
gasPrice: '0x3B9ACA00', // Example: 1 gwei
|
|
46
|
+
gasLimit: '0x186A0', // 100,000 gas
|
|
47
|
+
});
|
|
48
|
+
// Run the precheck
|
|
49
|
+
console.log('\n๐ Running precheck...');
|
|
50
|
+
const precheckResult = await abilityClient.precheck({
|
|
51
|
+
serializedTransaction: serializedTx,
|
|
52
|
+
}, {
|
|
53
|
+
delegatorPkpEthAddress: agentPkpInfo.ethAddress,
|
|
54
|
+
});
|
|
55
|
+
console.log('Precheck result:', util.inspect(precheckResult, { depth: 10 }));
|
|
56
|
+
if (!precheckResult.success) {
|
|
57
|
+
console.error('โ Precheck failed:');
|
|
58
|
+
if (precheckResult.runtimeError) {
|
|
59
|
+
console.error(' Runtime error:', precheckResult.runtimeError);
|
|
60
|
+
}
|
|
61
|
+
if (precheckResult.result) {
|
|
62
|
+
console.error(' Result:', util.inspect(precheckResult.result, { depth: 10 }));
|
|
63
|
+
}
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const { deserializedUnsignedTransaction } = precheckResult.result;
|
|
67
|
+
console.log('โ
Precheck passed - deserialized transaction:', deserializedUnsignedTransaction);
|
|
68
|
+
// Execute the ability (sign the transaction)
|
|
69
|
+
console.log('\nโก Executing ability (signing transaction)...');
|
|
70
|
+
const executeResult = await abilityClient.execute({
|
|
71
|
+
serializedTransaction: serializedTx,
|
|
72
|
+
}, {
|
|
73
|
+
delegatorPkpEthAddress: agentPkpInfo.ethAddress,
|
|
74
|
+
});
|
|
75
|
+
console.log('Execution result:', util.inspect(executeResult, { depth: 10 }));
|
|
76
|
+
if (!executeResult.success) {
|
|
77
|
+
console.error('โ Execution failed:');
|
|
78
|
+
if (executeResult.runtimeError) {
|
|
79
|
+
console.error(' Runtime error:', executeResult.runtimeError);
|
|
80
|
+
}
|
|
81
|
+
if (executeResult.result) {
|
|
82
|
+
console.error(' Result:', util.inspect(executeResult.result, { depth: 10 }));
|
|
83
|
+
}
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const { signedTransaction } = executeResult.result;
|
|
87
|
+
console.log('\n๐ Transaction signed successfully!');
|
|
88
|
+
console.log('Signed transaction:', signedTransaction);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
console.error('โ Execution failed with error:', error);
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
console.log('\n๐งน Cleaning up...');
|
|
96
|
+
await (0, abilityClient_1.disconnectVincentAbilityClients)();
|
|
97
|
+
}
|
|
98
|
+
})();
|
|
99
|
+
//# sourceMappingURL=test-execution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-execution.js","sourceRoot":"","sources":["../../src/test-execution.ts"],"names":[],"mappings":";;;AAAA,8CAA0C;AAC1C,+BAA+B;AAE/B,kEAAkE;AAClE,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,IAAA,cAAO,EAAC,SAAS,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;AAEjE,iFAA0F;AAE1F,+EAGqD;AACrD,mCAAgC;AAChC,wDAAkC;AAElC,4CAA4C;AAC5C,iHAA6F;AAE7F,CAAC,KAAK,IAAI,EAAE;IACV,IAAI,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;QAElD,gEAAgE;QAChE,MAAM,cAAc,GAAmB;YACrC,iDAAiD;YACjD,CAAC,8DAAqB,CAAC,OAAO,CAAC,EAAE,EAAE;SACpC,CAAC;QAEF,+FAA+F;QAC/F,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;QAChE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,2DAAkC,EAAC,EAAE,cAAc,EAAE,CAAC,CAAC;QAC/F,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAElC,gEAAgE;QAChE,MAAM,aAAa,GAAG,IAAA,uCAAuB,EAAC;YAC5C,qBAAqB,EAAE,8DAAqB;YAC5C,YAAY,EAAE,OAAO,CAAC,YAAY;SACnC,CAAC,CAAC;QAEH,qEAAqE;QACrE,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CAAC;QACf,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;QACvD,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;QACnC,MAAM,IAAA,+CAA+B,GAAE,CAAC;IAC1C,CAAC;AACH,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vincent-app-setup.d.ts","sourceRoot":"","sources":["../../src/vincent-app-setup.ts"],"names":[],"mappings":"AAiBA,wBAAsB,KAAK,kFAS1B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setup = setup;
|
|
4
|
+
const dotenvx_1 = require("@dotenvx/dotenvx");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
// Load environment variables from .env file in the same directory
|
|
7
|
+
// FIXME: Set this path to the location of the .env file in your project
|
|
8
|
+
(0, dotenvx_1.config)({ path: (0, path_1.resolve)(__dirname, '../.env'), override: false });
|
|
9
|
+
const vincent_e2e_test_utils_1 = require("@lit-protocol/vincent-e2e-test-utils");
|
|
10
|
+
// FIXME: Import your bundled abilities here.
|
|
11
|
+
const index_1 = require("./index");
|
|
12
|
+
async function setup() {
|
|
13
|
+
// FIXME: Update permission data with your abilities and policies
|
|
14
|
+
const permissionData = {
|
|
15
|
+
// Aerodrome Swap Ability has no policies
|
|
16
|
+
// If yours does, you would add the policies to this object
|
|
17
|
+
[index_1.bundledVincentAbility.ipfsCid]: {},
|
|
18
|
+
};
|
|
19
|
+
return await (0, vincent_e2e_test_utils_1.setupVincentDevelopmentEnvironment)({ permissionData });
|
|
20
|
+
}
|
|
21
|
+
// Run setup if this file is executed directly
|
|
22
|
+
if (require.main === module) {
|
|
23
|
+
(async () => {
|
|
24
|
+
await setup();
|
|
25
|
+
console.log('Vincent development setup ready!');
|
|
26
|
+
})();
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=vincent-app-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vincent-app-setup.js","sourceRoot":"","sources":["../../src/vincent-app-setup.ts"],"names":[],"mappings":";;AAiBA,sBASC;AA1BD,8CAA0C;AAC1C,+BAA+B;AAE/B,kEAAkE;AAClE,wEAAwE;AACxE,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,IAAA,cAAO,EAAC,SAAS,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;AAEjE,iFAE8C;AAG9C,6CAA6C;AAC7C,mCAEiB;AAEV,KAAK,UAAU,KAAK;IACzB,iEAAiE;IACjE,MAAM,cAAc,GAAmB;QACrC,yCAAyC;QACzC,2DAA2D;QAC3D,CAAC,6BAAuB,CAAC,OAAO,CAAC,EAAE,EAAE;KACtC,CAAC;IAEF,OAAO,MAAM,IAAA,2DAAkC,EAAC,EAAE,cAAc,EAAE,CAAC,CAAC;AACtE,CAAC;AAED,8CAA8C;AAC9C,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,CAAC,KAAK,IAAI,EAAE;QACV,MAAM,KAAK,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IAClD,CAAC,CAAC,EAAE,CAAC;AACP,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lit-protocol/vincent-ability-aerodrome-swap",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"@lit-protocol/esbuild-plugin-polyfill-node": "^0.3.0",
|
|
22
22
|
"esbuild": "^0.19.12",
|
|
23
23
|
"ipfs-only-hash": "^4.0.0",
|
|
24
|
-
"@lit-protocol/vincent-
|
|
25
|
-
"@lit-protocol/vincent-
|
|
24
|
+
"@lit-protocol/vincent-contracts-sdk": "2.0.0",
|
|
25
|
+
"@lit-protocol/vincent-e2e-test-utils": "1.1.0"
|
|
26
26
|
},
|
|
27
27
|
"main": "./dist/src/index.js",
|
|
28
28
|
"module": "./dist/src/index.js",
|