{"version":3,"file":"range_codec.mjs","names":[],"sources":["../../../src/contracts/deepbook_predict/range_codec.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Canonical strike-range codec for Predict.\n *\n * Finite strikes are absolute ticks from zero: `strike = tick * tick_size`. Ranges\n * use `(lower_tick, higher_tick)` in entrypoints, events, and order IDs. Tick zero\n * and `pos_inf_tick` are the open lower and upper sentinels. This module owns\n * conversion between those ticks and raw oracle-price coordinates; `order` owns\n * range-shape validation.\n */\n\nimport { MoveTuple, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';\nimport { U64 } from '../../bcs/integers.js';\nimport { type Transaction } from '@mysten/sui/transactions';\nconst $moduleName = '@local-pkg/deepbook_predict::range_codec';\nexport const Strike = new MoveTuple({ name: `${$moduleName}::Strike`, fields: [U64] });\nexport interface StrikeFromTickArguments {\n\ttick: RawTransactionArgument<number | bigint>;\n\ttickSize: RawTransactionArgument<number | bigint>;\n}\nexport interface StrikeFromTickOptions {\n\tpackage?: string;\n\targuments:\n\t\t| StrikeFromTickArguments\n\t\t| [\n\t\t\t\ttick: RawTransactionArgument<number | bigint>,\n\t\t\t\ttickSize: RawTransactionArgument<number | bigint>,\n\t\t  ];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Convert a boundary tick to its raw strike, including the open-end sentinels.\n * Non-sentinel ticks multiply directly by `tick_size`; public PTB and devInspect\n * callers are responsible for supplying the intended market domain.\n */\nexport function strikeFromTick(options: StrikeFromTickOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = ['u64', 'u64'] satisfies (string | null)[];\n\tconst parameterNames = ['tick', 'tickSize'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'range_codec',\n\t\t\tfunction: 'strike_from_tick',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiBA,MAAM,cAAc;AACpB,MAAa,SAAS,IAAI,UAAU;CAAE,MAAM,GAAG,YAAY;CAAW,QAAQ,CAAC,IAAI;CAAE,CAAC;;;;;;AAsBtF,SAAgB,eAAe,SAAgC;CAC9D,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB,CAAC,OAAO,MAAM;CACrC,MAAM,iBAAiB,CAAC,QAAQ,WAAW;AAC3C,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,CAAC"}