Add requestGatewayBalances() to core

This commit is contained in:
wltsmrz
2015-09-22 06:55:51 -07:00
parent 9ebb59580d
commit 323e402e0c
2 changed files with 39 additions and 0 deletions

View File

@@ -2280,6 +2280,29 @@ Remote.prototype.requestConnect = function(ip, port, callback) {
return request;
};
Remote.prototype.requestGatewayBalances = function(options, callback) {
assert(_.isObject(options), 'Options missing');
assert(options.account, 'Account missing');
const request = new Request(this, 'gateway_balances');
request.message.account = UInt160.json_rewrite(options.account);
if (!_.isUndefined(options.hotwallet)) {
request.message.hotwallet = options.hotwallet;
}
if (!_.isUndefined(options.strict)) {
request.message.strict = options.strict;
}
if (!_.isUndefined(options.ledger)) {
request.selectLedger(options.ledger);
}
request.callback(callback);
return request;
};
/**
* Create a Transaction
*

View File

@@ -1966,6 +1966,22 @@ describe('Remote', function() {
});
});
it.only('Construct gateway_balances request', function() {
const request = remote.requestGatewayBalances({
account: 'rGr9PjmVe7MqEXTSbd3njhgJc2s5vpHV54',
hotwallet: 'rwxBjBC9fPzyQ9GgPZw6YYLNeRTSx5',
strict: true
});
assert.deepEqual(request.message, {
command: 'gateway_balances',
id: undefined,
account: 'rGr9PjmVe7MqEXTSbd3njhgJc2s5vpHV54',
hotwallet: 'rwxBjBC9fPzyQ9GgPZw6YYLNeRTSx5',
strict: true
});
});
it('Construct Payment transaction', function() {
const tx = remote.createTransaction('Payment', {
account: TX_JSON.Account,