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

@vostokplatform/waves-api

Package Overview
Dependencies
Maintainers
12
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 2.1.5-RC2 to 2.2.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});exports.TESTNET_CONFIG=exports.MAINNET_CONFIG=exports.create=exports.WavesAPI=void 0;var transactions_factory_1=require("@wavesenterprise/transactions-factory");var api_1=require("./api");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 WavesAPI=function(){function WavesAPI(params){this.Seed=transactions_factory_1.Seed;this.byteProcessors=transactions_factory_1.ByteProcessor;this.config=config_1.default;this.constants=constants;this.crypto=transactions_factory_1.utils.crypto;this.request=request;this.tools=tools_1.default;var initialConfiguration=params.initialConfiguration,_a=params.fetchInstance,fetchInstance=_a===void 0?fetch_1.default:_a;this.API={Node:new api_1.default(fetchInstance)};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}();exports.WavesAPI=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":7,"./config":14,"./constants":15,"./libs/fetch":19,"./tools":20,"./utils/request":23,"@wavesenterprise/transactions-factory":undefined}],2:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var constants_1=require("../constants");var request_1=require("../utils/request");var Addresses=function(){function Addresses(fetchInstance){this.fetch=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance: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":15,"../utils/request":23}],3:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var request_1=require("../utils/request");var Aliases=function(){function Aliases(fetchInstance){this.fetch=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance: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},{"../utils/request":23}],4:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var request_1=require("../utils/request");var addresses_1=require("./addresses");var constants=require("../constants");var Assets=function(){function Assets(fetchInstance){this.fetch=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance:fetchInstance});this.addresses=new addresses_1.default(this.fetch)}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":15,"../utils/request":23,"./addresses":2}],5:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var request_1=require("../utils/request");var Blocks=function(){function Blocks(fetchInstance){this.fetch=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance: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},{"../utils/request":23}],6:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var constants_1=require("../constants");var request_1=require("../utils/request");var Contracts=function(){function Contracts(fetchInstance){this.fetch=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance: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":15,"../utils/request":23}],7:[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":2,"./aliases":3,"./assets":4,"./blocks":5,"./contracts":6,"./leasing":8,"./peers":9,"./transactions":10,"./utils":13}],8:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var request_1=require("../utils/request");var Leasing=function(){function Leasing(fetchInstance){this.fetch=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance: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},{"../utils/request":23}],9:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var request_1=require("../utils/request");var Peers=function(){function Peers(fetchInstance){this.fetch=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance:fetchInstance})}Peers.prototype.connected=function(){return this.fetch("/peers/connected")};return Peers}();exports.default=Peers},{"../utils/request":23}],10:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||function(){__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};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};Object.defineProperty(exports,"__esModule",{value:true});var config_1=require("../../config");var constants=require("../../constants");var WavesError_1=require("../../errors/WavesError");var request_1=require("../../utils/request");var transactions_transforms_1=require("./transactions.transforms");var transactions_factory_1=require("@wavesenterprise/transactions-factory");var request_2=require("../../utils/request");var Transactions=function(){function Transactions(fetchInstance){this.fetch=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance:fetchInstance});this.txRequestFromNodeAddress=request_1.createTxRequestWrapper(fetchInstance)}Transactions.getTxMetaInfo=function(txType){var _a=constants.LEGACY_TX_TYPES[txType],type=_a.type,version=_a.v;var key=Object.keys(transactions_factory_1.TRANSACTION_TYPES).find(function(key){return transactions_factory_1.TRANSACTION_TYPES[key]===type});return{type:type,version:version,key:key}};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.broadcastFromClientAddress=function(txType,data,keys){var _this=this;return this.processTx(txType,data,keys,function(postParams){return _this.fetch(constants.BROADCAST_PATH,postParams)})};Transactions.prototype.broadcastFromNodeAddress=function(txType,nodeAddress,data,extraData){return __awaiter(this,void 0,void 0,function(){var _a,type,version,key,_b,preRemap,postRemap;return __generator(this,function(_c){_a=Transactions.getTxMetaInfo(txType),type=_a.type,version=_a.version,key=_a.key;if(!type||!key){throw new WavesError_1.default("Wrong transaction type: "+type,data)}_b=transactions_transforms_1.default[key]["V"+version],preRemap=_b.pre,postRemap=_b.post;return[2,this.txRequestFromNodeAddress(preRemap,postRemap,nodeAddress,__assign(__assign({},data),{type:type,version:version}),extraData)]})})};Transactions.prototype.sign=function(txType,data,keys){return this.processTx(txType,data,keys,function(postParams){return JSON.parse(postParams.body)})};Transactions.prototype.processTx=function(txType,data,keys,callback){var _a=Transactions.getTxMetaInfo(txType),type=_a.type,version=_a.version,key=_a.key;if(!type||!key){throw new WavesError_1.default("Wrong transaction type: "+type,data)}var factory=transactions_factory_1.getTransactionFactory(version,type);var _b=transactions_transforms_1.default[key]["V"+version],pre=_b.pre,post=_b.post;return request_2.wrapTxRequest(factory,pre,post,callback,true)(data,keys)};Transactions.prototype.rawBroadcast=function(data){return this.fetch(constants.BROADCAST_PATH,__assign(__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":14,"../../constants":15,"../../errors/WavesError":16,"../../utils/request":23,"./transactions.transforms":12,"@wavesenterprise/transactions-factory":undefined}],11:[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,parseValue:remap_1.normalizeAssetId},feeAssetId:{type:ts_api_validator_1.StringPart,required:false,parseValue:remap_1.normalizeAssetId},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":15,"../../utils/remap":22,"ts-api-validator":undefined}],12:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};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||function(){__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};return __assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:true});var transactions_factory_1=require("@wavesenterprise/transactions-factory");var ts_api_validator_1=require("ts-api-validator");var schemaFields_1=require("./schemaFields");var remap_1=require("../../utils/remap");var config_1=require("../../config");var bignumber_1=require("../../libs/bignumber");var TRANSFORMS={};Object.keys(transactions_factory_1.TRANSACTIONS).forEach(function(key){TRANSFORMS[key]={};Object.keys(transactions_factory_1.TRANSACTIONS[key]).forEach(function(key1){TRANSFORMS[key][key1]={}})});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);var 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:null},quantity:{type:ts_api_validator_1.StringPart,required:true},precision:{type:ts_api_validator_1.NumberPart,required:true,isValid:remap_1.precisionCheck},decimals:{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()}}}});var preIssue=function(data){return issueSchema.parse(data)};var postIssue=remap_1.createRemapper({transactionType:null,precision:"decimals",quantity:{from:"string",to:"bignumber"}});TRANSFORMS.ISSUE.V2={pre:preIssue,post:postIssue};var 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:schemaFields_1.default.feeAssetId,fee:schemaFields_1.default.fee,attachment:{type:ts_api_validator_1.StringPart,required:false,defaultValue:""},timestamp:schemaFields_1.default.timestamp}});var preTransfer=function(data){return transferSchema.parse(data)};var postTransfer=remap_1.createRemapper({transactionType:null,attachment:{from:"string",to:"base58"},recipient:{from:"raw",to:"prefixed"},amount:{from:"string",to:"bignumber"}});TRANSFORMS.TRANSFER.V2={pre:preTransfer,post:postTransfer};var 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()}}}});var preReissue=function(data){return reissueSchema.parse(data)};var postReissue=remap_1.createRemapper({transactionType:null,quantity:{from:"string",to:"bignumber"}});TRANSFORMS.REISSUE.V2={pre:preReissue,post:postReissue};var 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,amount:{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()}}}});var preBurn=function(data){return burnSchema.parse(data)};var postBurn=remap_1.createRemapper({transactionType:null,amount:{from:"string",to:"bignumber"}});TRANSFORMS.BURN.V2={pre:preBurn,post:postBurn};var 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}});var preLease=function(data){return leaseSchema.parse(data)};var postLease=remap_1.createRemapper({transactionType:null,recipient:{from:"raw",to:"prefixed"}});TRANSFORMS.LEASE.V2={pre:preLease,post:postLease};var 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()}}}});var preCancelLeasing=function(data){return cancelLeasingSchema.parse(data)};var postCancelLeasing=remap_1.createRemapper({transactionType:null,transactionId:"txId"});TRANSFORMS.LEASE_CANCEL.V2={pre:preCancelLeasing,post:postCancelLeasing};var 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}});var preCreateAlias=function(data){return createAliasSchema.parse(data)};var postCreateAlias=remap_1.createRemapper({transactionType:null});TRANSFORMS.CREATE_ALIAS.V2={pre:preCreateAlias,post:postCreateAlias};var 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:""}}});var preMassTransfer=function(data){return massTransferSchema.parse(data)};var postMassTransfer=remap_1.createRemapper({transactionType:null,attachment:{from:"string",to:"base58"},transfers:{from:"raw",to:"prefixed",path:"transfers"}});TRANSFORMS.MASS_TRANSFER.V1={pre:preMassTransfer,post:postMassTransfer};var 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}});var preData=function(data){return dataSchema.parse(data)};var 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});return __assign(__assign({},d),{data:data,transactionType:null})};TRANSFORMS.DATA.V1={pre:preData,post:postData};var 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}});var preSetScript=function(data){return setScriptSchema.parse(data)};var postSetScript=remap_1.createRemapper({transactionType:null});TRANSFORMS.SET_SCRIPT.V1={pre:preSetScript,post:postSetScript};var 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}});var preSponsorship=function(data){return sponsorshipSchema.parse(data)};var postSponsorship=remap_1.createRemapper({transactionType:null});TRANSFORMS.SPONSOR_FEE.V1={pre:preSponsorship,post:postSponsorship};var 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}});var prePermit=function(data){return permissionSchema.parse(data)};var postPermit=remap_1.createRemapper({transactionType:null});TRANSFORMS.PERMIT.V1={pre:prePermit,post:postPermit};var dockerCreateBaseSchema={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}};var dockerCreateSchema=new ts_api_validator_1.Schema(dockerCreateBaseSchema);var preDockerCreate=function(data){return dockerCreateSchema.parse(data)};var 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});return __assign(__assign({},d),{params:data,transactionType:null})};TRANSFORMS.CREATE_CONTRACT.V1={pre:preDockerCreate,post:postDockerCreate};var dockerCreateV2Schema=new ts_api_validator_1.Schema(__assign(__assign({},dockerCreateBaseSchema),{content:__assign(__assign({},dockerCreateBaseSchema.content),{feeAssetId:schemaFields_1.default.feeAssetId})}));var preDockerCreateV2=function(data){return dockerCreateV2Schema.parse(data)};var postDockerCreateV2=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});return __assign(__assign({},d),{params:data,transactionType:null})};TRANSFORMS.CREATE_CONTRACT.V2={pre:preDockerCreateV2,post:postDockerCreateV2};var dockerCallSchemaBase={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}};var dockerCallSchema=new ts_api_validator_1.Schema(dockerCallSchemaBase);var preDockerCall=function(data){return dockerCallSchema.parse(data)};var 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});return __assign(__assign({},d),{params:data,transactionType:null})};TRANSFORMS.CALL_CONTRACT.V1={pre:preDockerCall,post:postDockerCall};var dockerCallSchemaV2=new ts_api_validator_1.Schema(__assign(__assign({},dockerCallSchemaBase),{content:__assign(__assign({},dockerCallSchemaBase.content),{contractVersion:{type:ts_api_validator_1.NumberPart,required:true}})}));var preDockerCallV2=function(data){return dockerCallSchemaV2.parse(data)};var postDockerCallV2=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});return __assign(__assign({},d),{params:data,transactionType:null})};TRANSFORMS.CALL_CONTRACT.V2={pre:preDockerCallV2,post:postDockerCallV2};var dockerCallSchemaV3=new ts_api_validator_1.Schema(__assign(__assign({},dockerCallSchemaBase),{content:__assign(__assign({},dockerCallSchemaBase.content),{contractVersion:{type:ts_api_validator_1.NumberPart,required:true},feeAssetId:schemaFields_1.default.feeAssetId})}));var preDockerCallV3=function(data){return dockerCallSchemaV3.parse(data)};var postDockerCallV3=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});return __assign(__assign({},d),{params:data,transactionType:null})};TRANSFORMS.CALL_CONTRACT.V3={pre:preDockerCallV3,post:postDockerCallV3};var 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}});var preDockerDisable=function(data){return dockerDisableSchema.parse(data)};var postDockerDisable=function(d){return __assign(__assign({},d),{transactionType:null})};TRANSFORMS.DISABLE_CONTRACT.V1={pre:preDockerDisable,post:postDockerDisable};var dockerUpdateV2Schema=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},image:{type:ts_api_validator_1.StringPart,required:true},imageHash:{type:ts_api_validator_1.StringPart,required:true},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp,feeAssetId:schemaFields_1.default.feeAssetId}});var preDockerUpdateV2=function(data){return dockerUpdateV2Schema.parse(data)};var postDockerUpdateV2=function(d){return __assign(__assign({},d),{transactionType:null})};TRANSFORMS.UPDATE_CONTRACT.V2={pre:preDockerUpdateV2,post:postDockerUpdateV2};var 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}});var preNodeRegistry=function(data){return nodeRegistrySchema.parse(data)};var postNodeRegistry=function(d){return __assign(__assign({},d),{transactionType:null})};TRANSFORMS.REGISTER_NODE.V1={pre:preNodeRegistry,post:postNodeRegistry};var 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}});var prePolicyCreate=function(data){return policyCreateScheme.parse(data)};var postPolicyCreate=function(d){return __assign(__assign({},d),{transactionType:null})};TRANSFORMS.CREATE_POLICY.V1={pre:prePolicyCreate,post:postPolicyCreate};var 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}});var preUpdateCreate=function(data){return policyUpdateScheme.parse(data)};var postUpdateCreate=function(d){return __assign(__assign({},d),{transactionType:null})};TRANSFORMS.UPDATE_POLICY.V1={pre:preUpdateCreate,post:postUpdateCreate};exports.default=TRANSFORMS},{"../../config":14,"../../libs/bignumber":18,"../../utils/remap":22,"./schemaFields":11,"@wavesenterprise/transactions-factory":undefined,"ts-api-validator":undefined}],13:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var request_1=require("../utils/request");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=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance:fetchInstance})}Utils.prototype.time=function(){return this.fetch("/utils/time").then(function(t){return t.system})};return Utils}();exports.default=Utils},{"../utils/request":23}],14:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||function(){__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};return __assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:true});var transactions_factory_1=require("@wavesenterprise/transactions-factory");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){transactions_factory_1.config.set(newConfig);if(Object.keys(config).length===0){newConfig=__assign(__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":15,"./utils/request":23,"@wavesenterprise/transactions-factory":undefined}],15:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||function(){__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};return __assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:true});exports.SIGN_PATH=exports.BROADCAST_PATH=exports.WAVES_V1_ISSUE_TX=exports.DEFAULT_TESTNET_CONFIG=exports.DEFAULT_MAINNET_CONFIG=exports.DEFAULT_BASIC_CONFIG=exports.DEFAULT_PAGING_OFFSET=exports.DEFAULT_PAGING_LIMIT=exports.DEFAULT_ORDER_EXPIRATION_DAYS=exports.DEFAULT_MIN_SEED_LENGTH=exports.TRANSFER_ATTACHMENT_BYTE_LIMIT=exports.MINIMUM_DATA_FEE_PER_KB=exports.MINIMUM_MATCHER_FEE=exports.MINIMUM_ISSUE_FEE=exports.MINIMUM_FEE=exports.PUBLIC_KEY_GOST_LENGTH=exports.PUBLIC_KEY_LENGTH=exports.PRIVATE_KEY_LENGTH=exports.LEGACY_TX_TYPES=exports.ALIAS_BYTE=exports.ADDRESS_BYTE=exports.INITIAL_NONCE=exports.TESTNET_BYTE=exports.MAINNET_BYTE=exports.WAVES=void 0;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.LEGACY_TX_TYPES={issue:{type:3,v:2},issue_no_script:{type:3,v:2},transfer:{type:4,v:2},reissue:{type:5,v:2},burn:{type:6,v:2},exchange:{type:7,v:2},lease:{type:8,v:2},cancelLeasing:{type:9,v:2},createAlias:{type:10,v:2},massTransfer:{type:11,v:1},data:{type:12,v:1},setScript:{type:13,v:1},sponsorship:{type:14,v:1},permit:{type:102,v:1},dockerCreate:{type:103,v:1},dockerCreateV2:{type:103,v:2},dockerCall:{type:104,v:1},dockerCallV2:{type:104,v:2},dockerCallV3:{type:104,v:3},dockerDisable:{type:106,v:1},dockerUpdateV2:{type:107,v:2},policyRegisterNode:{type:111,v:1},policyCreate:{type:112,v:1},policyUpdate:{type:113,v:1},policyDataHash:{type:114,v:1}};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(__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(__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:3};exports.BROADCAST_PATH="/transactions/broadcast";exports.SIGN_PATH="/transactions/sign"},{}],16:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};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},{}],17:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};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":16}],18:[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}],19:[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}],20:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var transactions_factory_1=require("@wavesenterprise/transactions-factory");var config_1=require("./config");var base58ToString_1=require("./utils/base58ToString");exports.default={getAddressFromPublicKey:function(publicKey){var publicKeyBytes=transactions_factory_1.libs.base58.decode(publicKey);return config_1.default.isCryptoGost()?transactions_factory_1.utils.cryptoGost.buildRawAddress(publicKeyBytes):transactions_factory_1.utils.crypto.buildRawAddress(publicKeyBytes)},calculateTimeDiff:function(nodeTime,userTime){return nodeTime-userTime},base58:{encode:transactions_factory_1.libs.base58.encode,decode:transactions_factory_1.libs.base58.decode,base58ToString:base58ToString_1.base58ToString}}},{"./config":14,"./utils/base58ToString":21,"@wavesenterprise/transactions-factory":undefined}],21:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.base58ToString=void 0;var transactions_factory_1=require("@wavesenterprise/transactions-factory");function base58ToString(base58String){var arr=transactions_factory_1.libs.base58.decode(base58String);var str=String.fromCharCode.apply(null,arr);return decodeURIComponent(escape(str))}exports.base58ToString=base58ToString},{"@wavesenterprise/transactions-factory":undefined}],22:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||function(){__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};return __assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:true});exports.createRemapper=exports.precisionCheck=exports.getTimestamp=exports.removeAliasPrefix=exports.removeRecipientPrefix=exports.normalizeAssetId=void 0;var transactions_factory_1=require("@wavesenterprise/transactions-factory");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 transactions_factory_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 transactions_factory_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(__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(__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":14,"../constants":15,"../libs/bignumber":18,"@wavesenterprise/transactions-factory":undefined}],23:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||function(){__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};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};var _a;Object.defineProperty(exports,"__esModule",{value:true});exports.createTxRequestWrapper=exports.wrapTxRequest=exports.createFetchWrapper=exports.processJSON=exports.normalizePath=exports.normalizeHost=exports.POST_TEMPLATE=exports.SAFE_JSON_STRINGIFY=exports.SAFE_JSON_PARSE=void 0;var create=require("parse-json-bignumber");var constants_1=require("../constants");var WavesRequestError_1=require("../errors/WavesRequestError");var config_1=require("../config");var bignumber_1=require("../libs/bignumber");exports.SAFE_JSON_PARSE=create({BigNumber:bignumber_1.default}).parse;exports.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(exports.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;exports.wrapTxRequest=function(factory,preRemapAsync,postRemap,callback,withProofs){if(withProofs===void 0){withProofs=false}return function(data,keyPair){return __awaiter(void 0,void 0,void 0,function(){var preData,tx,signature,postData,sendData;return __generator(this,function(_a){switch(_a.label){case 0:preData=__assign(__assign({},data),{senderPublicKey:keyPair.publicKey});if(!preRemapAsync)return[3,2];return[4,preRemapAsync(preData)];case 1:preData=_a.sent();_a.label=2;case 2:tx=factory(preData);return[4,tx.getSignature(keyPair.privateKey)];case 3:signature=_a.sent();postData=__assign(__assign(__assign({},preData),withProofs?{proofs:[signature]}:{signature:signature}),{version:tx.version,type:tx.tx_type});if(postRemap){postData=postRemap(postData)}sendData=__assign(__assign({},exports.POST_TEMPLATE),{rejectUnauthorized:false,credentials:"include",body:exports.SAFE_JSON_STRINGIFY(postData,null,null)});return[2,callback(sendData)]}})})}};exports.createTxRequestWrapper=function(fetchInstance){return function(preRemapAsync,postRemap,nodeAddress,data,extraData){return __awaiter(void 0,void 0,void 0,function(){var newData,body,tx;return __generator(this,function(_a){switch(_a.label){case 0:nodeAddress=nodeAddress.replace(/\/+$/,"");newData=data;if(!preRemapAsync)return[3,2];return[4,preRemapAsync(newData)];case 1:newData=_a.sent();_a.label=2;case 2:if(postRemap){newData=postRemap(newData)}body=__assign(__assign(__assign({},newData),extraData),{type:data.type,version:data.version});if(body.assetId===""){body.assetId=null}if(body.feeAssetId===""){body.feeAssetId=null}return[4,fetchInstance(nodeAddress+constants_1.SIGN_PATH,__assign(__assign({},exports.POST_TEMPLATE),{credentials:"include",body:exports.SAFE_JSON_STRINGIFY(body,null,null)})).then(processJSON)];case 3:tx=_a.sent();return[2,fetchInstance(nodeAddress+constants_1.BROADCAST_PATH,__assign(__assign({},exports.POST_TEMPLATE),{credentials:"include",body:exports.SAFE_JSON_STRINGIFY(tx,null,null)})).then(processJSON)]}})})}}},{"../config":14,"../constants":15,"../errors/WavesRequestError":17,"../libs/bignumber":18,"parse-json-bignumber":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});exports.TESTNET_CONFIG=exports.MAINNET_CONFIG=exports.create=exports.WavesAPI=void 0;var transactions_factory_1=require("@wavesenterprise/transactions-factory");var api_1=require("./api");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 WavesAPI=function(){function WavesAPI(params){this.Seed=transactions_factory_1.Seed;this.byteProcessors=transactions_factory_1.ByteProcessor;this.config=config_1.default;this.constants=constants;this.crypto=transactions_factory_1.utils.crypto;this.request=request;this.tools=tools_1.default;var initialConfiguration=params.initialConfiguration,_a=params.fetchInstance,fetchInstance=_a===void 0?fetch_1.default:_a;this.API={Node:new api_1.default(fetchInstance)};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}();exports.WavesAPI=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":7,"./config":14,"./constants":15,"./libs/fetch":19,"./tools":20,"./utils/request":23,"@wavesenterprise/transactions-factory":undefined}],2:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var constants_1=require("../constants");var request_1=require("../utils/request");var Addresses=function(){function Addresses(fetchInstance){this.fetch=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance: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":15,"../utils/request":23}],3:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var request_1=require("../utils/request");var Aliases=function(){function Aliases(fetchInstance){this.fetch=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance: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},{"../utils/request":23}],4:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var request_1=require("../utils/request");var addresses_1=require("./addresses");var constants=require("../constants");var Assets=function(){function Assets(fetchInstance){this.fetch=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance:fetchInstance});this.addresses=new addresses_1.default(this.fetch)}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":15,"../utils/request":23,"./addresses":2}],5:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var request_1=require("../utils/request");var Blocks=function(){function Blocks(fetchInstance){this.fetch=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance: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},{"../utils/request":23}],6:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var constants_1=require("../constants");var request_1=require("../utils/request");var Contracts=function(){function Contracts(fetchInstance){this.fetch=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance: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":15,"../utils/request":23}],7:[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":2,"./aliases":3,"./assets":4,"./blocks":5,"./contracts":6,"./leasing":8,"./peers":9,"./transactions":10,"./utils":13}],8:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var request_1=require("../utils/request");var Leasing=function(){function Leasing(fetchInstance){this.fetch=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance: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},{"../utils/request":23}],9:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var request_1=require("../utils/request");var Peers=function(){function Peers(fetchInstance){this.fetch=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance:fetchInstance})}Peers.prototype.connected=function(){return this.fetch("/peers/connected")};return Peers}();exports.default=Peers},{"../utils/request":23}],10:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||function(){__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};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};Object.defineProperty(exports,"__esModule",{value:true});var config_1=require("../../config");var constants=require("../../constants");var WavesError_1=require("../../errors/WavesError");var request_1=require("../../utils/request");var transactions_transforms_1=require("./transactions.transforms");var transactions_factory_1=require("@wavesenterprise/transactions-factory");var request_2=require("../../utils/request");var Transactions=function(){function Transactions(fetchInstance){this.fetch=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance:fetchInstance});this.txRequestFromNodeAddress=request_1.createTxRequestWrapper(fetchInstance)}Transactions.getTxMetaInfo=function(txType){var _a=constants.LEGACY_TX_TYPES[txType],type=_a.type,version=_a.v;var key=Object.keys(transactions_factory_1.TRANSACTION_TYPES).find(function(key){return transactions_factory_1.TRANSACTION_TYPES[key]===type});return{type:type,version:version,key:key}};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.broadcastFromClientAddress=function(txType,data,keys){var _this=this;return this.processTx(txType,data,keys,function(postParams){return _this.fetch(constants.BROADCAST_PATH,postParams)})};Transactions.prototype.broadcastFromNodeAddress=function(txType,nodeAddress,data,extraData){return __awaiter(this,void 0,void 0,function(){var _a,type,version,key,_b,preRemap,postRemap;return __generator(this,function(_c){_a=Transactions.getTxMetaInfo(txType),type=_a.type,version=_a.version,key=_a.key;if(!type||!key){throw new WavesError_1.default("Wrong transaction type: "+type,data)}_b=transactions_transforms_1.default[key]["V"+version],preRemap=_b.pre,postRemap=_b.post;return[2,this.txRequestFromNodeAddress(preRemap,postRemap,nodeAddress,__assign(__assign({},data),{type:type,version:version}),extraData)]})})};Transactions.prototype.sign=function(txType,data,keys){return this.processTx(txType,data,keys,function(postParams){return JSON.parse(postParams.body)})};Transactions.prototype.processTx=function(txType,data,keys,callback){var _a=Transactions.getTxMetaInfo(txType),type=_a.type,version=_a.version,key=_a.key;if(!type||!key){throw new WavesError_1.default("Wrong transaction type: "+type,data)}var factory=transactions_factory_1.getTransactionFactory(version,type);var _b=transactions_transforms_1.default[key]["V"+version],pre=_b.pre,post=_b.post;return request_2.wrapTxRequest(factory,pre,post,callback,true)(data,keys)};Transactions.prototype.rawBroadcast=function(data){return this.fetch(constants.BROADCAST_PATH,__assign(__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":14,"../../constants":15,"../../errors/WavesError":16,"../../utils/request":23,"./transactions.transforms":12,"@wavesenterprise/transactions-factory":undefined}],11:[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,parseValue:remap_1.normalizeAssetId},feeAssetId:{type:ts_api_validator_1.StringPart,required:false,parseValue:remap_1.normalizeAssetId},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":15,"../../utils/remap":22,"ts-api-validator":undefined}],12:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};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||function(){__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};return __assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:true});var transactions_factory_1=require("@wavesenterprise/transactions-factory");var ts_api_validator_1=require("ts-api-validator");var schemaFields_1=require("./schemaFields");var remap_1=require("../../utils/remap");var config_1=require("../../config");var bignumber_1=require("../../libs/bignumber");var TRANSFORMS={};Object.keys(transactions_factory_1.TRANSACTIONS).forEach(function(key){TRANSFORMS[key]={};Object.keys(transactions_factory_1.TRANSACTIONS[key]).forEach(function(key1){TRANSFORMS[key][key1]={}})});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);var 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:null},quantity:{type:ts_api_validator_1.StringPart,required:true},decimals:{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()}}}});var preIssue=function(data){return issueSchema.parse(data)};var postIssue=remap_1.createRemapper({transactionType:null,quantity:{from:"string",to:"bignumber"}});TRANSFORMS.ISSUE.V2={pre:preIssue,post:postIssue};var 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:schemaFields_1.default.feeAssetId,fee:schemaFields_1.default.fee,attachment:{type:ts_api_validator_1.StringPart,required:false,defaultValue:""},timestamp:schemaFields_1.default.timestamp}});var preTransfer=function(data){return transferSchema.parse(data)};var postTransfer=remap_1.createRemapper({transactionType:null,attachment:{from:"string",to:"base58"},recipient:{from:"raw",to:"prefixed"},amount:{from:"string",to:"bignumber"}});TRANSFORMS.TRANSFER.V2={pre:preTransfer,post:postTransfer};var 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()}}}});var preReissue=function(data){return reissueSchema.parse(data)};var postReissue=remap_1.createRemapper({transactionType:null,quantity:{from:"string",to:"bignumber"}});TRANSFORMS.REISSUE.V2={pre:preReissue,post:postReissue};var 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,amount:{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()}}}});var preBurn=function(data){return burnSchema.parse(data)};var postBurn=remap_1.createRemapper({transactionType:null,amount:{from:"string",to:"bignumber"}});TRANSFORMS.BURN.V2={pre:preBurn,post:postBurn};var 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}});var preLease=function(data){return leaseSchema.parse(data)};var postLease=remap_1.createRemapper({transactionType:null,recipient:{from:"raw",to:"prefixed"}});TRANSFORMS.LEASE.V2={pre:preLease,post:postLease};var 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()}}}});var preCancelLeasing=function(data){return cancelLeasingSchema.parse(data)};var postCancelLeasing=remap_1.createRemapper({transactionType:null,transactionId:"txId"});TRANSFORMS.LEASE_CANCEL.V2={pre:preCancelLeasing,post:postCancelLeasing};var 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}});var preCreateAlias=function(data){return createAliasSchema.parse(data)};var postCreateAlias=remap_1.createRemapper({transactionType:null});TRANSFORMS.CREATE_ALIAS.V2={pre:preCreateAlias,post:postCreateAlias};var 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:""}}});var preMassTransfer=function(data){return massTransferSchema.parse(data)};var postMassTransfer=remap_1.createRemapper({transactionType:null,attachment:{from:"string",to:"base58"},transfers:{from:"raw",to:"prefixed",path:"transfers"}});TRANSFORMS.MASS_TRANSFER.V1={pre:preMassTransfer,post:postMassTransfer};var 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}});var preData=function(data){return dataSchema.parse(data)};var 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});return __assign(__assign({},d),{data:data,transactionType:null})};TRANSFORMS.DATA.V1={pre:preData,post:postData};var 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}});var preSetScript=function(data){return setScriptSchema.parse(data)};var postSetScript=remap_1.createRemapper({transactionType:null});TRANSFORMS.SET_SCRIPT.V1={pre:preSetScript,post:postSetScript};var 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}});var preSponsorship=function(data){return sponsorshipSchema.parse(data)};var postSponsorship=remap_1.createRemapper({transactionType:null});TRANSFORMS.SPONSOR_FEE.V1={pre:preSponsorship,post:postSponsorship};var 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}});var prePermit=function(data){return permissionSchema.parse(data)};var postPermit=remap_1.createRemapper({transactionType:null});TRANSFORMS.PERMIT.V1={pre:prePermit,post:postPermit};var dockerCreateBaseSchema={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}};var dockerCreateSchema=new ts_api_validator_1.Schema(dockerCreateBaseSchema);var preDockerCreate=function(data){return dockerCreateSchema.parse(data)};var 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});return __assign(__assign({},d),{params:data,transactionType:null})};TRANSFORMS.CREATE_CONTRACT.V1={pre:preDockerCreate,post:postDockerCreate};var dockerCreateV2Schema=new ts_api_validator_1.Schema(__assign(__assign({},dockerCreateBaseSchema),{content:__assign(__assign({},dockerCreateBaseSchema.content),{feeAssetId:schemaFields_1.default.feeAssetId})}));var preDockerCreateV2=function(data){return dockerCreateV2Schema.parse(data)};var postDockerCreateV2=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});return __assign(__assign({},d),{params:data,transactionType:null})};TRANSFORMS.CREATE_CONTRACT.V2={pre:preDockerCreateV2,post:postDockerCreateV2};var dockerCallSchemaBase={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}};var dockerCallSchema=new ts_api_validator_1.Schema(dockerCallSchemaBase);var preDockerCall=function(data){return dockerCallSchema.parse(data)};var 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});return __assign(__assign({},d),{params:data,transactionType:null})};TRANSFORMS.CALL_CONTRACT.V1={pre:preDockerCall,post:postDockerCall};var dockerCallSchemaV2=new ts_api_validator_1.Schema(__assign(__assign({},dockerCallSchemaBase),{content:__assign(__assign({},dockerCallSchemaBase.content),{contractVersion:{type:ts_api_validator_1.NumberPart,required:true}})}));var preDockerCallV2=function(data){return dockerCallSchemaV2.parse(data)};var postDockerCallV2=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});return __assign(__assign({},d),{params:data,transactionType:null})};TRANSFORMS.CALL_CONTRACT.V2={pre:preDockerCallV2,post:postDockerCallV2};var dockerCallSchemaV3=new ts_api_validator_1.Schema(__assign(__assign({},dockerCallSchemaBase),{content:__assign(__assign({},dockerCallSchemaBase.content),{contractVersion:{type:ts_api_validator_1.NumberPart,required:true},feeAssetId:schemaFields_1.default.feeAssetId})}));var preDockerCallV3=function(data){return dockerCallSchemaV3.parse(data)};var postDockerCallV3=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});return __assign(__assign({},d),{params:data,transactionType:null})};TRANSFORMS.CALL_CONTRACT.V3={pre:preDockerCallV3,post:postDockerCallV3};var 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}});var preDockerDisable=function(data){return dockerDisableSchema.parse(data)};var postDockerDisable=function(d){return __assign(__assign({},d),{transactionType:null})};TRANSFORMS.DISABLE_CONTRACT.V1={pre:preDockerDisable,post:postDockerDisable};var dockerUpdateV2Schema=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},image:{type:ts_api_validator_1.StringPart,required:true},imageHash:{type:ts_api_validator_1.StringPart,required:true},fee:schemaFields_1.default.fee,timestamp:schemaFields_1.default.timestamp,feeAssetId:schemaFields_1.default.feeAssetId}});var preDockerUpdateV2=function(data){return dockerUpdateV2Schema.parse(data)};var postDockerUpdateV2=function(d){return __assign(__assign({},d),{transactionType:null})};TRANSFORMS.UPDATE_CONTRACT.V2={pre:preDockerUpdateV2,post:postDockerUpdateV2};var 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}});var preNodeRegistry=function(data){return nodeRegistrySchema.parse(data)};var postNodeRegistry=function(d){return __assign(__assign({},d),{transactionType:null})};TRANSFORMS.REGISTER_NODE.V1={pre:preNodeRegistry,post:postNodeRegistry};var 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}});var prePolicyCreate=function(data){return policyCreateScheme.parse(data)};var postPolicyCreate=function(d){return __assign(__assign({},d),{transactionType:null})};TRANSFORMS.CREATE_POLICY.V1={pre:prePolicyCreate,post:postPolicyCreate};var 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}});var preUpdateCreate=function(data){return policyUpdateScheme.parse(data)};var postUpdateCreate=function(d){return __assign(__assign({},d),{transactionType:null})};TRANSFORMS.UPDATE_POLICY.V1={pre:preUpdateCreate,post:postUpdateCreate};exports.default=TRANSFORMS},{"../../config":14,"../../libs/bignumber":18,"../../utils/remap":22,"./schemaFields":11,"@wavesenterprise/transactions-factory":undefined,"ts-api-validator":undefined}],13:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var request_1=require("../utils/request");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=request_1.createFetchWrapper({product:0,version:0,pipe:request_1.processJSON,fetchInstance:fetchInstance})}Utils.prototype.time=function(){return this.fetch("/utils/time").then(function(t){return t.system})};return Utils}();exports.default=Utils},{"../utils/request":23}],14:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||function(){__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};return __assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:true});var transactions_factory_1=require("@wavesenterprise/transactions-factory");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){transactions_factory_1.config.set(newConfig);if(Object.keys(config).length===0){newConfig=__assign(__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":15,"./utils/request":23,"@wavesenterprise/transactions-factory":undefined}],15:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||function(){__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};return __assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:true});exports.SIGN_PATH=exports.BROADCAST_PATH=exports.WAVES_V1_ISSUE_TX=exports.DEFAULT_TESTNET_CONFIG=exports.DEFAULT_MAINNET_CONFIG=exports.DEFAULT_BASIC_CONFIG=exports.DEFAULT_PAGING_OFFSET=exports.DEFAULT_PAGING_LIMIT=exports.DEFAULT_ORDER_EXPIRATION_DAYS=exports.DEFAULT_MIN_SEED_LENGTH=exports.TRANSFER_ATTACHMENT_BYTE_LIMIT=exports.MINIMUM_DATA_FEE_PER_KB=exports.MINIMUM_MATCHER_FEE=exports.MINIMUM_ISSUE_FEE=exports.MINIMUM_FEE=exports.PUBLIC_KEY_GOST_LENGTH=exports.PUBLIC_KEY_LENGTH=exports.PRIVATE_KEY_LENGTH=exports.LEGACY_TX_TYPES=exports.ALIAS_BYTE=exports.ADDRESS_BYTE=exports.INITIAL_NONCE=exports.TESTNET_BYTE=exports.MAINNET_BYTE=exports.WAVES=void 0;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.LEGACY_TX_TYPES={issue:{type:3,v:2},issue_no_script:{type:3,v:2},transfer:{type:4,v:2},reissue:{type:5,v:2},burn:{type:6,v:2},exchange:{type:7,v:2},lease:{type:8,v:2},cancelLeasing:{type:9,v:2},createAlias:{type:10,v:2},massTransfer:{type:11,v:1},data:{type:12,v:1},setScript:{type:13,v:1},sponsorship:{type:14,v:1},permit:{type:102,v:1},dockerCreate:{type:103,v:1},dockerCreateV2:{type:103,v:2},dockerCall:{type:104,v:1},dockerCallV2:{type:104,v:2},dockerCallV3:{type:104,v:3},dockerDisable:{type:106,v:1},dockerUpdateV2:{type:107,v:2},policyRegisterNode:{type:111,v:1},policyCreate:{type:112,v:1},policyUpdate:{type:113,v:1},policyDataHash:{type:114,v:1}};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(__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(__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:3};exports.BROADCAST_PATH="/transactions/broadcast";exports.SIGN_PATH="/transactions/sign"},{}],16:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};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},{}],17:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};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":16}],18:[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}],19:[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}],20:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var transactions_factory_1=require("@wavesenterprise/transactions-factory");var config_1=require("./config");var base58ToString_1=require("./utils/base58ToString");exports.default={getAddressFromPublicKey:function(publicKey){var publicKeyBytes=transactions_factory_1.libs.base58.decode(publicKey);return config_1.default.isCryptoGost()?transactions_factory_1.utils.cryptoGost.buildRawAddress(publicKeyBytes):transactions_factory_1.utils.crypto.buildRawAddress(publicKeyBytes)},calculateTimeDiff:function(nodeTime,userTime){return nodeTime-userTime},base58:{encode:transactions_factory_1.libs.base58.encode,decode:transactions_factory_1.libs.base58.decode,base58ToString:base58ToString_1.base58ToString}}},{"./config":14,"./utils/base58ToString":21,"@wavesenterprise/transactions-factory":undefined}],21:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.base58ToString=void 0;var transactions_factory_1=require("@wavesenterprise/transactions-factory");function base58ToString(base58String){var arr=transactions_factory_1.libs.base58.decode(base58String);var str=String.fromCharCode.apply(null,arr);return decodeURIComponent(escape(str))}exports.base58ToString=base58ToString},{"@wavesenterprise/transactions-factory":undefined}],22:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||function(){__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};return __assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:true});exports.createRemapper=exports.precisionCheck=exports.getTimestamp=exports.removeAliasPrefix=exports.removeRecipientPrefix=exports.normalizeAssetId=void 0;var transactions_factory_1=require("@wavesenterprise/transactions-factory");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 transactions_factory_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 transactions_factory_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(__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(__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":14,"../constants":15,"../libs/bignumber":18,"@wavesenterprise/transactions-factory":undefined}],23:[function(require,module,exports){"use strict";var __assign=this&&this.__assign||function(){__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};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};var _a;Object.defineProperty(exports,"__esModule",{value:true});exports.createTxRequestWrapper=exports.wrapTxRequest=exports.createFetchWrapper=exports.processJSON=exports.normalizePath=exports.normalizeHost=exports.POST_TEMPLATE=exports.SAFE_JSON_STRINGIFY=exports.SAFE_JSON_PARSE=void 0;var create=require("parse-json-bignumber");var constants_1=require("../constants");var WavesRequestError_1=require("../errors/WavesRequestError");var config_1=require("../config");var bignumber_1=require("../libs/bignumber");exports.SAFE_JSON_PARSE=create({BigNumber:bignumber_1.default}).parse;exports.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(exports.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;exports.wrapTxRequest=function(factory,preRemapAsync,postRemap,callback,withProofs){if(withProofs===void 0){withProofs=false}return function(data,keyPair){return __awaiter(void 0,void 0,void 0,function(){var preData,tx,signature,postData,sendData;return __generator(this,function(_a){switch(_a.label){case 0:preData=__assign(__assign({},data),{senderPublicKey:keyPair.publicKey});if(!preRemapAsync)return[3,2];return[4,preRemapAsync(preData)];case 1:preData=_a.sent();_a.label=2;case 2:tx=factory(preData);return[4,tx.getSignature(keyPair.privateKey)];case 3:signature=_a.sent();postData=__assign(__assign(__assign({},preData),withProofs?{proofs:[signature]}:{signature:signature}),{version:tx.version,type:tx.tx_type});if(postRemap){postData=postRemap(postData)}sendData=__assign(__assign({},exports.POST_TEMPLATE),{rejectUnauthorized:false,credentials:"include",body:exports.SAFE_JSON_STRINGIFY(postData,null,null)});return[2,callback(sendData)]}})})}};exports.createTxRequestWrapper=function(fetchInstance){return function(preRemapAsync,postRemap,nodeAddress,data,extraData){return __awaiter(void 0,void 0,void 0,function(){var newData,body,tx;return __generator(this,function(_a){switch(_a.label){case 0:nodeAddress=nodeAddress.replace(/\/+$/,"");newData=data;if(!preRemapAsync)return[3,2];return[4,preRemapAsync(newData)];case 1:newData=_a.sent();_a.label=2;case 2:if(postRemap){newData=postRemap(newData)}body=__assign(__assign(__assign({},newData),extraData),{type:data.type,version:data.version});if(body.assetId===""){body.assetId=null}if(body.feeAssetId===""){body.feeAssetId=null}return[4,fetchInstance(nodeAddress+constants_1.SIGN_PATH,__assign(__assign({},exports.POST_TEMPLATE),{credentials:"include",body:exports.SAFE_JSON_STRINGIFY(body,null,null)})).then(processJSON)];case 3:tx=_a.sent();return[2,fetchInstance(nodeAddress+constants_1.BROADCAST_PATH,__assign(__assign({},exports.POST_TEMPLATE),{credentials:"include",body:exports.SAFE_JSON_STRINGIFY(tx,null,null)})).then(processJSON)]}})})}}},{"../config":14,"../constants":15,"../errors/WavesRequestError":17,"../libs/bignumber":18,"parse-json-bignumber":undefined}]},{},[1])(1)});
{
"name": "@vostokplatform/waves-api",
"version": "2.1.5-RC2",
"version": "2.2.0",
"description": "Waves Enterprise client-side API library",

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

@@ -74,7 +74,2 @@ "use strict";

},
precision: {
type: ts_api_validator_1.NumberPart,
required: true,
isValid: remap_1.precisionCheck
},
decimals: {

@@ -98,3 +93,2 @@ type: ts_api_validator_1.NumberPart,

transactionType: null,
precision: 'decimals',
quantity: {

@@ -101,0 +95,0 @@ from: 'string',

@@ -59,3 +59,3 @@ import { TRANSACTIONS } from '@wavesenterprise/transactions-factory';

},
precision: {
decimals: {
type: NumberPart,

@@ -65,7 +65,2 @@ required: true,

},
decimals: { // TODO: check field rename precision -> decimals in postIssue
type: NumberPart,
required: true,
isValid: precisionCheck
},
reissuable: schemaFields.reissuable,

@@ -85,3 +80,2 @@ fee: schemaFields.issueFee,

transactionType: null,
precision: 'decimals',
quantity: {

@@ -88,0 +82,0 @@ from: 'string',

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

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