{"version":3,"sources":["../../src/api/table.ts"],"sourcesContent":["import { getTableItem } from \"../internal/table\";\nimport { LedgerVersionArg, TableItemRequest } from \"../types\";\nimport { EndlessConfig } from \"./endlessConfig\";\n\n/**\n * A class to query all `Table` Endless related queries\n */\nexport class Table {\n  readonly config: EndlessConfig;\n\n  constructor(config: EndlessConfig) {\n    this.config = config;\n  }\n\n  /**\n   * Queries for a table item for a table identified by the handle and the key for the item.\n   * Key and value types need to be passed in to help with key serialization and value deserialization.\n   *\n   * Note, this query calls the fullnode server\n   *\n   * @example https://api.devnet.endlesslabs.com/v1/accounts/0x1/resource/0x1::coin::CoinInfo%3C0x1::endless_coin::EndlessCoin%3E\n   * const tableItem = await endless.getTableItem({\n   *  handle: \"0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca\",\n   *  data: {\n   *   key_type: \"address\", // Move type of table key\n   *   value_type: \"u128\", // Move type of table value\n   *   key: \"0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935\" // Value of table key\n   *  },\n   * })\n   *\n   * @param args.handle A pointer to where that table is stored\n   * @param args.data Object that describes table item\n   * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n   *\n   * @returns Table item value rendered in JSON\n   */\n  async getTableItem<T>(args: { handle: string; data: TableItemRequest; options?: LedgerVersionArg }): Promise<T> {\n    return getTableItem<T>({ endlessConfig: this.config, ...args });\n  }\n}"],"mappings":"yCAOO,IAAMA,EAAN,KAAY,CAGjB,YAAYC,EAAuB,CACjC,KAAK,OAASA,CAChB,CAwBA,MAAM,aAAgBC,EAA0F,CAC9G,OAAOC,EAAgB,CAAE,cAAe,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAChE,CACF","names":["Table","config","args","getTableItem"]}