UNPKG

@newfound8ion/newcoin.farm-js

Version:

JS Library to interact with newcoin.farm smart contract.

1 lines 2.98 kB
var newcoinfarm;(()=>{"use strict";var e={277:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ActionGenerator=void 0,t.ActionGenerator=class{constructor(e,t){this.contract=e,this.pools_contract=t}async open(e,t,r,o){return this._pack(this.contract,e,"open",{owner:t,symbol:r,payer:o})}async close(e,t,r){return this._pack(this.contract,e,"close",{owner:t,symbol:r})}async unlock(e,t,r){return this._pack(this.contract,e,"unlock",{from:t,id:r})}async lockTokens(e,t,r){return this._pack(this.pools_contract,e,"transfer",{from:t,to:this.contract,quantity:r,memo:"lock"})}_pack(e,t,r,o){return[{account:e,name:r,authorization:t,data:o}]}}},172:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ChainApi=void 0,t.ChainApi=class{constructor(e,t,r){this.nodeos_url=e,this.contract=t,this.fetch=r}async getCurrencyStats(e){return await this.fetch(`${this.nodeos_url}/v1/chain/get_currency_stats`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async getCurrencyBalance(e){return await this.fetch(`${this.nodeos_url}/v1/chain/get_currency_balance`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async getTableRows(e){return await this.fetch(`${this.nodeos_url}/v1/chain/get_table_rows`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async getDeposit(e){return this.getTableRows({json:!0,code:this.contract,scope:e.owner,table:"deposits",table_key:e.id,lower_bound:e.id,upper_bound:e.id,key_type:"i64",index_position:"1"})}}},432:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(277),t),n(r(172),t),n(r(588),t),n(r(921),t)},242:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},119:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},588:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(242),t),n(r(119),t)},921:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})}},t={},r=function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}(432);newcoinfarm=r})();