import { OutPoint } from '.' ; import { DepType , CKBModel } from '..' ; import { validators , transformers } from 'ckb-js-toolkit' ; export class CellDep implements CKBModel { static fromRPC ( data ) { if ( ! data ) return undefined ; validators . ValidateCellDep ( data ) ; return new CellDep ( data . dep_type , data . out_point ) ; } constructor ( public depType , public outPoint ) { } validate ( ) { validators . ValidateCellDep ( transformers . TransformCellDep ( this ) ) ; return true ; } sameWith ( cellDep ) { validators . ValidateCellDep ( transformers . TransformCellDep ( cellDep ) ) ; return ( cellDep . depType === this . depType && cellDep . outPoint . sameWith ( this . outPoint ) ) ; } serializeJson ( ) { return { dep_type : this . depType , out_point : this . outPoint , } ; } }