Transfer : PreBuild,Sign and Send Transaction

To have more granular control of the signing process, it can be divided into 3 parts and used.

Send Transaction by using Parent Chain UTXO

For this example, we will use the LTC chain.

PreBuild Transaction

To create an unsigned transaction object

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

// recipients data.
let recipients = {
     recipients:[
       {
         address:"MP2W5NwaCCDKSR8hHNCsYvgSc7evNdhmj1",
         amount:0.0002
       }
     ]
};

// PreBuildTransaction
let unSignedTx = await walletInstance.PreBuildTransaction(recipients);
console.log("UnSigned Transaction: => ", JSON.stringify(unSignedTx));
let walletInstance: Wallet = await liminalJs
    .Coin(CoinsEnum.ltc)
    .Wallets()
    .Get({ walletId: 296 });

// recipients data.
let recipients: PrebuildAndSignTransactionOptions = {
  recipients:[
       {
         address:"MP2W5NwaCCDKSR8hHNCsYvgSc7evNdhmj1",
         amount:0.0002
       }
     ]
};

// PreBuildTransaction
let unSignedTx: PrebuildTransactionResult = await walletInstance.PreBuildTransaction(recipients);
console.log("UnSigned Transaction: => ", JSON.stringify(unSignedTx));

Sample response

{
   "txHex":"70736274ff010073020000000159ad55648e5d11bdc45a5663f7b085a0cf13fae0b45e220f1451c3624771a8690100000000ffffffff02204e00000000000017a914a5ed5d0697e8f09df41e3010120549a2c492bb3487c2e63d000000000017a914ed2f8a5488871d87f048ded565498feaad9d7ab08700000000000100fdb60102000000000101799c63fb165136d223f3cfd302535463e6b86f189ae227b869134b0b0191f96401000000232200204a0e149186f20a2981605b83c140108dc726c134021b2bf954eec1ab45cb450fffffffff02102700000000000017a914a5ed5d0697e8f09df41e3010120549a2c492bb348720423e000000000017a914ed2f8a5488871d87f048ded565498feaad9d7ab087040047304402202906e729d1755f29fe4f8c734558afbf0e8876202d44861baf7552df1bd88d04022038811c9a5f123f42a6b1f9977401da3ecbad4278b5faa1795058793cee89ebb70147304402207b45e93a7998b62b69b57a0a21b9ff29df3e4681ce37bf9f60a74f7452b3209d02200bc54ca4aa62d69ba162d15cdebf6f375e8ae2eff070c33efbe140587467372b018b5221020bc37273befd8e61692dbe2071d37bb716445e50803db94e3c0ac0563e4749c22102a9dfe00d0b061a9e9dadca0fe56e83b24edf610a2a27ff983f19621d6851a5f02102f00eefd123247a953ba7416bffa413ce73d08efdeeb7afc004ba063d612fa0322102fcdf11ae3a5c26364b146f6089c0bd4d5eeae142c719fb3bc8e762e7a6f5486f54ae0000000001042200204a0e149186f20a2981605b83c140108dc726c134021b2bf954eec1ab45cb450f01058b5221020bc37273befd8e61692dbe2071d37bb716445e50803db94e3c0ac0563e4749c22102a9dfe00d0b061a9e9dadca0fe56e83b24edf610a2a27ff983f19621d6851a5f02102f00eefd123247a953ba7416bffa413ce73d08efdeeb7afc004ba063d612fa0322102fcdf11ae3a5c26364b146f6089c0bd4d5eeae142c719fb3bc8e762e7a6f5486f54ae000000",
   "amlScreening":[
      {
         "address":"MP2W5NwaCCDKSR8hHNCsYvgSc7evNdhmj1",
         "addressRiskIndicators":[
            
         ],
         "chain":"ltc",
         "entities":[
            {
               "category":"Exchange",
               "categoryId":"8",
               "entity":"FTX",
               "riskScoreLevel":1,
               "riskScoreLevelLabel":"Low",
               "trmUrn":"/entity/manual/8aab44d9-b09f-4cbe-a61c-48797d667f52"
            }
         ]
      }
   ]
}

Note:
The amlScreenig property will use for screening the address and identify the risk factor associated with it.

Sign Transaction

