# Action Module

## Flow

<figure><img src="/files/zc8bR8u1fMNdSbSTZWh7" alt=""><figcaption><p>Action Flow</p></figcaption></figure>

## Types

### Assets

```typescript
export type Nft = {
  collection: string
  tokenId: string
}
```

### Signature

```typescript
export type Signature = {
  data: object
  signature: { v: number; r: string; s: string; deadline: number }
}

/* data object
interface SignAction {
  loan: SignLoanConfig;
  assets: string[];
  underlyingAsset: string;
  nonce: BigInt;
  deadline: BigInt;
}

interface SignLoanConfig {
  loanId: string;
  aggLoanPrice: BigInt;
  aggLtv: BigInt;
  aggLiquidationThreshold: BigInt;
  totalAssets: BigInt;
  nonce: BigInt;
  deadline: BigInt;
}
*/
```

### ClientOptions

```typescript
export type ClientOptions = {
  network?: Chain
}

export type Chain = 'mainnet' | 'sepolia' | 'localhost'
```

***

## Functions

### Borrowing Assets

To borrow assets using the SDK, use the `borrow` function from the `action` module:

<pre class="language-typescript"><code class="lang-typescript"><strong>export const borrow = async (
</strong><strong>        amount: BigInt, 
</strong><strong>        assets: Array&#x3C;Nft>, 
</strong><strong>        signature: Signature, 
</strong><strong>        options?: ClientOptions
</strong><strong>    )
</strong></code></pre>

```typescript
const result = await borrow(amount, assets[], signature, options?);
```

### Repaying Loans

To repay a borrowed loan, use the `repay` function from the `action` module:

```typescript
export const repay = async (
        amount: BigInt, 
        signature: Signature, 
        options?: ClientOptions
    )
```

```typescript
const result = await repay(amount, signature, options?);
```

***

Refer to the Action Module documentation for more details on the `borrow` and `repay` functions.

{% content-ref url="/pages/hnXwWgQd5bRcF7bJjAlG" %}
[Broken mention](broken://pages/hnXwWgQd5bRcF7bJjAlG)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sdk.unlockd.finance/getting-started/sdk-modules/action-module.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
