Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #115 from ChainSafe/mmuftic/snap-id-from-env
Browse files Browse the repository at this point in the history
Load snap id from env
  • Loading branch information
mpetrunic authored Jan 18, 2022
2 parents dfaeac5 + 9772b19 commit 5b7b053
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/example/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_SNAP_ID=local:http://localhost:8081
2 changes: 2 additions & 0 deletions packages/example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

.env
3 changes: 2 additions & 1 deletion packages/example/src/services/metamask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ declare global {
}
}

export const snapId = 'local:http://localhost:8081';
export const defaultSnapId = 'local:http://localhost:8081';

let isInstalled: boolean = false;

Expand All @@ -23,6 +23,7 @@ export interface SnapInitializationResponse {
}

export async function installFilecoinSnap(): Promise<SnapInitializationResponse> {
const snapId = process.env.REACT_APP_SNAP_ID ? process.env.REACT_APP_SNAP_ID : defaultSnapId
try {
console.log('Attempting to connect to snap...');
const metamaskFilecoinSnap = await enableFilecoinSnap({network: "f"}, snapId);
Expand Down

0 comments on commit 5b7b053

Please sign in to comment.