use-delegatecash
🚀 Getting Started
To get started, make sure you’ve got the following dependencies installed:
yarn add ethers wagmi use-delegatecash
💭 use-delegatecash
assumes you’ve already declared aWagmiConfig
at the root of your application.
✍️ Usage
use-delegatecash
wraps all of the getter functions exported by delegatecash
inside stateful typesafe React hooks.
You can also useDelegateCash()
to return a DelegateCash
object, which can be used to initiate transactions.
import * as React from 'react';
import {
ActivityIndicator,
StyleSheet,
Text,
View,
} from 'react-native';
import {
useCheckDelegateForAll,
useGetDelegatesForContract,
useCheckDelegateForContract,
useCheckDelegateForToken,
useDelegateCash,
useGetContractLevelDelegations,
useGetDelegatesForAll,
useGetDelegatesForContract,
useGetDelegationsByDelegate,
useGetTokenLevelDelegations,
isDelegateCashResult,
isDelegateCashError,
} from 'use-delegatecash';
export const AppExample = React.memo(
function AppExample(): JSX.Element {
const state = useGetDelegatesForAll({
vault: '0x312e71162Df834A87a2684d30562b94816b0f072',
});
return (
<View style={[StyleSheet.absoluteFill, styles.center]}>
{isDelegateCashError(state)
? <Text children={state.error.message} />
: isDelegateCashResult(state)
? <Text children="Got result!" />
: <ActivityIndicator />}
</View>
);
},
);
const styles = StyleSheet.create({
center: {alignItems: 'center', justifyContent: 'center'},
});