Skip to content

Commit

Permalink
Testing Algorand
Browse files Browse the repository at this point in the history
  • Loading branch information
productshiv committed Apr 5, 2024
1 parent 3a7d563 commit 2705c36
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
9 changes: 9 additions & 0 deletions v1.0/RPC Nodes/others/rpc-algorand.md
Original file line number Diff line number Diff line change
@@ -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)"
---
75 changes: 75 additions & 0 deletions v1.0/RPC Nodes/others/rpc-algorand/simulateTransaction.md
Original file line number Diff line number Diff line change
@@ -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":"<div style=\"padding: 10px 20px; border-radius: 5px; background-color: #e6e2ff; margin: 0 0 30px 0;\">\n <h5>Archive Method</h5>\n <p>Only on the full archive nodes. Complex queries might take longer and incur additional cost</p>\n</div>"}[/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<AlgorandAlgod>({ 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.

0 comments on commit 2705c36

Please sign in to comment.