nandesu / circularPHP

This is the initial port of the CircularJS SDK.
1 stars 0 forks source link

Circular PHP Class

The Circular class is a PHP implementation for interacting with the Circular Labs blockchain. It provides methods for performing various operations such as fetching wallet information, registering a wallet, fetching asset information, and sending transactions.

Dependencies

This class requires the following dependencies:

CAVEATS

Installation

First, you need to install Composer and then run the following command to install the Elliptic library:

composer require elliptic/php

Usage

Description of the methods available in the Circular class:

Example

Example of how to use the Circular class:

<?php
// Include the Circular class from the lib directory
require_once 'lib/CIRCULAR.php';

// Create a new instance of the Circular class
$circular = new \lib\Circular();

// Set the NAG key and URL
$circular->setNAGKey('your_nag_key');
$circular->setNAGURL('https://nag.circularlabs.io/NAG.php?cep=');

// Register a wallet
$blockchain = 'your_blockchain';
$privateKey = 'your_private_key';
$response = $circular->registerWallet($blockchain, $privateKey);

// Check the response
if ($response) {
    echo "Wallet registered successfully.\n";
} else {
    echo "Failed to register wallet.\n";
}

// Get wallet information
$address = 'your_address';
$walletInfo = $circular->getWallet($blockchain, $address);

// Print the wallet information
echo "Wallet Information: \n";
print_r($walletInfo);
?>

Note: Replace 'your_nag_key', 'your_blockchain', 'your_private_key', and 'your_address' with your actual values.

Disclaimer

This class is provided as-is, and it is up to the user to ensure that it is used correctly and securely. Always remember to keep your private keys secure and never share them with anyone. Always test your code thoroughly before deploying it in a production environment.