Coder Social home page Coder Social logo

tao-wallet's Introduction

tao-wallet

Wallet for everyone. send and receive. btc, usd, and more.

Self custodial or yield-generating full custody, choose your own adventure.

Tao Discord Twitter

Work in progress, looking for teammates!

Usage

Install as dependency

npm i tao-wallet

Usage

import { randomBytes } from 'crypto'
import { TaoWallet } from 'tao-wallet'

// On first usage, generate a secret for the backend LnMarkets account.
const lnmSecret = randomBytes(16).toString('hex')

const tao = new TaoWallet({ lnmSecret, network: 'mainnet' })

// Login.
await tao.login()

// Create an invoice to deposit funds (amount in sats).
const depositInvoice = await tao.fetchDepositAddress({
	type: 'bolt11',
	amountSats: 1000000,
})
console.log(depositInvoice)

// Create an on-chain address to deposit funds.
const depositAddress = await tao.fetchDepositAddress({ type: 'on-chain' })
console.log(depositAddress)

// Get balances.
const balances = await tao.fetchBalances()
console.log(balances)

// Swap btc for $2 of usd.
await tao.swap({ from: 'btc', to: 'usd', amountUsd: 2 })

// Swap $1 of usd for btc.
await tao.swap({ from: 'usd', to: 'btc', amountUsd: 1 })

// Send funds from your tao wallet to a lightning invoice.
const invoice = 'lnbc1....'
await tao.send({ type: 'bolt11', address: invoice })

// Send 100,000 sats from your tao wallet to an on-chain address.
const onchainAddress = 'bc1...'
await tao.send({
	type: 'on-chain',
	address: onchainAddress,
	amountSats: 100000,
})

More Info

Architecture, Contributing, Releases, etc

tao-wallet's People

Contributors

amsul avatar andredevjs avatar dannydeezy avatar uthpalax avatar vafanassieff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tao-wallet's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.