本文整理了Java中org.bitcoinj.wallet.Wallet.currentAddress()
方法的一些代码示例,展示了Wallet.currentAddress()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Wallet.currentAddress()
方法的具体详情如下:
包路径:org.bitcoinj.wallet.Wallet
类名称:Wallet
方法名:currentAddress
[英]Returns address for a #currentKey(org.bitcoinj.wallet.KeyChain.KeyPurpose)
[中]返回#currentKey的地址(org.bitcoinj.wallet.KeyChain.KeyPurpose)
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
/**
* An alias for calling {@link #currentAddress(org.bitcoinj.wallet.KeyChain.KeyPurpose)} with
* {@link org.bitcoinj.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS} as the parameter.
*/
public Address currentReceiveAddress() {
return currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
}
代码示例来源:origin: greenaddress/GreenBits
/**
* An alias for calling {@link #currentAddress(org.bitcoinj.wallet.KeyChain.KeyPurpose)} with
* {@link org.bitcoinj.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS} as the parameter.
*/
public Address currentReceiveAddress() {
return currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
}
代码示例来源:origin: HashEngineering/dashj
/**
* An alias for calling {@link #currentAddress(org.bitcoinj.wallet.KeyChain.KeyPurpose)} with
* {@link org.bitcoinj.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS} as the parameter.
*/
public Address currentReceiveAddress() {
return currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
}
代码示例来源:origin: HashEngineering/dashj
/** Returns the address used for change outputs. Note: this will probably go away in future. */
public Address currentChangeAddress() {
return currentAddress(KeyChain.KeyPurpose.CHANGE);
}
/**
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
/** Returns the address used for change outputs. Note: this will probably go away in future. */
public Address currentChangeAddress() {
return currentAddress(KeyChain.KeyPurpose.CHANGE);
}
/**
代码示例来源:origin: fr.acinq/bitcoinj-core
/**
* An alias for calling {@link #currentAddress(org.bitcoinj.wallet.KeyChain.KeyPurpose)} with
* {@link org.bitcoinj.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS} as the parameter.
*/
public Address currentReceiveAddress() {
return currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
}
代码示例来源:origin: fr.acinq/bitcoinj-core
/** Returns the address used for change outputs. Note: this will probably go away in future. */
public Address currentChangeAddress() {
return currentAddress(KeyChain.KeyPurpose.CHANGE);
}
/**
代码示例来源:origin: greenaddress/GreenBits
/** Returns the address used for change outputs. Note: this will probably go away in future. */
public Address currentChangeAddress() {
return currentAddress(KeyChain.KeyPurpose.CHANGE);
}
/**
代码示例来源:origin: uncleleonfan/FunWallet
@Override
public void onWalletChanged(Wallet wallet) {
Log.d(TAG, "onWalletChanged: " + wallet.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS));
updateUI(wallet);
}
代码示例来源:origin: uncleleonfan/FunWallet
private void updateUI(final Wallet wallet) {
final Address address = wallet.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
String s = BitcoinURI.convertToBitcoinURI(address, null, null, null);
final Bitmap bitmap = Qr.bitmap(s);
runOnUiThread(new Runnable() {
@Override
public void run() {
Coin balance = wallet.getBalance(Wallet.BalanceType.ESTIMATED);
mAddressText.setText(address.toString());
String balanceString = String.valueOf(balance.value / 100000) + " mBTC";
mBalanceText.setText(balanceString);
BitmapDrawable bitmapDrawable = new BitmapDrawable(getResources(), bitmap);
bitmapDrawable.setFilterBitmap(false);
mQrImageView.setImageDrawable(bitmapDrawable);
}
});
}
代码示例来源:origin: greenaddress/GreenBits
@Test
public void basicSpendingFromP2SH() throws Exception {
createMarriedWallet(2, 2);
myAddress = wallet.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
basicSpendingCommon(wallet, myAddress, OTHER_ADDRESS, null);
createMarriedWallet(2, 3);
myAddress = wallet.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
basicSpendingCommon(wallet, myAddress, OTHER_ADDRESS, null);
createMarriedWallet(3, 3);
myAddress = wallet.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
basicSpendingCommon(wallet, myAddress, OTHER_ADDRESS, null);
}
代码示例来源:origin: greenaddress/GreenBits
@Test (expected = TransactionSigner.MissingSignatureException.class)
public void completeTxPartiallySignedMarriedThrowsByDefault() throws Exception {
createMarriedWallet(2, 2, false);
myAddress = wallet.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
sendMoneyToWallet(AbstractBlockChain.NewBlockType.BEST_CHAIN, COIN, myAddress);
SendRequest req = SendRequest.emptyWallet(OTHER_ADDRESS);
wallet.completeTx(req);
}
代码示例来源:origin: greenaddress/GreenBits
public void completeTxPartiallySignedMarried(Wallet.MissingSigsMode missSigMode, byte[] expectedSig) throws Exception {
// create married wallet without signer
createMarriedWallet(2, 2, false);
myAddress = wallet.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
sendMoneyToWallet(AbstractBlockChain.NewBlockType.BEST_CHAIN, COIN, myAddress);
SendRequest req = SendRequest.emptyWallet(OTHER_ADDRESS);
req.missingSigsMode = missSigMode;
wallet.completeTx(req);
TransactionInput input = req.tx.getInput(0);
boolean firstSigIsMissing = Arrays.equals(expectedSig, input.getScriptSig().getChunks().get(1).data);
boolean secondSigIsMissing = Arrays.equals(expectedSig, input.getScriptSig().getChunks().get(2).data);
assertTrue("Only one of the signatures should be missing/dummy", firstSigIsMissing ^ secondSigIsMissing);
int localSigIndex = firstSigIsMissing ? 2 : 1;
int length = input.getScriptSig().getChunks().get(localSigIndex).data.length;
assertTrue("Local sig should be present: " + length, length >= 70);
}
代码示例来源:origin: greenaddress/GreenBits
@Test
public void testRoundTripMarriedWallet() throws Exception {
// create 2-of-2 married wallet
myWallet = new Wallet(PARAMS);
final DeterministicKeyChain partnerChain = new DeterministicKeyChain(new SecureRandom());
DeterministicKey partnerKey = DeterministicKey.deserializeB58(null, partnerChain.getWatchingKey().serializePubB58(PARAMS), PARAMS);
MarriedKeyChain chain = MarriedKeyChain.builder()
.random(new SecureRandom())
.followingKeys(partnerKey)
.threshold(2).build();
myWallet.addAndActivateHDChain(chain);
myAddress = myWallet.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
Wallet wallet1 = roundTrip(myWallet);
assertEquals(0, wallet1.getTransactions(true).size());
assertEquals(Coin.ZERO, wallet1.getBalance());
assertEquals(2, wallet1.getActiveKeyChain().getSigsRequiredToSpend());
assertEquals(myAddress, wallet1.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS));
}
代码示例来源:origin: greenaddress/GreenBits
wallet.addAndActivateHDChain(chain);
Address myAddress = wallet.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
sendMoneyToWallet(wallet, AbstractBlockChain.NewBlockType.BEST_CHAIN, COIN, myAddress);
内容来源于网络,如有侵权,请联系作者删除!