UNPKG

test-triam-base-contract

Version:

Low level triam smart cotnract support library

56 lines (37 loc) 1.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.testContract = undefined; var _stellarXdr_generated = require("../generated/stellar-xdr_generated"); var _stellarXdr_generated2 = _interopRequireDefault(_stellarXdr_generated); var _keypair = require("../keypair"); var _strkey = require("../strkey"); var _clone = require("lodash/clone"); var _clone2 = _interopRequireDefault(_clone); var _isUndefined = require("lodash/isUndefined"); var _isUndefined2 = _interopRequireDefault(_isUndefined); var _isString = require("lodash/isString"); var _isString2 = _interopRequireDefault(_isString); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Create and fund a non existent contract. * @function * @alias Operation.testContract * @param {object} opts * @param {string} opts.startingBalance - Amount in XLM the account should be funded for. Must be greater * than the [reserve balance amount](https://www.stellar.org/developers/learn/concepts/fees.html). * * @param {string} [opts.source] - The source account for the create contract. Defaults to the transaction's source account. * @returns {xdr.TestContractOp} */ var testContract = exports.testContract = function testContract(opts) { var attributes = {}; attributes.startingBalance = this._checkUnsignedIntValue("startingBalance", opts.startingBalance); // thuannd notes end var testContract = new _stellarXdr_generated2.default.TestContractOp(attributes); var opAttributes = {}; opAttributes.body = _stellarXdr_generated2.default.OperationBody.testContract(testContract); this.setSourceAccount(opAttributes, opts); return new _stellarXdr_generated2.default.Operation(opAttributes); };