Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vostokplatform/waves-api

Package Overview
Dependencies
Maintainers
8
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vostokplatform/waves-api - npm Package Compare versions

Comparing version 1.21.0 to 2.0.0

2

dist/waves-api.partial.min.js

@@ -1,1 +0,1 @@

(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.WavesAPI=f()}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r}()({1:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var signature_generator_1=require("@vostokplatform/signature-generator");var request_1=require("./utils/request");var request=require("./utils/request");var index_1=require("./api/node/index");var MatcherAPI=require("./api/matcher/index");var constants=require("./constants");var config_1=require("./config");var tools_1=require("./tools");var WavesAPI=function(){function WavesAPI(params){this.Seed=signature_generator_1.Seed;this.byteProcessors=signature_generator_1.ByteProcessor;this.config=config_1.default;this.constants=constants;this.crypto=signature_generator_1.utils.crypto;this.request=request;this.tools=tools_1.default;var initialConfiguration=params.initialConfiguration,_a=params.fetchInstance,fetchInstance=_a===void 0?request_1.createFetchWrapper(0,0,request_1.processJSON):_a;this.API={Node:new index_1.default(fetchInstance),Matcher:MatcherAPI};if(this instanceof WavesAPI){this.config.clear();this.config.set(initialConfiguration);if(WavesAPI._instance===null){WavesAPI._instance=this}else{return WavesAPI._instance}}else{return new WavesAPI({initialConfiguration:initialConfiguration,fetchInstance:fetchInstance})}}return WavesAPI}();function create(_a){var initialConfiguration=_a.initialConfiguration,fetchInstance=_a.fetchInstance;return new WavesAPI({initialConfiguration:initialConfiguration,fetchInstance:fetchInstance})}exports.create=create;exports.MAINNET_CONFIG=constants.DEFAULT_MAINNET_CONFIG;exports.TESTNET_CONFIG=constants.DEFAULT_TESTNET_CONFIG},{"./api/matcher/index":2,"./api/node/index":11,"./config":18,"./constants":19,"./tools":24,"./utils/request":27,"@vostokplatform/signature-generator":undefined}],2:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var info_1=require("./info");var orderbooks_1=require("./orderbooks");exports.getMatcherKey=info_1.default.getMatcherKey;exports.getOrderbooks=orderbooks_1.default.getOrderbooks;exports.getOrderbook=orderbooks_1.default.getOrderbook;exports.getOrders=orderbooks_1.default.getOrders;exports.getAllOrders=orderbooks_1.default.getAllOrders;exports.createOrder=orderbooks_1.default.createOrder;exports.cancelOrder=orderbooks_1.default.cancelOrder;exports.deleteOrder=orderbooks_1.default.deleteOrder},{"./info":3,"./orderbooks":4}],3:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var request_1=require("../../utils/request");var fetch=request_1.createFetchWrapper(1,0,request_1.processJSON);exports.default={getMatcherKey:function(){return fetch("/")}}},{"../../utils/request":27}],4:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};Object.defineProperty(exports,"__esModule",{value:true});var signature_generator_1=require("@vostokplatform/signature-generator");var request_1=require("../../utils/request");var remap_1=require("../../utils/remap");var request_2=require("../../utils/request");var orderbooks_x_1=require("./orderbooks.x");var fetch=request_1.createFetchWrapper(1,0,request_1.processJSON);var preCreateOrderAsync=function(data){return orderbooks_x_1.createOrderSchema.parse(data)};var postCreateOrder=function(data){data.assetPair={amountAsset:remap_1.normalizeAssetId(data.amountAsset),priceAsset:remap_1.normalizeAssetId(data.priceAsset)};delete data.amountAsset;delete data.priceAsset;return data};var postCancelOrder=remap_1.createRemapper({senderPublicKey:"sender"});var generateCancelLikeRequest=function(type){return function(amountAssetId,priceAssetId,orderId,keyPair){var data={senderPublicKey:keyPair.publicKey,orderId:orderId};var authData=new signature_generator_1.CANCEL_ORDER_SIGNATURE(data);return authData.getSignature(keyPair.privateKey).then(function(signature){return postCancelOrder(__assign({},data,{signature:signature}))}).then(function(tx){return fetch("/orderbook/"+amountAssetId+"/"+priceAssetId+"/"+type,__assign({},request_2.POST_TEMPLATE,{body:JSON.stringify(tx)}))})}};exports.default={getOrderbooks:function(){return fetch("/orderbook")},getOrderbook:function(assetOne,assetTwo){return fetch("/orderbook/"+assetOne+"/"+assetTwo)},getOrders:function(assetOne,assetTwo,keyPair){var data={senderPublicKey:keyPair.publicKey,timestamp:remap_1.getTimestamp()};var authData=new signature_generator_1.AUTH_ORDER_SIGNATURE(data);return authData.getSignature(keyPair.privateKey).then(function(signature){var preparedData=__assign({},data,{signature:signature});return fetch("/orderbook/"+assetOne+"/"+assetTwo+"/publicKey/"+keyPair.publicKey,{headers:{Timestamp:preparedData.timestamp,Signature:preparedData.signature}})})},getAllOrders:function(keyPair){var data={senderPublicKey:keyPair.publicKey,timestamp:remap_1.getTimestamp()};var authData=new signature_generator_1.AUTH_ORDER_SIGNATURE(data);return authData.getSignature(keyPair.privateKey).then(function(signature){var preparedData=__assign({},data,{signature:signature});return fetch("/orderbook/"+keyPair.publicKey,{headers:{Timestamp:preparedData.timestamp,Signature:preparedData.signature}})})},createOrder:request_1.wrapTxRequest(signature_generator_1.CREATE_ORDER_SIGNATURE,preCreateOrderAsync,postCreateOrder,function(postParams){return fetch("/orderbook",postParams)}),cancelOrder:generateCancelLikeRequest("cancel"),deleteOrder:generateCancelLikeRequest("delete")}},{"../../utils/remap":26,"../../utils/request":27,"./orderbooks.x":5,"@vostokplatform/signature-generator":undefined}],5:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var ts_api_validator_1=require("ts-api-validator");var remap_1=require("../../utils/remap");var constants_1=require("../../constants");var schemaFields_1=require("../schemaFields");exports.createOrderSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,matcherPublicKey:schemaFields_1.default.publicKey,amountAsset:schemaFields_1.default.assetId,priceAsset:schemaFields_1.default.assetId,orderType:{type:ts_api_validator_1.StringPart,required:true,isValid:function(orderType){return orderType==="buy"||orderType==="sell"}},amount:{type:ts_api_validator_1.NumberPart,required:true},price:{type:ts_api_validator_1.NumberPart,required:true},timestamp:schemaFields_1.default.timestamp,expiration:{type:ts_api_validator_1.NumberPart,required:true,parseValue:function(expiration){if(expiration){return remap_1.getTimestamp(expiration)}else{var date=new Date(remap_1.getTimestamp());return date.setDate(date.getDate()+constants_1.DEFAULT_ORDER_EXPIRATION_DAYS)}}},matcherFee:schemaFields_1.default.matcherFee}})},{"../../constants":19,"../../utils/remap":26,"../schemaFields":17,"ts-api-validator":undefined}],6:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var constants_1=require("../../constants");var Addresses=function(){function Addresses(fetchInstance){this.fetch=fetchInstance}Addresses.prototype.balance=function(address,confirmations){if(!confirmations){return this.fetch("/addresses/balance/"+address)}else{return this.fetch("/addresses/balance/"+address+"/"+confirmations)}};Addresses.prototype.balanceDetails=function(address){return this.fetch("/addresses/balance/details/"+address)};Addresses.prototype.data=function(address,offset,limit){if(offset===void 0){offset=constants_1.DEFAULT_PAGING_OFFSET}if(limit===void 0){limit=constants_1.DEFAULT_PAGING_LIMIT}return this.fetch("/addresses/data/"+address+"?offset="+offset+"&limit="+limit)};return Addresses}();exports.default=Addresses},{"../../constants":19}],7:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Aliases=function(){function Aliases(fetchInstance){this.fetch=fetchInstance}Aliases.prototype.byAlias=function(alias){return this.fetch("/alias/by-alias/"+alias)};Aliases.prototype.byAddress=function(address){return this.fetch("/alias/by-address/"+address)};return Aliases}();exports.default=Aliases},{}],8:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var addresses_1=require("./addresses");var constants=require("../../constants");var Assets=function(){function Assets(fetchInstance){this.fetch=fetchInstance;this.addresses=new addresses_1.default(fetchInstance)}Assets.prototype.balances=function(address){return this.fetch("/assets/balance/"+address)};Assets.prototype.balance=function(address,assetId){if(assetId===constants.WAVES){return this.addresses.balance(address)}else{return this.fetch("/assets/balance/"+address+"/"+assetId)}};Assets.prototype.distribution=function(assetId){return this.fetch("/assets/"+assetId+"/distribution")};return Assets}();exports.default=Assets},{"../../constants":19,"./addresses":6}],9:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Blocks=function(){function Blocks(fetchInstance){this.fetch=fetchInstance}Blocks.prototype.get=function(signature){return this.fetch("/blocks/signature/"+signature)};Blocks.prototype.at=function(height){return this.fetch("/blocks/at/"+height)};Blocks.prototype.first=function(){return this.fetch("/blocks/first")};Blocks.prototype.last=function(){return this.fetch("/blocks/last")};Blocks.prototype.height=function(){return this.fetch("/blocks/height")};return Blocks}();exports.default=Blocks},{}],10:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var constants_1=require("../../constants");var Contracts=function(){function Contracts(fetchInstance){this.fetch=fetchInstance}Contracts.prototype.get=function(id,offset,limit){if(offset===void 0){offset=constants_1.DEFAULT_PAGING_OFFSET}if(limit===void 0){limit=constants_1.DEFAULT_PAGING_LIMIT}return this.fetch("/contracts/"+id+"?offset="+offset+"&limit="+limit)};Contracts.prototype.getKey=function(id,key){return this.fetch("/contracts/"+id+"/"+key)};Contracts.prototype.getExecutedTxFor=function(id){return this.fetch("/contracts/executed-tx-for/"+id)};return Contracts}();exports.default=Contracts},{"../../constants":19}],11:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var addresses_1=require("./addresses");var aliases_1=require("./aliases");var assets_1=require("./assets");var blocks_1=require("./blocks");var contracts_1=require("./contracts");var leasing_1=require("./leasing");var transactions_1=require("./transactions");var peers_1=require("./peers");var utils_1=require("./utils");var NodeAPI=function(){function NodeAPI(fetchInstance){this.addresses=new addresses_1.default(fetchInstance);this.aliases=new aliases_1.default(fetchInstance);this.assets=new assets_1.default(fetchInstance);this.blocks=new blocks_1.default(fetchInstance);this.contracts=new contracts_1.default(fetchInstance);this.leasing=new leasing_1.default(fetchInstance);this.transactions=new transactions_1.default(fetchInstance);this.peers=new peers_1.default(fetchInstance);this.utils=new utils_1.default(fetchInstance)}return NodeAPI}();exports.default=NodeAPI},{"./addresses":6,"./aliases":7,"./assets":8,"./blocks":9,"./contracts":10,"./leasing":12,"./peers":13,"./transactions":14,"./utils":16}],12:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Leasing=function(){function Leasing(fetchInstance){this.fetch=fetchInstance}Leasing.prototype.getAllActiveLeases=function(address){return this.fetch("/leasing/active/"+address).then(function(list){return list.map(function(tx){tx.status="active";return tx})})};return Leasing}();exports.default=Leasing},{}],13:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Peers=function(){function Peers(fetchInstance){this.fetch=fetchInstance}Peers.prototype.connected=function(){return this.fetch("/peers/connected")};return Peers}();exports.default=Peers},{}],14:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};Object.defineProperty(exports,"__esModule",{value:true});var request_1=require("../../utils/request");var WavesError_1=require("../../errors/WavesError");var constants=require("../../constants");var config_1=require("../../config");var requests=require("./transactions.x");var Transactions=function(){function Transactions(fetchInstance){this.fetch=fetchInstance}Transactions.prototype.get=function(id){if(id===constants.WAVES){return Promise.resolve(constants.WAVES_V1_ISSUE_TX)}else{return this.fetch("/transactions/info/"+id)}};Transactions.prototype.getList=function(address,limit){if(limit===void 0){limit=config_1.default.getRequestParams().limit}return this.fetch("/transactions/address/"+address+"/limit/"+limit).then(function(array){return array[0]})};Transactions.prototype.utxSize=function(){return this.fetch("/transactions/unconfirmed/size")};Transactions.prototype.utxGet=function(id){return this.fetch("/transactions/unconfirmed/info/"+id)};Transactions.prototype.utxGetList=function(){return this.fetch("/transactions/unconfirmed")};Transactions.prototype.broadcast=function(type,data,keys){switch(type){case constants.ISSUE_TX_NAME:return requests.sendIssueTx(data,keys);case constants.TRANSFER_TX_NAME:return requests.sendTransferTx(data,keys);case constants.REISSUE_TX_NAME:return requests.sendReissueTx(data,keys);case constants.BURN_TX_NAME:return requests.sendBurnTx(data,keys);case constants.LEASE_TX_NAME:return requests.sendLeaseTx(data,keys);case constants.CANCEL_LEASING_TX_NAME:return requests.sendCancelLeasingTx(data,keys);case constants.CREATE_ALIAS_TX_NAME:return requests.sendCreateAliasTx(data,keys);case constants.MASS_TRANSFER_TX_NAME:return requests.sendMassTransferTx(data,keys);case constants.DATA_TX_NAME:return requests.sendDataTx(data,keys);case constants.SET_SCRIPT_TX_NAME:return requests.sendSetScriptTx(data,keys);case constants.SPONSORSHIP_TX_NAME:return requests.sendSponsorshipTx(data,keys);case constants.PERMISSION_TX_NAME:return requests.sendPermissionTx(data,keys);case constants.DOCKER_CREATE_TX_NAME:return requests.sendDockerCreateTx(data,keys);case constants.DOCKER_CALL_TX_NAME:return requests.sendDockerCallTx(data,keys);case constants.DOCKER_DISABLE_TX_NAME:return requests.sendDockerDisableTx(data,keys);case constants.POLICY_REGISTER_NODE_TX_NAME:return requests.sendNodeRegistry(data,keys);case constants.POLICY_CREATE_TX_NAME:return requests.sendPolicyCreate(data,keys);case constants.POLICY_UPDATE_TX_NAME:return requests.sendPolicyUpdate(data,keys);default:throw new WavesError_1.default("Wrong transaction type: "+type,data)}};Transactions.prototype.sign=function(type,data,keys){switch(type){case constants.ISSUE_TX_NAME:return requests.sendSignedIssueTx(data,keys);case constants.TRANSFER_TX_NAME:return requests.sendSignedTransferTx(data,keys);case constants.REISSUE_TX_NAME:return requests.sendSignedReissueTx(data,keys);case constants.BURN_TX_NAME:return requests.sendSignedBurnTx(data,keys);case constants.LEASE_TX_NAME:return requests.sendSignedLeaseTx(data,keys);case constants.CANCEL_LEASING_TX_NAME:return requests.sendSignedCancelLeasingTx(data,keys);case constants.CREATE_ALIAS_TX_NAME:return requests.sendSignedCreateAliasTx(data,keys);case constants.MASS_TRANSFER_TX_NAME:return requests.sendSignedMassTransferTx(data,keys);case constants.DATA_TX_NAME:return requests.sendSignedDataTx(data,keys);case constants.SET_SCRIPT_TX_NAME:return requests.sendSignedSetScriptTx(data,keys);case constants.SPONSORSHIP_TX_NAME:return requests.sendSignedSponsorshipTx(data,keys);case constants.PERMISSION_TX_NAME:return requests.sendSignedPermissionTx(data,keys);case constants.DOCKER_CREATE_TX_NAME:return requests.sendSignedDockerCreateTx(data,keys);case constants.DOCKER_CALL_TX_NAME:return requests.sendSignedDockerCallTx(data,keys);case constants.DOCKER_DISABLE_TX_NAME:return requests.sendSignedDockerDisableTx(data,keys);case constants.POLICY_REGISTER_NODE_TX_NAME:return requests.signNodeRegistry(data,keys);case constants.POLICY_CREATE_TX_NAME:return requests.signPolicyCreate(data,keys);case constants.POLICY_UPDATE_TX_NAME:return requests.signPolicyUpdate(data,keys);default:throw new WavesError_1.default("Wrong transaction type: "+type,data)}};Transactions.prototype.rawBroadcast=function(data){return this.fetch(constants.BROADCAST_PATH,__assign({},request_1.POST_TEMPLATE,{body:JSON.stringify(data)}))};Transactions.prototype.signOnNode=function(data){return this.fetch("/transactions/sign")};return Transactions}();exports.default=Transactions},{"../../config":18,"../../constants":19,"../../errors/WavesError":20,"../../utils/request":27,"./transactions.x":15}],15:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};Object.defineProperty(exports,"__esModule",{value:true});var ts_api_validator_1=require("ts-api-validator");var signature_generator_1=require("@vostokplatform/signature-generator");var schemaFields_1=require("../schemaFields");var remap_1=require("../../utils/remap");var request_1=require("../../utils/request");var constants=require("../../constants");var config_1=require("../../config");var bignumber_1=require("../../libs/bignumber");var fetch=request_1.createFetchWrapper(0,0,request_1.processJSON);var AnyPart=function(_super){__extends(AnyPart,_super);function AnyPart(){return _super!==null&&_super.apply(this,arguments)||this}AnyPart.prototype.getValue=function(data){return data};return AnyPart}(ts_api_validator_1.BasePart);function getSignedTx(data){return{data:new Promise(function(resolve){resolve(JSON.parse(data.body))})}}exports.issueSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,name:{type:ts_api_validator_1.StringPart,required:true},description:{type:ts_api_validator_1.StringPart,required:false,defaultValue:""},script:{type:ts_api_validator_1.StringPart,required:false,defaultValue:"base64:AQa3b8tH"},quantity:{type:ts_api_validator_1.StringPart,required:true},precision:{type:ts_api_validator_1.NumberPart,required:true,isValid:remap_1.precisionCheck},reissuable:schemaFields_1.default.reissuable,fee:schemaFields_1.default.issueFee,timestamp:schemaFields_1.default.timestamp,chainId:{type:ts_api_validator_1.NumberPart,required:true,parseValue:function(){return config_1.default.getNetworkByte()}}}});exports.preIssue=function(data){return exports.issueSchema.parse(data)};exports.postIssue=remap_1.createRemapper({transactionType:null,precision:"decimals",type:constants.ISSUE_TX,version:constants.ISSUE_TX_VERSION,quantity:{from:"string",to:"bignumber"}});exports.sendIssueTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.issue,exports.preIssue,exports.postIssue,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedIssueTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.issue,exports.preIssue,exports.postIssue,function(postParams){return getSignedTx(postParams).data},true);exports.transferSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,recipient:schemaFields_1.default.recipient,assetId:schemaFields_1.default.assetId,amount:{type:ts_api_validator_1.StringPart,required:true},feeAssetId:{type:ts_api_validator_1.StringPart,required:false,defaultValue:constants.WAVES},fee:schemaFields_1.default.fee,attachment:{type:ts_api_validator_1.StringPart,required:false,defaultValue:""},timestamp:schemaFields_1.default.timestamp}});exports.preTransfer=function(data){return exports.transferSchema.parse(data)};exports.postTransfer=remap_1.createRemapper({transactionType:null,assetId:remap_1.normalizeAssetId,feeAssetId:remap_1.normalizeAssetId,attachment:{from:"string",to:"base58"},recipient:{from:"raw",to:"prefixed"},amount:{from:"string",to:"bignumber"},type:constants.TRANSFER_TX,version:constants.TRANSFER_TX_VERSION});exports.sendTransferTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.transfer,exports.preTransfer,exports.postTransfer,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedTransferTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.transfer,exports.preTransfer,exports.postTransfer,function(postParams){return getSignedTx(postParams).data},true);exports.reissueSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,assetId:schemaFields_1.default.assetId,quantity:{type:ts_api_validator_1.StringPart,required:true},reissuable:schemaFields_1.default.reissuable,fee:schemaFields_1.default.issueFee,timestamp:schemaFields_1.default.timestamp,chainId:{type:ts_api_validator_1.NumberPart,required:true,parseValue:function(){return config_1.default.getNetworkByte()}}}});exports.preReissue=function(data){return exports.reissueSchema.parse(data)};exports.postReissue=remap_1.createRemapper({transactionType:null,type:constants.REISSUE_TX,version:constants.REISSUE_TX_VERSION,quantity:{from:"string",to:"bignumber"}});exports.sendReissueTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.reissue,exports.preReissue,exports.postReissue,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedReissueTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.reissue,exports.preReissue,exports.postReissue,function(postParams){return getSignedTx(postParams).data},true);exports.burnSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,assetId:schemaFields_1.default.assetId,quantity:{type:ts_api_validator_1.StringPart,required:true},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp,chainId:{type:ts_api_validator_1.NumberPart,required:true,parseValue:function(){return config_1.default.getNetworkByte()}}}});exports.preBurn=function(data){return exports.burnSchema.parse(data)};exports.postBurn=remap_1.createRemapper({transactionType:null,type:constants.BURN_TX,version:constants.BURN_TX_VERSION,quantity:{from:"string",to:"bignumber"}});exports.sendBurnTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.burn,exports.preBurn,exports.postBurn,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedBurnTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.burn,exports.preBurn,exports.postBurn,function(postParams){return getSignedTx(postParams).data},true);exports.leaseSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,recipient:schemaFields_1.default.recipient,amount:{type:ts_api_validator_1.NumberPart,required:true},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp}});exports.preLease=function(data){return exports.leaseSchema.parse(data)};exports.postLease=remap_1.createRemapper({transactionType:null,recipient:{from:"raw",to:"prefixed"},type:constants.LEASE_TX,version:constants.LEASE_TX_VERSION});exports.sendLeaseTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.lease,exports.preLease,exports.postLease,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedLeaseTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.lease,exports.preLease,exports.postLease,function(postParams){return getSignedTx(postParams).data},true);exports.cancelLeasingSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,leaseId:{type:ts_api_validator_1.StringPart,required:true},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp,chainId:{type:ts_api_validator_1.NumberPart,required:true,parseValue:function(){return config_1.default.getNetworkByte()}}}});exports.preCancelLeasing=function(data){return exports.cancelLeasingSchema.parse(data)};exports.postCancelLeasing=remap_1.createRemapper({transactionType:null,transactionId:"txId",type:constants.CANCEL_LEASING_TX,version:constants.CANCEL_LEASING_TX_VERSION});exports.sendCancelLeasingTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.cancelLeasing,exports.preCancelLeasing,exports.postCancelLeasing,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedCancelLeasingTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.cancelLeasing,exports.preCancelLeasing,exports.postCancelLeasing,function(postParams){return getSignedTx(postParams).data},true);exports.createAliasSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,alias:{type:ts_api_validator_1.StringPart,required:true,parseValue:remap_1.removeAliasPrefix},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp}});exports.preCreateAlias=function(data){return exports.createAliasSchema.parse(data)};exports.postCreateAlias=remap_1.createRemapper({transactionType:null,type:constants.CREATE_ALIAS_TX,version:constants.CREATE_ALIAS_TX_VERSION});exports.sendCreateAliasTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.createAlias,exports.preCreateAlias,exports.postCreateAlias,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedCreateAliasTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.createAlias,exports.preCreateAlias,exports.postCreateAlias,function(postParams){return getSignedTx(postParams).data},true);exports.massTransferSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,assetId:schemaFields_1.default.assetId,transfers:{type:ts_api_validator_1.ArrayPart,content:{type:ts_api_validator_1.ObjectPart,required:true,content:{recipient:schemaFields_1.default.recipient,amount:{type:ts_api_validator_1.StringPart,required:true}}},defaultValue:[]},timestamp:schemaFields_1.default.timestamp,fee:schemaFields_1.default.fee,attachment:{type:ts_api_validator_1.StringPart,required:false,defaultValue:""}}});exports.preMassTransfer=function(data){return exports.massTransferSchema.parse(data)};exports.postMassTransfer=remap_1.createRemapper({transactionType:null,assetId:remap_1.normalizeAssetId,attachment:{from:"string",to:"base58"},transfers:{from:"raw",to:"prefixed",path:"transfers"},type:constants.MASS_TRANSFER_TX,version:constants.MASS_TRANSFER_TX_VERSION});exports.sendMassTransferTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.massTransfer,exports.preMassTransfer,exports.postMassTransfer,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedMassTransferTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.massTransfer,exports.preMassTransfer,exports.postMassTransfer,function(postParams){return getSignedTx(postParams).data},true);exports.dataSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,authorPublicKey:schemaFields_1.default.publicKey,data:{type:ts_api_validator_1.ArrayPart,content:{type:ts_api_validator_1.ObjectPart,required:true,content:{type:{type:ts_api_validator_1.StringPart,required:true},key:{type:ts_api_validator_1.StringPart,required:true},value:{type:AnyPart,required:true}}},defaultValue:[]},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp}});exports.preData=function(data){return exports.dataSchema.parse(data)};exports.postData=function(d){var data=JSON.parse(JSON.stringify(d.data));data.forEach(function(e){if(e.type==="integer"&&typeof e.value==="string"){e.value=new bignumber_1.default(e.value)}return e});var result=__assign({},d,{data:data,transactionType:null,type:constants.DATA_TX,version:constants.DATA_TX_VERSION});return result};exports.sendDataTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.data,exports.preData,exports.postData,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedDataTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.data,exports.preData,exports.postData,function(postParams){return getSignedTx(postParams).data},true);exports.setScriptSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{name:{type:ts_api_validator_1.StringPart,required:true},description:{type:ts_api_validator_1.StringPart,required:false,defaultValue:""},senderPublicKey:schemaFields_1.default.publicKey,script:{type:ts_api_validator_1.StringPart,required:true},chainId:{type:ts_api_validator_1.NumberPart,required:true,parseValue:function(){return config_1.default.getNetworkByte()}},timestamp:schemaFields_1.default.timestamp,fee:schemaFields_1.default.fee}});exports.preSetScript=function(data){return exports.setScriptSchema.parse(data)};exports.postSetScript=remap_1.createRemapper({transactionType:null,type:constants.SET_SCRIPT_TX,version:constants.SET_SCRIPT_TX_VERSION});exports.sendSetScriptTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.setScript,exports.preSetScript,exports.postSetScript,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedSetScriptTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.setScript,exports.preSetScript,exports.postSetScript,function(postParams){return getSignedTx(postParams).data},true);exports.sponsorshipSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,assetId:schemaFields_1.default.assetId,minSponsoredAssetFee:{type:ts_api_validator_1.NumberPart,required:true},timestamp:schemaFields_1.default.timestamp,fee:schemaFields_1.default.fee}});exports.preSponsorship=function(data){return exports.sponsorshipSchema.parse(data)};exports.postSponsorship=remap_1.createRemapper({transactionType:null,type:constants.SPONSORSHIP_TX,version:constants.SPONSORSHIP_TX_VERSION});exports.sendSponsorshipTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.sponsorship,exports.preSponsorship,exports.postSponsorship,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedSponsorshipTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.sponsorship,exports.preSponsorship,exports.postSponsorship,function(postParams){return getSignedTx(postParams).data},true);exports.permissionSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,timestamp:schemaFields_1.default.timestamp,opType:{type:ts_api_validator_1.StringPart,required:true},role:{type:ts_api_validator_1.StringPart,required:true},target:{type:ts_api_validator_1.StringPart,required:true},dueTimestamp:{type:ts_api_validator_1.NumberPart,required:false},fee:schemaFields_1.default.fee}});exports.prePermit=function(data){return exports.permissionSchema.parse(data)};exports.postPermit=remap_1.createRemapper({transactionType:null,type:constants.PERMISSION_TX,version:constants.PERMISSION_TX_VERSION});exports.sendPermissionTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.permit,exports.prePermit,exports.postPermit,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedPermissionTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.permit,exports.prePermit,exports.postPermit,function(postParams){return getSignedTx(postParams).data},true);exports.dockerCreateSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,image:{type:ts_api_validator_1.StringPart,required:true},imageHash:{type:ts_api_validator_1.StringPart,required:true},contractName:{type:ts_api_validator_1.StringPart,required:true},params:{type:ts_api_validator_1.ArrayPart,content:{type:ts_api_validator_1.ObjectPart,required:true,content:{type:{type:ts_api_validator_1.StringPart,required:true},key:{type:ts_api_validator_1.StringPart,required:true},value:{type:AnyPart,required:true}}},defaultValue:[]},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp}});exports.preDockerCreate=function(data){return exports.dockerCreateSchema.parse(data)};exports.postDockerCreate=function(d){var data=JSON.parse(JSON.stringify(d.params));data.forEach(function(e){if(e.type==="integer"&&typeof e.value==="string"){e.value=new bignumber_1.default(e.value)}return e});var result=__assign({},d,{params:data,transactionType:null,type:constants.DOCKER_CREATE_TX,version:constants.DOCKER_CREATE_TX_VERSION});return result};exports.sendSignedDockerCreateTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.dockerCreate,exports.preDockerCreate,exports.postDockerCreate,function(postParams){return getSignedTx(postParams).data},true);exports.sendDockerCreateTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.dockerCreate,exports.preDockerCreate,exports.postDockerCreate,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.dockerCallSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,authorPublicKey:schemaFields_1.default.publicKey,contractId:{type:ts_api_validator_1.StringPart,required:true},params:{type:ts_api_validator_1.ArrayPart,content:{type:ts_api_validator_1.ObjectPart,required:true,content:{type:{type:ts_api_validator_1.StringPart,required:true},key:{type:ts_api_validator_1.StringPart,required:true},value:{type:AnyPart,required:true}}},defaultValue:[]},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp}});exports.preDockerCall=function(data){return exports.dockerCallSchema.parse(data)};exports.postDockerCall=function(d){var data=JSON.parse(JSON.stringify(d.params));data.forEach(function(e){if(e.type==="integer"&&typeof e.value==="string"){e.value=new bignumber_1.default(e.value)}return e});var result=__assign({},d,{params:data,transactionType:null,type:constants.DOCKER_CALL_TX,version:constants.DOCKER_CALL_TX_VERSION});return result};exports.sendSignedDockerCallTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.dockerCall,exports.preDockerCall,exports.postDockerCall,function(postParams){return getSignedTx(postParams).data},true);exports.sendDockerCallTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.dockerCall,exports.preDockerCall,exports.postDockerCall,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.dockerDisableSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,contractId:{type:ts_api_validator_1.StringPart,required:true},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp}});exports.preDockerDisable=function(data){return exports.dockerDisableSchema.parse(data)};exports.postDockerDisable=function(d){return __assign({},d,{transactionType:null,type:constants.DOCKER_DISABLE_TX,version:constants.DOCKER_DISABLE_TX_VERSION})};exports.sendSignedDockerDisableTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.dockerDisable,exports.preDockerDisable,exports.postDockerDisable,function(postParams){return getSignedTx(postParams).data},true);exports.sendDockerDisableTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.dockerDisable,exports.preDockerDisable,exports.postDockerDisable,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.nodeRegistrySchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,targetPubKey:schemaFields_1.default.publicKey,nodeName:{type:ts_api_validator_1.StringPart,required:true},opType:{type:ts_api_validator_1.StringPart,required:true},timestamp:schemaFields_1.default.timestamp,fee:schemaFields_1.default.fee}});exports.preNodeRegistry=function(data){return exports.nodeRegistrySchema.parse(data)};exports.postNodeRegistry=function(d){return __assign({},d,{transactionType:null,type:constants.POLICY_REGISTER_NODE_TX,version:constants.POLICY_REGISTER_NODE_TX_VERSION})};exports.signNodeRegistry=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.policyRegisterNode,exports.preNodeRegistry,exports.postNodeRegistry,function(postParams){return getSignedTx(postParams).data},true);exports.sendNodeRegistry=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.policyRegisterNode,exports.preNodeRegistry,exports.postNodeRegistry,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.policyCreateScheme=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,policyName:{type:ts_api_validator_1.StringPart,required:true},description:{type:ts_api_validator_1.StringPart,required:true},recipients:{type:ts_api_validator_1.ArrayPart,content:{type:ts_api_validator_1.StringPart,required:true},defaultValue:[]},owners:{type:ts_api_validator_1.ArrayPart,content:{type:ts_api_validator_1.StringPart,required:true},defaultValue:[]},timestamp:schemaFields_1.default.timestamp,fee:schemaFields_1.default.fee}});exports.prePolicyCreate=function(data){return exports.policyCreateScheme.parse(data)};exports.postPolicyCreate=function(d){return __assign({},d,{transactionType:null,type:constants.POLICY_CREATE_TX,version:constants.POLICY_CREATE_TX_VERSION})};exports.signPolicyCreate=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.policyCreate,exports.prePolicyCreate,exports.postPolicyCreate,function(postParams){return getSignedTx(postParams).data},true);exports.sendPolicyCreate=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.policyCreate,exports.prePolicyCreate,exports.postPolicyCreate,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.policyUpdateScheme=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,policyId:{type:ts_api_validator_1.StringPart,required:true},recipients:{type:ts_api_validator_1.ArrayPart,content:{type:ts_api_validator_1.StringPart,required:true},defaultValue:[]},owners:{type:ts_api_validator_1.ArrayPart,content:{type:ts_api_validator_1.StringPart,required:true},defaultValue:[]},opType:{type:ts_api_validator_1.StringPart,required:true},timestamp:schemaFields_1.default.timestamp,fee:schemaFields_1.default.fee}});exports.preUpdateCreate=function(data){return exports.policyUpdateScheme.parse(data)};exports.postUpdateCreate=function(d){return __assign({},d,{transactionType:null,type:constants.POLICY_UPDATE_TX,version:constants.POLICY_UPDATE_TX_VERSION})};exports.signPolicyUpdate=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.policyUpdate,exports.preUpdateCreate,exports.postUpdateCreate,function(postParams){return getSignedTx(postParams).data},true);exports.sendPolicyUpdate=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.policyUpdate,exports.preUpdateCreate,exports.postUpdateCreate,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true)},{"../../config":18,"../../constants":19,"../../libs/bignumber":22,"../../utils/remap":26,"../../utils/request":27,"../schemaFields":17,"@vostokplatform/signature-generator":undefined,"ts-api-validator":undefined}],16:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Utils=function(){function Utils(fetchInstance){this.script={compile:function(code){return this.fetch("/utils/script/compile",{method:"POST",body:code}).then(function(response){return response.script})}};this.fetch=fetchInstance}Utils.prototype.time=function(){return this.fetch("/utils/time").then(function(t){return t.system})};return Utils}();exports.default=Utils},{}],17:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var ts_api_validator_1=require("ts-api-validator");var remap_1=require("../utils/remap");var constants=require("../constants");exports.default={publicKey:{type:ts_api_validator_1.StringPart,required:true},assetId:{type:ts_api_validator_1.StringPart,required:true},fee:{type:ts_api_validator_1.NumberPart,required:false,defaultValue:constants.MINIMUM_FEE},issueFee:{type:ts_api_validator_1.NumberPart,required:false,defaultValue:constants.MINIMUM_ISSUE_FEE},matcherFee:{type:ts_api_validator_1.NumberPart,required:false,defaultValue:constants.MINIMUM_MATCHER_FEE},recipient:{type:ts_api_validator_1.StringPart,required:true,parseValue:remap_1.removeRecipientPrefix},reissuable:{type:ts_api_validator_1.BooleanPart,required:false,defaultValue:false},timestamp:{type:ts_api_validator_1.NumberPart,required:true,parseValue:remap_1.getTimestamp}}},{"../constants":19,"../utils/remap":26,"ts-api-validator":undefined}],18:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};Object.defineProperty(exports,"__esModule",{value:true});var signature_generator_1=require("@vostokplatform/signature-generator");var constants_1=require("./constants");var request_1=require("./utils/request");var config=Object.create(null);function checkRequiredFields(conf){if(!conf.networkByte)throw new Error("Missing network byte");if(!conf.nodeAddress)throw new Error("Missing node address");if(!conf.matcherAddress)throw new Error("Missing matcher address")}exports.default={getNetworkByte:function(){return config.networkByte},getNodeAddress:function(){return config.nodeAddress},isCryptoGost:function(){return config.crypto==="gost"},getMatcherAddress:function(){return config.matcherAddress},getMinimumSeedLength:function(){return config.minimumSeedLength},getRequestParams:function(){return{offset:config.requestOffset,limit:config.requestLimit}},getAssetFactory:function(){return config.assetFactory},getLogLevel:function(){return config.logLevel},getTimeDiff:function(){return config.timeDiff},get:function(){return __assign({},config)},set:function(newConfig){signature_generator_1.config.set(newConfig);if(Object.keys(config).length===0){newConfig=__assign({},constants_1.DEFAULT_BASIC_CONFIG,newConfig)}Object.keys(newConfig).forEach(function(key){switch(key){case"nodeAddress":case"matcherAddress":config[key]=request_1.normalizeHost(newConfig[key]);break;default:config[key]=newConfig[key];break}});checkRequiredFields(config)},clear:function(){Object.keys(config).forEach(function(key){delete config[key]})}}},{"./constants":19,"./utils/request":27,"@vostokplatform/signature-generator":undefined}],19:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};Object.defineProperty(exports,"__esModule",{value:true});exports.WAVES="WAVES";exports.MAINNET_BYTE="D".charCodeAt(0);exports.TESTNET_BYTE="D".charCodeAt(0);exports.INITIAL_NONCE=0;exports.ADDRESS_BYTE=1;exports.ALIAS_BYTE=2;exports.ISSUE_TX=3;exports.TRANSFER_TX=4;exports.REISSUE_TX=5;exports.BURN_TX=6;exports.EXCHANGE_TX=7;exports.LEASE_TX=8;exports.CANCEL_LEASING_TX=9;exports.CREATE_ALIAS_TX=10;exports.MASS_TRANSFER_TX=11;exports.DATA_TX=12;exports.SET_SCRIPT_TX=13;exports.SPONSORSHIP_TX=14;exports.PERMISSION_TX=102;exports.DOCKER_CREATE_TX=103;exports.DOCKER_CALL_TX=104;exports.DOCKER_DISABLE_TX=106;exports.POLICY_REGISTER_NODE_TX=111;exports.POLICY_CREATE_TX=112;exports.POLICY_UPDATE_TX=113;exports.ISSUE_TX_VERSION=2;exports.TRANSFER_TX_VERSION=2;exports.REISSUE_TX_VERSION=2;exports.BURN_TX_VERSION=2;exports.EXCHANGE_TX_VERSION=2;exports.LEASE_TX_VERSION=2;exports.CANCEL_LEASING_TX_VERSION=2;exports.CREATE_ALIAS_TX_VERSION=2;exports.MASS_TRANSFER_TX_VERSION=1;exports.DATA_TX_VERSION=1;exports.SET_SCRIPT_TX_VERSION=1;exports.SPONSORSHIP_TX_VERSION=1;exports.PERMISSION_TX_VERSION=1;exports.DOCKER_CREATE_TX_VERSION=1;exports.DOCKER_CALL_TX_VERSION=1;exports.DOCKER_DISABLE_TX_VERSION=1;exports.POLICY_REGISTER_NODE_TX_VERSION=1;exports.POLICY_CREATE_TX_VERSION=1;exports.POLICY_UPDATE_TX_VERSION=1;exports.ISSUE_TX_NAME="issue";exports.TRANSFER_TX_NAME="transfer";exports.REISSUE_TX_NAME="reissue";exports.BURN_TX_NAME="burn";exports.EXCHANGE_TX_NAME="exchange";exports.LEASE_TX_NAME="lease";exports.CANCEL_LEASING_TX_NAME="cancelLeasing";exports.CREATE_ALIAS_TX_NAME="createAlias";exports.MASS_TRANSFER_TX_NAME="massTransfer";exports.DATA_TX_NAME="data";exports.SET_SCRIPT_TX_NAME="setScript";exports.SPONSORSHIP_TX_NAME="sponsorship";exports.PERMISSION_TX_NAME="permit";exports.DOCKER_CREATE_TX_NAME="dockerCreate";exports.DOCKER_CALL_TX_NAME="dockerCall";exports.DOCKER_DISABLE_TX_NAME="dockerDisable";exports.POLICY_REGISTER_NODE_TX_NAME="policyRegisterNode";exports.POLICY_CREATE_TX_NAME="policyCreate";exports.POLICY_UPDATE_TX_NAME="policyUpdate";exports.PRIVATE_KEY_LENGTH=32;exports.PUBLIC_KEY_LENGTH=32;exports.PUBLIC_KEY_GOST_LENGTH=64;exports.MINIMUM_FEE=1e5;exports.MINIMUM_ISSUE_FEE=1e8;exports.MINIMUM_MATCHER_FEE=3e5;exports.MINIMUM_DATA_FEE_PER_KB=1e5;exports.TRANSFER_ATTACHMENT_BYTE_LIMIT=140;exports.DEFAULT_MIN_SEED_LENGTH=25;exports.DEFAULT_ORDER_EXPIRATION_DAYS=20;exports.DEFAULT_PAGING_LIMIT=50;exports.DEFAULT_PAGING_OFFSET=0;exports.DEFAULT_BASIC_CONFIG={minimumSeedLength:exports.DEFAULT_MIN_SEED_LENGTH,requestOffset:0,requestLimit:100,logLevel:"warning",timeDiff:0,crypto:"waves"};exports.DEFAULT_MAINNET_CONFIG=__assign({},exports.DEFAULT_BASIC_CONFIG,{networkByte:exports.MAINNET_BYTE,nodeAddress:"https://nodes.wavesplatform.com",matcherAddress:"https://matcher.wavesplatform.com/matcher"});exports.DEFAULT_TESTNET_CONFIG=__assign({},exports.DEFAULT_BASIC_CONFIG,{networkByte:exports.TESTNET_BYTE,nodeAddress:"https://testnet1.wavesnodes.com",matcherAddress:"https://testnet1.wavesnodes.com/matcher"});exports.WAVES_V1_ISSUE_TX={assetId:exports.WAVES,decimals:8,description:"",fee:0,height:0,id:exports.WAVES,name:"Waves",quantity:1e8*Math.pow(10,8),reissuable:false,sender:exports.WAVES,senderPublicKey:"",signature:"",timestamp:14604192e5,type:exports.ISSUE_TX};exports.BROADCAST_PATH="/transactions/broadcast"},{}],20:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});function paddedMessage(message){return"\n"+message+"\n"}function resolveData(data){if(data instanceof Error){return paddedMessage(data.toString())}else if(data){try{return paddedMessage(JSON.stringify(data,null,2))}catch(e){return paddedMessage("Not possible to retrieve error data")}}else{return paddedMessage("No additional data provided")}}var WavesError=function(_super){__extends(WavesError,_super);function WavesError(message,data){var _this=_super.call(this,message+":\n"+resolveData(data))||this;_this.name="WavesError";_this.data=data;if(Error.captureStackTrace){Error.captureStackTrace(_this,WavesError)}return _this}return WavesError}(Error);exports.default=WavesError},{}],21:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var WavesError_1=require("./WavesError");var FAILED_TO_FETCH="Failed to fetch";function normalizeErrorData(data){if(!data.error&&data.message&&data.message.indexOf(FAILED_TO_FETCH)!==-1){return{error:-1,message:"failed to fetch"}}else{return data}}var WavesRequestError=function(_super){__extends(WavesRequestError,_super);function WavesRequestError(url,data){var _this=_super.call(this,"Server request to '"+url+"' has failed",normalizeErrorData(data))||this;_this.name="WavesRequestError";return _this}return WavesRequestError}(WavesError_1.default);exports.default=WavesRequestError},{"./WavesError":20}],22:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var bignumber_js_1=require("bignumber.js");bignumber_js_1.default.config({ROUNDING_MODE:bignumber_js_1.default.ROUND_DOWN});exports.default=bignumber_js_1.default},{"bignumber.js":undefined}],23:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var fetchSubstitute=function(){if(typeof window!=="undefined"){return window.fetch.bind(window)}else if(typeof exports==="object"&&typeof module!=="undefined"){return require("node-fetch")}else if(typeof self!=="undefined"){return self.fetch.bind(self)}else{throw new Error("Your environment is not defined")}}();exports.default=fetchSubstitute},{"node-fetch":undefined}],24:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var signature_generator_1=require("@vostokplatform/signature-generator");var config_1=require("./config");var constants_1=require("./constants");var transactions_1=require("./utils/transactions");var base58ToString_1=require("./utils/base58ToString");exports.default={getAddressFromPublicKey:function(publicKey){var publicKeyBytes=signature_generator_1.libs.base58.decode(publicKey);return config_1.default.isCryptoGost()?signature_generator_1.utils.cryptoGost.buildRawAddress(publicKeyBytes):signature_generator_1.utils.crypto.buildRawAddress(publicKeyBytes)},calculateTimeDiff:function(nodeTime,userTime){return nodeTime-userTime},base58:{encode:signature_generator_1.libs.base58.encode,decode:signature_generator_1.libs.base58.decode,base58ToString:base58ToString_1.base58ToString},getMinimumDataTxFee:function(data){var emptyDataTx=new signature_generator_1.TX_TYPE_MAP.data({authorPublicKey:"11111111111111111111111111111111",senderPublicKey:"11111111111111111111111111111111",timestamp:0,fee:"",data:data});return emptyDataTx.getBytes().then(function(bytes){return Math.ceil(bytes.length/1024)*constants_1.MINIMUM_DATA_FEE_PER_KB})},createTransaction:transactions_1.createTransaction}},{"./config":18,"./constants":19,"./utils/base58ToString":25,"./utils/transactions":28,"@vostokplatform/signature-generator":undefined}],25:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var signature_generator_1=require("@vostokplatform/signature-generator");function base58ToString(base58String){var arr=signature_generator_1.libs.base58.decode(base58String);var str=String.fromCharCode.apply(null,arr);return decodeURIComponent(escape(str))}exports.base58ToString=base58ToString},{"@vostokplatform/signature-generator":undefined}],26:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};Object.defineProperty(exports,"__esModule",{value:true});var signature_generator_1=require("@vostokplatform/signature-generator");var constants_1=require("../constants");var config_1=require("../config");var bignumber_1=require("../libs/bignumber");function normalizeAssetId(original){if(!original||original===constants_1.WAVES){return""}else{return original}}exports.normalizeAssetId=normalizeAssetId;function removeRecipientPrefix(original){if(original.slice(0,8)==="address:"){return original.slice(8)}else{return original}}exports.removeRecipientPrefix=removeRecipientPrefix;function removeAliasPrefix(original){if(original.slice(0,6)==="alias:"){return original.slice(8)}else{return original}}exports.removeAliasPrefix=removeAliasPrefix;function getTimestamp(timestamp){return(timestamp||Date.now())+config_1.default.getTimeDiff()}exports.getTimestamp=getTimestamp;function precisionCheck(precision){return precision>=0&&precision<=8}exports.precisionCheck=precisionCheck;function castFromBytesToBase58(bytes,sliceIndex){var processedBytes=Uint8Array.from(Array.prototype.slice.call(bytes,sliceIndex));return signature_generator_1.libs.base58.encode(processedBytes)}function castFromStringToBase58(str,sliceIndex){var processedBytes=Uint8Array.from(Array.prototype.slice.call(unescape(encodeURIComponent(str)).split("").map(function(e){return e.charCodeAt(0)}),sliceIndex));return signature_generator_1.libs.base58.encode(processedBytes)}function castFromRawToPrefixed(raw){if(raw.length>30){return"address:"+raw}else{var networkCharacter=String.fromCharCode(config_1.default.getNetworkByte());return"alias:"+networkCharacter+":"+raw}}function createRemapper(rules){return function(data){return Object.keys(__assign({},data,rules)).reduce(function(result,key){var rule=rules[key];if(typeof rule==="function"){result[key]=rule(data[key])}else if(typeof rule==="string"){result[rule]=data[key]}else if(rule&&typeof rule==="object"){if(rule.from==="bytes"&&rule.to==="base58"){result[key]=castFromBytesToBase58(data[key],rule.slice||0)}else if(rule.from==="string"&&rule.to==="base58"){result[key]=castFromStringToBase58(data[key],rule.slice||0)}else if(rule.from==="string"&&rule.to==="bignumber"){result[key]=new bignumber_1.default(data[key])}else if(rule.from==="raw"&&rule.to==="prefixed"){if(data[key].length&&data[key][0].recipient){result[rule.path||key]=data[key].map(function(o){return __assign({},o,{amount:new bignumber_1.default(o.amount),recipient:castFromRawToPrefixed(o.recipient)})})}else{result[rule.path||key]=castFromRawToPrefixed(data[key])}}}else if(rule!==null){result[key]=typeof data[key]!=="undefined"?data[key]:rule}return result},Object.create(null))}}exports.createRemapper=createRemapper},{"../config":18,"../constants":19,"../libs/bignumber":22,"@vostokplatform/signature-generator":undefined}],27:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};Object.defineProperty(exports,"__esModule",{value:true});var create=require("parse-json-bignumber");var WavesRequestError_1=require("../errors/WavesRequestError");var fetch_1=require("../libs/fetch");var config_1=require("../config");var bignumber_1=require("../libs/bignumber");var SAFE_JSON_PARSE=create({BigNumber:bignumber_1.default}).parse;var SAFE_JSON_STRINGIFY=create({BigNumber:bignumber_1.default}).stringify;exports.POST_TEMPLATE={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8"}};var key=function(product,version){return product+"/"+version};var hostResolvers=(_a={},_a[key(0,0)]=function(){return config_1.default.getNodeAddress()},_a[key(1,0)]=function(){return config_1.default.getMatcherAddress()},_a);function normalizeHost(host){return host.replace(/\/+$/,"")}exports.normalizeHost=normalizeHost;function normalizePath(path){return("/"+path).replace(/\/+/g,"/").replace(/\/$/,"")}exports.normalizePath=normalizePath;function processJSON(res){if(res.ok){return res.text().then(SAFE_JSON_PARSE)}else{return res.json().then(Promise.reject.bind(Promise))}}exports.processJSON=processJSON;function handleError(url,data){throw new WavesRequestError_1.default(url,data)}function createFetchWrapper(product,version,pipe){var resolveHost=hostResolvers[key(product,version)];return function(path,options){var url=resolveHost()+normalizePath(path);var request=fetch_1.default(url,options);if(pipe){return request.then(pipe).catch(function(data){return handleError(url,data)})}else{return request.catch(function(data){return handleError(url,data)})}}}exports.createFetchWrapper=createFetchWrapper;function wrapTxRequest(SignatureGenerator,preRemapAsync,postRemap,callback,withProofs){if(withProofs===void 0){withProofs=false}return function(data,keyPair){return preRemapAsync(__assign({},data,{senderPublicKey:keyPair.publicKey})).then(function(validatedData){var transaction=new SignatureGenerator(validatedData);return transaction.getSignature(keyPair.privateKey).then(function(signature){return postRemap(__assign({},validatedData,withProofs?{proofs:[signature]}:{signature:signature}))}).then(function(tx){var sendData=__assign({},exports.POST_TEMPLATE,{rejectUnauthorized:false,credentials:"include",body:SAFE_JSON_STRINGIFY(tx,null,null)});console.log(sendData);return callback(sendData)})})}}exports.wrapTxRequest=wrapTxRequest;var _a},{"../config":18,"../errors/WavesRequestError":21,"../libs/bignumber":22,"../libs/fetch":23,"parse-json-bignumber":undefined}],28:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};Object.defineProperty(exports,"__esModule",{value:true});var signature_generator_1=require("@vostokplatform/signature-generator");var txHelpers=require("../api/node/transactions.x");var capitalize=function(name){return name.slice(0,1).toUpperCase()+name.slice(1)};var TransactionWrapper=function(){function TransactionWrapper(signatureGenerator,validatedData,postRemap,proofs){this.signatureGenerator=signatureGenerator;this.validatedData=validatedData;this.postRemap=postRemap;this.proofs=proofs;this._privateKeys=[]}TransactionWrapper.prototype.addProof=function(privateKey){this._privateKeys.push(privateKey);return this};TransactionWrapper.prototype.getJSON=function(){var _this=this;return Promise.all(this._privateKeys.map(function(privateKey){return _this.signatureGenerator.getSignature(privateKey)})).then(function(newProofs){return _this.postRemap(__assign({},_this.validatedData,{proofs:[].concat(_this.proofs,newProofs)}))})};return TransactionWrapper}();exports.createTransaction=function(type,data){var name=capitalize(type);var preRemap=txHelpers["pre"+name];var postRemap=txHelpers["post"+name];if(!preRemap||!postRemap||!signature_generator_1.TX_TYPE_MAP[type]){throw new Error("Unknown transaction type: "+type)}var proofs=data.proofs||[];return preRemap(data).then(function(validatedData){var signatureGenerator=new signature_generator_1.TX_TYPE_MAP[type](validatedData);return new TransactionWrapper(signatureGenerator,validatedData,postRemap,proofs)})}},{"../api/node/transactions.x":15,"@vostokplatform/signature-generator":undefined}]},{},[1])(1)});
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.WavesAPI=f()}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r}()({1:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var signature_generator_1=require("@vostokplatform/signature-generator");var MatcherAPI=require("./api/matcher/index");var index_1=require("./api/node/index");var config_1=require("./config");var constants=require("./constants");var fetch_1=require("./libs/fetch");var tools_1=require("./tools");var request=require("./utils/request");var request_1=require("./utils/request");var WavesAPI=function(){function WavesAPI(params){this.Seed=signature_generator_1.Seed;this.byteProcessors=signature_generator_1.ByteProcessor;this.config=config_1.default;this.constants=constants;this.crypto=signature_generator_1.utils.crypto;this.request=request;this.tools=tools_1.default;var initialConfiguration=params.initialConfiguration,_a=params.fetchInstance,fetchInstance=_a===void 0?request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance:fetch_1.default}):_a;this.API={Node:new index_1.default(request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance:fetchInstance})),Matcher:MatcherAPI};if(this instanceof WavesAPI){this.config.clear();this.config.set(initialConfiguration);if(WavesAPI._instance===null){WavesAPI._instance=this}else{return WavesAPI._instance}}else{return new WavesAPI({initialConfiguration:initialConfiguration,fetchInstance:fetchInstance})}}return WavesAPI}();function create(_a){var initialConfiguration=_a.initialConfiguration,fetchInstance=_a.fetchInstance;return new WavesAPI({initialConfiguration:initialConfiguration,fetchInstance:fetchInstance})}exports.create=create;exports.MAINNET_CONFIG=constants.DEFAULT_MAINNET_CONFIG;exports.TESTNET_CONFIG=constants.DEFAULT_TESTNET_CONFIG},{"./api/matcher/index":2,"./api/node/index":11,"./config":18,"./constants":19,"./libs/fetch":23,"./tools":24,"./utils/request":27,"@vostokplatform/signature-generator":undefined}],2:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var info_1=require("./info");var orderbooks_1=require("./orderbooks");exports.getMatcherKey=info_1.default.getMatcherKey;exports.getOrderbooks=orderbooks_1.default.getOrderbooks;exports.getOrderbook=orderbooks_1.default.getOrderbook;exports.getOrders=orderbooks_1.default.getOrders;exports.getAllOrders=orderbooks_1.default.getAllOrders;exports.createOrder=orderbooks_1.default.createOrder;exports.cancelOrder=orderbooks_1.default.cancelOrder;exports.deleteOrder=orderbooks_1.default.deleteOrder},{"./info":3,"./orderbooks":4}],3:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var fetch_1=require("../../libs/fetch");var request_1=require("../../utils/request");var fetch=request_1.createFetchWrapper({product:1,version:0,pipe:request_1.processJSON,fetchInstance:fetch_1.default});exports.default={getMatcherKey:function(){return fetch("/")}}},{"../../libs/fetch":23,"../../utils/request":27}],4:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};Object.defineProperty(exports,"__esModule",{value:true});var fetch_1=require("../../libs/fetch");var signature_generator_1=require("@vostokplatform/signature-generator");var request_1=require("../../utils/request");var remap_1=require("../../utils/remap");var request_2=require("../../utils/request");var orderbooks_x_1=require("./orderbooks.x");var fetch=request_1.createFetchWrapper({product:1,version:0,pipe:request_1.processJSON,fetchInstance:fetch_1.default});var preCreateOrderAsync=function(data){return orderbooks_x_1.createOrderSchema.parse(data)};var postCreateOrder=function(data){data.assetPair={amountAsset:remap_1.normalizeAssetId(data.amountAsset),priceAsset:remap_1.normalizeAssetId(data.priceAsset)};delete data.amountAsset;delete data.priceAsset;return data};var postCancelOrder=remap_1.createRemapper({senderPublicKey:"sender"});var generateCancelLikeRequest=function(type){return function(amountAssetId,priceAssetId,orderId,keyPair){var data={senderPublicKey:keyPair.publicKey,orderId:orderId};var authData=new signature_generator_1.CANCEL_ORDER_SIGNATURE(data);return authData.getSignature(keyPair.privateKey).then(function(signature){return postCancelOrder(__assign({},data,{signature:signature}))}).then(function(tx){return fetch("/orderbook/"+amountAssetId+"/"+priceAssetId+"/"+type,__assign({},request_2.POST_TEMPLATE,{body:JSON.stringify(tx)}))})}};exports.default={getOrderbooks:function(){return fetch("/orderbook")},getOrderbook:function(assetOne,assetTwo){return fetch("/orderbook/"+assetOne+"/"+assetTwo)},getOrders:function(assetOne,assetTwo,keyPair){var data={senderPublicKey:keyPair.publicKey,timestamp:remap_1.getTimestamp()};var authData=new signature_generator_1.AUTH_ORDER_SIGNATURE(data);return authData.getSignature(keyPair.privateKey).then(function(signature){var preparedData=__assign({},data,{signature:signature});return fetch("/orderbook/"+assetOne+"/"+assetTwo+"/publicKey/"+keyPair.publicKey,{headers:{Timestamp:preparedData.timestamp,Signature:preparedData.signature}})})},getAllOrders:function(keyPair){var data={senderPublicKey:keyPair.publicKey,timestamp:remap_1.getTimestamp()};var authData=new signature_generator_1.AUTH_ORDER_SIGNATURE(data);return authData.getSignature(keyPair.privateKey).then(function(signature){var preparedData=__assign({},data,{signature:signature});return fetch("/orderbook/"+keyPair.publicKey,{headers:{Timestamp:preparedData.timestamp,Signature:preparedData.signature}})})},createOrder:request_1.wrapTxRequest(signature_generator_1.CREATE_ORDER_SIGNATURE,preCreateOrderAsync,postCreateOrder,function(postParams){return fetch("/orderbook",postParams)}),cancelOrder:generateCancelLikeRequest("cancel"),deleteOrder:generateCancelLikeRequest("delete")}},{"../../libs/fetch":23,"../../utils/remap":26,"../../utils/request":27,"./orderbooks.x":5,"@vostokplatform/signature-generator":undefined}],5:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var ts_api_validator_1=require("ts-api-validator");var remap_1=require("../../utils/remap");var constants_1=require("../../constants");var schemaFields_1=require("../schemaFields");exports.createOrderSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,matcherPublicKey:schemaFields_1.default.publicKey,amountAsset:schemaFields_1.default.assetId,priceAsset:schemaFields_1.default.assetId,orderType:{type:ts_api_validator_1.StringPart,required:true,isValid:function(orderType){return orderType==="buy"||orderType==="sell"}},amount:{type:ts_api_validator_1.NumberPart,required:true},price:{type:ts_api_validator_1.NumberPart,required:true},timestamp:schemaFields_1.default.timestamp,expiration:{type:ts_api_validator_1.NumberPart,required:true,parseValue:function(expiration){if(expiration){return remap_1.getTimestamp(expiration)}else{var date=new Date(remap_1.getTimestamp());return date.setDate(date.getDate()+constants_1.DEFAULT_ORDER_EXPIRATION_DAYS)}}},matcherFee:schemaFields_1.default.matcherFee}})},{"../../constants":19,"../../utils/remap":26,"../schemaFields":17,"ts-api-validator":undefined}],6:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var constants_1=require("../../constants");var Addresses=function(){function Addresses(fetchInstance){this.fetch=fetchInstance}Addresses.prototype.balance=function(address,confirmations){if(!confirmations){return this.fetch("/addresses/balance/"+address)}else{return this.fetch("/addresses/balance/"+address+"/"+confirmations)}};Addresses.prototype.balanceDetails=function(address){return this.fetch("/addresses/balance/details/"+address)};Addresses.prototype.data=function(address,offset,limit){if(offset===void 0){offset=constants_1.DEFAULT_PAGING_OFFSET}if(limit===void 0){limit=constants_1.DEFAULT_PAGING_LIMIT}return this.fetch("/addresses/data/"+address+"?offset="+offset+"&limit="+limit)};return Addresses}();exports.default=Addresses},{"../../constants":19}],7:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Aliases=function(){function Aliases(fetchInstance){this.fetch=fetchInstance}Aliases.prototype.byAlias=function(alias){return this.fetch("/alias/by-alias/"+alias)};Aliases.prototype.byAddress=function(address){return this.fetch("/alias/by-address/"+address)};return Aliases}();exports.default=Aliases},{}],8:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var addresses_1=require("./addresses");var constants=require("../../constants");var Assets=function(){function Assets(fetchInstance){this.fetch=fetchInstance;this.addresses=new addresses_1.default(fetchInstance)}Assets.prototype.balances=function(address){return this.fetch("/assets/balance/"+address)};Assets.prototype.balance=function(address,assetId){if(assetId===constants.WAVES){return this.addresses.balance(address)}else{return this.fetch("/assets/balance/"+address+"/"+assetId)}};Assets.prototype.distribution=function(assetId){return this.fetch("/assets/"+assetId+"/distribution")};return Assets}();exports.default=Assets},{"../../constants":19,"./addresses":6}],9:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Blocks=function(){function Blocks(fetchInstance){this.fetch=fetchInstance}Blocks.prototype.get=function(signature){return this.fetch("/blocks/signature/"+signature)};Blocks.prototype.at=function(height){return this.fetch("/blocks/at/"+height)};Blocks.prototype.first=function(){return this.fetch("/blocks/first")};Blocks.prototype.last=function(){return this.fetch("/blocks/last")};Blocks.prototype.height=function(){return this.fetch("/blocks/height")};return Blocks}();exports.default=Blocks},{}],10:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var constants_1=require("../../constants");var Contracts=function(){function Contracts(fetchInstance){this.fetch=fetchInstance}Contracts.prototype.get=function(id,offset,limit){if(offset===void 0){offset=constants_1.DEFAULT_PAGING_OFFSET}if(limit===void 0){limit=constants_1.DEFAULT_PAGING_LIMIT}return this.fetch("/contracts/"+id+"?offset="+offset+"&limit="+limit)};Contracts.prototype.getKey=function(id,key){return this.fetch("/contracts/"+id+"/"+key)};Contracts.prototype.getExecutedTxFor=function(id){return this.fetch("/contracts/executed-tx-for/"+id)};return Contracts}();exports.default=Contracts},{"../../constants":19}],11:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var addresses_1=require("./addresses");var aliases_1=require("./aliases");var assets_1=require("./assets");var blocks_1=require("./blocks");var contracts_1=require("./contracts");var leasing_1=require("./leasing");var transactions_1=require("./transactions");var peers_1=require("./peers");var utils_1=require("./utils");var NodeAPI=function(){function NodeAPI(fetchInstance){this.addresses=new addresses_1.default(fetchInstance);this.aliases=new aliases_1.default(fetchInstance);this.assets=new assets_1.default(fetchInstance);this.blocks=new blocks_1.default(fetchInstance);this.contracts=new contracts_1.default(fetchInstance);this.leasing=new leasing_1.default(fetchInstance);this.transactions=new transactions_1.default(fetchInstance);this.peers=new peers_1.default(fetchInstance);this.utils=new utils_1.default(fetchInstance)}return NodeAPI}();exports.default=NodeAPI},{"./addresses":6,"./aliases":7,"./assets":8,"./blocks":9,"./contracts":10,"./leasing":12,"./peers":13,"./transactions":14,"./utils":16}],12:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Leasing=function(){function Leasing(fetchInstance){this.fetch=fetchInstance}Leasing.prototype.getAllActiveLeases=function(address){return this.fetch("/leasing/active/"+address).then(function(list){return list.map(function(tx){tx.status="active";return tx})})};return Leasing}();exports.default=Leasing},{}],13:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Peers=function(){function Peers(fetchInstance){this.fetch=fetchInstance}Peers.prototype.connected=function(){return this.fetch("/peers/connected")};return Peers}();exports.default=Peers},{}],14:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};Object.defineProperty(exports,"__esModule",{value:true});var request_1=require("../../utils/request");var WavesError_1=require("../../errors/WavesError");var constants=require("../../constants");var config_1=require("../../config");var requests=require("./transactions.x");var Transactions=function(){function Transactions(fetchInstance){this.fetch=fetchInstance}Transactions.prototype.get=function(id){if(id===constants.WAVES){return Promise.resolve(constants.WAVES_V1_ISSUE_TX)}else{return this.fetch("/transactions/info/"+id)}};Transactions.prototype.getList=function(address,limit){if(limit===void 0){limit=config_1.default.getRequestParams().limit}return this.fetch("/transactions/address/"+address+"/limit/"+limit).then(function(array){return array[0]})};Transactions.prototype.utxSize=function(){return this.fetch("/transactions/unconfirmed/size")};Transactions.prototype.utxGet=function(id){return this.fetch("/transactions/unconfirmed/info/"+id)};Transactions.prototype.utxGetList=function(){return this.fetch("/transactions/unconfirmed")};Transactions.prototype.broadcast=function(type,data,keys){switch(type){case constants.ISSUE_TX_NAME:return requests.sendIssueTx(data,keys);case constants.TRANSFER_TX_NAME:return requests.sendTransferTx(data,keys);case constants.REISSUE_TX_NAME:return requests.sendReissueTx(data,keys);case constants.BURN_TX_NAME:return requests.sendBurnTx(data,keys);case constants.LEASE_TX_NAME:return requests.sendLeaseTx(data,keys);case constants.CANCEL_LEASING_TX_NAME:return requests.sendCancelLeasingTx(data,keys);case constants.CREATE_ALIAS_TX_NAME:return requests.sendCreateAliasTx(data,keys);case constants.MASS_TRANSFER_TX_NAME:return requests.sendMassTransferTx(data,keys);case constants.DATA_TX_NAME:return requests.sendDataTx(data,keys);case constants.SET_SCRIPT_TX_NAME:return requests.sendSetScriptTx(data,keys);case constants.SPONSORSHIP_TX_NAME:return requests.sendSponsorshipTx(data,keys);case constants.PERMISSION_TX_NAME:return requests.sendPermissionTx(data,keys);case constants.DOCKER_CREATE_TX_NAME:return requests.sendDockerCreateTx(data,keys);case constants.DOCKER_CALL_TX_NAME:return requests.sendDockerCallTx(data,keys);case constants.DOCKER_DISABLE_TX_NAME:return requests.sendDockerDisableTx(data,keys);case constants.POLICY_REGISTER_NODE_TX_NAME:return requests.sendNodeRegistry(data,keys);case constants.POLICY_CREATE_TX_NAME:return requests.sendPolicyCreate(data,keys);case constants.POLICY_UPDATE_TX_NAME:return requests.sendPolicyUpdate(data,keys);default:throw new WavesError_1.default("Wrong transaction type: "+type,data)}};Transactions.prototype.sign=function(type,data,keys){switch(type){case constants.ISSUE_TX_NAME:return requests.sendSignedIssueTx(data,keys);case constants.TRANSFER_TX_NAME:return requests.sendSignedTransferTx(data,keys);case constants.REISSUE_TX_NAME:return requests.sendSignedReissueTx(data,keys);case constants.BURN_TX_NAME:return requests.sendSignedBurnTx(data,keys);case constants.LEASE_TX_NAME:return requests.sendSignedLeaseTx(data,keys);case constants.CANCEL_LEASING_TX_NAME:return requests.sendSignedCancelLeasingTx(data,keys);case constants.CREATE_ALIAS_TX_NAME:return requests.sendSignedCreateAliasTx(data,keys);case constants.MASS_TRANSFER_TX_NAME:return requests.sendSignedMassTransferTx(data,keys);case constants.DATA_TX_NAME:return requests.sendSignedDataTx(data,keys);case constants.SET_SCRIPT_TX_NAME:return requests.sendSignedSetScriptTx(data,keys);case constants.SPONSORSHIP_TX_NAME:return requests.sendSignedSponsorshipTx(data,keys);case constants.PERMISSION_TX_NAME:return requests.sendSignedPermissionTx(data,keys);case constants.DOCKER_CREATE_TX_NAME:return requests.sendSignedDockerCreateTx(data,keys);case constants.DOCKER_CALL_TX_NAME:return requests.sendSignedDockerCallTx(data,keys);case constants.DOCKER_DISABLE_TX_NAME:return requests.sendSignedDockerDisableTx(data,keys);case constants.POLICY_REGISTER_NODE_TX_NAME:return requests.signNodeRegistry(data,keys);case constants.POLICY_CREATE_TX_NAME:return requests.signPolicyCreate(data,keys);case constants.POLICY_UPDATE_TX_NAME:return requests.signPolicyUpdate(data,keys);default:throw new WavesError_1.default("Wrong transaction type: "+type,data)}};Transactions.prototype.rawBroadcast=function(data){return this.fetch(constants.BROADCAST_PATH,__assign({},request_1.POST_TEMPLATE,{body:JSON.stringify(data)}))};Transactions.prototype.signOnNode=function(data){return this.fetch("/transactions/sign")};return Transactions}();exports.default=Transactions},{"../../config":18,"../../constants":19,"../../errors/WavesError":20,"../../utils/request":27,"./transactions.x":15}],15:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};Object.defineProperty(exports,"__esModule",{value:true});var fetch_1=require("../../libs/fetch");var ts_api_validator_1=require("ts-api-validator");var signature_generator_1=require("@vostokplatform/signature-generator");var schemaFields_1=require("../schemaFields");var remap_1=require("../../utils/remap");var request_1=require("../../utils/request");var constants=require("../../constants");var config_1=require("../../config");var bignumber_1=require("../../libs/bignumber");var fetch=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance:fetch_1.default});var AnyPart=function(_super){__extends(AnyPart,_super);function AnyPart(){return _super!==null&&_super.apply(this,arguments)||this}AnyPart.prototype.getValue=function(data){return data};return AnyPart}(ts_api_validator_1.BasePart);function getSignedTx(data){return{data:new Promise(function(resolve){resolve(JSON.parse(data.body))})}}exports.issueSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,name:{type:ts_api_validator_1.StringPart,required:true},description:{type:ts_api_validator_1.StringPart,required:false,defaultValue:""},script:{type:ts_api_validator_1.StringPart,required:false,defaultValue:"base64:AQa3b8tH"},quantity:{type:ts_api_validator_1.StringPart,required:true},precision:{type:ts_api_validator_1.NumberPart,required:true,isValid:remap_1.precisionCheck},reissuable:schemaFields_1.default.reissuable,fee:schemaFields_1.default.issueFee,timestamp:schemaFields_1.default.timestamp,chainId:{type:ts_api_validator_1.NumberPart,required:true,parseValue:function(){return config_1.default.getNetworkByte()}}}});exports.preIssue=function(data){return exports.issueSchema.parse(data)};exports.postIssue=remap_1.createRemapper({transactionType:null,precision:"decimals",type:constants.ISSUE_TX,version:constants.ISSUE_TX_VERSION,quantity:{from:"string",to:"bignumber"}});exports.sendIssueTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.issue,exports.preIssue,exports.postIssue,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedIssueTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.issue,exports.preIssue,exports.postIssue,function(postParams){return getSignedTx(postParams).data},true);exports.transferSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,recipient:schemaFields_1.default.recipient,assetId:schemaFields_1.default.assetId,amount:{type:ts_api_validator_1.StringPart,required:true},feeAssetId:{type:ts_api_validator_1.StringPart,required:false,defaultValue:constants.WAVES},fee:schemaFields_1.default.fee,attachment:{type:ts_api_validator_1.StringPart,required:false,defaultValue:""},timestamp:schemaFields_1.default.timestamp}});exports.preTransfer=function(data){return exports.transferSchema.parse(data)};exports.postTransfer=remap_1.createRemapper({transactionType:null,assetId:remap_1.normalizeAssetId,feeAssetId:remap_1.normalizeAssetId,attachment:{from:"string",to:"base58"},recipient:{from:"raw",to:"prefixed"},amount:{from:"string",to:"bignumber"},type:constants.TRANSFER_TX,version:constants.TRANSFER_TX_VERSION});exports.sendTransferTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.transfer,exports.preTransfer,exports.postTransfer,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedTransferTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.transfer,exports.preTransfer,exports.postTransfer,function(postParams){return getSignedTx(postParams).data},true);exports.reissueSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,assetId:schemaFields_1.default.assetId,quantity:{type:ts_api_validator_1.StringPart,required:true},reissuable:schemaFields_1.default.reissuable,fee:schemaFields_1.default.issueFee,timestamp:schemaFields_1.default.timestamp,chainId:{type:ts_api_validator_1.NumberPart,required:true,parseValue:function(){return config_1.default.getNetworkByte()}}}});exports.preReissue=function(data){return exports.reissueSchema.parse(data)};exports.postReissue=remap_1.createRemapper({transactionType:null,type:constants.REISSUE_TX,version:constants.REISSUE_TX_VERSION,quantity:{from:"string",to:"bignumber"}});exports.sendReissueTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.reissue,exports.preReissue,exports.postReissue,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedReissueTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.reissue,exports.preReissue,exports.postReissue,function(postParams){return getSignedTx(postParams).data},true);exports.burnSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,assetId:schemaFields_1.default.assetId,quantity:{type:ts_api_validator_1.StringPart,required:true},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp,chainId:{type:ts_api_validator_1.NumberPart,required:true,parseValue:function(){return config_1.default.getNetworkByte()}}}});exports.preBurn=function(data){return exports.burnSchema.parse(data)};exports.postBurn=remap_1.createRemapper({transactionType:null,type:constants.BURN_TX,version:constants.BURN_TX_VERSION,quantity:{from:"string",to:"bignumber"}});exports.sendBurnTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.burn,exports.preBurn,exports.postBurn,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedBurnTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.burn,exports.preBurn,exports.postBurn,function(postParams){return getSignedTx(postParams).data},true);exports.leaseSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,recipient:schemaFields_1.default.recipient,amount:{type:ts_api_validator_1.NumberPart,required:true},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp}});exports.preLease=function(data){return exports.leaseSchema.parse(data)};exports.postLease=remap_1.createRemapper({transactionType:null,recipient:{from:"raw",to:"prefixed"},type:constants.LEASE_TX,version:constants.LEASE_TX_VERSION});exports.sendLeaseTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.lease,exports.preLease,exports.postLease,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedLeaseTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.lease,exports.preLease,exports.postLease,function(postParams){return getSignedTx(postParams).data},true);exports.cancelLeasingSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,leaseId:{type:ts_api_validator_1.StringPart,required:true},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp,chainId:{type:ts_api_validator_1.NumberPart,required:true,parseValue:function(){return config_1.default.getNetworkByte()}}}});exports.preCancelLeasing=function(data){return exports.cancelLeasingSchema.parse(data)};exports.postCancelLeasing=remap_1.createRemapper({transactionType:null,transactionId:"txId",type:constants.CANCEL_LEASING_TX,version:constants.CANCEL_LEASING_TX_VERSION});exports.sendCancelLeasingTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.cancelLeasing,exports.preCancelLeasing,exports.postCancelLeasing,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedCancelLeasingTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.cancelLeasing,exports.preCancelLeasing,exports.postCancelLeasing,function(postParams){return getSignedTx(postParams).data},true);exports.createAliasSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,alias:{type:ts_api_validator_1.StringPart,required:true,parseValue:remap_1.removeAliasPrefix},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp}});exports.preCreateAlias=function(data){return exports.createAliasSchema.parse(data)};exports.postCreateAlias=remap_1.createRemapper({transactionType:null,type:constants.CREATE_ALIAS_TX,version:constants.CREATE_ALIAS_TX_VERSION});exports.sendCreateAliasTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.createAlias,exports.preCreateAlias,exports.postCreateAlias,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedCreateAliasTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.createAlias,exports.preCreateAlias,exports.postCreateAlias,function(postParams){return getSignedTx(postParams).data},true);exports.massTransferSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,assetId:schemaFields_1.default.assetId,transfers:{type:ts_api_validator_1.ArrayPart,content:{type:ts_api_validator_1.ObjectPart,required:true,content:{recipient:schemaFields_1.default.recipient,amount:{type:ts_api_validator_1.StringPart,required:true}}},defaultValue:[]},timestamp:schemaFields_1.default.timestamp,fee:schemaFields_1.default.fee,attachment:{type:ts_api_validator_1.StringPart,required:false,defaultValue:""}}});exports.preMassTransfer=function(data){return exports.massTransferSchema.parse(data)};exports.postMassTransfer=remap_1.createRemapper({transactionType:null,assetId:remap_1.normalizeAssetId,attachment:{from:"string",to:"base58"},transfers:{from:"raw",to:"prefixed",path:"transfers"},type:constants.MASS_TRANSFER_TX,version:constants.MASS_TRANSFER_TX_VERSION});exports.sendMassTransferTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.massTransfer,exports.preMassTransfer,exports.postMassTransfer,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedMassTransferTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.massTransfer,exports.preMassTransfer,exports.postMassTransfer,function(postParams){return getSignedTx(postParams).data},true);exports.dataSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,authorPublicKey:schemaFields_1.default.publicKey,data:{type:ts_api_validator_1.ArrayPart,content:{type:ts_api_validator_1.ObjectPart,required:true,content:{type:{type:ts_api_validator_1.StringPart,required:true},key:{type:ts_api_validator_1.StringPart,required:true},value:{type:AnyPart,required:true}}},defaultValue:[]},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp}});exports.preData=function(data){return exports.dataSchema.parse(data)};exports.postData=function(d){var data=JSON.parse(JSON.stringify(d.data));data.forEach(function(e){if(e.type==="integer"&&typeof e.value==="string"){e.value=new bignumber_1.default(e.value)}return e});var result=__assign({},d,{data:data,transactionType:null,type:constants.DATA_TX,version:constants.DATA_TX_VERSION});return result};exports.sendDataTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.data,exports.preData,exports.postData,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedDataTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.data,exports.preData,exports.postData,function(postParams){return getSignedTx(postParams).data},true);exports.setScriptSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{name:{type:ts_api_validator_1.StringPart,required:true},description:{type:ts_api_validator_1.StringPart,required:false,defaultValue:""},senderPublicKey:schemaFields_1.default.publicKey,script:{type:ts_api_validator_1.StringPart,required:true},chainId:{type:ts_api_validator_1.NumberPart,required:true,parseValue:function(){return config_1.default.getNetworkByte()}},timestamp:schemaFields_1.default.timestamp,fee:schemaFields_1.default.fee}});exports.preSetScript=function(data){return exports.setScriptSchema.parse(data)};exports.postSetScript=remap_1.createRemapper({transactionType:null,type:constants.SET_SCRIPT_TX,version:constants.SET_SCRIPT_TX_VERSION});exports.sendSetScriptTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.setScript,exports.preSetScript,exports.postSetScript,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedSetScriptTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.setScript,exports.preSetScript,exports.postSetScript,function(postParams){return getSignedTx(postParams).data},true);exports.sponsorshipSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,assetId:schemaFields_1.default.assetId,minSponsoredAssetFee:{type:ts_api_validator_1.NumberPart,required:true},timestamp:schemaFields_1.default.timestamp,fee:schemaFields_1.default.fee}});exports.preSponsorship=function(data){return exports.sponsorshipSchema.parse(data)};exports.postSponsorship=remap_1.createRemapper({transactionType:null,type:constants.SPONSORSHIP_TX,version:constants.SPONSORSHIP_TX_VERSION});exports.sendSponsorshipTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.sponsorship,exports.preSponsorship,exports.postSponsorship,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedSponsorshipTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.sponsorship,exports.preSponsorship,exports.postSponsorship,function(postParams){return getSignedTx(postParams).data},true);exports.permissionSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,timestamp:schemaFields_1.default.timestamp,opType:{type:ts_api_validator_1.StringPart,required:true},role:{type:ts_api_validator_1.StringPart,required:true},target:{type:ts_api_validator_1.StringPart,required:true},dueTimestamp:{type:ts_api_validator_1.NumberPart,required:false},fee:schemaFields_1.default.fee}});exports.prePermit=function(data){return exports.permissionSchema.parse(data)};exports.postPermit=remap_1.createRemapper({transactionType:null,type:constants.PERMISSION_TX,version:constants.PERMISSION_TX_VERSION});exports.sendPermissionTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.permit,exports.prePermit,exports.postPermit,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.sendSignedPermissionTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.permit,exports.prePermit,exports.postPermit,function(postParams){return getSignedTx(postParams).data},true);exports.dockerCreateSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,image:{type:ts_api_validator_1.StringPart,required:true},imageHash:{type:ts_api_validator_1.StringPart,required:true},contractName:{type:ts_api_validator_1.StringPart,required:true},params:{type:ts_api_validator_1.ArrayPart,content:{type:ts_api_validator_1.ObjectPart,required:true,content:{type:{type:ts_api_validator_1.StringPart,required:true},key:{type:ts_api_validator_1.StringPart,required:true},value:{type:AnyPart,required:true}}},defaultValue:[]},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp}});exports.preDockerCreate=function(data){return exports.dockerCreateSchema.parse(data)};exports.postDockerCreate=function(d){var data=JSON.parse(JSON.stringify(d.params));data.forEach(function(e){if(e.type==="integer"&&typeof e.value==="string"){e.value=new bignumber_1.default(e.value)}return e});var result=__assign({},d,{params:data,transactionType:null,type:constants.DOCKER_CREATE_TX,version:constants.DOCKER_CREATE_TX_VERSION});return result};exports.sendSignedDockerCreateTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.dockerCreate,exports.preDockerCreate,exports.postDockerCreate,function(postParams){return getSignedTx(postParams).data},true);exports.sendDockerCreateTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.dockerCreate,exports.preDockerCreate,exports.postDockerCreate,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.dockerCallSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,authorPublicKey:schemaFields_1.default.publicKey,contractId:{type:ts_api_validator_1.StringPart,required:true},params:{type:ts_api_validator_1.ArrayPart,content:{type:ts_api_validator_1.ObjectPart,required:true,content:{type:{type:ts_api_validator_1.StringPart,required:true},key:{type:ts_api_validator_1.StringPart,required:true},value:{type:AnyPart,required:true}}},defaultValue:[]},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp}});exports.preDockerCall=function(data){return exports.dockerCallSchema.parse(data)};exports.postDockerCall=function(d){var data=JSON.parse(JSON.stringify(d.params));data.forEach(function(e){if(e.type==="integer"&&typeof e.value==="string"){e.value=new bignumber_1.default(e.value)}return e});var result=__assign({},d,{params:data,transactionType:null,type:constants.DOCKER_CALL_TX,version:constants.DOCKER_CALL_TX_VERSION});return result};exports.sendSignedDockerCallTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.dockerCall,exports.preDockerCall,exports.postDockerCall,function(postParams){return getSignedTx(postParams).data},true);exports.sendDockerCallTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.dockerCall,exports.preDockerCall,exports.postDockerCall,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.dockerDisableSchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,contractId:{type:ts_api_validator_1.StringPart,required:true},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp}});exports.preDockerDisable=function(data){return exports.dockerDisableSchema.parse(data)};exports.postDockerDisable=function(d){return __assign({},d,{transactionType:null,type:constants.DOCKER_DISABLE_TX,version:constants.DOCKER_DISABLE_TX_VERSION})};exports.sendSignedDockerDisableTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.dockerDisable,exports.preDockerDisable,exports.postDockerDisable,function(postParams){return getSignedTx(postParams).data},true);exports.sendDockerDisableTx=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.dockerDisable,exports.preDockerDisable,exports.postDockerDisable,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.nodeRegistrySchema=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,targetPubKey:schemaFields_1.default.publicKey,nodeName:{type:ts_api_validator_1.StringPart,required:true},opType:{type:ts_api_validator_1.StringPart,required:true},timestamp:schemaFields_1.default.timestamp,fee:schemaFields_1.default.fee}});exports.preNodeRegistry=function(data){return exports.nodeRegistrySchema.parse(data)};exports.postNodeRegistry=function(d){return __assign({},d,{transactionType:null,type:constants.POLICY_REGISTER_NODE_TX,version:constants.POLICY_REGISTER_NODE_TX_VERSION})};exports.signNodeRegistry=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.policyRegisterNode,exports.preNodeRegistry,exports.postNodeRegistry,function(postParams){return getSignedTx(postParams).data},true);exports.sendNodeRegistry=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.policyRegisterNode,exports.preNodeRegistry,exports.postNodeRegistry,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.policyCreateScheme=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,policyName:{type:ts_api_validator_1.StringPart,required:true},description:{type:ts_api_validator_1.StringPart,required:true},recipients:{type:ts_api_validator_1.ArrayPart,content:{type:ts_api_validator_1.StringPart,required:true},defaultValue:[]},owners:{type:ts_api_validator_1.ArrayPart,content:{type:ts_api_validator_1.StringPart,required:true},defaultValue:[]},timestamp:schemaFields_1.default.timestamp,fee:schemaFields_1.default.fee}});exports.prePolicyCreate=function(data){return exports.policyCreateScheme.parse(data)};exports.postPolicyCreate=function(d){return __assign({},d,{transactionType:null,type:constants.POLICY_CREATE_TX,version:constants.POLICY_CREATE_TX_VERSION})};exports.signPolicyCreate=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.policyCreate,exports.prePolicyCreate,exports.postPolicyCreate,function(postParams){return getSignedTx(postParams).data},true);exports.sendPolicyCreate=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.policyCreate,exports.prePolicyCreate,exports.postPolicyCreate,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true);exports.policyUpdateScheme=new ts_api_validator_1.Schema({type:ts_api_validator_1.ObjectPart,required:true,content:{senderPublicKey:schemaFields_1.default.publicKey,policyId:{type:ts_api_validator_1.StringPart,required:true},recipients:{type:ts_api_validator_1.ArrayPart,content:{type:ts_api_validator_1.StringPart,required:true},defaultValue:[]},owners:{type:ts_api_validator_1.ArrayPart,content:{type:ts_api_validator_1.StringPart,required:true},defaultValue:[]},opType:{type:ts_api_validator_1.StringPart,required:true},timestamp:schemaFields_1.default.timestamp,fee:schemaFields_1.default.fee}});exports.preUpdateCreate=function(data){return exports.policyUpdateScheme.parse(data)};exports.postUpdateCreate=function(d){return __assign({},d,{transactionType:null,type:constants.POLICY_UPDATE_TX,version:constants.POLICY_UPDATE_TX_VERSION})};exports.signPolicyUpdate=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.policyUpdate,exports.preUpdateCreate,exports.postUpdateCreate,function(postParams){return getSignedTx(postParams).data},true);exports.sendPolicyUpdate=request_1.wrapTxRequest(signature_generator_1.TX_TYPE_MAP.policyUpdate,exports.preUpdateCreate,exports.postUpdateCreate,function(postParams){return fetch(constants.BROADCAST_PATH,postParams)},true)},{"../../config":18,"../../constants":19,"../../libs/bignumber":22,"../../libs/fetch":23,"../../utils/remap":26,"../../utils/request":27,"../schemaFields":17,"@vostokplatform/signature-generator":undefined,"ts-api-validator":undefined}],16:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Utils=function(){function Utils(fetchInstance){this.script={compile:function(code){return this.fetch("/utils/script/compile",{method:"POST",body:code}).then(function(response){return response.script})}};this.fetch=fetchInstance}Utils.prototype.time=function(){return this.fetch("/utils/time").then(function(t){return t.system})};return Utils}();exports.default=Utils},{}],17:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var ts_api_validator_1=require("ts-api-validator");var remap_1=require("../utils/remap");var constants=require("../constants");exports.default={publicKey:{type:ts_api_validator_1.StringPart,required:true},assetId:{type:ts_api_validator_1.StringPart,required:true},fee:{type:ts_api_validator_1.NumberPart,required:false,defaultValue:constants.MINIMUM_FEE},issueFee:{type:ts_api_validator_1.NumberPart,required:false,defaultValue:constants.MINIMUM_ISSUE_FEE},matcherFee:{type:ts_api_validator_1.NumberPart,required:false,defaultValue:constants.MINIMUM_MATCHER_FEE},recipient:{type:ts_api_validator_1.StringPart,required:true,parseValue:remap_1.removeRecipientPrefix},reissuable:{type:ts_api_validator_1.BooleanPart,required:false,defaultValue:false},timestamp:{type:ts_api_validator_1.NumberPart,required:true,parseValue:remap_1.getTimestamp}}},{"../constants":19,"../utils/remap":26,"ts-api-validator":undefined}],18:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};Object.defineProperty(exports,"__esModule",{value:true});var signature_generator_1=require("@vostokplatform/signature-generator");var constants_1=require("./constants");var request_1=require("./utils/request");var config=Object.create(null);function checkRequiredFields(conf){if(!conf.networkByte)throw new Error("Missing network byte");if(!conf.nodeAddress)throw new Error("Missing node address");if(!conf.matcherAddress)throw new Error("Missing matcher address")}exports.default={getNetworkByte:function(){return config.networkByte},getNodeAddress:function(){return config.nodeAddress},isCryptoGost:function(){return config.crypto==="gost"},getMatcherAddress:function(){return config.matcherAddress},getMinimumSeedLength:function(){return config.minimumSeedLength},getRequestParams:function(){return{offset:config.requestOffset,limit:config.requestLimit}},getAssetFactory:function(){return config.assetFactory},getLogLevel:function(){return config.logLevel},getTimeDiff:function(){return config.timeDiff},get:function(){return __assign({},config)},set:function(newConfig){signature_generator_1.config.set(newConfig);if(Object.keys(config).length===0){newConfig=__assign({},constants_1.DEFAULT_BASIC_CONFIG,newConfig)}Object.keys(newConfig).forEach(function(key){switch(key){case"nodeAddress":case"matcherAddress":config[key]=request_1.normalizeHost(newConfig[key]);break;default:config[key]=newConfig[key];break}});checkRequiredFields(config)},clear:function(){Object.keys(config).forEach(function(key){delete config[key]})}}},{"./constants":19,"./utils/request":27,"@vostokplatform/signature-generator":undefined}],19:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};Object.defineProperty(exports,"__esModule",{value:true});exports.WAVES="WAVES";exports.MAINNET_BYTE="D".charCodeAt(0);exports.TESTNET_BYTE="D".charCodeAt(0);exports.INITIAL_NONCE=0;exports.ADDRESS_BYTE=1;exports.ALIAS_BYTE=2;exports.ISSUE_TX=3;exports.TRANSFER_TX=4;exports.REISSUE_TX=5;exports.BURN_TX=6;exports.EXCHANGE_TX=7;exports.LEASE_TX=8;exports.CANCEL_LEASING_TX=9;exports.CREATE_ALIAS_TX=10;exports.MASS_TRANSFER_TX=11;exports.DATA_TX=12;exports.SET_SCRIPT_TX=13;exports.SPONSORSHIP_TX=14;exports.PERMISSION_TX=102;exports.DOCKER_CREATE_TX=103;exports.DOCKER_CALL_TX=104;exports.DOCKER_DISABLE_TX=106;exports.POLICY_REGISTER_NODE_TX=111;exports.POLICY_CREATE_TX=112;exports.POLICY_UPDATE_TX=113;exports.ISSUE_TX_VERSION=2;exports.TRANSFER_TX_VERSION=2;exports.REISSUE_TX_VERSION=2;exports.BURN_TX_VERSION=2;exports.EXCHANGE_TX_VERSION=2;exports.LEASE_TX_VERSION=2;exports.CANCEL_LEASING_TX_VERSION=2;exports.CREATE_ALIAS_TX_VERSION=2;exports.MASS_TRANSFER_TX_VERSION=1;exports.DATA_TX_VERSION=1;exports.SET_SCRIPT_TX_VERSION=1;exports.SPONSORSHIP_TX_VERSION=1;exports.PERMISSION_TX_VERSION=1;exports.DOCKER_CREATE_TX_VERSION=1;exports.DOCKER_CALL_TX_VERSION=1;exports.DOCKER_DISABLE_TX_VERSION=1;exports.POLICY_REGISTER_NODE_TX_VERSION=1;exports.POLICY_CREATE_TX_VERSION=1;exports.POLICY_UPDATE_TX_VERSION=1;exports.ISSUE_TX_NAME="issue";exports.TRANSFER_TX_NAME="transfer";exports.REISSUE_TX_NAME="reissue";exports.BURN_TX_NAME="burn";exports.EXCHANGE_TX_NAME="exchange";exports.LEASE_TX_NAME="lease";exports.CANCEL_LEASING_TX_NAME="cancelLeasing";exports.CREATE_ALIAS_TX_NAME="createAlias";exports.MASS_TRANSFER_TX_NAME="massTransfer";exports.DATA_TX_NAME="data";exports.SET_SCRIPT_TX_NAME="setScript";exports.SPONSORSHIP_TX_NAME="sponsorship";exports.PERMISSION_TX_NAME="permit";exports.DOCKER_CREATE_TX_NAME="dockerCreate";exports.DOCKER_CALL_TX_NAME="dockerCall";exports.DOCKER_DISABLE_TX_NAME="dockerDisable";exports.POLICY_REGISTER_NODE_TX_NAME="policyRegisterNode";exports.POLICY_CREATE_TX_NAME="policyCreate";exports.POLICY_UPDATE_TX_NAME="policyUpdate";exports.PRIVATE_KEY_LENGTH=32;exports.PUBLIC_KEY_LENGTH=32;exports.PUBLIC_KEY_GOST_LENGTH=64;exports.MINIMUM_FEE=1e5;exports.MINIMUM_ISSUE_FEE=1e8;exports.MINIMUM_MATCHER_FEE=3e5;exports.MINIMUM_DATA_FEE_PER_KB=1e5;exports.TRANSFER_ATTACHMENT_BYTE_LIMIT=140;exports.DEFAULT_MIN_SEED_LENGTH=25;exports.DEFAULT_ORDER_EXPIRATION_DAYS=20;exports.DEFAULT_PAGING_LIMIT=50;exports.DEFAULT_PAGING_OFFSET=0;exports.DEFAULT_BASIC_CONFIG={minimumSeedLength:exports.DEFAULT_MIN_SEED_LENGTH,requestOffset:0,requestLimit:100,logLevel:"warning",timeDiff:0,crypto:"waves"};exports.DEFAULT_MAINNET_CONFIG=__assign({},exports.DEFAULT_BASIC_CONFIG,{networkByte:exports.MAINNET_BYTE,nodeAddress:"https://nodes.wavesplatform.com",matcherAddress:"https://matcher.wavesplatform.com/matcher"});exports.DEFAULT_TESTNET_CONFIG=__assign({},exports.DEFAULT_BASIC_CONFIG,{networkByte:exports.TESTNET_BYTE,nodeAddress:"https://testnet1.wavesnodes.com",matcherAddress:"https://testnet1.wavesnodes.com/matcher"});exports.WAVES_V1_ISSUE_TX={assetId:exports.WAVES,decimals:8,description:"",fee:0,height:0,id:exports.WAVES,name:"Waves",quantity:1e8*Math.pow(10,8),reissuable:false,sender:exports.WAVES,senderPublicKey:"",signature:"",timestamp:14604192e5,type:exports.ISSUE_TX};exports.BROADCAST_PATH="/transactions/broadcast"},{}],20:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});function paddedMessage(message){return"\n"+message+"\n"}function resolveData(data){if(data instanceof Error){return paddedMessage(data.toString())}else if(data){try{return paddedMessage(JSON.stringify(data,null,2))}catch(e){return paddedMessage("Not possible to retrieve error data")}}else{return paddedMessage("No additional data provided")}}var WavesError=function(_super){__extends(WavesError,_super);function WavesError(message,data){var _this=_super.call(this,message+":\n"+resolveData(data))||this;_this.name="WavesError";_this.data=data;if(Error.captureStackTrace){Error.captureStackTrace(_this,WavesError)}return _this}return WavesError}(Error);exports.default=WavesError},{}],21:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var WavesError_1=require("./WavesError");var FAILED_TO_FETCH="Failed to fetch";function normalizeErrorData(data){if(!data.error&&data.message&&data.message.indexOf(FAILED_TO_FETCH)!==-1){return{error:-1,message:"failed to fetch"}}else{return data}}var WavesRequestError=function(_super){__extends(WavesRequestError,_super);function WavesRequestError(url,data){var _this=_super.call(this,"Server request to '"+url+"' has failed",normalizeErrorData(data))||this;_this.name="WavesRequestError";return _this}return WavesRequestError}(WavesError_1.default);exports.default=WavesRequestError},{"./WavesError":20}],22:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var bignumber_js_1=require("bignumber.js");bignumber_js_1.default.config({ROUNDING_MODE:bignumber_js_1.default.ROUND_DOWN});exports.default=bignumber_js_1.default},{"bignumber.js":undefined}],23:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var fetchSubstitute=function(){if(typeof window!=="undefined"){return window.fetch.bind(window)}else if(typeof exports==="object"&&typeof module!=="undefined"){return require("node-fetch")}else if(typeof self!=="undefined"){return self.fetch.bind(self)}else{throw new Error("Your environment is not defined")}}();exports.default=fetchSubstitute},{"node-fetch":undefined}],24:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var signature_generator_1=require("@vostokplatform/signature-generator");var config_1=require("./config");var constants_1=require("./constants");var transactions_1=require("./utils/transactions");var base58ToString_1=require("./utils/base58ToString");exports.default={getAddressFromPublicKey:function(publicKey){var publicKeyBytes=signature_generator_1.libs.base58.decode(publicKey);return config_1.default.isCryptoGost()?signature_generator_1.utils.cryptoGost.buildRawAddress(publicKeyBytes):signature_generator_1.utils.crypto.buildRawAddress(publicKeyBytes)},calculateTimeDiff:function(nodeTime,userTime){return nodeTime-userTime},base58:{encode:signature_generator_1.libs.base58.encode,decode:signature_generator_1.libs.base58.decode,base58ToString:base58ToString_1.base58ToString},getMinimumDataTxFee:function(data){var emptyDataTx=new signature_generator_1.TX_TYPE_MAP.data({authorPublicKey:"11111111111111111111111111111111",senderPublicKey:"11111111111111111111111111111111",timestamp:0,fee:"",data:data});return emptyDataTx.getBytes().then(function(bytes){return Math.ceil(bytes.length/1024)*constants_1.MINIMUM_DATA_FEE_PER_KB})},createTransaction:transactions_1.createTransaction}},{"./config":18,"./constants":19,"./utils/base58ToString":25,"./utils/transactions":28,"@vostokplatform/signature-generator":undefined}],25:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var signature_generator_1=require("@vostokplatform/signature-generator");function base58ToString(base58String){var arr=signature_generator_1.libs.base58.decode(base58String);var str=String.fromCharCode.apply(null,arr);return decodeURIComponent(escape(str))}exports.base58ToString=base58ToString},{"@vostokplatform/signature-generator":undefined}],26:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};Object.defineProperty(exports,"__esModule",{value:true});var signature_generator_1=require("@vostokplatform/signature-generator");var constants_1=require("../constants");var config_1=require("../config");var bignumber_1=require("../libs/bignumber");function normalizeAssetId(original){if(!original||original===constants_1.WAVES){return""}else{return original}}exports.normalizeAssetId=normalizeAssetId;function removeRecipientPrefix(original){if(original.slice(0,8)==="address:"){return original.slice(8)}else{return original}}exports.removeRecipientPrefix=removeRecipientPrefix;function removeAliasPrefix(original){if(original.slice(0,6)==="alias:"){return original.slice(8)}else{return original}}exports.removeAliasPrefix=removeAliasPrefix;function getTimestamp(timestamp){return(timestamp||Date.now())+config_1.default.getTimeDiff()}exports.getTimestamp=getTimestamp;function precisionCheck(precision){return precision>=0&&precision<=8}exports.precisionCheck=precisionCheck;function castFromBytesToBase58(bytes,sliceIndex){var processedBytes=Uint8Array.from(Array.prototype.slice.call(bytes,sliceIndex));return signature_generator_1.libs.base58.encode(processedBytes)}function castFromStringToBase58(str,sliceIndex){var processedBytes=Uint8Array.from(Array.prototype.slice.call(unescape(encodeURIComponent(str)).split("").map(function(e){return e.charCodeAt(0)}),sliceIndex));return signature_generator_1.libs.base58.encode(processedBytes)}function castFromRawToPrefixed(raw){if(raw.length>30){return"address:"+raw}else{var networkCharacter=String.fromCharCode(config_1.default.getNetworkByte());return"alias:"+networkCharacter+":"+raw}}function createRemapper(rules){return function(data){return Object.keys(__assign({},data,rules)).reduce(function(result,key){var rule=rules[key];if(typeof rule==="function"){result[key]=rule(data[key])}else if(typeof rule==="string"){result[rule]=data[key]}else if(rule&&typeof rule==="object"){if(rule.from==="bytes"&&rule.to==="base58"){result[key]=castFromBytesToBase58(data[key],rule.slice||0)}else if(rule.from==="string"&&rule.to==="base58"){result[key]=castFromStringToBase58(data[key],rule.slice||0)}else if(rule.from==="string"&&rule.to==="bignumber"){result[key]=new bignumber_1.default(data[key])}else if(rule.from==="raw"&&rule.to==="prefixed"){if(data[key].length&&data[key][0].recipient){result[rule.path||key]=data[key].map(function(o){return __assign({},o,{amount:new bignumber_1.default(o.amount),recipient:castFromRawToPrefixed(o.recipient)})})}else{result[rule.path||key]=castFromRawToPrefixed(data[key])}}}else if(rule!==null){result[key]=typeof data[key]!=="undefined"?data[key]:rule}return result},Object.create(null))}}exports.createRemapper=createRemapper},{"../config":18,"../constants":19,"../libs/bignumber":22,"@vostokplatform/signature-generator":undefined}],27:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};Object.defineProperty(exports,"__esModule",{value:true});var create=require("parse-json-bignumber");var WavesRequestError_1=require("../errors/WavesRequestError");var config_1=require("../config");var bignumber_1=require("../libs/bignumber");var SAFE_JSON_PARSE=create({BigNumber:bignumber_1.default}).parse;var SAFE_JSON_STRINGIFY=create({BigNumber:bignumber_1.default}).stringify;exports.POST_TEMPLATE={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8"}};var key=function(product,version){return product+"/"+version};var hostResolvers=(_a={},_a[key(0,0)]=function(){return config_1.default.getNodeAddress()},_a[key(1,0)]=function(){return config_1.default.getMatcherAddress()},_a);function normalizeHost(host){return host.replace(/\/+$/,"")}exports.normalizeHost=normalizeHost;function normalizePath(path){return("/"+path).replace(/\/+/g,"/").replace(/\/$/,"")}exports.normalizePath=normalizePath;function processJSON(res){if(res.ok){return res.text().then(SAFE_JSON_PARSE)}else{return res.json().then(Promise.reject.bind(Promise))}}exports.processJSON=processJSON;function handleError(url,data){throw new WavesRequestError_1.default(url,data)}function createFetchWrapper(config){var product=config.product,version=config.version,pipe=config.pipe,fetchInstance=config.fetchInstance;var resolveHost=hostResolvers[key(product,version)];return function(path,options){var url=resolveHost()+normalizePath(path);var request=fetchInstance(url,options);if(pipe){return request.then(pipe).catch(function(data){return handleError(url,data)})}else{return request.catch(function(data){return handleError(url,data)})}}}exports.createFetchWrapper=createFetchWrapper;function wrapTxRequest(SignatureGenerator,preRemapAsync,postRemap,callback,withProofs){if(withProofs===void 0){withProofs=false}return function(data,keyPair){return preRemapAsync(__assign({},data,{senderPublicKey:keyPair.publicKey})).then(function(validatedData){var transaction=new SignatureGenerator(validatedData);return transaction.getSignature(keyPair.privateKey).then(function(signature){return postRemap(__assign({},validatedData,withProofs?{proofs:[signature]}:{signature:signature}))}).then(function(tx){var sendData=__assign({},exports.POST_TEMPLATE,{rejectUnauthorized:false,credentials:"include",body:SAFE_JSON_STRINGIFY(tx,null,null)});console.log(sendData);return callback(sendData)})})}}exports.wrapTxRequest=wrapTxRequest;var _a},{"../config":18,"../errors/WavesRequestError":21,"../libs/bignumber":22,"parse-json-bignumber":undefined}],28:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};Object.defineProperty(exports,"__esModule",{value:true});var signature_generator_1=require("@vostokplatform/signature-generator");var txHelpers=require("../api/node/transactions.x");var capitalize=function(name){return name.slice(0,1).toUpperCase()+name.slice(1)};var TransactionWrapper=function(){function TransactionWrapper(signatureGenerator,validatedData,postRemap,proofs){this.signatureGenerator=signatureGenerator;this.validatedData=validatedData;this.postRemap=postRemap;this.proofs=proofs;this._privateKeys=[]}TransactionWrapper.prototype.addProof=function(privateKey){this._privateKeys.push(privateKey);return this};TransactionWrapper.prototype.getJSON=function(){var _this=this;return Promise.all(this._privateKeys.map(function(privateKey){return _this.signatureGenerator.getSignature(privateKey)})).then(function(newProofs){return _this.postRemap(__assign({},_this.validatedData,{proofs:[].concat(_this.proofs,newProofs)}))})};return TransactionWrapper}();exports.createTransaction=function(type,data){var name=capitalize(type);var preRemap=txHelpers["pre"+name];var postRemap=txHelpers["post"+name];if(!preRemap||!postRemap||!signature_generator_1.TX_TYPE_MAP[type]){throw new Error("Unknown transaction type: "+type)}var proofs=data.proofs||[];return preRemap(data).then(function(validatedData){var signatureGenerator=new signature_generator_1.TX_TYPE_MAP[type](validatedData);return new TransactionWrapper(signatureGenerator,validatedData,postRemap,proofs)})}},{"../api/node/transactions.x":15,"@vostokplatform/signature-generator":undefined}]},{},[1])(1)});
{
"name": "@vostokplatform/waves-api",
"version": "1.21.0",
"version": "2.0.0",
"description": "Vostok client-side API library",

@@ -5,0 +5,0 @@ "keywords": [

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var fetch_1 = require("../../libs/fetch");
var request_1 = require("../../utils/request");
var fetch = request_1.createFetchWrapper(1 /* MATCHER */, 0 /* V1 */, request_1.processJSON);
var fetch = request_1.createFetchWrapper({
product: 1 /* MATCHER */,
version: 0 /* V1 */,
pipe: request_1.processJSON,
fetchInstance: fetch_1.default
});
exports.default = {

@@ -6,0 +12,0 @@ getMatcherKey: function () {

@@ -11,2 +11,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var fetch_1 = require("../../libs/fetch");
var signature_generator_1 = require("@vostokplatform/signature-generator");

@@ -17,3 +18,8 @@ var request_1 = require("../../utils/request");

var orderbooks_x_1 = require("./orderbooks.x");
var fetch = request_1.createFetchWrapper(1 /* MATCHER */, 0 /* V1 */, request_1.processJSON);
var fetch = request_1.createFetchWrapper({
product: 1 /* MATCHER */,
version: 0 /* V1 */,
pipe: request_1.processJSON,
fetchInstance: fetch_1.default
});
var preCreateOrderAsync = function (data) { return orderbooks_x_1.createOrderSchema.parse(data); };

@@ -20,0 +26,0 @@ var postCreateOrder = function (data) {

@@ -21,2 +21,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var fetch_1 = require("../../libs/fetch");
var ts_api_validator_1 = require("ts-api-validator");

@@ -30,3 +31,8 @@ var signature_generator_1 = require("@vostokplatform/signature-generator");

var bignumber_1 = require("../../libs/bignumber");
var fetch = request_1.createFetchWrapper(0 /* NODE */, 0 /* V1 */, request_1.processJSON);
var fetch = request_1.createFetchWrapper({
product: 0 /* NODE */,
version: 0 /* V1 */,
pipe: request_1.processJSON,
fetchInstance: fetch_1.default
});
var AnyPart = /** @class */ (function (_super) {

@@ -33,0 +39,0 @@ __extends(AnyPart, _super);

@@ -7,2 +7,8 @@ import { ISignatureGeneratorConstructor } from '@vostokplatform/signature-generator';

}
export interface IFetchWrapperConfig {
product: PRODUCTS;
version: VERSIONS;
fetchInstance: typeof fetch;
pipe?: (value: Response) => Response | PromiseLike<Response>;
}
export declare const enum PRODUCTS {

@@ -25,3 +31,3 @@ NODE = 0,

export declare function processJSON(res: any): any;
export declare function createFetchWrapper(product: PRODUCTS, version: VERSIONS, pipe?: Function): IFetchWrapper<any>;
export declare function createFetchWrapper(config: IFetchWrapperConfig): IFetchWrapper<any>;
export declare function wrapTxRequest(SignatureGenerator: ISignatureGeneratorConstructor<any>, preRemapAsync: (data: IHash<any>) => Promise<IHash<any>>, postRemap: (data: IHash<any>) => IHash<any>, callback: (postParams: IHash<any>) => Promise<any>, withProofs?: boolean): (data: IHash<any>, keyPair: IKeyPair) => Promise<any>;

@@ -13,3 +13,2 @@ "use strict";

var WavesRequestError_1 = require("../errors/WavesRequestError");
var fetch_1 = require("../libs/fetch");
var config_1 = require("../config");

@@ -57,7 +56,8 @@ var bignumber_1 = require("../libs/bignumber");

}
function createFetchWrapper(product, version, pipe) {
function createFetchWrapper(config) {
var product = config.product, version = config.version, pipe = config.pipe, fetchInstance = config.fetchInstance;
var resolveHost = hostResolvers[key(product, version)];
return function (path, options) {
var url = resolveHost() + normalizePath(path);
var request = fetch_1.default(url, options);
var request = fetchInstance(url, options);
if (pipe) {

@@ -64,0 +64,0 @@ return request.then(pipe).catch(function (data) { return handleError(url, data); });

@@ -0,5 +1,6 @@

import { ByteProcessor as byteProcessors, Seed } from '@vostokplatform/signature-generator';
import { IHash, IWavesConfig } from '../interfaces';
import { Seed, ByteProcessor as byteProcessors } from '@vostokplatform/signature-generator';
import { IMatcherAPI } from './api/matcher/index';
import { INodeAPI } from './api/node/index';
import { IMatcherAPI } from './api/matcher/index';
import fetch from './libs/fetch';
export interface IAPIVersions {

@@ -6,0 +7,0 @@ Node: INodeAPI;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var signature_generator_1 = require("@vostokplatform/signature-generator");
var request_1 = require("./utils/request");
var request = require("./utils/request");
var MatcherAPI = require("./api/matcher/index");
var index_1 = require("./api/node/index");
var MatcherAPI = require("./api/matcher/index");
var config_1 = require("./config");
var constants = require("./constants");
var config_1 = require("./config");
var fetch_1 = require("./libs/fetch");
var tools_1 = require("./tools");
var request = require("./utils/request");
var request_1 = require("./utils/request");
var WavesAPI = /** @class */ (function () {

@@ -20,5 +21,15 @@ function WavesAPI(params) {

this.tools = tools_1.default;
var initialConfiguration = params.initialConfiguration, _a = params.fetchInstance, fetchInstance = _a === void 0 ? request_1.createFetchWrapper(0 /* NODE */, 0 /* V1 */, request_1.processJSON) : _a;
var initialConfiguration = params.initialConfiguration, _a = params.fetchInstance, fetchInstance = _a === void 0 ? request_1.createFetchWrapper({
product: 0 /* NODE */,
version: 0 /* V1 */,
pipe: request_1.processJSON,
fetchInstance: fetch_1.default
}) : _a;
this.API = {
Node: new index_1.default(fetchInstance),
Node: new index_1.default(request_1.createFetchWrapper({
product: 0 /* NODE */,
version: 0 /* V1 */,
pipe: request_1.processJSON,
fetchInstance: fetchInstance
})),
Matcher: MatcherAPI

@@ -25,0 +36,0 @@ };

@@ -0,5 +1,11 @@

import fetchInstance from '../../libs/fetch'
import { createFetchWrapper, PRODUCTS, VERSIONS, processJSON } from '../../utils/request';
const fetch = createFetchWrapper(PRODUCTS.MATCHER, VERSIONS.V1, processJSON);
const fetch = createFetchWrapper({
product: PRODUCTS.MATCHER,
version: VERSIONS.V1,
pipe: processJSON,
fetchInstance
});

@@ -6,0 +12,0 @@

@@ -0,1 +1,2 @@

import fetchInstance from "../../libs/fetch";
import { IKeyPair } from '../../../interfaces';

@@ -12,3 +13,8 @@ import { TTransactionRequest } from '../../utils/request';

const fetch = createFetchWrapper(PRODUCTS.MATCHER, VERSIONS.V1, processJSON);
const fetch = createFetchWrapper({
product: PRODUCTS.MATCHER,
version: VERSIONS.V1,
pipe: processJSON,
fetchInstance
});

@@ -15,0 +21,0 @@ const preCreateOrderAsync = (data) => createOrderSchema.parse(data);

import {DEFAULT_PAGING_OFFSET, DEFAULT_PAGING_LIMIT} from '../../constants';
export default class Addresses {

@@ -5,0 +4,0 @@

@@ -0,1 +1,2 @@

import fetchInstance from "../../libs/fetch";
import { TTransactionRequest } from '../../utils/request'

@@ -23,3 +24,8 @@ import { IHash } from '../../../interfaces' // TODO : fix this issue with interface

const fetch = createFetchWrapper(PRODUCTS.NODE, VERSIONS.V1, processJSON)
const fetch = createFetchWrapper({
product: PRODUCTS.NODE,
version: VERSIONS.V1,
pipe: processJSON,
fetchInstance
});

@@ -930,2 +936,2 @@ class AnyPart extends BasePart<any> {

return fetch(constants.BROADCAST_PATH, postParams)
}, true) as TTransactionRequest
}, true) as TTransactionRequest

@@ -8,3 +8,2 @@ import {ISignatureGenerator, ISignatureGeneratorConstructor} from '@vostokplatform/signature-generator';

import fetch from '../libs/fetch';
import config from '../config';

@@ -26,2 +25,8 @@ import BigNumber from '../libs/bignumber';

export interface IFetchWrapperConfig {
product: PRODUCTS;
version: VERSIONS;
fetchInstance: typeof fetch;
pipe?: (value: Response) => Response | PromiseLike<Response>
}

@@ -74,3 +79,4 @@ export const enum PRODUCTS { NODE, MATCHER }

export function createFetchWrapper(product: PRODUCTS, version: VERSIONS, pipe?: Function): IFetchWrapper<any> {
export function createFetchWrapper(config: IFetchWrapperConfig): IFetchWrapper<any> {
const { product, version, pipe, fetchInstance } = config;

@@ -83,3 +89,3 @@ const resolveHost = hostResolvers[key(product, version)];

const request = fetch(url, options);
const request = fetchInstance(url, options);

@@ -86,0 +92,0 @@ if (pipe) {

@@ -0,21 +1,15 @@

import { ByteProcessor as byteProcessors, Seed, utils } from '@vostokplatform/signature-generator';
import { IHash, IWavesConfig } from '../interfaces';
import {
utils,
Seed,
ByteProcessor as byteProcessors
} from '@vostokplatform/signature-generator';
import { createFetchWrapper, processJSON, PRODUCTS, VERSIONS } from "./utils/request";
import * as request from './utils/request';
import NodeAPI from './api/node/index';
import { INodeAPI } from './api/node/index';
import * as MatcherAPI from './api/matcher/index';
import { IMatcherAPI } from './api/matcher/index';
import NodeAPI, { INodeAPI } from './api/node/index';
import config from './config';
import * as constants from './constants';
import config from './config';
import fetch from './libs/fetch';
import tools from './tools';
import * as request from "./utils/request";
import { createFetchWrapper, processJSON, PRODUCTS, VERSIONS } from "./utils/request";

@@ -59,5 +53,17 @@ export interface IAPIVersions {

constructor(params: IWavesAPICtr) {
const { initialConfiguration, fetchInstance = createFetchWrapper(PRODUCTS.NODE, VERSIONS.V1, processJSON) } = params;
const { initialConfiguration, fetchInstance = createFetchWrapper({
product: PRODUCTS.NODE,
version: VERSIONS.V1,
pipe: processJSON,
fetchInstance: fetch
}) } = params;
this.API = {
Node: new NodeAPI(fetchInstance),
Node: new NodeAPI(
createFetchWrapper({
product: PRODUCTS.NODE,
version: VERSIONS.V1,
pipe: processJSON,
fetchInstance
})
),
Matcher: MatcherAPI

@@ -64,0 +70,0 @@ };

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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 not supported yet

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 not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc