This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@futureverse/asset-registry-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.28.0 • Public • Published

Futureverse Asset Registry SDK

Installation

NPM:

    npm install @futureverse/asset-registry-sdk --save

Yarn:

    yarn add @futureverse/asset-registry-sdk

Usage

import {
  AssetRegistryClientProvider,
  Namespace,
  useCreateShaclSchema,
} from './index'
import { render } from 'react-dom'
import { ethers } from 'ethers'

const ASSET_REGISTRY_ENDPOINT = 'http://localhost:4000/graphql'
const APP_DOMAIN = 'com.fv.app'
const WALLET_PRIVATE_KEY = ''

function App() {
  return (
    // Provide the client to your App
    <AssetRegistryClientProvider
      url={ASSET_REGISTRY_ENDPOINT}
      domain={APP_DOMAIN}
      chainId={1}
    >
      <CreateShaclSchemaComponent />
    </AssetRegistryClientProvider>
  )
}

function CreateShaclSchemaComponent() {
  const wallet = new ethers.Wallet(WALLET_PRIVATE_KEY ?? '')
  const origin = 'http://localhost:3000'
  const id = 'foo'
  const version = 1
  const namespace = 'com.fv.schemas' as Namespace
  const schema = '{}'

  const mutation = useCreateShaclSchema({
    wallet,
    schema,
    version,
    origin,
    namespace,
  })

  return (
    <div>
      {mutation.isLoading ? (
        'Adding Shacl Schema...'
      ) : (
        <>
          {mutation.isError ? (
            <div>An error occurred: {mutation.error as string}</div>
          ) : null}

          {mutation.isSuccess ? <div>Shacl Schema added!</div> : null}

          <button onClick={() => mutation.mutate()}>Create Shacl Schema</button>
        </>
      )}
    </div>
  )
}

render(<App />, document.getElementById('root'))

Requirements

Readme

Keywords

none

Package Sidebar

Install

npm i @futureverse/asset-registry-sdk

Weekly Downloads

9

Version

0.28.0

License

none

Unpacked Size

882 kB

Total Files

14

Last publish

Collaborators

  • aidan-starke
  • driferose
  • rmafv
  • chris_futureverse
  • fv-philip.roigard
  • taylor_tran
  • kingsley.wang
  • jcsanpedro
  • nick95550
  • garethdainesnpm
  • developer-darpan
  • tknff
  • mj.liang
  • hlissnake
  • chris.czurylo
  • felixschl
  • pramodya-centrapass
  • admin-futureverse