# Portal Swap SDK Overview

[*This document is for informational purposes only. It is a specification of a product that is under active development and should be expected to change. It does not provide any guarantees or warranties as to how the final product will operate.*](#user-content-fn-1)[^1]

The Portal SDK packages classes presenting simple yet powerful interfaces to the Portal DEX, to wallets, and for crypto-asset management in general. This document describes the initial version of the Portal SDK used for interfacing with the Portal DEX to execute swaps of crypto-assets.

The SDK is avilable as a Javascript module that can be imported into browser or server (e.g. node.js) environments:

```javascript
npm install '@portaldefi/sdk'
import SDK from '@portaldefi/sdk'
```

The `SDK` module exports a single function which must be executed in order to access any capabilities of the SDK:

```javascript
const dex = SDK.init( config )
```

<mark style="color:blue;">`config`</mark> is an Object with format:

```json
{
   network: {
      hostname: String,
      port: Number
   },
   blockchains: {
      bitcoind: Object,
      geth: Object,
      lnd: Object
   },
   swaps: Object
}
```

<mark style="color:yellow;">`SDK.init()`</mark> returns an instance of the DEX class representing a connection to a particular instance of the Portal DEX network for a particular user. The interface of the DEX class is specified in the next section.

<mark style="color:yellow;">`SDK.init()`</mark> will throw an exception if there are any errors in <mark style="color:blue;">`config`</mark> or any errors connecting to the network - thus it is advisable to call this function in a try/catch block.

[^1]:


---

# 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.portaldefi.com/portal-swap-sdk-overview.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.
