Skip to content

Commit

Permalink
Terminate snap after install
Browse files Browse the repository at this point in the history
  • Loading branch information
gantunesr committed Dec 14, 2022
1 parent 2c247d5 commit 12ae8f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
4 changes: 1 addition & 3 deletions app/components/Views/Wallet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,14 +374,12 @@ const Wallet = ({ navigation }: any) => {

const installSnap = async (url: string): Promise<void> => {
const { SnapController } = Engine.context as any;
await installTestSnap({ snapController: SnapController, url });
await installTestSnap({ snapController: SnapController, snapId: url });
};

const executeTestSnap = async () => {
// eslint-disable-next-line no-console
const { SnapController } = Engine.context as any;
console.log('Current snaps', SnapController.internalState.snaps);
console.log('LOG: executeTestSnap');
const localSnap = 'local:http://localhost:3000/snap/';
const origin = 'origin';
const result = await SnapController.handleRequest({
Expand Down
12 changes: 4 additions & 8 deletions app/components/Views/Wallet/snaps/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@ export const TEST_SNAP_ID_TWO = 'local:http://localhost:3000/snapother/';

export const installTestSnap = async ({
snapController,
url,
snapId,
}: {
snapController: any;
url: string;
snapId: string;
}): Promise<void> => {
const mockOrigin = 'origin';
// eslint-disable-next-line no-console
console.log('> Install snap', url);
await snapController.installSnaps(mockOrigin, { [url]: {} });

// eslint-disable-next-line no-console
console.log('> Snap installed', url);
await snapController.installSnaps(mockOrigin, { [snapId]: {} });
await snapController.terminateSnap(snapId);
};

export const validateShasum = () => {
Expand Down

0 comments on commit 12ae8f0

Please sign in to comment.