terra.onchainpayments v1.4.4
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 Typescript, with type definitions
- Works with React Native, Typescript Ecosystems, in the browser, and Mobile solutions for anyone building on the Terra Ecosystem
- Makes it easier to manage payments with very simple abstractions
Installation & Configuration
Next, grab the latest version of the payment library off of Npm
For npm
npm i terra.onchainpayments
For Yarn
yarn add terra.onchainpayments
Usage
This package can be used for Mobile & Web Developers, or SDK Developers looking to extend the Terra Platform
Please note: PaymentsManager must be registered as a Singleton to prevent issues with the Connection Pool.
Manage Payments
First, get some testnet tokens for terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v
, or use LocalTerra.
// Customer wallets are the ones that make the payment, and pay for the Burn Tax
function ChargeCustomerWithLUNC() {
let businessWallet = "terra17lmam6zguazs5q5u6z5mmx76uj63gldnse2pdp";
let customerKeys =
"notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius";
let customerAddress = "terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v";
var manager = new PaymentsManager({ env: Environments.ClassicTestNet })
.configureBusinessWallet(businessWallet)
.configureCustomerKeys(customerKeys, customerAddress);
// Charge the customer a payment of 200,000 LUNC
var tx = await manager.ChargeCustomer(200000);
console.debug(`TX: ${tx.TxFinderHashUrl}`); // Track the Tx Url on Terra.Finder
}
function ChargeCustomerWithLUNA2() {
let businessWallet = "terra17lmam6zguazs5q5u6z5mmx76uj63gldnse2pdp";
let customerKeys =
"notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius";
let customerAddress = "terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v";
var manager = new PaymentsManager({ env: Environments.Luna2TestNet })
.configureBusinessWallet(businessWallet)
.configureCustomerKeys(customerKeys, customerAddress);
// Charge the customer a payment of 200 LUNA
var tx = await manager.ChargeCustomer(200);
console.debug(`TX: ${tx.TxFinderHashUrl}`); // Track the Tx Url on Terra.Finder
}
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago