Package Exports
- filsnap-adapter
- filsnap-adapter/dist/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (filsnap-adapter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Filsnap adapter
Adapter for Filsnap
Exposes a simple API to interact the snap from a dapp and also Fil Forwarder contract metadata.
Installation
pnpm install filsnap-adapter
Usage
This adapter interacts directly with the snap, so Metamask Flask needs to be installed and unlocked in the browser.
import * as Filsnap from 'filsnap-adapter'
const hasFlask = await Filsnap.hasFlask()
if (!hasFlask) {
console.error('Flask not installed')
return
}
const snap = await Filsnap.connect({ network: 'testnet' }, 'npm:filsnap')
const { error, result } = await snap.getAddress()
if (error) {
console.error(error)
} else {
console.log(result)
// t1d2xrzcslx7xlbbylc5c3d5lvandqw4iwl6epxba
}
const isConnected = await snap.isConnected()
// true
Check out the demo for a working example and the API for more details.
Contributing
Read contributing guidelines here.
License
Dual-licensed: MIT, Apache Software License v2, by way of the Permissive License Stack.