
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
deficonnect
Advanced tools
npm install "deficonnect"
<script type="module" src="https://unpkg.com/deficonnect/dist/index.umd.js"></script>
the global variable is: window.DeFiConnect
const connector = new window.DeFiConnect.DeFiWeb3Connector({
supportedChainIds: [1],
rpc: { 1: 'https://mainnet.infura.io/v3/INFURA_API_KEY' },
pollingInterval: 15000
})
if you use
web3-react
, it is easy to integrate:DeFiWeb3Connector
has implementAbstractConnector
fromweb3-react
import { DeFiWeb3Connector } from 'deficonnect'
const connector = new DeFiWeb3Connector({
supportedChainIds: [1],
rpc: { 1: 'https://mainnet.infura.io/v3/INFURA_API_KEY' },
pollingInterval: 15000
})
connector.activate()
// connect to the Wallet
await connector.activate()
// disconnect the Wallet
await connector.deactivate()
// Subscribe to accounts change
provider.on('accountsChanged', (accounts: string[]) => {
console.log(accounts)
})
// Subscribe to chainId change
provider.on('chainChanged', (chainId: number) => {
console.log(chainId)
})
// Subscribe to session connection
provider.on('connect', () => {
console.log('connect')
})
// Subscribe to session disconnection
provider.on('disconnect', (code: number, reason: string) => {
console.log(code, reason)
})
interface RequestArguments {
method: string;
params?: unknown[] | object;
}
// Send JSON RPC requests
const result = await provider.request(payload: RequestArguments);
// Close provider session
await provider.disconnect()
// Get Accounts
const accounts = await web3.eth.getAccounts()
// Get Chain Id
const chainId = await web3.eth.chainId()
// Get Network Id
const networkId = await web3.eth.net.getId()
// Send Transaction
const txHash = await web3.eth.sendTransaction(tx)
// Sign Transaction
const signedTx = await web3.eth.signTransaction(tx)
// Sign Message
const signedMessage = await web3.eth.sign(msg)
// Sign Typed Data
const signedTypedData = await web3.eth.signTypedData(msg)
FAQs
deficonnect SDK for Crypto.com DeFi Wallet Extension
We found that deficonnect demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.