Dev Guide - Injective DApps Integration
Welcome to Ninji Wallet Developer Guide. This documentation contains guides for developers to get started developing on Ninji Wallet.
To detect Ninji Wallet Extension
To detect whether your browser is running Ninji Wallet Extension, please use:
To connect Ninji Wallet Extension
Enable Connection
The window.ninji.enable(chainIds) method requests the extension to be unlocked if it's currently locked. If the user hasn't given permission to the webpage, it will ask the user to give permission for the webpage to access Ninji.
If the user cancels the unlock or rejects the permission, an error will be thrown.
Note: When users have multiple wallets in the extension, users have the option to choose which wallet they want to activate.
To disconnect Ninji Wallet Extension
To disconnect Ninji Extension, please use:
API Reference
Get Address / Public Key
If the webpage has permission and Ninji is unlocked, this function will return the address and public key in the following format:
Sign Amino
Similar to CosmJS OfflineSigner's signAmino, but Ninji's signAmino takes the chain-id as a required parameter. Signs Amino-encoded StdSignDoc.
Sign Direct / Protobuf
Similar to CosmJS OfflineDirectSigner's signDirect, but Ninji's signDirect takes the chain-id as a required parameter. Signs Proto-encoded StdSignDoc.
Delegate Transaction broadcasting:
Webpages can use this function to delegate the broadcasting of the transaction to LCD endpoints configured in the ninji wallet. If the broadcast is successful, this method will return the transaction hash. Otherwise, it will throw an error.
CosmJS example
Ninji’s API is similar to Keplr's to keep the integration of Ninji for the dApp as easy as possible.
List of events
Currently we only support some action event from wallet extension
accountsChanged
Receive when active account changed in Extension
networkChanged
Receive when active network changed in Extension
on(event, callback)
Add event listener
off(event, callback)
Remove event listener
Last updated