@bitflowlabs/core-sdk 2.4.0 → 2.4.1
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 +43 -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, use the [rate limit request template](./RATE_LIMIT_REQUEST.md) 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)
|
|
@@ -29,29 +31,6 @@ Install the Bitflow SDK using npm:
|
|
|
29
31
|
npm install @bitflowlabs/core-sdk
|
|
30
32
|
```
|
|
31
33
|
|
|
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
34
|
# Usage
|
|
56
35
|
|
|
57
36
|
Here's a step-by-step guide to implement the Bitflow SDK in your project:
|
|
@@ -64,20 +43,48 @@ import { BitflowSDK } from '@bitflowlabs/core-sdk';
|
|
|
64
43
|
|
|
65
44
|
2. Initialize the SDK:
|
|
66
45
|
|
|
46
|
+
If no parameters are provided, the SDK will use the environment variables. See the [Environment Variables](#environment-variables) section for more details.
|
|
47
|
+
|
|
67
48
|
```ts
|
|
68
|
-
//
|
|
49
|
+
// API keys are optional — omit them to use the default public rate limits.
|
|
69
50
|
const bitflow = new BitflowSDK({
|
|
70
|
-
BITFLOW_API_HOST:
|
|
71
|
-
BITFLOW_API_KEY: string,
|
|
51
|
+
BITFLOW_API_HOST: 'https://bitflowsdk-api-test-7owjsmt8.uk.gateway.dev',
|
|
52
|
+
// optional: BITFLOW_API_KEY: string,
|
|
72
53
|
BITFLOW_PROVIDER_ADDRESS: string,
|
|
73
|
-
READONLY_CALL_API_HOST:
|
|
74
|
-
READONLY_CALL_API_KEY: string,
|
|
75
|
-
KEEPER_API_HOST:
|
|
76
|
-
KEEPER_API_KEY: string
|
|
54
|
+
READONLY_CALL_API_HOST: 'https://node.bitflowapis.finance',
|
|
55
|
+
// optional: READONLY_CALL_API_KEY: string,
|
|
56
|
+
KEEPER_API_HOST: 'https://bitflow-keeper-test-7owjsmt8.uc.gateway.dev',
|
|
57
|
+
// optional: KEEPER_API_KEY: string,
|
|
77
58
|
});
|
|
78
59
|
```
|
|
79
60
|
|
|
80
|
-
3. Use the SDK methods to interact with the Bitflow Protocol.
|
|
61
|
+
3. Use the SDK methods to interact with the Bitflow Protocol. See the [Available Functions](#available-functions) section for more details.
|
|
62
|
+
|
|
63
|
+
## Environment Variables
|
|
64
|
+
|
|
65
|
+
If no options are provided when initializing the SDK, it will use the environment variables.
|
|
66
|
+
|
|
67
|
+
Create a `.env` file in your project root with the following variables:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Bitflow Core API — publicly accessible, no key required
|
|
71
|
+
BITFLOW_API_HOST=https://bitflowsdk-api-test-7owjsmt8.uk.gateway.dev
|
|
72
|
+
# Optional: API key for higher rate limits (see RATE_LIMIT_REQUEST.md to request one)
|
|
73
|
+
BITFLOW_API_KEY=<your_api_key_here>
|
|
74
|
+
|
|
75
|
+
# Your provider address
|
|
76
|
+
BITFLOW_PROVIDER_ADDRESS=<your_provider_address_here>
|
|
77
|
+
|
|
78
|
+
# Stacks Node — publicly accessible, no key required
|
|
79
|
+
READONLY_CALL_API_HOST=https://node.bitflowapis.finance
|
|
80
|
+
# Optional: API key for higher rate limits
|
|
81
|
+
READONLY_CALL_API_KEY=<your_readonly_api_key_here>
|
|
82
|
+
|
|
83
|
+
# Keeper API — publicly accessible, no key required
|
|
84
|
+
KEEPER_API_HOST=https://bitflow-keeper-test-7owjsmt8.uc.gateway.dev
|
|
85
|
+
# Optional: API key for higher rate limits
|
|
86
|
+
KEEPER_API_KEY=<your_keeper_api_key_here>
|
|
87
|
+
```
|
|
81
88
|
|
|
82
89
|
# Available Functions
|
|
83
90
|
|
|
@@ -152,7 +159,7 @@ const swapParams = await bitflow.getSwapParams(
|
|
|
152
159
|
senderAddress,
|
|
153
160
|
slippageTolerance
|
|
154
161
|
);
|
|
155
|
-
console.log(swapParams);
|
|
162
|
+
console.log(swapParams); // Use this parameters to build your swap transaction
|
|
156
163
|
```
|
|
157
164
|
|
|
158
165
|
## Executing Swap (uses `@stacks/connect`)
|