From 2705c36c70017f238aa6fc362e785e6cd109bec0 Mon Sep 17 00:00:00 2001 From: productshiv Date: Fri, 5 Apr 2024 21:08:05 +0530 Subject: [PATCH] Testing Algorand --- v1.0/RPC Nodes/others/rpc-algorand.md | 9 +++ .../rpc-algorand/simulateTransaction.md | 75 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 v1.0/RPC Nodes/others/rpc-algorand.md create mode 100644 v1.0/RPC Nodes/others/rpc-algorand/simulateTransaction.md diff --git a/v1.0/RPC Nodes/others/rpc-algorand.md b/v1.0/RPC Nodes/others/rpc-algorand.md new file mode 100644 index 00000000..5a8f2c70 --- /dev/null +++ b/v1.0/RPC Nodes/others/rpc-algorand.md @@ -0,0 +1,9 @@ +--- +title: "Algorand" +slug: "rpc-algorand" +excerpt: "" +category: 65c5e93c623cad004b45d505 +hidden: false +createdAt: "Wed Mar 06 2024 10:35:18 GMT+0000 (Coordinated Universal Time)" +updatedAt: "Wed Mar 06 2024 13:09:53 GMT+0000 (Coordinated Universal Time)" +--- diff --git a/v1.0/RPC Nodes/others/rpc-algorand/simulateTransaction.md b/v1.0/RPC Nodes/others/rpc-algorand/simulateTransaction.md new file mode 100644 index 00000000..ba19e2ce --- /dev/null +++ b/v1.0/RPC Nodes/others/rpc-algorand/simulateTransaction.md @@ -0,0 +1,75 @@ +--- +title: "simulateTransaction" +slug: "rpc-algorand-simulateTransaction" +excerpt: "Algorand RPC" +category: 65c5e93c623cad004b45d505 +hidden: false +metadata: + description: "Algorand RPC" + image: [] + keywords: "algorand, rpc" + robots: "index" +createdAt: "Wed Mar 06 2024 10:35:44 GMT+0000 (Coordinated Universal Time)" +updatedAt: "Tue Apr 02 2024 08:40:59 GMT+0000 (Coordinated Universal Time)" +--- +[block:html]{"html":"
\n
Archive Method
\n

Only on the full archive nodes. Complex queries might take longer and incur additional cost

\n
"}[/block]\n +### How to use it + +```typescript +// Import required libraries and modules from Tatum SDK +import { TatumSDK, AlgorandAlgod, Network } from '@tatumio/tatum'; + +// Initialize the Tatum SDK for Algorand +const tatum = await TatumSDK.init({ network: Network.ALGORAND_ALGOD }); + +// Define the input parameters in a single object +const params = { + format: 'json', // Optional: Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. +}; + +// Define the request body object +const requestBody = { + // Specify the transactions to simulate, along with any other inputs. + // Please refer to the Tatum SDK documentation for detailed information about the request body schema. +}; + +// Simulate the transaction or transaction group on the Algorand network +const simulationResult = await tatum.rpc.simulateTransaction(params, requestBody); + +// Log the simulation result +console.log('Algorand Transaction Simulation Result:', simulationResult); + +// Always destroy the Tatum SDK instance when done to stop any background processes +await tatum.destroy(); +``` + +### Overview + +The `simulateTransaction` method allows you to simulate a raw transaction or transaction group as it would be evaluated on the Algorand network. The simulation will use blockchain state from the latest committed round. + +### Example Use Cases + +1. **Transaction Simulation**: Developers can use this method to test the validity and outcome of a transaction or transaction group before actually submitting it to the Algorand network. This can help avoid failed transactions and wasted resources. + +### Request Parameters + +The `simulateTransaction` method requires the following parameters: + +- `format` (enum: json, msgpack, optional): Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. + +### Request Body + +The `simulateTransaction` method requires a request body object. Please refer to the Tatum SDK documentation for detailed information about the request body schema. + +### Return Object + +The method returns an object representing the result of the simulated transaction or transaction group. Please note that the structure of the returned object may vary depending on the format specified in the request parameters and the Algorand RPC version. + +### Error Responses + +- `400`: Bad Request. The request was invalid or missing required parameters. +- `401`: Invalid API Token. The API token used for authentication is invalid. +- `500`: Internal Error. An unexpected error occurred on the server. +- `503`: Service Temporarily Unavailable. The server is temporarily unable to handle the request. + +Please refer to the Tatum SDK documentation for more information about error responses.