Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
commodilibero
Advanced tools
Library to connect Dapps to mobile wallets using WalletConnect
You can read more about WalletConnect standard here: http://walletconnect.org/
yarn add walletconnect
# OR
npm install --save walletconnect
import WalletConnect from 'walletconnect'
/**
* Create a webConnector
*/
const webConnector = new WalletConnect(
{
bridgeUrl: 'https://bridge.walletconnect.org', // Required
dappName: 'INSERT_DAPP_NAME', // Required
}
)
/**
* Initiate WalletConnect session
*/
await webConnector.initSession()
/**
* Check if connection is already established
*/
if (webConnector.isConnected) {
// If yes, get accounts
const accounts = webConnector.accounts
} else {
// If not, prompt the user to scan the QR code
const uri = webConnector.uri;
// Listen for session confirmation from wallet
await webConnector.listenSessionStatus()
// Get accounts after session status is resolved
accounts = webConnector.accounts
}
/**
* Draft transaction
*/
const tx = {from: '0xab12...1cd', to: '0x0', nonce: 1, gas: 100000, value: 0, data: '0x0'}
/**
* Send transaction
*/
try {
// Submitted Transaction Hash
const result = await webConnector.sendTransaction(tx)
} catch (error) {
// Rejected Transaction
console.error(error)
}
/**
* Draft message
*/
const msg = 'My email is john@doe.com - 1537836206101'
/**
* Sign message
*/
try {
// Signed message
const result = await webConnector.signMessage(msg)
} catch (error) {
// Rejected signing
console.error(error)
}
/**
* Draft Typed Data
*/
const msgParams = [
{
type: 'string',
name: 'Message',
value: 'My email is john@doe.com'
},
{
type: 'uint32',
name: 'A number',
value: '1537836206101'
}
]
/**
* Sign Typed Data
*/
try {
// Signed typed data
const result = await webConnector.signTypedData(msgParams)
} catch (error) {
// Rejected signing
console.error(error)
}
FAQs
Autolib
We found that commodilibero demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.