Skip to content

Instantly share code, notes, and snippets.

@0xRyze
Created April 15, 2024 17:03
Show Gist options
  • Select an option

  • Save 0xRyze/c1761f6e2356918635bc0510fe58a024 to your computer and use it in GitHub Desktop.

Select an option

Save 0xRyze/c1761f6e2356918635bc0510fe58a024 to your computer and use it in GitHub Desktop.
# 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