Aryze Docs
  • 🌱Introduction
    • Introduction
    • What Are Stablecoins?
    • Why Choose Aryze?
  • 🪙Our Services
    • Quick Start Guide
    • Branded Stablecoins (SaaS)
    • Treasury Optimization
    • FX API Integration
  • 💻Technical Overview
    • Stablecoin Architecture
    • reForge FX Engine
  • 💻API
    • reForge API
      • Get started
      • Endpoints
      • Usage examples
    • Aryze Orders API
      • Get started
      • Endpoints
      • Usage examples
  • Faucet
  • 🪙$RYZE
    • What is $RYZE?
    • Tokenomics
    • Ecosystem Utilities
    • Future Developments
  • 📄Documentation
    • Contracts List
    • Audits
  • 🏛️Company
    • Legal Framework
    • Backing & Solvency
    • Entities
    • Mission
    • Roadmap
    • Resources & Links
    • Media Kit
    • Contact Us
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. API
  2. reForge API

Usage examples

Below are some examples demonstrating how to make requests to each of the API methods described earlier.

1. Prepare a Transaction

These examples use the requests library, which is a popular choice for making HTTP requests in Python. If you haven't already, you will need to install the requests library using pip:

pip install requests
import requests
import json

url = "https://api.mama.io/v1/reforge/prepareReforge"
headers = {"Content-Type": "application/json"}
data = {
    "sourceAmount": "100",
    "sourceToken": "0x3c6af76181891a6f0f438d4d0fc1474f0e8ca9a0",
    "destinationToken": "0xc61e8563d354c4870d3526361d8531d79cd5dfe3",
    "destinationChainId": "0x61"
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)

To use axios for making HTTP requests in JavaScript, you first need to ensure that axios is installed in your project. If you haven't installed it yet, you can do so by running:

npm install axios
const axios = require('axios');

const url = "https://api.mama.io/v1/reforge/prepareReforge";
const headers = {
  "Content-Type": "application/json"
};
const data = {
  "sourceAmount": "100",
  "sourceToken": "0x3c6af76181891a6f0f438d4d0fc1474f0e8ca9a0",
  "destinationToken": "0xc61e8563d354c4870d3526361d8531d79cd5dfe3",
  "destinationChainId": "0x61"
};

axios.post(url, data, { headers: headers })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error.response.data);
  });

2. Execute a Transaction Asynchronously

url = "https://api.mama.io/v1/reforge/executeReforgeAsync"
data = {
    "tx": "prepared_transaction_data",
    "walletData": {
        "rpcUrl": "https://sourcechain.rpc.url",
        "privateKey": "your_wallet_private_key"
    }
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)
const axios = require('axios');

const url = "https://api.mama.io/v1/reforge/executeReforgeAsync";
const headers = {
  "Content-Type": "application/json"
};
const data = {
  "walletData": {
    "rpcUrl": "https://sourcechain.rpc.url",
    "privateKey": "your_wallet_private_key"
  }
};

axios.post(url, data, { headers })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error.response ? error.response.data : error.message);
  });

3. Execute a Transaction

url = "https://api.mama.io/v1/reforge/executeReforge"
data = {
    "tx": "prepared_transaction_data",
    "walletData": {
        "rpcUrl": "https://sourcechain.rpc.url",
        "privateKey": "your_wallet_private_key"
    }
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)
const axios = require('axios');

const url = "https://api.mama.io/v1/reforge/executeReforge";
const headers = {
  "Content-Type": "application/json"
};
const data = {
  "walletData": {
    "rpcUrl": "https://sourcechain.rpc.url",
    "privateKey": "your_wallet_private_key"
  }
};

axios.post(url, data, { headers })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error.response ? error.response.data : error.message);
  });

4. Get Supported Chains and Tokens

url = "https://api.mama.io/v1/reforge/getChainsAndTokens"

response = requests.get(url)
print(response.text)
const axios = require('axios');

const url = "https://api.mama.io/v1/reforge/getChainsAndTokens";

axios.get(url)
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error.response ? error.response.data : error.message);
  });

These examples show how to use different languages to interact with the API, including how to send GET and POST requests, how to include headers, and how to serialize to JSON for the request body. Remember to adjust parameters as needed to match your requirements.

PreviousEndpointsNextAryze Orders API

Was this helpful?

💻