import { validators , transformers } from 'ckb-js-toolkit' ; import { CKBModel } from '..' ; export class OutPoint implements CKBModel { static fromRPC ( data ) { if ( ! data ) return undefined ; validators . ValidateOutPoint ( data ) ; return new OutPoint ( data . tx_hash , data . index ) ; } constructor ( public txHash , public index ) { } sameWith ( outPoint ) { validators . ValidateOutPoint ( transformers . TransformOutPoint ( outPoint ) ) ; return this . txHash === outPoint . txHash && this . index === outPoint . index ; } validate ( ) { validators . ValidateOutPoint ( transformers . TransformOutPoint ( this ) ) ; return this ; } serializeJson ( ) { return { tx_hash : this . txHash , index : this . index , } ; } }