Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More

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

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Apollo api with react codegen


Version published
Weekly downloads
2
decreased by-96.87%
Maintainers
7
Weekly downloads
 
Created

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

FAQs

Package last updated on 07 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts