From f88a04cfcac0afe29e363cae183df637e138ac47 Mon Sep 17 00:00:00 2001 From: Lavinia Talpas Date: Tue, 8 Aug 2023 20:37:41 +0300 Subject: [PATCH 1/2] add data visualization to evm.getAtomicTx --- Avalanche.postman_collection.json | 326 +++++++++++++++++++++++++++++- 1 file changed, 324 insertions(+), 2 deletions(-) diff --git a/Avalanche.postman_collection.json b/Avalanche.postman_collection.json index da1c98e..dcd05c7 100644 --- a/Avalanche.postman_collection.json +++ b/Avalanche.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "133cf180-c9cf-4d6b-9834-944dc66f7f0f", + "_postman_id": "3d716136-a9a1-45a5-86ca-2102a10a86a7", "name": "Avalanche", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "23086587" @@ -4973,12 +4973,334 @@ }, { "name": "getAtomicTx", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var res = {};", + "const req = JSON.parse(pm.request.body.raw)", + "const txID = req.params.txID", + "var view = `", + "", + " ", + "", + "", + "", + "", + "", + "", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + "", + " {{#if response.inputs.0.address}}", + " ", + " ", + " ", + " ", + " ", + " {{/if}}", + "", + " {{#if response.inputs.0.nonce}}", + " ", + " ", + " ", + " ", + " ", + " {{/if}}", + "", + " {{#if response.inputs.0.id}}", + " ", + " ", + " ", + " ", + " ", + " {{/if}}", + "", + " {{#if response.inputs.0.txId}}", + " ", + " ", + " ", + " ", + " ", + " {{/if}}", + "", + " {{#if response.inputs.0.index}}", + " ", + " ", + " ", + " ", + " ", + " {{/if}}", + "", + " {{#if response.inputs.0.amount}}", + " ", + " ", + " ", + " ", + " ", + " {{/if}}", + "", + " {{#if response.inputs.0.srcChain}}", + " ", + " ", + " ", + " ", + " ", + " {{/if}}", + "", + " ", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + "", + " {{#if response.outputs.0.address}}", + " ", + " ", + " ", + " ", + " ", + " {{/if}}", + "", + " {{#if response.outputs.0.id}}", + " ", + " ", + " ", + " ", + " ", + " {{/if}}", + "", + " {{#if response.outputs.0.txId}}", + " ", + " ", + " ", + " ", + " ", + " {{/if}}", + "", + " {{#if response.outputs.0.index}}", + " ", + " ", + " ", + " ", + " ", + " {{/if}}", + "", + " {{#if response.outputs.0.amount}}", + " ", + " ", + " ", + " ", + " ", + " {{/if}}", + "", + " {{#if response.outputs.0.dstChain}}", + " ", + " ", + " ", + " ", + " ", + " {{/if}}", + "", + " {{#if response.outputs.0.owner.addresses}}", + " ", + " ", + " ", + " ", + " ", + " {{/if}}", + "", + " {{#if response.outputs.0.owner.threshold}}", + " ", + " ", + " ", + " ", + " ", + " {{/if}}", + "", + "", + " ", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + " ", + "", + " ", + " ", + " ", + " ", + " ", + "", + "", + "
Decoded Atomic TX:
ID: {{response.id}}
Type: {{response.type}}
From: {{response.from}}
To: {{response.to}}
From: {{response.from}}
Chain ID: {{response.chainId}}
Date: {{response.timestamp}}
Block number: {{response.blockNumber}}
Block hash: {{response.blockHash}}
Value: {{response.value}}
Burned fees: {{response.burnedFees}}
Status: {{response.status}}
Inputs
Address: {{response.inputs.0.address}}
Nonce: {{response.inputs.0.nonce}}
ID: {{response.inputs.0.id}}
Transaction ID: {{response.inputs.0.txId}}
Index: {{response.inputs.0.index}}
Amount: {{response.inputs.0.amount}}
Source chain: {{response.inputs.0.srcChain}}
Asset ID: {{response.inputs.0.asset.id}}
Asset name: {{response.inputs.0.asset.name}}
Asset symbol: {{response.inputs.0.asset.symbol}}
Asset denomination: {{response.inputs.0.asset.denomination}}
Asset type: {{response.inputs.0.asset.type}}
Outputs
Address: {{response.outputs.0.address}}
ID: {{response.outputs.0.id}}
Transaction ID: {{response.outputs.0.txId}}
Index: {{response.outputs.0.index}}
Amount: {{response.outputs.0.amount}}
Destination chain: {{response.outputs.0.dstChain}}
Owner address: {{response.outputs.0.owner.addresses}}
Threshold: {{response.outputs.0.owner.threshold}}
Asset ID: {{response.outputs.0.asset.id}}
Asset name: {{response.outputs.0.asset.name}}
Asset symbol: {{response.outputs.0.asset.symbol}}
Asset denomination: {{response.outputs.0.asset.denomination}}
Asset type: {{response.outputs.0.asset.type}}
", + "`;", + "", + "const requestURL = \"https://api-beta.avascan.info/v2/network/mainnet/evm/43114/transactions/\" + txID ;", + "console.log(requestURL)", + "pm.sendRequest(requestURL, function (err, response) {", + " res = response.json();", + " console.log(res.value)", + " pm.visualizer.set(view, {", + " response: res,", + " });", + "})", + "" + ], + "type": "text/javascript" + } + } + ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\n \"jsonrpc\":\"2.0\",\n \"id\" :1,\n \"method\" :\"avax.getAtomicTx\",\n \"params\" :{\n \"txID\":\"2GD5SRYJQr2kw5jE73trBFiAgVQyrCaeg223TaTyJFYXf2kPty\",\n \"encoding\": \"hex\"\n }\n}", + "raw": "{\n \"jsonrpc\":\"2.0\",\n \"id\" :1,\n \"method\" :\"avax.getAtomicTx\",\n \"params\" :{\n \"txID\":\"9zX25brVj24xMBXJFw973MGVgkuDwvFPyBQoqo4pLye5mBkhN\",\n \"encoding\": \"hex\"\n }\n}", "options": { "raw": { "language": "json" From 24fcfdf59cd6742db9b8357ff696b9f698fda050 Mon Sep 17 00:00:00 2001 From: Lavinia Talpas Date: Tue, 8 Aug 2023 21:02:27 +0300 Subject: [PATCH 2/2] modify date format + add comment --- Avalanche.postman_collection.json | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Avalanche.postman_collection.json b/Avalanche.postman_collection.json index dcd05c7..d61cfb1 100644 --- a/Avalanche.postman_collection.json +++ b/Avalanche.postman_collection.json @@ -5018,9 +5018,18 @@ " outputsAmount.innerHTML = outAmountInAvax + \" AVAX\"", "", "}", + "", + "function convertTime() {", + " const dateCell = document.getElementById(\"time\")", + " const date = dateCell.innerText", + " const splitDate = date.split(\"T\")", + " const time = splitDate[1].split(\"000Z\")", + "", + " dateCell.innerHTML = splitDate[0] + \" | \" + time[0]", + "}", "", "", - "", + "", "", "", " ", @@ -5059,7 +5068,7 @@ "", " ", " ", - " ", + " ", " ", "", " ", @@ -5300,7 +5309,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"jsonrpc\":\"2.0\",\n \"id\" :1,\n \"method\" :\"avax.getAtomicTx\",\n \"params\" :{\n \"txID\":\"9zX25brVj24xMBXJFw973MGVgkuDwvFPyBQoqo4pLye5mBkhN\",\n \"encoding\": \"hex\"\n }\n}", + "raw": "{\n \"jsonrpc\":\"2.0\",\n \"id\" :1,\n \"method\" :\"avax.getAtomicTx\",\n \"params\" :{\n \"txID\":\"9zX25brVj24xMBXJFw973MGVgkuDwvFPyBQoqo4pLye5mBkhN\",\n \"encoding\": \"hex\"\n }\n}\n\n//choose \"Visualize\" from the output section to see the decoded tx", "options": { "raw": { "language": "json"
Date: {{response.timestamp}} {{response.timestamp}}