{
  "version": 3,
  "sources": ["../src/account_identifier.ts", "../../../node_modules/@noble/hashes/src/utils.ts", "../../../node_modules/@noble/hashes/src/_md.ts", "../../../node_modules/@noble/hashes/src/sha2.ts", "../src/canisters/ledger/ledger.request.converts.ts", "../src/constants/constants.ts", "../src/errors/ledger.errors.ts", "../src/index.canister.ts", "../src/candid/index.certified.idl.js", "../src/candid/index.idl.js", "../src/constants/canister_ids.ts", "../src/errors/index.errors.ts", "../src/utils/params.utils.ts", "../src/ledger.canister.ts", "../src/candid/ledger.certified.idl.js", "../src/candid/ledger.idl.js", "../src/utils/accounts.utils.ts"],
  "sourcesContent": ["import {\n  arrayOfNumberToUint8Array,\n  asciiStringToByteArray,\n  bigEndianCrc32,\n  hexStringToUint8Array,\n  uint8ArrayToHexString,\n} from \"@dfinity/utils\";\nimport type { Principal } from \"@icp-sdk/core/principal\";\nimport { sha224 } from \"@noble/hashes/sha2\";\n\n/**\n * A 32-byte account identifier used to send and receive ICP tokens.\n *\n * The ICP Ledger uses the concept of an `AccountIdentifier` to represent accounts.\n * It\u2019s a unique value derived from a principal (the identity controlling the account)\n * and a subaccount. This design allows a single principal to control multiple accounts\n * by using different subaccounts.\n *\n * @see https://internetcomputer.org/docs/references/ledger#_accounts\n * @see https://internetcomputer.org/docs/defi/token-ledgers/setup/icp_ledger_setup\n * @see https://internetcomputer.org/docs/references/ledger#_operations_transactions_blocks_transaction_ledger\n */\nexport class AccountIdentifier {\n  private constructor(private readonly bytes: Uint8Array) {}\n\n  /**\n   * Creates an `AccountIdentifier` object from a hexadecimal string (e.g. d3e13d4777e22367532053190b6c6ccf57444a61337e996242b1abfb52cf92c8).\n   * Validates the checksum in the process.\n   *\n   * @param hex - The 64-character hexadecimal representation of the account identifier.\n   * @throws If the length is not 32 bytes or if the checksum is invalid.\n   * @returns An instance of `AccountIdentifier`.\n   */\n  public static fromHex(hex: string): AccountIdentifier {\n    const bytes = hexStringToUint8Array(hex);\n\n    if (bytes.length !== 32) {\n      throw new Error(\n        `Invalid AccountIdentifier: expected 32 bytes, got ${bytes.length}.`,\n      );\n    }\n\n    const providedChecksum = uint8ArrayToHexString(bytes.slice(0, 4));\n\n    const hash = bytes.slice(4);\n    const expectedChecksum = uint8ArrayToHexString(bigEndianCrc32(hash));\n\n    if (providedChecksum !== expectedChecksum) {\n      throw Error(\n        `Checksum mismatch. Expected ${expectedChecksum}, but got ${providedChecksum}.`,\n      );\n    }\n\n    return new AccountIdentifier(bytes);\n  }\n\n  /**\n   * Creates an `AccountIdentifier` object from a principal and optional subaccount.\n   *\n   * When no subaccount is provided, a 32-byte array of zeros is used by default.\n   * You can use any arbitrary 32 bytes as a subaccount identifier to derive a distinct account identifier\n   * for the same principal.\n   *\n   * @param options.principal - The principal to derive the account from.\n   * @param options.subAccount - The optional subaccount (defaults to 0).\n   * @returns An instance of `AccountIdentifier`.\n   */\n  public static fromPrincipal({\n    principal,\n    subAccount = SubAccount.fromID(0),\n  }: {\n    principal: Principal;\n    subAccount?: SubAccount;\n  }): AccountIdentifier {\n    // Hash (sha224) the principal, the subAccount and some padding\n    const padding = asciiStringToByteArray(\"\\x0Aaccount-id\");\n\n    const shaObj = sha224.create();\n    shaObj.update(\n      arrayOfNumberToUint8Array([\n        ...padding,\n        ...principal.toUint8Array(),\n        ...subAccount.toUint8Array(),\n      ]),\n    );\n    const hash = shaObj.digest();\n\n    // Prepend the checksum of the hash and convert to a hex string\n    const checksum = bigEndianCrc32(hash);\n    const bytes = new Uint8Array([...checksum, ...hash]);\n    return new AccountIdentifier(bytes);\n  }\n\n  /**\n   * Returns the ICP Ledger Account Identifier as a 64-character hexadecimal string.\n   * This is the format typically used to display the account identifier in a human-readable way.\n   *\n   * @returns Hex representation (64-character string).\n   */\n  public toHex(): string {\n    return uint8ArrayToHexString(this.bytes);\n  }\n\n  /**\n   * Returns the raw 32-byte `Uint8Array` of the account identifier.\n   *\n   * @returns The raw bytes of the account identifier.\n   */\n  public toUint8Array(): Uint8Array {\n    return this.bytes;\n  }\n\n  /**\n   * Returns the account identifier as an array of numbers.\n   *\n   * @returns An array of byte values.\n   */\n  public toNumbers(): number[] {\n    return Array.from(this.bytes);\n  }\n\n  /**\n   * Returns the raw bytes wrapped in an object under the `hash` key.\n   *\n   * @returns `{ hash: Uint8Array }` where `hash` is the raw 32-byte `Uint8Array`.\n   */\n  public toAccountIdentifierHash(): { hash: Uint8Array } {\n    return {\n      hash: this.toUint8Array(),\n    };\n  }\n}\n\n/**\n * A subaccount in the ICP ledger is a 32-byte identifier that allows a principal (user or canister)\n * to control multiple independent accounts under the same principal.\n *\n * @see https://internetcomputer.org/docs/references/ledger#_accounts\n */\nexport class SubAccount {\n  private constructor(private readonly bytes: Uint8Array) {}\n\n  /**\n   * Creates a `SubAccount` from a 32\u2011byte array.\n   *\n   * @param bytes - A `Uint8Array` of exactly 32 bytes.\n   * @throws If the byte array length is not 32.\n   * @returns A `SubAccount` instance.\n   */\n  public static fromBytes(bytes: Uint8Array): SubAccount {\n    if (bytes.length !== 32) {\n      throw new Error(\"Subaccount length must be 32-bytes\");\n    }\n\n    return new SubAccount(bytes);\n  }\n\n  /**\n   * Generates a `SubAccount` from a principal.\n   *\n   * The principal is embedded into the beginning of a 32\u2011byte array.\n   *\n   * @param principal - A principal to encode into the subaccount.\n   * @returns A `SubAccount` instance.\n   */\n  public static fromPrincipal(principal: Principal): SubAccount {\n    const bytes = new Uint8Array(32).fill(0);\n\n    const principalBytes = principal.toUint8Array();\n    bytes[0] = principalBytes.length;\n\n    for (let i = 0; i < principalBytes.length; i++) {\n      bytes[1 + i] = principalBytes[i];\n    }\n\n    return new SubAccount(bytes);\n  }\n\n  /**\n   * Generates a `SubAccount` from a non\u2011negative number.\n   *\n   * The number is encoded into the last 8 bytes of the 32\u2011byte array.\n   * This is a common pattern when using numbered subaccounts like 0, 1, 2...\n   *\n   * @param id - A non-negative integer.\n   * @throws If the number is negative or exceeds `Number.MAX_SAFE_INTEGER`.\n   * @returns A `SubAccount` instance.\n   */\n  public static fromID(id: number): SubAccount {\n    if (id < 0) {\n      throw new Error(\"Number cannot be negative\");\n    }\n\n    if (id > Number.MAX_SAFE_INTEGER) {\n      throw new Error(\"Number is too large to fit in 32 bytes.\");\n    }\n\n    const view = new DataView(new ArrayBuffer(32));\n\n    // Fix for IOS < 14.8 setBigUint64 absence\n    if (typeof view.setBigUint64 === \"function\") {\n      view.setBigUint64(24, BigInt(id));\n    } else {\n      const TWO_TO_THE_32 = BigInt(1) << BigInt(32);\n      view.setUint32(24, Number(BigInt(id) >> BigInt(32)));\n      view.setUint32(28, Number(BigInt(id) % TWO_TO_THE_32));\n    }\n\n    const uint8Arary = new Uint8Array(view.buffer);\n    return new SubAccount(uint8Arary);\n  }\n\n  /**\n   * Returns the raw 32-byte `Uint8Array` representing this subaccount.\n   *\n   * @returns A 32-byte array.\n   */\n  public toUint8Array(): Uint8Array {\n    return this.bytes;\n  }\n}\n", "/**\n * Utilities for hex, bytes, CSPRNG.\n * @module\n */\n/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\n\n/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */\nexport function isBytes(a: unknown): a is Uint8Array {\n  return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');\n}\n\n/** Asserts something is positive integer. */\nexport function anumber(n: number): void {\n  if (!Number.isSafeInteger(n) || n < 0) throw new Error('positive integer expected, got ' + n);\n}\n\n/** Asserts something is Uint8Array. */\nexport function abytes(b: Uint8Array | undefined, ...lengths: number[]): void {\n  if (!isBytes(b)) throw new Error('Uint8Array expected');\n  if (lengths.length > 0 && !lengths.includes(b.length))\n    throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length);\n}\n\n/** Asserts something is hash */\nexport function ahash(h: IHash): void {\n  if (typeof h !== 'function' || typeof h.create !== 'function')\n    throw new Error('Hash should be wrapped by utils.createHasher');\n  anumber(h.outputLen);\n  anumber(h.blockLen);\n}\n\n/** Asserts a hash instance has not been destroyed / finished */\nexport function aexists(instance: any, checkFinished = true): void {\n  if (instance.destroyed) throw new Error('Hash instance has been destroyed');\n  if (checkFinished && instance.finished) throw new Error('Hash#digest() has already been called');\n}\n\n/** Asserts output is properly-sized byte array */\nexport function aoutput(out: any, instance: any): void {\n  abytes(out);\n  const min = instance.outputLen;\n  if (out.length < min) {\n    throw new Error('digestInto() expects output buffer of length at least ' + min);\n  }\n}\n\n/** Generic type encompassing 8/16/32-byte arrays - but not 64-byte. */\n// prettier-ignore\nexport type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array |\n  Uint16Array | Int16Array | Uint32Array | Int32Array;\n\n/** Cast u8 / u16 / u32 to u8. */\nexport function u8(arr: TypedArray): Uint8Array {\n  return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n\n/** Cast u8 / u16 / u32 to u32. */\nexport function u32(arr: TypedArray): Uint32Array {\n  return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n}\n\n/** Zeroize a byte array. Warning: JS provides no guarantees. */\nexport function clean(...arrays: TypedArray[]): void {\n  for (let i = 0; i < arrays.length; i++) {\n    arrays[i].fill(0);\n  }\n}\n\n/** Create DataView of an array for easy byte-level manipulation. */\nexport function createView(arr: TypedArray): DataView {\n  return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n\n/** The rotate right (circular right shift) operation for uint32 */\nexport function rotr(word: number, shift: number): number {\n  return (word << (32 - shift)) | (word >>> shift);\n}\n\n/** The rotate left (circular left shift) operation for uint32 */\nexport function rotl(word: number, shift: number): number {\n  return (word << shift) | ((word >>> (32 - shift)) >>> 0);\n}\n\n/** Is current platform little-endian? Most are. Big-Endian platform: IBM */\nexport const isLE: boolean = /* @__PURE__ */ (() =>\n  new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();\n\n/** The byte swap operation for uint32 */\nexport function byteSwap(word: number): number {\n  return (\n    ((word << 24) & 0xff000000) |\n    ((word << 8) & 0xff0000) |\n    ((word >>> 8) & 0xff00) |\n    ((word >>> 24) & 0xff)\n  );\n}\n/** Conditionally byte swap if on a big-endian platform */\nexport const swap8IfBE: (n: number) => number = isLE\n  ? (n: number) => n\n  : (n: number) => byteSwap(n);\n\n/** @deprecated */\nexport const byteSwapIfBE: typeof swap8IfBE = swap8IfBE;\n/** In place byte swap for Uint32Array */\nexport function byteSwap32(arr: Uint32Array): Uint32Array {\n  for (let i = 0; i < arr.length; i++) {\n    arr[i] = byteSwap(arr[i]);\n  }\n  return arr;\n}\n\nexport const swap32IfBE: (u: Uint32Array) => Uint32Array = isLE\n  ? (u: Uint32Array) => u\n  : byteSwap32;\n\n// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex\nconst hasHexBuiltin: boolean = /* @__PURE__ */ (() =>\n  // @ts-ignore\n  typeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();\n\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) =>\n  i.toString(16).padStart(2, '0')\n);\n\n/**\n * Convert byte array to hex string. Uses built-in function, when available.\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes: Uint8Array): string {\n  abytes(bytes);\n  // @ts-ignore\n  if (hasHexBuiltin) return bytes.toHex();\n  // pre-caching improves the speed 6x\n  let hex = '';\n  for (let i = 0; i < bytes.length; i++) {\n    hex += hexes[bytes[i]];\n  }\n  return hex;\n}\n\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 } as const;\nfunction asciiToBase16(ch: number): number | undefined {\n  if (ch >= asciis._0 && ch <= asciis._9) return ch - asciis._0; // '2' => 50-48\n  if (ch >= asciis.A && ch <= asciis.F) return ch - (asciis.A - 10); // 'B' => 66-(65-10)\n  if (ch >= asciis.a && ch <= asciis.f) return ch - (asciis.a - 10); // 'b' => 98-(97-10)\n  return;\n}\n\n/**\n * Convert hex string to byte array. Uses built-in function, when available.\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex: string): Uint8Array {\n  if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex);\n  // @ts-ignore\n  if (hasHexBuiltin) return Uint8Array.fromHex(hex);\n  const hl = hex.length;\n  const al = hl / 2;\n  if (hl % 2) throw new Error('hex string expected, got unpadded hex of length ' + hl);\n  const array = new Uint8Array(al);\n  for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n    const n1 = asciiToBase16(hex.charCodeAt(hi));\n    const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n    if (n1 === undefined || n2 === undefined) {\n      const char = hex[hi] + hex[hi + 1];\n      throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n    }\n    array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163\n  }\n  return array;\n}\n\n/**\n * There is no setImmediate in browser and setTimeout is slow.\n * Call of async fn will return Promise, which will be fullfiled only on\n * next scheduler queue processing step and this is exactly what we need.\n */\nexport const nextTick = async (): Promise<void> => {};\n\n/** Returns control to thread each 'tick' ms to avoid blocking. */\nexport async function asyncLoop(\n  iters: number,\n  tick: number,\n  cb: (i: number) => void\n): Promise<void> {\n  let ts = Date.now();\n  for (let i = 0; i < iters; i++) {\n    cb(i);\n    // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n    const diff = Date.now() - ts;\n    if (diff >= 0 && diff < tick) continue;\n    await nextTick();\n    ts += diff;\n  }\n}\n\n// Global symbols, but ts doesn't see them: https://github.com/microsoft/TypeScript/issues/31535\ndeclare const TextEncoder: any;\ndeclare const TextDecoder: any;\n\n/**\n * Converts string to bytes using UTF8 encoding.\n * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])\n */\nexport function utf8ToBytes(str: string): Uint8Array {\n  if (typeof str !== 'string') throw new Error('string expected');\n  return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n\n/**\n * Converts bytes to string using UTF8 encoding.\n * @example bytesToUtf8(Uint8Array.from([97, 98, 99])) // 'abc'\n */\nexport function bytesToUtf8(bytes: Uint8Array): string {\n  return new TextDecoder().decode(bytes);\n}\n\n/** Accepted input of hash functions. Strings are converted to byte arrays. */\nexport type Input = string | Uint8Array;\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data: Input): Uint8Array {\n  if (typeof data === 'string') data = utf8ToBytes(data);\n  abytes(data);\n  return data;\n}\n\n/** KDFs can accept string or Uint8Array for user convenience. */\nexport type KDFInput = string | Uint8Array;\n/**\n * Helper for KDFs: consumes uint8array or string.\n * When string is passed, does utf8 decoding, using TextDecoder.\n */\nexport function kdfInputToBytes(data: KDFInput): Uint8Array {\n  if (typeof data === 'string') data = utf8ToBytes(data);\n  abytes(data);\n  return data;\n}\n\n/** Copies several Uint8Arrays into one. */\nexport function concatBytes(...arrays: Uint8Array[]): Uint8Array {\n  let sum = 0;\n  for (let i = 0; i < arrays.length; i++) {\n    const a = arrays[i];\n    abytes(a);\n    sum += a.length;\n  }\n  const res = new Uint8Array(sum);\n  for (let i = 0, pad = 0; i < arrays.length; i++) {\n    const a = arrays[i];\n    res.set(a, pad);\n    pad += a.length;\n  }\n  return res;\n}\n\ntype EmptyObj = {};\nexport function checkOpts<T1 extends EmptyObj, T2 extends EmptyObj>(\n  defaults: T1,\n  opts?: T2\n): T1 & T2 {\n  if (opts !== undefined && {}.toString.call(opts) !== '[object Object]')\n    throw new Error('options should be object or undefined');\n  const merged = Object.assign(defaults, opts);\n  return merged as T1 & T2;\n}\n\n/** Hash interface. */\nexport type IHash = {\n  (data: Uint8Array): Uint8Array;\n  blockLen: number;\n  outputLen: number;\n  create: any;\n};\n\n/** For runtime check if class implements interface */\nexport abstract class Hash<T extends Hash<T>> {\n  abstract blockLen: number; // Bytes per block\n  abstract outputLen: number; // Bytes in output\n  abstract update(buf: Input): this;\n  // Writes digest into buf\n  abstract digestInto(buf: Uint8Array): void;\n  abstract digest(): Uint8Array;\n  /**\n   * Resets internal state. Makes Hash instance unusable.\n   * Reset is impossible for keyed hashes if key is consumed into state. If digest is not consumed\n   * by user, they will need to manually call `destroy()` when zeroing is necessary.\n   */\n  abstract destroy(): void;\n  /**\n   * Clones hash instance. Unsafe: doesn't check whether `to` is valid. Can be used as `clone()`\n   * when no options are passed.\n   * Reasons to use `_cloneInto` instead of clone: 1) performance 2) reuse instance => all internal\n   * buffers are overwritten => causes buffer overwrite which is used for digest in some cases.\n   * There are no guarantees for clean-up because it's impossible in JS.\n   */\n  abstract _cloneInto(to?: T): T;\n  // Safe version that clones internal state\n  abstract clone(): T;\n}\n\n/**\n * XOF: streaming API to read digest in chunks.\n * Same as 'squeeze' in keccak/k12 and 'seek' in blake3, but more generic name.\n * When hash used in XOF mode it is up to user to call '.destroy' afterwards, since we cannot\n * destroy state, next call can require more bytes.\n */\nexport type HashXOF<T extends Hash<T>> = Hash<T> & {\n  xof(bytes: number): Uint8Array; // Read 'bytes' bytes from digest stream\n  xofInto(buf: Uint8Array): Uint8Array; // read buf.length bytes from digest stream into buf\n};\n\n/** Hash function */\nexport type CHash = ReturnType<typeof createHasher>;\n/** Hash function with output */\nexport type CHashO = ReturnType<typeof createOptHasher>;\n/** XOF with output */\nexport type CHashXO = ReturnType<typeof createXOFer>;\n\n/** Wraps hash function, creating an interface on top of it */\nexport function createHasher<T extends Hash<T>>(\n  hashCons: () => Hash<T>\n): {\n  (msg: Input): Uint8Array;\n  outputLen: number;\n  blockLen: number;\n  create(): Hash<T>;\n} {\n  const hashC = (msg: Input): Uint8Array => hashCons().update(toBytes(msg)).digest();\n  const tmp = hashCons();\n  hashC.outputLen = tmp.outputLen;\n  hashC.blockLen = tmp.blockLen;\n  hashC.create = () => hashCons();\n  return hashC;\n}\n\nexport function createOptHasher<H extends Hash<H>, T extends Object>(\n  hashCons: (opts?: T) => Hash<H>\n): {\n  (msg: Input, opts?: T): Uint8Array;\n  outputLen: number;\n  blockLen: number;\n  create(opts?: T): Hash<H>;\n} {\n  const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n  const tmp = hashCons({} as T);\n  hashC.outputLen = tmp.outputLen;\n  hashC.blockLen = tmp.blockLen;\n  hashC.create = (opts?: T) => hashCons(opts);\n  return hashC;\n}\n\nexport function createXOFer<H extends HashXOF<H>, T extends Object>(\n  hashCons: (opts?: T) => HashXOF<H>\n): {\n  (msg: Input, opts?: T): Uint8Array;\n  outputLen: number;\n  blockLen: number;\n  create(opts?: T): HashXOF<H>;\n} {\n  const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n  const tmp = hashCons({} as T);\n  hashC.outputLen = tmp.outputLen;\n  hashC.blockLen = tmp.blockLen;\n  hashC.create = (opts?: T) => hashCons(opts);\n  return hashC;\n}\nexport const wrapConstructor: typeof createHasher = createHasher;\nexport const wrapConstructorWithOpts: typeof createOptHasher = createOptHasher;\nexport const wrapXOFConstructorWithOpts: typeof createXOFer = createXOFer;\n\n/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */\nexport function randomBytes(bytesLength = 32): Uint8Array {\n  if (crypto && typeof crypto.getRandomValues === 'function') {\n    return crypto.getRandomValues(new Uint8Array(bytesLength));\n  }\n  // Legacy Node.js compatibility\n  if (crypto && typeof crypto.randomBytes === 'function') {\n    return Uint8Array.from(crypto.randomBytes(bytesLength));\n  }\n  throw new Error('crypto.getRandomValues must be defined');\n}\n", "/**\n * Internal Merkle-Damgard hash utils.\n * @module\n */\nimport { type Input, Hash, abytes, aexists, aoutput, clean, createView, toBytes } from './utils.ts';\n\n/** Polyfill for Safari 14. https://caniuse.com/mdn-javascript_builtins_dataview_setbiguint64 */\nexport function setBigUint64(\n  view: DataView,\n  byteOffset: number,\n  value: bigint,\n  isLE: boolean\n): void {\n  if (typeof view.setBigUint64 === 'function') return view.setBigUint64(byteOffset, value, isLE);\n  const _32n = BigInt(32);\n  const _u32_max = BigInt(0xffffffff);\n  const wh = Number((value >> _32n) & _u32_max);\n  const wl = Number(value & _u32_max);\n  const h = isLE ? 4 : 0;\n  const l = isLE ? 0 : 4;\n  view.setUint32(byteOffset + h, wh, isLE);\n  view.setUint32(byteOffset + l, wl, isLE);\n}\n\n/** Choice: a ? b : c */\nexport function Chi(a: number, b: number, c: number): number {\n  return (a & b) ^ (~a & c);\n}\n\n/** Majority function, true if any two inputs is true. */\nexport function Maj(a: number, b: number, c: number): number {\n  return (a & b) ^ (a & c) ^ (b & c);\n}\n\n/**\n * Merkle-Damgard hash construction base class.\n * Could be used to create MD5, RIPEMD, SHA1, SHA2.\n */\nexport abstract class HashMD<T extends HashMD<T>> extends Hash<T> {\n  protected abstract process(buf: DataView, offset: number): void;\n  protected abstract get(): number[];\n  protected abstract set(...args: number[]): void;\n  abstract destroy(): void;\n  protected abstract roundClean(): void;\n\n  readonly blockLen: number;\n  readonly outputLen: number;\n  readonly padOffset: number;\n  readonly isLE: boolean;\n\n  // For partial updates less than block size\n  protected buffer: Uint8Array;\n  protected view: DataView;\n  protected finished = false;\n  protected length = 0;\n  protected pos = 0;\n  protected destroyed = false;\n\n  constructor(blockLen: number, outputLen: number, padOffset: number, isLE: boolean) {\n    super();\n    this.blockLen = blockLen;\n    this.outputLen = outputLen;\n    this.padOffset = padOffset;\n    this.isLE = isLE;\n    this.buffer = new Uint8Array(blockLen);\n    this.view = createView(this.buffer);\n  }\n  update(data: Input): this {\n    aexists(this);\n    data = toBytes(data);\n    abytes(data);\n    const { view, buffer, blockLen } = this;\n    const len = data.length;\n    for (let pos = 0; pos < len; ) {\n      const take = Math.min(blockLen - this.pos, len - pos);\n      // Fast path: we have at least one block in input, cast it to view and process\n      if (take === blockLen) {\n        const dataView = createView(data);\n        for (; blockLen <= len - pos; pos += blockLen) this.process(dataView, pos);\n        continue;\n      }\n      buffer.set(data.subarray(pos, pos + take), this.pos);\n      this.pos += take;\n      pos += take;\n      if (this.pos === blockLen) {\n        this.process(view, 0);\n        this.pos = 0;\n      }\n    }\n    this.length += data.length;\n    this.roundClean();\n    return this;\n  }\n  digestInto(out: Uint8Array): void {\n    aexists(this);\n    aoutput(out, this);\n    this.finished = true;\n    // Padding\n    // We can avoid allocation of buffer for padding completely if it\n    // was previously not allocated here. But it won't change performance.\n    const { buffer, view, blockLen, isLE } = this;\n    let { pos } = this;\n    // append the bit '1' to the message\n    buffer[pos++] = 0b10000000;\n    clean(this.buffer.subarray(pos));\n    // we have less than padOffset left in buffer, so we cannot put length in\n    // current block, need process it and pad again\n    if (this.padOffset > blockLen - pos) {\n      this.process(view, 0);\n      pos = 0;\n    }\n    // Pad until full block byte with zeros\n    for (let i = pos; i < blockLen; i++) buffer[i] = 0;\n    // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n    // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n    // So we just write lowest 64 bits of that value.\n    setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);\n    this.process(view, 0);\n    const oview = createView(out);\n    const len = this.outputLen;\n    // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT\n    if (len % 4) throw new Error('_sha2: outputLen should be aligned to 32bit');\n    const outLen = len / 4;\n    const state = this.get();\n    if (outLen > state.length) throw new Error('_sha2: outputLen bigger than state');\n    for (let i = 0; i < outLen; i++) oview.setUint32(4 * i, state[i], isLE);\n  }\n  digest(): Uint8Array {\n    const { buffer, outputLen } = this;\n    this.digestInto(buffer);\n    const res = buffer.slice(0, outputLen);\n    this.destroy();\n    return res;\n  }\n  _cloneInto(to?: T): T {\n    to ||= new (this.constructor as any)() as T;\n    to.set(...this.get());\n    const { blockLen, buffer, length, finished, destroyed, pos } = this;\n    to.destroyed = destroyed;\n    to.finished = finished;\n    to.length = length;\n    to.pos = pos;\n    if (length % blockLen) to.buffer.set(buffer);\n    return to;\n  }\n  clone(): T {\n    return this._cloneInto();\n  }\n}\n\n/**\n * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.\n * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.\n */\n\n/** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */\nexport const SHA256_IV: Uint32Array = /* @__PURE__ */ Uint32Array.from([\n  0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,\n]);\n\n/** Initial SHA224 state. Bits 32..64 of frac part of sqrt of primes 23..53 */\nexport const SHA224_IV: Uint32Array = /* @__PURE__ */ Uint32Array.from([\n  0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4,\n]);\n\n/** Initial SHA384 state. Bits 0..64 of frac part of sqrt of primes 23..53 */\nexport const SHA384_IV: Uint32Array = /* @__PURE__ */ Uint32Array.from([\n  0xcbbb9d5d, 0xc1059ed8, 0x629a292a, 0x367cd507, 0x9159015a, 0x3070dd17, 0x152fecd8, 0xf70e5939,\n  0x67332667, 0xffc00b31, 0x8eb44a87, 0x68581511, 0xdb0c2e0d, 0x64f98fa7, 0x47b5481d, 0xbefa4fa4,\n]);\n\n/** Initial SHA512 state. Bits 0..64 of frac part of sqrt of primes 2..19 */\nexport const SHA512_IV: Uint32Array = /* @__PURE__ */ Uint32Array.from([\n  0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1,\n  0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179,\n]);\n", "/**\n * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.\n * SHA256 is the fastest hash implementable in JS, even faster than Blake3.\n * Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and\n * [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).\n * @module\n */\nimport { Chi, HashMD, Maj, SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from './_md.ts';\nimport * as u64 from './_u64.ts';\nimport { type CHash, clean, createHasher, rotr } from './utils.ts';\n\n/**\n * Round constants:\n * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)\n */\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ Uint32Array.from([\n  0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n  0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n  0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n  0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n  0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n  0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n  0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n  0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n\n/** Reusable temporary buffer. \"W\" comes straight from spec. */\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\nexport class SHA256 extends HashMD<SHA256> {\n  // We cannot use array here since array allows indexing by variable\n  // which means optimizer/compiler cannot use registers.\n  protected A: number = SHA256_IV[0] | 0;\n  protected B: number = SHA256_IV[1] | 0;\n  protected C: number = SHA256_IV[2] | 0;\n  protected D: number = SHA256_IV[3] | 0;\n  protected E: number = SHA256_IV[4] | 0;\n  protected F: number = SHA256_IV[5] | 0;\n  protected G: number = SHA256_IV[6] | 0;\n  protected H: number = SHA256_IV[7] | 0;\n\n  constructor(outputLen: number = 32) {\n    super(64, outputLen, 8, false);\n  }\n  protected get(): [number, number, number, number, number, number, number, number] {\n    const { A, B, C, D, E, F, G, H } = this;\n    return [A, B, C, D, E, F, G, H];\n  }\n  // prettier-ignore\n  protected set(\n    A: number, B: number, C: number, D: number, E: number, F: number, G: number, H: number\n  ): void {\n    this.A = A | 0;\n    this.B = B | 0;\n    this.C = C | 0;\n    this.D = D | 0;\n    this.E = E | 0;\n    this.F = F | 0;\n    this.G = G | 0;\n    this.H = H | 0;\n  }\n  protected process(view: DataView, offset: number): void {\n    // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n    for (let i = 0; i < 16; i++, offset += 4) SHA256_W[i] = view.getUint32(offset, false);\n    for (let i = 16; i < 64; i++) {\n      const W15 = SHA256_W[i - 15];\n      const W2 = SHA256_W[i - 2];\n      const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n      const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n      SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n    }\n    // Compression function main loop, 64 rounds\n    let { A, B, C, D, E, F, G, H } = this;\n    for (let i = 0; i < 64; i++) {\n      const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n      const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n      const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n      const T2 = (sigma0 + Maj(A, B, C)) | 0;\n      H = G;\n      G = F;\n      F = E;\n      E = (D + T1) | 0;\n      D = C;\n      C = B;\n      B = A;\n      A = (T1 + T2) | 0;\n    }\n    // Add the compressed chunk to the current hash value\n    A = (A + this.A) | 0;\n    B = (B + this.B) | 0;\n    C = (C + this.C) | 0;\n    D = (D + this.D) | 0;\n    E = (E + this.E) | 0;\n    F = (F + this.F) | 0;\n    G = (G + this.G) | 0;\n    H = (H + this.H) | 0;\n    this.set(A, B, C, D, E, F, G, H);\n  }\n  protected roundClean(): void {\n    clean(SHA256_W);\n  }\n  destroy(): void {\n    this.set(0, 0, 0, 0, 0, 0, 0, 0);\n    clean(this.buffer);\n  }\n}\n\nexport class SHA224 extends SHA256 {\n  protected A: number = SHA224_IV[0] | 0;\n  protected B: number = SHA224_IV[1] | 0;\n  protected C: number = SHA224_IV[2] | 0;\n  protected D: number = SHA224_IV[3] | 0;\n  protected E: number = SHA224_IV[4] | 0;\n  protected F: number = SHA224_IV[5] | 0;\n  protected G: number = SHA224_IV[6] | 0;\n  protected H: number = SHA224_IV[7] | 0;\n  constructor() {\n    super(28);\n  }\n}\n\n// SHA2-512 is slower than sha256 in js because u64 operations are slow.\n\n// Round contants\n// First 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409\n// prettier-ignore\nconst K512 = /* @__PURE__ */ (() => u64.split([\n  '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n  '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n  '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n  '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n  '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n  '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n  '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n  '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n  '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n  '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n  '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n  '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n  '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n  '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n  '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n  '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n  '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n  '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n  '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n  '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n))))();\nconst SHA512_Kh = /* @__PURE__ */ (() => K512[0])();\nconst SHA512_Kl = /* @__PURE__ */ (() => K512[1])();\n\n// Reusable temporary buffers\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\n\nexport class SHA512 extends HashMD<SHA512> {\n  // We cannot use array here since array allows indexing by variable\n  // which means optimizer/compiler cannot use registers.\n  // h -- high 32 bits, l -- low 32 bits\n  protected Ah: number = SHA512_IV[0] | 0;\n  protected Al: number = SHA512_IV[1] | 0;\n  protected Bh: number = SHA512_IV[2] | 0;\n  protected Bl: number = SHA512_IV[3] | 0;\n  protected Ch: number = SHA512_IV[4] | 0;\n  protected Cl: number = SHA512_IV[5] | 0;\n  protected Dh: number = SHA512_IV[6] | 0;\n  protected Dl: number = SHA512_IV[7] | 0;\n  protected Eh: number = SHA512_IV[8] | 0;\n  protected El: number = SHA512_IV[9] | 0;\n  protected Fh: number = SHA512_IV[10] | 0;\n  protected Fl: number = SHA512_IV[11] | 0;\n  protected Gh: number = SHA512_IV[12] | 0;\n  protected Gl: number = SHA512_IV[13] | 0;\n  protected Hh: number = SHA512_IV[14] | 0;\n  protected Hl: number = SHA512_IV[15] | 0;\n\n  constructor(outputLen: number = 64) {\n    super(128, outputLen, 16, false);\n  }\n  // prettier-ignore\n  protected get(): [\n    number, number, number, number, number, number, number, number,\n    number, number, number, number, number, number, number, number\n  ] {\n    const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n    return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n  }\n  // prettier-ignore\n  protected set(\n    Ah: number, Al: number, Bh: number, Bl: number, Ch: number, Cl: number, Dh: number, Dl: number,\n    Eh: number, El: number, Fh: number, Fl: number, Gh: number, Gl: number, Hh: number, Hl: number\n  ): void {\n    this.Ah = Ah | 0;\n    this.Al = Al | 0;\n    this.Bh = Bh | 0;\n    this.Bl = Bl | 0;\n    this.Ch = Ch | 0;\n    this.Cl = Cl | 0;\n    this.Dh = Dh | 0;\n    this.Dl = Dl | 0;\n    this.Eh = Eh | 0;\n    this.El = El | 0;\n    this.Fh = Fh | 0;\n    this.Fl = Fl | 0;\n    this.Gh = Gh | 0;\n    this.Gl = Gl | 0;\n    this.Hh = Hh | 0;\n    this.Hl = Hl | 0;\n  }\n  protected process(view: DataView, offset: number): void {\n    // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n    for (let i = 0; i < 16; i++, offset += 4) {\n      SHA512_W_H[i] = view.getUint32(offset);\n      SHA512_W_L[i] = view.getUint32((offset += 4));\n    }\n    for (let i = 16; i < 80; i++) {\n      // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n      const W15h = SHA512_W_H[i - 15] | 0;\n      const W15l = SHA512_W_L[i - 15] | 0;\n      const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);\n      const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);\n      // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n      const W2h = SHA512_W_H[i - 2] | 0;\n      const W2l = SHA512_W_L[i - 2] | 0;\n      const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);\n      const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);\n      // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];\n      const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n      const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n      SHA512_W_H[i] = SUMh | 0;\n      SHA512_W_L[i] = SUMl | 0;\n    }\n    let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n    // Compression function main loop, 80 rounds\n    for (let i = 0; i < 80; i++) {\n      // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n      const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);\n      const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);\n      //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n      const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n      const CHIl = (El & Fl) ^ (~El & Gl);\n      // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n      // prettier-ignore\n      const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n      const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n      const T1l = T1ll | 0;\n      // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n      const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);\n      const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);\n      const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n      const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n      Hh = Gh | 0;\n      Hl = Gl | 0;\n      Gh = Fh | 0;\n      Gl = Fl | 0;\n      Fh = Eh | 0;\n      Fl = El | 0;\n      ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n      Dh = Ch | 0;\n      Dl = Cl | 0;\n      Ch = Bh | 0;\n      Cl = Bl | 0;\n      Bh = Ah | 0;\n      Bl = Al | 0;\n      const All = u64.add3L(T1l, sigma0l, MAJl);\n      Ah = u64.add3H(All, T1h, sigma0h, MAJh);\n      Al = All | 0;\n    }\n    // Add the compressed chunk to the current hash value\n    ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n    ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n    ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n    ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n    ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n    ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n    ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n    ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n    this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n  }\n  protected roundClean(): void {\n    clean(SHA512_W_H, SHA512_W_L);\n  }\n  destroy(): void {\n    clean(this.buffer);\n    this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n  }\n}\n\nexport class SHA384 extends SHA512 {\n  protected Ah: number = SHA384_IV[0] | 0;\n  protected Al: number = SHA384_IV[1] | 0;\n  protected Bh: number = SHA384_IV[2] | 0;\n  protected Bl: number = SHA384_IV[3] | 0;\n  protected Ch: number = SHA384_IV[4] | 0;\n  protected Cl: number = SHA384_IV[5] | 0;\n  protected Dh: number = SHA384_IV[6] | 0;\n  protected Dl: number = SHA384_IV[7] | 0;\n  protected Eh: number = SHA384_IV[8] | 0;\n  protected El: number = SHA384_IV[9] | 0;\n  protected Fh: number = SHA384_IV[10] | 0;\n  protected Fl: number = SHA384_IV[11] | 0;\n  protected Gh: number = SHA384_IV[12] | 0;\n  protected Gl: number = SHA384_IV[13] | 0;\n  protected Hh: number = SHA384_IV[14] | 0;\n  protected Hl: number = SHA384_IV[15] | 0;\n\n  constructor() {\n    super(48);\n  }\n}\n\n/**\n * Truncated SHA512/256 and SHA512/224.\n * SHA512_IV is XORed with 0xa5a5a5a5a5a5a5a5, then used as \"intermediary\" IV of SHA512/t.\n * Then t hashes string to produce result IV.\n * See `test/misc/sha2-gen-iv.js`.\n */\n\n/** SHA512/224 IV */\nconst T224_IV = /* @__PURE__ */ Uint32Array.from([\n  0x8c3d37c8, 0x19544da2, 0x73e19966, 0x89dcd4d6, 0x1dfab7ae, 0x32ff9c82, 0x679dd514, 0x582f9fcf,\n  0x0f6d2b69, 0x7bd44da8, 0x77e36f73, 0x04c48942, 0x3f9d85a8, 0x6a1d36c8, 0x1112e6ad, 0x91d692a1,\n]);\n\n/** SHA512/256 IV */\nconst T256_IV = /* @__PURE__ */ Uint32Array.from([\n  0x22312194, 0xfc2bf72c, 0x9f555fa3, 0xc84c64c2, 0x2393b86b, 0x6f53b151, 0x96387719, 0x5940eabd,\n  0x96283ee2, 0xa88effe3, 0xbe5e1e25, 0x53863992, 0x2b0199fc, 0x2c85b8aa, 0x0eb72ddc, 0x81c52ca2,\n]);\n\nexport class SHA512_224 extends SHA512 {\n  protected Ah: number = T224_IV[0] | 0;\n  protected Al: number = T224_IV[1] | 0;\n  protected Bh: number = T224_IV[2] | 0;\n  protected Bl: number = T224_IV[3] | 0;\n  protected Ch: number = T224_IV[4] | 0;\n  protected Cl: number = T224_IV[5] | 0;\n  protected Dh: number = T224_IV[6] | 0;\n  protected Dl: number = T224_IV[7] | 0;\n  protected Eh: number = T224_IV[8] | 0;\n  protected El: number = T224_IV[9] | 0;\n  protected Fh: number = T224_IV[10] | 0;\n  protected Fl: number = T224_IV[11] | 0;\n  protected Gh: number = T224_IV[12] | 0;\n  protected Gl: number = T224_IV[13] | 0;\n  protected Hh: number = T224_IV[14] | 0;\n  protected Hl: number = T224_IV[15] | 0;\n\n  constructor() {\n    super(28);\n  }\n}\n\nexport class SHA512_256 extends SHA512 {\n  protected Ah: number = T256_IV[0] | 0;\n  protected Al: number = T256_IV[1] | 0;\n  protected Bh: number = T256_IV[2] | 0;\n  protected Bl: number = T256_IV[3] | 0;\n  protected Ch: number = T256_IV[4] | 0;\n  protected Cl: number = T256_IV[5] | 0;\n  protected Dh: number = T256_IV[6] | 0;\n  protected Dl: number = T256_IV[7] | 0;\n  protected Eh: number = T256_IV[8] | 0;\n  protected El: number = T256_IV[9] | 0;\n  protected Fh: number = T256_IV[10] | 0;\n  protected Fl: number = T256_IV[11] | 0;\n  protected Gh: number = T256_IV[12] | 0;\n  protected Gl: number = T256_IV[13] | 0;\n  protected Hh: number = T256_IV[14] | 0;\n  protected Hl: number = T256_IV[15] | 0;\n\n  constructor() {\n    super(32);\n  }\n}\n\n/**\n * SHA2-256 hash function from RFC 4634.\n *\n * It is the fastest JS hash, even faster than Blake3.\n * To break sha256 using birthday attack, attackers need to try 2^128 hashes.\n * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.\n */\nexport const sha256: CHash = /* @__PURE__ */ createHasher(() => new SHA256());\n/** SHA2-224 hash function from RFC 4634 */\nexport const sha224: CHash = /* @__PURE__ */ createHasher(() => new SHA224());\n\n/** SHA2-512 hash function from RFC 4634. */\nexport const sha512: CHash = /* @__PURE__ */ createHasher(() => new SHA512());\n/** SHA2-384 hash function from RFC 4634. */\nexport const sha384: CHash = /* @__PURE__ */ createHasher(() => new SHA384());\n\n/**\n * SHA2-512/256 \"truncated\" hash function, with improved resistance to length extension attacks.\n * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).\n */\nexport const sha512_256: CHash = /* @__PURE__ */ createHasher(() => new SHA512_256());\n/**\n * SHA2-512/224 \"truncated\" hash function, with improved resistance to length extension attacks.\n * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).\n */\nexport const sha512_224: CHash = /* @__PURE__ */ createHasher(() => new SHA512_224());\n", "import {\n  arrayOfNumberToUint8Array,\n  isNullish,\n  toNullable,\n} from \"@dfinity/utils\";\nimport type {\n  TransferArg as Icrc1TransferRawRequest,\n  icrc21_consent_message_request as Icrc21ConsentMessageRawRequest,\n  ApproveArgs as Icrc2ApproveRawRequest,\n  Tokens,\n  TransferArgs as TransferRawRequest,\n} from \"../../candid/ledger\";\nimport { TRANSACTION_FEE } from \"../../constants/constants\";\nimport type {\n  Icrc1TransferRequest,\n  Icrc21ConsentMessageRequest,\n  Icrc2ApproveRequest,\n  TransferRequest,\n} from \"../../types/ledger_converters\";\n\nconst e8sToTokens = (e8s: bigint): Tokens => ({ e8s });\n\nexport const toTransferRawRequest = ({\n  to,\n  amount,\n  memo,\n  fee,\n  fromSubAccount,\n  createdAt,\n}: TransferRequest): TransferRawRequest => ({\n  to: to.toUint8Array(),\n  fee: e8sToTokens(fee ?? TRANSACTION_FEE),\n  amount: e8sToTokens(amount),\n  // Always explicitly set the memo for compatibility with ledger wallet - hardware wallet\n  memo: memo ?? BigInt(0),\n  created_at_time:\n    createdAt !== undefined ? [{ timestamp_nanos: createdAt }] : [],\n  from_subaccount:\n    fromSubAccount === undefined\n      ? []\n      : [arrayOfNumberToUint8Array(fromSubAccount)],\n});\n\n// WARNING: When using the ICRC-1 interface of the ICP ledger, there is no\n// relationship between the memo and the icrc1Memo of a transaction. The ICRC-1\n// interface simply cannot set the memo field and the non-ICRC-1 interface\n// cannot set the icrc1Memo field, even though the icrc1Memo field is called\n// just \"memo\" in canister method params.\nexport const toIcrc1TransferRawRequest = ({\n  fromSubAccount,\n  to,\n  amount,\n  fee,\n  icrc1Memo,\n  createdAt,\n}: Icrc1TransferRequest): Icrc1TransferRawRequest => ({\n  to,\n  fee: toNullable(fee ?? TRANSACTION_FEE),\n  amount,\n  memo: toNullable(icrc1Memo),\n  created_at_time: toNullable(createdAt),\n  from_subaccount: toNullable(fromSubAccount),\n});\n\nexport const toIcrc2ApproveRawRequest = ({\n  fee,\n  createdAt,\n  icrc1Memo,\n  fromSubAccount,\n  expected_allowance,\n  expires_at,\n  amount,\n  ...rest\n}: Icrc2ApproveRequest): Icrc2ApproveRawRequest => ({\n  ...rest,\n  fee: toNullable(fee ?? TRANSACTION_FEE),\n  memo: toNullable(icrc1Memo),\n  from_subaccount: toNullable(fromSubAccount),\n  created_at_time: toNullable(createdAt),\n  amount,\n  expected_allowance: toNullable(expected_allowance),\n  expires_at: toNullable(expires_at),\n});\n\nexport const toIcrc21ConsentMessageRawRequest = ({\n  userPreferences: {\n    metadata: { utcOffsetMinutes, language },\n    deriveSpec,\n  },\n  ...rest\n}: Icrc21ConsentMessageRequest): Icrc21ConsentMessageRawRequest => ({\n  ...rest,\n  user_preferences: {\n    metadata: {\n      language,\n      utc_offset_minutes: toNullable(utcOffsetMinutes),\n    },\n    device_spec: isNullish(deriveSpec)\n      ? toNullable()\n      : toNullable(\n          \"GenericDisplay\" in deriveSpec\n            ? { GenericDisplay: null }\n            : {\n                FieldsDisplay: null,\n              },\n        ),\n  },\n});\n", "export const SUB_ACCOUNT_BYTE_LENGTH = 32;\nexport const CREATE_CANISTER_MEMO = BigInt(0x41455243); // CREA,\nexport const TOP_UP_CANISTER_MEMO = BigInt(0x50555054); // TPUP\n\nexport const TRANSACTION_FEE = BigInt(10_000);\n\n// Note:  Canister IDs are not constant, so are not provided here.\n//        The same applies to HOST.\nexport const E8S_PER_TOKEN = BigInt(100000000);\n", "import type {\n  Icrc1BlockIndex,\n  Icrc1Tokens,\n  icrc21_error as Icrc21RawError,\n  ApproveError as RawApproveError,\n  Icrc1TransferError as RawIcrc1TransferError,\n  TransferError as RawTransferError,\n} from \"../candid/ledger\";\nimport type { BlockHeight } from \"../types/common\";\n\nexport class IcrcError extends Error {}\n\nexport class TransferError extends IcrcError {}\nexport class ApproveError extends IcrcError {}\nexport class ConsentMessageError extends IcrcError {}\n\nexport class InvalidSenderError extends TransferError {}\n\nexport class InvalidAccountIDError extends Error {}\n\nexport class InsufficientFundsError extends TransferError {\n  constructor(public readonly balance: bigint) {\n    super();\n  }\n}\n\nexport class TxTooOldError extends TransferError {\n  constructor(public readonly allowed_window_secs?: number | undefined) {\n    super();\n  }\n}\n\nexport class TxCreatedInFutureError extends TransferError {}\n\nexport class TxDuplicateError extends TransferError {\n  constructor(public readonly duplicateOf: BlockHeight) {\n    super();\n  }\n}\n\nexport class BadFeeError extends IcrcError {\n  constructor(public readonly expectedFee: bigint) {\n    super();\n  }\n}\n\nexport class GenericError extends ApproveError {\n  constructor(\n    public readonly message: string,\n    public readonly error_code: bigint,\n  ) {\n    super();\n  }\n}\n\nexport class TemporarilyUnavailableError extends ApproveError {}\n\nexport class DuplicateError extends ApproveError {\n  constructor(public readonly duplicateOf: Icrc1BlockIndex) {\n    super();\n  }\n}\n\nexport class AllowanceChangedError extends ApproveError {\n  constructor(public readonly currentAllowance: Icrc1Tokens) {\n    super();\n  }\n}\n\nexport class CreatedInFutureError extends ApproveError {}\nexport class TooOldError extends ApproveError {}\n\nexport class ExpiredError extends ApproveError {\n  constructor(public readonly ledgerTime: bigint) {\n    super();\n  }\n}\n\nexport class InsufficientPaymentError extends ConsentMessageError {}\nexport class UnsupportedCanisterCallError extends ConsentMessageError {}\nexport class ConsentMessageUnavailableError extends ConsentMessageError {}\n\nexport const mapTransferError = (\n  rawTransferError: RawTransferError,\n): TransferError => {\n  if (\"TxDuplicate\" in rawTransferError) {\n    return new TxDuplicateError(rawTransferError.TxDuplicate.duplicate_of);\n  }\n  if (\"InsufficientFunds\" in rawTransferError) {\n    return new InsufficientFundsError(\n      rawTransferError.InsufficientFunds.balance.e8s,\n    );\n  }\n  if (\"TxCreatedInFuture\" in rawTransferError) {\n    return new TxCreatedInFutureError();\n  }\n  if (\"TxTooOld\" in rawTransferError) {\n    return new TxTooOldError(\n      Number(rawTransferError.TxTooOld.allowed_window_nanos),\n    );\n  }\n  if (\"BadFee\" in rawTransferError) {\n    return new BadFeeError(rawTransferError.BadFee.expected_fee.e8s);\n  }\n  // Edge case\n  return new TransferError(\n    `Unknown error type ${JSON.stringify(rawTransferError)}`,\n  );\n};\n\nexport const mapIcrc1TransferError = (\n  rawTransferError: RawIcrc1TransferError,\n): TransferError => {\n  if (\"Duplicate\" in rawTransferError) {\n    return new TxDuplicateError(rawTransferError.Duplicate.duplicate_of);\n  }\n  if (\"InsufficientFunds\" in rawTransferError) {\n    return new InsufficientFundsError(\n      rawTransferError.InsufficientFunds.balance,\n    );\n  }\n  if (\"CreatedInFuture\" in rawTransferError) {\n    return new TxCreatedInFutureError();\n  }\n  if (\"TooOld\" in rawTransferError) {\n    return new TxTooOldError();\n  }\n  if (\"BadFee\" in rawTransferError) {\n    return new BadFeeError(rawTransferError.BadFee.expected_fee);\n  }\n  // Edge case\n  return new TransferError(\n    `Unknown error type ${JSON.stringify(rawTransferError)}`,\n  );\n};\n\nexport const mapIcrc2ApproveError = (\n  rawApproveError: RawApproveError,\n): ApproveError => {\n  /**\n   * export type ApproveError =\n   *   | { InsufficientFunds: { balance: Icrc1Tokens } };\n   */\n\n  if (\"GenericError\" in rawApproveError) {\n    return new GenericError(\n      rawApproveError.GenericError.message,\n      rawApproveError.GenericError.error_code,\n    );\n  }\n\n  if (\"TemporarilyUnavailable\" in rawApproveError) {\n    return new TemporarilyUnavailableError();\n  }\n\n  if (\"Duplicate\" in rawApproveError) {\n    return new DuplicateError(rawApproveError.Duplicate.duplicate_of);\n  }\n\n  if (\"BadFee\" in rawApproveError) {\n    return new BadFeeError(rawApproveError.BadFee.expected_fee);\n  }\n\n  if (\"AllowanceChanged\" in rawApproveError) {\n    return new AllowanceChangedError(\n      rawApproveError.AllowanceChanged.current_allowance,\n    );\n  }\n\n  if (\"CreatedInFuture\" in rawApproveError) {\n    return new CreatedInFutureError();\n  }\n\n  if (\"TooOld\" in rawApproveError) {\n    return new TooOldError();\n  }\n\n  if (\"Expired\" in rawApproveError) {\n    return new ExpiredError(rawApproveError.Expired.ledger_time);\n  }\n\n  if (\"InsufficientFunds\" in rawApproveError) {\n    return new InsufficientFundsError(\n      rawApproveError.InsufficientFunds.balance,\n    );\n  }\n\n  // Edge case\n  return new ApproveError(\n    `Unknown error type ${JSON.stringify(rawApproveError)}`,\n  );\n};\n\nexport const mapIcrc21ConsentMessageError = (\n  rawError: Icrc21RawError,\n): ConsentMessageError => {\n  if (\"GenericError\" in rawError) {\n    return new GenericError(\n      rawError.GenericError.description,\n      rawError.GenericError.error_code,\n    );\n  }\n\n  if (\"InsufficientPayment\" in rawError) {\n    return new InsufficientPaymentError(\n      rawError.InsufficientPayment.description,\n    );\n  }\n\n  if (\"UnsupportedCanisterCall\" in rawError) {\n    return new UnsupportedCanisterCallError(\n      rawError.UnsupportedCanisterCall.description,\n    );\n  }\n  if (\"ConsentMessageUnavailable\" in rawError) {\n    return new ConsentMessageUnavailableError(\n      rawError.ConsentMessageUnavailable.description,\n    );\n  }\n\n  // Edge case\n  return new ConsentMessageError(\n    `Unknown error type ${JSON.stringify(rawError)}`,\n  );\n};\n", "import {\n  Canister,\n  createServices,\n  toNullable,\n  type CanisterOptions,\n} from \"@dfinity/utils\";\nimport type {\n  GetAccountIdentifierTransactionsResponse,\n  _SERVICE as IndexService,\n} from \"./candid/index\";\nimport { idlFactory as certifiedIdlFactory } from \"./candid/index.certified.idl\";\nimport { idlFactory } from \"./candid/index.idl\";\nimport { MAINNET_INDEX_CANISTER_ID } from \"./constants/canister_ids\";\nimport { IndexError } from \"./errors/index.errors\";\nimport type { GetTransactionsParams } from \"./types/index.params\";\nimport type { AccountBalanceParams } from \"./types/ledger.params\";\nimport { paramToAccountIdentifierHex } from \"./utils/params.utils\";\n\nexport class IndexCanister extends Canister<IndexService> {\n  static create({\n    canisterId: optionsCanisterId,\n    ...options\n  }: CanisterOptions<IndexService>) {\n    const { service, certifiedService, canisterId } =\n      createServices<IndexService>({\n        options: {\n          ...options,\n          canisterId: optionsCanisterId ?? MAINNET_INDEX_CANISTER_ID,\n        },\n        idlFactory,\n        certifiedIdlFactory,\n      });\n\n    return new IndexCanister(canisterId, service, certifiedService);\n  }\n\n  /**\n   * Returns the balance of the specified account identifier.\n   *\n   * @param {AccountBalanceParams} params The parameters to get the balance of an account.\n   * @param {AccountIdentifierParam} params.accountIdentifier The account identifier provided either as hex string or as an AccountIdentifier.\n   * @param {boolean} params.certified query or update call.\n   * @returns {Promise<bigint>} The balance of the given account.\n   */\n  accountBalance = ({\n    certified,\n    accountIdentifier,\n  }: AccountBalanceParams): Promise<bigint> =>\n    this.caller({ certified }).get_account_identifier_balance(\n      paramToAccountIdentifierHex(accountIdentifier),\n    );\n\n  /**\n   * Returns the transactions and balance of an ICP account.\n   *\n   * @param {GetTransactionsParams} params The parameters to get the transactions.\n   * @param {boolean} params.certified query or update call.\n   * @param {AccountIdentifierParam} params.accountIdentifier The account identifier provided either as hex string or as an AccountIdentifier.\n   * @param {bigint} params.start If set then the results will start from the next most recent transaction id after start (start won't be included). If not provided, then the results will start from the most recent transaction id.\n   * @param {bigint} params.maxResults Maximum number of transactions to fetch.\n   * @returns {Promise<GetAccountIdentifierTransactionsResponse>} The transactions, balance and the transaction id of the oldest transaction the account has.\n   * @throws {@link IndexError}\n   */\n  getTransactions = async ({\n    certified,\n    accountIdentifier,\n    start,\n    maxResults: max_results,\n  }: GetTransactionsParams): Promise<GetAccountIdentifierTransactionsResponse> => {\n    const response = await this.caller({\n      certified,\n    }).get_account_identifier_transactions({\n      account_identifier: paramToAccountIdentifierHex(accountIdentifier),\n      start: toNullable(start),\n      max_results,\n    });\n\n    if (\"Err\" in response) {\n      throw new IndexError(response.Err.message);\n    }\n\n    return response.Ok;\n  };\n}\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n  const InitArg = IDL.Record({ ledger_id: IDL.Principal });\n  const GetAccountIdentifierTransactionsArgs = IDL.Record({\n    max_results: IDL.Nat64,\n    start: IDL.Opt(IDL.Nat64),\n    account_identifier: IDL.Text,\n  });\n  const Tokens = IDL.Record({ e8s: IDL.Nat64 });\n  const TimeStamp = IDL.Record({ timestamp_nanos: IDL.Nat64 });\n  const Operation = IDL.Variant({\n    Approve: IDL.Record({\n      fee: Tokens,\n      from: IDL.Text,\n      allowance: Tokens,\n      expected_allowance: IDL.Opt(Tokens),\n      expires_at: IDL.Opt(TimeStamp),\n      spender: IDL.Text,\n    }),\n    Burn: IDL.Record({\n      from: IDL.Text,\n      amount: Tokens,\n      spender: IDL.Opt(IDL.Text),\n    }),\n    Mint: IDL.Record({ to: IDL.Text, amount: Tokens }),\n    Transfer: IDL.Record({\n      to: IDL.Text,\n      fee: Tokens,\n      from: IDL.Text,\n      amount: Tokens,\n      spender: IDL.Opt(IDL.Text),\n    }),\n  });\n  const Transaction = IDL.Record({\n    memo: IDL.Nat64,\n    icrc1_memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    operation: Operation,\n    timestamp: IDL.Opt(TimeStamp),\n    created_at_time: IDL.Opt(TimeStamp),\n  });\n  const TransactionWithId = IDL.Record({\n    id: IDL.Nat64,\n    transaction: Transaction,\n  });\n  const GetAccountIdentifierTransactionsResponse = IDL.Record({\n    balance: IDL.Nat64,\n    transactions: IDL.Vec(TransactionWithId),\n    oldest_tx_id: IDL.Opt(IDL.Nat64),\n  });\n  const GetAccountIdentifierTransactionsError = IDL.Record({\n    message: IDL.Text,\n  });\n  const GetAccountIdentifierTransactionsResult = IDL.Variant({\n    Ok: GetAccountIdentifierTransactionsResponse,\n    Err: GetAccountIdentifierTransactionsError,\n  });\n  const Account = IDL.Record({\n    owner: IDL.Principal,\n    subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),\n  });\n  const GetAccountTransactionsArgs = IDL.Record({\n    max_results: IDL.Nat,\n    start: IDL.Opt(IDL.Nat),\n    account: Account,\n  });\n  const GetBlocksRequest = IDL.Record({\n    start: IDL.Nat,\n    length: IDL.Nat,\n  });\n  const GetBlocksResponse = IDL.Record({\n    blocks: IDL.Vec(IDL.Vec(IDL.Nat8)),\n    chain_length: IDL.Nat64,\n  });\n  const HttpRequest = IDL.Record({\n    url: IDL.Text,\n    method: IDL.Text,\n    body: IDL.Vec(IDL.Nat8),\n    headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),\n  });\n  const HttpResponse = IDL.Record({\n    body: IDL.Vec(IDL.Nat8),\n    headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),\n    status_code: IDL.Nat16,\n  });\n  const Status = IDL.Record({ num_blocks_synced: IDL.Nat64 });\n\n  return IDL.Service({\n    get_account_identifier_balance: IDL.Func([IDL.Text], [IDL.Nat64], []),\n    get_account_identifier_transactions: IDL.Func(\n      [GetAccountIdentifierTransactionsArgs],\n      [GetAccountIdentifierTransactionsResult],\n      [],\n    ),\n    get_account_transactions: IDL.Func(\n      [GetAccountTransactionsArgs],\n      [GetAccountIdentifierTransactionsResult],\n      [],\n    ),\n    get_blocks: IDL.Func([GetBlocksRequest], [GetBlocksResponse], []),\n    http_request: IDL.Func([HttpRequest], [HttpResponse], []),\n    icrc1_balance_of: IDL.Func([Account], [IDL.Nat64], [\"query\"]),\n    ledger_id: IDL.Func([], [IDL.Principal], []),\n    status: IDL.Func([], [Status], []),\n  });\n};\n\nexport const init = ({ IDL }) => {\n  const InitArg = IDL.Record({ ledger_id: IDL.Principal });\n\n  return [InitArg];\n};\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n  const InitArg = IDL.Record({ ledger_id: IDL.Principal });\n  const GetAccountIdentifierTransactionsArgs = IDL.Record({\n    max_results: IDL.Nat64,\n    start: IDL.Opt(IDL.Nat64),\n    account_identifier: IDL.Text,\n  });\n  const Tokens = IDL.Record({ e8s: IDL.Nat64 });\n  const TimeStamp = IDL.Record({ timestamp_nanos: IDL.Nat64 });\n  const Operation = IDL.Variant({\n    Approve: IDL.Record({\n      fee: Tokens,\n      from: IDL.Text,\n      allowance: Tokens,\n      expected_allowance: IDL.Opt(Tokens),\n      expires_at: IDL.Opt(TimeStamp),\n      spender: IDL.Text,\n    }),\n    Burn: IDL.Record({\n      from: IDL.Text,\n      amount: Tokens,\n      spender: IDL.Opt(IDL.Text),\n    }),\n    Mint: IDL.Record({ to: IDL.Text, amount: Tokens }),\n    Transfer: IDL.Record({\n      to: IDL.Text,\n      fee: Tokens,\n      from: IDL.Text,\n      amount: Tokens,\n      spender: IDL.Opt(IDL.Text),\n    }),\n  });\n  const Transaction = IDL.Record({\n    memo: IDL.Nat64,\n    icrc1_memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    operation: Operation,\n    timestamp: IDL.Opt(TimeStamp),\n    created_at_time: IDL.Opt(TimeStamp),\n  });\n  const TransactionWithId = IDL.Record({\n    id: IDL.Nat64,\n    transaction: Transaction,\n  });\n  const GetAccountIdentifierTransactionsResponse = IDL.Record({\n    balance: IDL.Nat64,\n    transactions: IDL.Vec(TransactionWithId),\n    oldest_tx_id: IDL.Opt(IDL.Nat64),\n  });\n  const GetAccountIdentifierTransactionsError = IDL.Record({\n    message: IDL.Text,\n  });\n  const GetAccountIdentifierTransactionsResult = IDL.Variant({\n    Ok: GetAccountIdentifierTransactionsResponse,\n    Err: GetAccountIdentifierTransactionsError,\n  });\n  const Account = IDL.Record({\n    owner: IDL.Principal,\n    subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),\n  });\n  const GetAccountTransactionsArgs = IDL.Record({\n    max_results: IDL.Nat,\n    start: IDL.Opt(IDL.Nat),\n    account: Account,\n  });\n  const GetBlocksRequest = IDL.Record({\n    start: IDL.Nat,\n    length: IDL.Nat,\n  });\n  const GetBlocksResponse = IDL.Record({\n    blocks: IDL.Vec(IDL.Vec(IDL.Nat8)),\n    chain_length: IDL.Nat64,\n  });\n  const HttpRequest = IDL.Record({\n    url: IDL.Text,\n    method: IDL.Text,\n    body: IDL.Vec(IDL.Nat8),\n    headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),\n  });\n  const HttpResponse = IDL.Record({\n    body: IDL.Vec(IDL.Nat8),\n    headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),\n    status_code: IDL.Nat16,\n  });\n  const Status = IDL.Record({ num_blocks_synced: IDL.Nat64 });\n\n  return IDL.Service({\n    get_account_identifier_balance: IDL.Func(\n      [IDL.Text],\n      [IDL.Nat64],\n      [\"query\"],\n    ),\n    get_account_identifier_transactions: IDL.Func(\n      [GetAccountIdentifierTransactionsArgs],\n      [GetAccountIdentifierTransactionsResult],\n      [\"query\"],\n    ),\n    get_account_transactions: IDL.Func(\n      [GetAccountTransactionsArgs],\n      [GetAccountIdentifierTransactionsResult],\n      [\"query\"],\n    ),\n    get_blocks: IDL.Func([GetBlocksRequest], [GetBlocksResponse], [\"query\"]),\n    http_request: IDL.Func([HttpRequest], [HttpResponse], [\"query\"]),\n    icrc1_balance_of: IDL.Func([Account], [IDL.Nat64], [\"query\"]),\n    ledger_id: IDL.Func([], [IDL.Principal], [\"query\"]),\n    status: IDL.Func([], [Status], [\"query\"]),\n  });\n};\n\nexport const init = ({ IDL }) => {\n  const InitArg = IDL.Record({ ledger_id: IDL.Principal });\n\n  return [InitArg];\n};\n", "import { Principal } from \"@icp-sdk/core/principal\";\n\nexport const MAINNET_LEDGER_CANISTER_ID = Principal.fromText(\n  \"ryjl3-tyaaa-aaaaa-aaaba-cai\",\n);\n\nexport const MAINNET_INDEX_CANISTER_ID = Principal.fromText(\n  \"qhbym-qaaaa-aaaaa-aaafq-cai\",\n);\n", "export class IndexError extends Error {}\n", "import { AccountIdentifier } from \"../account_identifier\";\nimport type { AccountIdentifierHex } from \"../types/common\";\nimport type { AccountIdentifierParam } from \"../types/ledger.params\";\n\nexport const paramToAccountIdentifier = (\n  param: AccountIdentifierParam,\n): AccountIdentifier =>\n  param instanceof AccountIdentifier ? param : AccountIdentifier.fromHex(param);\n\nexport const paramToAccountIdentifierHex = (\n  param: AccountIdentifierParam,\n): AccountIdentifierHex =>\n  param instanceof AccountIdentifier ? param.toHex() : param;\n", "import { Canister, createServices, type QueryParams } from \"@dfinity/utils\";\nimport type { Principal } from \"@icp-sdk/core/principal\";\nimport type {\n  Icrc1BlockIndex,\n  _SERVICE as LedgerService,\n  Value,\n  icrc21_consent_info,\n} from \"./candid/ledger\";\nimport { idlFactory as certifiedIdlFactory } from \"./candid/ledger.certified.idl\";\nimport { idlFactory } from \"./candid/ledger.idl\";\nimport {\n  toIcrc1TransferRawRequest,\n  toIcrc21ConsentMessageRawRequest,\n  toIcrc2ApproveRawRequest,\n  toTransferRawRequest,\n} from \"./canisters/ledger/ledger.request.converts\";\nimport { MAINNET_LEDGER_CANISTER_ID } from \"./constants/canister_ids\";\nimport {\n  mapIcrc1TransferError,\n  mapIcrc21ConsentMessageError,\n  mapIcrc2ApproveError,\n  mapTransferError,\n} from \"./errors/ledger.errors\";\nimport type { BlockHeight } from \"./types/common\";\nimport type { LedgerCanisterOptions } from \"./types/ledger.options\";\nimport type { AccountBalanceParams } from \"./types/ledger.params\";\nimport type {\n  Icrc1TransferRequest,\n  Icrc21ConsentMessageRequest,\n  Icrc2ApproveRequest,\n  TransferRequest,\n} from \"./types/ledger_converters\";\nimport { paramToAccountIdentifier } from \"./utils/params.utils\";\n\nexport class LedgerCanister extends Canister<LedgerService> {\n  public static create(options: LedgerCanisterOptions = {}) {\n    const canisterId: Principal =\n      options.canisterId ?? MAINNET_LEDGER_CANISTER_ID;\n\n    const { service, certifiedService } = createServices<LedgerService>({\n      options: {\n        ...options,\n        canisterId,\n      },\n      idlFactory,\n      certifiedIdlFactory,\n    });\n\n    return new LedgerCanister(canisterId, service, certifiedService);\n  }\n\n  /**\n   * Returns the balance of the specified account identifier.\n   *\n   * If `certified` is true, the request is fetched as an update call, otherwise\n   * it is fetched using a query call.\n   *\n   * @param {AccountBalanceParams} params The parameters to get the balance of an account.\n   * @param {AccountIdentifierParam} params.accountIdentifier The account identifier provided either as hex string or as an AccountIdentifier.\n   * @param {boolean} params.certified query or update call.\n   * @returns {Promise<bigint>} The balance of the given account.\n   * @throws {@link Error}\n   */\n  public accountBalance = async ({\n    accountIdentifier: accountIdentifierParam,\n    certified = true,\n  }: AccountBalanceParams): Promise<bigint> => {\n    const accountIdentifier = paramToAccountIdentifier(accountIdentifierParam);\n\n    const service = certified ? this.certifiedService : this.service;\n    const tokens = await service.account_balance({\n      account: accountIdentifier.toUint8Array(),\n    });\n    return tokens.e8s;\n  };\n\n  /**\n   * Fetches the ledger metadata.\n   *\n   * @param {QueryParams} params - The parameters used to fetch the metadata, notably query or certified call.\n   * @returns {Promise<Array<[string, Value]>>} The metadata of the ICP ledger. A promise that resolves to an array of metadata entries, where each entry is a tuple consisting of a string and a value.\n   */\n  metadata = (params: QueryParams): Promise<Array<[string, Value]>> => {\n    const { icrc1_metadata } = this.caller(params);\n    return icrc1_metadata();\n  };\n\n  /**\n   * Returns the transaction fee of the ICP ledger canister.\n   *\n   * @param {QueryParams} [params={certified: false}] - Optional query parameters for the request, defaulting to `{ certified: false }` for backwards compatibility reason.\n   * @returns {Promise<bigint>} A promise that resolves to the transaction fee as a bigint.\n   */\n  public transactionFee = async (\n    params: QueryParams = { certified: false },\n  ): Promise<bigint> => {\n    const { transfer_fee } = this.caller(params);\n\n    const {\n      transfer_fee: { e8s },\n    } = await transfer_fee({});\n\n    return e8s;\n  };\n\n  /**\n   * Transfer ICP from the caller to the destination `accountIdentifier`.\n   * Returns the index of the block containing the tx if it was successful.\n   *\n   * @throws {@link TransferError}\n   */\n  public transfer = async (request: TransferRequest): Promise<BlockHeight> => {\n    const rawRequest = toTransferRawRequest(request);\n    const response = await this.certifiedService.transfer(rawRequest);\n    if (\"Err\" in response) {\n      throw mapTransferError(response.Err);\n    }\n    return response.Ok;\n  };\n\n  // WARNING: When using the ICRC-1 interface of the ICP ledger, there is no\n  // relationship between the memo and the icrc1Memo of a transaction. The\n  // ICRC-1 interface simply cannot set the memo field and the non-ICRC-1\n  // interface cannot set the icrc1Memo field, even though the icrc1Memo field\n  // is called just \"memo\" in canister method params.\n  /**\n   * Transfer ICP from the caller to the destination `Account`.\n   * Returns the index of the block containing the tx if it was successful.\n   *\n   * @throws {@link TransferError}\n   */\n  public icrc1Transfer = async (\n    request: Icrc1TransferRequest,\n  ): Promise<BlockHeight> => {\n    const rawRequest = toIcrc1TransferRawRequest(request);\n    const response = await this.certifiedService.icrc1_transfer(rawRequest);\n    if (\"Err\" in response) {\n      throw mapIcrc1TransferError(response.Err);\n    }\n    return response.Ok;\n  };\n\n  /**\n   * This method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n   *\n   * Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n   *\n   * @param {Icrc2ApproveRequest} params - The parameters to approve.\n   * @throws {ApproveError} If the approval fails.\n   * @returns {Promise<Icrc1BlockIndex>} The block index of the approved transaction.\n   */\n  icrc2Approve = async (\n    params: Icrc2ApproveRequest,\n  ): Promise<Icrc1BlockIndex> => {\n    const { icrc2_approve } = this.caller({ certified: true });\n\n    const response = await icrc2_approve(toIcrc2ApproveRawRequest(params));\n\n    if (\"Err\" in response) {\n      throw mapIcrc2ApproveError(response.Err);\n    }\n\n    return response.Ok;\n  };\n\n  /**\n   * Fetches the consent message for a specified canister call, intended to provide a human-readable message that helps users make informed decisions.\n   *\n   * @link: https://github.com/dfinity/wg-identity-authentication/blob/main/topics/ICRC-21/icrc_21_consent_msg.md\n   *\n   * @param {Icrc21ConsentMessageRequest} params - The request parameters containing the method name, arguments, and consent preferences (e.g., language).\n   * @returns {Promise<icrc21_consent_info>} - A promise that resolves to the consent message response, which includes the consent message in the specified language and other related information.\n   *\n   * @throws {InsufficientPaymentError} - This error is reserved for future use, in case payment extensions are introduced. For example, if consent messages, which are currently free, begin to require payments.\n   * @throws {UnsupportedCanisterCallError} - If the specified canister call is not supported.\n   * @throws {ConsentMessageUnavailableError} - If there is no consent message available.\n   * @throws {GenericError} - For any other generic errors.\n   */\n  icrc21ConsentMessage = async (\n    params: Icrc21ConsentMessageRequest,\n  ): Promise<icrc21_consent_info> => {\n    const { icrc21_canister_call_consent_message } = this.caller({\n      certified: true,\n    });\n\n    const response = await icrc21_canister_call_consent_message(\n      toIcrc21ConsentMessageRawRequest(params),\n    );\n\n    if (\"Err\" in response) {\n      throw mapIcrc21ConsentMessageError(response.Err);\n    }\n\n    return response.Ok;\n  };\n}\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n  const SubAccount = IDL.Vec(IDL.Nat8);\n  const Account = IDL.Record({\n    owner: IDL.Principal,\n    subaccount: IDL.Opt(SubAccount),\n  });\n  const FeatureFlags = IDL.Record({ icrc2: IDL.Bool });\n  const UpgradeArgs = IDL.Record({\n    icrc1_minting_account: IDL.Opt(Account),\n    feature_flags: IDL.Opt(FeatureFlags),\n  });\n  const Tokens = IDL.Record({ e8s: IDL.Nat64 });\n  const TextAccountIdentifier = IDL.Text;\n  const Duration = IDL.Record({ secs: IDL.Nat64, nanos: IDL.Nat32 });\n  const ArchiveOptions = IDL.Record({\n    num_blocks_to_archive: IDL.Nat64,\n    max_transactions_per_response: IDL.Opt(IDL.Nat64),\n    trigger_threshold: IDL.Nat64,\n    more_controller_ids: IDL.Opt(IDL.Vec(IDL.Principal)),\n    max_message_size_bytes: IDL.Opt(IDL.Nat64),\n    cycles_for_archive_creation: IDL.Opt(IDL.Nat64),\n    node_max_memory_size_bytes: IDL.Opt(IDL.Nat64),\n    controller_id: IDL.Principal,\n  });\n  const InitArgs = IDL.Record({\n    send_whitelist: IDL.Vec(IDL.Principal),\n    token_symbol: IDL.Opt(IDL.Text),\n    transfer_fee: IDL.Opt(Tokens),\n    minting_account: TextAccountIdentifier,\n    transaction_window: IDL.Opt(Duration),\n    max_message_size_bytes: IDL.Opt(IDL.Nat64),\n    icrc1_minting_account: IDL.Opt(Account),\n    archive_options: IDL.Opt(ArchiveOptions),\n    initial_values: IDL.Vec(IDL.Tuple(TextAccountIdentifier, Tokens)),\n    token_name: IDL.Opt(IDL.Text),\n    feature_flags: IDL.Opt(FeatureFlags),\n  });\n  const LedgerCanisterPayload = IDL.Variant({\n    Upgrade: IDL.Opt(UpgradeArgs),\n    Init: InitArgs,\n  });\n  const AccountIdentifier = IDL.Vec(IDL.Nat8);\n  const AccountBalanceArgs = IDL.Record({ account: AccountIdentifier });\n  const AccountBalanceArgsDfx = IDL.Record({\n    account: TextAccountIdentifier,\n  });\n  const Archive = IDL.Record({ canister_id: IDL.Principal });\n  const Archives = IDL.Record({ archives: IDL.Vec(Archive) });\n  const GetAllowancesArgs = IDL.Record({\n    prev_spender_id: IDL.Opt(TextAccountIdentifier),\n    from_account_id: TextAccountIdentifier,\n    take: IDL.Opt(IDL.Nat64),\n  });\n  const Allowances = IDL.Vec(\n    IDL.Record({\n      from_account_id: TextAccountIdentifier,\n      to_spender_id: TextAccountIdentifier,\n      allowance: Tokens,\n      expires_at: IDL.Opt(IDL.Nat64),\n    }),\n  );\n  const Icrc1Tokens = IDL.Nat;\n  const Value = IDL.Variant({\n    Int: IDL.Int,\n    Nat: IDL.Nat,\n    Blob: IDL.Vec(IDL.Nat8),\n    Text: IDL.Text,\n  });\n  const Icrc1Timestamp = IDL.Nat64;\n  const TransferArg = IDL.Record({\n    to: Account,\n    fee: IDL.Opt(Icrc1Tokens),\n    memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    from_subaccount: IDL.Opt(SubAccount),\n    created_at_time: IDL.Opt(Icrc1Timestamp),\n    amount: Icrc1Tokens,\n  });\n  const Icrc1BlockIndex = IDL.Nat;\n  const Icrc1TransferError = IDL.Variant({\n    GenericError: IDL.Record({\n      message: IDL.Text,\n      error_code: IDL.Nat,\n    }),\n    TemporarilyUnavailable: IDL.Null,\n    BadBurn: IDL.Record({ min_burn_amount: Icrc1Tokens }),\n    Duplicate: IDL.Record({ duplicate_of: Icrc1BlockIndex }),\n    BadFee: IDL.Record({ expected_fee: Icrc1Tokens }),\n    CreatedInFuture: IDL.Record({ ledger_time: IDL.Nat64 }),\n    TooOld: IDL.Null,\n    InsufficientFunds: IDL.Record({ balance: Icrc1Tokens }),\n  });\n  const Icrc1TransferResult = IDL.Variant({\n    Ok: Icrc1BlockIndex,\n    Err: Icrc1TransferError,\n  });\n  const icrc21_consent_message_metadata = IDL.Record({\n    utc_offset_minutes: IDL.Opt(IDL.Int16),\n    language: IDL.Text,\n  });\n  const icrc21_consent_message_spec = IDL.Record({\n    metadata: icrc21_consent_message_metadata,\n    device_spec: IDL.Opt(\n      IDL.Variant({ GenericDisplay: IDL.Null, FieldsDisplay: IDL.Null }),\n    ),\n  });\n  const icrc21_consent_message_request = IDL.Record({\n    arg: IDL.Vec(IDL.Nat8),\n    method: IDL.Text,\n    user_preferences: icrc21_consent_message_spec,\n  });\n  const Icrc21Value = IDL.Variant({\n    Text: IDL.Record({ content: IDL.Text }),\n    TokenAmount: IDL.Record({\n      decimals: IDL.Nat8,\n      amount: IDL.Nat64,\n      symbol: IDL.Text,\n    }),\n    TimestampSeconds: IDL.Record({ amount: IDL.Nat64 }),\n    DurationSeconds: IDL.Record({ amount: IDL.Nat64 }),\n  });\n  const FieldsDisplay = IDL.Record({\n    fields: IDL.Vec(IDL.Tuple(IDL.Text, Icrc21Value)),\n    intent: IDL.Text,\n  });\n  const icrc21_consent_message = IDL.Variant({\n    FieldsDisplayMessage: FieldsDisplay,\n    GenericDisplayMessage: IDL.Text,\n  });\n  const icrc21_consent_info = IDL.Record({\n    metadata: icrc21_consent_message_metadata,\n    consent_message: icrc21_consent_message,\n  });\n  const icrc21_error_info = IDL.Record({ description: IDL.Text });\n  const icrc21_error = IDL.Variant({\n    GenericError: IDL.Record({\n      description: IDL.Text,\n      error_code: IDL.Nat,\n    }),\n    InsufficientPayment: icrc21_error_info,\n    UnsupportedCanisterCall: icrc21_error_info,\n    ConsentMessageUnavailable: icrc21_error_info,\n  });\n  const icrc21_consent_message_response = IDL.Variant({\n    Ok: icrc21_consent_info,\n    Err: icrc21_error,\n  });\n  const AllowanceArgs = IDL.Record({\n    account: Account,\n    spender: Account,\n  });\n  const Allowance = IDL.Record({\n    allowance: Icrc1Tokens,\n    expires_at: IDL.Opt(Icrc1Timestamp),\n  });\n  const ApproveArgs = IDL.Record({\n    fee: IDL.Opt(Icrc1Tokens),\n    memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    from_subaccount: IDL.Opt(SubAccount),\n    created_at_time: IDL.Opt(Icrc1Timestamp),\n    amount: Icrc1Tokens,\n    expected_allowance: IDL.Opt(Icrc1Tokens),\n    expires_at: IDL.Opt(Icrc1Timestamp),\n    spender: Account,\n  });\n  const ApproveError = IDL.Variant({\n    GenericError: IDL.Record({\n      message: IDL.Text,\n      error_code: IDL.Nat,\n    }),\n    TemporarilyUnavailable: IDL.Null,\n    Duplicate: IDL.Record({ duplicate_of: Icrc1BlockIndex }),\n    BadFee: IDL.Record({ expected_fee: Icrc1Tokens }),\n    AllowanceChanged: IDL.Record({ current_allowance: Icrc1Tokens }),\n    CreatedInFuture: IDL.Record({ ledger_time: IDL.Nat64 }),\n    TooOld: IDL.Null,\n    Expired: IDL.Record({ ledger_time: IDL.Nat64 }),\n    InsufficientFunds: IDL.Record({ balance: Icrc1Tokens }),\n  });\n  const ApproveResult = IDL.Variant({\n    Ok: Icrc1BlockIndex,\n    Err: ApproveError,\n  });\n  const TransferFromArgs = IDL.Record({\n    to: Account,\n    fee: IDL.Opt(Icrc1Tokens),\n    spender_subaccount: IDL.Opt(SubAccount),\n    from: Account,\n    memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    created_at_time: IDL.Opt(Icrc1Timestamp),\n    amount: Icrc1Tokens,\n  });\n  const TransferFromError = IDL.Variant({\n    GenericError: IDL.Record({\n      message: IDL.Text,\n      error_code: IDL.Nat,\n    }),\n    TemporarilyUnavailable: IDL.Null,\n    InsufficientAllowance: IDL.Record({ allowance: Icrc1Tokens }),\n    BadBurn: IDL.Record({ min_burn_amount: Icrc1Tokens }),\n    Duplicate: IDL.Record({ duplicate_of: Icrc1BlockIndex }),\n    BadFee: IDL.Record({ expected_fee: Icrc1Tokens }),\n    CreatedInFuture: IDL.Record({ ledger_time: Icrc1Timestamp }),\n    TooOld: IDL.Null,\n    InsufficientFunds: IDL.Record({ balance: Icrc1Tokens }),\n  });\n  const TransferFromResult = IDL.Variant({\n    Ok: Icrc1BlockIndex,\n    Err: TransferFromError,\n  });\n  const BlockIndex = IDL.Nat64;\n  const GetBlocksArgs = IDL.Record({\n    start: BlockIndex,\n    length: IDL.Nat64,\n  });\n  const Memo = IDL.Nat64;\n  const TimeStamp = IDL.Record({ timestamp_nanos: IDL.Nat64 });\n  const Operation = IDL.Variant({\n    Approve: IDL.Record({\n      fee: Tokens,\n      from: AccountIdentifier,\n      allowance_e8s: IDL.Int,\n      allowance: Tokens,\n      expected_allowance: IDL.Opt(Tokens),\n      expires_at: IDL.Opt(TimeStamp),\n      spender: AccountIdentifier,\n    }),\n    Burn: IDL.Record({\n      from: AccountIdentifier,\n      amount: Tokens,\n      spender: IDL.Opt(AccountIdentifier),\n    }),\n    Mint: IDL.Record({ to: AccountIdentifier, amount: Tokens }),\n    Transfer: IDL.Record({\n      to: AccountIdentifier,\n      fee: Tokens,\n      from: AccountIdentifier,\n      amount: Tokens,\n      spender: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    }),\n  });\n  const Transaction = IDL.Record({\n    memo: Memo,\n    icrc1_memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    operation: IDL.Opt(Operation),\n    created_at_time: TimeStamp,\n  });\n  const Block = IDL.Record({\n    transaction: Transaction,\n    timestamp: TimeStamp,\n    parent_hash: IDL.Opt(IDL.Vec(IDL.Nat8)),\n  });\n  const BlockRange = IDL.Record({ blocks: IDL.Vec(Block) });\n  const QueryArchiveError = IDL.Variant({\n    BadFirstBlockIndex: IDL.Record({\n      requested_index: BlockIndex,\n      first_valid_index: BlockIndex,\n    }),\n    Other: IDL.Record({\n      error_message: IDL.Text,\n      error_code: IDL.Nat64,\n    }),\n  });\n  const QueryArchiveResult = IDL.Variant({\n    Ok: BlockRange,\n    Err: QueryArchiveError,\n  });\n  const QueryArchiveFn = IDL.Func([GetBlocksArgs], [QueryArchiveResult], []);\n  const ArchivedBlocksRange = IDL.Record({\n    callback: QueryArchiveFn,\n    start: BlockIndex,\n    length: IDL.Nat64,\n  });\n  const QueryBlocksResponse = IDL.Record({\n    certificate: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    blocks: IDL.Vec(Block),\n    chain_length: IDL.Nat64,\n    first_block_index: BlockIndex,\n    archived_blocks: IDL.Vec(ArchivedBlocksRange),\n  });\n  const ArchivedEncodedBlocksRange = IDL.Record({\n    callback: IDL.Func(\n      [GetBlocksArgs],\n      [\n        IDL.Variant({\n          Ok: IDL.Vec(IDL.Vec(IDL.Nat8)),\n          Err: QueryArchiveError,\n        }),\n      ],\n      [],\n    ),\n    start: IDL.Nat64,\n    length: IDL.Nat64,\n  });\n  const QueryEncodedBlocksResponse = IDL.Record({\n    certificate: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    blocks: IDL.Vec(IDL.Vec(IDL.Nat8)),\n    chain_length: IDL.Nat64,\n    first_block_index: IDL.Nat64,\n    archived_blocks: IDL.Vec(ArchivedEncodedBlocksRange),\n  });\n  const RemoveApprovalArgs = IDL.Record({\n    fee: IDL.Opt(Icrc1Tokens),\n    from_subaccount: IDL.Opt(SubAccount),\n    spender: AccountIdentifier,\n  });\n  const SendArgs = IDL.Record({\n    to: TextAccountIdentifier,\n    fee: Tokens,\n    memo: Memo,\n    from_subaccount: IDL.Opt(SubAccount),\n    created_at_time: IDL.Opt(TimeStamp),\n    amount: Tokens,\n  });\n  const TipOfChainRes = IDL.Record({\n    certification: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    tip_index: BlockIndex,\n  });\n  const TransferArgs = IDL.Record({\n    to: AccountIdentifier,\n    fee: Tokens,\n    memo: Memo,\n    from_subaccount: IDL.Opt(SubAccount),\n    created_at_time: IDL.Opt(TimeStamp),\n    amount: Tokens,\n  });\n  const TransferError = IDL.Variant({\n    TxTooOld: IDL.Record({ allowed_window_nanos: IDL.Nat64 }),\n    BadFee: IDL.Record({ expected_fee: Tokens }),\n    TxDuplicate: IDL.Record({ duplicate_of: BlockIndex }),\n    TxCreatedInFuture: IDL.Null,\n    InsufficientFunds: IDL.Record({ balance: Tokens }),\n  });\n  const TransferResult = IDL.Variant({\n    Ok: BlockIndex,\n    Err: TransferError,\n  });\n  const TransferFeeArg = IDL.Record({});\n  const TransferFee = IDL.Record({ transfer_fee: Tokens });\n\n  return IDL.Service({\n    account_balance: IDL.Func([AccountBalanceArgs], [Tokens], []),\n    account_balance_dfx: IDL.Func([AccountBalanceArgsDfx], [Tokens], []),\n    account_identifier: IDL.Func([Account], [AccountIdentifier], []),\n    archives: IDL.Func([], [Archives], []),\n    decimals: IDL.Func([], [IDL.Record({ decimals: IDL.Nat32 })], []),\n    get_allowances: IDL.Func([GetAllowancesArgs], [Allowances], []),\n    icrc10_supported_standards: IDL.Func(\n      [],\n      [IDL.Vec(IDL.Record({ url: IDL.Text, name: IDL.Text }))],\n      [],\n    ),\n    icrc1_balance_of: IDL.Func([Account], [Icrc1Tokens], []),\n    icrc1_decimals: IDL.Func([], [IDL.Nat8], []),\n    icrc1_fee: IDL.Func([], [Icrc1Tokens], []),\n    icrc1_metadata: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Text, Value))], []),\n    icrc1_minting_account: IDL.Func([], [IDL.Opt(Account)], []),\n    icrc1_name: IDL.Func([], [IDL.Text], []),\n    icrc1_supported_standards: IDL.Func(\n      [],\n      [IDL.Vec(IDL.Record({ url: IDL.Text, name: IDL.Text }))],\n      [],\n    ),\n    icrc1_symbol: IDL.Func([], [IDL.Text], []),\n    icrc1_total_supply: IDL.Func([], [Icrc1Tokens], []),\n    icrc1_transfer: IDL.Func([TransferArg], [Icrc1TransferResult], []),\n    icrc21_canister_call_consent_message: IDL.Func(\n      [icrc21_consent_message_request],\n      [icrc21_consent_message_response],\n      [],\n    ),\n    icrc2_allowance: IDL.Func([AllowanceArgs], [Allowance], []),\n    icrc2_approve: IDL.Func([ApproveArgs], [ApproveResult], []),\n    icrc2_transfer_from: IDL.Func([TransferFromArgs], [TransferFromResult], []),\n    is_ledger_ready: IDL.Func([], [IDL.Bool], [\"query\"]),\n    name: IDL.Func([], [IDL.Record({ name: IDL.Text })], []),\n    query_blocks: IDL.Func([GetBlocksArgs], [QueryBlocksResponse], []),\n    query_encoded_blocks: IDL.Func(\n      [GetBlocksArgs],\n      [QueryEncodedBlocksResponse],\n      [],\n    ),\n    remove_approval: IDL.Func([RemoveApprovalArgs], [ApproveResult], []),\n    send_dfx: IDL.Func([SendArgs], [BlockIndex], []),\n    symbol: IDL.Func([], [IDL.Record({ symbol: IDL.Text })], []),\n    tip_of_chain: IDL.Func([], [TipOfChainRes], []),\n    transfer: IDL.Func([TransferArgs], [TransferResult], []),\n    transfer_fee: IDL.Func([TransferFeeArg], [TransferFee], []),\n  });\n};\n\nexport const init = ({ IDL }) => {\n  const SubAccount = IDL.Vec(IDL.Nat8);\n  const Account = IDL.Record({\n    owner: IDL.Principal,\n    subaccount: IDL.Opt(SubAccount),\n  });\n  const FeatureFlags = IDL.Record({ icrc2: IDL.Bool });\n  const UpgradeArgs = IDL.Record({\n    icrc1_minting_account: IDL.Opt(Account),\n    feature_flags: IDL.Opt(FeatureFlags),\n  });\n  const Tokens = IDL.Record({ e8s: IDL.Nat64 });\n  const TextAccountIdentifier = IDL.Text;\n  const Duration = IDL.Record({ secs: IDL.Nat64, nanos: IDL.Nat32 });\n  const ArchiveOptions = IDL.Record({\n    num_blocks_to_archive: IDL.Nat64,\n    max_transactions_per_response: IDL.Opt(IDL.Nat64),\n    trigger_threshold: IDL.Nat64,\n    more_controller_ids: IDL.Opt(IDL.Vec(IDL.Principal)),\n    max_message_size_bytes: IDL.Opt(IDL.Nat64),\n    cycles_for_archive_creation: IDL.Opt(IDL.Nat64),\n    node_max_memory_size_bytes: IDL.Opt(IDL.Nat64),\n    controller_id: IDL.Principal,\n  });\n  const InitArgs = IDL.Record({\n    send_whitelist: IDL.Vec(IDL.Principal),\n    token_symbol: IDL.Opt(IDL.Text),\n    transfer_fee: IDL.Opt(Tokens),\n    minting_account: TextAccountIdentifier,\n    transaction_window: IDL.Opt(Duration),\n    max_message_size_bytes: IDL.Opt(IDL.Nat64),\n    icrc1_minting_account: IDL.Opt(Account),\n    archive_options: IDL.Opt(ArchiveOptions),\n    initial_values: IDL.Vec(IDL.Tuple(TextAccountIdentifier, Tokens)),\n    token_name: IDL.Opt(IDL.Text),\n    feature_flags: IDL.Opt(FeatureFlags),\n  });\n  const LedgerCanisterPayload = IDL.Variant({\n    Upgrade: IDL.Opt(UpgradeArgs),\n    Init: InitArgs,\n  });\n\n  return [LedgerCanisterPayload];\n};\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n  const SubAccount = IDL.Vec(IDL.Nat8);\n  const Account = IDL.Record({\n    owner: IDL.Principal,\n    subaccount: IDL.Opt(SubAccount),\n  });\n  const FeatureFlags = IDL.Record({ icrc2: IDL.Bool });\n  const UpgradeArgs = IDL.Record({\n    icrc1_minting_account: IDL.Opt(Account),\n    feature_flags: IDL.Opt(FeatureFlags),\n  });\n  const Tokens = IDL.Record({ e8s: IDL.Nat64 });\n  const TextAccountIdentifier = IDL.Text;\n  const Duration = IDL.Record({ secs: IDL.Nat64, nanos: IDL.Nat32 });\n  const ArchiveOptions = IDL.Record({\n    num_blocks_to_archive: IDL.Nat64,\n    max_transactions_per_response: IDL.Opt(IDL.Nat64),\n    trigger_threshold: IDL.Nat64,\n    more_controller_ids: IDL.Opt(IDL.Vec(IDL.Principal)),\n    max_message_size_bytes: IDL.Opt(IDL.Nat64),\n    cycles_for_archive_creation: IDL.Opt(IDL.Nat64),\n    node_max_memory_size_bytes: IDL.Opt(IDL.Nat64),\n    controller_id: IDL.Principal,\n  });\n  const InitArgs = IDL.Record({\n    send_whitelist: IDL.Vec(IDL.Principal),\n    token_symbol: IDL.Opt(IDL.Text),\n    transfer_fee: IDL.Opt(Tokens),\n    minting_account: TextAccountIdentifier,\n    transaction_window: IDL.Opt(Duration),\n    max_message_size_bytes: IDL.Opt(IDL.Nat64),\n    icrc1_minting_account: IDL.Opt(Account),\n    archive_options: IDL.Opt(ArchiveOptions),\n    initial_values: IDL.Vec(IDL.Tuple(TextAccountIdentifier, Tokens)),\n    token_name: IDL.Opt(IDL.Text),\n    feature_flags: IDL.Opt(FeatureFlags),\n  });\n  const LedgerCanisterPayload = IDL.Variant({\n    Upgrade: IDL.Opt(UpgradeArgs),\n    Init: InitArgs,\n  });\n  const AccountIdentifier = IDL.Vec(IDL.Nat8);\n  const AccountBalanceArgs = IDL.Record({ account: AccountIdentifier });\n  const AccountBalanceArgsDfx = IDL.Record({\n    account: TextAccountIdentifier,\n  });\n  const Archive = IDL.Record({ canister_id: IDL.Principal });\n  const Archives = IDL.Record({ archives: IDL.Vec(Archive) });\n  const GetAllowancesArgs = IDL.Record({\n    prev_spender_id: IDL.Opt(TextAccountIdentifier),\n    from_account_id: TextAccountIdentifier,\n    take: IDL.Opt(IDL.Nat64),\n  });\n  const Allowances = IDL.Vec(\n    IDL.Record({\n      from_account_id: TextAccountIdentifier,\n      to_spender_id: TextAccountIdentifier,\n      allowance: Tokens,\n      expires_at: IDL.Opt(IDL.Nat64),\n    }),\n  );\n  const Icrc1Tokens = IDL.Nat;\n  const Value = IDL.Variant({\n    Int: IDL.Int,\n    Nat: IDL.Nat,\n    Blob: IDL.Vec(IDL.Nat8),\n    Text: IDL.Text,\n  });\n  const Icrc1Timestamp = IDL.Nat64;\n  const TransferArg = IDL.Record({\n    to: Account,\n    fee: IDL.Opt(Icrc1Tokens),\n    memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    from_subaccount: IDL.Opt(SubAccount),\n    created_at_time: IDL.Opt(Icrc1Timestamp),\n    amount: Icrc1Tokens,\n  });\n  const Icrc1BlockIndex = IDL.Nat;\n  const Icrc1TransferError = IDL.Variant({\n    GenericError: IDL.Record({\n      message: IDL.Text,\n      error_code: IDL.Nat,\n    }),\n    TemporarilyUnavailable: IDL.Null,\n    BadBurn: IDL.Record({ min_burn_amount: Icrc1Tokens }),\n    Duplicate: IDL.Record({ duplicate_of: Icrc1BlockIndex }),\n    BadFee: IDL.Record({ expected_fee: Icrc1Tokens }),\n    CreatedInFuture: IDL.Record({ ledger_time: IDL.Nat64 }),\n    TooOld: IDL.Null,\n    InsufficientFunds: IDL.Record({ balance: Icrc1Tokens }),\n  });\n  const Icrc1TransferResult = IDL.Variant({\n    Ok: Icrc1BlockIndex,\n    Err: Icrc1TransferError,\n  });\n  const icrc21_consent_message_metadata = IDL.Record({\n    utc_offset_minutes: IDL.Opt(IDL.Int16),\n    language: IDL.Text,\n  });\n  const icrc21_consent_message_spec = IDL.Record({\n    metadata: icrc21_consent_message_metadata,\n    device_spec: IDL.Opt(\n      IDL.Variant({ GenericDisplay: IDL.Null, FieldsDisplay: IDL.Null }),\n    ),\n  });\n  const icrc21_consent_message_request = IDL.Record({\n    arg: IDL.Vec(IDL.Nat8),\n    method: IDL.Text,\n    user_preferences: icrc21_consent_message_spec,\n  });\n  const Icrc21Value = IDL.Variant({\n    Text: IDL.Record({ content: IDL.Text }),\n    TokenAmount: IDL.Record({\n      decimals: IDL.Nat8,\n      amount: IDL.Nat64,\n      symbol: IDL.Text,\n    }),\n    TimestampSeconds: IDL.Record({ amount: IDL.Nat64 }),\n    DurationSeconds: IDL.Record({ amount: IDL.Nat64 }),\n  });\n  const FieldsDisplay = IDL.Record({\n    fields: IDL.Vec(IDL.Tuple(IDL.Text, Icrc21Value)),\n    intent: IDL.Text,\n  });\n  const icrc21_consent_message = IDL.Variant({\n    FieldsDisplayMessage: FieldsDisplay,\n    GenericDisplayMessage: IDL.Text,\n  });\n  const icrc21_consent_info = IDL.Record({\n    metadata: icrc21_consent_message_metadata,\n    consent_message: icrc21_consent_message,\n  });\n  const icrc21_error_info = IDL.Record({ description: IDL.Text });\n  const icrc21_error = IDL.Variant({\n    GenericError: IDL.Record({\n      description: IDL.Text,\n      error_code: IDL.Nat,\n    }),\n    InsufficientPayment: icrc21_error_info,\n    UnsupportedCanisterCall: icrc21_error_info,\n    ConsentMessageUnavailable: icrc21_error_info,\n  });\n  const icrc21_consent_message_response = IDL.Variant({\n    Ok: icrc21_consent_info,\n    Err: icrc21_error,\n  });\n  const AllowanceArgs = IDL.Record({\n    account: Account,\n    spender: Account,\n  });\n  const Allowance = IDL.Record({\n    allowance: Icrc1Tokens,\n    expires_at: IDL.Opt(Icrc1Timestamp),\n  });\n  const ApproveArgs = IDL.Record({\n    fee: IDL.Opt(Icrc1Tokens),\n    memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    from_subaccount: IDL.Opt(SubAccount),\n    created_at_time: IDL.Opt(Icrc1Timestamp),\n    amount: Icrc1Tokens,\n    expected_allowance: IDL.Opt(Icrc1Tokens),\n    expires_at: IDL.Opt(Icrc1Timestamp),\n    spender: Account,\n  });\n  const ApproveError = IDL.Variant({\n    GenericError: IDL.Record({\n      message: IDL.Text,\n      error_code: IDL.Nat,\n    }),\n    TemporarilyUnavailable: IDL.Null,\n    Duplicate: IDL.Record({ duplicate_of: Icrc1BlockIndex }),\n    BadFee: IDL.Record({ expected_fee: Icrc1Tokens }),\n    AllowanceChanged: IDL.Record({ current_allowance: Icrc1Tokens }),\n    CreatedInFuture: IDL.Record({ ledger_time: IDL.Nat64 }),\n    TooOld: IDL.Null,\n    Expired: IDL.Record({ ledger_time: IDL.Nat64 }),\n    InsufficientFunds: IDL.Record({ balance: Icrc1Tokens }),\n  });\n  const ApproveResult = IDL.Variant({\n    Ok: Icrc1BlockIndex,\n    Err: ApproveError,\n  });\n  const TransferFromArgs = IDL.Record({\n    to: Account,\n    fee: IDL.Opt(Icrc1Tokens),\n    spender_subaccount: IDL.Opt(SubAccount),\n    from: Account,\n    memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    created_at_time: IDL.Opt(Icrc1Timestamp),\n    amount: Icrc1Tokens,\n  });\n  const TransferFromError = IDL.Variant({\n    GenericError: IDL.Record({\n      message: IDL.Text,\n      error_code: IDL.Nat,\n    }),\n    TemporarilyUnavailable: IDL.Null,\n    InsufficientAllowance: IDL.Record({ allowance: Icrc1Tokens }),\n    BadBurn: IDL.Record({ min_burn_amount: Icrc1Tokens }),\n    Duplicate: IDL.Record({ duplicate_of: Icrc1BlockIndex }),\n    BadFee: IDL.Record({ expected_fee: Icrc1Tokens }),\n    CreatedInFuture: IDL.Record({ ledger_time: Icrc1Timestamp }),\n    TooOld: IDL.Null,\n    InsufficientFunds: IDL.Record({ balance: Icrc1Tokens }),\n  });\n  const TransferFromResult = IDL.Variant({\n    Ok: Icrc1BlockIndex,\n    Err: TransferFromError,\n  });\n  const BlockIndex = IDL.Nat64;\n  const GetBlocksArgs = IDL.Record({\n    start: BlockIndex,\n    length: IDL.Nat64,\n  });\n  const Memo = IDL.Nat64;\n  const TimeStamp = IDL.Record({ timestamp_nanos: IDL.Nat64 });\n  const Operation = IDL.Variant({\n    Approve: IDL.Record({\n      fee: Tokens,\n      from: AccountIdentifier,\n      allowance_e8s: IDL.Int,\n      allowance: Tokens,\n      expected_allowance: IDL.Opt(Tokens),\n      expires_at: IDL.Opt(TimeStamp),\n      spender: AccountIdentifier,\n    }),\n    Burn: IDL.Record({\n      from: AccountIdentifier,\n      amount: Tokens,\n      spender: IDL.Opt(AccountIdentifier),\n    }),\n    Mint: IDL.Record({ to: AccountIdentifier, amount: Tokens }),\n    Transfer: IDL.Record({\n      to: AccountIdentifier,\n      fee: Tokens,\n      from: AccountIdentifier,\n      amount: Tokens,\n      spender: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    }),\n  });\n  const Transaction = IDL.Record({\n    memo: Memo,\n    icrc1_memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    operation: IDL.Opt(Operation),\n    created_at_time: TimeStamp,\n  });\n  const Block = IDL.Record({\n    transaction: Transaction,\n    timestamp: TimeStamp,\n    parent_hash: IDL.Opt(IDL.Vec(IDL.Nat8)),\n  });\n  const BlockRange = IDL.Record({ blocks: IDL.Vec(Block) });\n  const QueryArchiveError = IDL.Variant({\n    BadFirstBlockIndex: IDL.Record({\n      requested_index: BlockIndex,\n      first_valid_index: BlockIndex,\n    }),\n    Other: IDL.Record({\n      error_message: IDL.Text,\n      error_code: IDL.Nat64,\n    }),\n  });\n  const QueryArchiveResult = IDL.Variant({\n    Ok: BlockRange,\n    Err: QueryArchiveError,\n  });\n  const QueryArchiveFn = IDL.Func(\n    [GetBlocksArgs],\n    [QueryArchiveResult],\n    [\"query\"],\n  );\n  const ArchivedBlocksRange = IDL.Record({\n    callback: QueryArchiveFn,\n    start: BlockIndex,\n    length: IDL.Nat64,\n  });\n  const QueryBlocksResponse = IDL.Record({\n    certificate: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    blocks: IDL.Vec(Block),\n    chain_length: IDL.Nat64,\n    first_block_index: BlockIndex,\n    archived_blocks: IDL.Vec(ArchivedBlocksRange),\n  });\n  const ArchivedEncodedBlocksRange = IDL.Record({\n    callback: IDL.Func(\n      [GetBlocksArgs],\n      [\n        IDL.Variant({\n          Ok: IDL.Vec(IDL.Vec(IDL.Nat8)),\n          Err: QueryArchiveError,\n        }),\n      ],\n      [\"query\"],\n    ),\n    start: IDL.Nat64,\n    length: IDL.Nat64,\n  });\n  const QueryEncodedBlocksResponse = IDL.Record({\n    certificate: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    blocks: IDL.Vec(IDL.Vec(IDL.Nat8)),\n    chain_length: IDL.Nat64,\n    first_block_index: IDL.Nat64,\n    archived_blocks: IDL.Vec(ArchivedEncodedBlocksRange),\n  });\n  const RemoveApprovalArgs = IDL.Record({\n    fee: IDL.Opt(Icrc1Tokens),\n    from_subaccount: IDL.Opt(SubAccount),\n    spender: AccountIdentifier,\n  });\n  const SendArgs = IDL.Record({\n    to: TextAccountIdentifier,\n    fee: Tokens,\n    memo: Memo,\n    from_subaccount: IDL.Opt(SubAccount),\n    created_at_time: IDL.Opt(TimeStamp),\n    amount: Tokens,\n  });\n  const TipOfChainRes = IDL.Record({\n    certification: IDL.Opt(IDL.Vec(IDL.Nat8)),\n    tip_index: BlockIndex,\n  });\n  const TransferArgs = IDL.Record({\n    to: AccountIdentifier,\n    fee: Tokens,\n    memo: Memo,\n    from_subaccount: IDL.Opt(SubAccount),\n    created_at_time: IDL.Opt(TimeStamp),\n    amount: Tokens,\n  });\n  const TransferError = IDL.Variant({\n    TxTooOld: IDL.Record({ allowed_window_nanos: IDL.Nat64 }),\n    BadFee: IDL.Record({ expected_fee: Tokens }),\n    TxDuplicate: IDL.Record({ duplicate_of: BlockIndex }),\n    TxCreatedInFuture: IDL.Null,\n    InsufficientFunds: IDL.Record({ balance: Tokens }),\n  });\n  const TransferResult = IDL.Variant({\n    Ok: BlockIndex,\n    Err: TransferError,\n  });\n  const TransferFeeArg = IDL.Record({});\n  const TransferFee = IDL.Record({ transfer_fee: Tokens });\n\n  return IDL.Service({\n    account_balance: IDL.Func([AccountBalanceArgs], [Tokens], [\"query\"]),\n    account_balance_dfx: IDL.Func([AccountBalanceArgsDfx], [Tokens], [\"query\"]),\n    account_identifier: IDL.Func([Account], [AccountIdentifier], [\"query\"]),\n    archives: IDL.Func([], [Archives], [\"query\"]),\n    decimals: IDL.Func([], [IDL.Record({ decimals: IDL.Nat32 })], [\"query\"]),\n    get_allowances: IDL.Func([GetAllowancesArgs], [Allowances], [\"query\"]),\n    icrc10_supported_standards: IDL.Func(\n      [],\n      [IDL.Vec(IDL.Record({ url: IDL.Text, name: IDL.Text }))],\n      [\"query\"],\n    ),\n    icrc1_balance_of: IDL.Func([Account], [Icrc1Tokens], [\"query\"]),\n    icrc1_decimals: IDL.Func([], [IDL.Nat8], [\"query\"]),\n    icrc1_fee: IDL.Func([], [Icrc1Tokens], [\"query\"]),\n    icrc1_metadata: IDL.Func(\n      [],\n      [IDL.Vec(IDL.Tuple(IDL.Text, Value))],\n      [\"query\"],\n    ),\n    icrc1_minting_account: IDL.Func([], [IDL.Opt(Account)], [\"query\"]),\n    icrc1_name: IDL.Func([], [IDL.Text], [\"query\"]),\n    icrc1_supported_standards: IDL.Func(\n      [],\n      [IDL.Vec(IDL.Record({ url: IDL.Text, name: IDL.Text }))],\n      [\"query\"],\n    ),\n    icrc1_symbol: IDL.Func([], [IDL.Text], [\"query\"]),\n    icrc1_total_supply: IDL.Func([], [Icrc1Tokens], [\"query\"]),\n    icrc1_transfer: IDL.Func([TransferArg], [Icrc1TransferResult], []),\n    icrc21_canister_call_consent_message: IDL.Func(\n      [icrc21_consent_message_request],\n      [icrc21_consent_message_response],\n      [],\n    ),\n    icrc2_allowance: IDL.Func([AllowanceArgs], [Allowance], [\"query\"]),\n    icrc2_approve: IDL.Func([ApproveArgs], [ApproveResult], []),\n    icrc2_transfer_from: IDL.Func([TransferFromArgs], [TransferFromResult], []),\n    is_ledger_ready: IDL.Func([], [IDL.Bool], [\"query\"]),\n    name: IDL.Func([], [IDL.Record({ name: IDL.Text })], [\"query\"]),\n    query_blocks: IDL.Func([GetBlocksArgs], [QueryBlocksResponse], [\"query\"]),\n    query_encoded_blocks: IDL.Func(\n      [GetBlocksArgs],\n      [QueryEncodedBlocksResponse],\n      [\"query\"],\n    ),\n    remove_approval: IDL.Func([RemoveApprovalArgs], [ApproveResult], []),\n    send_dfx: IDL.Func([SendArgs], [BlockIndex], []),\n    symbol: IDL.Func([], [IDL.Record({ symbol: IDL.Text })], [\"query\"]),\n    tip_of_chain: IDL.Func([], [TipOfChainRes], [\"query\"]),\n    transfer: IDL.Func([TransferArgs], [TransferResult], []),\n    transfer_fee: IDL.Func([TransferFeeArg], [TransferFee], [\"query\"]),\n  });\n};\n\nexport const init = ({ IDL }) => {\n  const SubAccount = IDL.Vec(IDL.Nat8);\n  const Account = IDL.Record({\n    owner: IDL.Principal,\n    subaccount: IDL.Opt(SubAccount),\n  });\n  const FeatureFlags = IDL.Record({ icrc2: IDL.Bool });\n  const UpgradeArgs = IDL.Record({\n    icrc1_minting_account: IDL.Opt(Account),\n    feature_flags: IDL.Opt(FeatureFlags),\n  });\n  const Tokens = IDL.Record({ e8s: IDL.Nat64 });\n  const TextAccountIdentifier = IDL.Text;\n  const Duration = IDL.Record({ secs: IDL.Nat64, nanos: IDL.Nat32 });\n  const ArchiveOptions = IDL.Record({\n    num_blocks_to_archive: IDL.Nat64,\n    max_transactions_per_response: IDL.Opt(IDL.Nat64),\n    trigger_threshold: IDL.Nat64,\n    more_controller_ids: IDL.Opt(IDL.Vec(IDL.Principal)),\n    max_message_size_bytes: IDL.Opt(IDL.Nat64),\n    cycles_for_archive_creation: IDL.Opt(IDL.Nat64),\n    node_max_memory_size_bytes: IDL.Opt(IDL.Nat64),\n    controller_id: IDL.Principal,\n  });\n  const InitArgs = IDL.Record({\n    send_whitelist: IDL.Vec(IDL.Principal),\n    token_symbol: IDL.Opt(IDL.Text),\n    transfer_fee: IDL.Opt(Tokens),\n    minting_account: TextAccountIdentifier,\n    transaction_window: IDL.Opt(Duration),\n    max_message_size_bytes: IDL.Opt(IDL.Nat64),\n    icrc1_minting_account: IDL.Opt(Account),\n    archive_options: IDL.Opt(ArchiveOptions),\n    initial_values: IDL.Vec(IDL.Tuple(TextAccountIdentifier, Tokens)),\n    token_name: IDL.Opt(IDL.Text),\n    feature_flags: IDL.Opt(FeatureFlags),\n  });\n  const LedgerCanisterPayload = IDL.Variant({\n    Upgrade: IDL.Opt(UpgradeArgs),\n    Init: InitArgs,\n  });\n\n  return [LedgerCanisterPayload];\n};\n", "import {\n  bigEndianCrc32,\n  hexStringToUint8Array,\n  isNullish,\n  uint8ArrayToHexString,\n  uint8ArraysEqual,\n} from \"@dfinity/utils\";\nimport { InvalidAccountIDError } from \"../errors/ledger.errors\";\n\n/**\n * Checks account id check sum\n *\n * @throws InvalidAccountIDError\n */\nexport const checkAccountId = (accountId: string): void => {\n  // Verify the checksum of the given address.\n  if (accountId.length != 64) {\n    throw new InvalidAccountIDError(\n      `Invalid account identifier ${accountId}. The account identifier must be 64 chars in length.`,\n    );\n  }\n\n  const toAccountBytes = hexStringToUint8Array(accountId);\n  const foundChecksum = toAccountBytes.slice(0, 4);\n  const expectedCheckum = bigEndianCrc32(toAccountBytes.slice(4));\n  if (!uint8ArraysEqual({ a: expectedCheckum, b: foundChecksum })) {\n    throw new InvalidAccountIDError(\n      `Account identifier ${accountId} has an invalid checksum. Are you sure the account identifier is correct?\\n\\nExpected checksum: ${uint8ArrayToHexString(expectedCheckum)}\\nFound checksum: ${uint8ArrayToHexString(foundChecksum)}`,\n    );\n  }\n};\n\n/**\n * Checks if a given string (or undefined) is a valid ICP account identifier.\n *\n * It uses the `checkAccountId` function to validate the checksum, but it does not throw an error.\n *\n * @param {string | undefined} address The putative ICP account identifier.\n */\n\nexport const isIcpAccountIdentifier = (\n  address: string | undefined,\n): boolean => {\n  if (isNullish(address)) {\n    return false;\n  }\n\n  try {\n    checkAccountId(address);\n    return true;\n  } catch (_: unknown) {\n    // We do not parse the error\n  }\n\n  return false;\n};\n"],
  "mappings": ";;AAAA,OACE,6BAAAA,GACA,0BAAAC,GACA,kBAAAC,GACA,yBAAAC,GACA,yBAAAC,OACK,iBCSD,SAAUC,GAAQC,EAAU,CAChC,OAAOA,aAAa,YAAe,YAAY,OAAOA,CAAC,GAAKA,EAAE,YAAY,OAAS,YACrF,CAQM,SAAUC,EAAOC,KAA8BC,EAAiB,CACpE,GAAI,CAACC,GAAQF,CAAC,EAAG,MAAM,IAAI,MAAM,qBAAqB,EACtD,GAAIC,EAAQ,OAAS,GAAK,CAACA,EAAQ,SAASD,EAAE,MAAM,EAClD,MAAM,IAAI,MAAM,iCAAmCC,EAAU,gBAAkBD,EAAE,MAAM,CAC3F,CAWM,SAAUG,GAAQC,EAAeC,EAAgB,GAAI,CACzD,GAAID,EAAS,UAAW,MAAM,IAAI,MAAM,kCAAkC,EAC1E,GAAIC,GAAiBD,EAAS,SAAU,MAAM,IAAI,MAAM,uCAAuC,CACjG,CAGM,SAAUE,GAAQC,EAAUH,EAAa,CAC7CI,EAAOD,CAAG,EACV,IAAME,EAAML,EAAS,UACrB,GAAIG,EAAI,OAASE,EACf,MAAM,IAAI,MAAM,yDAA2DA,CAAG,CAElF,CAkBM,SAAUC,KAASC,EAAoB,CAC3C,QAASC,EAAI,EAAGA,EAAID,EAAO,OAAQC,IACjCD,EAAOC,CAAC,EAAE,KAAK,CAAC,CAEpB,CAGM,SAAUC,EAAWC,EAAe,CACxC,OAAO,IAAI,SAASA,EAAI,OAAQA,EAAI,WAAYA,EAAI,UAAU,CAChE,CAGM,SAAUC,EAAKC,EAAcC,EAAa,CAC9C,OAAQD,GAAS,GAAKC,EAAWD,I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BAAuB,MACrBP,GACiC,CACjC,GAAM,CAAE,qCAAAc,CAAqC,EAAI,KAAK,OAAO,CAC3D,UAAW,EACb,CAAC,EAEKP,EAAW,MAAMO,EACrBC,GAAiCf,CAAM,CACzC,EAEA,GAAI,QAASO,EACX,MAAMS,GAA6BT,EAAS,GAAG,EAGjD,OAAOA,EAAS,EAClB,CACF,EGnMA,OACE,kBAAAU,GACA,yBAAAC,GACA,aAAAC,GACA,yBAAAC,GACA,oBAAAC,OACK,iBAQA,IAAMC,GAAkBC,GAA4B,CAEzD,GAAIA,EAAU,QAAU,GACtB,MAAM,IAAIC,EACR,8BAA8BD,CAAS,sDACzC,EAGF,IAAME,EAAiBC,GAAsBH,CAAS,EAChDI,EAAgBF,EAAe,MAAM,EAAG,CAAC,EACzCG,EAAkBC,GAAeJ,EAAe,MAAM,CAAC,CAAC,EAC9D,GAAI,CAACK,GAAiB,CAAE,EAAGF,EAAiB,EAAGD,CAAc,CAAC,EAC5D,MAAM,IAAIH,EACR,sBAAsBD,CAAS;AAAA;AAAA,qBAAmGQ,GAAsBH,CAAe,CAAC;AAAA,kBAAqBG,GAAsBJ,CAAa,CAAC,EACnO,CAEJ,EAUaK,GACXC,GACY,CACZ,GAAIC,GAAUD,CAAO,EACnB,MAAO,GAGT,GAAI,CACF,OAAAX,GAAeW,CAAO,EACf,EACT,MAAqB,CAErB,CAEA,MAAO,EACT",
  "names": ["arrayOfNumberToUint8Array", "asciiStringToByteArray", "bigEndianCrc32", "hexStringToUint8Array", "uint8ArrayToHexString", "isBytes", "a", "abytes", "b", "lengths", "isBytes", "aexists", "instance", "checkFinished", "aoutput", "out", "abytes", "min", "clean", "arrays", "i", "createView", "arr", "rotr", "word", "shift", "utf8ToBytes", "str", "toBytes", "data", "utf8ToBytes", "abytes", "Hash", "createHasher", "hashCons", "hashC", "msg", "toBytes", "tmp", "setBigUint64", "view", "byteOffset", "value", "isLE", "_32n", "_u32_max", "wh", "wl", "h", "Chi", "a", "b", "Maj", "HashMD", "Hash", "blockLen", "outputLen", "padOffset", "createView", "data", "aexists", "toBytes", "abytes", "buffer", "len", "pos", "take", "dataView", "out", "aoutput", "clean", "i", "oview", "outLen", "state", "res", "to", "length", "finished", "destroyed", "SHA256_IV", "SHA224_IV", "SHA256_K", "SHA256_W", "SHA256", "HashMD", "outputLen", "SHA256_IV", "A", "B", "C", "D", "E", "F", "G", "H", "view", "offset", "i", "W15", "W2", "s0", "rotr", "s1", "sigma1", "T1", "Chi", "T2", "Maj", "clean", "SHA224", "SHA224_IV", "sha224", "createHasher", "SHA224", "AccountIdentifier", "_AccountIdentifier", "bytes", "hex", "hexStringToUint8Array", "providedChecksum", "uint8ArrayToHexString", "hash", "expectedChecksum", "bigEndianCrc32", "principal", "subAccount", "SubAccount", "padding", "asciiStringToByteArray", "shaObj", "sha224", "arrayOfNumberToUint8Array", "checksum", "_SubAccount", "principalBytes", "i", "id", "view", "TWO_TO_THE_32", "uint8Arary", "arrayOfNumberToUint8Array", "isNullish", "toNullable", "CREATE_CANISTER_MEMO", "TOP_UP_CANISTER_MEMO", "TRANSACTION_FEE", "E8S_PER_TOKEN", "e8sToTokens", "e8s", "toTransferRawRequest", "to", "amount", "memo", "fee", "fromSubAccount", "createdAt", "TRANSACTION_FEE", "arrayOfNumberToUint8Array", "toIcrc1TransferRawRequest", "icrc1Memo", "toNullable", "toIcrc2ApproveRawRequest", "expected_allowance", "expires_at", "rest", "toIcrc21ConsentMessageRawRequest", "utcOffsetMinutes", "language", "deriveSpec", "isNullish", "IcrcError", "TransferError", "ApproveError", "ConsentMessageError", "InvalidSenderError", "InvalidAccountIDError", "InsufficientFundsError", "balance", "TxTooOldError", "allowed_window_secs", "TxCreatedInFutureError", "TxDuplicateError", "duplicateOf", "BadFeeError", "expectedFee", "GenericError", "message", "error_code", "TemporarilyUnavailableError", "DuplicateError", "AllowanceChangedError", "currentAllowance", "CreatedInFutureError", "TooOldError", "ExpiredError", "ledgerTime", "InsufficientPaymentError", "UnsupportedCanisterCallError", "ConsentMessageUnavailableError", "mapTransferError", "rawTransferError", "mapIcrc1TransferError", "mapIcrc2ApproveError", "rawApproveError", "mapIcrc21ConsentMessageError", "rawError", "Canister", "createServices", "toNullable", "idlFactory", "IDL", "InitArg", "GetAccountIdentifierTransactionsArgs", "Tokens", "TimeStamp", "Operation", "Transaction", "TransactionWithId", "GetAccountIdentifierTransactionsResponse", "GetAccountIdentifierTransactionsError", "GetAccountIdentifierTransactionsResult", "Account", "GetAccountTransactionsArgs", "GetBlocksRequest", "GetBlocksResponse", "HttpRequest", "HttpResponse", "Status", "idlFactory", "IDL", "InitArg", "GetAccountIdentifierTransactionsArgs", "Tokens", "TimeStamp", "Operation", "Transaction", "TransactionWithId", "GetAccountIdentifierTransactionsResponse", "GetAccountIdentifierTransactionsError", "GetAccountIdentifierTransactionsResult", "Account", "GetAccountTransactionsArgs", "GetBlocksRequest", "GetBlocksResponse", "HttpRequest", "HttpResponse", "Status", "Principal", "MAINNET_LEDGER_CANISTER_ID", "MAINNET_INDEX_CANISTER_ID", "IndexError", "paramToAccountIdentifier", "param", "AccountIdentifier", "paramToAccountIdentifierHex", "IndexCanister", "_IndexCanister", "Canister", "optionsCanisterId", "options", "service", "certifiedService", "canisterId", "createServices", "MAINNET_INDEX_CANISTER_ID", "idlFactory", "certified", "accountIdentifier", "paramToAccountIdentifierHex", "start", "max_results", "response", "toNullable", "IndexError", "Canister", "createServices", "idlFactory", "IDL", "SubAccount", "Account", "FeatureFlags", "UpgradeArgs", "Tokens", "TextAccountIdentifier", "Duration", "ArchiveOptions", "InitArgs", "LedgerCanisterPayload", "AccountIdentifier", "AccountBalanceArgs", "AccountBalanceArgsDfx", "Archive", "Archives", "GetAllowancesArgs", "Allowances", "Icrc1Tokens", "Value", "Icrc1Timestamp", "TransferArg", "Icrc1BlockIndex", "Icrc1TransferError", "Icrc1TransferResult", "icrc21_consent_message_metadata", "icrc21_consent_message_spec", "icrc21_consent_message_request", "Icrc21Value", "FieldsDisplay", "icrc21_consent_message", "icrc21_consent_info", "icrc21_error_info", "icrc21_error", "icrc21_consent_message_response", "AllowanceArgs", "Allowance", "ApproveArgs", "ApproveError", "ApproveResult", "TransferFromArgs", "TransferFromError", "TransferFromResult", "BlockIndex", "GetBlocksArgs", "Memo", "TimeStamp", "Operation", "Transaction", "Block", "BlockRange", "QueryArchiveError", "QueryArchiveResult", "QueryArchiveFn", "ArchivedBlocksRange", "QueryBlocksResponse", "ArchivedEncodedBlocksRange", "QueryEncodedBlocksResponse", "RemoveApprovalArgs", "SendArgs", "TipOfChainRes", "TransferArgs", "TransferError", "TransferResult", "TransferFeeArg", "TransferFee", "idlFactory", "IDL", "SubAccount", "Account", "FeatureFlags", "UpgradeArgs", "Tokens", "TextAccountIdentifier", "Duration", "ArchiveOptions", "InitArgs", "LedgerCanisterPayload", "AccountIdentifier", "AccountBalanceArgs", "AccountBalanceArgsDfx", "Archive", "Archives", "GetAllowancesArgs", "Allowances", "Icrc1Tokens", "Value", "Icrc1Timestamp", "TransferArg", "Icrc1BlockIndex", "Icrc1TransferError", "Icrc1TransferResult", "icrc21_consent_message_metadata", "icrc21_consent_message_spec", "icrc21_consent_message_request", "Icrc21Value", "FieldsDisplay", "icrc21_consent_message", "icrc21_consent_info", "icrc21_error_info", "icrc21_error", "icrc21_consent_message_response", "AllowanceArgs", "Allowance", "ApproveArgs", "ApproveError", "ApproveResult", "TransferFromArgs", "TransferFromError", "TransferFromResult", "BlockIndex", "GetBlocksArgs", "Memo", "TimeStamp", "Operation", "Transaction", "Block", "BlockRange", "QueryArchiveError", "QueryArchiveResult", "QueryArchiveFn", "ArchivedBlocksRange", "QueryBlocksResponse", "ArchivedEncodedBlocksRange", "QueryEncodedBlocksResponse", "RemoveApprovalArgs", "SendArgs", "TipOfChainRes", "TransferArgs", "TransferError", "TransferResult", "TransferFeeArg", "TransferFee", "LedgerCanister", "_LedgerCanister", "Canister", "options", "canisterId", "MAINNET_LEDGER_CANISTER_ID", "service", "certifiedService", "createServices", "idlFactory", "accountIdentifierParam", "certified", "accountIdentifier", "paramToAccountIdentifier", "params", "icrc1_metadata", "transfer_fee", "e8s", "request", "rawRequest", "toTransferRawRequest", "response", "mapTransferError", "toIcrc1TransferRawRequest", "mapIcrc1TransferError", "icrc2_approve", "toIcrc2ApproveRawRequest", "mapIcrc2ApproveError", "icrc21_canister_call_consent_message", "toIcrc21ConsentMessageRawRequest", "mapIcrc21ConsentMessageError", "bigEndianCrc32", "hexStringToUint8Array", "isNullish", "uint8ArrayToHexString", "uint8ArraysEqual", "checkAccountId", "accountId", "InvalidAccountIDError", "toAccountBytes", "hexStringToUint8Array", "foundChecksum", "expectedCheckum", "bigEndianCrc32", "uint8ArraysEqual", "uint8ArrayToHexString", "isIcpAccountIdentifier", "address", "isNullish"]
}
