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

Commit

Permalink
Fix npm install version not sent
Browse files Browse the repository at this point in the history
  • Loading branch information
mpetrunic committed Jan 18, 2022
1 parent 7b7894b commit 7026374
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/adapter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chainsafe/filsnap-adapter",
"version": "2.0.0",
"version": "2.0.1",
"main": "./build/index.js",
"module": "./build/index.js",
"types": "./build/index.d.ts",
Expand Down
18 changes: 12 additions & 6 deletions packages/adapter/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import {hasMetaMask, isMetamaskSnapsSupported} from "./utils";
import {SnapConfig} from "@chainsafe/filsnap-types";
import { hasMetaMask, isMetamaskSnapsSupported } from "./utils";
import { SnapConfig } from "@chainsafe/filsnap-types";
import { MetamaskFilecoinSnap } from "./snap";

const defaultSnapOrigin = "https://bafybeigzphbumdkucnj2c6nr5xb3kwsq5gs2gp7w3qldgbvfeycfsbjylu.ipfs.infura-ipfs.io";


export {MetamaskFilecoinSnap} from "./snap";
export {hasMetaMask, isMetamaskSnapsSupported, isSnapInstalled} from "./utils";
export { MetamaskFilecoinSnap } from "./snap";
export { hasMetaMask, isMetamaskSnapsSupported, isSnapInstalled } from "./utils";

export type SnapInstallationParamNames = 'version' | string;

/**
* Install and enable Filecoin snap
Expand All @@ -22,7 +24,9 @@ export {hasMetaMask, isMetamaskSnapsSupported, isSnapInstalled} from "./utils";
* @return MetamaskFilecoinSnap - adapter object that exposes snap API
*/
export async function enableFilecoinSnap(
config: Partial<SnapConfig>, snapOrigin?: string
config: Partial<SnapConfig>,
snapOrigin?: string,
snapInstallationParams: Record<SnapInstallationParamNames, unknown> = {}
): Promise<MetamaskFilecoinSnap> {

const snapId = snapOrigin ?? defaultSnapOrigin;
Expand All @@ -42,7 +46,9 @@ export async function enableFilecoinSnap(
await window.ethereum.request({
method: "wallet_enable",
params: [{
[`wallet_snap_${snapId}`]: {}
[`wallet_snap_${snapId}`]: {
...snapInstallationParams
}
}]
});

Expand Down
2 changes: 1 addition & 1 deletion packages/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"gh-pages": "^3.1.0"
},
"dependencies": {
"@chainsafe/filsnap-adapter": "2.0.0",
"@chainsafe/filsnap-adapter": "2.0.1",
"@chainsafe/filsnap-types": "2.0.0",
"@material-ui/core": "^4.9.7",
"@material-ui/icons": "^4.9.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/example/src/services/metamask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ 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);
const metamaskFilecoinSnap = await enableFilecoinSnap({network: "f"}, snapId, {version: "latest"});
isInstalled = true;
console.log('Snap installed!');
return {isSnapInstalled: true, snap: metamaskFilecoinSnap};
Expand Down

0 comments on commit 7026374

Please sign in to comment.