diff --git a/packages/mainnet-poll-example/README.md b/packages/mainnet-poll-example/README.md index c5b4ee9..58e5604 100644 --- a/packages/mainnet-poll-example/README.md +++ b/packages/mainnet-poll-example/README.md @@ -1,72 +1 @@ -# DappConnect Poll SDK Example - -This package is example usage of WakuPolling - -Example uses usedapp for exposing web3 provider - -For using usedapp please see usedapp docs - -## creating WakuPolling object - -to create waku polling object you can just use react hook - -``` -const wakuPolling = useWakuPolling( - appName, - tokenaddress, - library, - multicallAddress - ) -``` - -it is a good idea for token address and multicall address to be dependent on current chainId. - -useWakuPolling creates a new WakuPolling object whenever chainId changes. - -## creating new poll - -to create new poll you can use `createTimedPoll` function from WakuPolling class - -``` -wakuPolling.createTimedPoll( - question, - answers, - selectedType, - undefined, - endTime - ) -``` - -If you want you can use already created modal component for creating polls - -``` -const [showPollCreation, setShowPollCreation] = useState(false) -. -. -. -{showPollCreation && ( - - )} -``` - -### showing polls - -to show list of polls you can either use `PollList` component from polling-component - -``` - -``` - -If you want to create your own react component please use - -``` -usePollList(wakuPolling: WakuPolling | undefined) -``` - -Which returns memoized DetailedTimedPoll[] array. - -Waku polling also exposes `getDetailedTimedPolls` - -``` -const DetailedTimedPolls = await wakuPolling.getDetailedTimedPolls() -``` +# Mainnet DappConnect Poll SDK Example