Sign the unsigned transaction object.

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

// recipients data.
let recipients = {
     recipients:[
       {
         address:"MP2W5NwaCCDKSR8hHNCsYvgSc7evNdhmj1",
         amount:0.0002
       }
     ]
};

// PreBuildTransaction
let unSignedTx = await walletInstance.PreBuildTransaction(recipients);
console.log("UnSigned Transaction: => ", JSON.stringify(unSignedTx));

// SignTransaction
let halfSigned = await walletInstance.SignTransaction(recipients, unSignedTx);
console.log("halfSigned Transaction: => ", JSON.stringify(halfSigned));
let walletInstance: Wallet = await liminalJs
    .Coin(CoinsEnum.ltc)
    .Wallets()
    .Get({ walletId: 296 });

// recipients data.
let recipients: PrebuildAndSignTransactionOptions = {
  recipients:[
       {
         address:"MP2W5NwaCCDKSR8hHNCsYvgSc7evNdhmj1",
         amount:0.0002
       }
     ]
};

// PreBuildTransaction
let unSignedTx: PrebuildTransactionResult = await walletInstance.PreBuildTransaction(recipients);
console.log("UnSigned Transaction: => ", JSON.stringify(unSignedTx));

// SignTransaction
let halfSigned: SignedTransaction = await walletInstance.SignTransaction(recipients, unSignedTx);
console.log("halfSigned Transaction: => ", JSON.stringify(halfSigned));

Sample response

