Created
April 15, 2024 17:03
-
-
Save 0xRyze/c1761f6e2356918635bc0510fe58a024 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Bandit Campaign Integration Docs | |
| ## Installation | |
| 1) Install `@bandit-network/react` with npm / pnpm | |
| ```js | |
| npm install @bandit-network/react | |
| ``` | |
| 2) Copy paste the below code. Replace API_KEY with `` and CAMPAIGN with `45`(dummy campaign) | |
| ```js | |
| <BanditContextProvider | |
| apiKey="API_KEY" | |
| cluster="devnet" | |
| > | |
| <Campaign campaignId={"CAMPAIGN ID" as number} displayMode="integrated" /> | |
| </BanditContextProvider> | |
| ``` | |
| 3) Bandit widgets have inbuilt wallet system. if you want to use yours | |
| ```js | |
| const App = () => { | |
| const { openConnectModal } = useConnectModal() | |
| return ( | |
| <BanditContextProvider | |
| apiKey="API_KEY" | |
| cluster="devnet" | |
| walletSettings={{ | |
| evm: { | |
| // config is your wagmi config | |
| config: config, | |
| openConnectModal: () => openConnectModal(), | |
| } | |
| enabledChains: ['evm'], | |
| }} | |
| > | |
| <Campaign campaignId={45} displayMode="integrated" /> | |
| </BanditContextProvider> | |
| ) | |
| } | |
| ``` | |
| 4) Bandit widgets comes with default UI. if you want to use yours | |
| ```js | |
| import { | |
| BanditContextProvider, | |
| Campaign, | |
| RenderArgsType, | |
| } from '@bandit-network/react' | |
| <Campaign campaignId={45} | |
| displayMode="integrated" | |
| render={(args: RenderArgsType)=>{ | |
| <div> | |
| //Your own UI | |
| </div> | |
| }} | |
| /> | |
| ``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment