# Implementation

## Step 1 - Authorize your project

#### For testing

Use a tool such as ngrok (<https://ngrok.com/docs/http/>) to get a unique URL for your web app running locally on your device and add it to your allowlist. \
\
See: [allowlisting via the admin dashboard](/developers/sdk/classes-and-functions/authentication/allow-listing-a-domain.md).

#### For production

Add your production domain by [allowlisting it via the admin dashboard](/developers/sdk/classes-and-functions/authentication/allow-listing-a-domain.md)

## Step 2 - Packaging

The ChainVine SDK can be added to your project via the following package managers or methods

```bash
npm install @chainvine/sdk
```

Or

```bash
yarn add @chainvine/sdk
```

{% tabs %}
{% tab title="Script tag (coming soon)" %}
*Coming soon*
{% endtab %}

{% tab title="Feedback" %}
Not seeing your framework or language here? \
Let us know which one you'd like us to look into here:

{% embed url="<https://92dgagzx54m.typeform.com/to/nmMJ1EVj>" %}
{% endtab %}
{% endtabs %}

## Step 3 - Initializing the Client

```typescript
import { ChainvineClient } from '@chainvine/sdk';

const client = new ChainvineClient();
```

You may provide optional configuration parameters in order to override the [default settings of the Client](broken://pages/4DdnEIPn6ZrnRUFs7uVC).

### Examples

**For your Testing environment**

{% tabs %}
{% tab title="Node.js/JavaScript" %}

```javascript
import { ChainvineClient } from '@chainvine/sdk';

const client = new ChainvineClient({
   apiKey: 'S3CR37C0D3Z',
   testMode: true,
   logToConsole: true,
});
```

{% endtab %}
{% endtabs %}

#### For your Production environment

{% tabs %}
{% tab title="Node.js/JavaScript" %}

```javascript
import { ChainvineClient } from '@chainvine/sdk';

const client = new ChainvineClient({
   apiKey: 'S3CR37C0D3Z',
   logToConsole: true, //can also be false or ommited depending on your needs
});
```

{% endtab %}
{% endtabs %}

## Examples

The extent to which a referral program is hosted on your d(App) is up to you.  Here are some of the functions you might like to use :&#x20;

1. [Generate unique referral links](/developers/use-cases/generate-a-referrer-link.md)
2. [Log the referrer from a URL link](/developers/use-cases/link-claimer-referrer.md)
3. [Send a custom amount-based referral conversion](/developers/use-cases/record-a-transfer-event.md)
4. [Send a custom once-off referral conversion](/developers/use-cases/complete-a-requirement.md)
5. [Record a link click](/developers/use-cases/record-link-click.md)
6. [Cookie management](/developers/use-cases/leverage-cookies.md)


---

# 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://docs.chainvine.xyz/developers/sdk/implementation.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.
