Block UTXO Transaction

Block UTXO Transaction

This feature allows you to block UTXO transaction by passing Hash and Transaction Position value.

Note:
This works only in the UTXO base chains.

// Get Wallet Instance
let walletInstance = await liminalJs
  .Coin(CoinsEnum.ltc)
  .Wallets()
  .Get({ walletId: 296 });

// Create Block UTXO Transaction    
let response= await walletInstance?.BlockUTXO({
  hash:"3dd3795d48b05eb26fa0563f1127f83fc6b4cd79a0d2968199d77d4e2b3f4c35",
  pos:2
});

if(response?.success===true){
  console.log(`Success => ${response?.data?.message}`);
}
else
{
  console.log(`Error Code => ${response?.code}`);
  console.log(`fail => ${response?.message}`);
}
// Get Wallet Instance
let walletInstance: Wallet = await liminalJs
  .Coin(CoinsEnum.ltc)
  .Wallets()
  .Get({ walletId: 296 });

// Create Block UTXO Transaction    
let response:BlockUtxoResultDataWrapper= await walletInstance?.BlockUTXO({
  hash:"3dd3795d48b05eb26fa0563f1127f83fc6b4cd79a0d2968199d77d4e2b3f4c35",
  pos:2
});

if(response?.success===true){
  console.log(`Success => ${response?.data?.message}`);
}
else
{
  console.log(`Error Code => ${response?.code}`);
  console.log(`fail => ${response?.message}`);
}

Parameter:

Params

Data Type

Description

hash

string

Specify the Hash value.

pos

number

Specify the transaction position value.

API Error Code:

Error Code

Error Message

BLOCK_UTXO_001

Operation permitted only for utxo wallets.

BLOCK_UTXO_002

The given hash exists in the system.

You will get the following response from the BlockUTXO method. It is JSON representation Only.

{
   "success":true,
   "data":{
      "message":"The given Transaction 3dd3795d48b05eb26fa0563f1127f83fc6b4cd79a0d2968199d77d4e2b3f4c35 and Transaction Position 2 has successfully blocked in the system."
   }
}

Full Example

import { CoinsEnum,LiminalEnvironment, LiminalJs } from "@lmnl/liminaljs";

const main = async () => {
    try {
        // Instance of Liminal Js
        let liminalJs = new LiminalJs(LiminalEnvironment.test);
        await liminalJs
            .Authenticate({
                clientId: "YOUR_CLIENT_ID",
                clientSecret: "YOUR_CLIENT_SECRET"
            })
            .AuthenticateWithAccessToken();

        // Get Wallet Instance
        let walletInstance = await liminalJs
          .Coin(CoinsEnum.ltc)
          .Wallets()
          .Get({ walletId: 296 });

        // Create Block UTXO Transaction    
        let response= await walletInstance?.BlockUTXO({
          hash:"3dd3795d48b05eb26fa0563f1127f83fc6b4cd79a0d2968199d77d4e2b3f4c35",
          pos:2
        });

        if(response?.success===true){
          console.log(`Success => ${response?.data?.message}`);
        }
        else
        {
          console.log(`Error Code => ${response?.code}`);
          console.log(`fail => ${response?.message}`);
        }
    }
    catch (ex) {
        throw ex;
    }
};
main().then((resolve) => console.log("Complete")).catch((error) => console.log(error));
import {
    CoinsEnum,
    BlockUtxoResultDataWrapper,
    LiminalEnvironment,
    LiminalJs,
    Wallet
} from "@lmnl/liminaljs";

const main = async (): Promise<void> => {
    try {
        // Instance of Liminal Js
        let liminalJs = new LiminalJs(LiminalEnvironment.test);
        await liminalJs
            .Authenticate({
                clientId: "YOUR_CLIENT_ID",
                clientSecret: "YOUR_CLIENT_SECRET"
            })
            .AuthenticateWithAccessToken();

        // Get Wallet Instance
        let walletInstance: Wallet = await liminalJs
          .Coin(CoinsEnum.ltc)
          .Wallets()
          .Get({ walletId: 296 });

        // Create Block UTXO Transaction    
        let response:BlockUtxoResultDataWrapper= await walletInstance?.BlockUTXO({
          hash:"3dd3795d48b05eb26fa0563f1127f83fc6b4cd79a0d2968199d77d4e2b3f4c35",
          pos:2
        });

        if(response?.success===true){
          console.log(`Success => ${response?.data?.message}`);
        }
        else
        {
          console.log(`Error Code => ${response?.code}`);
          console.log(`fail => ${response?.message}`);
        }


    }
    catch (ex) {
        throw ex;
    }
}

main().then((resolve) => console.log("Complete")).catch((error) => console.log(error));

Did this page help you?