Skip to content
Open
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
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ program
.option('-m, --moments [moments]', 'Life moments')
.option('-c, --contract-id [contract-id]', 'Contract id')
.option('-i, --image [image]', 'Instance image')
.option('-s, --sendmax [evr]', 'Maximum EVR allowed for acquiring the instance')
.action(acquire);

program
Expand Down Expand Up @@ -97,6 +98,7 @@ program
.option('-m, --moments [moments]', 'Life moments')
.option('-c, --contract-id [contract-id]', 'Contract id')
.option('-i, --image [image]', 'Instance image')
.option('-s, --sendmax [evr]', 'Maximum EVR allowed for acquiring the instance')
.action(acquireAndDeploy);

program
Expand Down Expand Up @@ -164,4 +166,4 @@ catch (e) {
// Log the exception if not a console output.
if (!('stdout' in e) && !('stderr' in e))
console.error(e);
}
}
5 changes: 3 additions & 2 deletions lib/command-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ async function acquire(host, options) {
userKeys.publicKey,
options.contractId,
options.image,
appenv.hpInitCfg || {});
appenv.hpInitCfg || {}),
{ sendMax: options.sendmax });
success('Instance created!', result);
}
catch (e) {
Expand Down Expand Up @@ -1143,4 +1144,4 @@ module.exports = {
extend,
extendInstance,
audit
};
};
10 changes: 9 additions & 1 deletion lib/evernode-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,15 @@ class EvernodeManager {
config: config
};

const result = await this.#tenantClient.acquireLease(hostAddress, requirement, { leaseOfferIndex: options.leaseIndex, transactionOptions: { sequence: options.tenantSequence } });
const acquireOptions = {
leaseOfferIndex: options.leaseIndex,
transactionOptions: { sequence: options.tenantSequence }
};

if (options.sendMax !== undefined && options.sendMax !== null)
acquireOptions.sendMax = options.sendMax;

const result = await this.#tenantClient.acquireLease(hostAddress, requirement, acquireOptions);
const acquiredTimestamp = Date.now();
const instanceName = result.instance.name;

Expand Down