Use a bitkubnext wallet as a wagmi connector!
- BitkubNextConnector - Wagmi connector for bitkubnext
- BitkubNextCaller - To interact with smart contracts on bitkubnext
npm install wagmi-bitkubnext-connector
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>, }, }), ], });
| Key | Value | Required | Example |
|---|---|---|---|
| networkMode | testnet,mainnet | true | testnet |
| clientId | string | true | XXXXXX |
| oauthRedirectURI | string | true | http://localhost:3000/oauth/callback |
You will need to set up a callback pages before using the connector and caller.
- create a callback page at
/pages/oauth/callback.tsx - set up a callback page to receive the access token and login to the wallet.
- create a callback folder
/pages/callback - set up these callback pages to send the transaction.
async function handleSendTransaction() { await bitkubnextCaller.send({ contractAddr: "", methodName: "", methodParams: [""], // don't need to add sender to params }); }
Feel free to contribute. Pull requests and issues are welcome!