0.2.8 • Published 1 month ago
@snapshot-labs/lock v0.2.8
Lock.js
A lightweight JavaScript library for log in to Ethereum.
Install
To install Lock.js, open your terminal and run:
npm install github:snapshot-labs/lock
Browser
You can create an index.html file and include Lock.js with:
<script src="https://cdn.jsdelivr.net/npm/@snapshot-labs/lock"></script>
Usage
import { Lock } from '@snapshot-labs/lock';
import injected from '@snapshot-labs/lock/connectors/injected';
import walletconnect from '@snapshot-labs/lock/connectors/walletconnect';
// Init Lock
const lock = new Lock();
// Add injected connector
lock.addConnector({
key: 'injected',
connector: injected
});
// Add WalletConnect connector
lock.addConnector({
key: 'walletconnect',
connector: walletconnect,
options: {
infuraId: 'c00cb721...'
}
});
// Log in with injected web3
const connector = lock.getConnector('injected');
const provider = await connector.connect('injected');
// Log out from WalletConnect
const connector = lock.getConnector('walletconnect');
await connector.logout();
// Is logged in?
const isLoggedIn = await connector.isLoggedIn();
License
MIT.
0.2.8
1 month ago
0.2.7
2 months ago
0.2.6
4 months ago
0.2.5
4 months ago
0.2.4
7 months ago
0.2.3
10 months ago
0.2.2
11 months ago
0.2.1
12 months ago
0.2.0
1 year ago
0.1.1019
1 year ago
0.1.1017
1 year ago
0.1.1018
1 year ago
0.1.1016
1 year ago
0.1.1013
2 years ago
0.1.1014
2 years ago
0.1.1015
2 years ago
0.1.1012
2 years ago
0.1.109
2 years ago
0.1.1010
2 years ago
0.1.1011
2 years ago
0.1.105
2 years ago
0.1.104
2 years ago
0.1.96
2 years ago
0.1.97
2 years ago
0.1.98
2 years ago
0.1.99
2 years ago
0.1.91
2 years ago
0.1.92
2 years ago
0.1.93
2 years ago
0.1.94
2 years ago
0.1.95
2 years ago
0.1.103
2 years ago
0.1.102
2 years ago
0.1.101
2 years ago
0.1.100
2 years ago
0.1.8
3 years ago
0.1.9
2 years ago
0.1.7
3 years ago
0.1.4
3 years ago
0.1.6
3 years ago
0.1.5
3 years ago
0.1.3
4 years ago
0.1.2
4 years ago
0.1.1
4 years ago
0.1.0
4 years ago