metafab-client
TypeScript icon, indicating that this package has built-in type declarations

0.1.11 • Public • Published

MetaFab Typescript Client SDK

NPM NPM GitHub Workflow Status

Community-built Typescript client for MetaFab's Web3 API.

The official documentation can be found at: https://trymetafab.com.

Installation

NPM

npm install metafab-client

YARN

yarn add metafab-client

Usage

Authenticate your MetaFab game

import { MetaFabClient, NETWORK } from 'metafab-client';
import type { Game } from 'metafab-client';

const client = new MetaFabClient({
  network: NETWORK.POLY_MAIN,
  username: process.env.METAFAB_ACCOUNT_EMAIL,
  password: process.env.METAFAB_ACCOUNT_PASSWORD,
});

const result = await client.games.auth();
const game: Game = result.data;

Authenticate a MetaFab player

import { MetaFabClient, NETWORK } from 'metafab-client';
import type { Player } from 'metafab-client';

const client = new MetaFabClient({
  network: NETWORK.POLY_MAIN,
  username: process.env.METAFAB_ACCOUNT_EMAIL,
  password: process.env.METAFAB_ACCOUNT_PASSWORD,
});

const result = await client.players.auth(process.env.METAFAB_GAME_PUBLISH_KEY, 'playerUsername', 'p@ssw0rd');
const player: Player = result.data;

Package Sidebar

Install

npm i metafab-client

Weekly Downloads

0

Version

0.1.11

License

MIT

Unpacked Size

1.31 MB

Total Files

47

Last publish

Collaborators

  • dschoon