@vocdoni/client
TypeScript icon, indicating that this package has built-in type declarations

1.16.8 • Public • Published

@vocdoni/client

@vocdoni/client contains shared helpers, models and type definitions for the dvote-js library

Installation

Use npm to install @vocdoni/client.

npm install @vocdoni/client

Usage

Gateway discovery

import { GatewayDiscovery } from "@vocdoni/client"

const gateways = await GatewayDiscovery.run()

You can use any of the gateway objects to send requests to the Voting and Census service providers.

Eth Provider

import { ProviderUtil } from "@vocdoni/client"

const provider1 = ProviderUtil.fromUri
  "https://my-web3-endpoint/rpc",
  "mainnet",  // "homestead" | "mainnet" | "rinkeby" | "goerli" | "xdai" | "sokol" | "matic"
  "prod"  // "prod" | "stg" | "dev"
)

// In a web browser
const provider2 = ProviderUtil.fromInjectedWeb3()

File API

import { FileApi } from "@vocdoni/client"

const buffData = Buffer.from("hello world")
const result1 = await FileApi.add(buffData, "my-file.txt", myWallet, gw)
// result1 => "ipfs://12346789..."

ENS

import { getEnsTextRecord } from "@vocdoni/client"

const value = await getEnsTextRecord(gateway, "vnd.vocdoni.meta", { environment: "prod", networkId: "mainnet" })
// result1 => "ipfs://12346789..."

Testing

To execute library tests just run

npm run test

Readme

Keywords

none

Package Sidebar

Install

npm i @vocdoni/client

Weekly Downloads

2

Version

1.16.8

License

GPL-3.0-or-later

Unpacked Size

435 kB

Total Files

118

Last publish

Collaborators

  • jordipainan
  • elboletaire
  • emmdim
  • marcvelmer