> For the complete documentation index, see [llms.txt](/llms.txt)

# Using the manager

Use the TransferPolicyTransaction manager to add rules and withdraw profits.



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?: string | bigint)`

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

`amount` is optional. Leave empty to withdraw all profits.

```typescript
// ... 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_000n);
```

### 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(percentageBps: number | string, minAmount: number | string)`

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(percentageBps, minAmount)**. Use 0 for no minimum amount.

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

You can remove the rule by calling:

```typescript
tpTx.removeRoyaltyRule();
```

#### Kiosk lock rule

`addLockRule()`

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

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

You can remove the rule by calling:

```typescript
tpTx.removeLockRule();
```

#### Personal kiosk rule

`addPersonalKioskRule()`

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

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

You can remove the rule by calling:

```typescript
tpTx.removePersonalKioskRule();
```

#### Floor price rule

`addFloorPriceRule(minPrice: string | bigint)`

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

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

You can remove the rule by calling:

```typescript
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:

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