{
   "txHex":"70736274ff010073020000000159ad55648e5d11bdc45a5663f7b085a0cf13fae0b45e220f1451c3624771a8690100000000ffffffff02204e00000000000017a914a5ed5d0697e8f09df41e3010120549a2c492bb3487c2e63d000000000017a914ed2f8a5488871d87f048ded565498feaad9d7ab08700000000000100fdb60102000000000101799c63fb165136d223f3cfd302535463e6b86f189ae227b869134b0b0191f96401000000232200204a0e149186f20a2981605b83c140108dc726c134021b2bf954eec1ab45cb450fffffffff02102700000000000017a914a5ed5d0697e8f09df41e3010120549a2c492bb348720423e000000000017a914ed2f8a5488871d87f048ded565498feaad9d7ab087040047304402202906e729d1755f29fe4f8c734558afbf0e8876202d44861baf7552df1bd88d04022038811c9a5f123f42a6b1f9977401da3ecbad4278b5faa1795058793cee89ebb70147304402207b45e93a7998b62b69b57a0a21b9ff29df3e4681ce37bf9f60a74f7452b3209d02200bc54ca4aa62d69ba162d15cdebf6f375e8ae2eff070c33efbe140587467372b018b5221020bc37273befd8e61692dbe2071d37bb716445e50803db94e3c0ac0563e4749c22102a9dfe00d0b061a9e9dadca0fe56e83b24edf610a2a27ff983f19621d6851a5f02102f00eefd123247a953ba7416bffa413ce73d08efdeeb7afc004ba063d612fa0322102fcdf11ae3a5c26364b146f6089c0bd4d5eeae142c719fb3bc8e762e7a6f5486f54ae00000000220202a9dfe00d0b061a9e9dadca0fe56e83b24edf610a2a27ff983f19621d6851a5f0483045022100e1d54a683f30a6c5020ac050a6e86b4715089ff551f0e6094a288a87a38b3fdb02205a48449c830ea1d7bc5de95db32c8e3b8bf9548f40bfcf7881877eb05e31165f0101042200204a0e149186f20a2981605b83c140108dc726c134021b2bf954eec1ab45cb450f01058b5221020bc37273befd8e61692dbe2071d37bb716445e50803db94e3c0ac0563e4749c22102a9dfe00d0b061a9e9dadca0fe56e83b24edf610a2a27ff983f19621d6851a5f02102f00eefd123247a953ba7416bffa413ce73d08efdeeb7afc004ba063d612fa0322102fcdf11ae3a5c26364b146f6089c0bd4d5eeae142c719fb3bc8e762e7a6f5486f54ae000000",
   "halfSigned":{
      "payload":"",
      "txBase64":"cHNidP8BAHMCAAAAAVmtVWSOXRG9xFpWY/ewhaDPE/rgtF4iDxRRw2JHcahpAQAAAAD/////AiBOAAAAAAAAF6kUpe1dBpfo8J30HjAQEgVJosSSuzSHwuY9AAAAAAAXqRTtL4pUiIcdh/BI3tVlSY/qrZ16sIcAAAAAAAEA/bYBAgAAAAABAXmcY/sWUTbSI/PP0wJTVGPmuG8YmuInuGkTSwsBkflkAQAAACMiACBKDhSRhvIKKYFgW4PBQBCNxybBNAIbK/lU7sGrRctFD/////8CECcAAAAAAAAXqRSl7V0Gl+jwnfQeMBASBUmixJK7NIcgQj4AAAAAABepFO0vilSIhx2H8Eje1WVJj+qtnXqwhwQARzBEAiApBucp0XVfKf5PjHNFWK+/Doh2IC1EhhuvdVLfG9iNBAIgOIEcml8SP0KmsfmXdAHaPsutQni1+qF5UFh5PO6J67cBRzBEAiB7Rek6eZi2K2m1egohuf8p3z5Ggc43v59gp090UrMgnQIgC8VMpKpi1puhYtFc3r9vN16K4u/wcMM+++FAWHRnNysBi1IhAgvDcnO+/Y5haS2+IHHTe7cWRF5QgD25TjwKwFY+R0nCIQKp3+ANCwYanp2tyg/lboOyTt9hCion/5g/GWIdaFGl8CEC8A7v0SMkepU7p0Fr/6QTznPQjv3ut6/ABLoGPWEvoDIhAvzfEa46XCY2SxRvYInAvU1e6uFCxxn7O8jnYuem9UhvVK4AAAAAIgICqd/gDQsGGp6drcoP5W6Dsk7fYQoqJ/+YPxliHWhRpfBIMEUCIQDh1UpoPzCmxQIKwFCm6GtHFQif9VHw5glKKIqHo4s/2wIgWkhEnIMOode8XeldsyyOO4v5VI9Av894gYd+sF4xFl8BAQQiACBKDhSRhvIKKYFgW4PBQBCNxybBNAIbK/lU7sGrRctFDwEFi1IhAgvDcnO+/Y5haS2+IHHTe7cWRF5QgD25TjwKwFY+R0nCIQKp3+ANCwYanp2tyg/lboOyTt9hCion/5g/GWIdaFGl8CEC8A7v0SMkepU7p0Fr/6QTznPQjv3ut6/ABLoGPWEvoDIhAvzfEa46XCY2SxRvYInAvU1e6uFCxxn7O8jnYuem9UhvVK4AAAA=",
      "txHex":"70736274ff010073020000000159ad55648e5d11bdc45a5663f7b085a0cf13fae0b45e220f1451c3624771a8690100000000ffffffff02204e00000000000017a914a5ed5d0697e8f09df41e3010120549a2c492bb3487c2e63d000000000017a914ed2f8a5488871d87f048ded565498feaad9d7ab08700000000000100fdb60102000000000101799c63fb165136d223f3cfd302535463e6b86f189ae227b869134b0b0191f96401000000232200204a0e149186f20a2981605b83c140108dc726c134021b2bf954eec1ab45cb450fffffffff02102700000000000017a914a5ed5d0697e8f09df41e3010120549a2c492bb348720423e000000000017a914ed2f8a5488871d87f048ded565498feaad9d7ab087040047304402202906e729d1755f29fe4f8c734558afbf0e8876202d44861baf7552df1bd88d04022038811c9a5f123f42a6b1f9977401da3ecbad4278b5faa1795058793cee89ebb70147304402207b45e93a7998b62b69b57a0a21b9ff29df3e4681ce37bf9f60a74f7452b3209d02200bc54ca4aa62d69ba162d15cdebf6f375e8ae2eff070c33efbe140587467372b018b5221020bc37273befd8e61692dbe2071d37bb716445e50803db94e3c0ac0563e4749c22102a9dfe00d0b061a9e9dadca0fe56e83b24edf610a2a27ff983f19621d6851a5f02102f00eefd123247a953ba7416bffa413ce73d08efdeeb7afc004ba063d612fa0322102fcdf11ae3a5c26364b146f6089c0bd4d5eeae142c719fb3bc8e762e7a6f5486f54ae00000000220202a9dfe00d0b061a9e9dadca0fe56e83b24edf610a2a27ff983f19621d6851a5f0483045022100e1d54a683f30a6c5020ac050a6e86b4715089ff551f0e6094a288a87a38b3fdb02205a48449c830ea1d7bc5de95db32c8e3b8bf9548f40bfcf7881877eb05e31165f0101042200204a0e149186f20a2981605b83c140108dc726c134021b2bf954eec1ab45cb450f01058b5221020bc37273befd8e61692dbe2071d37bb716445e50803db94e3c0ac0563e4749c22102a9dfe00d0b061a9e9dadca0fe56e83b24edf610a2a27ff983f19621d6851a5f02102f00eefd123247a953ba7416bffa413ce73d08efdeeb7afc004ba063d612fa0322102fcdf11ae3a5c26364b146f6089c0bd4d5eeae142c719fb3bc8e762e7a6f5486f54ae000000"
   }
}

