Sha256: 6691e8a3cae5cda4e4142d17bcb92d934270e0cce7560ee13da70757f2255925

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

import { prop, switchTransactionByType, toArray } from '../utils';
import { NAME_MAP } from '../../constants';
const getAssetIdList = switchTransactionByType({
    [NAME_MAP.transfer]: tx => [tx.assetId, tx.feeAssetId],
    [NAME_MAP.burn]: tx => [tx.assetId],
    [NAME_MAP.reissue]: tx => [tx.assetId],
    [NAME_MAP.exchange]: tx => Array.from(new Set([
        tx.order1.assetPair.amountAsset,
        tx.order1.assetPair.priceAsset,
        tx.order1.version === 3 ? tx.order1.matcherFeeAssetId : null,
        tx.order2.version === 3 ? tx.order2.matcherFeeAssetId : null
    ])),
    [NAME_MAP.massTransfer]: tx => [tx.assetId],
    [NAME_MAP.setAssetScript]: tx => [tx.assetId],
    [NAME_MAP.sponsorship]: tx => [tx.assetId],
    [NAME_MAP.invoke]: tx => [...(tx.payment || []).map(prop('assetId')), tx.feeAssetId],
    [NAME_MAP.updateAsset]: tx => [tx.assetId]
});
export default function (tx) {
    // @ts-ignore
    const idList = toArray(tx).reduce((acc, tx) => acc.concat(getAssetIdList(tx) || []), []).filter(x => x != null);
    return idList;
}
//# sourceMappingURL=getAssetIdListByTx.js.map

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
waves_lib-0.1.0 js/node_modules/@waves/node-api-js/es/tools/adresses/getAssetIdListByTx.js