-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inject publickeyring #3086
inject publickeyring #3086
Changes from all commits
d62d440
ac6068b
9eb174b
8a93ede
9b41cb8
5579c30
98328fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package bisq.common.crypto; | ||
|
||
import com.google.inject.Inject; | ||
import com.google.inject.Provider; | ||
|
||
public class PubKeyRingProvider implements Provider<PubKeyRing> { | ||
|
||
private PubKeyRing pubKeyRing; | ||
|
||
@Inject | ||
public PubKeyRingProvider(KeyRing keyRing) { | ||
pubKeyRing = keyRing.getPubKeyRing(); | ||
} | ||
|
||
@Override | ||
public PubKeyRing get() { | ||
return pubKeyRing; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package bisq.core.dao.governance.proposal; | ||
|
||
import bisq.core.btc.wallet.WalletsManager; | ||
import bisq.core.dao.governance.period.PeriodService; | ||
import bisq.core.dao.state.DaoStateService; | ||
|
||
import bisq.network.p2p.P2PService; | ||
|
||
import bisq.common.crypto.PubKeyRing; | ||
import bisq.common.storage.Storage; | ||
|
||
import javafx.beans.property.SimpleIntegerProperty; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
public class MyProposalListServiceTest { | ||
@Test | ||
public void canInstantiate() { | ||
P2PService p2PService = mock(P2PService.class); | ||
when(p2PService.getNumConnectedPeers()).thenReturn(new SimpleIntegerProperty(0)); | ||
Storage storage = mock(Storage.class); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is storage mocked separately? It's just passed as an argument like the rest. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah that test is just a stub that got me thinking about the pubkey. |
||
MyProposalListService service = new MyProposalListService(p2PService, | ||
mock(DaoStateService.class), | ||
mock(PeriodService.class), mock(WalletsManager.class), storage, mock(PubKeyRing.class) | ||
); | ||
} | ||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,7 +106,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs | |
private final TxFeeEstimationService txFeeEstimationService; | ||
private final ReferralIdService referralIdService; | ||
private final BSFormatter btcFormatter; | ||
private MakerFeeMaker makerFeeMaker; | ||
private MakerFeeProvider makerFeeProvider; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can be final |
||
private final String offerId; | ||
private final BalanceListener btcBalanceListener; | ||
private final SetChangeListener<PaymentAccount> paymentAccountsChangeListener; | ||
|
@@ -159,7 +159,7 @@ public MutableOfferDataModel(OpenOfferManager openOfferManager, | |
TxFeeEstimationService txFeeEstimationService, | ||
ReferralIdService referralIdService, | ||
BSFormatter btcFormatter, | ||
MakerFeeMaker makerFeeMaker) { | ||
MakerFeeProvider makerFeeProvider) { | ||
super(btcWalletService); | ||
|
||
this.openOfferManager = openOfferManager; | ||
|
@@ -175,7 +175,7 @@ public MutableOfferDataModel(OpenOfferManager openOfferManager, | |
this.txFeeEstimationService = txFeeEstimationService; | ||
this.referralIdService = referralIdService; | ||
this.btcFormatter = btcFormatter; | ||
this.makerFeeMaker = makerFeeMaker; | ||
this.makerFeeProvider = makerFeeProvider; | ||
|
||
offerId = Utilities.getRandomPrefix(5, 8) + "-" + | ||
UUID.randomUUID().toString() + "-" + | ||
|
@@ -805,7 +805,7 @@ public Coin getMakerFee(boolean isCurrencyForMakerFeeBtc) { | |
} | ||
|
||
public Coin getMakerFee() { | ||
return makerFeeMaker.getMakerFee(bsqWalletService, preferences, amount.get()); | ||
return makerFeeProvider.getMakerFee(bsqWalletService, preferences, amount.get()); | ||
} | ||
|
||
public Coin getMakerFeeInBtc() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this guaranteed to be in singleton context?
Can you move it to the other bindings above, so th einstall calls are not mixed with bind calls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah from the test below its seems its singleton.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes i made sure that it is.