Retrieve a transaction from deposit

return to Examples

To retrieve available transaction, you need to ensure that it’s state is ready. Then send retrieve request:

interface RetrieveRequest {
  id: string // ID of the transaction you want to retrieve
  raw: string // Raw transaction

The ID can be obtained from getByOwnerId(). Raw transaction will be published to blockchain:

// library to load environment variables from .env file
import dotenv from 'dotenv'

// import required class, types and tool
import Service, { Responses, Event, DebugLevels, wait } from '@kiroboio/safe-transfer-lib'

// configure the library

// get authentication details
const authDetails = { key: process.env.AUTH_KEY || '', secret: process.env.AUTH_SECRET || '' }

// setup eventBus to process the event, coming from the API
function eventBus(event: Event): void {
  // here were are just displaying the event
  console.dir(event, { depth: 15, colors: true, compact: true })

// configure Kirobo API service library
const service = Service.getInstance(
    debug: DebugLevels.QUIET, // minimize the console logging
    respondAs: Responses.Callback, // send feedback and events through callback function, i.e. eventBus
    eventBus, // providing the function for eventBus
    authDetails, // authentication details
  true, //  replace previous instances

// main function
async function run(): Promise<void> {
  // set a delay to allow the service proceed with initial connection, and authorization
  await wait(2000)

  try {
    service.retrieve({ id: 'aaaaa', raw: 'bbbbb' })
  } catch (err) {

// run the main function

In response the library will send:

fromNodeTxid: 'transaction_id'

to top

return to Examples