mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-01 09:35:48 +00:00
Add requestGatewayBalances() to core
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user