Submit(Send) Transaction

Broadcast the signed transaction to the network:

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

// recipients data.
let recipients = {
     recipients:[
       {
         address:"MP2W5NwaCCDKSR8hHNCsYvgSc7evNdhmj1",
         amount:0.0002
       }
     ]
};

// PreBuildTransaction
let unSignedTx = await walletInstance.PreBuildTransaction(recipients);
console.log("UnSigned Transaction: => ", JSON.stringify(unSignedTx));

// SignTransaction
let halfSigned = await walletInstance.SignTransaction(recipients, unSignedTx);
console.log("halfSigned Transaction: => ", JSON.stringify(halfSigned));

// Submit Transaction (Send Many Transaction by passing halfSigned Object and sequenceId)
let transactionResponse = await walletInstance.Submit(halfSigned, "b7c24547-67c3-d390-dde9-f24de6deb1a0");
console.log("Send Many Transaction: =>", JSON.stringify(transactionResponse));
let walletInstance: Wallet = await liminalJs
    .Coin(CoinsEnum.ltc)
    .Wallets()
    .Get({ walletId: 296 });

// recipients data.
let recipients: PrebuildAndSignTransactionOptions = {
  recipients:[
       {
         address:"MP2W5NwaCCDKSR8hHNCsYvgSc7evNdhmj1",
         amount:0.0002
       }
     ]
};

// PreBuildTransaction
let unSignedTx: PrebuildTransactionResult = await walletInstance.PreBuildTransaction(recipients);
console.log("UnSigned Transaction: => ", JSON.stringify(unSignedTx));

// SignTransaction
let halfSigned: SignedTransaction = await walletInstance.SignTransaction(recipients, unSignedTx);
console.log("halfSigned Transaction: => ", JSON.stringify(halfSigned));

// Submit Transaction (Send Many Transaction by passing halfSigned Object and sequenceId)
let transactionResponse: any = await walletInstance.Submit(halfSigned, "b7c24547-67c3-d390-dde9-f24de6deb1a0");
console.log("Send Many Transaction: =>", JSON.stringify(transactionResponse));

Sample response

