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

0.2.0 • Public • Published

Gitcoin Passport SDK: Scorer

Score the contents of a Gitcoin Passport

Installation

Add to your project...

yarn add @gitcoinco/passport-sdk-scorer

--

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

yarn install

Build...

yarn run webpack

Basic Usage

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

// import as a module
import PassportScorer from "@gitcoinco/passport-sdk-scorer";


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

...

// create a new instance defining the criteria we wish to score against
const scorer = new PassportScorer([
    {
        provider: "BrightID",
        issuer: "did:key:z6MkghvGHLobLEdj1bgRLhS4LPGJAvbMA1tn2zcRyqmYU5LC",
        score: 0.5
    }
]);

// get the score for a specific address
const score = await scorer.getScore("0x0...");

The PassportScorer instance exposes read-only methods to score the content of a Gitcoin Passport:


  • getScore - pass in a wallet address and get back a score based on the instances scoring criteria and any additional checks
PassportScorer.getScore(address: string, passport?: Passport, additionalStampCheck?: (stamp: Stamp) => boolean): Promise<number>

Readme

Keywords

none

Package Sidebar

Install

npm i @gitcoinco/passport-sdk-scorer

Weekly Downloads

0

Version

0.2.0

License

AGPL-3.0

Unpacked Size

8.87 MB

Total Files

6

Last publish

Collaborators

  • aminahio
  • fahimgitcoin
  • kevinolsen
  • tschultz
  • geraldgtc