@theqrl/zond-wallet-provider
v0.1.0
Published
A JavaScript Zond provider that connects to the wallet over a stream
Downloads
61
Maintainers
Readme
Zond Wallet Provider
The Ethereum provider object announced by the Zond Wallet, based on EIP-6963. This facilitates the connection and communication between Zond Wallet and dApps.
Important! Zond Wallet Provider is based on few MetaMask repositories(
json-rpc-engine
,json-rpc-middleware-stream
,object-multiplex
,post-message-stream
,providers
,rpc-errors
,safe-event-emitter
,superstruct
,utils
). For each of the codebase used, their respective license is kept alongside the code. Please go through the subdirectories of this repository to view those licenses.
:keyboard: Usage
- Run
npm i -D @theqrl/zond-wallet-provider
in your project to install the zond-wallet-provider package. - Import the required functions to the files, and invoke it.
import { initializeProvider, WindowPostMessageStream } from "@theqrl/zond-wallet-provider";
const initializeInPageScript = () => {
try {
const zondStream = new WindowPostMessageStream({
name: ZOND_POST_MESSAGE_STREAM.INPAGE,
target: ZOND_POST_MESSAGE_STREAM.CONTENT_SCRIPT,
});
initializeProvider({
connectionStream: zondStream,
logger: log,
providerInfo: {
uuid: uuid(),
name: ZOND_WALLET_PROVIDER_INFO.NAME,
icon: ZOND_WALLET_PROVIDER_INFO.ICON,
rdns: ZOND_WALLET_PROVIDER_INFO.RDNS,
},
});
} catch (error) {
console.warn("Zond Wallet: Failed to initialize the zond wallet provider", error);
}
};
// This function accounces the zond wallet provider(based on EIP-6963), to be detected by the dApps.
initializeInPageScript();