How to use the eosjs/dist/eosjs-jssig function in eosjs

To help you get started, we’ve selected a few eosjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EOSIO / eosio-explorer / packages / api-rpc / src / api / push_action.ts View on Github external
export default async (query: {
  endpoint: string,
  account_name: string,
  private_key: string,
  actor: string,
  permission: string,
  action_name: string,
  payload: any
}) => {
  try{
    let { endpoint, account_name, private_key, actor, permission, action_name, payload } = query;

    const rpc = new JsonRpc(endpoint);
    const signatureProvider = new JsSignatureProvider([private_key]);
    const api = new Api({ rpc, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder() });


    if (account_name === "eosio" && action_name==="setabi"){
      const buffer = new Serialize.SerialBuffer({
        textEncoder: api.textEncoder,
        textDecoder: api.textDecoder,
      });

      let abi = payload.abi;
      const abiDefinition = api.abiTypes.get('abi_def');
      // need to make sure abi has every field in abiDefinition.fields
      // otherwise serialize throws error
      abi = abiDefinition!.fields.reduce(
          (acc, { name: fieldName }) => Object.assign(acc, { [fieldName]: acc[fieldName] || [] }),
          abi,
github EOSIO / eosio-project-demux-example / frontend / src / utils / eosio-client.js View on Github external
constructor (contractAccount) {
    const rpc = new JsonRpc(process.env.REACT_APP_EOSIO_HTTP_URL)
    const signatureProvider = new JsSignatureProvider([process.env.REACT_APP_EOSIO_PRIVATE_KEY])
    this.contractAccount = contractAccount
    this.eos = new Api({ rpc, signatureProvider })
  }
github EOSIO / eosio-explorer / packages / api-rpc / src / api / create_account.ts View on Github external
export default async (query: {
  endpoint: string,
  private_key: string,
  actor: string,
  permission: string,
  new_account_name: string,
  new_account_owner_key: string,
  new_account_active_key: string
}) => {
  try{
    let { endpoint, private_key: creator_private_key, actor: creator_account_name, permission: creator_account_permission, new_account_name, new_account_owner_key, new_account_active_key } = query;

    const rpc = new JsonRpc(endpoint);
    const signatureProvider = new JsSignatureProvider([creator_private_key]);
    const api = new Api({ rpc, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder() });

    const result = await api.transact({
      actions: [{
        account: 'eosio',
        name: 'newaccount',
        authorization: [{
          actor: creator_account_name,
          permission: creator_account_permission,
        }],
        data: {
          creator: creator_account_name,
          name: new_account_name,
          owner: {
            threshold: 1,
            keys: [{