1.2.5 • Published 9 months ago

qip-wallet v1.2.5

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

qip-wallet-lib

Documentation for the QIP Wallet Library qip-wallet-lib provides set of tools for working with Bitcoin transactions and keys. It is written in javascript and works in node.js enviroment

Features

  • Create HD wallet
  • Create transaction
  • Sign transaction and PSBT
  • Create inscriptions with special sat

Installation

npm install qip-wallet-lib

Usage

/**
 * Wallet
 */
const {wallet} = require('qip-wallet-lib');

// Create a new wallet
const passPhrase = wallet.createPassPhrase();
console.log("passPhrase: ",passPhrase);

// Create a new address
const accountKeys = wallet.accountKeys({passPhrase: passPhrase, networkName: 'testnet', path:0});
console.log("accountKeys: ",accountKeys);

// Create a new address
const address = wallet.getAllAddress({privateKey: accountKeys.privateKey, networkName: 'testnet'});

// Create a new transaction
const tx = wallet.createTransaction2({
    input:[{txid:"133c3dcf862b1ed6a01efaa70da27acbf9449bc766ef268edaac4a711be3eb36", vout:1, value:8332}], 
    output:[{address:"tb1q4myftf8sc0rzpwnmluaq06ygykprq9ld0fz60c", value:550}],
    publicKey: "e6c357476d31cfd13b8e75d5b29b94cbff062d489a7965baaabf0bddd68db2c0",
    addressType:"taproot",
    networkName:"testnet",
    feeRate: 10,
        change: "tb1pump4w3mdx88azwuwwh2m9xu5e0lsvt2gnfuktw42hu9am45dktqq3rfjtj",
    });

console.log("tx: ",tx);

// Sign transaction
const signedTx = wallet.signTransaction({
    psbt: {psbtBase64: "cHNidP8BAH0CAAAAATbr4xtxSqzajibvZsebRPnLeqINp/oeoNYeK4bPPTwTAQAAAAD/////AiYCAAAAAAAAFgAUrsiVpPDDxiC6e/86B+iIJYIwF+1KHQAAAAAAACJRIObDV0dtMc/RO4511bKblMv/Bi1Imnlluqq/C93WjbLAAAAAAAABASuMIAAAAAAAACJRIObDV0dtMc/RO4511bKblMv/Bi1Imnlluqq/C93WjbLAARcg5sNXR20xz9E7jnXVspuUy/8GLUiaeWW6qr8L3daNssAAAAA="}, privateKey:accountKeys.privateKey, 
    networkName: 'testnet'
    });

console.log("signedTx: ",signedTx);

/**
 * Inscription
 */

const {inscription} = require('qip-wallet-lib');

// Create a new inscription

//These are optional parameters used to create inscription
const options = {   
    metadata: {creator: "arch.xyz", collection: "test collection", platform: "inscribable.xyz"},
    satTx: {
        txid: "9225058961e6e73273d9b58748dbcd5f832a3f0cebbb88daf424e0c15314ab56",
        vout: 0,
        value: 1000
    }
}

//get inscription keyPair
const inscriptionKeyPair = inscription.getKeyPair({networkName: 'testnet'});
console.log("inscriptionKeyPair: ",inscriptionKeyPair);

//get inscription initlization data
//this returns all the data required to create inscription including the funding address
const initData = getInitData({networkName: "testnet", privateKey: inscriptionKeyPair.privateKey});
console.log("initData: ",initData);


//get all inscription
//this returns an array of inscriptions and the total cost of inscriptions
let filePaths = [`${process.cwd()}/test.png`]
let feeRate = 21
let padding = 550

const inscriptionData = inscription.getInscriptions({
    filePaths: filePaths, 
    publicKey: inscriptionKeyPair.publicKey, 
    networkName: "testnet", 
    feerate: feeRate, 
    padding: padding, 
    options: options 
    });

console.log("inscriptionData: ",inscriptionData);

/**
 now you fund the address from initData.fundingAddress with the value of inscriptionData.total_fees
 NB: If satTx is provided in options, the sat utxo has to be in the funding address as well
*/

//split funded utxo to different inscription addresses
//It returns a signed transaction to be broadcasted in hexadecimal(HEX) format, as well as the transaction id(txid)
const splitFunds = inscription.splitFunds({
    filePaths: filePaths, 
    privateKey: inscriptionKeyPair.privateKey, 
    networkName: "testnet", 
    feerate: feeRate, 
    padding: padding, 
    options: options
    })

console.log("splitFunds: ",splitFunds);

//create inscription(s)
//It returns an array of signed inscription transaction to be broadcasted in hexadecimal(HEX) format, 
//their transaction ids as well as the inscriptiond id.
const createInscription = inscription.createInscription({
    filePaths:filePaths, 
    privateKey:privateKey, 
    receiveAddress:"tb1pxlsh06u5ej72gjvmcl9ktuq4jw8ja2pzx5jqgypyxzfw0c32j0ysppm29h", 
    networkName:"testnet", 
    feerate:feeRate, 
    padding:padding, 
    options:options
    })

console.log("createInscription: ",createInscription);
1.2.5

9 months ago

1.2.0

10 months ago

1.1.29

10 months ago

1.1.28

10 months ago

1.2.4

10 months ago

1.2.3

10 months ago

1.2.2

10 months ago

1.2.1

10 months ago

1.1.27

10 months ago

1.1.26

1 year ago

1.1.25

1 year ago

1.1.23

1 year ago

1.1.22

1 year ago

1.1.24

1 year ago

1.1.21

1 year ago

1.1.20

1 year ago

1.1.19

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.13

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.10

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

1 year ago

1.1.2

1 year ago

1.1.0

1 year ago

1.0.36

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.33

1 year ago

1.0.32

1 year ago

1.0.31

1 year ago

1.0.30

1 year ago

1.0.35

1 year ago

1.0.34

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.1-7.2

1 year ago

1.0.1-7.0

1 year ago

1.0.1-6.1

1 year ago

1.0.1-7.1

1 year ago

1.0.1-6.0

1 year ago

1.0.15

1 year ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago