# eosio-push-guarantee

#### Push Guarantee

Retry time between push guarantee verification can be set with the `DAPP_CLIENT_PUSH_TRANSACTION_SLEEP` environment variable, defaults to 10ms.

```javascript
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() });

(async () => {
    const config = {
        // 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', 
        readRetries: 3,

        // pushGuarantee: 'handoffs:1', 
        // readRetries: 10,

        // pushGuarantee: 'handoffs:2', 
        // readRetries: 20,

        // pushGuarantee: 'handoffs:3', 
        // readRetries: 30,
        
        pushGuarantee: 'irreversible', 
        readRetries: 100,
    }
    const push_guarantee_rpc = new PushGuarantee(rpc, config);
    const account = 'dappservices';
    const actor = 'vacctstst123';
    const action = 'transfer';
    const serializedTrx = await api.transact({
        actions: [{
            account,
            name: action,
            authorization: [{
                actor,
                permission: 'active',
            }],
            data: {
                from: 'vacctstst123',
                to: 'natdeveloper',
                quantity: '1.0000 DAPP',
                memo: ''
            },
        }]
    },  {
        blocksBehind: 3, // in-block
        expireSeconds: 30, // in-block

        // blocksBehind: 3, // handoffs
        // expireSeconds: 90, // handoffs
        
        // expireSeconds: 300, // irreversible
        // useLastIrreversible: true, // irreversible,
        
        broadcast: false 
    });
    const response = await (await getClient()).dappNetwork.push_action(rpc, serializedTrx, config);
    console.dir(result);
})().catch((e) => { console.log(e); });
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.liquidapps.io/liquidapps-documentation/introduction/dapp-network-resources/eosio-push-guarantee.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
