Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 40x 1x 1x 1x 1x 20x 10x 10x 10x 10x 10x 5x 3x 2x 1x 3x 1x 1x 1x | import type {Action, NameType, SignatureType} from '@wharfkit/antelope' import {Name, PublicKey, UInt64} from '@wharfkit/antelope' import type {LinkObject} from '../types' import {LinkState} from '../types' import {Asset} from './asset' import type {KitUtility} from '../utility' export class Link { readonly data: LinkObject readonly assets: Asset[] readonly utility: KitUtility readonly publicKey: PublicKey static from(linkObject: LinkObject, utility: KitUtility) { const assets = linkObject.assets.map((a) => Asset.from(a, utility)) return new this(utility, linkObject, assets) } constructor(utility: KitUtility, data: LinkObject, assets: Asset[]) { this.utility = utility this.data = data this.assets = assets this.publicKey = PublicKey.from(this.data.public_key) } get linkId() { return UInt64.from(this.data.link_id) } get creator() { return Name.from(this.data.creator) } get claimer() { return this.data.claimer ? Name.from(this.data.claimer) : null } get state() { return LinkState[LinkState[this.data.state.toNumber()]] } get memo() { return this.data.memo } cancel(): Action { return this.utility.toolsContract.action('cancellink', {link_id: this.linkId}) } claim(claimer: NameType, claimerSignature: SignatureType): Action { return this.utility.toolsContract.action('claimlink', { link_id: this.linkId, claimer, claimer_signature: claimerSignature, }) } } |