@7kprotocol/sdk-ts 3.5.0 → 3.5.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 +45 -171
- package/lib/cjs/constants/_7k.js +2 -1
- package/lib/cjs/features/metaAg/providers/bluefin.js +2 -2
- package/lib/cjs/features/metaAg/providers/cetus.js +3 -0
- package/lib/cjs/features/metaAg/providers/flowx.js +2 -0
- package/lib/cjs/types/constants/_7k.d.ts +1 -0
- package/lib/cjs/types/constants/_7k.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/providers/cetus.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/providers/flowx.d.ts.map +1 -1
- package/lib/esm/constants/_7k.js +1 -0
- package/lib/esm/features/metaAg/providers/bluefin.js +2 -2
- package/lib/esm/features/metaAg/providers/cetus.js +3 -0
- package/lib/esm/features/metaAg/providers/flowx.js +3 -1
- package/lib/esm/types/constants/_7k.d.ts +1 -0
- package/lib/esm/types/constants/_7k.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/providers/cetus.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/providers/flowx.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# 7K TypeScript SDK
|
|
2
2
|
|
|
3
|
+
The 7K Protocol TypeScript SDK provides a comprehensive toolkit for interacting
|
|
4
|
+
with DeFi services on the Sui blockchain. It offers seamless integration with
|
|
5
|
+
token swaps, price feeds, limit orders, dollar-cost averaging (DCA), and
|
|
6
|
+
multi-provider aggregation services.
|
|
7
|
+
|
|
8
|
+
## Introduction
|
|
9
|
+
|
|
10
|
+
The 7K TypeScript SDK is designed to simplify DeFi development on Sui by
|
|
11
|
+
providing a unified, type-safe interface for accessing liquidity and trading
|
|
12
|
+
services. Whether you're building a wallet, trading application, or DeFi
|
|
13
|
+
protocol, this SDK offers the tools you need to integrate advanced trading
|
|
14
|
+
functionality.
|
|
15
|
+
|
|
16
|
+
Key features:
|
|
17
|
+
|
|
18
|
+
- **Meta Aggregator (Active Simulation)**: The SDK includes an active simulation
|
|
19
|
+
of the Meta Aggregator, allowing developers to test and compare quotes from
|
|
20
|
+
multiple sources — including Bluefin7K, FlowX, and Cetus. This provides a
|
|
21
|
+
preview of how the unified aggregator will optimize routing and liquidity
|
|
22
|
+
aggregation across providers.
|
|
23
|
+
|
|
24
|
+
➤ Additional aggregators and RFQ-based liquidity sources are planned for
|
|
25
|
+
integration in future releases.
|
|
26
|
+
|
|
27
|
+
- **Price Service**: Fetch token prices with support for single tokens and batch
|
|
28
|
+
queries
|
|
29
|
+
- **Limit Orders**: Place and manage limit orders for token swaps
|
|
30
|
+
- **DCA Orders**: Set up dollar-cost averaging strategies for automated
|
|
31
|
+
recurring purchases
|
|
32
|
+
- **BluefinX Integration**: Access RFQ-based trading with sponsored transactions
|
|
33
|
+
and MEV protection
|
|
34
|
+
- **Type Safety**: Full TypeScript support with comprehensive type definitions
|
|
35
|
+
- **Mainnet Support**: Production-ready SDK for Sui mainnet
|
|
36
|
+
- **Flexible Configuration**: Customize API keys, slippage, commissions, and
|
|
37
|
+
more
|
|
38
|
+
|
|
39
|
+
The SDK is built with developer experience in mind, providing both a default
|
|
40
|
+
export for convenience and named exports for tree-shaking and modular
|
|
41
|
+
development.
|
|
42
|
+
|
|
3
43
|
## Installation
|
|
4
44
|
|
|
5
45
|
```bash
|
|
@@ -12,7 +52,7 @@ This package has peer dependencies that are required for core functionality:
|
|
|
12
52
|
|
|
13
53
|
| Package | Version | Purpose | Required For |
|
|
14
54
|
| -------------------------- | --------- | ---------------------------- | ------------------ |
|
|
15
|
-
| `@mysten/sui` | `^1.
|
|
55
|
+
| `@mysten/sui` | `^1.44.0` | Sui blockchain interaction | Core functionality |
|
|
16
56
|
| `@pythnetwork/pyth-sui-js` | `^2.2.0` | Pyth price feeds integration | Price feeds |
|
|
17
57
|
|
|
18
58
|
**Required peer dependencies:**
|
|
@@ -75,65 +115,11 @@ or import specific functions as needed:
|
|
|
75
115
|
import { getQuote, buildTx } from "@7kprotocol/sdk-ts";
|
|
76
116
|
```
|
|
77
117
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
Configuration is optional, but if provided, it must be set before invoking any
|
|
81
|
-
SDK functions.
|
|
82
|
-
|
|
83
|
-
### Set API Key
|
|
84
|
-
|
|
85
|
-
You can use our SDK with a default rate limit of **5 requests per second**
|
|
86
|
-
without needing an API key.
|
|
87
|
-
|
|
88
|
-
- For **frontend (in-browser) usage**, no API key is required, and the rate
|
|
89
|
-
limit cannot be increased.
|
|
90
|
-
|
|
91
|
-
- For **backend (server-side) usage**, the API key is **optional** for default
|
|
92
|
-
usage. However, to request a **higher rate limit**, you must provide both an
|
|
93
|
-
**API key** and **partner information**.
|
|
94
|
-
|
|
95
|
-
To request a rate limit increase, please submit your request at:
|
|
96
|
-
|
|
97
|
-
🔗 <https://7k.ag/collab> and select **"SDK - increase request rate"**.
|
|
98
|
-
|
|
99
|
-
| Usage | API Key Required | Default Rate Limit | Can Request Higher Rate Limit |
|
|
100
|
-
| -------- | ------------------------------------- | ------------------------------- | -------------------------------------------- |
|
|
101
|
-
| Frontend | No | 5 requests/second | No |
|
|
102
|
-
| Backend | Optional (required to increase limit) | 5 requests/second (without key) | Yes (requires API Key & partner information) |
|
|
103
|
-
|
|
104
|
-
```typescript
|
|
105
|
-
import { Config } from "@7kprotocol/sdk-ts";
|
|
106
|
-
|
|
107
|
-
Config.setApiKey("YOUR_API_KEY");
|
|
108
|
-
console.log("API key", Config.getApiKey());
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### Set BluefinX API key
|
|
112
|
-
|
|
113
|
-
Setting a BluefinX API key is optional. However, if you'd like to use one — for
|
|
114
|
-
example, to avoid rate limits when routing through BluefinX — you'll need to
|
|
115
|
-
request an API key directly from Bluefin.
|
|
116
|
-
|
|
117
|
-
```typescript
|
|
118
|
-
import { Config } from "@7kprotocol/sdk-ts";
|
|
119
|
-
|
|
120
|
-
Config.setBluefinXApiKey("YOUR_BLUEFINX_API_KEY");
|
|
121
|
-
console.log("BluefinX API key", Config.getBluefinXApiKey());
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### Set Sui Client
|
|
125
|
-
|
|
126
|
-
```typescript
|
|
127
|
-
import { SuiClient, getFullnodeUrl } from "@mysten/sui/client";
|
|
128
|
-
import { Config } from "@7kprotocol/sdk-ts";
|
|
118
|
+
Note: this package only supports **mainnet**.
|
|
129
119
|
|
|
130
|
-
|
|
131
|
-
const suiClient = new SuiClient({ url: getFullnodeUrl(network) });
|
|
132
|
-
Config.setSuiClient(suiClient);
|
|
133
|
-
console.log("Sui client", Config.getSuiClient());
|
|
134
|
-
```
|
|
120
|
+
## MetaAg (Multi-Provider Aggregation)
|
|
135
121
|
|
|
136
|
-
|
|
122
|
+
See [Meta Aggregator](docs/META_AG.md).
|
|
137
123
|
|
|
138
124
|
## Swap
|
|
139
125
|
|
|
@@ -151,121 +137,9 @@ See [Limit Orders](docs/LIMIT.md).
|
|
|
151
137
|
|
|
152
138
|
See [DCA Orders](docs/DCA.md).
|
|
153
139
|
|
|
154
|
-
## MetaAg (Multi-Provider Aggregation)
|
|
155
|
-
|
|
156
|
-
The MetaAg feature allows you to aggregate quotes from multiple DEX Aggregator
|
|
157
|
-
providers. By default, all available providers are enabled. You can optionally
|
|
158
|
-
configure specific providers or install optional dependencies to enable
|
|
159
|
-
additional providers.
|
|
160
|
-
|
|
161
|
-
### Using Default Providers
|
|
162
|
-
|
|
163
|
-
The Bluefin7K provider is built-in and works without additional dependencies:
|
|
164
|
-
|
|
165
|
-
```typescript
|
|
166
|
-
import { MetaAg, EProvider } from "@7kprotocol/sdk-ts";
|
|
167
|
-
|
|
168
|
-
const metaAg = new MetaAg();
|
|
169
|
-
|
|
170
|
-
// Get quotes from all available providers
|
|
171
|
-
const quotes = await metaAg.quote({
|
|
172
|
-
amountIn: "1000000000", // 1 SUI (9 decimals)
|
|
173
|
-
coinInType:
|
|
174
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
175
|
-
coinOutType:
|
|
176
|
-
"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
// Find the best quote
|
|
180
|
-
const bestQuote = quotes.reduce((best, current) =>
|
|
181
|
-
Number(current.amountOut) > Number(best.amountOut) ? current : best,
|
|
182
|
-
);
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### Configuring Specific Providers
|
|
186
|
-
|
|
187
|
-
You can configure specific providers and their options:
|
|
188
|
-
|
|
189
|
-
```typescript
|
|
190
|
-
const metaAg = new MetaAg({
|
|
191
|
-
providers: {
|
|
192
|
-
[EProvider.BLUEFIN7K]: {
|
|
193
|
-
apiKey: "your-bluefin-api-key", // Optional
|
|
194
|
-
},
|
|
195
|
-
[EProvider.FLOWX]: {
|
|
196
|
-
apiKey: "your-flowx-api-key", // Optional
|
|
197
|
-
},
|
|
198
|
-
[EProvider.CETUS]: {
|
|
199
|
-
apiKey: "your-cetus-api-key", // Optional
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
});
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
**Note**: To use Flowx or Cetus providers, you must install their respective
|
|
206
|
-
optional dependencies. See the
|
|
207
|
-
[Optional Dependencies](#optional-dependencies-for-metaag-providers) section
|
|
208
|
-
above.
|
|
209
|
-
|
|
210
|
-
### Sponsored Transactions
|
|
211
|
-
|
|
212
|
-
When building sponsored transactions, `tx.gas` can not be used for swap.
|
|
213
|
-
|
|
214
|
-
**Important considerations:**
|
|
215
|
-
|
|
216
|
-
1. **Gas coin usage**: Set `useGasCoin: false` when creating your coin input
|
|
217
|
-
object to prevent the SDK from trying to use `tx.gas`.
|
|
218
|
-
|
|
219
|
-
2. **Pyth oracle dependencies**: Transactions that use the gas coin cannot be
|
|
220
|
-
sponsored because Pyth oracle fees are paid from `tx.gas`. Exclude DEX
|
|
221
|
-
sources that depend on Pyth oracles.
|
|
222
|
-
|
|
223
|
-
**Example configuration:**
|
|
224
|
-
|
|
225
|
-
```typescript
|
|
226
|
-
import { MetaAg, EProvider } from "@7kprotocol/sdk-ts";
|
|
227
|
-
import { coinWithBalance } from "@mysten/sui/transactions";
|
|
228
|
-
import { Protocol } from "@flowx-finance/sdk"; // Required for Flowx sources
|
|
229
|
-
import { CETUS, BLUEFIN } from "@cetusprotocol/aggregator-sdk
|
|
230
|
-
|
|
231
|
-
const metaAg = new MetaAg({
|
|
232
|
-
providers: {
|
|
233
|
-
[EProvider.BLUEFIN7K]: {
|
|
234
|
-
sources: ["cetus", "bluefin"], // Excludes Pyth oracle-based DEX
|
|
235
|
-
},
|
|
236
|
-
[EProvider.FLOWX]: {
|
|
237
|
-
sources: [Protocol.BLUEFIN, Protocol.CETUS, Protocol.FLOWX_V3],
|
|
238
|
-
},
|
|
239
|
-
[EProvider.CETUS]: {
|
|
240
|
-
sources: [CETUS, BLUEFIN],
|
|
241
|
-
},
|
|
242
|
-
},
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
// Create coin input WITHOUT using the gas coin
|
|
246
|
-
const coinIn = coinWithBalance({
|
|
247
|
-
balance: 1000000000n, // 1 SUI
|
|
248
|
-
type: "0x2::sui::SUI",
|
|
249
|
-
useGasCoin: false, // Important: must be false for sponsored transactions
|
|
250
|
-
});
|
|
251
|
-
```
|
|
252
|
-
|
|
253
140
|
## Prices
|
|
254
141
|
|
|
255
|
-
|
|
256
|
-
import { getTokenPrice, getTokenPrices, getSuiPrice } from "@7kprotocol/sdk-ts";
|
|
257
|
-
|
|
258
|
-
const tokenPrice = await getTokenPrice(
|
|
259
|
-
"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
|
|
260
|
-
);
|
|
261
|
-
|
|
262
|
-
const tokenPrices = await getTokenPrices([
|
|
263
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
264
|
-
"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
|
|
265
|
-
]);
|
|
266
|
-
|
|
267
|
-
const suiPrice = await getSuiPrice();
|
|
268
|
-
```
|
|
142
|
+
See [Prices](docs/PRICE.md).
|
|
269
143
|
|
|
270
144
|
## Miscellaneous
|
|
271
145
|
|
package/lib/cjs/constants/_7k.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._7K_META_CONFIG = exports._7K_META_VAULT = exports._7K_META_PACKAGE_ID = exports._7K_META_PUBLISHED_AT = exports._7K_VAULT = exports._7K_CONFIG = exports._7K_PACKAGE_ID = void 0;
|
|
3
|
+
exports._7K_PARTNER_ADDRESS = exports._7K_META_CONFIG = exports._7K_META_VAULT = exports._7K_META_PACKAGE_ID = exports._7K_META_PUBLISHED_AT = exports._7K_VAULT = exports._7K_CONFIG = exports._7K_PACKAGE_ID = void 0;
|
|
4
4
|
exports._7K_PACKAGE_ID = "0x62412b7268c35f3808336aee57a52836501f40b8ba5d936f8ad275e672befd04";
|
|
5
5
|
//legacy V4: "0xe8f996ea6ff38c557c253d3b93cfe2ebf393816487266786371aa4532a9229f2";
|
|
6
6
|
//legacy V3: "0x7ea6e27ad7af6f3b8671d59df1aaebd7c03dddab893e52a714227b2f4fe91519";
|
|
@@ -14,3 +14,4 @@ exports._7K_META_PUBLISHED_AT = "0x17c0b1f7a6ad73f51268f16b8c06c049eecc2f28a270c
|
|
|
14
14
|
exports._7K_META_PACKAGE_ID = "0x17c0b1f7a6ad73f51268f16b8c06c049eecc2f28a270cdd29c06e3d2dea23302";
|
|
15
15
|
exports._7K_META_VAULT = "0x9a8abd32fe5721307ce3b697cf982ee84e9ffbd58d667a4a199f1683c1a3d23c";
|
|
16
16
|
exports._7K_META_CONFIG = "0xbbb3a51877ed9b492f26f4e2181811cfb2bd70c532f6f7621263d122d5e96b56";
|
|
17
|
+
exports._7K_PARTNER_ADDRESS = "0x93ead46c1e48a9b62e25b6787f2ea6f75caedabb21726f12431acc4381f5f4c5";
|
|
@@ -4,8 +4,8 @@ exports.BluefinProvider = void 0;
|
|
|
4
4
|
const pyth_sui_js_1 = require("@pythnetwork/pyth-sui-js");
|
|
5
5
|
const uuid_1 = require("uuid");
|
|
6
6
|
const config_1 = require("../../../config");
|
|
7
|
+
const _7k_1 = require("../../../constants/_7k");
|
|
7
8
|
const apiEndpoints_1 = require("../../../constants/apiEndpoints");
|
|
8
|
-
const sui_1 = require("../../../constants/sui");
|
|
9
9
|
const metaAg_1 = require("../../../types/metaAg");
|
|
10
10
|
const condition_1 = require("../../../utils/condition");
|
|
11
11
|
const buildTxV2_1 = require("../../swap/buildTxV2");
|
|
@@ -54,7 +54,7 @@ class BluefinProvider {
|
|
|
54
54
|
accountAddress: signer,
|
|
55
55
|
commission: {
|
|
56
56
|
commissionBps: 0,
|
|
57
|
-
partner:
|
|
57
|
+
partner: _7k_1._7K_PARTNER_ADDRESS,
|
|
58
58
|
},
|
|
59
59
|
slippage: 1,
|
|
60
60
|
extendTx: {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CetusProvider = void 0;
|
|
4
4
|
const aggregator_sdk_1 = require("@cetusprotocol/aggregator-sdk");
|
|
5
5
|
const uuid_1 = require("uuid");
|
|
6
|
+
const _7k_1 = require("../../../constants/_7k");
|
|
6
7
|
const metaAg_1 = require("../../../types/metaAg");
|
|
7
8
|
const condition_1 = require("../../../utils/condition");
|
|
8
9
|
class CetusProvider {
|
|
@@ -15,6 +16,8 @@ class CetusProvider {
|
|
|
15
16
|
endpoint: options.api,
|
|
16
17
|
env: aggregator_sdk_1.Env.Mainnet,
|
|
17
18
|
pythUrls: metaOptions.hermesApi ? [metaOptions.hermesApi] : [],
|
|
19
|
+
overlayFeeRate: 0,
|
|
20
|
+
overlayFeeReceiver: _7k_1._7K_PARTNER_ADDRESS,
|
|
18
21
|
});
|
|
19
22
|
}
|
|
20
23
|
async quote(quoteOptions) {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FlowxProvider = void 0;
|
|
4
4
|
const sdk_1 = require("@flowx-finance/sdk");
|
|
5
5
|
const uuid_1 = require("uuid");
|
|
6
|
+
const _7k_1 = require("../../../constants/_7k");
|
|
6
7
|
const metaAg_1 = require("../../../types/metaAg");
|
|
7
8
|
const condition_1 = require("../../../utils/condition");
|
|
8
9
|
class FlowxProvider {
|
|
@@ -39,6 +40,7 @@ class FlowxProvider {
|
|
|
39
40
|
const builder = new sdk_1.TradeBuilder("mainnet", options.quote.quote.routes);
|
|
40
41
|
builder.sender(options.signer);
|
|
41
42
|
builder.slippage(10000 * 100);
|
|
43
|
+
builder.commission(new sdk_1.Commission(_7k_1._7K_PARTNER_ADDRESS, options.quote.quote.coinOut, sdk_1.CommissionType.PERCENTAGE, 0, true));
|
|
42
44
|
const res = await builder.build().swap({
|
|
43
45
|
tx: options.tx,
|
|
44
46
|
client: this.client,
|
|
@@ -5,4 +5,5 @@ export declare const _7K_META_PUBLISHED_AT = "0x17c0b1f7a6ad73f51268f16b8c06c049
|
|
|
5
5
|
export declare const _7K_META_PACKAGE_ID = "0x17c0b1f7a6ad73f51268f16b8c06c049eecc2f28a270cdd29c06e3d2dea23302";
|
|
6
6
|
export declare const _7K_META_VAULT = "0x9a8abd32fe5721307ce3b697cf982ee84e9ffbd58d667a4a199f1683c1a3d23c";
|
|
7
7
|
export declare const _7K_META_CONFIG = "0xbbb3a51877ed9b492f26f4e2181811cfb2bd70c532f6f7621263d122d5e96b56";
|
|
8
|
+
export declare const _7K_PARTNER_ADDRESS = "0x93ead46c1e48a9b62e25b6787f2ea6f75caedabb21726f12431acc4381f5f4c5";
|
|
8
9
|
//# sourceMappingURL=_7k.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_7k.d.ts","sourceRoot":"","sources":["../../../../src/constants/_7k.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,uEAC2C,CAAC;AAKvE,eAAO,MAAM,UAAU,uEAC+C,CAAC;AAGvE,eAAO,MAAM,SAAS,uEACgD,CAAC;AAEvE,eAAO,MAAM,qBAAqB,uEACoC,CAAC;AACvE,eAAO,MAAM,mBAAmB,uEACsC,CAAC;AACvE,eAAO,MAAM,cAAc,uEAC2C,CAAC;AACvE,eAAO,MAAM,eAAe,uEAC0C,CAAC"}
|
|
1
|
+
{"version":3,"file":"_7k.d.ts","sourceRoot":"","sources":["../../../../src/constants/_7k.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,uEAC2C,CAAC;AAKvE,eAAO,MAAM,UAAU,uEAC+C,CAAC;AAGvE,eAAO,MAAM,SAAS,uEACgD,CAAC;AAEvE,eAAO,MAAM,qBAAqB,uEACoC,CAAC;AACvE,eAAO,MAAM,mBAAmB,uEACsC,CAAC;AACvE,eAAO,MAAM,cAAc,uEAC2C,CAAC;AACvE,eAAO,MAAM,eAAe,uEAC0C,CAAC;AACvE,eAAO,MAAM,mBAAmB,uEACsC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cetus.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/cetus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"cetus.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/cetus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAGrE,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,aAAc,YAAW,UAAU;IAI5C,OAAO,CAAC,QAAQ,CAAC,OAAO;IAH1B,IAAI,YAAmB;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;gBAE5B,OAAO,EAAE,oBAAoB,EAC9C,WAAW,EAAE,aAAa,EAC1B,MAAM,EAAE,SAAS;IAab,KAAK,CAAC,YAAY,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IA0BzD,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAUzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowx.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/flowx.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flowx.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/flowx.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAGrE,OAAO,EACL,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,aAAc,YAAW,UAAU;IAI5C,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJzB,IAAI,YAAmB;IACvB,OAAO,CAAC,MAAM,CAAmB;gBAEd,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,SAAS;IAK9B,KAAK,CAAC,YAAY,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAuBzD,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAqBzE"}
|
package/lib/esm/constants/_7k.js
CHANGED
|
@@ -11,3 +11,4 @@ export const _7K_META_PUBLISHED_AT = "0x17c0b1f7a6ad73f51268f16b8c06c049eecc2f28
|
|
|
11
11
|
export const _7K_META_PACKAGE_ID = "0x17c0b1f7a6ad73f51268f16b8c06c049eecc2f28a270cdd29c06e3d2dea23302";
|
|
12
12
|
export const _7K_META_VAULT = "0x9a8abd32fe5721307ce3b697cf982ee84e9ffbd58d667a4a199f1683c1a3d23c";
|
|
13
13
|
export const _7K_META_CONFIG = "0xbbb3a51877ed9b492f26f4e2181811cfb2bd70c532f6f7621263d122d5e96b56";
|
|
14
|
+
export const _7K_PARTNER_ADDRESS = "0x93ead46c1e48a9b62e25b6787f2ea6f75caedabb21726f12431acc4381f5f4c5";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SuiPriceServiceConnection, SuiPythClient, } from "@pythnetwork/pyth-sui-js";
|
|
2
2
|
import { v4 } from "uuid";
|
|
3
3
|
import { Config } from "../../../config";
|
|
4
|
+
import { _7K_PARTNER_ADDRESS } from "../../../constants/_7k";
|
|
4
5
|
import { API_ENDPOINTS } from "../../../constants/apiEndpoints";
|
|
5
|
-
import { SUI_ADDRESS_ZERO } from "../../../constants/sui";
|
|
6
6
|
import { EProvider, } from "../../../types/metaAg";
|
|
7
7
|
import { assert } from "../../../utils/condition";
|
|
8
8
|
import { buildTxV2 } from "../../swap/buildTxV2";
|
|
@@ -53,7 +53,7 @@ export class BluefinProvider {
|
|
|
53
53
|
accountAddress: signer,
|
|
54
54
|
commission: {
|
|
55
55
|
commissionBps: 0,
|
|
56
|
-
partner:
|
|
56
|
+
partner: _7K_PARTNER_ADDRESS,
|
|
57
57
|
},
|
|
58
58
|
slippage: 1,
|
|
59
59
|
extendTx: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AggregatorClient, Env } from "@cetusprotocol/aggregator-sdk";
|
|
2
2
|
import { v4 } from "uuid";
|
|
3
|
+
import { _7K_PARTNER_ADDRESS } from "../../../constants/_7k";
|
|
3
4
|
import { EProvider, } from "../../../types/metaAg";
|
|
4
5
|
import { assert } from "../../../utils/condition";
|
|
5
6
|
export class CetusProvider {
|
|
@@ -14,6 +15,8 @@ export class CetusProvider {
|
|
|
14
15
|
endpoint: options.api,
|
|
15
16
|
env: Env.Mainnet,
|
|
16
17
|
pythUrls: metaOptions.hermesApi ? [metaOptions.hermesApi] : [],
|
|
18
|
+
overlayFeeRate: 0,
|
|
19
|
+
overlayFeeReceiver: _7K_PARTNER_ADDRESS,
|
|
17
20
|
});
|
|
18
21
|
}
|
|
19
22
|
async quote(quoteOptions) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AggregatorQuoter, TradeBuilder } from "@flowx-finance/sdk";
|
|
1
|
+
import { AggregatorQuoter, Commission, CommissionType, TradeBuilder, } from "@flowx-finance/sdk";
|
|
2
2
|
import { v4 } from "uuid";
|
|
3
|
+
import { _7K_PARTNER_ADDRESS } from "../../../constants/_7k";
|
|
3
4
|
import { EProvider, } from "../../../types/metaAg";
|
|
4
5
|
import { assert } from "../../../utils/condition";
|
|
5
6
|
export class FlowxProvider {
|
|
@@ -39,6 +40,7 @@ export class FlowxProvider {
|
|
|
39
40
|
const builder = new TradeBuilder("mainnet", options.quote.quote.routes);
|
|
40
41
|
builder.sender(options.signer);
|
|
41
42
|
builder.slippage(10000 * 100);
|
|
43
|
+
builder.commission(new Commission(_7K_PARTNER_ADDRESS, options.quote.quote.coinOut, CommissionType.PERCENTAGE, 0, true));
|
|
42
44
|
const res = await builder.build().swap({
|
|
43
45
|
tx: options.tx,
|
|
44
46
|
client: this.client,
|
|
@@ -5,4 +5,5 @@ export declare const _7K_META_PUBLISHED_AT = "0x17c0b1f7a6ad73f51268f16b8c06c049
|
|
|
5
5
|
export declare const _7K_META_PACKAGE_ID = "0x17c0b1f7a6ad73f51268f16b8c06c049eecc2f28a270cdd29c06e3d2dea23302";
|
|
6
6
|
export declare const _7K_META_VAULT = "0x9a8abd32fe5721307ce3b697cf982ee84e9ffbd58d667a4a199f1683c1a3d23c";
|
|
7
7
|
export declare const _7K_META_CONFIG = "0xbbb3a51877ed9b492f26f4e2181811cfb2bd70c532f6f7621263d122d5e96b56";
|
|
8
|
+
export declare const _7K_PARTNER_ADDRESS = "0x93ead46c1e48a9b62e25b6787f2ea6f75caedabb21726f12431acc4381f5f4c5";
|
|
8
9
|
//# sourceMappingURL=_7k.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_7k.d.ts","sourceRoot":"","sources":["../../../../src/constants/_7k.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,uEAC2C,CAAC;AAKvE,eAAO,MAAM,UAAU,uEAC+C,CAAC;AAGvE,eAAO,MAAM,SAAS,uEACgD,CAAC;AAEvE,eAAO,MAAM,qBAAqB,uEACoC,CAAC;AACvE,eAAO,MAAM,mBAAmB,uEACsC,CAAC;AACvE,eAAO,MAAM,cAAc,uEAC2C,CAAC;AACvE,eAAO,MAAM,eAAe,uEAC0C,CAAC"}
|
|
1
|
+
{"version":3,"file":"_7k.d.ts","sourceRoot":"","sources":["../../../../src/constants/_7k.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,uEAC2C,CAAC;AAKvE,eAAO,MAAM,UAAU,uEAC+C,CAAC;AAGvE,eAAO,MAAM,SAAS,uEACgD,CAAC;AAEvE,eAAO,MAAM,qBAAqB,uEACoC,CAAC;AACvE,eAAO,MAAM,mBAAmB,uEACsC,CAAC;AACvE,eAAO,MAAM,cAAc,uEAC2C,CAAC;AACvE,eAAO,MAAM,eAAe,uEAC0C,CAAC;AACvE,eAAO,MAAM,mBAAmB,uEACsC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cetus.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/cetus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"cetus.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/cetus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAGrE,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,aAAc,YAAW,UAAU;IAI5C,OAAO,CAAC,QAAQ,CAAC,OAAO;IAH1B,IAAI,YAAmB;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;gBAE5B,OAAO,EAAE,oBAAoB,EAC9C,WAAW,EAAE,aAAa,EAC1B,MAAM,EAAE,SAAS;IAab,KAAK,CAAC,YAAY,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IA0BzD,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAUzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowx.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/flowx.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flowx.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/flowx.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAGrE,OAAO,EACL,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,aAAc,YAAW,UAAU;IAI5C,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJzB,IAAI,YAAmB;IACvB,OAAO,CAAC,MAAM,CAAmB;gBAEd,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,SAAS;IAK9B,KAAK,CAAC,YAAY,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAuBzD,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAqBzE"}
|