Protected
constructorClaims a subscription for a given subscriber.
The parameters for claiming a subscription.
This function creates a discount for a subscription and returns the transaction ID.
The parameters for creating a discount.
A promise that resolves to an object containing the transaction ID.
This method is utilized to initiate a subscription. It accepts a subscriber as an argument and returns a promise that resolves to an object containing the transaction ID and subscription ID.
The parameters for creating a subscription.
A promise that resolves to an object containing the transaction ID and subscription ID.
The parameters for deleting a subscription.
A promise that resolves to an object containing the transaction ID.
This method is utilized to deactivate the application by updating the lifecycle. It should be invoked prior to the deletion of the application. Once deactivated, the product will cease to allow new subscriptions to be purchased, and existing subscribers will only have the option to cancel their subscriptions. The product can be deleted once all subscriptions have been cancelled or have expired. The method returns the transaction ID.
A promise that resolves to an object containing the transaction ID.
Retrieves the current state of the application. Returns an object containing various details about the product such as product name, subscription name, manager, price, total subscriptions, maximum subscriptions, coin ID, subscription type, lifecycle, creation time, oracle ID, unit name, image URL, and discount.
Specifies whether to parse the whole units (default is true).
A promise that resolves to an object representing the current state of the application.
This method retrieves the discount based on a given duration. It accepts a duration object as an argument and returns a promise that resolves to a DiscountRecord.
A promise that resolves to the discount record.
This method calculates the locker creation fee. It requires the creator's address as an input and returns a promise that resolves to the calculated fee amount.
The address of the locker's creator.
A promise that resolves to the calculated locker creation fee.
This method is used to get a subscription. It takes an AlgodClient and a subscriber address as arguments and returns a promise that resolves to a SubscriptionRecord.
The parameters for retrieving a subscription.
A promise that resolves to a SubscriptionRecord.
Checks if a given address is a subscriber.
The parameters for checking if an address is a subscriber.
Transfers a subscription from one subscriber to another.
The parameters for transferring a subscription.
A promise that resolves to an object containing the transaction ID of the transfer operation.
Protected
updateThis method is used to update the lifecycle state of the application. The method returns the transaction ID.
The parameters for updating the lifecycle state.
A promise that resolves to an object containing the transaction ID.
Static
initInitializes a SubtopiaClient instance. Retrieves the product's global state, validates it, and creates a new SubtopiaClient.
The parameters for initializing the client.
Promise resolving to a SubtopiaClient instance.
The
SubtopiaClient
class is responsible for interacting with a Subtopia Product contracts on the Algorand blockchain. It provides methods for initializing the client, managing the lifecycle of the application, creating and managing subscriptions, and retrieving information about the application and subscriptions.