Sha256: 0d1a56297b4610c9481605b8c22cd5b315808a0fa498e39647b81bd8ccc703fe
Contents?: true
Size: 1.96 KB
Versions: 1
Compression:
Stored size: 1.96 KB
Contents
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.massTransfer = void 0; const generic_1 = require("../generic"); const ts_lib_crypto_1 = require("@waves/ts-lib-crypto"); const marshall_1 = require("@waves/marshall"); const validators_1 = require("../validators"); const proto_serialize_1 = require("../proto-serialize"); const defaultVersions_1 = require("../defaultVersions"); const ts_types_1 = require("@waves/ts-types"); function massTransfer(paramsOrTx, seed) { var _a; const type = ts_types_1.TRANSACTION_TYPE.MASS_TRANSFER; const version = paramsOrTx.version || defaultVersions_1.DEFAULT_VERSIONS.MASS_TRANSFER; const seedsAndIndexes = generic_1.convertToPairs(seed); const senderPublicKey = generic_1.getSenderPublicKey(seedsAndIndexes, paramsOrTx); if (!Array.isArray(paramsOrTx.transfers) || paramsOrTx.transfers.length === 0) throw new Error('Should contain at least one transfer'); const tx = { type, version, senderPublicKey, assetId: generic_1.normalizeAssetId(paramsOrTx.assetId), transfers: paramsOrTx.transfers, fee: generic_1.fee(paramsOrTx, 100000 + Math.ceil(0.5 * paramsOrTx.transfers.length) * 100000), timestamp: paramsOrTx.timestamp || Date.now(), attachment: paramsOrTx.attachment || '', proofs: paramsOrTx.proofs || [], chainId: generic_1.networkByte(paramsOrTx.chainId, generic_1.chainIdFromRecipient((_a = paramsOrTx.transfers[0]) === null || _a === void 0 ? void 0 : _a.recipient)), id: '', }; validators_1.validate.massTransfer(tx); const bytes = version > 1 ? proto_serialize_1.txToProtoBytes(tx) : marshall_1.binary.serializeTx(tx); seedsAndIndexes.forEach(([s, i]) => generic_1.addProof(tx, ts_lib_crypto_1.signBytes(s, bytes), i)); tx.id = ts_lib_crypto_1.base58Encode(ts_lib_crypto_1.blake2b(bytes)); return tx; } exports.massTransfer = massTransfer; //# sourceMappingURL=mass-transfer.js.map
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
waves_lib-0.1.0 | js/node_modules/@waves/waves-transactions/dist/transactions/mass-transfer.js |