What will i have if i execute a PCse

If we have a sample PCse and we executed the depositLiqudity method ;

async function depositLiqudity(ratio)
{
    if (isNaN(ratio))
        return {error:1,message:'Ratio must be a number!'};    
    if (ratio<=0)
    return {error:1,message:'Could not set Ratio Zero or Negative Number'};
    if (AMOUNT===undefined)
        return {error:1,message:'You must send Amount!'};
    if (AMOUNT<=0)
        return {error:1,message:'Amount must be Positive!'};
    let expireDate=new Date();
    expireDate.setDate(expireDate.getDate() + 2);
    
    const addedLiqsRecords=[
        {key:'addedLiq',value:AMOUNT,enc:0},
        {key:'addedAssetID',value:ASSETID,enc:0},
        {key:'ratio',value:ratio,enc:0},
        {key:'expireDate',value:expireDate,enc:0}
    ];
    return Transaction.pushData(JSON.stringify(addedLiqsRecords),EXECUTER_ADDRESS);
}

System gives us below response if all conditions met. Local Transactions are made by PCse. And User must send a few of AMOUNT to execute. As we see the 20th code line, PCse pushes the a new generated data into block network.

Response:

{
  "transactionHash": "ea9cdc717dce55af99a4e2d9551fa4d546a725c247f2775ffd4fcc63c9d17e00",
  "signature": "30450221009ac12983a2337249a0a0656bc1806673e9a82049b3282e2413fb897b360aceb502200ddb7d2b0ce18305ea445a01921c8498175d9452b46d4da5dec55c32657d2be5",
  }  

When we call getTransaction method with relevant Transaction Hash then system gives us below response:

