DeltaDeFi
  • About
    • 👋Introduction
    • 📖Learn
      • Architecture
        • Account
        • App Vault
        • Hydra
        • Intent and Process
        • Order Book
      • Trade
        • Order Types
      • Whitepaper
  • Start Trading
    • ⚡Getting Started
      • Create Account
      • Deposit
      • Place Order
      • Cancel Order
      • Withdrawal
      • API Key / Dashboard
    • ⚙️Developers
      • Introduction
        • Base Url
        • Auth
        • Assets
      • Getting started
        • Deposit funds
        • Place a new order
        • Cancel an order
        • Withdraw funds
      • API Documentation
        • Account
          • Create new api key
          • Build deposit transaction
          • Submit deposit transaction
          • Deposit records
          • Withdrawal records
          • Order records
          • Build withdrawal transaction
          • Submit withdrawal transaction
          • Balances
        • App
          • Get mock USDX (testnet only)
          • Submit USDX transaction (testnet only)
        • Market
          • Market Price
          • Market Depth
          • Aggregated trades
        • Order
          • Build order transaction
          • Submit order Transaction
          • Build cancel Order Transaction
          • Submit cancel order transaction
      • Websocket Endpoints
        • Account streams
        • Market price streams
        • Market depth streams
      • SDK
        • Typescript
        • Python
  • FAQ
    • General
    • Product
    • Cardano
    • Disclaimer
Powered by GitBook
On this page
  • Verifying deposit
  • Related FAQ
  1. Start Trading
  2. Developers
  3. Getting started

Deposit funds

PreviousGetting startedNextPlace a new order

Last updated 1 month ago

1

Build a deposit transaction

You must first build a transaction using your current UTxO state before processing.

  • For in-depth API detailsBuild deposit transaction.

  • For a list of supported assets, view Assets

In the following example, we're depositing 10 Ada, equivalent to 10_000_000 lovelace

curl --location 'https://api-staging.deltadefi.io/accounts/deposit/build' \
--header 'x-api-key: <your_api_key>' \
--header 'Content-Type: application/json' \
--data '{
    "deposit_amount": [
        {
            "unit": "lovelace",
            "quantity": "10000000"
        }
    ], 
    "input_utxos": [
        {
            "input": {
                "tx_hash": "6a33db7b4da84707b088d29fd6ec3072f03599427a4854c7ebe88c3052524385",
                "output_index": 4
            },
            "output": {
                "address": "addr_test1qr77kjlsarq8wy22g4flrcznjh5lkug5mvth7qhhkewgmezwvc8hnnjzy82j5twzf8dfy5gjk04yd09t488ys9605dvq4ymc4x",
                "amount": [
                    {
                        "unit": "lovelace",
                        "quantity": "77261137"
                    }
                ],
                "data_hash": null,
                "plutus_data": null,
                "script_ref": null,
                "script_hash": null
            }
        }
    ]
}

const axios = require('axios');
let data = JSON.stringify({
  "deposit_amount": [
    {
      "unit": "lovelace",
      "quantity": "10000000"
    }
  ],
  "input_utxos": [
    {
      "input": {
        "tx_hash": "6a33db7b4da84707b088d29fd6ec3072f03599427a4854c7ebe88c3052524385",
        "output_index": 4
      },
      "output": {
        "address": "addr_test1qr77kjlsarq8wy22g4flrcznjh5lkug5mvth7qhhkewgmezwvc8hnnjzy82j5twzf8dfy5gjk04yd09t488ys9605dvq4ymc4x",
        "amount": [
          {
            "unit": "lovelace",
            "quantity": "77261137"
          }
        ],
        "data_hash": null,
        "plutus_data": null,
        "script_ref": null,
        "script_hash": null
      }
    }
  ]
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api-staging.deltadefi.io/accounts/deposit/build',
  headers: { 
    'X-API-KEY': '<your_api_key>', 
    'Content-Type': 'application/json'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://api-staging.deltadefi.io/accounts/deposit/build"
  method := "POST"

  payload := strings.NewReader(`{
    "deposit_amount": [
        {
            "unit": "lovelace",
            "quantity": "10000000"
        }
    ], 
    "input_utxos": [
        {
            "input": {
                "tx_hash": "6a33db7b4da84707b088d29fd6ec3072f03599427a4854c7ebe88c3052524385",
                "output_index": 4
            },
            "output": {
                "address": "addr_test1qr77kjlsarq8wy22g4flrcznjh5lkug5mvth7qhhkewgmezwvc8hnnjzy82j5twzf8dfy5gjk04yd09t488ys9605dvq4ymc4x",
                "amount": [
                    {
                        "unit": "lovelace",
                        "quantity": "77261137"
                    }
                ],
                "data_hash": null,
                "plutus_data": null,
                "script_ref": null,
                "script_hash": null
            }
        }
    ]
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("X-API-KEY", "<your_api_key>")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
2

Submit a deposit transaction

With the returned tx_hex from step 1, you will need to sign it before submitting it.

For in-depth API details Submit deposit transaction


curl --location 'https://api-staging.deltadefi.io/accounts/deposit/submit' \
--header 'X-API-key: <your_api_key>' \
--header 'Content-Type: application/json' \
--data '{
    "signed_tx": "<your_signed_tx>"
}

const axios = require('axios');
let data = JSON.stringify({
  "signed_tx": "<your_signed_tx>"
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api-staging.deltadefi.io/accounts/deposit/submit',
  headers: { 
    'X-API-key': '<your_api_key>', 
    'Content-Type': 'application/json'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://api-staging.deltadefi.io/accounts/deposit/submit"
  method := "POST"

  payload := strings.NewReader(`{
    "signed_tx": "<your_signed_tx>"
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("X-API-key", "<your_api_key>")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}

Verifying deposit

After you have made a successful deposit request, you can check your latest account balance via the Balances API.

curl --location 'https://api-staging.deltadefi.io/accounts/balance' \
--header 'X-API-KEY: <your_api_key>'

const axios = require('axios');

let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://api-staging.deltadefi.io/accounts/balance',
  headers: { 
    'X-API-KEY': '<your_api_key>'
  }
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {

  url := "https://api-staging.deltadefi.io/accounts/balance"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("X-API-KEY", "<your_api_key>")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}

Your Response should look something like below:

[
    {
        "asset": "usdx",
        "asset_unit": "5066154a102ee037390c5236f78db23239b49c5748d3d349f3ccf04b55534458",
        "free": 0,
        "locked": 17.35
    },
    {
        "asset": "ada",
        "asset_unit": "",
        "free": 0,
        "locked": 100
    }
]


Related FAQ

⚙️
How do I get my API keys?
✅
How can I get UTxOs from my wallet address?
How can I sign a Cardano transaction?
How can I get UTxOs from my wallet address?
How can I sign a Cardano transaction?
What is the minimum amount of deposit and withdrawal?
How long does it take to deposit & withdraw?
What are locked and free balances?