Skip to content

c3exchange/c3-typescript-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Website shields.io Discord Twitter

C3 Exchange Typescript SDK

Welcome to the official TypeScript SDK of C3 Exchange

Example Repository

Scripts with examples are provided to help you understand how to use the SDK to build your own bot. [Examples Folder] (examples/src/)

API Documentation

For detailed information about the API and its capabilities, please refer to the official C3 Exchange API Documentation.

Dependencies

NOTE: if signing using an EVM Wallet, ethers.js version 5 is supported

npm install @c3exchange/sdk@0.4.0-alpha.3 ethers@5

Quick Start

Init c3sdk

import { Signer } from "@c3exchange/common";
import { C3SDK, OrderParams } from "@c3exchange/sdk";


const c3sdk = new C3SDK({
  c3_api: {
    server: "https://api.test.c3.io", // Mainnet api: "https://api.c3.io" 
    wormhole_network: "TESTNET",
  },
  algorand_node: {
    server: "https://testnet-api.algonode.cloud", // Mainnet node: "https://mainnet-api.algonode.cloud" 
  },

Authentification

  const signer = createAlgorandOwnerFromMnemonic(Algorand_MNEMONIC); //signer can also be an EVM signer, check examples folder

  console.log("Authenticating account");
  const accountSdk = await c3sdk.login(signer);

Create an order

async function createOrders(): Promise<void> {
  console.log("Submitting 1 order");

  const firsOrder: OrderParams = {
    type: ORDER_TYPE,
    side: ORDER_SIDE,
    marketId: MARKET,
    amount: ORDER_AMOUNT,
    price: ORDER_PRICE,
    // maxBorrow: "2.5", // Optional, used for margin orders
    // maxRepay:"2.5", // Optional, used to pay back loans
    // expiresOn: // Optional, UnixTimestampInSeconds;
  };

  const orderResult = await accountSdk.createOrder(firsOrder);

}

createOrders().catch((error) => console.log("Error in execution.", error));

});

Note

This SDK is provided "as is", without warranty of any kind, express or implied. C3 Exchange does not take responsibility for any harm that might be caused by the use or misuse of this SDK.

Releases

No releases published

Packages

No packages published