{"version":3,"sources":["../../src/api/digitalAsset.ts"],"sourcesContent":["// Copyright © Endless\n// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { MoveStructId } from \"../types\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { Account } from \"../account\";\nimport { InputGenerateTransactionOptions } from \"../transactions/types\";\nimport {\n  addDigitalAssetPropertyTransaction,\n  addDigitalAssetTypedPropertyTransaction,\n  burnDigitalAssetTransaction,\n  CreateCollectionOptions,\n  createCollectionTransaction,\n  freezeDigitalAssetTransferTransaction,\n  mintDigitalAssetTransaction,\n  mintSoulBoundTransaction,\n  PropertyType,\n  PropertyValue,\n  removeDigitalAssetPropertyTransaction,\n  setDigitalAssetDescriptionTransaction,\n  setDigitalAssetNameTransaction,\n  setDigitalAssetURITransaction,\n  transferDigitalAssetTransaction,\n  unfreezeDigitalAssetTransferTransaction,\n  updateDigitalAssetPropertyTransaction,\n  updateDigitalAssetTypedPropertyTransaction,\n} from \"../internal/digitalAsset\";\nimport { EndlessConfig } from \"./endlessConfig\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\n/**\n * A class to query all `DigitalAsset` related queries on Endless.\n */\nexport class DigitalAsset {\n  constructor(readonly config: EndlessConfig) { }\n\n  /**\n   * Creates a new collection within the specified account\n   *\n   * @example\n   * const transaction = await endless.createCollectionTransaction({\n   *  creator: alice,\n   *  description: \"collectionDescription\",\n   *  name: \"collectionName\",\n   *  uri: \"collection-uri.com\",\n   * });\n   *\n   * @param args.creator the account of the collection's creator\n   * @param args.description the description of the collection\n   * @param args.name the name of the collection\n   * @param args.uri the URI to additional info about the collection\n   *\n   * The parameters below are optional.\n   * @param args.maxSupply controls the max supply of the digital assets - defaults MAX_U64_BIG_INT\n   * @param args.mutableDescription controls mutability of the collection's description - defaults true\n   * @param args.mutableRoyalty controls mutability of the collection's description - defaults true\n   * @param args.mutableUri controls mutability of the collection's URI - defaults true\n   * @param args.mutableTokenDescription controls mutability of the digital asset's description - defaults true\n   * @param args.mutableTokenName controls mutability of the digital asset's name - defaults true\n   * @param args.mutableTokenProperties controls mutability of digital asset's properties - defaults true\n   * @param args.mutableTokenUri controls mutability of the digital asset's URI - defaults true\n   * @param args.tokensBurnableByCreator controls whether digital assets can be burnable by the creator - defaults true\n   * @param args.tokensFreezableByCreator controls whether digital assets can be frozen by the creator - defaults true\n   * @param args.royaltyNumerator the numerator of the royalty to be paid to the creator when\n   * a digital asset is transferred - defaults 0\n   * @param args.royaltyDenominator the denominator of the royalty to be paid to the creator\n   * when a digital asset is transferred - defaults 1\n   *\n   * @returns A SimpleTransaction that when submitted will create the collection.\n   */\n  async createCollectionTransaction(\n    args: {\n      creator: Account;\n      description: string;\n      name: string;\n      uri: string;\n      options?: InputGenerateTransactionOptions;\n    } & CreateCollectionOptions,\n  ): Promise<SimpleTransaction> {\n    return createCollectionTransaction({ endlessConfig: this.config, ...args });\n  }\n\n  /**\n   * Create a transaction to mint a digital asset into the creators account within an existing collection.\n   *\n   * @example\n   * const transaction = await endless.mintDigitalAssetTransaction({\n   *  creator: alice,\n   *  description: \"collectionDescription\",\n   *  collection: \"collectionName\",\n   *  name: \"digitalAssetName\",\n   *  uri: \"digital-asset-uri.com\",\n   * });\n   *\n   * @param args.creator the creator of the collection\n   * @param args.collection the name of the collection the digital asset belongs to\n   * @param args.description the description of the digital asset\n   * @param args.name the name of the digital asset\n   * @param args.uri the URI to additional info about the digital asset\n   *\n   * @returns A SimpleTransaction that can be simulated or submitted to chain\n   */\n  async mintDigitalAssetTransaction(args: {\n    creator: Account;\n    collection: string;\n    description: string;\n    name: string;\n    uri: string;\n    propertyKeys?: Array<string>;\n    propertyTypes?: Array<PropertyType>;\n    propertyValues?: Array<PropertyValue>;\n    options?: InputGenerateTransactionOptions;\n  }): Promise<SimpleTransaction> {\n    return mintDigitalAssetTransaction({ endlessConfig: this.config, ...args });\n  }\n\n  /**\n   * Transfer a digital asset (non fungible digital asset) ownership.\n   *\n   * We can transfer a digital asset only when the digital asset is not frozen\n   * (i.e. owner transfer is not disabled such as for soul bound digital assets)\n   *\n   * @example\n   * const transaction = await endless.transferDigitalAssetTransaction({\n   *  sender: alice,\n   *  digitalAssetAddress: \"0x123\",\n   *  recipient: \"0x456\",\n   * });\n   *\n   * @param args.sender The sender account of the current digital asset owner\n   * @param args.digitalAssetAddress The digital asset address\n   * @param args.recipient The recipient account address\n   * @param args.digitalAssetType optional. The digital asset type, default to \"0x4::token::Token\"\n   *\n   * @returns A SimpleTransaction that can be simulated or submitted to chain\n   */\n  async transferDigitalAssetTransaction(args: {\n    sender: Account;\n    digitalAssetAddress: AccountAddressInput;\n    recipient: AccountAddress;\n    digitalAssetType?: MoveStructId;\n    options?: InputGenerateTransactionOptions;\n  }): Promise<SimpleTransaction> {\n    return transferDigitalAssetTransaction({ endlessConfig: this.config, ...args });\n  }\n\n  /**\n   * Mint a soul bound digital asset into a recipient's account\n   *\n   * @example\n   * const transaction = await endless.mintSoulBoundTransaction({\n   *  account: alice,\n   *  collection: \"collectionName\",\n   *  description: \"collectionDescription\",\n   *  name: \"digitalAssetName\",\n   *  uri: \"digital-asset-uri.com\",\n   *  recipient: \"0x123\"\n   * });\n   *\n   * @param args.account The account that mints the digital asset\n   * @param args.collection The collection name that the digital asset belongs to\n   * @param args.description The digital asset description\n   * @param args.name The digital asset name\n   * @param args.uri The digital asset URL\n   * @param args.recipient The account address where the digital asset will be created\n   * @param args.propertyKeys The property keys for storing on-chain properties\n   * @param args.propertyTypes The type of property values\n   * @param args.propertyValues The property values to be stored on-chain\n   *\n   * @returns A SimpleTransaction that can be simulated or submitted to chain\n   */\n  async mintSoulBoundTransaction(args: {\n    account: Account;\n    collection: string;\n    description: string;\n    name: string;\n    uri: string;\n    recipient: AccountAddressInput;\n    propertyKeys?: Array<string>;\n    propertyTypes?: Array<PropertyType>;\n    propertyValues?: Array<PropertyValue>;\n    options?: InputGenerateTransactionOptions;\n  }): Promise<SimpleTransaction> {\n    return mintSoulBoundTransaction({ endlessConfig: this.config, ...args });\n  }\n\n  /**\n   * Burn a digital asset by its creator\n   *\n   * @example\n   * const transaction = await endless.burnDigitalAssetTransaction({\n   *  creator: alice,\n   *  digitalAssetAddress: \"0x123\",\n   * });\n   *\n   * @param args.creator The creator account\n   * @param args.digitalAssetAddress The digital asset address\n   *\n   * @returns A SimpleTransaction that can be simulated or submitted to chain\n   */\n  async burnDigitalAssetTransaction(args: {\n    creator: Account;\n    digitalAssetAddress: AccountAddressInput;\n    digitalAssetType?: MoveStructId;\n    options?: InputGenerateTransactionOptions;\n  }) {\n    return burnDigitalAssetTransaction({ endlessConfig: this.config, ...args });\n  }\n\n  /**\n   * Freeze digital asset transfer ability\n   *\n   * @example\n   * const transaction = await endless.freezeDigitalAssetTransaferTransaction({\n   *  creator: alice,\n   *  digitalAssetAddress: \"0x123\",\n   * });\n   *\n   * @param args.creator The creator account\n   * @param args.digitalAssetAddress The digital asset address\n   *\n   * @returns A SimpleTransaction that can be simulated or submitted to chain\n   */\n  async freezeDigitalAssetTransaferTransaction(args: {\n    creator: Account;\n    digitalAssetAddress: AccountAddressInput;\n    digitalAssetType?: MoveStructId;\n    options?: InputGenerateTransactionOptions;\n  }) {\n    return freezeDigitalAssetTransferTransaction({ endlessConfig: this.config, ...args });\n  }\n\n  /**\n   * Unfreeze digital asset transfer ability\n   *\n   * @example\n   * const transaction = await endless.unfreezeDigitalAssetTransaferTransaction({\n   *  creator: alice,\n   *  digitalAssetAddress: \"0x123\",\n   * });\n   *\n   * @param args.creator The creator account\n   * @param args.digitalAssetAddress The digital asset address\n   *\n   * @returns A SimpleTransaction that can be simulated or submitted to chain\n   */\n  async unfreezeDigitalAssetTransaferTransaction(args: {\n    creator: Account;\n    digitalAssetAddress: AccountAddressInput;\n    digitalAssetType?: MoveStructId;\n    options?: InputGenerateTransactionOptions;\n  }) {\n    return unfreezeDigitalAssetTransferTransaction({ endlessConfig: this.config, ...args });\n  }\n\n  /**\n   * Set the digital asset description\n   *\n   * @example\n   * const transaction = await endless.setDigitalAssetDescriptionTransaction({\n   *  creator: alice,\n   *  description: \"digitalAssetDescription\",\n   *  digitalAssetAddress: \"0x123\",\n   * });\n   *\n   * @param args.creator The creator account\n   * @param args.description The digital asset description\n   * @param args.digitalAssetAddress The digital asset address\n   *\n   * @returns A SimpleTransaction that can be simulated or submitted to chain\n   */\n  async setDigitalAssetDescriptionTransaction(args: {\n    creator: Account;\n    description: string;\n    digitalAssetAddress: AccountAddressInput;\n    digitalAssetType?: MoveStructId;\n    options?: InputGenerateTransactionOptions;\n  }) {\n    return setDigitalAssetDescriptionTransaction({ endlessConfig: this.config, ...args });\n  }\n\n  /**\n   * Set the digital asset name\n   *\n   * @example\n   * const transaction = await endless.setDigitalAssetNameTransaction({\n   *  creator: alice,\n   *  name: \"digitalAssetName\",\n   *  digitalAssetAddress: \"0x123\",\n   * });\n   *\n   * @param args.creator The creator account\n   * @param args.name The digital asset name\n   * @param args.digitalAssetAddress The digital asset address\n   *\n   * @returns A SimpleTransaction that can be simulated or submitted to chain\n   */\n  async setDigitalAssetNameTransaction(args: {\n    creator: Account;\n    name: string;\n    digitalAssetAddress: AccountAddressInput;\n    digitalAssetType?: MoveStructId;\n    options?: InputGenerateTransactionOptions;\n  }) {\n    return setDigitalAssetNameTransaction({ endlessConfig: this.config, ...args });\n  }\n\n  /**\n   * Set the digital asset name\n   *\n   * @example\n   * const transaction = await endless.setDigitalAssetURITransaction({\n   *  creator: alice,\n   *  uri: \"digital-asset-uri.com\",\n   *  digitalAssetAddress: \"0x123\",\n   * });\n   *\n   * @param args.creator The creator account\n   * @param args.uri The digital asset uri\n   * @param args.digitalAssetAddress The digital asset address\n   *\n   * @returns A SimpleTransaction that can be simulated or submitted to chain\n   */\n  async setDigitalAssetURITransaction(args: {\n    creator: Account;\n    uri: string;\n    digitalAssetAddress: AccountAddressInput;\n    digitalAssetType?: MoveStructId;\n    options?: InputGenerateTransactionOptions;\n  }) {\n    return setDigitalAssetURITransaction({ endlessConfig: this.config, ...args });\n  }\n\n  /**\n   * Add a digital asset property\n   *\n   * @example\n   * const transaction = await endless.addDigitalAssetPropertyTransaction({\n   *  creator: alice,\n   *  propertyKey: \"newKey\",\n   *  propertyType: \"BOOLEAN\",\n   *  propertyValue: true,\n   *  digitalAssetAddress: \"0x123\",\n   * });\n   *\n   * @param args.account The account that mints the digital asset\n   * @param args.digitalAssetAddress The digital asset address\n   * @param args.propertyKey The property key for storing on-chain properties\n   * @param args.propertyType The type of property value\n   * @param args.propertyValue The property value to be stored on-chain\n   *\n   * @returns A SimpleTransaction that can be simulated or submitted to chain\n   */\n  async addDigitalAssetPropertyTransaction(args: {\n    creator: Account;\n    propertyKey: string;\n    propertyType: PropertyType;\n    propertyValue: PropertyValue;\n    digitalAssetAddress: AccountAddressInput;\n    digitalAssetType?: MoveStructId;\n    options?: InputGenerateTransactionOptions;\n  }) {\n    return addDigitalAssetPropertyTransaction({ endlessConfig: this.config, ...args });\n  }\n\n  /**\n   * Remove a digital asset property\n   *\n   * @example\n   * const transaction = await endless.removeDigitalAssetPropertyTransaction({\n   *  creator: alice,\n   *  propertyKey: \"newKey\",\n   *  propertyType: \"BOOLEAN\",\n   *  propertyValue: true,\n   *  digitalAssetAddress: \"0x123\",\n   * });\n   *\n   * @param args.account The account that mints the digital asset\n   * @param args.digitalAssetAddress The digital asset address\n   * @param args.propertyKey The property key for storing on-chain properties\n   * @param args.propertyType The type of property value\n   * @param args.propertyValue The property value to be stored on-chain\n   *\n   * @returns A SimpleTransaction that can be simulated or submitted to chain\n   */\n  async removeDigitalAssetPropertyTransaction(args: {\n    creator: Account;\n    propertyKey: string;\n    propertyType: PropertyType;\n    propertyValue: PropertyValue;\n    digitalAssetAddress: AccountAddressInput;\n    digitalAssetType?: MoveStructId;\n    options?: InputGenerateTransactionOptions;\n  }) {\n    return removeDigitalAssetPropertyTransaction({ endlessConfig: this.config, ...args });\n  }\n\n  /**\n   * Update a digital asset property\n   *\n   * @example\n   * const transaction = await endless.updateDigitalAssetPropertyTransaction({\n   *  creator: alice,\n   *  propertyKey: \"newKey\",\n   *  propertyType: \"BOOLEAN\",\n   *  propertyValue: false,\n   *  digitalAssetAddress: \"0x123\",\n   * });\n   *\n   * @param args.account The account that mints the digital asset\n   * @param args.digitalAssetAddress The digital asset address\n   * @param args.propertyKey The property key for storing on-chain properties\n   * @param args.propertyType The type of property value\n   * @param args.propertyValue The property value to be stored on-chain\n   *\n   * @returns A SimpleTransaction that can be simulated or submitted to chain\n   */\n  async updateDigitalAssetPropertyTransaction(args: {\n    creator: Account;\n    propertyKey: string;\n    propertyType: PropertyType;\n    propertyValue: PropertyValue;\n    digitalAssetAddress: AccountAddressInput;\n    digitalAssetType?: MoveStructId;\n    options?: InputGenerateTransactionOptions;\n  }) {\n    return updateDigitalAssetPropertyTransaction({ endlessConfig: this.config, ...args });\n  }\n\n  /**\n   * Add a typed digital asset property\n   *\n   * @example\n   * const transaction = await endless.addDigitalAssetTypedPropertyTransaction({\n   *  creator: alice,\n   *  propertyKey: \"typedKey\",\n   *  propertyType: \"STRING\",\n   *  propertyValue: \"hello\",\n   *  digitalAssetAddress: \"0x123\",\n   * });\n   *\n   * @param args.account The account that mints the digital asset\n   * @param args.digitalAssetAddress The digital asset address\n   * @param args.propertyKey The property key for storing on-chain properties\n   * @param args.propertyType The type of property value\n   * @param args.propertyValue The property value to be stored on-chain\n   *\n   * @returns A SimpleTransaction that can be simulated or submitted to chain\n   */\n  async addDigitalAssetTypedPropertyTransaction(args: {\n    creator: Account;\n    propertyKey: string;\n    propertyType: PropertyType;\n    propertyValue: PropertyValue;\n    digitalAssetAddress: AccountAddressInput;\n    digitalAssetType?: MoveStructId;\n    options?: InputGenerateTransactionOptions;\n  }) {\n    return addDigitalAssetTypedPropertyTransaction({ endlessConfig: this.config, ...args });\n  }\n\n  /**\n   * Update a typed digital asset property\n   *\n   * @example\n   * const transaction = await endless.updateDigitalAssetTypedPropertyTransaction({\n   *  creator: alice,\n   *  propertyKey: \"typedKey\",\n   *  propertyType: \"U8\",\n   *  propertyValue: 2,\n   *  digitalAssetAddress: \"0x123\",\n   * });\n   *\n   * @param args.account The account that mints the digital asset\n   * @param args.digitalAssetAddress The digital asset address\n   * @param args.propertyKey The property key for storing on-chain properties\n   * @param args.propertyType The type of property value\n   * @param args.propertyValue The property value to be stored on-chain\n   *\n   * @returns A SimpleTransaction that can be simulated or submitted to chain\n   */\n  async updateDigitalAssetTypedPropertyTransaction(args: {\n    creator: Account;\n    propertyKey: string;\n    propertyType: PropertyType;\n    propertyValue: PropertyValue;\n    digitalAssetAddress: AccountAddressInput;\n    digitalAssetType?: MoveStructId;\n    options?: InputGenerateTransactionOptions;\n  }) {\n    return updateDigitalAssetTypedPropertyTransaction({ endlessConfig: this.config, ...args });\n  }\n}\n"],"mappings":"2IAkCO,IAAMA,EAAN,KAAmB,CACxB,YAAqBC,EAAuB,CAAvB,YAAAA,CAAyB,CAoC9C,MAAM,4BACJC,EAO4B,CAC5B,OAAOC,EAA4B,CAAE,cAAe,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAC5E,CAsBA,MAAM,4BAA4BA,EAUH,CAC7B,OAAOE,EAA4B,CAAE,cAAe,KAAK,OAAQ,GAAGF,CAAK,CAAC,CAC5E,CAsBA,MAAM,gCAAgCA,EAMP,CAC7B,OAAOG,EAAgC,CAAE,cAAe,KAAK,OAAQ,GAAGH,CAAK,CAAC,CAChF,CA2BA,MAAM,yBAAyBA,EAWA,CAC7B,OAAOI,EAAyB,CAAE,cAAe,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CACzE,CAgBA,MAAM,4BAA4BA,EAK/B,CACD,OAAOK,EAA4B,CAAE,cAAe,KAAK,OAAQ,GAAGL,CAAK,CAAC,CAC5E,CAgBA,MAAM,uCAAuCA,EAK1C,CACD,OAAOM,EAAsC,CAAE,cAAe,KAAK,OAAQ,GAAGN,CAAK,CAAC,CACtF,CAgBA,MAAM,yCAAyCA,EAK5C,CACD,OAAOO,EAAwC,CAAE,cAAe,KAAK,OAAQ,GAAGP,CAAK,CAAC,CACxF,CAkBA,MAAM,sCAAsCA,EAMzC,CACD,OAAOQ,EAAsC,CAAE,cAAe,KAAK,OAAQ,GAAGR,CAAK,CAAC,CACtF,CAkBA,MAAM,+BAA+BA,EAMlC,CACD,OAAOS,EAA+B,CAAE,cAAe,KAAK,OAAQ,GAAGT,CAAK,CAAC,CAC/E,CAkBA,MAAM,8BAA8BA,EAMjC,CACD,OAAOU,EAA8B,CAAE,cAAe,KAAK,OAAQ,GAAGV,CAAK,CAAC,CAC9E,CAsBA,MAAM,mCAAmCA,EAQtC,CACD,OAAOW,EAAmC,CAAE,cAAe,KAAK,OAAQ,GAAGX,CAAK,CAAC,CACnF,CAsBA,MAAM,sCAAsCA,EAQzC,CACD,OAAOY,EAAsC,CAAE,cAAe,KAAK,OAAQ,GAAGZ,CAAK,CAAC,CACtF,CAsBA,MAAM,sCAAsCA,EAQzC,CACD,OAAOa,EAAsC,CAAE,cAAe,KAAK,OAAQ,GAAGb,CAAK,CAAC,CACtF,CAsBA,MAAM,wCAAwCA,EAQ3C,CACD,OAAOc,EAAwC,CAAE,cAAe,KAAK,OAAQ,GAAGd,CAAK,CAAC,CACxF,CAsBA,MAAM,2CAA2CA,EAQ9C,CACD,OAAOe,EAA2C,CAAE,cAAe,KAAK,OAAQ,GAAGf,CAAK,CAAC,CAC3F,CACF","names":["DigitalAsset","config","args","createCollectionTransaction","mintDigitalAssetTransaction","transferDigitalAssetTransaction","mintSoulBoundTransaction","burnDigitalAssetTransaction","freezeDigitalAssetTransferTransaction","unfreezeDigitalAssetTransferTransaction","setDigitalAssetDescriptionTransaction","setDigitalAssetNameTransaction","setDigitalAssetURITransaction","addDigitalAssetPropertyTransaction","removeDigitalAssetPropertyTransaction","updateDigitalAssetPropertyTransaction","addDigitalAssetTypedPropertyTransaction","updateDigitalAssetTypedPropertyTransaction"]}