allow to check whether wallet is encrypted.

This commit is contained in:
Christopher Jeffrey 2014-10-28 11:29:33 -07:00
parent 9d54277db1
commit 665a87f680
2 changed files with 25 additions and 0 deletions

View File

@ -727,6 +727,10 @@ Wallet.prototype.encrypt = function(options) {
return bitcoindjs.walletEncrypt(options || {});
};
Wallet.prototype.isEncrypted = function() {
return bitcoindjs.walletEncrypted();
};
Wallet.prototype.setTxFee = function(options) {
return bitcoindjs.walletSetTxFee(options || {});
};

View File

@ -192,6 +192,7 @@ NAN_METHOD(WalletPassphrase);
NAN_METHOD(WalletPassphraseChange);
NAN_METHOD(WalletLock);
NAN_METHOD(WalletEncrypt);
NAN_METHOD(WalletEncrypted);
NAN_METHOD(WalletSetTxFee);
NAN_METHOD(WalletImportKey);
@ -3168,6 +3169,25 @@ NAN_METHOD(WalletEncrypt) {
NanReturnValue(Undefined());
}
/**
* WalletEncrypted()
* bitcoindjs.walletEncrypted()
* Check whether the wallet is encrypted.
*/
NAN_METHOD(WalletEncrypted) {
NanScope();
if (args.Length() > 0) {
return NanThrowError(
"Usage: bitcoindjs.walletEncrypted()");
}
bool isEncrypted = pwalletMain->IsCrypted();
NanReturnValue(NanNew<Boolean>(isEncrypted));
}
/**
* WalletSetTxFee()
* bitcoindjs.walletSetTxFee(options)
@ -3712,6 +3732,7 @@ init(Handle<Object> target) {
NODE_SET_METHOD(target, "walletPassphraseChange", WalletPassphraseChange);
NODE_SET_METHOD(target, "walletLock", WalletLock);
NODE_SET_METHOD(target, "walletEncrypt", WalletEncrypt);
NODE_SET_METHOD(target, "walletEncrypted", WalletEncrypted);
NODE_SET_METHOD(target, "walletSetTxFee", WalletSetTxFee);
NODE_SET_METHOD(target, "walletImportKey", WalletImportKey);
}