1.0.0-beta-2 • Published 4 years ago

smartql-sign v1.0.0-beta-2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

img

A universal JavaScript tool for pushing SmartQL mutations to the blockchain.

Support

Set up

npm i smartql-sign

API

namespace ResoruceCost

Recource cost for transaction.

ParameterTypeDescription
cpu_usage_usnumberCPU time usage in micro seconds.
net_usage_wordsnumberNetwork usage cost (bytes).
statusstringStatus of the transaction.

namespace TranctionReceipt

ParameterTypeDescription
transaction_idstringID to refrence the transaction.
block_numnumberThe block the transaction is located in.
block_timestringTransaction time (GMT).
producer_block_idstringThe producers ID.
resource_costResoruceCostNetwork cost of the transaction.
elapsednumberElapsed time in µs used.
net_usagenumberNetwork usage.
scheduledbooleanScheduled.
action_tracesstringJSON representation of the executed transaction.

function push_mutation

Pushes a GraphQL mutation to the blockchain.

ParameterTypeDescription
argobjectArgument.
arg.querystringGraphQL query string.
arg.variablesobjectGraphQL variabes.
arg.private_keysArray\List of wif private keys to sign the transaction with.
blockchainstring?Specifiy what EOSIO chain you want to connet to.

Returns: TranctionReceipt — Transaction receipt.

Examples

Ways to require

const { push_mutation } = require('smartql-sign')

Ways to import

import { push_mutation } from 'smartql-sign'

Push a mutation

push_mutation({
  query: `
    mutation {
      eosio_token(
        actions: {
          transfer: {
            to: "pur3miish111"
            from: "relocke"
            quantity: "1.0000 EOS"
            memo: "sent with SmartQL"
            authorization: { actor: "relocke" }
          }
        }
      ) {
        chain_id
        transaction_header
        transaction_body
      }
    }
  `,
  private_keys: ['5…']
}).then(console.log)

The logged output was the TranctionReceipt object.


function push_transaction

Push a transaction to the Blockchain.

ParameterTypeDescription
argobjectArgument
arg.chain_idstringHash representing the ID of the chain.
arg.transaction_headerstringMeta data about the transaction (TaPoS, bandwidth allocation).
arg.transaction_bodystringThe serialized transaction data.
private_keysArray\List of wif private keys to sign the transaction with.

Returns: TranctionReceipt — transaction receipt.

Examples

Ways to require

const { push_transaction } = require('smartql-sign')

Ways to import

import { push_transaction } from 'smartql-sign'