@mysten/suins
Version:
51 lines (49 loc) • 1.66 kB
JavaScript
import { MoveTuple, normalizeMoveArguments } from "../utils/index.mjs";
import { bcs } from "@mysten/sui/bcs";
//#region src/contracts/suins_discounts/discounts.ts
/**************************************************************
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
**************************************************************/
/**
* A module that allows purchasing names in a different price by presenting a
* reference of type T. Each `T` can have a separate configuration for a discount
* percentage. If a `T` doesn't exist, registration will fail.
*
* Can be called only when promotions are active for a specific type T. Activation
* / deactivation happens through PTBs.
*/
const $moduleName = "@suins/discounts::discounts";
const RegularDiscountsApp = new MoveTuple({
name: `${$moduleName}::RegularDiscountsApp`,
fields: [bcs.bool()]
});
const DiscountKey = new MoveTuple({
name: `${$moduleName}::DiscountKey<phantom T>`,
fields: [bcs.bool()]
});
/** A function to register a name with a discount using type `T`. */
function applyPercentageDiscount(options) {
const packageAddress = options.package ?? "@suins/discounts";
const argumentsTypes = [
null,
null,
null,
`${options.typeArguments[0]}`
];
const parameterNames = [
"self",
"intent",
"suins",
"_"
];
return (tx) => tx.moveCall({
package: packageAddress,
module: "discounts",
function: "apply_percentage_discount",
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
typeArguments: options.typeArguments
});
}
//#endregion
export { applyPercentageDiscount };
//# sourceMappingURL=discounts.mjs.map