https://github.com/nextu1337/xnogate
xnogate is an open-source NANO cryptocurrency payment gateway library
https://github.com/nextu1337/xnogate
cryptocoins cryptocurrency nano-cryptocurrency nanocurrency payment-gateway payments wallet
Last synced: 3 months ago
JSON representation
xnogate is an open-source NANO cryptocurrency payment gateway library
- Host: GitHub
- URL: https://github.com/nextu1337/xnogate
- Owner: nextu1337
- Created: 2023-04-19T17:31:13.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-29T06:18:41.000Z (about 1 year ago)
- Last Synced: 2024-05-29T19:02:46.731Z (about 1 year ago)
- Topics: cryptocoins, cryptocurrency, nano-cryptocurrency, nanocurrency, payment-gateway, payments, wallet
- Language: TypeScript
- Homepage:
- Size: 3 MB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# xnogate
xnogate is a safe, reliable payment gateway library for the NANO (XNO) cryptocurrency.
## Installation
To install xnogate, run the following command:
```
npm i xnogate
```## Usage
WARNING: do not use any of the keys or addresses listed below to send real assets!To use the payment gateway module, import it as follows:
```js
const { payments } = require("xnogate")
```### Create a Payment
To create a new payment, call the `payments.create(config, amount)` method, passing in a configuration object and the desired amount in NANO. The configuration object should contain the following properties:
- `seed`: a 64-character string representing the seed to be used to generate the private key for the wallet. If not provided, a random seed will be generated.
- `index`: index of the wallet to use. If not provided, 0 will be used.
- `destination`: the address of the account to which the payment will be made.
- `timeout`: the timeout for the payment, in seconds.Example:
```js
const config = {
seed: "6e78325f7061796d656e745f676174657761795f746573745f786e6f67617465",
index: 0,
destination: "nano_3ujqppynxfakp59i99o75qkwi1dm6btox9gndegbnuyxpc53sw7ikmb1zp8z",
timeout: 30 // 30 seconds
};const amount = 0.5; // 0.5 NANO
const interval = payments.create(config, amount);
```### Start a Payment
To start a payment, call the `payments.start(interval, onSuccess, onTimeout)` method, passing in the `interval` object returned from `payments.create`, as well as the `onSuccess` and `onTimeout` callbacks. `o` variable in the callback is the interval itself, you can retrieve or store some data there
Example:
```js
payments.start(interval,
(o) => { console.log("Payment successful"); },
(o) => { console.log("Payment timed out"); }
);
```
Alternatively:
```js
interval.start(
(o) => { console.log("Payment successful"); },
(o) => { console.log("Payment timed out"); }
);
```## Donate
If you find this module useful and would like to support its development, please consider making a donation to the following Nano address:
`nano_3ujqppynxfakp59i99o75qkwi1dm6btox9gndegbnuyxpc53sw7ikmb1zp8z`
Your contribution is greatly appreciated and will help ensure the continued maintenance and improvement of this project, and some extra motivation. Thank you for your support!