# Buy Now Module

<figure><img src="https://2398861552-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBIiwmyAPmsS6IKhOGacE%2Fuploads%2F5aM7gIl9ZRl6mG5n4PrD%2FbuyNow.jpg?alt=media&#x26;token=eab9a4f7-e6f5-4f85-8d6d-a9de1c7a3a00" alt=""><figcaption><p>BuyNow flow</p></figcaption></figure>

## Types

### Signature

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

/* data object
interface SignBuyNow {
  asset: SignAsset;
  assetLtv: BigInt;
  assetLiquidationThreshold: BigInt;
  from: string;
  to: string;
  data: string;
  value: BigInt;
  marketAdapter: string;
  marketApproval: string;
  marketPrice: BigInt;
  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

### Buying an Asset

To buy an asset instantly, use the `buy` function from the `buyNow` module:

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

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

Refer to the Buy Now Module documentation for more details on the `buy` function.
