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C1D,cAAc;;AAghBhB;IAEA,2CAAe;oBACb;8BACA;AACF;AACO,eAAe,0CAAe,OAAiB;IACpD,MAAM,SAAS,IAAI;IACnB,MAAM,OAAO,IAAI,CAAC;IAClB,OAAO;AACT","sources":["src/ravencoinWallet.ts","src/blockchain/sweep.ts","src/blockchain/SendManyTransaction.ts","src/Errors.ts","src/utils.ts","src/blockchain/Transaction.ts","src/getBaseCurrencyByNetwork.ts","src/getBalance.ts","src/contants.ts","src/getAssets.ts"],"sourcesContent":["import { getRPC, methods } from \"@ravenrebels/ravencoin-rpc\";\nimport RavencoinKey from \"@ravenrebels/ravencoin-key\";\nimport Signer from \"@ravenrebels/ravencoin-sign-transaction\";\nimport {\n ChainType,\n IAddressDelta,\n IAddressMetaData,\n IMempoolEntry,\n IOptions,\n ISend,\n ISendManyOptions,\n ISendResult,\n IUTXO,\n SweepResult,\n} from \"./Types\";\n\nimport { sweep } from \"./blockchain/sweep\";\nimport { Transaction } from \"./blockchain/Transaction\";\nimport { SendManyTransaction } from \"./blockchain/SendManyTransaction\";\nimport { getBaseCurrencyByNetwork } from \"./getBaseCurrencyByNetwork\";\nimport { getBalance } from \"./getBalance\";\nimport { ValidationError } from \"./Errors\";\nimport { getAssets } from \"./getAssets\";\n\nexport { Transaction };\nexport { SendManyTransaction };\nconst URL_RAVENCOIN_MAINNET = \"https://rvn-rpc-mainnet.ting.finance/rpc\";\nconst URL_RAVENCOIN_TESTNET = \"https://rvn-rpc-testnet.ting.finance/rpc\";\nconst URL_EVRMORE_MAINNET = \"https://evr-rpc-mainnet.ting.finance/rpc\";\n\n//Avoid singleton (anti-pattern)\n//Meaning multiple instances of the wallet must be able to co-exist\n\nexport class Wallet {\n rpc = getRPC(\"anonymous\", \"anonymous\", URL_RAVENCOIN_MAINNET);\n _mnemonic = \"\";\n network: ChainType = \"rvn\";\n addressObjects: Array<IAddressMetaData> = [];\n receiveAddress = \"\";\n changeAddress = \"\";\n addressPosition = 0;\n baseCurrency = \"RVN\"; //Default is RVN but it could be EVR\n offlineMode = false;\n setBaseCurrency(currency: string) {\n this.baseCurrency = currency;\n }\n getBaseCurrency() {\n return this.baseCurrency;\n }\n /**\n * Sweeping a private key means to send all the funds the address holds to your your wallet.\n * The private key you sweep does not become a part of your wallet.\n *\n * NOTE: the address you sweep needs to cointain enough RVN to pay for the transaction\n *\n * @param WIF the private key of the address that you want move funds from\n * @returns either a string, that is the transaction id or null if there were no funds to send\n */\n sweep(WIF: string, onlineMode: boolean): Promise<SweepResult> {\n const wallet = this;\n\n return sweep(WIF, wallet, onlineMode);\n }\n getAddressObjects() {\n return this.addressObjects;\n }\n getAddresses(): Array<string> {\n const addresses = this.addressObjects.map((obj) => {\n return obj.address;\n });\n return addresses;\n }\n\n async init(options: IOptions) {\n let username = \"anonymous\";\n let password = \"anonymous\";\n let url = URL_RAVENCOIN_MAINNET;\n\n //VALIDATION\n if (!options) {\n throw Error(\"option argument is mandatory\");\n }\n\n if (options.offlineMode === true) {\n this.offlineMode = true;\n }\n if (!options.mnemonic) {\n throw Error(\"option.mnemonic is mandatory\");\n }\n if (options.network === \"rvn-test\") {\n url = URL_RAVENCOIN_TESTNET;\n }\n if (options.network === \"evr\") {\n url = URL_EVRMORE_MAINNET;\n }\n url = options.rpc_url || url;\n password = options.rpc_password || password;\n username = options.rpc_username || username;\n\n if (options.network) {\n this.network = options.network;\n this.setBaseCurrency(getBaseCurrencyByNetwork(options.network));\n }\n\n this.rpc = getRPC(username, password, url);\n this._mnemonic = options.mnemonic;\n\n //Generating the hd key is slow, so we re-use the object\n const hdKey = RavencoinKey.getHDKey(this.network, this._mnemonic);\n const coinType = RavencoinKey.getCoinType(this.network);\n const ACCOUNT = 0;\n\n const minAmountOfAddresses = Number.isFinite(options.minAmountOfAddresses)\n ? options.minAmountOfAddresses\n : 0;\n\n let doneDerivingAddresses = false;\n while (doneDerivingAddresses === false) {\n //We add new addresses to tempAddresses so we can check history for the last 20\n const tempAddresses = [] as string[];\n\n for (let i = 0; i < 20; i++) {\n const external = RavencoinKey.getAddressByPath(\n this.network,\n hdKey,\n `m/44'/${coinType}'/${ACCOUNT}'/0/${this.addressPosition}`\n );\n\n const internal = RavencoinKey.getAddressByPath(\n this.network,\n hdKey,\n `m/44'/${coinType}'/${ACCOUNT}'/1/${this.addressPosition}`\n );\n\n this.addressObjects.push(external);\n this.addressObjects.push(internal);\n this.addressPosition++;\n\n tempAddresses.push(external.address + \"\");\n tempAddresses.push(internal.address + \"\");\n }\n\n if (\n minAmountOfAddresses &&\n minAmountOfAddresses >= this.addressPosition\n ) {\n //In case we intend to create extra addresses on startup\n doneDerivingAddresses = false;\n } else if (this.offlineMode === true) {\n //BREAK generation of addresses and do NOT check history on the network\n doneDerivingAddresses = true;\n } else {\n //If no history, break\n doneDerivingAddresses =\n false === (await this.hasHistory(tempAddresses));\n }\n }\n }\n async hasHistory(addresses: Array<string>): Promise<boolean> {\n const includeAssets = true;\n const obj = {\n addresses,\n };\n\n const asdf = (await this.rpc(methods.getaddressbalance, [\n obj,\n includeAssets,\n ])) as any;\n\n //@ts-ignore\n const hasReceived = Object.values(asdf).find((asset) => asset.received > 0);\n\n return !!hasReceived;\n }\n\n async _getFirstUnusedAddress(external: boolean) {\n //First, check if lastReceivedAddress\n if (external === true && this.receiveAddress) {\n const asdf = await this.hasHistory([this.receiveAddress]);\n if (asdf === false) {\n return this.receiveAddress;\n }\n }\n if (external === false && this.changeAddress) {\n const asdf = await this.hasHistory([this.changeAddress]);\n if (asdf === false) {\n return this.changeAddress;\n }\n }\n\n //First make a list of relevant addresses, either external (even) or change (odd)\n const addresses: string[] = [];\n\n this.getAddresses().map(function (address: string, index: number) {\n if (external === true && index % 2 === 0) {\n addresses.push(address);\n } else if (external === false && index % 2 !== 0) {\n addresses.push(address);\n }\n });\n\n //Use BINARY SEARCH\n\n // Binary search implementation to find the first item with `history` set to false\n const binarySearch = async (_addresses: string[]) => {\n let low = 0;\n let high = _addresses.length - 1;\n let result = \"\";\n\n while (low <= high) {\n const mid = Math.floor((low + high) / 2);\n const addy = _addresses[mid];\n\n const hasHistory = await this.hasHistory([addy]);\n if (hasHistory === false) {\n result = addy;\n high = mid - 1; // Continue searching towards the left\n } else {\n low = mid + 1; // Continue searching towards the right\n }\n }\n\n return result;\n };\n\n const result = await binarySearch(addresses);\n\n if (!result) {\n //IF we have not found one, return the first address\n return addresses[0];\n }\n if (external === true) {\n this.receiveAddress = result;\n } else {\n this.changeAddress = result;\n }\n\n return result;\n }\n\n async getHistory(): Promise<IAddressDelta[]> {\n const assetName = \"\"; //Must be empty string, NOT \"*\"\n const addresses = this.getAddresses();\n const deltas = this.rpc(methods.getaddressdeltas, [\n { addresses, assetName },\n ]);\n //@ts-ignore\n const addressDeltas: IAddressDelta[] = deltas as IAddressDelta[];\n return addressDeltas;\n }\n async getMempool(): Promise<IMempoolEntry[]> {\n const method = methods.getaddressmempool;\n const includeAssets = true;\n const params = [{ addresses: this.getAddresses() }, includeAssets];\n return this.rpc(method, params) as Promise<IMempoolEntry[]>;\n }\n async getReceiveAddress() {\n const isExternal = true;\n return this._getFirstUnusedAddress(isExternal);\n }\n\n async getChangeAddress() {\n const isExternal = false;\n return this._getFirstUnusedAddress(isExternal);\n }\n /**\n *\n * @param assetName if present, only return UTXOs for that asset, otherwise for all assets\n * @returns UTXOs for assets\n */\n async getAssetUTXOs(assetName?: string): Promise<IUTXO[]> {\n //If no asset name, set to wildcard, meaning all assets\n const _assetName = !assetName ? \"*\" : assetName;\n const chainInfo = false;\n const params = [\n { addresses: this.getAddresses(), chainInfo, assetName: _assetName },\n ];\n\n return this.rpc(methods.getaddressutxos, params);\n }\n async getUTXOs() {\n return this.rpc(methods.getaddressutxos, [\n { addresses: this.getAddresses() },\n ]);\n }\n\n getPrivateKeyByAddress(address: string) {\n const f = this.addressObjects.find((a) => a.address === address);\n\n if (!f) {\n return undefined;\n }\n return f.WIF;\n }\n async sendRawTransaction(raw: string): Promise<string> {\n return this.rpc(\"sendrawtransaction\", [raw]);\n }\n\n async send(options: ISend): Promise<ISendResult> {\n //ACTUAL SENDING TRANSACTION\n\n //Important, do not swallow the exceptions/errors of createTransaction, let them fly\n const sendResult: ISendResult = await this.createTransaction(options);\n\n const id = await this.rpc(\"sendrawtransaction\", [\n sendResult.debug.signedTransaction,\n ]);\n sendResult.transactionId = id;\n\n return sendResult;\n }\n\n async sendMany({ outputs, assetName }: ISendManyOptions) {\n const options = {\n wallet: this,\n outputs,\n assetName,\n };\n const sendResult: ISendResult = await this.createSendManyTransaction(\n options\n );\n\n //ACTUAL SENDING TRANSACTION\n //Important, do not swallow the exceptions/errors of createSendManyTransaction, let them fly\n\n try {\n const id = await this.rpc(\"sendrawtransaction\", [\n sendResult.debug.signedTransaction,\n ]);\n sendResult.transactionId = id;\n\n return sendResult;\n } catch (e) {\n throw new Error(\n \"Error while sending, perhaps you have pending transaction? Please try again.\"\n );\n }\n }\n /**\n * Does all the heavy lifting regarding creating a SendManyTransaction\n * but it does not broadcast the actual transaction.\n * Perhaps the user wants to accept the transaction fee?\n * @param options\n * @returns An transaction that has not been broadcasted\n */\n async createTransaction(options: ISend): Promise<ISendResult> {\n const { amount, toAddress } = options;\n let { assetName } = options;\n\n if (!assetName) {\n assetName = this.baseCurrency;\n }\n\n //Validation\n if (!toAddress) {\n throw Error(\"Wallet.send toAddress is mandatory\");\n }\n if (!amount) {\n throw Error(\"Wallet.send amount is mandatory\");\n }\n const changeAddress = await this.getChangeAddress();\n\n if (changeAddress === toAddress) {\n throw new Error(\"Change address cannot be the same as toAddress\");\n }\n const transaction = new Transaction({\n assetName,\n amount,\n toAddress,\n wallet: this,\n /* optional */\n forcedChangeAddressAssets: options.forcedChangeAddressAssets,\n forcedUTXOs: options.forcedUTXOs,\n forcedChangeAddressBaseCurrency: options.forcedChangeAddressBaseCurrency,\n });\n\n await transaction.loadData();\n\n const inputs = transaction.getInputs();\n const outputs = await transaction.getOutputs();\n\n const privateKeys = transaction.getPrivateKeys();\n\n const raw = await this.rpc(\"createrawtransaction\", [inputs, outputs]);\n const signed = Signer.sign(\n this.network,\n raw,\n transaction.getUTXOs(),\n privateKeys\n );\n\n try {\n // const id = await this.rpc(\"sendrawtransaction\", [signed]);\n const sendResult: ISendResult = {\n transactionId: null,\n debug: {\n amount,\n assetName,\n fee: transaction.getFee(),\n inputs,\n outputs,\n privateKeys,\n rawUnsignedTransaction: raw,\n rvnChangeAmount: transaction.getBaseCurrencyChange(),\n rvnAmount: transaction.getBaseCurrencyAmount(),\n signedTransaction: signed,\n UTXOs: transaction.getUTXOs(),\n walletMempool: transaction.getWalletMempool(),\n },\n };\n return sendResult;\n } catch (e) {\n throw new Error(\n \"Error while sending, perhaps you have pending transaction? Please try again.\"\n );\n }\n }\n\n /**\n * Does all the heavy lifting regarding creating a transaction\n * but it does not broadcast the actual transaction.\n * Perhaps the user wants to accept the transaction fee?\n * @param options\n * @returns An transaction that has not been broadcasted\n */\n async createSendManyTransaction(options: {\n assetName?: string;\n outputs: { [key: string]: number };\n }): Promise<ISendResult> {\n let { assetName } = options;\n\n if (!assetName) {\n assetName = this.baseCurrency;\n }\n\n //Validation\n if (!options.outputs) {\n throw Error(\"Wallet.createSendManyTransaction outputs is mandatory\");\n } else if (Object.keys(options.outputs).length === 0) {\n throw new ValidationError(\n \"outputs is mandatory, shoud be an object with address as keys and amounts (numbers) as values\"\n );\n }\n const changeAddress = await this.getChangeAddress();\n\n const toAddresses = Object.keys(options.outputs);\n if (toAddresses.includes(changeAddress)) {\n throw new Error(\"You cannot send to your current change address\");\n }\n const transaction = new SendManyTransaction({\n assetName,\n outputs: options.outputs,\n wallet: this,\n });\n\n await transaction.loadData();\n\n const inputs = transaction.getInputs();\n const outputs = await transaction.getOutputs();\n\n const privateKeys = transaction.getPrivateKeys();\n\n const raw = await this.rpc(\"createrawtransaction\", [inputs, outputs]);\n const signed = Signer.sign(\n this.network,\n raw,\n transaction.getUTXOs(),\n privateKeys\n );\n\n try {\n const sendResult: ISendResult = {\n transactionId: null,\n debug: {\n amount: transaction.getAmount(),\n assetName,\n fee: transaction.getFee(),\n inputs,\n outputs,\n privateKeys,\n rawUnsignedTransaction: raw,\n rvnChangeAmount: transaction.getBaseCurrencyChange(),\n rvnAmount: transaction.getBaseCurrencyAmount(),\n signedTransaction: signed,\n UTXOs: transaction.getUTXOs(),\n walletMempool: transaction.getWalletMempool(),\n },\n };\n return sendResult;\n } catch (e) {\n throw new Error(\n \"Error while sending, perhaps you have pending transaction? Please try again.\"\n );\n }\n }\n\n /**\n * This method checks if an UTXO is being spent in the mempool.\n * rpc getaddressutxos will list available UTXOs on the chain.\n * BUT an UTXO can be being spent by a transaction in mempool.\n *\n * @param utxo\n * @returns boolean true if utxo is being spent in mempool, false if not\n */\n async isSpentInMempool(utxo: IUTXO) {\n const details = await this.rpc(\"gettxout\", [utxo.txid, utxo.outputIndex]);\n return details === null;\n }\n async getAssets() {\n return getAssets(this, this.getAddresses());\n }\n async getBalance() {\n const a = this.getAddresses();\n return getBalance(this, a);\n }\n async convertMempoolEntryToUTXO(mempoolEntry: IMempoolEntry): Promise<IUTXO> {\n //Mempool items might not have the script attbribute, we need it\n const out = await this.rpc(\"gettxout\", [\n mempoolEntry.txid,\n mempoolEntry.index,\n true,\n ]);\n\n const utxo = {\n ...mempoolEntry,\n script: out.scriptPubKey.hex,\n outputIndex: mempoolEntry.index,\n value: mempoolEntry.satoshis / 1e8,\n };\n return utxo;\n }\n\n /**\n * Get list of spendable UTXOs in mempool.\n * Note: a UTXO in mempool can already be \"being spent\"\n * @param mempool (optional)\n * @returns list of UTXOs in mempool ready to spend\n */\n async getUTXOsInMempool(mempool?: IMempoolEntry[]) {\n //If no mempool argument, fetch mempool\n let _mempool = mempool;\n if (!_mempool) {\n const m = await this.getMempool();\n _mempool = m;\n }\n const mySet = new Set();\n for (let item of _mempool) {\n if (!item.prevtxid) {\n continue;\n }\n const value = item.prevtxid + \"_\" + item.prevout;\n mySet.add(value);\n }\n\n const spendable = _mempool.filter((item) => {\n if (item.satoshis < 0) {\n return false;\n }\n const value = item.txid + \"_\" + item.index;\n return mySet.has(value) === false;\n });\n\n const utxos: IUTXO[] = [];\n\n for (let s of spendable) {\n const u = await this.convertMempoolEntryToUTXO(s);\n utxos.push(u);\n }\n return utxos;\n }\n}\n\nexport default {\n createInstance,\n getBaseCurrencyByNetwork,\n};\nexport async function createInstance(options: IOptions): Promise<Wallet> {\n const wallet = new Wallet();\n await wallet.init(options);\n return wallet;\n}\n","import RavencoinKey, { Network } from \"@ravenrebels/ravencoin-key\";\nimport Signer from \"@ravenrebels/ravencoin-sign-transaction\";\n\n!!Signer.sign; //\"Idiocracy\" but prevents bundle tools such as PARCEL to strip this dependency out on build.\n\nimport { Wallet } from \"../ravencoinWallet\";\nimport { IInput, SweepResult } from \"../Types\";\nimport { shortenNumber } from \"./SendManyTransaction\";\n\n//sight rate burger maid melody slogan attitude gas account sick awful hammer\n//OH easter egg ;)\nconst WIF = \"Kz5U4Bmhrng4o2ZgwBi5PjtorCeq2dyM7axGQfdxsBSwCKi5ZfTw\";\n\n/**\n *\n * @param WIF the private key in wallet import format that you want to sweep/empty\n * @param wallet your wallet\n * @returns a string of a signed transaction, you have to broad cast it\n */\nexport async function sweep(\n WIF: string,\n wallet: Wallet,\n onlineMode: boolean\n): Promise<SweepResult> {\n const privateKey = RavencoinKey.getAddressByWIF(wallet.network, WIF);\n\n const result: SweepResult = {};\n const rpc = wallet.rpc;\n const obj = {\n addresses: [privateKey.address],\n };\n const baseCurrencyUTXOs = await rpc(\"getaddressutxos\", [obj]);\n const obj2 = {\n addresses: [privateKey.address],\n assetName: \"*\",\n };\n\n const assetUTXOs = await rpc(\"getaddressutxos\", [obj2]);\n const UTXOs = assetUTXOs.concat(baseCurrencyUTXOs);\n result.UTXOs = UTXOs;\n //Create a raw transaction with ALL UTXOs\n\n if (UTXOs.length === 0) {\n result.errorDescription = \"Address \" + privateKey.address + \" has no funds\";\n return result;\n }\n const balanceObject = {};\n\n UTXOs.map((utxo) => {\n if (!balanceObject[utxo.assetName]) {\n balanceObject[utxo.assetName] = 0;\n }\n balanceObject[utxo.assetName] += utxo.satoshis;\n });\n\n const keys = Object.keys(balanceObject);\n\n //Start simple, get the first addresses from the wallet\n\n const outputs = {};\n\n const fixedFee = 0.02; // should do for now\n keys.map((assetName, index) => {\n const address = wallet.getAddresses()[index];\n const amount = balanceObject[assetName] / 1e8;\n\n if (assetName === wallet.baseCurrency) {\n outputs[address] = shortenNumber(amount - fixedFee);\n } else {\n outputs[address] = {\n transfer: {\n [assetName]: amount,\n },\n };\n }\n });\n result.outputs = outputs;\n\n //Convert from UTXO format to INPUT fomat\n const inputs: Array<IInput> = UTXOs.map((utxo, index) => {\n /* {\n \"txid\":\"id\", (string, required) The transaction id\n \"vout\":n, (number, required) The output number\n \"sequence\":n (number, optional) The sequence number\n } \n */\n\n const input: IInput = {\n txid: utxo.txid,\n vout: utxo.outputIndex,\n };\n return input;\n });\n //Create raw transaction\n const rawHex = await rpc(\"createrawtransaction\", [inputs, outputs]);\n\n const privateKeys = {\n [privateKey.address]: WIF,\n };\n const signedHex = Signer.sign(wallet.network, rawHex, UTXOs, privateKeys);\n result.rawTransaction = signedHex;\n if (onlineMode === true) {\n result.transactionId = await rpc(\"sendrawtransaction\", [signedHex]);\n }\n\n return result;\n}\n","import { InsufficientFundsError, ValidationError } from \"../Errors\";\nimport { Wallet } from \"../ravencoinWallet\";\nimport {\n IForcedUTXO,\n IMempoolEntry,\n ISendManyTransactionOptions,\n IUTXO,\n} from \"../Types\";\nimport { removeDuplicates } from \"../utils\";\n/**\n * SendManyTransaction Class\n *\n * This class is responsible for calculating the necessary steps to broadcast a Ravencoin transaction:\n * 1) Identify available UTXOs that are not already spent in the mempool.\n * 2) Determine the required number of UTXOs for creating this transaction.\n * 3) Define the transaction's inputs and outputs.\n * 4) Sign the transaction.\n *\n * Note: this class does not do the actual broadcasting; it is up to the user.\n *\n * How does it work?\n * 1) Create an instance:\n * const transaction = new SendManyTransaction({\n * assetName,\n * outputs: options.outputs,\n * wallet: this,\n * });\n *\n * 2) Load data from the network:\n * transaction.loadData();\n */\n\nexport class SendManyTransaction {\n _allUTXOs: IUTXO[]; //all UTXOs that we know of\n\n private assetName: string;\n feerate = 1; //When loadData is called, this attribute is updated from the blockchain wallet = null;\n\n private wallet: Wallet;\n private outputs: any;\n private walletMempool: IMempoolEntry[] = [];\n private forcedUTXOs: IForcedUTXO[] = [];\n private forcedChangeAddressBaseCurrency: string | undefined = \"\";\n private forcedChangeAddressAssets: string | undefined = \"\";\n constructor(options: ISendManyTransactionOptions) {\n const { wallet, outputs, assetName } = options;\n this.assetName = !assetName ? wallet.baseCurrency : assetName;\n this.wallet = wallet;\n this.outputs = outputs;\n this.forcedChangeAddressAssets = options.forcedChangeAddressAssets;\n this.forcedChangeAddressBaseCurrency =\n options.forcedChangeAddressBaseCurrency;\n //Tag forced UTXOs with the \"force\" flag\n if (options.forcedUTXOs) {\n options.forcedUTXOs.map((f) => (f.utxo.forced = true));\n this.forcedUTXOs = options.forcedUTXOs;\n }\n }\n /**\n *\n * @returns forced UTXOs for this transaction, that means \"no matter want, spend this UTXO\"\n */\n getForcedUTXOs() {\n return this.forcedUTXOs;\n }\n getWalletMempool() {\n return this.walletMempool;\n }\n getSizeInKB() {\n // We need to estimate the size of the transaction to calculate the fee,\n // which in turn affects the transaction size itself.\n // This is a chicken-and-egg situation, requiring an initial size estimate.\n\n const utxos = this.predictUTXOs();\n\n const baseSize = 400;\n const assumedSizePerUTXO = 320; //Add 320 bytes to the size per UTXO we use\n const assumedSizePerOutput = 160;\n\n const bytes =\n (utxos.length + 1) * assumedSizePerUTXO +\n Object.keys(this.outputs).length * assumedSizePerOutput;\n\n const kb = (baseSize + bytes) / 1024;\n\n return kb;\n }\n async loadData() {\n //Load blockchain information async, and wait for it\n const mempoolPromise = this.wallet.getMempool();\n const assetUTXOsPromise = this.wallet.getAssetUTXOs();\n const baseCurencyUTXOsPromise = this.wallet.getUTXOs();\n const feeRatePromise = this.getFeeRate();\n\n this.walletMempool = await mempoolPromise;\n const assetUTXOs = await assetUTXOsPromise;\n const baseCurrencyUTXOs = await baseCurencyUTXOsPromise;\n this.feerate = await feeRatePromise;\n\n const mempoolUTXOs = await this.wallet.getUTXOsInMempool(\n this.walletMempool\n );\n\n const _allUTXOsTemp = assetUTXOs\n .concat(baseCurrencyUTXOs)\n .concat(mempoolUTXOs);\n\n //add forced UTXO to the beginning of the array\n //method getUTXOs will remove all duplicates\n if (this.forcedUTXOs) {\n for (let f of this.forcedUTXOs) {\n const utxo = f.utxo;\n _allUTXOsTemp.unshift(utxo);\n }\n }\n\n //Collect UTXOs that are not currently being spent in the mempool\n const allUTXOs = _allUTXOsTemp.filter((utxo) => {\n //Always include forced UTXOs\n if (utxo.forced === true) {\n return true;\n }\n const objInMempool = this.walletMempool.find((mempoolEntry) => {\n if (mempoolEntry.prevtxid) {\n const result =\n mempoolEntry.prevtxid === utxo.txid &&\n mempoolEntry.prevout === utxo.outputIndex;\n\n return result;\n }\n return false;\n });\n\n return !objInMempool;\n });\n //Sort utxos lowest first\n //const sorted = allUTXOs.sort(sortBySatoshis);\n\n //Remove duplicates, like if we have added an UTXO as forced, but it is already\n //in the wallet as a normal UTXO\n this._allUTXOs = removeDuplicates(allUTXOs);\n }\n getAmount() {\n let total = 0;\n\n const values: number[] = Object.values(this.outputs);\n values.map((value) => (total += value));\n\n return total;\n }\n getUTXOs(): IUTXO[] {\n //NOTE, if we have FORCED utxos, they have to be included no matter what\n\n let result: IUTXO[] = [];\n if (this.isAssetTransfer() === true) {\n const assetAmount = this.getAmount();\n const baseCurrencyAmount = this.getBaseCurrencyAmount();\n const baseCurrencyUTXOs = getEnoughUTXOs(\n this._allUTXOs,\n this.wallet.baseCurrency,\n baseCurrencyAmount\n );\n const assetUTXOs = getEnoughUTXOs(\n this._allUTXOs,\n this.assetName,\n assetAmount\n );\n\n result = assetUTXOs.concat(baseCurrencyUTXOs);\n } else {\n result = getEnoughUTXOs(\n this._allUTXOs,\n this.wallet.baseCurrency,\n this.getBaseCurrencyAmount()\n );\n }\n\n return result;\n }\n /*\n Check the blockchain, network.\n Is this transaction still valid? Will it be accepted?\n */\n validate() {}\n predictUTXOs() {\n let utxos: IUTXO[] = [];\n\n if (this.isAssetTransfer()) {\n utxos = getEnoughUTXOs(this._allUTXOs, this.assetName, this.getAmount());\n } else {\n utxos = getEnoughUTXOs(\n this._allUTXOs,\n this.wallet.baseCurrency,\n this.getAmount()\n );\n }\n\n return utxos;\n }\n getBaseCurrencyAmount() {\n const fee = this.getFee();\n\n if (this.isAssetTransfer() === true) {\n return fee;\n } else return this.getAmount() + fee;\n }\n getBaseCurrencyChange() {\n const enoughUTXOs = getEnoughUTXOs(\n this._allUTXOs,\n this.wallet.baseCurrency,\n this.getBaseCurrencyAmount()\n );\n\n let total = 0;\n for (let utxo of enoughUTXOs) {\n if (utxo.assetName !== this.wallet.baseCurrency) {\n continue;\n }\n total = total + utxo.satoshis / 1e8;\n }\n\n const result = total - this.getBaseCurrencyAmount();\n\n return shortenNumber(result);\n }\n getAssetChange() {\n const enoughUTXOs = getEnoughUTXOs(\n this._allUTXOs,\n this.assetName,\n this.getAmount()\n );\n let total = 0;\n for (let utxo of enoughUTXOs) {\n if (utxo.assetName !== this.assetName) {\n continue;\n }\n total = total + utxo.satoshis / 1e8;\n }\n return total - this.getAmount();\n }\n isAssetTransfer() {\n return this.assetName !== this.wallet.baseCurrency;\n }\n\n async getOutputs() {\n //we take the declared outputs and add change outputs\n const totalOutputs = {};\n const changeAddressBaseCurrency =\n this.forcedChangeAddressBaseCurrency ||\n (await this.wallet.getChangeAddress());\n\n if (this.isAssetTransfer() === true) {\n //Validate: change address cant be toAddress\n const toAddresses = Object.keys(this.outputs);\n if (toAddresses.includes(changeAddressBaseCurrency) === true) {\n throw new ValidationError(\n \"Change address cannot be the same as to address\"\n );\n }\n totalOutputs[changeAddressBaseCurrency] = this.getBaseCurrencyChange();\n const changeAddressAsset = await this._getChangeAddressAssets();\n //Validate change address can never be the same as toAddress\n if (toAddresses.includes(changeAddressAsset) === true) {\n throw new ValidationError(\n \"Change address cannot be the same as to address\"\n );\n }\n if (this.getAssetChange() > 0) {\n totalOutputs[changeAddressAsset] = {\n transfer: {\n [this.assetName]: Number(this.getAssetChange().toFixed(8)),\n },\n };\n }\n\n for (let addy of Object.keys(this.outputs)) {\n const amount = this.outputs[addy];\n totalOutputs[addy] = {\n transfer: {\n [this.assetName]: amount,\n },\n };\n }\n } else {\n for (let addy of Object.keys(this.outputs)) {\n const amount = this.outputs[addy];\n totalOutputs[addy] = amount;\n }\n\n totalOutputs[changeAddressBaseCurrency] = this.getBaseCurrencyChange();\n }\n return totalOutputs;\n }\n\n async _getChangeAddressAssets() {\n if (this.forcedChangeAddressAssets) {\n return this.forcedChangeAddressAssets;\n }\n const changeAddressBaseCurrency = await this.wallet.getChangeAddress();\n const index = this.wallet.getAddresses().indexOf(changeAddressBaseCurrency);\n const changeAddressAsset = this.wallet.getAddresses()[index + 2];\n return changeAddressAsset;\n }\n getInputs() {\n return this.getUTXOs().map((obj) => {\n return { address: obj.address, txid: obj.txid, vout: obj.outputIndex };\n });\n }\n\n getPrivateKeys() {\n const addressO