@bloks/api
Advanced tools
Comparing version 4.0.188 to 22.0.32
360
CHANGELOG.md
@@ -6,2 +6,362 @@ # Change Log | ||
## [22.0.31](https://github.com/ProtonProtocol/bloks/compare/v22.0.30...v22.0.31) (2021-01-26) | ||
**Note:** Version bump only for package @bloks/api | ||
## [22.0.27](https://github.com/ProtonProtocol/bloks/compare/v22.0.26...v22.0.27) (2021-01-25) | ||
**Note:** Version bump only for package @bloks/api | ||
## [22.0.23](https://github.com/ProtonProtocol/bloks/compare/v22.0.22...v22.0.23) (2021-01-24) | ||
**Note:** Version bump only for package @bloks/api | ||
## [22.0.16](https://github.com/ProtonProtocol/bloks/compare/v22.0.15...v22.0.16) (2021-01-21) | ||
**Note:** Version bump only for package @bloks/api | ||
## [22.0.15](https://github.com/ProtonProtocol/bloks/compare/v22.0.14...v22.0.15) (2021-01-20) | ||
**Note:** Version bump only for package @bloks/api | ||
## [22.0.11](https://github.com/ProtonProtocol/bloks/compare/v22.0.10...v22.0.11) (2021-01-15) | ||
**Note:** Version bump only for package @bloks/api | ||
## [22.0.10](https://github.com/ProtonProtocol/bloks/compare/v22.0.9...v22.0.10) (2021-01-15) | ||
**Note:** Version bump only for package @bloks/api | ||
## [22.0.9](https://github.com/ProtonProtocol/bloks/compare/v22.0.8...v22.0.9) (2021-01-13) | ||
**Note:** Version bump only for package @bloks/api | ||
## [22.0.7](https://github.com/ProtonProtocol/bloks/compare/v22.0.6...v22.0.7) (2021-01-13) | ||
**Note:** Version bump only for package @bloks/api | ||
## [22.0.5](https://github.com/ProtonProtocol/bloks/compare/v22.0.4...v22.0.5) (2021-01-12) | ||
**Note:** Version bump only for package @bloks/api | ||
## [22.0.3](https://github.com/ProtonProtocol/bloks/compare/v22.0.2...v22.0.3) (2021-01-12) | ||
**Note:** Version bump only for package @bloks/api | ||
## [22.0.2](https://github.com/ProtonProtocol/bloks/compare/v22.0.1-17...v22.0.2) (2021-01-11) | ||
**Note:** Version bump only for package @bloks/api | ||
## [22.0.1](https://github.com/ProtonProtocol/bloks/compare/v22.0.1-17...v22.0.1) (2021-01-11) | ||
**Note:** Version bump only for package @bloks/api | ||
## [22.0.1-17](https://github.com/jafri/bloks/compare/v21.0.54...v22.0.1-17) (2020-12-15) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.54](https://github.com/jafri/bloks/compare/v21.0.53...v21.0.54) (2020-11-18) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.53](https://github.com/jafri/bloks/compare/v22.0.1-17...v21.0.53) (2020-11-17) | ||
**Note:** Version bump only for package @bloks/api | ||
## [22.0.1-17](https://github.com/jafri/bloks/compare/v21.0.51...v22.0.1-17) (2020-11-09) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.48](https://github.com/jafri/bloks/compare/v21.0.47...v21.0.48) (2020-11-02) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.47](https://github.com/jafri/bloks/compare/v21.0.46...v21.0.47) (2020-11-01) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.46](https://github.com/jafri/bloks/compare/v21.0.45...v21.0.46) (2020-11-01) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.44](https://github.com/jafri/bloks/compare/v21.0.43...v21.0.44) (2020-11-01) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.43](https://github.com/jafri/bloks/compare/v21.0.42...v21.0.43) (2020-11-01) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.42](https://github.com/jafri/bloks/compare/v21.0.41...v21.0.42) (2020-11-01) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.38](https://github.com/jafri/bloks/compare/v21.0.37...v21.0.38) (2020-11-01) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.36](https://github.com/jafri/bloks/compare/v21.0.35...v21.0.36) (2020-10-30) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.35](https://github.com/jafri/bloks/compare/v21.0.34...v21.0.35) (2020-10-28) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.34](https://github.com/jafri/bloks/compare/v21.0.33...v21.0.34) (2020-10-28) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.31](https://github.com/jafri/bloks/compare/v21.0.30...v21.0.31) (2020-10-27) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.26](https://github.com/jafri/bloks/compare/v21.0.25...v21.0.26) (2020-10-25) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.25](https://github.com/jafri/bloks/compare/v21.0.24...v21.0.25) (2020-10-20) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.24](https://github.com/jafri/bloks/compare/v21.0.18...v21.0.24) (2020-10-18) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.18](https://github.com/jafri/bloks/compare/v21.0.17...v21.0.18) (2020-10-15) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.17](https://github.com/jafri/bloks/compare/v21.0.16...v21.0.17) (2020-10-14) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.16](https://github.com/jafri/bloks/compare/v21.0.15...v21.0.16) (2020-10-12) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.14](https://github.com/jafri/bloks/compare/v21.0.13...v21.0.14) (2020-10-11) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.12](https://github.com/jafri/bloks/compare/v21.0.11...v21.0.12) (2020-10-11) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.7](https://github.com/jafri/bloks/compare/v21.0.6...v21.0.7) (2020-10-08) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.6](https://github.com/jafri/bloks/compare/v21.0.5...v21.0.6) (2020-10-07) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.5](https://github.com/jafri/bloks/compare/v21.0.4...v21.0.5) (2020-10-06) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.3](https://github.com/jafri/bloks/compare/v21.0.3-3...v21.0.3) (2020-10-06) | ||
**Note:** Version bump only for package @bloks/api | ||
## [21.0.3-3](https://github.com/jafri/bloks/compare/v4.0.202...v21.0.3-3) (2020-10-06) | ||
**Note:** Version bump only for package @bloks/api | ||
## [4.0.200](https://github.com/jafri/bloks/compare/v4.0.199...v4.0.200) (2020-10-06) | ||
**Note:** Version bump only for package @bloks/api | ||
## [4.0.199](https://github.com/jafri/bloks/compare/v4.0.198...v4.0.199) (2020-10-02) | ||
**Note:** Version bump only for package @bloks/api | ||
## [4.0.198](https://github.com/jafri/bloks/compare/v4.0.197...v4.0.198) (2020-10-01) | ||
**Note:** Version bump only for package @bloks/api | ||
## [4.0.192](https://github.com/jafri/bloks/compare/v3.3.6...v4.0.192) (2020-09-16) | ||
**Note:** Version bump only for package @bloks/api | ||
## [4.0.185](https://github.com/jafri/bloks/compare/v4.0.184...v4.0.185) (2020-09-10) | ||
@@ -8,0 +368,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@bloks/utils"),t=require("@protonprotocol/protonjs"),n=require("@bloks/constants"),r=require("@eoscafe/hyperion"),o=require("@eoscafe/light-api");function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return i(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}const a=function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{u(r,1,e(this.v))}catch(e){u(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?u(r,1,t?t(o):o):n?u(r,1,n(o)):u(r,2,o)}catch(e){u(r,2,e)}},r},e}();function u(e,t,n){if(!e.s){if(n instanceof a){if(!n.s)return void(n.o=u.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(u.bind(null,e,t),u.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}function l(e){return e instanceof a&&1&e.s}const f="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function h(e,t,n){if("function"==typeof e[f]){var r,o,s,i=e[f]();if(function e(c){try{for(;!((r=i.next()).done||n&&n());)if((c=t(r.value))&&c.then){if(!l(c))return void c.then(e,s||(s=u.bind(null,o=new a,2)));c=c.v}o?u(o,1,c):o=c}catch(e){u(o||(o=new a),2,e)}}(),i.return){var c=function(e){try{r.done||i.return()}catch(e){}return e};if(o&&o.then)return o.then(c,(function(e){throw c(e)}));c()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var h=[],d=0;d<e.length;d++)h.push(e[d]);return function(e,t,n){var r,o,s=-1;return function i(c){try{for(;++s<e.length&&(!n||!n());)if((c=t(s))&&c.then){if(!l(c))return void c.then(i,o||(o=u.bind(null,r=new a,2)));c=c.v}r?u(r,1,c):r=c}catch(e){u(r||(r=new a),2,e)}}(),r}(h,(function(e){return t(h[e])}),n)}function d(e,t){var n;do{var r=e();if(r&&r.then){if(!l(r)){n=!0;break}r=r.v}var o=t();if(l(o)&&(o=o.v),!o)return r}while(!o.then);const s=new a,i=u.bind(null,s,2);return(n?r.then(c):o.then(f)).then(void 0,i),s;function c(n){for(r=n;l(o=t())&&(o=o.v),o;){if(o.then)return void o.then(f).then(void 0,i);if((r=e())&&r.then){if(!l(r))return void r.then(c).then(void 0,i);r=r.v}}u(s,1,r)}function f(n){if(n){do{if((r=e())&&r.then){if(!l(r))return void r.then(c).then(void 0,i);r=r.v}if(l(n=t())&&(n=n.v),!n)return void u(s,1,r)}while(!n.then);n.then(f).then(void 0,i)}else u(s,1,r)}}function m(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var p=function(e,t){void 0===t&&(t="json");try{return Promise.resolve(m((function(){return Promise.resolve(fetch(e)).then((function(e){return function(){if(e.ok)return Promise.resolve("arraybuffer"===t?e.arrayBuffer():e.json())}()}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},v=function(e,t,n){void 0===t&&(t={method:"get"}),void 0===n&&(n="json");try{return Promise.resolve(p(new Request(e,t),n))}catch(e){return Promise.reject(e)}},_=function(e,t,n){try{return void 0===n&&(n={method:"post",body:JSON.stringify(t)}),Promise.resolve(p(new Request(e,n)))}catch(e){return Promise.reject(e)}},g={jungle:"jungle",bos:"bos",eos:"mainnet",telos:"telos"};exports.EosApi=new(function(){function i(){this.eos=void 0,this.eosActions=void 0,this.eosApi=void 0,this.hyperion=void 0,this.get=void 0,this.post=void 0,this.get=v,this.post=_,this.initialize()}var a=i.prototype;return a.initialize=function(){this.eos=new t.JsonRpc(n.constants.DEFAULT_ENDPOINTS,{fetch:fetch}),this.eosActions=new t.JsonRpc(n.constants.ACTIONS_ENDPOINTS,{fetch:fetch}),this.eosApi=new t.Api({rpc:this.eos,signatureProvider:void 0}),n.constants.HYPERION_URL&&(this.hyperion=new r.JsonRpc(n.constants.HYPERION_URL,{fetch:fetch}))},a.getDappStats=function(){try{var e=this;return Promise.resolve(m((function(){return Promise.resolve(e.eos.get_table_rows({code:"dappservices",json:!0,limit:1,scope:"......2ke1.o4",table:"statext"})).then((function(e){return e&&e.rows&&e.rows.length?e.rows[0]:{}}))}),(function(e){return console.log(e),{}})))}catch(e){return Promise.reject(e)}},a.getDspPackages=function(){try{var e=this;return Promise.resolve(m((function(){return Promise.resolve(e.eos.get_table_rows({code:"dappservices",json:!0,limit:500,scope:"dappservices",table:"package"})).then((function(e){return e&&e.rows&&e.rows.length?e.rows:[]}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},a.getDapphodlBalance=function(e){var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.eos.get_table_rows({code:"dappairhodl1",json:!0,limit:1,scope:e,table:"accounts"})).then((function(e){return e&&e.rows&&e.rows.length?e.rows[0]:{}}))}),(function(){return{}})))},a.getDappBalance=function(e){var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.eos.get_table_rows({code:"dappservices",json:!0,limit:1,scope:e,table:"accounts"})).then((function(e){return e&&e.rows&&e.rows.length?e.rows[0]:{}}))}),(function(){return{}})))},a.getDappStakes=function(e){var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.eos.get_table_rows({code:"dappservices",json:!0,limit:100,scope:e,table:"staking"})).then((function(t){return t&&t.rows&&t.rows.length?t.rows.map((function(t){return t.scope=e,t})):[]}))}),(function(){return[]})))},a.getDapphodlStakes=function(e,t){var n=this;return void 0===t&&(t=""),Promise.resolve(m((function(){return Promise.resolve(n.eos.get_table_rows({code:"dappservices",json:!0,limit:1e3,scope:"dappairhodl1",table:"staking",lower_bound:t})).then((function(t){function r(){return o.filter((function(t){return t.account===e})).map((function(e){return e.scope="dappairhodl1",e}))}if(!t)return[];var o=t.rows,s=function(){if(t.more){var r=o,s=r.concat;return Promise.resolve(n.getDapphodlStakes(e,+o[o.length-1].id+1)).then((function(e){o=s.call(r,e)}))}}();return s&&s.then?s.then(r):r()}))}),(function(){return[]})))},a.getDappUnstakes=function(e){var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.eos.get_table_rows({code:"dappservices",json:!0,limit:100,scope:e,table:"refunds"})).then((function(t){return t&&t.rows&&t.rows.length?t.rows.map((function(t){return t.scope=e,t})):[]}))}),(function(){return[]})))},a.getDapphodlUnstakes=function(e){var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.eos.get_table_rows({code:"dappservices",json:!0,limit:1e3,scope:"dappairhodl1",table:"refunds"})).then((function(n){function r(){return o.filter((function(t){return t.account===e})).map((function(e){return e.scope="dappairhodl1",e}))}if(!n)return[];var o=n.rows,s=function(){if(n.more){var r=o,s=r.concat;return Promise.resolve(t.getDapphodlUnstakes(e)).then((function(e){o=s.call(r,e)}))}}();return s&&s.then?s.then(r):r()}))}),(function(){return[]})))},a.dnsAvailable=function(e){try{var t=this;return Promise.resolve(function(){if("eos"===n.constants.CHAIN)return m((function(){return Promise.resolve(t.eos.get_table_rows({json:!0,code:"eosdns.x",scope:e,table:"dns",limit:25})).then((function(e){var t=e.rows;return t&&t.length}))}),(function(){return!1}))}())}catch(e){return Promise.reject(e)}},a.getTokenSupply=function(e,t){try{var n=this;return Promise.resolve(m((function(){return Promise.resolve(n.eos.get_currency_stats(e,t)).then((function(e){var n=e[t],r=n.supply,o=n.max_supply;return{supply:r?+r.split(" ")[0]:0,max_supply:o?+o.split(" ")[0]:0}}))}),(function(e){return console.log(e),{supply:0,max_supply:0}})))}catch(e){return Promise.reject(e)}},a.generateTransactionSettings=function(e,n,r){void 0===e&&(e=3e3),void 0===n&&(n=12),void 0===r&&(r=0);try{var o=this;return Promise.resolve(o.getInfo()).then((function(i){function c(){return s({max_net_usage_words:0,max_cpu_usage_ms:0,delay_sec:r,context_free_actions:[],actions:[],transaction_extensions:[]},a)}var a={},u=function(){if(i)return Promise.resolve(o.getBlock(i.head_block_num-n)).then((function(n){a=t.Serialize.transactionHeader(n,e)}))}();return u&&u.then?u.then(c):c()}))}catch(e){return Promise.reject(e)}},a.getRamPriceInEos=function(){try{var e=!1,t=this,r=m((function(){return"wbi"===n.constants.CHAIN?Promise.resolve(t.getChainTable()).then((function(r){var o=r.max_ram_size;return Promise.resolve(t.getTokenSupply(n.constants.EOSIO_TOKEN,n.constants.CORE_SYMBOL)).then((function(t){return e=!0,o/1e4/t.supply}))})):Promise.resolve(t.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"rammarket",table_key:"",limit:10})).then((function(t){var n=t.rows[0].base.balance,r=+n.substr(0,n.indexOf(" ")),o=t.rows[0].quote.balance,s=o.substr(0,o.indexOf(" ")),i=1024*Number((s/r).toFixed(8));return e=!0,i}))}),(function(e){console.log(e)}));return Promise.resolve(r&&r.then?r.then((function(t){return e?t:0})):e?r:0)}catch(e){return Promise.reject(e)}},a.getRexQueued=function(t){try{var r=!1,o=this,s=m((function(){return Promise.resolve(o.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"rexqueue",limit:1,lower_bound:e.encodeName(t,!1)})).then((function(e){var n=e.rows;if(n&&n.length&&n[0].owner===t)return r=!0,n[0]}))}),(function(e){console.log(e)}));return Promise.resolve(s&&s.then?s.then((function(e){return r?e:void 0})):r?s:void 0)}catch(e){return Promise.reject(e)}},a.getRexPool=function(){try{return Promise.resolve(this.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"rexpool"})).then((function(t){for(var n=t.rows[0],r=0,o=Object.keys(n);r<o.length;r++){var s=o[r];"string"==typeof n[s]&&(n[s]=Number(n[s].split(" ")[0]))}return n.lent_percent=e.multiply(e.divide(n.total_lent,n.total_lendable),100),n.rex_price=+e.divide(n.total_lendable,n.total_rex),n.resource_price=+e.divide(n.total_unlent,n.total_rent+1),n}))}catch(e){return Promise.reject(e)}},a.getRexBalance=function(t){try{return Promise.resolve(this.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"rexbal",lower_bound:e.encodeName(t,!1)})).then((function(e){var n=e.rows[0];return n.owner===t?n:void 0}))}catch(e){return Promise.reject(e)}},a.getRexCpuLoans=function(t){try{return Promise.resolve(this.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"cpuloan",table_key:"byowner",key_type:"i64",limit:100,lower_bound:e.encodeName(t,!1),index_position:3})).then((function(e){return e.rows.filter((function(e){return e.from===t}))}))}catch(e){return Promise.reject(e)}},a.getRexNetLoans=function(t){try{return Promise.resolve(this.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"netloan",table_key:"byowner",key_type:"i64",limit:100,lower_bound:e.encodeName(t,!1),index_position:3})).then((function(e){return e.rows.filter((function(e){return e.from===t}))}))}catch(e){return Promise.reject(e)}},a.getEosDepositedIntoRex=function(t){try{return Promise.resolve(this.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"rexfund",lower_bound:e.encodeName(t,!1)})).then((function(e){var n=e.rows[0];return n.owner===t?Number(n.balance.split(" ")[0]):0}))}catch(e){return Promise.reject(e)}},a.getEosTopStakes=function(e){return void 0===e&&(e=500),new o.JsonRpc(n.constants.CHAIN,{fetch:fetch}).get_topstake(e)},a.getEosTopRams=function(e){return void 0===e&&(e=500),new o.JsonRpc(n.constants.CHAIN,{fetch:fetch}).get_topram(e)},a.getTokenBalance=function(e,t,n){try{return Promise.resolve(this.eos.get_currency_balance(e,t,n).catch((function(e){return console.log(e)}))).then((function(r){return r&&r.length?(console.log(e,t,n,r[0]),r[0]):null}))}catch(e){return Promise.reject(e)}},a.getAccount=function(e){return this.eos.get_account(e).catch((function(e){return console.log(e)}))},a.getInfo=function(){return this.eos.get_info().catch((function(e){return console.log(e)}))},a.getInfoFromUrl=function(e){return v(e+"/v1/chain/get_info")},a.isHyperionAlive=function(e){try{return Promise.resolve(v(e+"/v2/state/alive")).then((function(e){return e&&"OK"===e.status}))}catch(e){return Promise.reject(e)}},a.getBlock=function(e){return this.eos.get_block(e)},a.getEosBalance=function(e){try{return Promise.resolve(this.eos.get_currency_balance(n.constants.EOSIO_TOKEN,e,n.constants.CORE_SYMBOL)).then((function(e){return e[0]}))}catch(e){return Promise.reject(e)}},a.getTable=function(e){return this.eos.get_table_rows(e).catch((function(e){return console.log(e)}))},a.getAbi=function(e){return this.eos.get_abi(e).catch((function(e){return console.log(e)}))},a.parsePackedMsig=function(t){try{var r=this;return Promise.resolve(m((function(){return Promise.resolve(r.eosApi.deserializeTransactionWithActions(t)).then((function(t){function o(){return t.actions=s.map((function(e){return{action_trace:{act:e}}})),t}var s=[],i=h(t.actions,(function(t){function o(){function o(){s.push(t)}var i=function(){if(t.account===n.constants.EOSIO&&"setabi"===t.name)return Promise.resolve(r.eosApi.rawAbiToJson(e.hexToUint8Array(t.data.abi))).then((function(e){t.data.abi=e}))}();return i&&i.then?i.then(o):o()}var i=function(){if(t.account===n.constants.EOSIO_MSIG&&"propose"===t.name)return Promise.resolve(r.eosApi.deserializeActionsSync(t.data.trx.actions)).then((function(e){t.data.trx.actions=e}))}();return i&&i.then?i.then(o):o()}));return i&&i.then?i.then(o):o()}))}),(function(e){console.log("Error parsing packed msig"),console.log(e)})))}catch(e){return Promise.reject(e)}},a.getFullMsigProposal=function(t,r){try{var o=this;return Promise.resolve(m((function(){return Promise.resolve(o.eos.get_table_rows({json:!0,code:n.constants.EOSIO_MSIG,scope:e.encodeName(t,!1),table:n.constants.EOSIO_MSIG_PROPOSALS_TABLE,table_key:"",key_type:"name",lower_bound:r,index_position:1,limit:1})).then((function(e){return console.log(e),function(){if(e&&e.rows&&e.rows.length)return Promise.resolve(o.parsePackedMsig(e.rows[0].packed_transaction))}()}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},a.getMsigApprovals=function(t,r){try{var o=this;return Promise.resolve(m((function(){return Promise.resolve(o.eos.get_table_rows({json:!0,code:n.constants.EOSIO_MSIG,scope:e.encodeName(t,!1),table:r,limit:-1})).then((function(e){return e.rows}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},a.getAccountsMsigProposals=function(e){try{var t=this;return Promise.resolve(m((function(){var r=[t.getMsigApprovals(e,n.constants.EOSIO_MSIG_APPROVALS_TABLE)];return"approvals2"===n.constants.EOSIO_MSIG_APPROVALS_TABLE&&r.push(t.getMsigApprovals(e,"approvals")),Promise.resolve(Promise.all(r)).then((function(e){return e[0].concat(e[1])}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},a.getWaxGenesisRewards=function(t){try{var r=this;return Promise.resolve(m((function(){return Promise.resolve(r.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:e.encodeName(t,!1),table:"genesis",limit:1})).then((function(e){var t=e.rows;return t.length?t[0]:void 0}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},a.getVoter=function(t){try{var r=this;return Promise.resolve(m((function(){return Promise.resolve(r.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:n.constants.EOSIO,lower_bound:e.encodeName(t,!1),upper_bound:e.encodeName(t,!1),table:"voters",limit:1})).then((function(e){var t=e.rows;return t.length?t[0]:void 0}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},a.getFIOVoter=function(t){try{var r=this;return Promise.resolve(m((function(){return Promise.resolve(r.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:n.constants.EOSIO,lower_bound:e.encodeName(t,!1),upper_bound:e.encodeName(t,!1),table:"voters",key_type:"i64",index_position:3,limit:1})).then((function(e){var t=e.rows;return t.length?t[0]:void 0}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},a.getCurrentNameBids=function(e,t){return void 0===e&&(e=""),void 0===t&&(t=""),this.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"namebids",key_type:"name",lower_bound:e,upper_bound:t,index_position:2,limit:500})},a.getEosKnightsTable=function(e,t){return this.eos.get_table_rows({json:!0,code:"eosknightsio",scope:"eosknightsio",table:e,table_key:"",key_type:"name",lower_bound:t,index_position:1,limit:1}).then((function(e){var n=e.rows[0];return n.owner===t?n.rows:[]}))},a.getEosBetsTable=function(e){return this.eos.get_table_rows({json:!0,code:"eosbetdice11",scope:"eosbetdice11",table:e,table_key:"",limit:200}).then((function(e){return e.rows.length>0?e.rows:[]}))},a.getBetDiceHouseEdge=function(){return this.eos.get_table_rows({json:!0,code:"betdicegroup",scope:"betdicegroup",table:"gamestats",limit:1e3}).then((function(e){return e.rows.length>0?e.rows:[]}))},a.getBetDiceStakeInfo=function(){return this.eos.get_table_rows({json:!0,code:"betdicestake",scope:"betdicestake",table:"stats",limit:1}).then((function(e){return e.rows.length>0?e.rows[0]:{staking:0,unstaking:0}}))},a.getBetDicePrice=function(){try{return Promise.resolve(v("https://api.newdex.io/v1/ticker?symbol=betdicetoken-dice-eos")).then((function(e){return e&&e.data}))}catch(e){return Promise.reject(e)}},a.getEosPlayTable=function(e){return this.eos.get_table_rows({json:!0,code:"eosplaybrand",scope:"eosplaybrand",table:e,table_key:"",limit:1}).then((function(e){return e.rows}))},a.getFIOAddressByName=function(t){try{var n=this;return Promise.resolve(m((function(){var r=n.eos,o=r.get_table_rows;return Promise.resolve(e.string_to_uint128_hash(t)).then((function(e){return Promise.resolve(o.call(r,{code:"fio.address",scope:"fio.address",table:"fionames",lower_bound:"0x"+e,limit:1,key_type:"i128",index_position:5})).then((function(e){var n=e.rows;return n&&n.length&&n[0].name===t?n[0]:void 0}))}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},a.getFIODomainByName=function(t){try{var n=this;return Promise.resolve(m((function(){var r=n.eos,o=r.get_table_rows;return Promise.resolve(e.string_to_uint128_hash(t)).then((function(e){return Promise.resolve(o.call(r,{code:"fio.address",scope:"fio.address",table:"domains",lower_bound:"0x"+e,limit:1,key_type:"i128",index_position:4})).then((function(e){var n=e.rows;return n&&n.length&&n[0].name===t?n[0]:void 0}))}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},a.getDomains=function(e,t){void 0===e&&(e=-1);try{var n=this;return Promise.resolve(m((function(){return Promise.resolve(n.eos.get_table_rows({code:"fio.address",scope:"fio.address",table:"domains",reverse:!0,upper_bound:t,limit:e})).then((function(e){var t=e.rows;return t&&t.length?t:[]}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},a.getAddresses=function(e,t){void 0===e&&(e=-1);try{var n=this;return Promise.resolve(m((function(){return Promise.resolve(n.eos.get_table_rows({code:"fio.address",scope:"fio.address",table:"fionames",reverse:!0,upper_bound:t,limit:e})).then((function(e){var t=e.rows;return t&&t.length?t:[]}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},a.getFIOProducers=function(e){try{var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"producers",reverse:!0,limit:e})).then((function(e){var t=e.rows;return t&&t.length?t:[]}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},a.getFIOLockedTokens=function(t){try{var r=this;return Promise.resolve(m((function(){return Promise.resolve(r.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"lockedtokens",lower_bound:e.encodeName(t,!1),limit:1})).then((function(e){var r=e.rows;return r&&r.length&&r[0].owner===t?r[0].remaining_locked_amount/Math.pow(10,n.constants.CORE_PRECISION):0}))}),(function(e){return console.log(e),0})))}catch(e){return Promise.reject(e)}},a.getFIOLocked=function(e){return this.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"lockedtokens",lower_bound:e,limit:-1})},a.getAllFIOLocked=function(){try{var t=this,n=!0,r=[],o=null,s="",i=d((function(){return Promise.resolve(t.getFIOLocked(s)).then((function(t){n=(o=t).more,r=r.concat(o.rows),n&&(s=e.toBigNumber(e.encodeName(r[r.length-1].owner,!1)).plus(1).toString())}))}),(function(){return!!n}));return Promise.resolve(i&&i.then?i.then((function(){return r})):r)}catch(e){return Promise.reject(e)}},a.getFIOSupplyBreakdown=function(){try{var e=this;return Promise.resolve(e.getAllFIOLocked()).then((function(t){var r=t.reduce((function(e,t){var n=Date.now()/1e3;return 4===t.grant_type?e+=t.remaining_locked_amount:n>=1592870952?e+=t.total_grant_amount-.06*t.total_grant_amount:n>=1608422952?e+=t.total_grant_amount-.248*t.total_grant_amount:n>=1623974952?e+=t.total_grant_amount-.436*t.total_grant_amount:n>=1639526952?e+=t.total_grant_amount-.624*t.total_grant_amount:n>=1655078952?e+=t.total_grant_amount-.812*t.total_grant_amount:n>=1670630952&&(e+=t.total_grant_amount-1*t.total_grant_amount),e}),0)/Math.pow(10,n.constants.CORE_PRECISION);return Promise.resolve(e.eos.get_table_rows({code:"fio.token",scope:"FIO",table:"stat"})).then((function(t){var o=+t.rows[0].supply.split(" ")[0];return Promise.resolve(e.eos.get_table_rows({code:"fio.treasury",scope:"fio.treasury",table:"bprewards"})).then((function(t){var s=t.rows[0].rewards/Math.pow(10,n.constants.CORE_PRECISION);return Promise.resolve(e.eos.get_table_rows({code:"fio.treasury",scope:"fio.treasury",table:"bpbucketpool"})).then((function(e){var t=e.rows[0].rewards/Math.pow(10,n.constants.CORE_PRECISION),i=s+t,c=r+i;return{supply:o,totalLocked:c,bpRewards:s,bpBucket:t,totalBp:i,circulating:o-c}}))}))}))}))}catch(e){return Promise.reject(e)}},a.getFIOFees=function(){try{return Promise.resolve(this.eos.get_table_rows({code:"fio.fee",scope:"fio.fee",table:"fiofees",limit:-1}).then((function(e){return e.rows})).catch((function(e){return[]})))}catch(e){return Promise.reject(e)}},a.addFIOFeeToActions=function(e,t){try{var r=this,o={"eosio::deleteauth":"auth_delete","eosio::linkauth":"auth_link","eosio::regproducer":"register_producer","eosio::regproxy":"register_proxy","eosio::unregprod":"unregister_producer","eosio::unregproxy":"unregister_proxy","eosio::updateauth":"auth_update","eosio::voteproducer":"vote_producer","eosio::voteproxy":"proxy_vote","fio.token::trnsfiopubky":"transfer_tokens_pub_key","fio.address::addaddress":"add_pub_address","fio.address::regaddress":"register_fio_address","fio.address::regdomain":"register_fio_domain","fio.address::renewaddress":"renew_fio_address","fio.address::renewdomain":"renew_fio_domain","fio.address::setdomainpub":"set_fio_domain_public","eosio.msig::approve":"msig_approve","eosio.msig::cancel":"msig_cancel","eosio.msig::exec":"msig_exec","eosio.msig::invalidate":"msig_invalidate","eosio.msig::propose":"msig_propose","eosio.msig::unapprove":"msig_approve","fio.reqobt::newfundsreq":"new_funds_request","fio.reqobt::rejectfndreq":"reject_funds_request","fio.reqobt::cancelfndreq":"cancelfndreq","fio.reqobt::recordobt":"record_obt_data","fio.reqobt::newpubaddreq":"new_pub_address_request","fio.reqobt::relpubadd":"release_pub_address","fio.reqobt::rejectaddreq":"reject_pub_address_request","fio.reqobt::canceladdreq":"cancel_pub_address_request","fio.lock::trnsloctoks":"transfer_locked_tokens","fio.lock::locktokens":"lock_tokens","fio.address::remaddress":"remove_pub_address","fio.address::remalladdr":"remove_all_pub_addresses","fio.address::burnaddress":"burn_fio_address","fio.address::xferdomain":"transfer_fio_domain","fio.address::xferaddress":"transfer_fio_address"};return Promise.resolve(r.getFIOFees()).then((function(s){var i=[],c=h(e,(function(e){return Promise.resolve(r.eosApi.getCachedAbi(e.account)).then((function(c){var a=c.abi,u=a.structs;function l(){i.push(e)}var f=a.actions.find((function(t){return t.name===e.name})),h=function(){if(f){var i=u.find((function(e){return e.name===f.type})),c=function(){if(i){if(i.fields.find((function(e){return"max_fee"===e.name}))&&void 0===e.data.max_fee){var c=o[e.account+"::"+e.name];if(c){var a=s.find((function(e){return e.end_point===c}));e.data.max_fee=a?a.suf_amount:0}}i.fields.find((function(e){return"actor"===e.name}))&&void 0===e.data.actor&&(e.data.actor=t),i.fields.find((function(e){return"tpid"===e.name}))&&void 0===e.data.tpid&&(e.data.tpid=n.constants.FIO_FEES_ACCOUNT);var u=i.fields.find((function(e){return"fio_address"===e.name})),l=function(){if(u&&void 0===e.data.fio_address)return Promise.resolve(r.getFIOAddresses(t)).then((function(t){t.length&&(e.data.fio_address=t[0].name)}))}();if(l&&l.then)return l.then((function(){}))}}();if(c&&c.then)return c.then((function(){}))}}();return h&&h.then?h.then(l):l()}))}));return c&&c.then?c.then((function(){return i})):i}))}catch(e){return Promise.reject(e)}},a.getFIOAddresses=function(t){return this.eos.get_table_rows({code:"fio.address",scope:"fio.address",table:"fionames",key_type:"i64",limit:-1,lower_bound:e.encodeName(t,!1),upper_bound:e.toBigNumber(e.encodeName(t,!1)).plus(1).toString(),index_position:4}).then((function(e){return e.rows.length>0?e.rows.filter((function(e){return e.owner_account===t})):[]})).catch((function(e){return[]}))},a.getFIODomains=function(t){return this.eos.get_table_rows({code:"fio.address",scope:"fio.address",table:"domains",key_type:"i64",limit:-1,lower_bound:e.encodeName(t,!1),upper_bound:e.toBigNumber(e.encodeName(t,!1)).plus(1).toString(),index_position:2}).then((function(e){return e.rows.length>0?e.rows.filter((function(e){return e.account===t})):[]})).catch((function(e){return[]}))},a.getFIOAddressesAndDomains=function(e){return _(n.constants.DEFAULT_ENDPOINTS[0]+"/v1/get_fio_names",{fio_public_key:e})},a.getControlledAccounts=function(e){return n.constants.HISTORY_TYPES.includes("native")?this.eosActions.history_get_controlled_accounts(e):n.constants.HISTORY_TYPES.includes("hyperion")?new t.JsonRpc([n.constants.HYPERION_URL],{fetch:fetch}).history_get_controlled_accounts(e):[]},a.getPermissionLinks=function(e){try{return n.constants.LIGHT_API?Promise.resolve(v(n.constants.API_URL+"/account/"+e+"?type=getAccountLightData")).then((function(e){return e?e.linkauth.map((function(e){return{action:e.type,contract:e.code,permission_name:e.requirement}})):[]})):n.constants.HISTORY_TYPES.includes("dfuse")?Promise.resolve(m((function(){return Promise.resolve(v(n.constants.API_URL+"/dfuse?type=state_permission_links&account="+e)).then((function(e){return e.linked_permissions||[]}))}),(function(e){return console.log(e),[]}))):n.constants.HISTORY_TYPES.includes("hyperion")?Promise.resolve(this.hyperion.get_links(e)).then((function(e){return e.links.map((function(e){return{action:e.action,contract:e.code,permission_name:e.permission}}))})):(console.log("Permission links not available on chain"),Promise.resolve([]))}catch(e){return Promise.reject(e)}},a.dfuseGetKeyAccounts=function(e,t){try{return void 0===t&&(t=n.constants.API_URL),Promise.resolve(m((function(){return Promise.resolve(v(t+"/dfuse?type=state_key_accounts&publicKey="+e)).then((function(e){var t=e.account_names;return t&&t.length?t:[]}))}),(function(t){return console.log(t),console.log("No dfuse accounts found associated with key:",e),[]})))}catch(e){return Promise.reject(e)}},a.nativeGetKeyAccounts=function(r,o){try{void 0===o&&(o=n.constants.ACTIONS_ENDPOINTS);var s=new t.JsonRpc(o,{fetch:fetch});return Promise.resolve(m((function(){return Promise.resolve(s.history_get_key_accounts(r)).then((function(t){var o=t.account_names,s=o&&o.length?o:[];if(["fio","fio-test"].includes(n.constants.CHAIN)){var i=e.fioKeyToActor(r);-1===s.indexOf(i)&&s.push(i)}return s}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},a.hyperionGetKeyAccounts=function(e,t){try{void 0===t&&(t=n.constants.HYPERION_URL);var o=new r.JsonRpc(t,{fetch:fetch});return Promise.resolve(o.get_key_accounts(e)).then((function(e){var t=e.account_names;return t&&t.length?t:[]}))}catch(e){return Promise.reject(e)}},a.hyperionGetTokensForAccount=function(e){try{return Promise.resolve(this.hyperion.get_tokens(e)).then((function(e){return e.tokens.map((function(e){return{currency:e.symbol,trx_id:"",deleted:!1,amount:e.amount,contract:e.contract,decimals:e.precision,metadata:{}}}))}))}catch(e){return Promise.reject(e)}},a.lightGetKeyAccounts=function(e,t){try{void 0===t&&(t=n.constants.LIGHT_API);var r=new o.JsonRpc("",{fetch:fetch,endpoint:t});return Promise.resolve(r.get_key_accounts(e))}catch(e){return Promise.reject(e)}},a.getKeyAccountsByType=function(e,t,r){try{switch(r||(r=n.constants),t){case"dfuse":return Promise.resolve(this.dfuseGetKeyAccounts(e,n.constants.API_URL));case"native":return Promise.resolve(this.nativeGetKeyAccounts(e,n.constants.ACTIONS_ENDPOINTS));case"hyperion":return Promise.resolve(this.hyperionGetKeyAccounts(e,n.constants.HYPERION_URL));default:return Promise.resolve([])}}catch(e){return Promise.reject(e)}},a.getKeyAccounts=function(e){try{var t=function(e){return r?e:[]},r=!1,o=this,s=h(n.constants.HISTORY_TYPES,(function(t){return m((function(){return Promise.resolve(o.getKeyAccountsByType(e,t,n.constants)).then((function(e){return r=!0,e}))}),(function(e){console.log(e)}))}),(function(){return r}));return Promise.resolve(s&&s.then?s.then(t):t(s))}catch(e){return Promise.reject(e)}},a.getKeyAccountsForAllChains=function(e){try{var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.lightGetKeyAccounts(e,n.constants.LIGHT_API)).then((function(e){return Object.keys(e).reduce((function(t,n){return Object.keys(e[n].accounts).length&&t.push({chain:n,accounts:Object.keys(e[n].accounts)}),t}),[])}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},a.getRequiredAccounts=function(e,t,n,r,o){void 0===n&&(n=[]),void 0===r&&(r=1),void 0===o&&(o=2);try{var s=this;return Promise.resolve(s.getAccount(e)).then((function(i){var c=h(i.permissions,(function(i){return function(){if(i.perm_name===t){var c=i.required_auth.accounts;return c.length||n.push({actor:e,permission:t}),h(c,(function(e){var t=function(){if(r<o)return Promise.resolve(s.getRequiredAccounts(e.permission.actor,e.permission.permission,n,++r,o)).then((function(){}));n.push({actor:e.permission.actor,permission:e.permission.permission})}();if(t&&t.then)return t.then((function(){}))}))}}()}));return c&&c.then?c.then((function(){return n})):n}))}catch(e){return Promise.reject(e)}},a.getUsersFromKeys=function(e){try{var t=this,n=[],r=e.map((function(e){try{return Promise.resolve(t.getKeyAccounts(e)).then((function(r){var o=r.map((function(r){try{return Promise.resolve(t.getAccount(r)).then((function(t){for(var o,s=c(t.permissions);!(o=s()).done;){var i=o.value;i.required_auth.keys.find((function(t){return t.key===e}))&&n.push({actor:r,permission:i.perm_name,publicKey:e})}}))}catch(e){return Promise.reject(e)}}));return Promise.resolve(Promise.all(o)).then((function(){}))}))}catch(e){return Promise.reject(e)}}));return Promise.resolve(Promise.all(r)).then((function(){return n}))}catch(e){return Promise.reject(e)}},a.getActionsFromNative=function(t,n,r,o){void 0===o&&(o="native");try{return console.log("Fetching actions from:",o),console.log("Fetch Params:","actionSkip",n,"actionsPerPage",r),Promise.resolve(this.eosActions.history_get_actions(t,n,r)).then((function(t){if(!t)throw new Error("Could not retrieve actions");return"native"===o?e.nativeTransformGetActions(t):[]}))}catch(e){return Promise.reject(e)}},a.getRexReturnRate=function(e){void 0===e&&(e="mpr");try{var t=g[n.constants.CHAIN];return t?Promise.resolve(_("https://www.api.bloks.io/graphql/v1alpha1/graphql",{query:"query {\n "+t+"_"+e+" {\n "+e+"\n }\n }",variables:null})).then((function(n){var r=n.data;return r?Math.abs(r[t+"_"+e][0][e]):0})):Promise.resolve(0)}catch(e){return Promise.reject(e)}},a.getRexPriceChart=function(){try{var t=g[n.constants.CHAIN];if(t){var r=e.formatDate(e.utcTime()),o=e.formatDate(e.utcTime(e.startDate(e.time(),7)));return Promise.resolve(_("https://www.api.bloks.io/graphql/v1alpha1/graphql",{query:"query {\n "+t+'_pricechart(args: {\n from_time: "'+o+'",\n to_time: "'+r+'"\n }) {\n t\n o\n h\n l\n c\n }\n }',variables:null})).then((function(e){var n=e.data;return n?n[t+"_pricechart"]:[]}))}return Promise.resolve({actions:[]})}catch(e){return Promise.reject(e)}},a.getMsigProposalDescriptions=function(){try{switch(n.constants.CHAIN){case"eos":return Promise.resolve(v("https://raw.githubusercontent.com/jafri/eos-community-proposals/master/proposals.json"));default:return Promise.resolve({})}}catch(e){return Promise.reject(e)}},a.getHistoryTransaction=function(r,o){void 0===o&&(o=0);try{var s=new t.JsonRpc(n.constants.TRANSACTIONS_ENDPOINTS,{fetch:fetch});return Promise.resolve(s.history_get_transaction(r,o)).then((function(t){if(!t)throw new Error("TX not found");return e.historyTransformTransaction(t)}))}catch(e){return Promise.reject(e)}},a.getDeferredTransaction=function(t){try{return Promise.resolve(this.eos.get_scheduled_transactions(!0,t,1)).then((function(n){var r=n.transactions;return r.length>0&&r[0].trx_id.substring(0,6)===t.substring(0,6)?e.historyTransformDeferredTransaction(r[0]):{}}))}catch(e){return Promise.reject(e)}},a.accountNameSearch=function(e,t){try{var r=this;return e&&/(^[a-zA-Z12345.]+$)/.test(e)?0===e.indexOf(".")?Promise.resolve([]):Promise.resolve(m((function(){return e=e.toLowerCase(),Promise.resolve(r.eos.get_table_by_scope({json:!0,code:n.constants.EOSIO,limit:t,lower_bound:e,table:"userres",upper_bound:""+e+(e.length<12?"z".repeat(12-e.length):"")})).then((function(e){return e.rows.map((function(e){return e.scope}))}))}),(function(e){return console.log(e),[]}))):Promise.resolve([])}catch(e){return Promise.reject(e)}},a.getChainTable=function(){return this.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"global",table_key:"",limit:1}).then((function(e){return e.rows[0]}))},a.delegatedBandwith=function(t,r){return this.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:e.encodeName(t,!1),table:"delband",table_key:"",limit:-1,lower_bound:r,key_type:"i64",index_position:1})},a.getXprVoter=function(t){try{var r=this;return Promise.resolve(m((function(){return Promise.resolve(r.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,lower_bound:e.encodeName(t,!1),table:"votersxpr",limit:1})).then((function(e){var n=e.rows;return n&&n.length&&n[0].owner===t?n[0]:void 0}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},a.getXprAccountStakes=function(t){try{var r=this,o=[],s=m((function(){return Promise.resolve(r.eos.get_table_rows({code:n.constants.EOSIO,scope:e.encodeName(t,!1),table:"delxpr",limit:-1})).then((function(e){var t=e.rows;t&&t.length&&(o=t)}))}),(function(e){console.log(e)}));return Promise.resolve(s&&s.then?s.then((function(){return o})):o)}catch(e){return Promise.reject(e)}},a.getXprAccountRefund=function(t){try{var r,o=this,s=m((function(){return Promise.resolve(o.eos.get_table_rows({code:n.constants.EOSIO,scope:e.encodeName(t,!1),table:"refundsxpr",limit:-1})).then((function(e){var t=e.rows;t&&t.length&&((r=t[0]).quantity=+r.quantity.split(" ")[0])}))}),(function(e){console.log(e)}));return Promise.resolve(s&&s.then?s.then((function(){return r})):r)}catch(e){return Promise.reject(e)}},a.getAccountDelegatedBandwidth=function(t){try{var n=this,r=!0,o=[],s=null,i="",c=m((function(){var c=d((function(){return Promise.resolve(n.delegatedBandwith(t,i)).then((function(t){r=(s=t).more,o=o.concat(s.rows),r&&(i=e.toBigNumber(e.encodeName(o[o.length-1].to,!1)).plus(1).toString())}))}),(function(){return!!r}));if(c&&c.then)return c.then((function(){}))}),(function(e){console.log(e)}));return Promise.resolve(c&&c.then?c.then((function(){return o})):o)}catch(e){return Promise.reject(e)}},a.getAccountResources=function(t){return this.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:e.encodeName(t,!1),table:"userres",table_key:"",limit:1}).then((function(e){return e.rows[0]}))},a.getBpJson=function(){return this.eos.get_table_rows({json:!0,code:"producerjson",scope:"producerjson",table:"producerjson",table_key:"",limit:500}).then((function(e){return e.rows}))},a.getPixeos=function(e){try{return Promise.resolve("eos"===n.constants.CHAIN&&m((function(){return Promise.resolve(v("https://avatar.pixeos.art/avatar/"+e,void 0,"arraybuffer")).then((function(e){if(e){var t=new Uint8Array(e).reduce((function(e,t){return e+String.fromCharCode(t)}),"");return"data:image/png;base64,"+btoa(t)}return e}))}),(function(){return!1})))}catch(e){return Promise.reject(e)}},a.getGravatar=function(e){try{return"eos"===n.constants.CHAIN?Promise.resolve(this.eos.get_table_rows({json:!0,code:n.constants.ACCOUNT_INFO,scope:n.constants.ACCOUNT_INFO,table:"accounts",table_key:"",key_type:"name",lower_bound:e,index_position:1,limit:1})).then((function(t){return t.rows.length>0&&t.rows[0].account_name===e?t.rows[0]:void 0})):Promise.resolve(void 0)}catch(e){return Promise.reject(e)}},a.getProtonAvatar=function(e){try{var t=this;return Promise.resolve(function(){if(-1!==n.constants.CHAIN.indexOf("proton"))return Promise.resolve(t.eos.get_table_rows({json:!0,code:"eosio.proton",scope:"eosio.proton",table:"usersinfo",table_key:"",key_type:"name",lower_bound:e,index_position:1,limit:1})).then((function(t){return t.rows.length>0&&t.rows[0].acc===e?t.rows[0]:void 0}))}())}catch(e){return Promise.reject(e)}},a.getProxyData=function(e){try{return""!==n.constants.ALOHA_PROXY_URL?Promise.resolve(v(n.constants.ALOHA_PROXY_URL+"/"+e+"?output=json")).then((function(e){return e.proxy})):Promise.resolve(void 0)}catch(e){return Promise.reject(e)}},a.getBlacklistTable=function(e){return this.eos.get_table_rows({json:!0,code:"theblacklist",scope:"theblacklist",table:e,table_key:"",limit:500}).then((function(e){return e.rows}))},a.getProposalsByProposer=function(t){try{var r=this;return Promise.resolve(m((function(){return Promise.resolve(r.eos.get_table_rows({json:!0,code:n.constants.EOSFORUM,scope:n.constants.EOSFORUM,table:n.constants.EOSIO_MSIG_PROPOSALS_TABLE,key_name:"by_proposer",key_type:"i64",lower_bound:e.encodeName(t,!1),upper_bound:e.toBigNumber(e.encodeName(t,!1)).plus(1).toString(),index_position:2,limit:100})).then((function(e){return e.rows}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},a.getProposalsByVoter=function(t){var r=function(e){for(var t="",n=e.length-1;n>0;n-=2)t+=e[n-1]+e[n];return t.length%2!=0&&(t="0"+t),t}(function(e){for(var t=e.toString().split(""),n=[],r=[];t.length;)for(var o=1*t.shift(),s=0;o||s<n.length;s++)n[s]=(o+=10*(n[s]||0))%16,o=(o-n[s])/16;for(;n.length;)r.push(n.pop().toString(16));return r.join("")}(e.toBigNumber(e.encodeName(t,!1)).toString()));return this.eos.get_table_rows({json:!0,code:n.constants.EOSFORUM,scope:n.constants.EOSFORUM,table:"vote",key_name:"by_voter",key_type:"i128",lower_bound:"0x0000000000000000"+r,upper_bound:"0xffffffffffffffff"+r,index_position:3}).then((function(e){return e.rows}))},a.getProxies=function(){try{return""!==n.constants.ALOHA_PROXY_URL?Promise.resolve(v(n.constants.ALOHA_PROXY_URL+"?output=json")).then((function(e){return e.proxies})):Promise.resolve(this.hyperion.get_voters({proxy:!0,limit:1e3})).then((function(e){return e.voters.map((function(e,t){return s({},e,{weight:e.weight/Math.pow(10,n.constants.CORE_PRECISION),rank:t+1})}))}))}catch(e){return Promise.reject(e)}},a.getVoters=function(e){try{var t=this;return t.hyperion?Promise.resolve(t.hyperion.get_voters({producer:e,limit:100})).then((function(e){var n=e.voters,r=t.calculateVoteWeight();return n.map((function(e){return s({},e,{vote:t.weightedVoteToNumber(e.weight,r)})}))})):Promise.resolve(void 0)}catch(e){return Promise.reject(e)}},a.calculateVoteWeight=function(){var e="wax"===n.constants.CHAIN?13:52,t=Date.now()/1e3-946684800,r=Math.floor(t/604800)/e;return Math.pow(2,r)},a.weightedVoteToNumber=function(e,t){return void 0===t&&(t=this.calculateVoteWeight()),+e/t/Math.pow(10,n.constants.CORE_PRECISION)},a.getAirdrops=function(){try{return Promise.resolve(v("https://raw.githubusercontent.com/eoscafe/eos-airdrops/master/tokens.json"))}catch(e){return Promise.reject(e)}},a.getDapps=function(){try{return Promise.resolve(v("https://raw.githubusercontent.com/eoscafe/eos-dapps/master/dapps.json"))}catch(e){return Promise.reject(e)}},a.getAllAirgrabs=function(){try{return Promise.resolve(v("https://raw.githubusercontent.com/eoscafe/eos-airgrabs/master/airgrabs.json"))}catch(e){return Promise.reject(e)}},a.getGameStatsAvailable=function(e){try{return Promise.resolve(m((function(){return Promise.resolve(v("https://eosgames.guru/api/external/user/"+e)).then((function(e){return e&&"true"===e.exist}))}),(function(e){return console.log(e),!1})))}catch(e){return Promise.reject(e)}},a.getActions=function(e,t,r){var o=void 0===r?{}:r,s=o.actionsPerPage,i=void 0===s?100:s,c=o.actionSkip,a=void 0===c?0:c,u=o.sortDirection,l=void 0===u?"desc":u,f=o.dfuseCursorStack,h=void 0===f?[]:f,d=o.tokenFilter,m=o.actionFilters,p=o.contractFilter,v=o.actionFilter,_=o.start,g=void 0===_?n.constants.CHAIN_START_DATE:_,b=o.end;try{var P,y=this;!t&&n.constants.HISTORY_TYPES.length&&(t=n.constants.HISTORY_TYPES[0]),g&&b?(g=g||n.constants.CHAIN_START_DATE?new Date(g||n.constants.CHAIN_START_DATE).toISOString():void 0,b=new Date(b||new Date).toISOString()):(g=void 0,b=void 0);var w=function(){if("dfuse"===t)return Promise.resolve(y.getActionsFromDfuse(e,{limit:i,cursor:h.length>0?h[h.length-1]:"",direction:l,query:"",after:g,before:b,tokenFilter:d,actionFilters:m,contractFilter:p,actionFilter:v})).then((function(e){P=e}));var n="hyperion"===t?Promise.resolve(y.getActionsFromHyperion(e,{skip:Math.abs(a)-1,limit:i,sort:l,after:g,before:b,tokenFilter:d,actionFilters:m,contractFilter:p,actionFilter:v})).then((function(e){P=e})):Promise.resolve(y.getActionsFromNative(e,a,-i,"native")).then((function(e){P=e}));return n&&n.then?n.then((function(){})):void 0}();return Promise.resolve(w&&w.then?w.then((function(){return P})):P)}catch(e){return Promise.reject(e)}},a.getActionsFromDfuse=function(t,r){var o=void 0===r?{}:r,s=o.before,i=o.after,c=o.limit,a=void 0===c?25:c,u=o.cursor,l=o.query,f=o.direction,h=void 0===f?"desc":f,d=o.tokenFilter,m=o.actionFilters,p=o.contractFilter,_=o.actionFilter,g=o.type,b=void 0===g?"search_transactions_graphql":g;try{var P=l||"(auth:"+t+" OR\n receiver:"+t+" OR\n data.to:"+t+" OR\n data.from:"+t+" OR\n data.receiver:"+t+")";if(d&&(P=P+" account:"+d.split(" ")[1]),m){var y=Object.entries(m).reduce((function(e,t){var n=t[1];return n.isActive?e.concat(n):e}),[]);if(y.length){var w=y.map((function(e){return e.dfuseQuery(t)})).join(" OR ");-1!==w.search("OR")&&(w="("+w+")"),P=P+" "+w}p&&(P=P+" account:"+p),_&&(P=P+" action:"+_)}return Promise.resolve(v(e.urlBuilder(n.constants.API_URL,"dfuse",{type:b,q:P,options:Object.assign({},{sort:h,cursor:u,limit:a,withReversible:!0,before:s,after:i,code:1})}))).then((function(r){if(!r)throw new Error("Could not retrieve actions");return e.dfuseTransformGetActions(r,t,n.constants)}))}catch(e){return Promise.reject(e)}},a.getActionsFromHyperion=function(t,r){var o=void 0===r?{}:r,s=o.skip,i=o.limit,a=o.sort,u=o.after,l=o.before,f=o.filter,h=o.tokenFilter,d=o.actionFilters,m=o.contractFilter,p=o.actionFilter;try{var _,g=function(){if(!_)throw new Error("Could not retrieve actions");return e.hyperionTransformGetActions(_)},b={filter:f,skip:s,limit:i,sort:a,after:u,before:l};if(console.log("Fetching actions from Hyperion"),console.table(b),h){var P=h.split(" ")[1];b.filter=b.filter?b.filter.replace("*",P):P+":*"}if(d){var y=Object.entries(d).reduce((function(e,t){var n=t[1];return n.isActive?e.concat(n):e}),[]);if(y.length){for(var w,O=c(y);!(w=O()).done;)w.value.hyperionQuery(t,b);console.log(b)}}if(m)if(b.filter){var I=b.filter.split(":");b.filter=m+":"+I[1]}else b.filter=m+":*";if(p)if(b.filter){var S=b.filter.split(":"),A=S[0],j=S[1];b.filter="*"===j?A+":"+p:A+":"+j+","+p}else b.filter="*:"+p;var k=n.constants.HYPERION_URL?Promise.resolve(this.hyperion.get_actions(t,Object.assign({},b))).then((function(e){_=e})):Promise.resolve(v(e.urlBuilder(n.constants.API_URL,"hyperion",{type:"get_actions",account:t,options:Object.assign({},b)}))).then((function(e){_=e}));return Promise.resolve(k&&k.then?k.then(g):g())}catch(e){return Promise.reject(e)}},a.getAllMsigs=function(){try{var t=this;if(n.constants.HISTORY_TYPES.includes("dfuse"))return Promise.resolve(v(e.urlBuilder(n.constants.API_URL,"dfuse",{type:"state_scope_pipeline",account:n.constants.EOSIO_MSIG,table:n.constants.EOSIO_MSIG_PROPOSALS_TABLE,options:{}}))).then((function(e){return e.tables.map((function(e){return e.rows=e.rows.sort((function(e,t){return t.block-e.block})),e.highestBlock=e.rows[0].block,e})).sort((function(e,t){return t.highestBlock-e.highestBlock}))}));var r=function(){return o.map((function(e){return{scope:e.scope,rows:Array(e.count).fill({key:""})}}))},o=[],s="",i=d((function(){return Promise.resolve(t.eos.get_table_by_scope({json:!0,code:"eosio.msig",limit:100,lower_bound:s,table:"proposal",upper_bound:""})).then((function(e){s=e.more,o=o.concat(e.rows)}))}),(function(){return!!s}));return Promise.resolve(i&&i.then?i.then(r):r())}catch(e){return Promise.reject(e)}},a.getParent=function(t){return n.constants.HISTORY_TYPES.includes("hyperion")?n.constants.HYPERION_URL?this.hyperion.get_creator(t):v(e.urlBuilder(n.constants.API_URL,"hyperion",{type:"get_creator",account:t})):null},a.getHyperionTransaction=function(t){try{var r,o=function(){if(!r||!r.actions||!r.actions.length)throw new Error("TX not found");return e.hyperionTransformTransaction(r)},s=n.constants.HYPERION_URL?Promise.resolve(this.hyperion.get_transaction(t)).then((function(e){r=e})):Promise.resolve(v(e.urlBuilder(n.constants.API_URL,"hyperion",{type:"get_transaction",id:t,options:{}}))).then((function(e){r=e}));return Promise.resolve(s&&s.then?s.then(o):o())}catch(e){return Promise.reject(e)}},a.getProducers=function(t,r){void 0===t&&(t=1),void 0===r&&(r=50);try{var o=this;if(""!==n.constants.API_URL)return Promise.resolve(v(e.urlBuilder(n.constants.API_URL,"producers",{pageNum:t,perPage:r})));var s=!0,i=[],c=null,a=null,u=d((function(){return Promise.resolve(o.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"producers",lower_bound:a,index_position:1,key_type:"i64",limit:100})).then((function(t){s=(c=t).more,i=i.concat(c.rows),a=e.toBigNumber(e.encodeName(i[i.length-1].owner,!1)).plus(1).toString()}))}),(function(){return!!s}));return Promise.resolve(u&&u.then?u.then((function(){return i})):i)}catch(e){return Promise.reject(e)}},i}()),exports.get=v,exports.http=p,exports.post=_,exports.put=function(e,t,n){try{return void 0===n&&(n={method:"put",body:JSON.stringify(t)}),Promise.resolve(p(new Request(e,n)))}catch(e){return Promise.reject(e)}}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@bloks/utils"),t=require("@proton/js"),n=require("@bloks/constants"),r=require("@eoscafe/hyperion"),o=require("@eoscafe/light-api");function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return i(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}const u=function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{a(r,1,e(this.v))}catch(e){a(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?a(r,1,t?t(o):o):n?a(r,1,n(o)):a(r,2,o)}catch(e){a(r,2,e)}},r},e}();function a(e,t,n){if(!e.s){if(n instanceof u){if(!n.s)return void(n.o=a.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(a.bind(null,e,t),a.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}function l(e){return e instanceof u&&1&e.s}const f="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function h(e,t,n){if("function"==typeof e[f]){var r,o,s,i=e[f]();if(function e(c){try{for(;!((r=i.next()).done||n&&n());)if((c=t(r.value))&&c.then){if(!l(c))return void c.then(e,s||(s=a.bind(null,o=new u,2)));c=c.v}o?a(o,1,c):o=c}catch(e){a(o||(o=new u),2,e)}}(),i.return){var c=function(e){try{r.done||i.return()}catch(e){}return e};if(o&&o.then)return o.then(c,(function(e){throw c(e)}));c()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var h=[],d=0;d<e.length;d++)h.push(e[d]);return function(e,t,n){var r,o,s=-1;return function i(c){try{for(;++s<e.length&&(!n||!n());)if((c=t(s))&&c.then){if(!l(c))return void c.then(i,o||(o=a.bind(null,r=new u,2)));c=c.v}r?a(r,1,c):r=c}catch(e){a(r||(r=new u),2,e)}}(),r}(h,(function(e){return t(h[e])}),n)}function d(e,t){var n;do{var r=e();if(r&&r.then){if(!l(r)){n=!0;break}r=r.v}var o=t();if(l(o)&&(o=o.v),!o)return r}while(!o.then);const s=new u,i=a.bind(null,s,2);return(n?r.then(c):o.then(f)).then(void 0,i),s;function c(n){for(r=n;l(o=t())&&(o=o.v),o;){if(o.then)return void o.then(f).then(void 0,i);if((r=e())&&r.then){if(!l(r))return void r.then(c).then(void 0,i);r=r.v}}a(s,1,r)}function f(n){if(n){do{if((r=e())&&r.then){if(!l(r))return void r.then(c).then(void 0,i);r=r.v}if(l(n=t())&&(n=n.v),!n)return void a(s,1,r)}while(!n.then);n.then(f).then(void 0,i)}else a(s,1,r)}}function m(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var p=function(e,t){void 0===t&&(t="json");try{return Promise.resolve(m((function(){return Promise.resolve(fetch(e)).then((function(e){return function(){if(e.ok)return Promise.resolve("arraybuffer"===t?e.arrayBuffer():e.json())}()}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},v=function(e,t,n){void 0===t&&(t={method:"get"}),void 0===n&&(n="json");try{return Promise.resolve(p(new Request(e,t),n))}catch(e){return Promise.reject(e)}},_=function(e,t,n){try{return void 0===n&&(n={method:"post",body:JSON.stringify(t)}),Promise.resolve(p(new Request(e,n)))}catch(e){return Promise.reject(e)}},g={jungle:"jungle",bos:"bos",eos:"mainnet",telos:"telos"};exports.EosApi=new(function(){function i(){this.eos=void 0,this.eosActions=void 0,this.eosApi=void 0,this.hyperion=void 0,this.get=void 0,this.post=void 0,this.get=v,this.post=_,this.initialize()}var u=i.prototype;return u.initialize=function(){this.eos=new t.JsonRpc(n.constants.DEFAULT_ENDPOINTS,{fetch:fetch}),this.eosActions=new t.JsonRpc(n.constants.ACTIONS_ENDPOINTS,{fetch:fetch}),this.eosApi=new t.Api({rpc:this.eos,signatureProvider:void 0}),n.constants.HYPERION_URL&&(this.hyperion=new r.JsonRpc(n.constants.HYPERION_URL,{fetch:fetch}))},u.getDappStats=function(){try{var e=this;return Promise.resolve(m((function(){return Promise.resolve(e.eos.get_table_rows({code:"dappservices",json:!0,limit:1,scope:"......2ke1.o4",table:"statext"})).then((function(e){return e&&e.rows&&e.rows.length?e.rows[0]:{}}))}),(function(e){return console.log(e),{}})))}catch(e){return Promise.reject(e)}},u.getDspPackages=function(){try{var e=this;return Promise.resolve(m((function(){return Promise.resolve(e.eos.get_table_rows({code:"dappservices",json:!0,limit:500,scope:"dappservices",table:"package"})).then((function(e){return e&&e.rows&&e.rows.length?e.rows:[]}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},u.getDapphodlBalance=function(e){var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.eos.get_table_rows({code:"dappairhodl1",json:!0,limit:1,scope:e,table:"accounts"})).then((function(e){return e&&e.rows&&e.rows.length?e.rows[0]:{}}))}),(function(){return{}})))},u.getDappBalance=function(e){var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.eos.get_table_rows({code:"dappservices",json:!0,limit:1,scope:e,table:"accounts"})).then((function(e){return e&&e.rows&&e.rows.length?e.rows[0]:{}}))}),(function(){return{}})))},u.getDappStakes=function(e){var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.eos.get_table_rows({code:"dappservices",json:!0,limit:100,scope:e,table:"staking"})).then((function(t){return t&&t.rows&&t.rows.length?t.rows.map((function(t){return t.scope=e,t})):[]}))}),(function(){return[]})))},u.getAllOracleFeeds=function(e){void 0===e&&(e=void 0);try{var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.eos.get_table_rows({code:"oracles",scope:"oracles",table:"feeds",limit:-1,lower_bound:e})).then((function(e){var n=e.rows;return e.more?Promise.resolve(t.getAllOracleFeeds(e.next_key)).then((function(e){return n.concat(e)})):n}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},u.getAllOracleData=function(e){try{var t=!1,n=this,r=m((function(){return Promise.resolve(n.eos.get_table_rows({code:"oracles",scope:"oracles",table:"data",limit:-1,lower_bound:e,upper_bound:e})).then((function(n){var r=n.rows;if(r&&r.length&&r[0].feed_index===e)return t=!0,r[0]}))}),(function(e){console.log(e)}));return Promise.resolve(r&&r.then?r.then((function(e){return t?e:void 0})):t?r:void 0)}catch(e){return Promise.reject(e)}},u.getDapphodlStakes=function(e,t){var n=this;return void 0===t&&(t=""),Promise.resolve(m((function(){return Promise.resolve(n.eos.get_table_rows({code:"dappservices",json:!0,limit:1e3,scope:"dappairhodl1",table:"staking",lower_bound:t})).then((function(t){function r(){return o.filter((function(t){return t.account===e})).map((function(e){return e.scope="dappairhodl1",e}))}if(!t)return[];var o=t.rows,s=function(){if(t.more){var r=o,s=r.concat;return Promise.resolve(n.getDapphodlStakes(e,+o[o.length-1].id+1)).then((function(e){o=s.call(r,e)}))}}();return s&&s.then?s.then(r):r()}))}),(function(){return[]})))},u.getDappUnstakes=function(e){var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.eos.get_table_rows({code:"dappservices",json:!0,limit:100,scope:e,table:"refunds"})).then((function(t){return t&&t.rows&&t.rows.length?t.rows.map((function(t){return t.scope=e,t})):[]}))}),(function(){return[]})))},u.getDapphodlUnstakes=function(e){var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.eos.get_table_rows({code:"dappservices",json:!0,limit:1e3,scope:"dappairhodl1",table:"refunds"})).then((function(n){function r(){return o.filter((function(t){return t.account===e})).map((function(e){return e.scope="dappairhodl1",e}))}if(!n)return[];var o=n.rows,s=function(){if(n.more){var r=o,s=r.concat;return Promise.resolve(t.getDapphodlUnstakes(e)).then((function(e){o=s.call(r,e)}))}}();return s&&s.then?s.then(r):r()}))}),(function(){return[]})))},u.dnsAvailable=function(e){try{var t=this;return Promise.resolve(function(){if("eos"===n.constants.CHAIN)return m((function(){return Promise.resolve(t.eos.get_table_rows({json:!0,code:"eosdns.x",scope:e,table:"dns",limit:25})).then((function(e){var t=e.rows;return t&&t.length}))}),(function(){return!1}))}())}catch(e){return Promise.reject(e)}},u.getTokenSupply=function(e,t){try{var n=this;return Promise.resolve(m((function(){return Promise.resolve(n.eos.get_currency_stats(e,t)).then((function(e){var n=e[t],r=n.supply,o=n.max_supply;return{supply:r?+r.split(" ")[0]:0,max_supply:o?+o.split(" ")[0]:0}}))}),(function(e){return console.log(e),{supply:0,max_supply:0}})))}catch(e){return Promise.reject(e)}},u.generateTransactionSettings=function(e,n,r){void 0===e&&(e=3e3),void 0===n&&(n=12),void 0===r&&(r=0);try{var o=this;return Promise.resolve(o.getInfo()).then((function(i){function c(){return s({max_net_usage_words:0,max_cpu_usage_ms:0,delay_sec:r,context_free_actions:[],actions:[],transaction_extensions:[]},u)}var u={},a=function(){if(i)return Promise.resolve(o.getBlock(i.head_block_num-n)).then((function(n){u=t.Serialize.transactionHeader(n,e)}))}();return a&&a.then?a.then(c):c()}))}catch(e){return Promise.reject(e)}},u.getRamPriceInEos=function(){try{var e=!1,t=this,r=m((function(){return Promise.resolve(t.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"rammarket",table_key:"",limit:10})).then((function(t){var n=t.rows[0].base.balance,r=+n.substr(0,n.indexOf(" ")),o=t.rows[0].quote.balance,s=o.substr(0,o.indexOf(" ")),i=1024*Number((s/r).toFixed(8));return e=!0,i}))}),(function(e){console.log(e)}));return Promise.resolve(r&&r.then?r.then((function(t){return e?t:0})):e?r:0)}catch(e){return Promise.reject(e)}},u.getRexQueued=function(t){try{var r=!1,o=this,s=m((function(){return Promise.resolve(o.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"rexqueue",limit:1,lower_bound:e.encodeName(t,!1)})).then((function(e){var n=e.rows;if(n&&n.length&&n[0].owner===t)return r=!0,n[0]}))}),(function(e){console.log(e)}));return Promise.resolve(s&&s.then?s.then((function(e){return r?e:void 0})):r?s:void 0)}catch(e){return Promise.reject(e)}},u.getRexPool=function(){try{return Promise.resolve(this.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"rexpool"})).then((function(t){for(var n=t.rows[0],r=0,o=Object.keys(n);r<o.length;r++){var s=o[r];"string"==typeof n[s]&&(n[s]=Number(n[s].split(" ")[0]))}return n.lent_percent=e.multiply(e.divide(n.total_lent,n.total_lendable),100),n.rex_price=+e.divide(n.total_lendable,n.total_rex),n.resource_price=+e.divide(n.total_unlent,n.total_rent+1),n}))}catch(e){return Promise.reject(e)}},u.getRexBalance=function(t){try{return Promise.resolve(this.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"rexbal",lower_bound:e.encodeName(t,!1)})).then((function(e){var n=e.rows[0];return n.owner===t?n:void 0}))}catch(e){return Promise.reject(e)}},u.getRexCpuLoans=function(t){try{return Promise.resolve(this.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"cpuloan",table_key:"byowner",key_type:"i64",limit:100,lower_bound:e.encodeName(t,!1),index_position:3})).then((function(e){return e.rows.filter((function(e){return e.from===t}))}))}catch(e){return Promise.reject(e)}},u.getRexNetLoans=function(t){try{return Promise.resolve(this.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"netloan",table_key:"byowner",key_type:"i64",limit:100,lower_bound:e.encodeName(t,!1),index_position:3})).then((function(e){return e.rows.filter((function(e){return e.from===t}))}))}catch(e){return Promise.reject(e)}},u.getEosDepositedIntoRex=function(t){try{return Promise.resolve(this.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"rexfund",lower_bound:e.encodeName(t,!1)})).then((function(e){var n=e.rows[0];return n.owner===t?Number(n.balance.split(" ")[0]):0}))}catch(e){return Promise.reject(e)}},u.getEosTopStakes=function(e){return void 0===e&&(e=500),new o.JsonRpc(n.constants.CHAIN,{fetch:fetch}).get_topstake(e)},u.getEosTopRams=function(e){return void 0===e&&(e=500),new o.JsonRpc(n.constants.CHAIN,{fetch:fetch}).get_topram(e)},u.getTokenBalance=function(e,t,n){try{return Promise.resolve(this.eos.get_currency_balance(e,t,n).catch((function(e){return console.log(e)}))).then((function(e){return e&&e.length?e[0]:null}))}catch(e){return Promise.reject(e)}},u.getAccount=function(e){try{var r=this;return Promise.resolve(m((function(){return Promise.resolve(r.eos.get_account(e)).then((function(e){return e.permissions=e.permissions.map((function(e){return e.required_auth.keys=e.required_auth.keys.map((function(e){return-1!==e.key.indexOf(n.constants.KEY_PREFIX)&&(e.key=t.Numeric.convertLegacyPublicKey(e.key,n.constants.KEY_PREFIX)),e})),e})),e}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},u.getInfo=function(){return this.eos.get_info().catch((function(e){return console.log(e)}))},u.getInfoFromUrl=function(e){return v(e+"/v1/chain/get_info")},u.isHyperionAlive=function(e){try{return Promise.resolve(v(e+"/v2/state/alive")).then((function(e){return e&&"OK"===e.status}))}catch(e){return Promise.reject(e)}},u.getBlock=function(e){return this.eos.get_block(e)},u.getEosBalance=function(e){try{return Promise.resolve(this.eos.get_currency_balance(n.constants.EOSIO_TOKEN,e,n.constants.CORE_SYMBOL)).then((function(e){return e[0]}))}catch(e){return Promise.reject(e)}},u.getTable=function(e){return this.eos.get_table_rows(e).catch((function(e){return console.log(e)}))},u.getAbi=function(e){return this.eos.get_abi(e).catch((function(e){return console.log(e)}))},u.parsePackedMsigActions=function(t){try{var r=this,o=function(){return s=s.map((function(e){return{action_trace:{act:e}}}))},s=[],i=h(t,(function(t){function o(){function o(){s.push(t)}var i=function(){if(t.account===n.constants.EOSIO&&"setabi"===t.name)return Promise.resolve(r.eosApi.rawAbiToJson(e.hexToUint8Array(t.data.abi))).then((function(e){t.data.abi=e}))}();return i&&i.then?i.then(o):o()}var i=function(){if(t.account===n.constants.EOSIO_MSIG&&"propose"===t.name)return Promise.resolve(r.eosApi.deserializeActionsSync(t.data.trx.actions)).then((function(e){t.data.trx.actions=e}))}();return i&&i.then?i.then(o):o()}));return Promise.resolve(i&&i.then?i.then(o):o())}catch(e){return Promise.reject(e)}},u.parsePackedMsig=function(e){try{var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.eosApi.deserializeTransactionWithActions(e)).then((function(e){return Promise.resolve(t.parsePackedMsigActions(e.actions)).then((function(t){return e.actions=t,e}))}))}),(function(e){console.log("Error parsing packed msig"),console.log(e)})))}catch(e){return Promise.reject(e)}},u.getFullMsigProposal=function(t,r){try{var o=this;return Promise.resolve(m((function(){return Promise.resolve(o.eos.get_table_rows({json:!0,code:n.constants.EOSIO_MSIG,scope:e.encodeName(t,!1),table:n.constants.EOSIO_MSIG_PROPOSALS_TABLE,table_key:"",key_type:"name",lower_bound:r,index_position:1,limit:1})).then((function(e){return function(){if(e&&e.rows&&e.rows.length)return Promise.resolve(o.parsePackedMsig(e.rows[0].packed_transaction))}()}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},u.getMsigApprovals=function(t,r){try{var o=this;return Promise.resolve(m((function(){return Promise.resolve(o.eos.get_table_rows({json:!0,code:n.constants.EOSIO_MSIG,scope:e.encodeName(t,!1),table:r,limit:-1})).then((function(e){return e.rows}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},u.getAccountsMsigProposals=function(e){try{var t=this;return Promise.resolve(m((function(){var r=[t.getMsigApprovals(e,n.constants.EOSIO_MSIG_APPROVALS_TABLE)];return"approvals2"===n.constants.EOSIO_MSIG_APPROVALS_TABLE&&r.push(t.getMsigApprovals(e,"approvals")),Promise.resolve(Promise.all(r)).then((function(e){return e[0].concat(e[1])}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},u.getWaxGenesisRewards=function(t){try{var r=this;return Promise.resolve(m((function(){return Promise.resolve(r.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:e.encodeName(t,!1),table:"genesis",limit:1})).then((function(e){var t=e.rows;return t.length?t[0]:void 0}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},u.getVoter=function(t){try{var r=this;return Promise.resolve(m((function(){return Promise.resolve(r.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:n.constants.EOSIO,lower_bound:e.encodeName(t,!1),upper_bound:e.encodeName(t,!1),table:"voters",limit:1})).then((function(e){var t=e.rows;return t.length?t[0]:void 0}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},u.getFIOVoter=function(t){try{var r=this;return Promise.resolve(m((function(){return Promise.resolve(r.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:n.constants.EOSIO,lower_bound:e.encodeName(t,!1),upper_bound:e.encodeName(t,!1),table:"voters",key_type:"i64",index_position:3,limit:1})).then((function(e){var t=e.rows;return t.length?t[0]:void 0}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},u.getCurrentNameBids=function(e,t){return void 0===e&&(e=""),void 0===t&&(t=""),this.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"namebids",key_type:"name",lower_bound:e,upper_bound:t,index_position:2,limit:500})},u.getEosKnightsTable=function(e,t){return this.eos.get_table_rows({json:!0,code:"eosknightsio",scope:"eosknightsio",table:e,table_key:"",key_type:"name",lower_bound:t,index_position:1,limit:1}).then((function(e){var n=e.rows[0];return n.owner===t?n.rows:[]}))},u.getEosBetsTable=function(e){return this.eos.get_table_rows({json:!0,code:"eosbetdice11",scope:"eosbetdice11",table:e,table_key:"",limit:200}).then((function(e){return e.rows.length>0?e.rows:[]}))},u.getBetDiceHouseEdge=function(){return this.eos.get_table_rows({json:!0,code:"betdicegroup",scope:"betdicegroup",table:"gamestats",limit:1e3}).then((function(e){return e.rows.length>0?e.rows:[]}))},u.getBetDiceStakeInfo=function(){return this.eos.get_table_rows({json:!0,code:"betdicestake",scope:"betdicestake",table:"stats",limit:1}).then((function(e){return e.rows.length>0?e.rows[0]:{staking:0,unstaking:0}}))},u.getBetDicePrice=function(){try{return Promise.resolve(v("https://api.newdex.io/v1/ticker?symbol=betdicetoken-dice-eos")).then((function(e){return e&&e.data}))}catch(e){return Promise.reject(e)}},u.getEosPlayTable=function(e){return this.eos.get_table_rows({json:!0,code:"eosplaybrand",scope:"eosplaybrand",table:e,table_key:"",limit:1}).then((function(e){return e.rows}))},u.getFIOAddressByName=function(t){try{var n=this;return Promise.resolve(m((function(){var r=n.eos,o=r.get_table_rows;return Promise.resolve(e.string_to_uint128_hash(t)).then((function(e){return Promise.resolve(o.call(r,{code:"fio.address",scope:"fio.address",table:"fionames",lower_bound:"0x"+e,limit:1,key_type:"i128",index_position:5})).then((function(e){var n=e.rows;return n&&n.length&&n[0].name===t?n[0]:void 0}))}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},u.getFIODomainByName=function(t){try{var n=this;return Promise.resolve(m((function(){var r=n.eos,o=r.get_table_rows;return Promise.resolve(e.string_to_uint128_hash(t)).then((function(e){return Promise.resolve(o.call(r,{code:"fio.address",scope:"fio.address",table:"domains",lower_bound:"0x"+e,limit:1,key_type:"i128",index_position:4})).then((function(e){var n=e.rows;return n&&n.length&&n[0].name===t?n[0]:void 0}))}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},u.getDomains=function(e,t){void 0===e&&(e=-1);try{var n=this;return Promise.resolve(m((function(){return Promise.resolve(n.eos.get_table_rows({code:"fio.address",scope:"fio.address",table:"domains",reverse:!0,upper_bound:t,limit:e})).then((function(e){var t=e.rows;return t&&t.length?t:[]}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},u.getAddresses=function(e,t){void 0===e&&(e=-1);try{var n=this;return Promise.resolve(m((function(){return Promise.resolve(n.eos.get_table_rows({code:"fio.address",scope:"fio.address",table:"fionames",reverse:!0,upper_bound:t,limit:e})).then((function(e){var t=e.rows;return t&&t.length?t:[]}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},u.getRentbwState=function(){try{return Promise.resolve(this.eos.get_table_rows({code:n.constants.EOSIO,scope:0,table:"rent.state",limit:1})).then((function(e){return e.rows[0]}))}catch(e){return Promise.reject(e)}},u.getFIOProducers=function(e){try{var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"producers",reverse:!0,limit:e})).then((function(e){var t=e.rows;return t&&t.length?t:[]}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},u.getFIOLockedTokens=function(t){try{var r=this;return Promise.resolve(m((function(){return Promise.resolve(r.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"lockedtokens",lower_bound:e.encodeName(t,!1),limit:1})).then((function(e){var r=e.rows;return r&&r.length&&r[0].owner===t?r[0].remaining_locked_amount/Math.pow(10,n.constants.CORE_PRECISION):0}))}),(function(e){return console.log(e),0})))}catch(e){return Promise.reject(e)}},u.getFIOLocked=function(e){return this.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"lockedtokens",lower_bound:e,limit:-1})},u.getAllFIOLocked=function(){try{var t=this,n=!0,r=[],o=null,s="",i=d((function(){return Promise.resolve(t.getFIOLocked(s)).then((function(t){n=(o=t).more,r=r.concat(o.rows),n&&(s=e.toBigNumber(e.encodeName(r[r.length-1].owner,!1)).plus(1).toString())}))}),(function(){return!!n}));return Promise.resolve(i&&i.then?i.then((function(){return r})):r)}catch(e){return Promise.reject(e)}},u.getFIOSupplyBreakdown=function(){try{var e=this;return Promise.resolve(e.eos.get_table_rows({code:"fio.token",scope:"FIO",table:"stat"})).then((function(t){var r=+t.rows[0].supply.split(" ")[0];return Promise.resolve(e.eos.get_table_rows({code:"fio.treasury",scope:"fio.treasury",table:"bprewards"})).then((function(t){var o=t.rows[0].rewards/Math.pow(10,n.constants.CORE_PRECISION);return Promise.resolve(e.eos.get_table_rows({code:"fio.treasury",scope:"fio.treasury",table:"bpbucketpool"})).then((function(e){var t=e.rows[0].rewards/Math.pow(10,n.constants.CORE_PRECISION),s=o+t;return Promise.resolve(fetch("https://fioprotocol.io/circulating").then((function(e){return e.json()}))).then((function(e){return{supply:r,totalLocked:r-e,bpRewards:o,bpBucket:t,totalBp:s,circulating:e}}))}))}))}))}catch(e){return Promise.reject(e)}},u.getFIOFees=function(){try{return Promise.resolve(this.eos.get_table_rows({code:"fio.fee",scope:"fio.fee",table:"fiofees",limit:-1}).then((function(e){return e.rows})).catch((function(e){return[]})))}catch(e){return Promise.reject(e)}},u.addFIOFeeToActions=function(e,t){try{var r=this,o={"eosio::deleteauth":"auth_delete","eosio::linkauth":"auth_link","eosio::regproducer":"register_producer","eosio::regproxy":"register_proxy","eosio::unregprod":"unregister_producer","eosio::unregproxy":"unregister_proxy","eosio::updateauth":"auth_update","eosio::voteproducer":"vote_producer","eosio::voteproxy":"proxy_vote","fio.token::trnsfiopubky":"transfer_tokens_pub_key","fio.address::addaddress":"add_pub_address","fio.address::regaddress":"register_fio_address","fio.address::regdomain":"register_fio_domain","fio.address::renewaddress":"renew_fio_address","fio.address::renewdomain":"renew_fio_domain","fio.address::setdomainpub":"set_fio_domain_public","eosio.msig::approve":"msig_approve","eosio.msig::cancel":"msig_cancel","eosio.msig::exec":"msig_exec","eosio.msig::invalidate":"msig_invalidate","eosio.msig::propose":"msig_propose","eosio.msig::unapprove":"msig_approve","fio.reqobt::newfundsreq":"new_funds_request","fio.reqobt::rejectfndreq":"reject_funds_request","fio.reqobt::cancelfndreq":"cancelfndreq","fio.reqobt::recordobt":"record_obt_data","fio.reqobt::newpubaddreq":"new_pub_address_request","fio.reqobt::relpubadd":"release_pub_address","fio.reqobt::rejectaddreq":"reject_pub_address_request","fio.reqobt::canceladdreq":"cancel_pub_address_request","fio.lock::trnsloctoks":"transfer_locked_tokens","fio.lock::locktokens":"lock_tokens","fio.address::remaddress":"remove_pub_address","fio.address::remalladdr":"remove_all_pub_addresses","fio.address::burnaddress":"burn_fio_address","fio.address::xferdomain":"transfer_fio_domain","fio.address::xferaddress":"transfer_fio_address"};return Promise.resolve(r.getFIOFees()).then((function(s){var i=[],c=h(e,(function(e){return Promise.resolve(r.eosApi.getCachedAbi(e.account)).then((function(c){var u=c.abi,a=u.structs;function l(){i.push(e)}var f=u.actions.find((function(t){return t.name===e.name})),h=function(){if(f){var i=a.find((function(e){return e.name===f.type})),c=function(){if(i){if(i.fields.find((function(e){return"max_fee"===e.name}))&&void 0===e.data.max_fee){var c=o[e.account+"::"+e.name];if(c){var u=s.find((function(e){return e.end_point===c}));e.data.max_fee=u?u.suf_amount:0}}i.fields.find((function(e){return"actor"===e.name}))&&void 0===e.data.actor&&(e.data.actor=t),i.fields.find((function(e){return"tpid"===e.name}))&&void 0===e.data.tpid&&(e.data.tpid=n.constants.FIO_FEES_ACCOUNT);var a=i.fields.find((function(e){return"fio_address"===e.name})),l=function(){if(a&&void 0===e.data.fio_address)return Promise.resolve(r.getFIOAddresses(t)).then((function(t){t.length&&(e.data.fio_address=t[0].name)}))}();if(l&&l.then)return l.then((function(){}))}}();if(c&&c.then)return c.then((function(){}))}}();return h&&h.then?h.then(l):l()}))}));return c&&c.then?c.then((function(){return i})):i}))}catch(e){return Promise.reject(e)}},u.getFIOAddresses=function(t){return this.eos.get_table_rows({code:"fio.address",scope:"fio.address",table:"fionames",key_type:"i64",limit:-1,lower_bound:e.encodeName(t,!1),upper_bound:e.toBigNumber(e.encodeName(t,!1)).plus(1).toString(),index_position:4}).then((function(e){return e.rows.length>0?e.rows.filter((function(e){return e.owner_account===t})):[]})).catch((function(e){return[]}))},u.getFIODomains=function(t){return this.eos.get_table_rows({code:"fio.address",scope:"fio.address",table:"domains",key_type:"i64",limit:-1,lower_bound:e.encodeName(t,!1),upper_bound:e.toBigNumber(e.encodeName(t,!1)).plus(1).toString(),index_position:2}).then((function(e){return e.rows.length>0?e.rows.filter((function(e){return e.account===t})):[]})).catch((function(e){return[]}))},u.getFIOAddressesAndDomains=function(e){return _(n.constants.DEFAULT_ENDPOINTS[0]+"/v1/get_fio_names",{fio_public_key:e})},u.getControlledAccounts=function(e){return n.constants.HISTORY_TYPES.includes("native")?this.eosActions.history_get_controlled_accounts(e):n.constants.HISTORY_TYPES.includes("hyperion")?new t.JsonRpc([n.constants.HYPERION_URL],{fetch:fetch}).history_get_controlled_accounts(e):[]},u.getPermissionLinks=function(e){try{var t=!1,r=this,o=function(o){var s=!1;if(t)return o;function i(t){var o=!1;if(s)return t;function i(e){return o?e:(console.log("Permission links not available on chain"),[])}var c=function(){if(n.constants.HISTORY_TYPES.includes("hyperion"))return m((function(){return Promise.resolve(r.hyperion.get_links(e)).then((function(e){return o=!0,e.links.map((function(e){return{action:e.action,contract:e.code,permission_name:e.permission}}))}))}),(function(e){console.log(e)}))}();return c&&c.then?c.then(i):i(c)}var c=function(){if(n.constants.HISTORY_TYPES.includes("dfuse"))return m((function(){return Promise.resolve(v(n.constants.API_URL+"/dfuse?type=state_permission_links&account="+e)).then((function(e){var t=e.linked_permissions;if(t)return s=!0,t}))}),(function(e){console.log(e)}))}();return c&&c.then?c.then(i):i(c)},s=function(){if(n.constants.LIGHT_API)return m((function(){return Promise.resolve(v(n.constants.API_URL+"/account/"+e+"?type=getAccountLightData")).then((function(e){if(e)return t=!0,e.linkauth.map((function(e){return{action:e.type,contract:e.code,permission_name:e.requirement}}))}))}),(function(e){console.log(e)}))}();return Promise.resolve(s&&s.then?s.then(o):o(s))}catch(e){return Promise.reject(e)}},u.dfuseGetKeyAccounts=function(e,t){try{return void 0===t&&(t=n.constants.API_URL),Promise.resolve(m((function(){return Promise.resolve(v(t+"/dfuse?type=state_key_accounts&publicKey="+e)).then((function(e){var t=e.account_names;return t&&t.length?t:[]}))}),(function(t){return console.log(t),console.log("No dfuse accounts found associated with key:",e),[]})))}catch(e){return Promise.reject(e)}},u.nativeGetKeyAccounts=function(r,o){try{void 0===o&&(o=n.constants.ACTIONS_ENDPOINTS);var s=new t.JsonRpc(o,{fetch:fetch});return Promise.resolve(m((function(){return Promise.resolve(s.history_get_key_accounts(r)).then((function(t){var o=t.account_names,s=o&&o.length?o:[];if(["fio","fio-test"].includes(n.constants.CHAIN)){var i=e.fioKeyToActor(r);-1===s.indexOf(i)&&s.push(i)}return s}))}),(function(e){throw console.log(e),e})))}catch(e){return Promise.reject(e)}},u.hyperionGetKeyAccounts=function(e,o){try{void 0===o&&(o=n.constants.HYPERION_URL);var s=new r.JsonRpc(o,{fetch:fetch}),i=t.Key.PublicKey.fromString(e).toLegacyString();return Promise.resolve(s.get_key_accounts(i)).then((function(e){var t=e.account_names;if(t&&t.length)return t;throw new Error("No keys found")}))}catch(e){return Promise.reject(e)}},u.hyperionGetTokensForAccount=function(e){try{return Promise.resolve(this.hyperion.get_tokens(e)).then((function(e){return e.tokens.map((function(e){return{currency:e.symbol,trx_id:"",deleted:!1,amount:e.amount,contract:e.contract,decimals:e.precision,metadata:{}}}))}))}catch(e){return Promise.reject(e)}},u.hyperionGetMsig=function(e){try{var t=this;return t.hyperion?Promise.resolve(t.hyperion.get_proposals(e)).then((function(r){if(r&&r.proposals&&r.proposals.length){var o,s,i=r.proposals[0];return Promise.resolve(Promise.all([t.hyperion.get_actions(n.constants.EOSIO_MSIG,{block_num:i.block_num,limit:1}),t.hyperion.get_deltas(n.constants.EOSIO_MSIG,e.proposer,"proposal",void 0,{block_num:i.block_num})])).then((function(n){var r=n[0],c=n[1];function u(){return{approvals:i,transaction:s,executionTransaction:o}}if(r&&r.actions&&r.actions.length){var a=r.actions.find((function(t){return t.act.data.proposal_name===e.proposal}));a&&(o={payer:a.act.data.executer||a.act.data.canceler,trx_id:a.trx_id,published_at:a.timestamp,cancelled:"cancel"===a.act.name})}var l=function(){if(c&&c.deltas&&c.deltas.length){var e=c.deltas[0].data.transaction;return Promise.resolve(t.parsePackedMsigActions(e.actions)).then((function(t){e.actions=t,s=e}))}}();return l&&l.then?l.then(u):u()}))}})):Promise.resolve(void 0)}catch(e){return Promise.reject(e)}},u.lightGetKeyAccounts=function(e,t){try{void 0===t&&(t=n.constants.LIGHT_API);var r=new o.JsonRpc("",{fetch:fetch,endpoint:t});return Promise.resolve(r.get_key_accounts(e))}catch(e){return Promise.reject(e)}},u.getKeyAccountsByType=function(e,t,r){void 0===r&&(r=n.constants);try{switch(t){case"dfuse":return Promise.resolve(this.dfuseGetKeyAccounts(e,r.API_URL));case"native":return Promise.resolve(this.nativeGetKeyAccounts(e,r.ACTIONS_ENDPOINTS));case"hyperion":return Promise.resolve(this.hyperionGetKeyAccounts(e,r.HYPERION_URL));default:return Promise.resolve([])}}catch(e){return Promise.reject(e)}},u.getKeyAccounts=function(e){try{var t=!1,r=this,o=function(e){return t?e:[]},s=h(n.constants.HISTORY_TYPES,(function(o){return m((function(){return Promise.resolve(r.getKeyAccountsByType(e,o,n.constants)).then((function(e){return t=!0,e}))}),(function(e){console.log(e)}))}),(function(){return t}));return Promise.resolve(s&&s.then?s.then(o):o(s))}catch(e){return Promise.reject(e)}},u.getKeyAccountsForAllChains=function(e){try{var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.lightGetKeyAccounts(e,n.constants.LIGHT_API)).then((function(e){var t=e.reduce((function(e,t){return s({},e,t)}),{});return Object.entries(t).reduce((function(e,t){var n=t[0],r=Object.keys(t[1].accounts);return r.length&&e.push({chain:n,accounts:r}),e}),[])}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},u.getRequiredAccounts=function(e,t,n,r,o){void 0===n&&(n=[]),void 0===r&&(r=1),void 0===o&&(o=2);try{var s=this;return Promise.resolve(s.getAccount(e)).then((function(i){var c=h(i.permissions,(function(i){return function(){if(i.perm_name===t){var c=i.required_auth.accounts;return c.length||n.push({actor:e,permission:t}),h(c,(function(e){var t=function(){if(r<o)return Promise.resolve(s.getRequiredAccounts(e.permission.actor,e.permission.permission,n,++r,o)).then((function(){}));n.push({actor:e.permission.actor,permission:e.permission.permission})}();if(t&&t.then)return t.then((function(){}))}))}}()}));return c&&c.then?c.then((function(){return n})):n}))}catch(e){return Promise.reject(e)}},u.getUsersFromKeys=function(e){try{var t=this,n=[],r=e.map((function(e){try{return Promise.resolve(t.getKeyAccounts(e)).then((function(r){var o=r.map((function(r){try{return Promise.resolve(t.getAccount(r)).then((function(t){for(var o,s=c(t.permissions);!(o=s()).done;){var i=o.value;i.required_auth.keys.find((function(t){return t.key===e}))&&n.push({actor:r,permission:i.perm_name,publicKey:e})}}))}catch(e){return Promise.reject(e)}}));return Promise.resolve(Promise.all(o)).then((function(){}))}))}catch(e){return Promise.reject(e)}}));return Promise.resolve(Promise.all(r)).then((function(){return n}))}catch(e){return Promise.reject(e)}},u.getActionsFromNative=function(t,n,r,o){void 0===o&&(o="native");try{return console.log("Fetching actions from:",o),console.log("Fetch Params:","actionSkip",n,"actionsPerPage",r),Promise.resolve(this.eosActions.history_get_actions(t,n,r)).then((function(t){if(!t)throw new Error("Could not retrieve actions");return"native"===o?e.nativeTransformGetActions(t):[]}))}catch(e){return Promise.reject(e)}},u.getRexReturnRate=function(e){void 0===e&&(e="mpr");try{var t=g[n.constants.CHAIN];return t?Promise.resolve(_("https://www.api.bloks.io/graphql/v1alpha1/graphql",{query:"query {\n "+t+"_"+e+" {\n "+e+"\n }\n }",variables:null})).then((function(n){var r=n.data;return r?Math.abs(r[t+"_"+e][0][e]):0})):Promise.resolve(0)}catch(e){return Promise.reject(e)}},u.getRexPriceChart=function(){try{var t=g[n.constants.CHAIN];if(t){var r=e.formatDate(e.utcTime()),o=e.formatDate(e.utcTime(e.startDate(e.time(),7)));return Promise.resolve(_("https://www.api.bloks.io/graphql/v1alpha1/graphql",{query:"query {\n "+t+'_pricechart(args: {\n from_time: "'+o+'",\n to_time: "'+r+'"\n }) {\n t\n o\n h\n l\n c\n }\n }',variables:null})).then((function(e){var n=e.data;return n?n[t+"_pricechart"]:[]}))}return Promise.resolve({actions:[]})}catch(e){return Promise.reject(e)}},u.getHistoryTransaction=function(r,o){void 0===o&&(o=0);try{var s=new t.JsonRpc(n.constants.TRANSACTIONS_ENDPOINTS,{fetch:fetch});return Promise.resolve(s.history_get_transaction(r,o)).then((function(t){if(!t)throw new Error("TX not found");return e.historyTransformTransaction(t)}))}catch(e){return Promise.reject(e)}},u.getDeferredTransaction=function(t){try{return Promise.resolve(this.eos.get_scheduled_transactions(!0,t,1)).then((function(n){var r=n.transactions;return r.length>0&&r[0].trx_id.substring(0,6)===t.substring(0,6)?e.historyTransformDeferredTransaction(r[0]):{}}))}catch(e){return Promise.reject(e)}},u.accountNameSearch=function(e,t){try{var r=this;return e&&/(^[a-zA-Z12345.]+$)/.test(e)?0===e.indexOf(".")?Promise.resolve([]):Promise.resolve(m((function(){return e=e.trim().toLowerCase(),Promise.resolve(r.eos.get_table_by_scope({json:!0,code:n.constants.EOSIO,limit:t,lower_bound:e,table:"userres",upper_bound:""+e+(e.length<12?"z".repeat(12-e.length):"")})).then((function(e){return e.rows.map((function(e){return e.scope}))}))}),(function(e){return console.log(e),[]}))):Promise.resolve([])}catch(e){return Promise.reject(e)}},u.getChainTable=function(){return this.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"global",table_key:"",limit:1}).then((function(e){return e.rows[0]}))},u.delegatedBandwith=function(t,r){return this.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:e.encodeName(t,!1),table:"delband",table_key:"",limit:-1,lower_bound:r,key_type:"i64",index_position:1})},u.getXprTotalStakedAndApr=function(){try{var e=this;return Promise.resolve(m((function(){return Promise.resolve(Promise.all([e.getTokenSupply(n.constants.EOSIO_TOKEN,n.constants.CORE_SYMBOL),e.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"globalsd",limit:1}).then((function(e){return e.rows[0]})),e.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"global4",limit:1}).then((function(e){return e.rows[0]}))])).then((function(e){var t=e[0].supply,r=e[2],o=r.continuous_rate,s=r.inflation_pay_factor,i=r.votepay_factor,c=+e[1].totalrstaked/Math.pow(10,n.constants.CORE_PRECISION);return{totalStaked:c,apr:t*(+s/(+s+ +i)*+o)/c*100}}))}),(function(e){return console.log(e),0})))}catch(e){return Promise.reject(e)}},u.getXprVoter=function(t){try{var r=this;return Promise.resolve(m((function(){return Promise.resolve(r.eos.get_table_rows({code:n.constants.EOSIO,scope:n.constants.EOSIO,lower_bound:e.encodeName(t,!1),table:"votersxpr",limit:1})).then((function(e){var n=e.rows;return n&&n.length&&n[0].owner===t?n[0]:void 0}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},u.getXprAccountStakes=function(t){try{var r=this,o=[],s=m((function(){return Promise.resolve(r.eos.get_table_rows({code:n.constants.EOSIO,scope:e.encodeName(t,!1),table:"delxpr",limit:-1})).then((function(e){var t=e.rows;t&&t.length&&(o=t)}))}),(function(e){console.log(e)}));return Promise.resolve(s&&s.then?s.then((function(){return o})):o)}catch(e){return Promise.reject(e)}},u.getXprAccountRefund=function(t){try{var r,o=this,s=m((function(){return Promise.resolve(o.eos.get_table_rows({code:n.constants.EOSIO,scope:e.encodeName(t,!1),table:"refundsxpr",limit:-1})).then((function(e){var t=e.rows;t&&t.length&&((r=t[0]).quantity=+r.quantity.split(" ")[0])}))}),(function(e){console.log(e)}));return Promise.resolve(s&&s.then?s.then((function(){return r})):r)}catch(e){return Promise.reject(e)}},u.getXprLongstakePlans=function(){try{var e=this;return Promise.resolve(m((function(){return Promise.resolve(e.eos.get_table_rows({code:"longstaking",scope:"longstaking",table:"plans",limit:-1})).then((function(e){return e.rows.sort((function(e,t){return e.plan_days-t.plan_days}))}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},u.getXprLongstakeStakes=function(e){try{var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.eos.get_table_rows({code:"longstaking",scope:"longstaking",table:"stakes",lower_bound:e,upper_bound:e,key_type:"name",index_position:2,limit:-1})).then((function(e){return e.rows}))}),(function(e){return console.log(e),[]})))}catch(e){return Promise.reject(e)}},u.getXprOracleData=function(e){try{var t=this;return Promise.resolve(m((function(){return Promise.resolve(t.eos.get_table_rows({code:"oracles",scope:"oracles",table:"data",limit:1,lower_bound:e,upper_bound:e})).then((function(e){var t=e.rows;return t&&t.length?t[0]:void 0}))}),(function(e){console.log(e)})))}catch(e){return Promise.reject(e)}},u.getAccountDelegatedBandwidth=function(t){try{var n=this,r=!0,o=[],s=null,i="",c=m((function(){var c=d((function(){return Promise.resolve(n.delegatedBandwith(t,i)).then((function(t){r=(s=t).more,o=o.concat(s.rows),r&&(i=e.toBigNumber(e.encodeName(o[o.length-1].to,!1)).plus(1).toString())}))}),(function(){return!!r}));if(c&&c.then)return c.then((function(){}))}),(function(e){console.log(e)}));return Promise.resolve(c&&c.then?c.then((function(){return o})):o)}catch(e){return Promise.reject(e)}},u.getAccountResources=function(t){return this.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:e.encodeName(t,!1),table:"userres",table_key:"",limit:1}).then((function(e){return e.rows[0]}))},u.getBpJson=function(){return this.eos.get_table_rows({json:!0,code:"producerjson",scope:"producerjson",table:"producerjson",table_key:"",limit:500}).then((function(e){return e.rows}))},u.getPixeos=function(e){try{return Promise.resolve("eos"===n.constants.CHAIN&&m((function(){return Promise.resolve(v("https://avatar.pixeos.art/avatar/"+e,void 0,"arraybuffer")).then((function(e){if(e){var t=new Uint8Array(e).reduce((function(e,t){return e+String.fromCharCode(t)}),"");return"data:image/png;base64,"+btoa(t)}return e}))}),(function(){return!1})))}catch(e){return Promise.reject(e)}},u.getGravatar=function(e){try{return"eos"===n.constants.CHAIN?Promise.resolve(this.eos.get_table_rows({json:!0,code:n.constants.ACCOUNT_INFO,scope:n.constants.ACCOUNT_INFO,table:"accounts",table_key:"",key_type:"name",lower_bound:e,index_position:1,limit:1})).then((function(t){return t.rows.length>0&&t.rows[0].account_name===e?t.rows[0]:void 0})):Promise.resolve(void 0)}catch(e){return Promise.reject(e)}},u.getProtonAvatar=function(e){try{var t=this;return Promise.resolve(function(){if(-1!==n.constants.CHAIN.indexOf("proton"))return Promise.resolve(t.eos.get_table_rows({json:!0,code:"eosio.proton",scope:"eosio.proton",table:"usersinfo",table_key:"",key_type:"name",lower_bound:e,index_position:1,limit:1})).then((function(t){return t.rows.length>0&&t.rows[0].acc===e?t.rows[0]:void 0}))}())}catch(e){return Promise.reject(e)}},u.getProxyData=function(e){try{return""!==n.constants.ALOHA_PROXY_URL?Promise.resolve(v(n.constants.ALOHA_PROXY_URL+"/"+e+"?output=json")).then((function(e){return e.proxy})):Promise.resolve(void 0)}catch(e){return Promise.reject(e)}},u.getBlacklistTable=function(e){return this.eos.get_table_rows({json:!0,code:"theblacklist",scope:"theblacklist",table:e,table_key:"",limit:500}).then((function(e){return e.rows}))},u.getProxies=function(){try{return""!==n.constants.ALOHA_PROXY_URL?Promise.resolve(v(n.constants.ALOHA_PROXY_URL+"?output=json")).then((function(e){return e.proxies})):Promise.resolve(this.hyperion.get_voters({proxy:!0,limit:1e3})).then((function(e){return e.voters.map((function(e,t){return s({},e,{weight:e.weight/Math.pow(10,n.constants.CORE_PRECISION),rank:t+1})}))}))}catch(e){return Promise.reject(e)}},u.getVoters=function(e){try{var t=this;return t.hyperion?Promise.resolve(t.hyperion.get_voters({producer:e,limit:100})).then((function(e){var n=e.voters,r=t.calculateVoteWeight();return n.map((function(e){return s({},e,{vote:t.weightedVoteToNumber(e.weight,r)})}))})):Promise.resolve(void 0)}catch(e){return Promise.reject(e)}},u.calculateVoteWeight=function(){var e="wax"===n.constants.CHAIN?13:52,t=Date.now()/1e3-946684800,r=Math.floor(t/604800)/e;return Math.pow(2,r)},u.weightedVoteToNumber=function(e,t){return void 0===t&&(t=this.calculateVoteWeight()),+e/t/Math.pow(10,n.constants.CORE_PRECISION)},u.getAirdrops=function(){try{return Promise.resolve(v("https://raw.githubusercontent.com/eoscafe/eos-airdrops/master/tokens.json"))}catch(e){return Promise.reject(e)}},u.getDapps=function(){try{return Promise.resolve(v("https://raw.githubusercontent.com/eoscafe/eos-dapps/master/dapps.json"))}catch(e){return Promise.reject(e)}},u.getAllAirgrabs=function(){try{return Promise.resolve(v("https://raw.githubusercontent.com/eoscafe/eos-airgrabs/master/airgrabs.json"))}catch(e){return Promise.reject(e)}},u.getGameStatsAvailable=function(e){try{return Promise.resolve(m((function(){return Promise.resolve(v("https://eosgames.guru/api/external/user/"+e)).then((function(e){return e&&"true"===e.exist}))}),(function(e){return console.log(e),!1})))}catch(e){return Promise.reject(e)}},u.getActions=function(e,t,r){var o=void 0===r?{}:r,s=o.actionsPerPage,i=void 0===s?100:s,c=o.actionSkip,u=void 0===c?0:c,a=o.sortDirection,l=void 0===a?"desc":a,f=o.dfuseCursorStack,h=void 0===f?[]:f,d=o.tokenFilter,m=o.actionFilters,p=o.contractFilter,v=o.actionFilter,_=o.start,g=void 0===_?n.constants.CHAIN_START_DATE:_,P=o.end;try{var b,y=this;!t&&n.constants.HISTORY_TYPES.length&&(t=n.constants.HISTORY_TYPES[0]),g&&P?(g=g||n.constants.CHAIN_START_DATE?new Date(g||n.constants.CHAIN_START_DATE).toISOString():void 0,P=new Date(P||new Date).toISOString()):(g=void 0,P=void 0);var w=function(){if("dfuse"===t)return Promise.resolve(y.getActionsFromDfuse(e,{limit:i,cursor:h.length>0?h[h.length-1]:"",direction:l,query:"",after:g,before:P,tokenFilter:d,actionFilters:m,contractFilter:p,actionFilter:v})).then((function(e){b=e}));var n="hyperion"===t?Promise.resolve(y.getActionsFromHyperion(e,{skip:Math.abs(u)-1,limit:i,sort:l,after:g,before:P,tokenFilter:d,actionFilters:m,contractFilter:p,actionFilter:v})).then((function(e){b=e})):Promise.resolve(y.getActionsFromNative(e,u,-i,"native")).then((function(e){b=e}));return n&&n.then?n.then((function(){})):void 0}();return Promise.resolve(w&&w.then?w.then((function(){return b})):b)}catch(e){return Promise.reject(e)}},u.getActionsFromDfuse=function(t,r){var o=void 0===r?{}:r,s=o.before,i=o.after,c=o.limit,u=void 0===c?25:c,a=o.cursor,l=o.query,f=o.direction,h=void 0===f?"desc":f,d=o.tokenFilter,m=o.actionFilters,p=o.contractFilter,_=o.actionFilter,g=o.type,P=void 0===g?"search_transactions_graphql":g;try{var b=l||"(auth:"+t+" OR\n receiver:"+t+" OR\n data.to:"+t+" OR\n data.from:"+t+" OR\n data.receiver:"+t+")";if(d&&(b=b+" account:"+d.split(" ")[1]),m){var y=Object.entries(m).reduce((function(e,t){var n=t[1];return n.isActive?e.concat(n):e}),[]);if(y.length){var w=y.map((function(e){return e.dfuseQuery(t)})).join(" OR ");-1!==w.search("OR")&&(w="("+w+")"),b=b+" "+w}p&&(b=b+" account:"+p),_&&(b=b+" action:"+_)}return Promise.resolve(v(e.urlBuilder(n.constants.API_URL,"dfuse",{type:P,q:b,options:Object.assign({},{sort:h,cursor:a,limit:u,withReversible:!0,before:s,after:i,code:1})}))).then((function(r){if(!r)throw new Error("Could not retrieve actions");return e.dfuseTransformGetActions(r,t,n.constants)}))}catch(e){return Promise.reject(e)}},u.getActionsFromHyperion=function(t,r){var o=void 0===r?{}:r,s=o.skip,i=o.limit,u=o.sort,a=o.after,l=o.before,f=o.filter,h=o.tokenFilter,d=o.actionFilters,m=o.contractFilter,p=o.actionFilter;try{var _,g=function(){if(!_)throw new Error("Could not retrieve actions");return e.hyperionTransformGetActions(_)},P={filter:f,skip:s,limit:i,sort:u,after:a,before:l};if(console.log("Fetching actions from Hyperion"),console.table(P),h){var b=h.split(" ")[1];P.filter=P.filter?P.filter.replace("*",b):b+":*"}if(d){var y=Object.entries(d).reduce((function(e,t){var n=t[1];return n.isActive?e.concat(n):e}),[]);if(y.length){for(var w,O=c(y);!(w=O()).done;)w.value.hyperionQuery(t,P);console.log(P)}}if(m&&(P.filter=P.filter?P.filter.split(",").map((function(e){return m+":"+e.split(":")[1]})).join(","):m+":*"),p)if(P.filter){var I=Array.from(new Set(P.filter.split(",").map((function(e){return e.split(":")[0]}))));P.filter=I.map((function(e){return e+":"+p})).join(",")}else P.filter="*:"+p;var k=n.constants.HYPERION_URL?Promise.resolve(this.hyperion.get_actions(t,Object.assign({},P))).then((function(e){_=e})):Promise.resolve(v(e.urlBuilder(n.constants.API_URL,"hyperion",{type:"get_actions",account:t,options:Object.assign({},P)}))).then((function(e){_=e}));return Promise.resolve(k&&k.then?k.then(g):g())}catch(e){return Promise.reject(e)}},u.getAllMsigs=function(){try{var t=this;if(n.constants.HISTORY_TYPES.includes("dfuse"))return Promise.resolve(v(e.urlBuilder(n.constants.API_URL,"dfuse",{type:"state_scope_pipeline",account:n.constants.EOSIO_MSIG,table:n.constants.EOSIO_MSIG_PROPOSALS_TABLE,options:{}}))).then((function(e){return e.tables.map((function(e){return e.rows=e.rows.sort((function(e,t){return t.block-e.block})),e.highestBlock=e.rows[0].block,e})).sort((function(e,t){return t.highestBlock-e.highestBlock}))}));var r=function(){return o.map((function(e){return{scope:e.scope,rows:Array(e.count).fill({key:""})}}))},o=[],s="",i=d((function(){return Promise.resolve(t.eos.get_table_by_scope({json:!0,code:"eosio.msig",limit:100,lower_bound:s,table:"proposal",upper_bound:""})).then((function(e){s=e.more,o=o.concat(e.rows)}))}),(function(){return!!s}));return Promise.resolve(i&&i.then?i.then(r):r())}catch(e){return Promise.reject(e)}},u.getParent=function(t){return n.constants.HISTORY_TYPES.includes("hyperion")?n.constants.HYPERION_URL?this.hyperion.get_creator(t):v(e.urlBuilder(n.constants.API_URL,"hyperion",{type:"get_creator",account:t})):null},u.getHyperionTransaction=function(t){try{var r,o=function(){if(!r||!r.actions||!r.actions.length)throw new Error("TX not found");return e.hyperionTransformTransaction(r)},s=n.constants.HYPERION_URL?Promise.resolve(this.hyperion.get_transaction(t)).then((function(e){r=e})):Promise.resolve(v(e.urlBuilder(n.constants.API_URL,"hyperion",{type:"get_transaction",id:t,options:{}}))).then((function(e){r=e}));return Promise.resolve(s&&s.then?s.then(o):o())}catch(e){return Promise.reject(e)}},u.getProducers=function(t,r){void 0===t&&(t=1),void 0===r&&(r=50);try{var o=this;if(""!==n.constants.API_URL)return Promise.resolve(v(e.urlBuilder(n.constants.API_URL,"producers",{pageNum:t,perPage:r})));var s=!0,i=[],c=null,u=null,a=d((function(){return Promise.resolve(o.eos.get_table_rows({json:!0,code:n.constants.EOSIO,scope:n.constants.EOSIO,table:"producers",lower_bound:u,index_position:1,key_type:"i64",limit:100})).then((function(t){s=(c=t).more,i=i.concat(c.rows),u=e.toBigNumber(e.encodeName(i[i.length-1].owner,!1)).plus(1).toString()}))}),(function(){return!!s}));return Promise.resolve(a&&a.then?a.then((function(){return i})):i)}catch(e){return Promise.reject(e)}},i}()),exports.get=v,exports.http=p,exports.post=_,exports.put=function(e,t,n){try{return void 0===n&&(n={method:"put",body:JSON.stringify(t)}),Promise.resolve(p(new Request(e,n)))}catch(e){return Promise.reject(e)}}; | ||
//# sourceMappingURL=api.cjs.production.min.js.map |
@@ -1,2 +0,2 @@ | ||
import { Api, JsonRpc } from '@protonprotocol/protonjs'; | ||
import { Api, JsonRpc } from '@proton/js'; | ||
import * as LightApi from '@eoscafe/light-api'; | ||
@@ -17,2 +17,4 @@ declare class EosApiClass { | ||
getDappStakes(account: string): Promise<any>; | ||
getAllOracleFeeds(lower_bound?: any): Promise<any>; | ||
getAllOracleData(feed_index: number): Promise<any>; | ||
getDapphodlStakes(account: string, lower_bound?: string | number): Promise<any>; | ||
@@ -45,9 +47,14 @@ getDappUnstakes(account: string): Promise<any>; | ||
getAccount(accountName: string): Promise<any>; | ||
getInfo(): Promise<void | import("@protonprotocol/protonjs/dist/eosjs-rpc-interfaces").GetInfoResult>; | ||
getInfo(): Promise<void | import("@proton/js/dist/eosjs-rpc-interfaces").GetInfoResult>; | ||
getInfoFromUrl(url: string): Promise<any>; | ||
isHyperionAlive(url: string): Promise<boolean>; | ||
getBlock(blockNumOrId: string | number): Promise<import("@protonprotocol/protonjs/dist/eosjs-rpc-interfaces").GetBlockResult>; | ||
getBlock(blockNumOrId: string | number): Promise<import("@proton/js/dist/eosjs-rpc-interfaces").GetBlockResult>; | ||
getEosBalance(accountName: string): Promise<any>; | ||
getTable(data: string): Promise<any>; | ||
getAbi(contract: string): Promise<void | import("@protonprotocol/protonjs/dist/eosjs-rpc-interfaces").GetAbiResult>; | ||
getAbi(contract: string): Promise<void | import("@proton/js/dist/eosjs-rpc-interfaces").GetAbiResult>; | ||
parsePackedMsigActions(packedActions: any): Promise<{ | ||
action_trace: { | ||
act: any; | ||
}; | ||
}[]>; | ||
parsePackedMsig(packed_transaction: any): Promise<any>; | ||
@@ -71,2 +78,3 @@ getFullMsigProposal(account_name: string, proposal_name: string): Promise<any>; | ||
getAddresses(limit: number | undefined, upper_bound: number): Promise<any>; | ||
getRentbwState(): Promise<any>; | ||
getFIOProducers(limit: number): Promise<any>; | ||
@@ -82,3 +90,3 @@ getFIOLockedTokens(account: string): Promise<number>; | ||
totalBp: number; | ||
circulating: number; | ||
circulating: any; | ||
}>; | ||
@@ -96,4 +104,14 @@ getFIOFees(): Promise<any>; | ||
hyperionGetTokensForAccount(account: string): Promise<any>; | ||
hyperionGetMsig(msigFilters: any): Promise<{ | ||
approvals: any; | ||
transaction: any; | ||
executionTransaction: { | ||
payer: any; | ||
trx_id: any; | ||
published_at: any; | ||
cancelled: boolean; | ||
} | undefined; | ||
} | undefined>; | ||
lightGetKeyAccounts(key: string, lightUrl?: any): Promise<LightApi.GetKeyAccounts[]>; | ||
getKeyAccountsByType(key: string, type: string, localConstants: any): Promise<any>; | ||
getKeyAccountsByType(key: string, type: string, localConstants?: any): Promise<any>; | ||
/** | ||
@@ -115,3 +133,2 @@ * Tries all histories to get key | ||
getRexPriceChart(): Promise<any>; | ||
getMsigProposalDescriptions(): Promise<any>; | ||
getHistoryTransaction(txId: string, blockHint?: number): Promise<{ | ||
@@ -133,5 +150,12 @@ status: any; | ||
delegatedBandwith(account: string, lower_bound: string): Promise<any>; | ||
getXprTotalStakedAndApr(): Promise<0 | { | ||
totalStaked: number; | ||
apr: number; | ||
}>; | ||
getXprVoter(account: string): Promise<any>; | ||
getXprAccountStakes(account: string): Promise<any>; | ||
getXprAccountRefund(account: string): Promise<any>; | ||
getXprLongstakePlans(): Promise<any[]>; | ||
getXprLongstakeStakes(account: string): Promise<any[]>; | ||
getXprOracleData(oracleIndex: number): Promise<any>; | ||
getAccountDelegatedBandwidth(account: string): Promise<any[]>; | ||
@@ -145,4 +169,2 @@ getAccountResources(account: string): Promise<any>; | ||
getBlacklistTable(table: string): Promise<any>; | ||
getProposalsByProposer(proposer: string): Promise<any>; | ||
getProposalsByVoter(voter: string): Promise<any>; | ||
getProxies(): Promise<any>; | ||
@@ -149,0 +171,0 @@ getVoters(producer: string): Promise<any>; |
{ | ||
"name": "@bloks/api", | ||
"version": "4.0.188", | ||
"version": "22.0.32", | ||
"author": "jafri", | ||
@@ -16,10 +16,4 @@ "module": "dist/api.esm.js", | ||
"test": "tsdx test", | ||
"lint": "tsdx lint", | ||
"prepare": "tsdx build" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "" | ||
} | ||
}, | ||
"devDependencies": { | ||
@@ -30,12 +24,12 @@ "@types/jest": "^24.9.0", | ||
"tslib": "^1.10.0", | ||
"typescript": "^3.7.5" | ||
"typescript": "^4.0.3" | ||
}, | ||
"dependencies": { | ||
"@bloks/constants": "^4.0.188", | ||
"@bloks/utils": "^4.0.188", | ||
"@eoscafe/hyperion": "^3.2.5", | ||
"@bloks/constants": "^22.0.15", | ||
"@bloks/utils": "^22.0.32", | ||
"@eoscafe/hyperion": "^3.2.7", | ||
"@eoscafe/light-api": "^3.2.8", | ||
"@protonprotocol/protonjs": "^21.0.0-rc.19" | ||
"@proton/js": "^22.0.32" | ||
}, | ||
"gitHead": "7796fc80c958c54f5246aa3b3924c4e02306f6eb" | ||
"gitHead": "6a216e65bad2f6eeeae1f25a085e4bcfe86597c3" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
759824
6855
15
36
+ Added@proton/js@^22.0.32
+ Added@bloks/constants@22.0.88(transitive)
+ Added@bloks/utils@22.0.89(transitive)
+ Added@jafri/numbro@2.3.4(transitive)
+ Added@proton/js@22.0.88(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedcamelcase@5.3.1(transitive)
+ Addedcliui@6.0.0(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addeddijkstrajs@1.0.3(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedfind-up@4.1.0(transitive)
+ Addedget-caller-file@2.0.5(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedlocate-path@5.0.0(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@4.1.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedpngjs@5.0.0(transitive)
+ Addedqrcode@1.5.4(transitive)
+ Addedrequire-directory@2.1.1(transitive)
+ Addedrequire-main-filename@2.0.0(transitive)
+ Addedset-blocking@2.0.0(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedwhich-module@2.0.1(transitive)
+ Addedwrap-ansi@6.2.0(transitive)
+ Addedy18n@4.0.3(transitive)
+ Addedyargs@15.4.1(transitive)
+ Addedyargs-parser@18.1.3(transitive)
+ Addedzod@1.11.17(transitive)
- Removed@babel/runtime@7.6.0(transitive)
- Removed@bloks/constants@26.4.04.0.188(transitive)
- Removed@bloks/utils@4.0.188(transitive)
- Removed@protonprotocol/protonjs@21.0.38(transitive)
- Removedabort-controller@3.0.0(transitive)
- Removedbase64url@3.0.1(transitive)
- Removedbigi@1.4.2(transitive)
- Removedbrowserify-aes@1.0.6(transitive)
- Removedbuffer-xor@1.0.3(transitive)
- Removedbytebuffer@5.0.1(transitive)
- Removedchainsaw@0.0.9(transitive)
- Removedcipher-base@1.0.6(transitive)
- Removedcreate-hash@1.1.3(transitive)
- Removedcreate-hmac@1.1.6(transitive)
- Removedecurve@1.0.5(transitive)
- Removedeosjs-ecc@4.0.7(transitive)
- Removedevent-target-shim@5.0.1(transitive)
- Removedevp_bytestokey@1.0.3(transitive)
- Removedhash-base@3.1.0(transitive)
- Removedhashish@0.0.4(transitive)
- Removedlong@3.2.0(transitive)
- Removedmd5.js@1.3.5(transitive)
- Removednumbro@2.5.0(transitive)
- Removedrandombytes@2.0.5(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedregenerator-runtime@0.13.11(transitive)
- Removedremove@0.1.5(transitive)
- Removedripemd160@2.0.2(transitive)
- Removedseq@0.3.5(transitive)
- Removedsha.js@2.4.11(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedtraverse@0.3.9(transitive)
- Removedutil-deprecate@1.0.2(transitive)
Updated@bloks/constants@^22.0.15
Updated@bloks/utils@^22.0.32
Updated@eoscafe/hyperion@^3.2.7