|
1 | 1 | import { |
2 | | - delegator, |
3 | | - delegatee, |
4 | | - funder, |
5 | | - appManager, |
6 | | - ensureUnexpiredCapacityToken, |
| 2 | + setupVincentDevelopmentEnvironment, |
7 | 3 | getChainHelpers, |
8 | 4 | getEnv, |
9 | 5 | type PkpInfo, |
@@ -46,61 +42,20 @@ describe('Aerodrome Swap Ability E2E Tests without Gas Sponsorship', () => { |
46 | 42 | let baseRpcProvider: providers.JsonRpcProvider; |
47 | 43 |
|
48 | 44 | beforeAll(async () => { |
49 | | - await funder.checkFunderBalance(); |
50 | | - await delegatee.ensureAppDelegateeFunded(); |
51 | | - await appManager.ensureAppManagerFunded(); |
52 | | - |
53 | | - const chainHelpers = await getChainHelpers(); |
54 | | - wallets = chainHelpers.wallets; |
55 | | - baseRpcProvider = chainHelpers.providers.base; |
56 | | - |
57 | | - await ensureUnexpiredCapacityToken(wallets.appDelegatee); |
58 | | - |
59 | 45 | const PERMISSION_DATA: PermissionData = { |
60 | 46 | // Aerodrome Swap Ability has no policies |
61 | 47 | [aerodromeBundledAbility.ipfsCid]: {}, |
62 | 48 | }; |
63 | 49 |
|
64 | | - const abilityIpfsCids: string[] = Object.keys(PERMISSION_DATA); |
65 | | - const abilityPolicies: string[][] = abilityIpfsCids.map((abilityIpfsCid) => { |
66 | | - return Object.keys(PERMISSION_DATA[abilityIpfsCid]); |
67 | | - }); |
68 | | - |
69 | | - // If an app exists for the delegatee, we will create a new app version with the new ipfs cids |
70 | | - // Otherwise, we will create an app w/ version 1 appVersion with the new ipfs cids |
71 | | - const existingApp = await delegatee.getAppInfo(); |
72 | | - console.log('[beforeAll] existingApp', existingApp); |
73 | | - let appId: number; |
74 | | - let appVersion: number; |
75 | | - if (!existingApp) { |
76 | | - console.log('[beforeAll] No existing app, registering new app'); |
77 | | - const newApp = await appManager.registerNewApp({ abilityIpfsCids, abilityPolicies }); |
78 | | - appId = newApp.appId; |
79 | | - appVersion = newApp.appVersion; |
80 | | - } else { |
81 | | - console.log('[beforeAll] Existing app, registering new app version'); |
82 | | - const newAppVersion = await appManager.registerNewAppVersion({ |
83 | | - abilityIpfsCids, |
84 | | - abilityPolicies, |
85 | | - }); |
86 | | - appId = existingApp.appId; |
87 | | - appVersion = newAppVersion.appVersion; |
88 | | - } |
89 | | - |
90 | | - agentPkpInfo = await delegator.getFundedAgentPkp(); |
91 | | - |
92 | | - await delegator.permitAppVersionForAgentWalletPkp({ |
| 50 | + const setupResult = await setupVincentDevelopmentEnvironment({ |
93 | 51 | permissionData: PERMISSION_DATA, |
94 | | - appId, |
95 | | - appVersion, |
96 | | - agentPkpInfo, |
97 | 52 | }); |
98 | 53 |
|
99 | | - await delegator.addPermissionForAbilities( |
100 | | - wallets.agentWalletOwner, |
101 | | - agentPkpInfo.tokenId, |
102 | | - abilityIpfsCids, |
103 | | - ); |
| 54 | + agentPkpInfo = setupResult.agentPkpInfo; |
| 55 | + wallets = setupResult.wallets; |
| 56 | + |
| 57 | + const chainHelpers = await getChainHelpers(); |
| 58 | + baseRpcProvider = chainHelpers.providers.base; |
104 | 59 | }); |
105 | 60 |
|
106 | 61 | afterAll(async () => { |
|
0 commit comments