UNPKG

jton-contracts

Version:
97 lines (96 loc) 3.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SetcodeMultisigWalletSend = exports.PARAMETERS = void 0; const jton_1 = require("jton"); const __1 = require("../"); var PARAMETERS; (function (PARAMETERS) { PARAMETERS["DEST"] = "dest"; PARAMETERS["VALUE"] = "value"; PARAMETERS["BOUNCE"] = "bounce"; PARAMETERS["FLAGS"] = "flags"; PARAMETERS["COMMENT"] = "comment"; })(PARAMETERS = exports.PARAMETERS || (exports.PARAMETERS = {})); class SetcodeMultisigWalletSend extends jton_1.Call { /** * @param config * Example: * { * net: { * url: 'http://localhost', * timeout: 30_000 * }, * locale: 'EN', * keys: `${__dirname}/../library/keys/GiverV2.se.keys.json` * } */ constructor(config) { super(config, Object.values(PARAMETERS)); } /** * Creates and returns contract. * @param keys * Example: * { * public: '0x0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff', * secret: '0x0000000011111111222222223333333344444444555555556666666677777777' * } * @param timeout Time in milliseconds. How much time need wait a collection from graphql. * Examples: * 3000 * 5000 */ _getContract(keys, timeout) { return new __1.SetcodeMultisigWallet(this._client, keys, timeout); } /** * Create and return target contract object. * @param map * Example: * { * address: '0:0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff' * } * @param timeout Time in milliseconds. How much time need wait a collection from graphql. * Examples: * 3000 * 5000 */ _getTargetContract(map, timeout) { return new jton_1.Contract(this._client, { abi: {}, address: map[PARAMETERS.DEST] }, timeout); } /** * Call the public method with an external message. * @param contract A contract on which we call the public method with an external message. * @param keys * Example: * { * public: '0x0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff', * secret: '0x0000000011111111222222223333333344444444555555556666666677777777' * } * @param map * Example: * { * address: '0:0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff ', * value: '1_000_000_000', * bounce: 'false' * } */ async _call(contract, map, keys) { const dest = map[PARAMETERS.DEST]; const value = (0, jton_1.readInt)(map[PARAMETERS.VALUE]); const bounce = (0, jton_1.readBoolean)(map[PARAMETERS.BOUNCE]); const flags = (0, jton_1.readInt)(map[PARAMETERS.FLAGS]); const comment = map[PARAMETERS.COMMENT]; await contract.sendTransaction({ dest, value, bounce, flags, payload: await (0, jton_1.getPayloadToTransfer)(this._client, comment) }, keys); } } exports.SetcodeMultisigWalletSend = SetcodeMultisigWalletSend;