@@ -1753,8 +1753,9 @@ class HathorWallet extends EventEmitter {
1753
1753
* Get mint authorities
1754
1754
*
1755
1755
* @param {string } tokenUid UID of the token to select the authority utxo
1756
- * @param [options] Object with custom options.
1756
+ * @param { Object } [options] Object with custom options.
1757
1757
* @param {boolean } [options.many=false] if should return many utxos or just one (default false)
1758
+ * @param {boolean } [options.only_available_utxos=false] If we should filter for available utxos.
1758
1759
*
1759
1760
* @return {Promise<{
1760
1761
* txId: string,
@@ -1769,6 +1770,7 @@ class HathorWallet extends EventEmitter {
1769
1770
const newOptions = {
1770
1771
token : tokenUid ,
1771
1772
authorities : 1 , // mint authority
1773
+ only_available_utxos : options . only_available_utxos ?? false ,
1772
1774
} ;
1773
1775
if ( ! options . many ) {
1774
1776
// limit number of utxos to select if many is false
@@ -1785,8 +1787,9 @@ class HathorWallet extends EventEmitter {
1785
1787
* Get melt authorities
1786
1788
*
1787
1789
* @param {string } tokenUid UID of the token to select the authority utxo
1788
- * @param [options] Object with custom options.
1790
+ * @param { Object } [options] Object with custom options.
1789
1791
* @param {boolean } [options.many=false] if should return many utxos or just one (default false)
1792
+ * @param {boolean } [options.only_available_utxos=false] If we should filter for available utxos.
1790
1793
*
1791
1794
* @return {Promise<{
1792
1795
* txId: string,
@@ -1801,6 +1804,7 @@ class HathorWallet extends EventEmitter {
1801
1804
const newOptions = {
1802
1805
token : tokenUid ,
1803
1806
authorities : 2 , // melt authority
1807
+ only_available_utxos : options . only_available_utxos ?? false ,
1804
1808
} ;
1805
1809
if ( ! options . many ) {
1806
1810
// limit number of utxos to select if many is false
@@ -1873,7 +1877,10 @@ class HathorWallet extends EventEmitter {
1873
1877
1874
1878
const mintAddress = newOptions . address || ( await this . getCurrentAddress ( ) ) . address ;
1875
1879
1876
- const mintInput = await this . getMintAuthority ( tokenUid , { many : false } ) ;
1880
+ const mintInput = await this . getMintAuthority ( tokenUid , {
1881
+ many : false ,
1882
+ only_available_utxos : true ,
1883
+ } ) ;
1877
1884
1878
1885
if ( ! mintInput || mintInput . length === 0 ) {
1879
1886
throw new Error ( "Don't have mint authority output available." ) ;
@@ -1990,7 +1997,10 @@ class HathorWallet extends EventEmitter {
1990
1997
}
1991
1998
}
1992
1999
1993
- const meltInput = await this . getMeltAuthority ( tokenUid , { many : false } ) ;
2000
+ const meltInput = await this . getMeltAuthority ( tokenUid , {
2001
+ many : false ,
2002
+ only_available_utxos : true ,
2003
+ } ) ;
1994
2004
1995
2005
if ( ! meltInput || meltInput . length === 0 ) {
1996
2006
throw new Error ( "Don't have melt authority output available." ) ;
@@ -2083,9 +2093,15 @@ class HathorWallet extends EventEmitter {
2083
2093
const { createAnother } = newOptions ;
2084
2094
let delegateInput ;
2085
2095
if ( type === 'mint' ) {
2086
- delegateInput = await this . getMintAuthority ( tokenUid , { many : false } ) ;
2096
+ delegateInput = await this . getMintAuthority ( tokenUid , {
2097
+ many : false ,
2098
+ only_available_utxos : true ,
2099
+ } ) ;
2087
2100
} else if ( type === 'melt' ) {
2088
- delegateInput = await this . getMeltAuthority ( tokenUid , { many : false } ) ;
2101
+ delegateInput = await this . getMeltAuthority ( tokenUid , {
2102
+ many : false ,
2103
+ only_available_utxos : true ,
2104
+ } ) ;
2089
2105
} else {
2090
2106
throw new Error ( 'This should never happen.' ) ;
2091
2107
}
@@ -2182,9 +2198,15 @@ class HathorWallet extends EventEmitter {
2182
2198
}
2183
2199
let destroyInputs ;
2184
2200
if ( type === 'mint' ) {
2185
- destroyInputs = await this . getMintAuthority ( tokenUid , { many : true } ) ;
2201
+ destroyInputs = await this . getMintAuthority ( tokenUid , {
2202
+ many : true ,
2203
+ only_available_utxos : true ,
2204
+ } ) ;
2186
2205
} else if ( type === 'melt' ) {
2187
- destroyInputs = await this . getMeltAuthority ( tokenUid , { many : true } ) ;
2206
+ destroyInputs = await this . getMeltAuthority ( tokenUid , {
2207
+ many : true ,
2208
+ only_available_utxos : true ,
2209
+ } ) ;
2188
2210
} else {
2189
2211
throw new Error ( 'This should never happen.' ) ;
2190
2212
}
0 commit comments