Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: first draft for the v4 sdk tech reference, overview tbd #858

Merged
merged 7 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/sdk/core/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "Core SDK",
"position": 4,
"position": 5,
"collapsed": true
}
2 changes: 1 addition & 1 deletion docs/sdk/swap-widget/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "Swap Widget",
"position": 2,
"position": 3,
"collapsed": true
}
4 changes: 2 additions & 2 deletions docs/sdk/v1/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "v1 SDK",
"position": 6,
"label": "V1 SDK",
"position": 7,
"collapsed": true
}
4 changes: 2 additions & 2 deletions docs/sdk/v2/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "v2 SDK",
"position": 5,
"label": "V2 SDK",
"position": 6,
"collapsed": true
}
6 changes: 3 additions & 3 deletions docs/sdk/v3/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "v3 SDK",
"position": 1,
"collapsed": false
"label": "V3 SDK",
"position": 2,
"collapsed": true
}
5 changes: 5 additions & 0 deletions docs/sdk/v4/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "V4 SDK",
"position": 1,
"collapsed": false
}
34 changes: 34 additions & 0 deletions docs/sdk/v4/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
id: overview
sidebar_position: 1
title: Overview
---

# The Uniswap v4 SDK

> **Welcome to the v4 Uniswap SDK!**

The Uniswap v4 SDK provides abstractions to assist you with interacting with the Uniswap v4 smart contracts in a Typescript/Javascript environment (e.g. websites, node scripts). It makes uses of the [**Core SDK**](../core/overview.md) to gain access to abstractions that are common amongst the Uniswap SDKs. With the SDK, you can add/remove liquidity, collect fees like what you will usually do with v3 SDK, but more with the extra functionalities from hook introduced in v4!

For complete documentation of the SDK's offerings, see the [**Technical Reference**](./reference/overview.md).

## Installation

To interact with the v4 SDK we recommend installing though npm:

```bash
npm i --save @uniswap/v4-sdk
npm i --save @uniswap/sdk-core
```

## Developer Links

- [**v4 SDK Github Repo**](https://github.com/Uniswap/sdks/tree/main/sdks/v4-sdk)
- [**Core SDK Github Repo**](https://github.com/Uniswap/sdk-core)
- [**v4 SDK NPM Package**](https://www.npmjs.com/package/@uniswap/v4-sdk)

[![Unit Tests](https://github.com/Uniswap/uniswap-v3-sdk/workflows/Unit%20Tests/badge.svg)](https://github.com/Uniswap/sdks/actions?query=workflow%3A%22%22Code+Quality+Checks%22%22++)
[![Lint](https://github.com/Uniswap/uniswap-v3-sdk/workflows/Lint/badge.svg)](https://github.com/Uniswap/sdks/actions?query=workflow%3A%22%22Code+Quality+Checks%22%22++)
[![npm version](https://img.shields.io/npm/v/@uniswap/v4-sdk/latest.svg)](https://www.npmjs.com/package/@uniswap/v4-sdk/v/latest)
[![npm bundle size (scoped version)](https://img.shields.io/bundlephobia/minzip/@uniswap/v4-sdk/latest.svg)](https://bundlephobia.com/result?p=@uniswap/v4-sdk@latest)
[![Discord](https://img.shields.io/badge/discord-join%20chat-blue.svg)](https://discord.com/channels/597638925346930701/607978109089611786)
5 changes: 5 additions & 0 deletions docs/sdk/v4/reference/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "Technical Reference",
"position": 3,
"collapsed": true
}
122 changes: 122 additions & 0 deletions docs/sdk/v4/reference/classes/Hook.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
[@uniswap/v4-sdk](../overview.md) / Hook

Defined in: [utils/hook.ts:40](https://github.com/Uniswap/sdks/blob/9cf6edb2df79338ae58f7ea7ca979c35a8a9bd56/sdks/v4-sdk/src/utils/hook.ts#L40)

## Constructors

### new Hook()

> **new Hook**(): [`Hook`](Hook.md)

#### Returns

[`Hook`](Hook.md)

## Methods

### hasDonatePermissions()

> `static` **hasDonatePermissions**(`address`): `boolean`

Defined in: [utils/hook.ts:91](https://github.com/Uniswap/sdks/blob/9cf6edb2df79338ae58f7ea7ca979c35a8a9bd56/sdks/v4-sdk/src/utils/hook.ts#L91)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `address` | `string` |

#### Returns

`boolean`

***

### hasInitializePermissions()

> `static` **hasInitializePermissions**(`address`): `boolean`

Defined in: [utils/hook.ts:66](https://github.com/Uniswap/sdks/blob/9cf6edb2df79338ae58f7ea7ca979c35a8a9bd56/sdks/v4-sdk/src/utils/hook.ts#L66)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `address` | `string` |

#### Returns

`boolean`

***

### hasLiquidityPermissions()

> `static` **hasLiquidityPermissions**(`address`): `boolean`

Defined in: [utils/hook.ts:74](https://github.com/Uniswap/sdks/blob/9cf6edb2df79338ae58f7ea7ca979c35a8a9bd56/sdks/v4-sdk/src/utils/hook.ts#L74)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `address` | `string` |

#### Returns

`boolean`

***

### hasPermission()

> `static` **hasPermission**(`address`, `hookOption`): `boolean`

Defined in: [utils/hook.ts:61](https://github.com/Uniswap/sdks/blob/9cf6edb2df79338ae58f7ea7ca979c35a8a9bd56/sdks/v4-sdk/src/utils/hook.ts#L61)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `address` | `string` |
| `hookOption` | [`HookOptions`](../enumerations/HookOptions.md) |

#### Returns

`boolean`

***

### hasSwapPermissions()

> `static` **hasSwapPermissions**(`address`): `boolean`

Defined in: [utils/hook.ts:85](https://github.com/Uniswap/sdks/blob/9cf6edb2df79338ae58f7ea7ca979c35a8a9bd56/sdks/v4-sdk/src/utils/hook.ts#L85)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `address` | `string` |

#### Returns

`boolean`

***

### permissions()

> `static` **permissions**(`address`): [`HookPermissions`](../overview.md#hookpermissions)

Defined in: [utils/hook.ts:41](https://github.com/Uniswap/sdks/blob/9cf6edb2df79338ae58f7ea7ca979c35a8a9bd56/sdks/v4-sdk/src/utils/hook.ts#L41)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `address` | `string` |

#### Returns

[`HookPermissions`](../overview.md#hookpermissions)
Loading