const { PushGuarantee } = require("eosio-push-guarantee");
const { Api, JsonRpc, RpcError } = require('eosjs');
const { JsSignatureProvider } = require('eosjs/dist/eosjs-jssig'); // development only
const fetch = require('node-fetch'); // node only; not needed in browsers
const { TextEncoder, TextDecoder } = require('util'); // node only; native TextEncoder/Decoder
const defaultPrivateKey = "5JMUyaQ4qw6Zt816B1kWJjgRA5cdEE6PhCb2BW45rU8GBEDa1RC"; // bob
const signatureProvider = new JsSignatureProvider([defaultPrivateKey]);
const rpc = new JsonRpc('https://kylin-dsp-2.liquidapps.io', { fetch });
const api = new Api({ rpc, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder() });
// pushGuarantee: 'none', // push guarantee level for trx
// readRetries: 0, // amount of times to try and verify trx before retrying trx
// pushRetries: 3, // amount of times to retry trx before failing
// backoff: 500, // time in ms between readRetries
// backoffExponent: 1.1 // multiplier backoff time for backoff (if 500ms and 1.1 multiplier then 550ms backoff next time, etc)
pushGuarantee: 'in-block',
// pushGuarantee: 'handoffs:1',
// pushGuarantee: 'handoffs:2',
// pushGuarantee: 'handoffs:3',
pushGuarantee: 'irreversible',
const push_guarantee_rpc = new PushGuarantee(rpc, config);
const account = 'dappservices';
const actor = 'vacctstst123';
const action = 'transfer';
const serializedTrx = await api.transact({
blocksBehind: 3, // in-block
expireSeconds: 30, // in-block
// blocksBehind: 3, // handoffs
// expireSeconds: 90, // handoffs
// expireSeconds: 300, // irreversible
// useLastIrreversible: true, // irreversible,
const response = await (await getClient()).dappNetwork.push_action(rpc, serializedTrx, config);
})().catch((e) => { console.log(e); });