{"version":3,"file":"pool.mjs","names":["plp.plpTotalSupply","plp.idleBalance","plp.supplyRequestsPending","plp.withdrawRequestsPending"],"sources":["../../../src/predict/reads/pool.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport { Transaction } from '@mysten/sui/transactions';\nimport { type GeneratedConfig } from '../config/generated.js';\nimport * as plp from '../../contracts/deepbook_predict/plp.js';\nimport { inspectReturns, type ReadClient } from './inspect.js';\nimport { parseU64LE } from './parse.js';\n\nexport interface PoolStats {\n\tplpTotalSupply: bigint;\n\tidleBalance: bigint;\n\tsupplyRequestsPending: bigint;\n\twithdrawRequestsPending: bigint;\n}\n\n// The pool's four u64 vault stats batched into one PTB (command order fixed below).\n// `plp::{plp_total_supply, idle_balance, supply_requests_pending,\n// withdraw_requests_pending}(vault)` — see\n// packages/predict/sources/plp/plp.move:{164,149,169,174}.\nexport async function poolStats(client: ReadClient, config: GeneratedConfig): Promise<PoolStats> {\n\tconst tx = new Transaction();\n\tfor (const fn of [\n\t\tplp.plpTotalSupply,\n\t\tplp.idleBalance,\n\t\tplp.supplyRequestsPending,\n\t\tplp.withdrawRequestsPending,\n\t]) {\n\t\ttx.add(fn({ config }));\n\t}\n\tconst cmds = await inspectReturns(client, tx);\n\treturn {\n\t\tplpTotalSupply: parseU64LE(cmds[0][0]),\n\t\tidleBalance: parseU64LE(cmds[1][0]),\n\t\tsupplyRequestsPending: parseU64LE(cmds[2][0]),\n\t\twithdrawRequestsPending: parseU64LE(cmds[3][0]),\n\t};\n}\n"],"mappings":";;;;;;AAmBA,eAAsB,UAAU,QAAoB,QAA6C;CAChG,MAAM,KAAK,IAAI,aAAa;AAC5B,MAAK,MAAM,MAAM;EAChBA;EACAC;EACAC;EACAC;EACA,CACA,IAAG,IAAI,GAAG,EAAE,QAAQ,CAAC,CAAC;CAEvB,MAAM,OAAO,MAAM,eAAe,QAAQ,GAAG;AAC7C,QAAO;EACN,gBAAgB,WAAW,KAAK,GAAG,GAAG;EACtC,aAAa,WAAW,KAAK,GAAG,GAAG;EACnC,uBAAuB,WAAW,KAAK,GAAG,GAAG;EAC7C,yBAAyB,WAAW,KAAK,GAAG,GAAG;EAC/C"}