3.0.2 • Published 4 months ago

@7kprotocol/sdk-ts v3.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

7K TypeScript SDK

Installation

npm i @7kprotocol/sdk-ts

This package requires @pythnetwork/pyth-sui-js as a peer dependency. If your project does not have it, you need to install it.

npm i @pythnetwork/pyth-sui-js

Usage

You can import the entire SDK as a module:

import SevenK from "@7kprotocol/sdk-ts";

or import specific functions as needed:

import { getQuote, buildTx } from "@7kprotocol/sdk-ts";

Config

Configuration is optional, but if provided, it must be set before invoking any SDK functions.

Set API Key

You can use our SDK with a default rate limit of 5 requests per second without needing an API key.

  • For frontend (in-browser) usage, no API key is required, and the rate limit cannot be increased.

  • For backend (server-side) usage, the API key is optional for default usage. However, to request a higher rate limit, you must provide both an API key and partner information.

To request a rate limit increase, please submit your request at:

šŸ”— https://7k.ag/collab and select "SDK - increase request rate".

UsageAPI Key RequiredDefault Rate LimitCan Request Higher Rate Limit
FrontendNo5 requests/secondNo
BackendOptional (required to increase limit)5 requests/second (without key)Yes (requires API Key & partner information)
import { Config } from "@7kprotocol/sdk-ts";

Config.setApiKey("YOUR_API_KEY");
console.log("API key", Config.getApiKey());

Set Sui Client

import { SuiClient, getFullnodeUrl } from "@mysten/sui/client";
import { Config } from "@7kprotocol/sdk-ts";

const network = "mainnet";
const suiClient = new SuiClient({ url: getFullnodeUrl(network) });
Config.setSuiClient(suiClient);
console.log("Sui client", Config.getSuiClient());

Note: this package only supports mainnet.

Swap

See Swap.

BluefinX

See BluefinX.

Limit Orders

See Limit Orders.

DCA Orders

See DCA Orders.

Prices

import { getTokenPrice, getTokenPrices, getSuiPrice } from "@7kprotocol/sdk-ts";

const tokenPrice = await getTokenPrice(
  "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
);

const tokenPrices = await getTokenPrices([
  "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
  "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
]);

const suiPrice = await getSuiPrice();

Miscellaneous

If you encounter issues when importing functions from this SDK in a Node.js environment, refer to src/examples/nodejs/ for guidance.

License

7K TypeScript SDK released under the MIT license. See the LICENSE file for details.

2.2.1

9 months ago

2.2.0

10 months ago

2.4.1

6 months ago

2.4.0

6 months ago

2.2.2

9 months ago

3.0.2

4 months ago

3.0.1

4 months ago

2.3.7

6 months ago

3.0.0

5 months ago

2.3.0

9 months ago

2.3.2

9 months ago

2.3.1

9 months ago

2.3.4

9 months ago

2.1.6

11 months ago

2.3.3

9 months ago

2.1.5

11 months ago

2.3.6

7 months ago

2.3.5

7 months ago

2.1.7

10 months ago

2.4.2-beta.0

5 months ago

2.4.2-beta.2

5 months ago

2.4.2-beta.1

5 months ago

2.1.4

12 months ago

2.1.2

12 months ago

2.1.1

1 year ago

2.1.3

12 months ago

2.1.0

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago