@xyo-network/api-address-verifier-apollo
TypeScript icon, indicating that this package has built-in type declarations

0.0.28 • Public • Published

Coin Manager React App (api-address-verifier-apollo)

Demo

Branches

Master

Build Status BCH compliance Maintainability

Develop

Build Status BCH compliance

Description

Apollo api with react codegen components for ethereum address verification

Getting Started

  1. Via terminal, cd into the api-address-verifier-apollo directory.
  2. Make sure you have Node.js Version 10.x or later installed: Latest Node.js Versions
  3. Make sure you have npm installed. How to Install npm
  4. In your terminal run yarn
  5. In your terminal run yarn dev

React component usage

Example

  1. 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

Readme

Keywords

none

Package Sidebar

Install

npm i @xyo-network/api-address-verifier-apollo

Weekly Downloads

5

Version

0.0.28

License

ISC

Unpacked Size

138 kB

Total Files

32

Last publish

Collaborators

  • jonesmac
  • joelbcarter
  • xyo
  • rphansen91
  • jordantrouw