{
  "type": -1,
  "isFromScenario": false,
  "confirmed": true,
  "confirmationCount": 5,
  "transactionHash": "ea9cdc717dce55af99a4e2d9551fa4d546a725c247f2775ffd4fcc63c9d17e00",
  "__v": 5,
  "amount": 1000,
  "assetID": 10007,
  "blockHeight": 3919629,
  "fee": 2.3,
  "from": "PRTMRKWZ56v4D8mV1oj813bqTgdfUm9J4woVTDMpGxF",
  "metaData": "{\"type\":\"executeMethod\",\"data\":{\"scenarioAddress\":\"PRTMQbunYS1CxSs5i59CrR4ot2WUThT9JvsKvLYDfwF\",\"method\":\"depositLiqudity\",\"params\":[\"1.345678\"],\"executeAddress\":\"PRTMRKWZ56v4D8mV1oj813bqTgdfUm9J4woVTDMpGxF\"}}",
  "pub": "04489dac5311bcb1d454af5f264edf4db531f25b4c14796ff568700b8805d7e620d428a6afdc588493380fa8fa3fc88d3961940a243208730e913a0d1be738193c",
  "signature": "30450221009ac12983a2337249a0a0656bc1806673e9a82049b3282e2413fb897b360aceb502200ddb7d2b0ce18305ea445a01921c8498175d9452b46d4da5dec55c32657d2be5",
  "symbol": "PEP0",
  "timeStamp": 1704809671956,
  "to": "PRTMQbunYS1CxSs5i59CrR4ot2WUThT9JvsKvLYDfwF",
  "validatorNodes": [
    {
      "_id": "659d54c9a1901845825fb09e",
      "nodeName": "BIRUNI",
      "message": "SUCCESS",
      "dateTime": "2024-01-09T14:14:33.031Z",
      "result": 1
    },
    {
      "_id": "659d54c9a1901845825fb0a6",
      "nodeName": "INALCIK",
      "message": "SUCCESS",
      "dateTime": "2024-01-09T14:14:33.202Z",
      "result": 1
    },
    {
      "_id": "659d54c9a1901845825fb0d7",
      "nodeName": "AKURGAL",
      "message": "SUCCESS",
      "dateTime": "2024-01-09T14:14:33.487Z",
      "result": 1
    },
    {
      "_id": "659d54c9a1901845825fb0de",
      "nodeName": "CELEBI",
      "message": "SUCCESS",
      "dateTime": "2024-01-09T14:14:33.501Z",
      "result": 1
    },
    {
      "_id": "659d54c9a1901845825fb0ea",
      "nodeName": "KUSCU",
      "message": "SUCCESS",
      "dateTime": "2024-01-09T14:14:33.939Z",
      "result": 1
    }
  ],
  "customData": [],
  "broadcastHex": "007b00220070007500620022003a002200300034003400380039006400610063003500330031003100620063006200310064003400350034006100660035006600320036003400650064006600340064006200350033003100660032003500620034006300310034003700390036006600660035003600380037003000300062003800380030003500640037006500360032003000640034003200380061003600610066006400630035003800380034003900330033003800300066006100380066006100330066006300380038006400330039003600310039003400300061003200340033003200300038003700330030006500390031003300610030006400310062006500370033003800310039003300630022002c0022007300690067006e006100740075007200650022003a002200330030003400350030003200320031003000300039006100630031003200390038003300610032003300330037003200340039006100300061003000360035003600620063003100380030003600360037003300650039006100380032003000340039006200330032003800320065003200340031003300660062003800390037006200330036003000610063006500620035003000320032003000300064006400620037006400320062003000630065003100380033003000350065006100340034003500610030003100390032003100630038003400390038003100370035006400390034003500320062003400360064003400640061003500640065006300350035006300330032003600350037006400320062006500350022002c002200660072006f006d0022003a0022005000520054004d0052004b0057005a003500360076003400440038006d00560031006f006a0038003100330062007100540067006400660055006d0039004a00340077006f005600540044004d00700047007800460022002c00220074006f0022003a0022005000520054004d005100620075006e005900530031004300780053007300350069003500390043007200520034006f00740032005700550054006800540039004a00760073004b0076004c005900440066007700460022002c002200740069006d0065005300740061006d00700022003a0031003700300034003800300039003600370031003900350036002c002200610073007300650074004900440022003a00310030003000300037007d",
  "localTransactions": [
    {
      "type": 9,
      "isFromScenario": true,
      "confirmed": false,
      "confirmationCount": 0,
      "_id": "659d54f29428f9fbf0234776",
      "transactionHash": "19afc2cf0713c4710fc19ca2c53b769ca362c126ebde67cecff2f14e72f76c78",
      "__v": 0,
      "amount": 0,
      "assetID": -1,
      "blockHeight": 3919629,
      "fee": 0.3585,
      "from": "PRTMQbunYS1CxSs5i59CrR4ot2WUThT9JvsKvLYDfwF",
      "parentTransaction": "ea9cdc717dce55af99a4e2d9551fa4d546a725c247f2775ffd4fcc63c9d17e00",
      "scenarioExecuterAddress": "PRTMQbunYS1CxSs5i59CrR4ot2WUThT9JvsKvLYDfwF",
      "symbol": "PIRI",
      "timeStamp": 1704809673294,
      "to": "PRTMRKWZ56v4D8mV1oj813bqTgdfUm9J4woVTDMpGxF",
      "validatorNodes": [],
      "customDocs": [
        {
          "_id": "659d54c9a1901845825fb0c5",
          "txID": "19afc2cf0713c4710fc19ca2c53b769ca362c126ebde67cecff2f14e72f76c78",
          "key": "expireDate",
          "value": "2024-01-11T14:14:33.289Z",
          "timeStamp": 1704809673294,
          "from": "PRTMQbunYS1CxSs5i59CrR4ot2WUThT9JvsKvLYDfwF",
          "to": "PRTMRKWZ56v4D8mV1oj813bqTgdfUm9J4woVTDMpGxF",
          "enc": 0,
          "__v": 0,
          "blockHeight": 3919629
        },
        {
          "_id": "659d54c9a1901845825fb0c4",
          "txID": "19afc2cf0713c4710fc19ca2c53b769ca362c126ebde67cecff2f14e72f76c78",
          "key": "addedLiq",
          "value": "1000",
          "timeStamp": 1704809673294,
          "from": "PRTMQbunYS1CxSs5i59CrR4ot2WUThT9JvsKvLYDfwF",
          "to": "PRTMRKWZ56v4D8mV1oj813bqTgdfUm9J4woVTDMpGxF",
          "enc": 0,
          "__v": 0,
          "blockHeight": 3919629
        },
        {
          "_id": "659d54c9a1901845825fb0c6",
          "txID": "19afc2cf0713c4710fc19ca2c53b769ca362c126ebde67cecff2f14e72f76c78",
          "key": "ratio",
          "value": "1.345678",
          "timeStamp": 1704809673294,
          "from": "PRTMQbunYS1CxSs5i59CrR4ot2WUThT9JvsKvLYDfwF",
          "to": "PRTMRKWZ56v4D8mV1oj813bqTgdfUm9J4woVTDMpGxF",
          "enc": 0,
          "__v": 0,
          "blockHeight": 3919629
        },
        {
          "_id": "659d54c9a1901845825fb0c3",
          "txID": "19afc2cf0713c4710fc19ca2c53b769ca362c126ebde67cecff2f14e72f76c78",
          "key": "addedAssetID",
          "value": "10007",
          "timeStamp": 1704809673294,
          "from": "PRTMQbunYS1CxSs5i59CrR4ot2WUThT9JvsKvLYDfwF",
          "to": "PRTMRKWZ56v4D8mV1oj813bqTgdfUm9J4woVTDMpGxF",
          "enc": 0,
          "__v": 0,
          "blockHeight": 3919629
        }
      ]
    }
  ]
}

It involves the metaData property explains the this transaction has been created by PCse. and we can find params and which method was executed.

 "metaData": "{\"type\":\"executeMethod\",\"data\":{\"scenarioAddress\":\"PRTMQbunYS1CxSs5i59CrR4ot2WUThT9JvsKvLYDfwF\",\"method\":\"depositLiqudity\",\"params\":[\"1.345678\"],\"executeAddress\":\"PRTMRKWZ56v4D8mV1oj813bqTgdfUm9J4woVTDMpGxF\"}}",

Last updated