Giter Club home page Giter Club logo

c3-typescript-sdk's Introduction

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/[email protected] 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 signerClass = new Signer();
  const signer = signerClass.addFromMnemonic(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.

c3-typescript-sdk's People

Contributors

alex99y avatar patrickdahdah avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.