@bitflowlabs/core-sdk 2.4.0 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -36
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# Bitflow SDK
|
|
2
2
|
|
|
3
|
-
Bitflow SDK is a powerful and easy-to-use library for interacting with the Bitflow Protocol. It provides a set of tools to seamlessly integrate Bitflow functionality into your applications.
|
|
3
|
+
Bitflow SDK is a powerful and easy-to-use library for interacting with the Bitflow Protocol. It provides a set of tools to seamlessly integrate Bitflow functionality into your applications.
|
|
4
|
+
|
|
5
|
+
All Bitflow API endpoints are **publicly accessible without an API key**. Unauthenticated requests are subject to a default rate limit of **500 requests per minute per IP**.
|
|
6
|
+
|
|
7
|
+
If your integration requires higher limits, see the [Rate Limit Request](#rate-limit-request) section to email **help@bitflow.finance** with a pre-filled form. You can also reach the team on [Discord](https://discord.gg/DY4yNyHyhT).
|
|
4
8
|
|
|
5
9
|
# Table of Contents
|
|
6
10
|
|
|
7
|
-
- [Bitflow SDK](#@bitflowlabs/core-sdk)
|
|
8
|
-
- [Table of Contents](#table-of-contents)
|
|
9
11
|
- [Installation](#installation)
|
|
10
|
-
- [Configuration](#configuration)
|
|
11
12
|
- [Usage](#usage)
|
|
13
|
+
- [Environment Variables](#environment-variables)
|
|
12
14
|
- [Available Functions](#available-functions)
|
|
13
15
|
- [Get Available Tokens](#get-available-tokens)
|
|
14
16
|
- [Get Possible Swaps](#get-possible-swaps)
|
|
@@ -19,6 +21,7 @@ Bitflow SDK is a powerful and easy-to-use library for interacting with the Bitfl
|
|
|
19
21
|
- [Executing Swap (uses `@stacks/connect`)](#executing-swap-uses-stacksconnect)
|
|
20
22
|
- [Types](#types)
|
|
21
23
|
- [Troubleshooting](#troubleshooting)
|
|
24
|
+
- [Rate Limit Request](#rate-limit-request)
|
|
22
25
|
- [License](#license)
|
|
23
26
|
|
|
24
27
|
# Installation
|
|
@@ -29,29 +32,6 @@ Install the Bitflow SDK using npm:
|
|
|
29
32
|
npm install @bitflowlabs/core-sdk
|
|
30
33
|
```
|
|
31
34
|
|
|
32
|
-
**Latest Stable Version is 2.4.0**
|
|
33
|
-
|
|
34
|
-
# Configuration
|
|
35
|
-
|
|
36
|
-
Before using the Bitflow SDK, you need to set up your environment variables. Create a `.env` file in your project root with the following variables:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
# will be provided by Bitflow
|
|
40
|
-
BITFLOW_API_HOST=https://example-api-host.com
|
|
41
|
-
# will be provided by Bitflow
|
|
42
|
-
BITFLOW_API_KEY=<your_api_key_here>
|
|
43
|
-
# your provider address
|
|
44
|
-
BITFLOW_PROVIDER_ADDRESS=<your_provider_address_here>
|
|
45
|
-
# will be provided by Bitflow or can be your own Stacks Node
|
|
46
|
-
READONLY_CALL_API_HOST=https://example-readonly-api.com
|
|
47
|
-
# will be provided by Bitflow or can be your own Stacks Node
|
|
48
|
-
READONLY_CALL_API_KEY=<your_readonly_api_key_here>
|
|
49
|
-
# will be provided by Bitflow
|
|
50
|
-
KEEPER_API_HOST=https://example-keeper-api.com
|
|
51
|
-
# will be provided by Bitflow
|
|
52
|
-
KEEPER_API_KEY=<your_keeper_api_key_here>
|
|
53
|
-
```
|
|
54
|
-
|
|
55
35
|
# Usage
|
|
56
36
|
|
|
57
37
|
Here's a step-by-step guide to implement the Bitflow SDK in your project:
|
|
@@ -64,20 +44,48 @@ import { BitflowSDK } from '@bitflowlabs/core-sdk';
|
|
|
64
44
|
|
|
65
45
|
2. Initialize the SDK:
|
|
66
46
|
|
|
47
|
+
If no parameters are provided, the SDK will use the environment variables. See the [Environment Variables](#environment-variables) section for more details.
|
|
48
|
+
|
|
67
49
|
```ts
|
|
68
|
-
//
|
|
50
|
+
// API keys are optional — omit them to use the default public rate limits.
|
|
69
51
|
const bitflow = new BitflowSDK({
|
|
70
|
-
BITFLOW_API_HOST:
|
|
71
|
-
BITFLOW_API_KEY: string,
|
|
52
|
+
BITFLOW_API_HOST: 'https://bitflowsdk-api-test-7owjsmt8.uk.gateway.dev',
|
|
53
|
+
// optional: BITFLOW_API_KEY: string,
|
|
72
54
|
BITFLOW_PROVIDER_ADDRESS: string,
|
|
73
|
-
READONLY_CALL_API_HOST:
|
|
74
|
-
READONLY_CALL_API_KEY: string,
|
|
75
|
-
KEEPER_API_HOST:
|
|
76
|
-
KEEPER_API_KEY: string
|
|
55
|
+
READONLY_CALL_API_HOST: 'https://node.bitflowapis.finance',
|
|
56
|
+
// optional: READONLY_CALL_API_KEY: string,
|
|
57
|
+
KEEPER_API_HOST: 'https://bitflow-keeper-test-7owjsmt8.uc.gateway.dev',
|
|
58
|
+
// optional: KEEPER_API_KEY: string,
|
|
77
59
|
});
|
|
78
60
|
```
|
|
79
61
|
|
|
80
|
-
3. Use the SDK methods to interact with the Bitflow Protocol.
|
|
62
|
+
3. Use the SDK methods to interact with the Bitflow Protocol. See the [Available Functions](#available-functions) section for more details.
|
|
63
|
+
|
|
64
|
+
## Environment Variables
|
|
65
|
+
|
|
66
|
+
If no options are provided when initializing the SDK, it will use the environment variables.
|
|
67
|
+
|
|
68
|
+
Create a `.env` file in your project root with the following variables:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Bitflow Core API — publicly accessible, no key required
|
|
72
|
+
BITFLOW_API_HOST=https://bitflowsdk-api-test-7owjsmt8.uk.gateway.dev
|
|
73
|
+
# Optional: API key for higher rate limits (see Rate Limit Request section below)
|
|
74
|
+
BITFLOW_API_KEY=<your_api_key_here>
|
|
75
|
+
|
|
76
|
+
# Your provider address
|
|
77
|
+
BITFLOW_PROVIDER_ADDRESS=<your_provider_address_here>
|
|
78
|
+
|
|
79
|
+
# Stacks Node — publicly accessible, no key required
|
|
80
|
+
READONLY_CALL_API_HOST=https://node.bitflowapis.finance
|
|
81
|
+
# Optional: API key for higher rate limits
|
|
82
|
+
READONLY_CALL_API_KEY=<your_readonly_api_key_here>
|
|
83
|
+
|
|
84
|
+
# Keeper API — publicly accessible, no key required
|
|
85
|
+
KEEPER_API_HOST=https://bitflow-keeper-test-7owjsmt8.uc.gateway.dev
|
|
86
|
+
# Optional: API key for higher rate limits
|
|
87
|
+
KEEPER_API_KEY=<your_keeper_api_key_here>
|
|
88
|
+
```
|
|
81
89
|
|
|
82
90
|
# Available Functions
|
|
83
91
|
|
|
@@ -152,7 +160,7 @@ const swapParams = await bitflow.getSwapParams(
|
|
|
152
160
|
senderAddress,
|
|
153
161
|
slippageTolerance
|
|
154
162
|
);
|
|
155
|
-
console.log(swapParams);
|
|
163
|
+
console.log(swapParams); // Use this parameters to build your swap transaction
|
|
156
164
|
```
|
|
157
165
|
|
|
158
166
|
## Executing Swap (uses `@stacks/connect`)
|
|
@@ -212,6 +220,25 @@ If you encounter any issues while using the Bitflow SDK, please check the follow
|
|
|
212
220
|
2. Make sure you have the latest version of the SDK installed.
|
|
213
221
|
3. Check that you're using a valid Stacks address for the senderAddress parameter.
|
|
214
222
|
|
|
223
|
+
# Rate Limit Request
|
|
224
|
+
|
|
225
|
+
If your integration needs more than **500 requests per minute per IP**, click the link below to open a pre-filled email in your mail client:
|
|
226
|
+
|
|
227
|
+
**[Request higher rate limits](mailto:help@bitflow.finance?subject=API%20Rate%20Limit%20Increase%20Request%20-%20%5BYour%20Project%20Name%5D&body=Hi%20Bitflow%20team%2C%0D%0A%0D%0AI%27m%20integrating%20the%20Bitflow%20SDK%20and%20would%20like%20to%20request%20an%20API%20key%20with%20increased%20rate%20limits.%0D%0A%0D%0AProject%20%2F%20Application%20name%3A%20%5Be.g.%20MyDeFi%20App%5D%0D%0ABrief%20description%3A%20%5BWhat%20your%20app%20does%20and%20how%20it%20uses%20the%20Bitflow%20API%5D%0D%0AWebsite%20%2F%20repo%20%28if%20public%29%3A%20%5BURL%20or%20N%2FA%5D%0D%0A%0D%0AAPIs%20I%20need%20higher%20limits%20for%20%28delete%20as%20applicable%29%3A%0D%0A-%20Bitflow%20Core%20API%20%28bitflow-sdk-api-gateway-7owjsmt8.uc.gateway.dev%29%0D%0A-%20Keeper%20API%20%28bitflow-keeper-7owjsmt8.uc.gateway.dev%29%0D%0A-%20Stacks%20Node%20%28node.bitflowapis.finance%29%0D%0A%0D%0AExpected%20request%20volume%3A%20%5Be.g.%20~2%2C000%20requests%2Fminute%20during%20peak%20hours%5D%0D%0A%0D%0AUse%20case%3A%20%5Be.g.%20Server-side%20data%20aggregation%2C%20real-time%20price%20feeds%20for%20N%20users%5D%0D%0A%0D%0AContact%20name%3A%20%5BYour%20name%5D%0D%0ADiscord%20handle%20%28optional%29%3A%20%5Be.g.%20%40yourhandle%5D%0D%0A%0D%0AThanks!)**
|
|
228
|
+
|
|
229
|
+
> If the link doesn't open your mail client, email **help@bitflow.finance** with the subject `API Rate Limit Increase Request` and include the following:
|
|
230
|
+
|
|
231
|
+
- **Project / Application name** — e.g. MyDeFi App
|
|
232
|
+
- **Brief description** — What your app does and how it uses the Bitflow API
|
|
233
|
+
- **Website / repo (if public)** — URL or N/A
|
|
234
|
+
- **APIs you need higher limits for** — Core API, Keeper API, Stacks Node (or all)
|
|
235
|
+
- **Expected request volume** — e.g. ~2,000 requests/minute during peak hours
|
|
236
|
+
- **Use case** — e.g. Server-side data aggregation, real-time price feeds for N users
|
|
237
|
+
- **Contact name**
|
|
238
|
+
- **Discord handle** (optional)
|
|
239
|
+
|
|
240
|
+
We aim to respond within 2 business days. For urgent requests, reach out on [Discord](https://discord.gg/DY4yNyHyhT).
|
|
241
|
+
|
|
215
242
|
# License
|
|
216
243
|
|
|
217
244
|
This project is licensed under the MIT License - see the LICENSE file for details.
|