import { OutPoint } from '.' ; import { CKBModel } from '..' ; import { validators , transformers } from 'ckb-js-toolkit' ; export class CellInput implements CKBModel { static fromRPC ( data ) { if ( ! data ) { throw new Error ( 'Cannot create CellInput from empty data' ) ; } validators . ValidateCellInput ( data ) ; return new CellInput ( data . previous_output , data . since ) ; } constructor ( public previousOutput , public since = '0x0' ) { } sameWith ( cellInput ) { validators . ValidateCellInput ( transformers . TransformCellInput ( cellInput ) ) ; return ( cellInput . previousOutput . sameWith ( this . previousOutput ) && cellInput . since === this . since ) ; } validate ( ) { validators . ValidateCellInput ( transformers . TransformCellInput ( this ) ) ; return true ; } serializeJson ( ) { return { since : this . since , previous_output : this . previousOutput , } ; } }