Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lib-sl

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lib-sl

sl library

  • 0.0.6-alpha
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Splinterlands Client Library - ALPHA

Please note that this is still an early version. Breaking changes will most likely occur. Use it at your own risk.

import { SplinterlandsClient } from 'lib-sl';

const main = async () => {
  /**
   * Create new Client
   * Metadata for custom_json broadcasting could be set here: { json: { prefix: 'sm_' <== default, app: 'myslapp' } }
   */
  const slClient = new SplinterlandsClient();

  /**
   * Login with hive-account + private key (could be also email + password)
   * This saves the access-token within the client & re-uses when needed
   */
  await slClient.login('myaccount', 'privatekey');
  const result = await slClient.players.getPlayer('myaccount');
  console.log('Player', result);

  /**
   * Create custom_json operations to be broadcasted to claim staking rewards + ranked/license rewards
   */
  const ops = [slClient.players.claimStaking('myaccount', 'SPS'), slClient.players.claimRewards('myaccount')];

  /**
   * Broadcast to the chain via dhive-sl
   */
  await slClient.broadcast(ops, 'myprivatepostingkey');
};

main();

Why?

The goal for this library is to provide a better and less error-prone way to interact with the Splinterlands API by returning the raw API data with typings. On top of that, the api data is then being converted to classes and improved upon, i.e. by adding relevant classes (card-details for cards or battles), converting string-arrays to real arrays, etc.

This library should also provide a better way to interact with & broadcast to Hive - i.e. to transfer-tokens, vote on proposals, etc.

FAQs

Package last updated on 31 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc