I'm having trouble setting a property. the JS script I have results in the following output (the pertinent JS script itself is below the output). From the Secret, the code clearly gets the Public but then seemingly cannot get a publicKey property from the resulting object resolution. Something similar happens using the Stellar Laboratory (with less detail).
I'm an old coder, any help would be greatly appreciated.
=============== console output =========================
set the home domain for your Stellar validator. Parsing command line arguments
Connecting to https://horizon.stellar.org
Building transaction to set domain for GDR7G2E2WBH7P4P7KMHSPOQGQDXQ2VXXFSI56HRHIYVOARS5T7NWST2W.
Error: An exception occured: TypeError: Cannot read property 'publicKey' of null
============== pertinent code ========================
// The network to which we will connect
var clNetwork = StellarSdk.Networks.PUBLIC;
var clServer = 'https://horizon.stellar.org';
...................
try {
console.log('Connecting to ' + clServer);
console.log('');
const server = new StellarSdk.Server(clServer);
console.log('Building transaction to set domain for ' + clValidatorKeys.publicKey() + '.');
const account = await server.loadAccount(clFundKeys.publicKey());
var builder = new StellarSdk.TransactionBuilder(account, {
fee: 100,
memo: StellarSdk.Memo.text('https://vaporcolony.world/'),
networkPassphrase: clNetwork
});
console.log('');
console.log('The transaction will:');
if (clFundKeys.publicKey() != clValidatorKeys.publicKey()) {
console.log(' - Send 1 XLM from ' + clFundKeys.publicKey());
console.log(' to fund a new account for the validator.');
builder = builder.addOperation(StellarSdk.Operation.createAccount({
destination: clValidatorKeys.publicKey(),
startingBalance: '1'
}))
}
console.log(' - Set the domain field to: \'' + args[1] + '\'.');
builder = builder.addOperation(StellarSdk.Operation.setOptions({
source: clValidatorKeys.publicKey(),
homeDomain: args[1]
}));
var tx = builder.setTimeout(5).build();
if (clFundKeys.publicKey() != clValidatorKeys.publicKey())
tx.sign(clFundKeys);
tx.sign(clValidatorKeys);
if (showXDR) {
console.log('');
console.log('The XDR for the transaction is:');
console.log(tx.toXDR());
}
if (submitTx) {
console.log('');
console.log('Submitting the transaction');
const result = await server.submitTransaction(tx);
console.log('');
console.log('The transaction was successfully submitted.');
// console.log('See: ' + ._links.transaction.href);
}
}
catch (e) {
console.log('Error: An exception occured: ' + e);
}