AMAX On-chain Interaction - js sdk

Please refer to https://developers.eos.io/manuals/eosjs/v16.0/index

Get Amax Object


This is a local instantiation object, and the private key is stored in the front-end (not secure), independent of the Scatter plugin.

  import Amax from "@amax/amaxjs";
  const client = Amax({
    keyProvider: "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3",// private key
    httpEndpoint: "http://127.0.0.1:8888",
    chainId: chain.sys,
  });

However, we usually use the Scatter plugin for operations, where the private key is placed in the plugin or app, and then we need to obtain the Amax object from the plugin. Please refer to the Scatter 6.1.0 document for details.

import Amax from "@amax/amaxjs";
const client = scatter.amax(
    network,
    Amax,
    {
        ...options,
        authorization: [`${account.name}@${account.authority}`],
    },
    network.protocol,
);

At this point, the client is the proxy object in the plugin or APP. When a signature is required, the plugin or APP provides the signature.

Amax Method on Object


Contract operation (single or multiple contracts)


Other Methods

  • format

  • ecc

  • Verify signature

  • Convert account to bigNumber

  • Usage scenario: When querying contract data, it is usually necessary to use a username to search, and the account passed to the contract needs to be converted to bigNumber. If you don't convert there'll be a pure digital account bug.

  • Index serialization issue

Contract Code

Front-end

Query

Last updated