3.0.2 • Published 4 months ago
filsnap-adapter v3.0.2
Filsnap adapter
Adapter for Filsnap
Exposes a simple API to interact with 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 with support for Snaps needs to be installed and unlocked in the browser.
import { FilsnapAdapter } from 'filsnap-adapter'
const hasSnaps = await FilsnapAdapter.hasSnaps()
if (!hasSnaps) {
console.error('Metamask with Snaps support is not installed')
return
}
const snap = await FilsnapAdapter.connect({ network: 'testnet' }, 'npm:filsnap')
const { error, result } = await snap.getAddress()
if (error) {
console.error(error)
} else {
console.log(result)
// t1d2xrzcslx7xlbbylc5c3d5lvandqw4iwl6epxba
}
const isAvailable = await FilsnapAdapter.isAvailable()
// 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.
3.0.2
4 months ago
3.0.1
4 months ago
3.0.0
4 months ago
2.1.1
4 months ago
2.1.0
4 months ago
2.0.3
5 months ago
2.0.4
5 months ago
2.0.2
8 months ago
2.0.1
9 months ago
2.0.0
10 months ago
1.0.2
12 months ago
1.0.1
1 year ago
1.0.0
2 years ago
0.3.0
2 years ago
0.2.1
2 years ago
0.2.0
2 years ago
0.1.1
2 years ago
0.1.0
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago