1.4.4 • Published 1 year ago

terra.onchainpayments v1.4.4

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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.4.4

1 year ago

1.4.3

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.9

1 year ago

1.3.8

1 year ago

1.3.7

1 year ago

1.3.6

1 year ago

1.3.5

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.9

1 year ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago