Skip to content

InfinitySEC/coinos-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Nome do Projeto

coinos-js

A simple lib for coinos api


Installation

npm install coinos-js

Examples

For satisfactory use, we recommend that you read the official coinos api documentation.

import coinos from "coinos-js"

async function test() {
    const service = await coinos.login("cooluser", "coolpass");

    // Get account info.
    const info = await service.accountInfo();
    console.log(info)

    // Create invoice.
    // The type supports lightning chain and conventional chain.
    // The webhook and secret are optional.
    const data = await service.createInvoice("lightning", 1000, "http://coolwebhook.com/api/check", "supersecuresecret");
    console.log(data);

    // Check invoice.
    const invoice_status = await service.checkInvoice("coolhash123");
    console.log(invoice_status);

    // Get payment list
    const payment_list = await service.getPayments();
    console.log(payment_list);

    // Execute payment.
    // Available payment types:
    // - Internal: Coinos user to Coinos user.
    // - Lightning: Payment via the Lightning Network.
    // - Bitcoin: Conventional on-chain Bitcoin payment.

    const internal_payment = await service.sendInternalPayment("coolcoinosuser", 1000);
    console.log(internal_payment);

    const lightning_payment = await service.sendLightningPayment("coolpayreq");
    console.log(lightning_payment);

    const bitcoin_payment = await service.sendBitcoinPayment("cooladdress", 10000);
    console.log(bitcoin_payment);
}

About

A simple nodejs lib for coinos api

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors