import { IAssetStake } from 'shared/model/transaction' ; import { IAssetRepository } from 'shared/repository/transaction' ; import { RawAsset } from 'shared/model/types' ; class TransactionStakeRepo implements IAssetRepository < IAssetStake > { serialize ( asset ) { return { amount : asset . amount , startTime : asset . startTime , startVoteCount : asset . startVoteCount , airdropReward : { sponsors : Array . from ( asset . airdropReward . sponsors ) . map ( elem => [ elem [ 0 ] . toString ( ) , elem [ 1 ] ] ) } } ; } deserialize ( rawAsset ) { return { amount : rawAsset . amount , startTime : rawAsset . startTime , startVoteCount : rawAsset . startVoteCount , airdropReward : { sponsors : new Map ( rawAsset . airdropReward . sponsors . map ( ( elem ) => [ BigInt ( elem [ 0 ] ) , elem [ 1 ] ] ) ) } } ; } } export default new TransactionStakeRepo ( ) ;