0.3.22 • Published 6 months ago

@deltadefi-protocol/typescript-sdk v0.3.22

Weekly downloads
-
License
-
Repository
-
Last release
6 months ago

UTxO Orderbook TypeScript SDK

The UTxO Orderbook TypeScript SDK provides a convenient way to interact with the DeltaDefi API. It includes classes and methods for managing accounts, orders, markets, and wallets.

Installation

To install the SDK, use npm:

npm i @deltadefi-protocol/typescript-sdk

Usage

Importing the SDK

import { ApiClient } from 'deltadefi-typescript-sdk';

Creating an Instance

const apiClient = new ApiClient({
    network: 'preprod',
    jwt: 'your-jwt-token',
    apiKey: 'your-api-key',
    signingKey: 'your-signing-key',
});

Orders

const postOrderData: PostOrderRequest = {
    symbol: 'ADAUSDX',
    side: 'buy',
    type: 'limit',
    quantity: 100,
    price: 1.5,
    max_slippage: true,
};

apiClient
    .postOrder(postOrderData)
    .then((response) => {
        console.log('Order posted successfully:', response);
    })
    .catch((error) => {
        console.error('Error posting order:', error);
    });

Markets

const marketDepthData: GetMarketDepthRequest = {
    pair: 'ADAUSDX',
};

apiClient.markets
    .getDepth(marketDepthData)
    .then((response) => {
        console.log('Market depth:', response);
    })
    .catch((error) => {
        console.error('Error getting market depth:', error);
    });

Wallet

const txHex = 'your-transaction-hex';

apiClient.wallet
    ?.signTx(txHex)
    .then((signedTx) => {
        console.log('Signed transaction:', signedTx);
    })
    .catch((error) => {
        console.error('Error signing transaction:', error);
    });

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
0.3.9

8 months ago

0.3.17

6 months ago

0.3.16

6 months ago

0.3.15

6 months ago

0.3.14

6 months ago

0.3.13

6 months ago

0.3.12

7 months ago

0.3.11

7 months ago

0.3.10

7 months ago

0.3.20

6 months ago

0.3.22

6 months ago

0.3.21

6 months ago

0.3.0

9 months ago

0.2.1

10 months ago

0.2.0

11 months ago

0.3.18

6 months ago

0.3.6

8 months ago

0.3.5

9 months ago

0.3.8

8 months ago

0.3.7

8 months ago

0.3.2

9 months ago

0.2.3

10 months ago

0.3.1

9 months ago

0.2.2

10 months ago

0.3.4

9 months ago

0.2.5

10 months ago

0.3.3

9 months ago

0.2.4

10 months ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.2-alpha.1

1 year ago

0.1.1

1 year ago