{
   "userid":76,
   "raw":"{\"txHex\":\"70736274ff010073020000000159ad55648e5d11bdc45a5663f7b085a0cf13fae0b45e220f1451c3624771a8690100000000ffffffff02204e00000000000017a914a5ed5d0697e8f09df41e3010120549a2c492bb3487c2e63d000000000017a914ed2f8a5488871d87f048ded565498feaad9d7ab08700000000000100fdb60102000000000101799c63fb165136d223f3cfd302535463e6b86f189ae227b869134b0b0191f96401000000232200204a0e149186f20a2981605b83c140108dc726c134021b2bf954eec1ab45cb450fffffffff02102700000000000017a914a5ed5d0697e8f09df41e3010120549a2c492bb348720423e000000000017a914ed2f8a5488871d87f048ded565498feaad9d7ab087040047304402202906e729d1755f29fe4f8c734558afbf0e8876202d44861baf7552df1bd88d04022038811c9a5f123f42a6b1f9977401da3ecbad4278b5faa1795058793cee89ebb70147304402207b45e93a7998b62b69b57a0a21b9ff29df3e4681ce37bf9f60a74f7452b3209d02200bc54ca4aa62d69ba162d15cdebf6f375e8ae2eff070c33efbe140587467372b018b5221020bc37273befd8e61692dbe2071d37bb716445e50803db94e3c0ac0563e4749c22102a9dfe00d0b061a9e9dadca0fe56e83b24edf610a2a27ff983f19621d6851a5f02102f00eefd123247a953ba7416bffa413ce73d08efdeeb7afc004ba063d612fa0322102fcdf11ae3a5c26364b146f6089c0bd4d5eeae142c719fb3bc8e762e7a6f5486f54ae00000000220202a9dfe00d0b061a9e9dadca0fe56e83b24edf610a2a27ff983f19621d6851a5f0483045022100e1d54a683f30a6c5020ac050a6e86b4715089ff551f0e6094a288a87a38b3fdb02205a48449c830ea1d7bc5de95db32c8e3b8bf9548f40bfcf7881877eb05e31165f0101042200204a0e149186f20a2981605b83c140108dc726c134021b2bf954eec1ab45cb450f01058b5221020bc37273befd8e61692dbe2071d37bb716445e50803db94e3c0ac0563e4749c22102a9dfe00d0b061a9e9dadca0fe56e83b24edf610a2a27ff983f19621d6851a5f02102f00eefd123247a953ba7416bffa413ce73d08efdeeb7afc004ba063d612fa0322102fcdf11ae3a5c26364b146f6089c0bd4d5eeae142c719fb3bc8e762e7a6f5486f54ae000000\",\"halfSigned\":{\"payload\":\"Some Value\",\"txBase64\":\"cHNidP8BAHMCAAAAAVmtVWSOXRG9xFpWY/ewhaDPE/rgtF4iDxRRw2JHcahpAQAAAAD/////AiBOAAAAAAAAF6kUpe1dBpfo8J30HjAQEgVJosSSuzSHwuY9AAAAAAAXqRTtL4pUiIcdh/BI3tVlSY/qrZ16sIcAAAAAAAEA/bYBAgAAAAABAXmcY/sWUTbSI/PP0wJTVGPmuG8YmuInuGkTSwsBkflkAQAAACMiACBKDhSRhvIKKYFgW4PBQBCNxybBNAIbK/lU7sGrRctFD/////8CECcAAAAAAAAXqRSl7V0Gl+jwnfQeMBASBUmixJK7NIcgQj4AAAAAABepFO0vilSIhx2H8Eje1WVJj+qtnXqwhwQARzBEAiApBucp0XVfKf5PjHNFWK+/Doh2IC1EhhuvdVLfG9iNBAIgOIEcml8SP0KmsfmXdAHaPsutQni1+qF5UFh5PO6J67cBRzBEAiB7Rek6eZi2K2m1egohuf8p3z5Ggc43v59gp090UrMgnQIgC8VMpKpi1puhYtFc3r9vN16K4u/wcMM+++FAWHRnNysBi1IhAgvDcnO+/Y5haS2+IHHTe7cWRF5QgD25TjwKwFY+R0nCIQKp3+ANCwYanp2tyg/lboOyTt9hCion/5g/GWIdaFGl8CEC8A7v0SMkepU7p0Fr/6QTznPQjv3ut6/ABLoGPWEvoDIhAvzfEa46XCY2SxRvYInAvU1e6uFCxxn7O8jnYuem9UhvVK4AAAAAIgICqd/gDQsGGp6drcoP5W6Dsk7fYQoqJ/+YPxliHWhRpfBIMEUCIQDh1UpoPzCmxQIKwFCm6GtHFQif9VHw5glKKIqHo4s/2wIgWkhEnIMOode8XeldsyyOO4v5VI9Av894gYd+sF4xFl8BAQQiACBKDhSRhvIKKYFgW4PBQBCNxybBNAIbK/lU7sGrRctFDwEFi1IhAgvDcnO+/Y5haS2+IHHTe7cWRF5QgD25TjwKwFY+R0nCIQKp3+ANCwYanp2tyg/lboOyTt9hCion/5g/GWIdaFGl8CEC8A7v0SMkepU7p0Fr/6QTznPQjv3ut6/ABLoGPWEvoDIhAvzfEa46XCY2SxRvYInAvU1e6uFCxxn7O8jnYuem9UhvVK4AAAA=\",\"txHex\":\"70736274ff010073020000000159ad55648e5d11bdc45a5663f7b085a0cf13fae0b45e220f1451c3624771a8690100000000ffffffff02204e00000000000017a914a5ed5d0697e8f09df41e3010120549a2c492bb3487c2e63d000000000017a914ed2f8a5488871d87f048ded565498feaad9d7ab08700000000000100fdb60102000000000101799c63fb165136d223f3cfd302535463e6b86f189ae227b869134b0b0191f96401000000232200204a0e149186f20a2981605b83c140108dc726c134021b2bf954eec1ab45cb450fffffffff02102700000000000017a914a5ed5d0697e8f09df41e3010120549a2c492bb348720423e000000000017a914ed2f8a5488871d87f048ded565498feaad9d7ab087040047304402202906e729d1755f29fe4f8c734558afbf0e8876202d44861baf7552df1bd88d04022038811c9a5f123f42a6b1f9977401da3ecbad4278b5faa1795058793cee89ebb70147304402207b45e93a7998b62b69b57a0a21b9ff29df3e4681ce37bf9f60a74f7452b3209d02200bc54ca4aa62d69ba162d15cdebf6f375e8ae2eff070c33efbe140587467372b018b5221020bc37273befd8e61692dbe2071d37bb716445e50803db94e3c0ac0563e4749c22102a9dfe00d0b061a9e9dadca0fe56e83b24edf610a2a27ff983f19621d6851a5f02102f00eefd123247a953ba7416bffa413ce73d08efdeeb7afc004ba063d612fa0322102fcdf11ae3a5c26364b146f6089c0bd4d5eeae142c719fb3bc8e762e7a6f5486f54ae00000000220202a9dfe00d0b061a9e9dadca0fe56e83b24edf610a2a27ff983f19621d6851a5f0483045022100e1d54a683f30a6c5020ac050a6e86b4715089ff551f0e6094a288a87a38b3fdb02205a48449c830ea1d7bc5de95db32c8e3b8bf9548f40bfcf7881877eb05e31165f0101042200204a0e149186f20a2981605b83c140108dc726c134021b2bf954eec1ab45cb450f01058b5221020bc37273befd8e61692dbe2071d37bb716445e50803db94e3c0ac0563e4749c22102a9dfe00d0b061a9e9dadca0fe56e83b24edf610a2a27ff983f19621d6851a5f02102f00eefd123247a953ba7416bffa413ce73d08efdeeb7afc004ba063d612fa0322102fcdf11ae3a5c26364b146f6089c0bd4d5eeae142c719fb3bc8e762e7a6f5486f54ae000000\",\"sequenceId\":\"b7c24547-67c3-d390-dde9-f24de6deb1a0\"},\"user\":{\"id\":76,\"displayName\":\"Machine\",\"photoURL\":\"https://cdn.icon-icons.com/icons2/1378/PNG/512/avatardefault_92824.png\",\"lastLoginAt\":\"2021-12-28T10:22:28.000Z\",\"email\":\"[email protected]\",\"phoneNumber\":null,\"status\":1,\"created_at\":\"2021-09-08T09:05:22.000Z\",\"clientid\":\"UT3DKwJuEf1L5LiDU7jkwnhE16JU3NKu\",\"type\":2},\"sequenceId\":\"b7c24547-67c3-d390-dde9-f24de6deb1a0\"}",
   "status":1,
   "walletid":"296",
   "type":1,
   "asset":"LTC",
   "chain":"LTC",
   "timestamp":"2021-12-28T10:23:38.421Z",
   "transactionSequenceId":4677,
   "sequenceId":"b7c24547-67c3-d390-dde9-f24de6deb1a0",
   "amount":0.0002,
   "destinationAddress":"MP2W5NwaCCDKSR8hHNCsYvgSc7evNdhmj1",
   "id":6516,
   "usdamount":0.03028
}

To check the status of the transaction by using sequence ID then please visit the following page:
<<https://docs.lmnl.app/docs/transaction-status#transaction-status-by-sequence-id>>


Did this page help you?