0.0.25 • Published 11 months ago

@keepix/wallets-bitcoin v0.0.25

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Keepix.Wallets.bitcoin

Install

npm i @keepix/wallets-bitcoin

Use

import { Wallet } from '@keepix/wallets-bitcoin';

const wallet = new Wallet({ password: 'test', type: 'bitcoin' });

console.log(await wallet.getCoinBalance());
// 0.00000000

console.log(wallet.getPrivateKey());
// xxxxxxxxxxx

console.log(wallet.getAddress());
// 1HxJKBJso1jGJNoo5XmkiygE6c1gB1PQDo

Information

Library that respects the WalletLibraryInterface.
This library is used to create wallets, hold coin and token balances and carry out transactions.

class Wallet {
    constructor({}: {
        password?: string,
        mnemonic?: string,
        privateKey?: string,
        type: string,
        apis?: any,
        privateKeyTemplate?: string
    }) {}

    getPrivateKey: () => string;
    getMnemonic: () => string | undefined;
    getAddress: () => string;
    getProdiver: () => Promise<any>;

    btcToSatoshi: (btc: number) => number;

    // returns like 1.01 (Always in readable value)
    getCoinBalance: (walletAddress?: string) => Promise<string>;
    // returns like 1.01 (Always in readable value)
    getTokenBalance: (tokenAddress: string, walletAddress?: string) => Promise<string>;

    // amount is always like 1.20 ETH 
    estimateCostSendCoinTo: (receiverAddress: string, amount: string) => Promise<{ success: boolean, description: string }>;
    estimateCostSendTokenTo: (tokenAddress: string, receiverAddress: string, amount: string) => Promise<{ success: boolean, description: string }>;
    sendCoinTo: (receiverAddress: string, amount: string) => Promise<{ success: boolean, description: string }>;
    sendTokenTo: (tokenAddress: string, receiverAddress: string, amount: string) => Promise<{ success: boolean, description: string }>;
}

export interface WalletLibraryInterface {
    Wallet: typeof Wallet;
};
0.0.20

11 months ago

0.0.21

11 months ago

0.0.10

11 months ago

0.0.22

11 months ago

0.0.11

11 months ago

0.0.23

11 months ago

0.0.12

11 months ago

0.0.24

11 months ago

0.0.13

11 months ago

0.0.25

11 months ago

0.0.14

11 months ago

0.0.15

11 months ago

0.0.16

11 months ago

0.0.17

11 months ago

0.0.18

11 months ago

0.0.7

2 years ago

0.0.5

2 years ago

0.0.6

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago