Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return Object.keys(assetAmts).map(key => {
return new tx.TransactionOutput({
assetId: CONST.ASSET_ID[key],
value: assetAmts[key],
scriptHash: acct.scriptHash
});
});
}
return rawTxs.map(tx => {
const vin = tx.vin
.filter(i => i.address_hash === address)
.map(i => ({ asset: i.asset, value: i.value }));
const vout = tx.vouts
.filter(o => o.address_hash === address)
.map(i => ({ asset: i.asset, value: i.value }));
const change = {
NEO: getChange(vin, vout, CONST.ASSET_ID.NEO),
GAS: getChange(vin, vout, CONST.ASSET_ID.GAS)
};
return {
txid: tx.txid,
blockHeight: tx.block_height,
change
};
});
}
return rawTxs.map(tx => {
const vin = tx.vin
.filter(i => i.address_hash === address)
.map(i => ({ asset: i.asset, value: i.value }));
const vout = tx.vouts
.filter(o => o.address_hash === address)
.map(i => ({ asset: i.asset, value: i.value }));
const change = {
NEO: getChange(vin, vout, CONST.ASSET_ID.NEO),
GAS: getChange(vin, vout, CONST.ASSET_ID.GAS)
};
return {
txid: tx.txid,
blockHeight: tx.block_height,
change
};
});
}
export function extractAsset(params: {
[key: string]: string;
}): string | undefined {
if (!params.asset) {
return undefined;
}
switch (params.asset) {
case "neo":
return CONST.ASSET_ID.NEO;
case "gas":
return CONST.ASSET_ID.GAS;
default:
return params.asset;
}
}