@gitcoinco/passport-sdk-reader
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

Gitcoin Passport SDK: Reader

Reads from any Gitcoin Passport stream (on Ceramic)

Installation

Add to your project...

yarn add @gitcoinco/passport-sdk-reader

--

Or download this .git repository and install dependencies manually...

yarn install

Build...

yarn run webpack

Basic Usage

Firstly, we need to import the library/bundle and construct a PassportReader instance, passing in a ceramic node URL and a networkId

// add to your project as a module
import PassportReader from "@gitcoinco/passport-sdk-reader"

// or import the bundle
<script src="./dist/reader.bundle.js" type="script/javascript"/>

...

// create a new instance pointing at Gitcoins mainnet Ceramic node
const reader = new PassportReader("https://ceramic.passport-iam.gitcoin.co", "1");

// read a Passport for any Ethereum Address
const passport = await reader.getPassport("0x0...");

The PassportReader instance exposes read-only methods to get the content of a Gitcoin Passport:


  • getGenesis - pass in an Ethereum address and get back the did:pkh and genesis IDX streams
reader.getGenesis(address: string): Promise<CeramicGenesis | false>
  • getPassport - pass in an Ethereum address and get back a fully hydrated Passport record
reader.getPassport(address: string): Promise<CeramicPassport | Passport | false>
  • getPassportStream - pass in a Ceramic DID and get back a raw Passport stream record *note that this is a shallow copy of the passport (and needs to have its stamps hydrated)
reader.getPassportStream(address: string): Promise<CeramicPassport | false>

Readme

Keywords

none

Package Sidebar

Install

npm i @gitcoinco/passport-sdk-reader

Weekly Downloads

13

Version

0.1.4

License

AGPL-3.0

Unpacked Size

68.9 kB

Total Files

6

Last publish

Collaborators

  • aminahio
  • fahimgitcoin
  • kevinolsen
  • tschultz
  • geraldgtc