@xyo-network/api-address-verifier-apollo
v0.0.28
Published
Apollo api with react codegen
Downloads
33
Keywords
Readme
Coin Manager React App (api-address-verifier-apollo)
Branches
Master
Develop
Description
Apollo api with react codegen components for ethereum address verification
Getting Started
- Via terminal,
cd
into theapi-address-verifier-apollo
directory. - Make sure you have Node.js Version 10.x or later installed: Latest Node.js Versions
- Make sure you have npm installed. How to Install npm
- In your terminal run
yarn
- In your terminal run
yarn dev
React component usage
- In react codebase
yarn add @xyo-network/api-address-verifier-apollo @xyo-network/tool-storybook-react
import {
VerifyType,
withVerifyAddress,
VerifyAddressProvider,
withMyVerifiedAddresses,
VerifiedAddress,
} from '@xyo-network/api-address-verifier-apollo'
import {
SignButton,
ISigningValues,
} from '@xyo-network/tool-storybook-react/dist/lib/Signing'
const SIGNING_DATA = 'I <3 XYO'
export const VerifyAddresses = withVerifyAddress()(({ mutate }) => {
const onSuccess = async ({ address, signature, error }: ISigningValues) => {
try {
if (error) throw error
await mutate({
variables: {
type: VerifyType.Sign,
data: SIGNING_DATA,
address,
signature,
},
})
} catch (e) {
// handle err
}
}
return <SignButton data={SIGNING_DATA} onSuccess={onSuccess} />
})
export const MyVerifiedAddresses = withMyVerifiedAddresses()(({ data }) => {
return <YourAddressListComponent verifiedAddresses={data.verifiedAddresses} />
})
export default () => {
return (
<VerifyAddressProvider
getRequestContext={async () => ({ headers: {
'X-Auth-Token': `${usertoken}`
...headers
} })}
>
<>
<VerifyAddresses />
<MyVerifiedAddresses />
</>
</VerifyAddressProvider>
)
}
License
Only for internal XY - The Persistent Company use at this time.
Credits
Made with ❄️ and 🔥 by XY - The Persistent Company