Skip to content

TerraMystics/Terra.Unity.Package

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation


A lightweight payment management library for the terra ecosystem for the Unity GameEngine


Explore the Docs »

Internally manages gas estimation required by the burn tax for successful transactions on the blockchain. Makes it easier for devs to get started with payments on the LUNC/LUNA Blockchains.

Features

  • Written in C#, with type definitions
  • Makes it easier to manage payments for anyone deploying to the Apple or Google app stores

Installation & Configuration

Please make sure to import the following package into your project as an asset.

Please also make sure to install the following dependency package into your project too.

Usage

This package can be used for Mobile & Web Developers working with Unity, or SDK Developers looking to extend the Terra Platform

Manage Payments

Please note: PaymentsManager must be registered as a Singleton to prevent issues with the Connection Pool.

void ProcessPaymentForTerra() {
     // Wallet where customer payments will be transferred to
     string businessWallet = "terra17lmam6zguazs5q5u6z5mmx76uj63gldnse2pdp";

     // Recovery Words of the Customer wallet that will be making the payment
     string customerRecoveryWords = "notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius";

     // Configure your PaymentManager
     // Set Blockchain to target (in this case Classic)
     var paymentsManager = new PaymentsManager(TerraEnvironment.Classic)
                               .ConfigureBusinessWallet(businessWallet) // Configure your Business Wallet
                               .ConfigureCustomerWallet(customerRecoveryWords); // Configure the Customer Wallet

     // Charge customer with LUNC
     var receipt = await paymentsManager.ChargeCustomer(100);

    var pubKey = await paymentsManager.VerifyCustomerSeedPhrase();
    if (!string.IsNullOrWhiteSpace(pubKey))
    {
        // Wallet exists on chain!
        // Charge the Wallet 100 LUNC
        var payment = await paymentsManager.ChargeCustomer(100);
        Console.WriteLine($"Receipt: {payment.TxFinderHashUrl}");
    }
}

License

This software is licensed under the MIT license. See LICENSE for full disclosure.

© 2022 TerraMystics.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published