test-triam-base-contract
Version:
Low level triam smart cotnract support library
44 lines (32 loc) • 1.41 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.checkContract = undefined;
var _stellarXdr_generated = require("../generated/stellar-xdr_generated");
var _stellarXdr_generated2 = _interopRequireDefault(_stellarXdr_generated);
var _keypair = require("../keypair");
var _strkey = require("../strkey");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Check a Tx contains the contract ops.
* @function
* @alias Operation.checkContract
* @param {object} opts
* @param {(number|string)} opts.isContract - Check: is contract
* The source account for the payment. Defaults to the transaction's source account.
* @param {string} [opts.source]
* @returns {xdr.CheckContractOp}
*/
var checkContract = exports.checkContract = function checkContract(opts) {
var attributes = {};
attributes.isContract = this._checkUnsignedIntValue("isContract", opts.isContract);
if (attributes.isContract != 0 && attributes.isContract != 1) {
throw new Error("IsContract must be 0 or 1.");
}
var checkContract = new _stellarXdr_generated2.default.CheckContractOp(attributes);
var opAttributes = {};
opAttributes.body = _stellarXdr_generated2.default.OperationBody.checkContract(checkContract);
this.setSourceAccount(opAttributes, opts);
return new _stellarXdr_generated2.default.Operation(opAttributes);
};