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 | 300x 1x 1x 1x 13x 13x 140x 140x 140x 12x 1x 1x 4x 1x 1x | import type {Action, NameType} from '@wharfkit/antelope' import {Name, UInt64} from '@wharfkit/antelope' import type {SchemaObject} from '../types' import {Collection} from './collection' import type * as AtomicAssetsContract from '../contracts/atomicassets' import type {KitUtility} from '../utility' export class Schema { readonly data: SchemaObject readonly collection: Collection readonly utility: KitUtility static from(schemaObject: SchemaObject, utility: KitUtility) { const collection = new Collection(utility, schemaObject.collection) return new this(utility, schemaObject, collection) } constructor(utility: KitUtility, data: SchemaObject, collection: Collection) { this.utility = utility this.data = data this.collection = collection } get schemaName() { return Name.from(this.data.schema_name) } get assets() { return UInt64.from(this.data.assets) } get format() { return this.data.format } /** * The descriptors authored through `setschematyp`. Undefined when the * schema came from a response that does not report them, such as the schema * nested in an asset or template. */ get types() { return this.data.types } extendSchema( authorizedEditor: NameType, schemaFormat: AtomicAssetsContract.ActionParams.Type.FORMAT[] ): Action { return this.utility.assetsContract.action('extendschema', { authorized_editor: authorizedEditor, collection_name: this.collection.collectionName, schema_name: this.schemaName, schema_format_extension: schemaFormat, }) } } |