ChainSafe / filsnap

MetaMask snap for interacting with Filecoin dapps.
https://filsnap.chainsafe.io
Apache License 2.0
106 stars 41 forks source link

Request - adapter - export `isSnapInstalled` and `MetamaskFilecoinSnap` #91

Closed Schwartz10 closed 2 years ago

Schwartz10 commented 2 years ago

A developer like myself likes to have maximum control over the function calls to show the right UI given the user's MetaMask state (and version).

I'd love to have all the utility helper functions exported https://github.com/ChainSafe/filsnap/blob/master/packages/adapter/src/index.ts#L10, so i can basically rewrite enableFilecoinSnap myself. Currently isSnapInstalled is the only utility not exported.

Another question - how in the future will isSnapInstalled handle minor, non-breaking version updates to the snap?

mpetrunic commented 2 years ago

Just to clarify, you just wan't for us to add isSnapInstalled exported?

Another question - how in the future will isSnapInstalled handle minor, non-breaking version updates to the snap? Seems like Metamask exposes snap version here: https://github.com/ChainSafe/filsnap/blob/12fe6ea84c8b9c704ed104ce054425f779a704ee/packages/adapter/src/utils.ts#L11 so we can check version when checking if snap is installed

Schwartz10 commented 2 years ago

Just to clarify, you just wan't for us to add isSnapInstalled exported?

Yes please!

so we can check version when checking if snap is installed

Wondering moreso about the snapOrigin argument for isSnapInstalled - https://github.com/ChainSafe/filsnap/blob/master/packages/adapter/src/index.ts#L5

Does this IPFS hash change on each version upgrade?