"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.updateAssetInfo = void 0; const ts_lib_crypto_1 = require("@waves/ts-lib-crypto"); const generic_1 = require("../generic"); 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 updateAssetInfo(paramsOrTx, seed) { const type = ts_types_1.TRANSACTION_TYPE.UPDATE_ASSET_INFO; const version = paramsOrTx.version || defaultVersions_1.DEFAULT_VERSIONS.UPDATE_ASSET_INFO; const seedsAndIndexes = generic_1.convertToPairs(seed); const senderPublicKey = generic_1.getSenderPublicKey(seedsAndIndexes, paramsOrTx); const tx = { type, version, senderPublicKey, name: paramsOrTx.name, description: paramsOrTx.description, assetId: paramsOrTx.assetId, fee: generic_1.fee(paramsOrTx, 100000), timestamp: paramsOrTx.timestamp || Date.now(), proofs: paramsOrTx.proofs || [], chainId: generic_1.networkByte(paramsOrTx.chainId, 87), id: '', }; validators_1.validate.updateAssetInfo(tx); const bytes = proto_serialize_1.txToProtoBytes(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.updateAssetInfo = updateAssetInfo; //# sourceMappingURL=update-asset-info.js.map