lib/glueby/internal/contract_builder.rb in glueby-1.2.0.beta.2 vs lib/glueby/internal/contract_builder.rb in glueby-1.2.0.beta.3
- old
+ new
@@ -129,11 +129,11 @@
fee_estimator: nil
)
tx, index = nil
if Glueby.configuration.use_utxo_provider? || utxo_provider
- utxo_provider ||= UtxoProvider.instance
+ utxo_provider ||= UtxoProvider.new
script_pubkey = Tapyrus::Script.parse_from_addr(address)
tx, index = utxo_provider.get_utxo(script_pubkey, amount)
else
fee_estimator ||= @fee_estimator
txb = Tapyrus::TxBuilder.new
@@ -263,18 +263,18 @@
tx = sender_wallet
.sign_to_pay_to_contract_address(tx, utxo, utxo[:payment_base], utxo[:metadata])
end
# Sign inputs from UtxoProvider
- Glueby::UtxoProvider.instance.wallet.sign_tx(tx, utxos) if Glueby.configuration.use_utxo_provider?
+ Glueby::UtxoProvider.new.wallet.sign_tx(tx, utxos) if Glueby.configuration.use_utxo_provider?
tx
end
def set_tpc_change_address
if Glueby.configuration.use_utxo_provider?
- change_address(UtxoProvider.instance.wallet.change_address)
+ change_address(UtxoProvider.new.wallet.change_address)
else
change_address(@sender_wallet.change_address)
end
end
@@ -317,10 +317,10 @@
# @return [Array<Hash>] The provided UTXOs
def auto_fulfill_inputs_utxos_for_tpc(tx)
target_amount = @outgoings[Tapyrus::Color::ColorIdentifier.default] || 0
provider = if Glueby.configuration.use_utxo_provider?
- UtxoProvider.instance
+ UtxoProvider.new
else
sender_wallet
end
_tx, fee, tpc_amount, provided_utxos = provider.fill_uncolored_inputs(