{"version":3,"file":"integers.mjs","names":[],"sources":["../../src/bcs/integers.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n// Replacement BCS integer types for the generated Move bindings (wired up in\n// `sui-codegen.config.ts` under `bcsOverrides`).\n//\n// `@mysten/sui/bcs` parses the wide integers to decimal *strings*; these parse straight to bigint\n// instead. Serialization still accepts what the plain types accept, so tx builders and test\n// fixtures are unaffected.\n//\n// Representation only — deliberately no scaling. A field's Move type does not determine its\n// scale (custody balances are raw coin units while an app's own fields may be rates), and the\n// exact on-chain integers are what consumers decoding account state and events want.\n\nimport { bcs } from '@mysten/sui/bcs';\n\nconst toBigInt = (value: string) => BigInt(value);\n\n/** `u64` parsed as a bigint rather than a decimal string. */\nexport const U64 = bcs.u64().transform({\n\tinput: (value: number | bigint | string) => value.toString(),\n\toutput: toBigInt,\n});\n\n/** `u128` parsed as a bigint rather than a decimal string. */\nexport const U128 = bcs.u128().transform({\n\tinput: (value: number | bigint | string) => value.toString(),\n\toutput: toBigInt,\n});\n\n/** `u256` parsed as a bigint rather than a decimal string. */\nexport const U256 = bcs.u256().transform({\n\tinput: (value: number | bigint | string) => value.toString(),\n\toutput: toBigInt,\n});\n"],"mappings":";;;AAgBA,MAAM,YAAY,UAAkB,OAAO,MAAM;;AAGjD,MAAa,MAAM,IAAI,KAAK,CAAC,UAAU;CACtC,QAAQ,UAAoC,MAAM,UAAU;CAC5D,QAAQ;CACR,CAAC;;AAGF,MAAa,OAAO,IAAI,MAAM,CAAC,UAAU;CACxC,QAAQ,UAAoC,MAAM,UAAU;CAC5D,QAAQ;CACR,CAAC;;AAGF,MAAa,OAAO,IAAI,MAAM,CAAC,UAAU;CACxC,QAAQ,UAAoC,MAAM,UAAU;CAC5D,QAAQ;CACR,CAAC"}