
Product
Introducing Webhook Events for Pull Request Scans
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
@deficonnect/web3-connector
Advanced tools
deficonnect web3-connector for Crypto.com DeFi Wallet Extension
npm install "@deficonnect/web3-connector"
<script type="module" src="https://unpkg.com/@deficonnect/web3-connector/dist/index.umd.js"></script>
the global variable is: DeFiWeb3Connector
const connector = new DeFiWeb3Connector({
supportedChainIds: [1],
appName: 'your app name',
chainType: 'eth', // only support 'eth' for DeFiWeb3Connector
chainId: '25', // for eth is 1
rpcUrls: {
1: 'https://mainnet.infura.io/v3/INFURA_API_KEY',
25: 'https://evm-cronos.crypto.org/',
},
})
if you want to support cosmos like chain, please use: @deficonnect/provider directly
if you use
web3-react
, it is easy to integrate:DeFiWeb3Connector
has implementAbstractConnector
fromweb3-react
import { DeFiWeb3Connector } from '@deficonnect/web3-connector'
const connector = new DeFiWeb3Connector({
supportedChainIds: [1],
appName: 'your app name',
chainType: 'eth', // only support 'eth' for DeFiWeb3Connector
chainId: '25', // for eth is 1
rpcUrls: {
1: 'https://mainnet.infura.io/v3/INFURA_API_KEY',
25: 'https://evm-cronos.crypto.org/',
},
})
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 web3-connector for Crypto.com DeFi Wallet Extension
The npm package @deficonnect/web3-connector receives a total of 405 weekly downloads. As such, @deficonnect/web3-connector popularity was classified as not popular.
We found that @deficonnect/web3-connector 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
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.