Skip to content
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

Add function for listing incoming_transfer Option : all,available,unavailable #1

Merged
merged 1 commit into from
Mar 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions moneronjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function Wallet(ip,port){
self.getaddress = function (callback){
rpc(self.opt.ip, self.opt.port, "getaddress",'', function(error,result){
if (error){
console.log("error in getting address"+error);
console.log("error in getting address: %j", [error]);
return;
} else { //console.log(result)
var address = result.address;
Expand All @@ -85,7 +85,7 @@ function Wallet(ip,port){
self.getbalance = function(callback){
rpc(self.opt.ip, self.opt.port, "getbalance",'', function(error,result){
if (error){
console.log("error in getting balance"+error);
console.log("error in getting balance: %j", [error]);
return;
} else {//console.log(result)
var unlocked = result.unlocked_balance;
Expand All @@ -97,13 +97,24 @@ function Wallet(ip,port){
self.getpayment= function(pid, callback){
rpc(self.opt.ip, self.opt.port, "get_payments", { "payment_id" : pid }, function(error,result){
if (error){
console.log("error in getting payment"+error);
console.log("error in getting payment: %j",[error]);
return;
} else {//console.log(result)
callback(result);
}
});
}
self.incoming_transfers= function(type,callback){
rpc(self.opt.ip, self.opt.port, "incoming_transfers", { "transfer_type" : type }, function(error,result){
if (error){
console.log("error in getting incoming_transfers: %j", [ error]);
return;
} else {
callback(result);
}
});
}

}


15 changes: 14 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
var wallet = require('./moneronjs.js');

console.log("this is a wallet rpc interface test");
var wal = new wallet.Wallet("127.0.0.1","10500");
var wal = new wallet.Wallet("127.0.0.1","8082");
console.log(wal.opt);


wal.getaddress(function(address){
console.log("lets try to get the address of the wallet");
console.log(address);
Expand All @@ -23,3 +25,14 @@ wal.getpayment("0000000000000000000000000000000000000000000000000000000000000000
console.log(result);
});

wal.incoming_transfers("available",function(result){
console.log("Listing of TX UnSpend");
console.log(result);
});
wal.incoming_transfers("unavailable",function(result){
console.log("Listing of TX Spend");
console.log(result);
});