UNPKG

@mysten/suins

Version:
106 lines (105 loc) 4.18 kB
import type { Transaction, TransactionObjectArgument, TransactionObjectInput } from '@mysten/sui/transactions'; import type { SuinsClient } from './suins-client.js'; import type { DiscountInfo, ReceiptParams, RegistrationParams, RenewalParams } from './types.js'; export declare class SuinsTransaction { suinsClient: SuinsClient; transaction: Transaction; constructor(client: SuinsClient, transaction: Transaction); /** * Registers a domain for a number of years. */ register(params: RegistrationParams): TransactionObjectArgument; /** * Renews an NFT for a number of years. */ renew(params: RenewalParams): void; initRegistration(domain: string): TransactionObjectArgument; initRenewal(nft: TransactionObjectInput, years: number): TransactionObjectArgument; calculatePrice(baseAmount: TransactionObjectArgument, paymentType: string, priceInfoObjectId: string): TransactionObjectArgument; handleBasePayment(paymentIntent: TransactionObjectArgument, payment: TransactionObjectArgument, paymentType: string): TransactionObjectArgument; handlePayment(paymentIntent: TransactionObjectArgument, payment: TransactionObjectArgument, paymentType: string, priceInfoObjectId: string, maxAmount?: bigint): TransactionObjectArgument; finalizeRegister(receipt: TransactionObjectArgument): TransactionObjectArgument; finalizeRenew(receipt: TransactionObjectArgument, nft: TransactionObjectInput): TransactionObjectArgument; calculatePriceAfterDiscount(paymentIntent: TransactionObjectArgument, paymentType: string): TransactionObjectArgument; generateReceipt(params: ReceiptParams): TransactionObjectArgument; /** * Applies a coupon to the payment intent. */ applyCoupon(intent: TransactionObjectArgument, couponCode: string): TransactionObjectArgument; /** * Applies a discount to the payment intent. */ applyDiscount(intent: TransactionObjectArgument, discountInfo: DiscountInfo): void; /** * Creates a subdomain. */ createSubName({ parentNft, name, expirationTimestampMs, allowChildCreation, allowTimeExtension, }: { parentNft: TransactionObjectInput; name: string; expirationTimestampMs: number; allowChildCreation: boolean; allowTimeExtension: boolean; }): import("@mysten/sui/transactions").TransactionResult; /** * Builds the PTB to create a leaf subdomain. * Parent can be a `SuinsRegistration` or a `SubDomainRegistration` object. * Can be passed in as an ID or a TransactionArgument. */ createLeafSubName({ parentNft, name, targetAddress, }: { parentNft: TransactionObjectInput; name: string; targetAddress: string; }): void; /** * Removes a leaf subname. */ removeLeafSubName({ parentNft, name }: { parentNft: TransactionObjectInput; name: string; }): void; /** * Sets the target address of an NFT. */ setTargetAddress({ nft, // Can be string or argument address, isSubname, }: { nft: TransactionObjectInput; address?: string; isSubname?: boolean; }): void; /** * Sets a default name for the user. */ setDefault(name: string): void; /** * Edits the setup of a subname. */ editSetup({ parentNft, name, allowChildCreation, allowTimeExtension, }: { parentNft: TransactionObjectInput; name: string; allowChildCreation: boolean; allowTimeExtension: boolean; }): void; /** * Extends the expiration of a subname. */ extendExpiration({ nft, expirationTimestampMs, }: { nft: TransactionObjectInput; expirationTimestampMs: number; }): void; /** * Sets the user data of an NFT. */ setUserData({ nft, value, key, isSubname, }: { nft: TransactionObjectInput; value: string; key: string; isSubname?: boolean; }): void; /** * Burns an expired NFT to collect storage rebates. */ burnExpired({ nft, isSubname }: { nft: TransactionObjectInput; isSubname?: boolean; }): void; }