diff --git a/index.js b/index.js index c9c737e..ad29ab9 100755 --- a/index.js +++ b/index.js @@ -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 @@ -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 @@ -164,4 +166,4 @@ catch (e) { // Log the exception if not a console output. if (!('stdout' in e) && !('stderr' in e)) console.error(e); -} \ No newline at end of file +} diff --git a/lib/command-handler.js b/lib/command-handler.js index 23a6243..0449784 100644 --- a/lib/command-handler.js +++ b/lib/command-handler.js @@ -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) { @@ -1143,4 +1144,4 @@ module.exports = { extend, extendInstance, audit -}; \ No newline at end of file +}; diff --git a/lib/evernode-manager.js b/lib/evernode-manager.js index 215f4c8..9eeb120 100644 --- a/lib/evernode-manager.js +++ b/lib/evernode-manager.js @@ -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;