wagmi-bitkubnext-connector
v0.3.3
Published
bitkubnext as a wagmi connector
Downloads
6
Readme
Wagmi Bitkubnext Connector
Use a bitkubnext wallet as a wagmi connector!
- BitkubNextConnector - Wagmi connector for bitkubnext
- BitkubNextCaller - To interact with smart contracts on bitkubnext
Installation
npm install wagmi-bitkubnext-connector
Usage
import { createClient } from "wagmi";
import { BitkubNextConnector, BitkubNextCaller } from "wagmi-bitkubnext-connector";
export const bitkubnextCaller = new BitkubNextCaller({
clientId: // <YOUR_CLIENT_ID>,
networkMode: // <YOUR_NETWORK_MODE>,
oauthRedirectURI: //<YOUR_REDIRECT_URI>,
});
const client = createClient({
connectors: [
new BitkubNextConnector({
options: {
clientId: // <YOUR_CLIENT_ID>,
networkMode: // <YOUR_NETWORK_MODE>,
oauthRedirectURI: //<YOUR_REDIRECT_URI>,
},
}),
],
});
API
options
| Key | Value | Required | Example | | ---------------- | --------------- | -------- | ------------------------------------ | | networkMode | testnet,mainnet | true | testnet | | clientId | string | true | XXXXXX | | oauthRedirectURI | string | true | http://localhost:3000/oauth/callback |
Set up callback pages
You will need to set up a callback pages before using the connector and caller.
BitkubnextConnector
- create a callback page at
/pages/oauth/callback.tsx
- set up a callback page to receive the access token and login to the wallet.
BitkubNextCaller
- create a callback folder
/pages/callback
- set up these callback pages to send the transaction.
Send transaction
async function handleSendTransaction() {
await bitkubnextCaller.send({
contractAddr: "",
methodName: "",
methodParams: [""], // don't need to add sender to params
});
}
Contribute
Feel free to contribute. Pull requests and issues are welcome!