{"version":3,"file":"builder_code.mjs","names":[],"sources":["../../../src/contracts/deepbook_predict/builder_code.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Owns deterministic builder referral codes and the USDC fees delivered to their\n * object addresses through the funds accumulator. Codes are derived per owner and\n * index, and only the immutable owner may withdraw accumulated fees. A trade names\n * the code it pays, and its fee per contract, as a `BuilderFee`.\n */\n\nimport {\n\tMoveTuple,\n\tMoveStruct,\n\tnormalizeMoveArguments,\n\ttype RawTransactionArgument,\n} from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { U64 } from '../../bcs/integers.js';\nimport { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';\nconst $moduleName = '@local-pkg/deepbook_predict::builder_code';\nexport const BuilderCodeKey = new MoveTuple({\n\tname: `${$moduleName}::BuilderCodeKey`,\n\tfields: [bcs.Address, U64],\n});\nexport const BuilderCode = new MoveStruct({\n\tname: `${$moduleName}::BuilderCode`,\n\tfields: {\n\t\tid: bcs.Address,\n\t\towner: bcs.Address,\n\t\tindex: U64,\n\t},\n});\nexport const BuilderFee = new MoveStruct({\n\tname: `${$moduleName}::BuilderFee`,\n\tfields: {\n\t\tcode_id: bcs.Address,\n\t\tfee_per_contract: U64,\n\t},\n});\nexport interface IdArguments {\n\tcode: RawTransactionArgument<string>;\n}\nexport interface IdOptions {\n\tpackage?: string;\n\targuments: IdArguments | [code: RawTransactionArgument<string>];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Returns the code identity for trade construction and external discovery. */\nexport function id(options: IdOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['code'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'builder_code',\n\t\t\tfunction: 'id',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface NewFeeArguments {\n\tcode: RawTransactionArgument<string>;\n\tfeePerContract: RawTransactionArgument<number | bigint>;\n}\nexport interface NewFeeOptions {\n\tpackage?: string;\n\targuments:\n\t\t| NewFeeArguments\n\t\t| [\n\t\t\t\tcode: RawTransactionArgument<string>,\n\t\t\t\tfeePerContract: RawTransactionArgument<number | bigint>,\n\t\t  ];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Name `code` and its fee per contract for one trade. For PTB construction and the\n * order-flow companion, which pass it to Predict's builder admission.\n */\nexport function newFee(options: NewFeeOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, 'u64'] satisfies (string | null)[];\n\tconst parameterNames = ['code', 'feePerContract'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'builder_code',\n\t\t\tfunction: 'new_fee',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface CodeIdArguments {\n\tfee: TransactionArgument;\n}\nexport interface CodeIdOptions {\n\tpackage?: string;\n\targuments: CodeIdArguments | [fee: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Returns the code a `BuilderFee` pays, for the companion and Sessions' checks. */\nexport function codeId(options: CodeIdOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['fee'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'builder_code',\n\t\t\tfunction: 'code_id',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface FeePerContractArguments {\n\tfee: TransactionArgument;\n}\nexport interface FeePerContractOptions {\n\tpackage?: string;\n\targuments: FeePerContractArguments | [fee: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Returns a `BuilderFee`'s uncapped fee per contract, for the companion and\n * Sessions' checks.\n */\nexport function feePerContract(options: FeePerContractOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['fee'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'builder_code',\n\t\t\tfunction: 'fee_per_contract',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface OwnerArguments {\n\tcode: RawTransactionArgument<string>;\n}\nexport interface OwnerOptions {\n\tpackage?: string;\n\targuments: OwnerArguments | [code: RawTransactionArgument<string>];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Returns the immutable owner authorized to claim fees. */\nexport function owner(options: OwnerOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['code'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'builder_code',\n\t\t\tfunction: 'owner',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface IndexArguments {\n\tcode: RawTransactionArgument<string>;\n}\nexport interface IndexOptions {\n\tpackage?: string;\n\targuments: IndexArguments | [code: RawTransactionArgument<string>];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Returns the owner-selected derivation index for external discovery. */\nexport function index(options: IndexOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['code'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'builder_code',\n\t\t\tfunction: 'index',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface ClaimableBuilderFeesArguments {\n\tcode: RawTransactionArgument<string>;\n}\nexport interface ClaimableBuilderFeesOptions {\n\tpackage?: string;\n\targuments: ClaimableBuilderFeesArguments | [code: RawTransactionArgument<string>];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return visible USDC builder fees for SDK and devInspect reads. */\nexport function claimableBuilderFees(options: ClaimableBuilderFeesOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = ['0x2::accumulator::AccumulatorRoot', null] satisfies (string | null)[];\n\tconst parameterNames = ['code'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'builder_code',\n\t\t\tfunction: 'claimable_builder_fees',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface ClaimAllBuilderFeesArguments {\n\tcode: RawTransactionArgument<string>;\n}\nexport interface ClaimAllBuilderFeesOptions {\n\tpackage?: string;\n\targuments: ClaimAllBuilderFeesArguments | [code: RawTransactionArgument<string>];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Claims all settled USDC builder fees for the immutable owner; an empty\n * accumulator returns a zero coin.\n */\nexport function claimAllBuilderFees(options: ClaimAllBuilderFeesOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, '0x2::accumulator::AccumulatorRoot'] satisfies (string | null)[];\n\tconst parameterNames = ['code'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'builder_code',\n\t\t\tfunction: 'claim_all_builder_fees',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,cAAc;AACpB,MAAa,iBAAiB,IAAI,UAAU;CAC3C,MAAM,GAAG,YAAY;CACrB,QAAQ,CAAC,IAAI,SAAS,IAAI;CAC1B,CAAC;AACF,MAAa,cAAc,IAAI,WAAW;CACzC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,IAAI,IAAI;EACR,OAAO,IAAI;EACX,OAAO;EACP;CACD,CAAC;AACF,MAAa,aAAa,IAAI,WAAW;CACxC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,SAAS,IAAI;EACb,kBAAkB;EAClB;CACD,CAAC;;AAYF,SAAgB,GAAG,SAAoB;CACtC,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB,CAAC,KAAK;CAC7B,MAAM,iBAAiB,CAAC,OAAO;AAC/B,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,CAAC;;;;;;AAsBJ,SAAgB,OAAO,SAAwB;CAC9C,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB,CAAC,MAAM,MAAM;CACpC,MAAM,iBAAiB,CAAC,QAAQ,iBAAiB;AACjD,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,CAAC;;;AAaJ,SAA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