Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public constructor(rawTransaction: unknown) {
super(rawTransaction);
const tx = (typeof rawTransaction === 'object' && rawTransaction !== null
? rawTransaction
: {}) as Partial;
// Initializes to empty object if it doesn't exist
if (tx.asset) {
const rawAsset = tx.asset as RawAsset;
this.asset = {
data: rawAsset.data,
recipientId: rawAsset.recipientId,
amount: new BigNum(
isPositiveNumberString(rawAsset.amount) ? rawAsset.amount : '0',
),
};
} else {
// tslint:disable-next-line no-object-literal-type-assertion
this.asset = {
amount: new BigNum('0'),
recipientId: '',
} as TransferAsset;
}
}