npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@khgame/dg-provider

v0.1.24

Published

## models

Downloads

61

Readme

eosProvider

models

Provider

The provider is ultimately responsible for all function calls within the business logic. It generally includes (but is not limited to) two types of processing procedure.

In order to make a specific provider that actually supports a business scenario, A class who is inherit the 'Provider' class and implement Provide's interfaces should be provided.

Those implementations is aimed at provide the concrete usages to a remote service.

Processing procedure

there are two kinds of Processing procedure:

  • hset: set an key-value pair of a scope
  • receipt: include three method corresponding to three phases of transactions.
    • hookPrepare
    • commit
    • abort

Provide's interfaces

Remote Service

Interface files in the directory ./src/remoteService can be used as references.
By the way, if the remote service is implemented using js/ts, you can also import these interfaces directly into the project.

Get
  • get operations
    • token

      • balance(userIdentity, tokenSym)

      check balance of the userIdentity
      response should be the value string of user's balance
      { "result": QUANTITY_NUMBER }

    • hset

      • scopes()

      get all scopes in the service
      response should be a list of all scopes
      { "result": [ ... ] }

      • hkeys(scope)

      get all keys of a scope in the service
      response should be a list of all keys in the scope
      { "result": [ ... ] }

      • hexist(scope, key)

      check is the key are provided in the scope
      response should indicates whether the key is exist
      { "result": true/false }

      • hget(scope, key)

      get a value by given scope and key
      response should be the value of given scope and key
      { "result": VAL }

      • hgetall(scope)

      get a key-value pairs by given scope
      response should be a map of all key-value pairs in the scope
      { "result": { KEY: VAL, ... } }

    • action

      • nonce()

      get the count of all performed actions
      generally, it is exactly equal to the nonce(starts at 1) or nonce(starts at 0) + 1
      response should be the value of nonce
      { "result": NONCE_VALUE }

      • actions(start, limit)

      get actions by given start position and limit
      response should be the actions of the nonce from the start to start + limit
      { "result": [ { nonce: NONCE_VALUE, action: ACTION_RECORD}] }
      the structure of the action is given in the next chapter

    • receipt

      • checkReceipt(receiptId)

      get receipt by receiptId { "result": {id, status, creator, sym, quantity, receiver, tariff, create_at, update_at} }

      • listReceipts(start, limit, option?, sort?)

      get a list of receipts
      option : {status?, creator?, sym?, receiver?}
      sort : {quantity?, create_at?, update_at?}

    • [optional] validateSign : (login)

SET
  • User side

    • token
      • [Optional] withdraw(userIdentity, tokenSym, quantity)

      user withdraw token from layer 2 to layer 1

      • [Optional] charge(userIdentity, tokenSym, quantity)

      user charge tokens from layer 1 to layer 2

      • transfer(from, to, tokenSym, quantity, memo)

      user transfer tokens to another

    • receipt
      • createReceipt(receiptId, tokenSym, quantity)

      pay tokens and create an receipt

  • Game server side

    • hset
      • hset(scope, key, val)

      set value by scope and key

      • hinc(scope, key, val)

      inc number value by scope and key

      • hdel(scope, key)

      del value by scope and key

    • receipt
      • commitReceipt(receiptId, receiver, texRate)

      commit the receipt and send tokens to receiver and official accounts (by logic server)

      • abortReceipt(receiptId, memo)

      abort the receipt and return tokens (by logic server)