mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
Add support for regularKey in prepareSettings
This commit is contained in:
@@ -92,8 +92,14 @@ function createSettingsTransaction(account, settings) {
|
||||
validate.settings(settings);
|
||||
|
||||
const transaction = new ripple.Transaction();
|
||||
transaction.accountSet(account);
|
||||
if (settings.regularKey) {
|
||||
return transaction.setRegularKey({
|
||||
account: account,
|
||||
regular_key: settings.regularKey
|
||||
});
|
||||
}
|
||||
|
||||
transaction.accountSet(account);
|
||||
setTransactionFlags(transaction, settings);
|
||||
setTransactionFields(transaction, settings);
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ const orderCancellationResponse =
|
||||
require('./fixtures/ordercancellation-response');
|
||||
const settingsSpecification = require('./fixtures/settings-specification');
|
||||
const settingsResponse = require('./fixtures/settings-response');
|
||||
const regularKeyResponse = require('./fixtures/regular-key-response');
|
||||
const signInput = require('./fixtures/sign-input');
|
||||
const signOutput = require('./fixtures/sign-output');
|
||||
const MockPRNG = require('./mock-prng');
|
||||
@@ -91,6 +92,12 @@ describe('RippleAPI', function() {
|
||||
instructions, _.partial(checkResult, settingsResponse, done));
|
||||
});
|
||||
|
||||
it('prepareSettings - regularKey', function(done) {
|
||||
const regularKey = {regularKey: 'rAR8rR8sUkBoCZFawhkWzY4Y5YoyuznwD'};
|
||||
this.api.prepareSettings(address, regularKey,
|
||||
instructions, _.partial(checkResult, regularKeyResponse, done));
|
||||
});
|
||||
|
||||
it('sign', function() {
|
||||
const secret = 'shsWGZcmZz6YsWWmcnpfr6fLTdtFV';
|
||||
withDeterministicPRNG(() => {
|
||||
|
||||
9
test/fixtures/regular-key-response.json
vendored
Normal file
9
test/fixtures/regular-key-response.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"Flags": 0,
|
||||
"TransactionType": "SetRegularKey",
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"RegularKey": "rAR8rR8sUkBoCZFawhkWzY4Y5YoyuznwD",
|
||||
"LastLedgerSequence": 8820051,
|
||||
"Fee": "12",
|
||||
"Sequence": 23
|
||||
}
|
||||
Reference in New Issue
Block a user