@mutants/cardano
Advanced tools
Comparing version 1.5.7 to 1.5.8
@@ -47,4 +47,6 @@ import { TransactionOutput } from "../builders/transaction.builder"; | ||
calculateOutputs: (inputsUtxo: CardanoUTXO[], requiredInputs: RequiredInputs, requiredOutputs: RequiredOutputs, collateral?: CardanoUTXO) => TransactionOutput[]; | ||
getAvailableCoinFromUTXO: (utxo: CardanoUTXO) => number; | ||
getTotalAvailableCoin: (utxos: CardanoUTXO[]) => number; | ||
sort: (utxos: CardanoUTXO[]) => CardanoUTXO[]; | ||
hasAsset: (utxo: CardanoUTXO, asset: string) => boolean; | ||
}; |
@@ -99,3 +99,3 @@ "use strict"; | ||
})) || | ||
getAvailableCoinFromUTXO(utxo) <= COLLATERAL_VALUE // TODO: confirm if this is really an issue - Some UTXOs with 5000000 total coin value keep throwing 'BadInputs' | ||
getAvailableCoinFromUTXO(utxo) === COLLATERAL_VALUE // TODO: confirm if this is really an issue - Some UTXOs with 5000000 total coin value keep throwing 'BadInputs' | ||
) | ||
@@ -175,3 +175,3 @@ return adaUtxos; | ||
else { | ||
cleanAdaUtxos.totalCoin += utxo.utxo.amount.coin; | ||
cleanAdaUtxos.totalCoin += getAvailableCoinFromUTXO(utxo); | ||
cleanAdaUtxos.utxos.push(utxo); | ||
@@ -315,2 +315,4 @@ return cleanAdaUtxos; | ||
calculateOutputs: calculateOutputs, | ||
getAvailableCoinFromUTXO: getAvailableCoinFromUTXO, | ||
getTotalAvailableCoin: getTotalAvailableCoin, | ||
sort: sort, | ||
@@ -317,0 +319,0 @@ hasAsset: hasAsset, |
{ | ||
"name": "@mutants/cardano", | ||
"version": "1.5.7", | ||
"version": "1.5.8", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
@@ -59,4 +59,4 @@ jest.mock(".."); | ||
test("ada total coin should be 1583758768", () => { | ||
expect(adaUtxos.totalCoin).toBe(1583758768); | ||
test("ada total coin should be 1581758768", () => { | ||
expect(adaUtxos.totalCoin).toBe(1581758768); | ||
}); | ||
@@ -107,3 +107,21 @@ | ||
test("no utxo should be found", () => { | ||
expect(adaUtxos.utxos).toHaveLength(0); | ||
expect(adaUtxos.utxos).toEqual([ | ||
{ | ||
transaction: { | ||
hash: "610b4ef721ac542cd96af0e4e58dde5aac51641a29f7497a14ba3835281687dd", | ||
index: 1, | ||
}, | ||
utxo: { | ||
address: | ||
"addr_test1qr5j96qkdpfqw0tvrjd7qum9xpqye8pxmxapwulpr5edz8q00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrnszk8s3g", | ||
amount: { | ||
coin: 2000000, | ||
multiasset: { | ||
"24d41af96ef693136a5c1eb616114f028dfdb92b10f31c648b2fac92": | ||
{ "4d7574616e7443726f63": 1 }, | ||
}, | ||
}, | ||
}, | ||
}, | ||
]); | ||
}); | ||
@@ -129,4 +147,4 @@ }); | ||
test("ada total coin should be 20000000", () => { | ||
expect(adaUtxos.totalCoin).toBe(20000000); | ||
test("ada total coin should be 18000000", () => { | ||
expect(adaUtxos.totalCoin).toBe(18000000); | ||
}); | ||
@@ -133,0 +151,0 @@ |
@@ -97,3 +97,3 @@ import { TransactionOutput } from "../builders/transaction.builder"; | ||
) || | ||
getAvailableCoinFromUTXO(utxo) <= COLLATERAL_VALUE // TODO: confirm if this is really an issue - Some UTXOs with 5000000 total coin value keep throwing 'BadInputs' | ||
getAvailableCoinFromUTXO(utxo) === COLLATERAL_VALUE // TODO: confirm if this is really an issue - Some UTXOs with 5000000 total coin value keep throwing 'BadInputs' | ||
) | ||
@@ -186,3 +186,3 @@ return adaUtxos; | ||
} else { | ||
cleanAdaUtxos.totalCoin += utxo.utxo.amount.coin; | ||
cleanAdaUtxos.totalCoin += getAvailableCoinFromUTXO(utxo); | ||
cleanAdaUtxos.utxos.push(utxo); | ||
@@ -382,4 +382,6 @@ return cleanAdaUtxos; | ||
calculateOutputs, | ||
getAvailableCoinFromUTXO, | ||
getTotalAvailableCoin, | ||
sort, | ||
hasAsset, | ||
}; |
Sorry, the diff of this file is not supported yet
206822
4512