Kiosk SDK
Kiosk Client
Transfer Policy Transaction
Supported Functionality

How to use

After following the introduction steps on how to initialize a transfer policy transaction you can call any of the available functions to prepare your Programmable Transaction Block (PTB).

Available functions

Withdraw profits

withdraw(address: string, amount?: bigint | number)

After setting up the manager, you can withdraw profits from the specified transfer policy.

amount is optional. Leave empty to withdraw all profits.

// ... tp transaction is initialized and policy is set.
// Withdraw 10 SUI from the policy. Leave last parameter empty to withdraw all profits.
tpTx.withdraw('address_to_transfer_coin', 10_000_000_000);

Add/Remove rules

You can chain the actions when you're calling them, to add multiple rules.

After setting up the transaction, you can add any of the supported rules to the policy.

Royalty rule

addRoyaltyRule(percentage, minAmount)

You can add the royalty rule like the following example.

percentageToBasisPoints is a helper to convert a percentage (0.00-100%) to basis points.

Use minAmount to set a minimum amount per transaction, so that the royalty paid is MAX(percentage, min_amount). Use 0 for no minimum amount.

// ... tp transaction is initialized and policy is set.
tpTx.addRoyaltyRule(percentageToBasisPoints(30), 1_000_000_000);

You can remove the rule by calling:

tpTx.removeRoyaltyRule();

Kiosk lock rule

addLockRule()

You can add the kiosk lock rule like the following example.

// ... tp transaction is initialized and policy is set.
tpTx.addLockRule();

You can remove the rule by calling:

tpTx.removeLockRule();

Personal kiosk rule

addPersonalKioskRule()

You can add the kiosk lock rule like the following example.

// ... tp transaction is initialized and policy is set.
tpTx.addPersonalKioskRule();

You can remove the rule by calling:

tpTx.removePersonalKioskRule();

Floor price rule

addFloorPriceRule(price)

You can add the floor price rule like the following example:

// ... tp transaction is initialized and policy is set.
tpTx.addFloorPriceRule(10_000_000_000); // sets 10 SUI as the floor price.

You can remove the rule by calling:

tpTx.removeFloorPriceRule();

Updating rules

If you want to update a rule, call the remove... function, and then call add again with the new settings.

Example:

// ... tp transaction is initialized and policy is set.
tpTx.removeRoyaltyRule().addRoyaltyRule(percentageToBasisPoints(20), 1_000_000_000);