Skip to content

Commit

Permalink
Merge pull request #10 from TheLindaProjectInc/migrate-to-psbt
Browse files Browse the repository at this point in the history
Migrate to PSBT
  • Loading branch information
nibbles83 authored Sep 13, 2024
2 parents 1c46922 + 9ffb39b commit 67bb7cb
Show file tree
Hide file tree
Showing 15 changed files with 231 additions and 157 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog

# 0.3.0
# 0.3.2

- Migrate to PSBT for transaction creation
- Update bitcoinjs-lib to 5.2.0
- Update bip174 to 2.0.1

# 0.3.1

- Remove Axios in favour of fetch for api calls.
- Fix Metrix Signed Message length prefix
5 changes: 5 additions & 0 deletions lib/Insight.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export declare class Insight {
listUTXOs(address: string): Promise<Insight.IUTXO[]>;
getInfo(address: string): Promise<Insight.IGetInfo>;
sendRawTx(rawtx: string): Promise<Insight.ISendRawTxResult>;
GetRawTx(tx: string): Promise<Insight.IGetRawTxResult>;
contractCall(address: string, encodedData: string): Promise<Insight.IContractCall>;
/**
* Estimate the fee per KB of txdata, in satoshi. Returns -1 if no estimate is
Expand Down Expand Up @@ -42,6 +43,9 @@ export declare namespace Insight {
interface ISendRawTxResult {
txid: string;
}
interface IGetRawTxResult {
rawtx: string;
}
interface IUTXO {
address: string;
txid: string;
Expand All @@ -55,6 +59,7 @@ export declare namespace Insight {
isStake: boolean;
height: number;
confirmations: number;
rawtx: string;
}
interface IExecutionResult {
gasUsed: number;
Expand Down
15 changes: 15 additions & 0 deletions lib/Insight.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/Insight.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/Wallet.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import * as bitcoin from "bitcoinjs-lib";
import { ECPairInterface } from 'bitcoinjs-lib';
import { BIP32Interface } from "bip32";
import { INetworkInfo } from "./Network";
import { Insight } from "./Insight";
import { IUTXO, IContractSendTXOptions, ISendTxOptions, IContractCreateTXOptions } from "./tx";
import { IScryptParams } from "./scrypt";
export declare class Wallet {
keyPair: bitcoin.ECPair;
keyPair: ECPairInterface;
network: INetworkInfo;
address: string;
private insight;
constructor(keyPair: bitcoin.ECPair, network: INetworkInfo);
constructor(keyPair: ECPairInterface, network: INetworkInfo);
toWIF(): string;
/**
* Get basic information about the wallet address.
Expand Down
2 changes: 1 addition & 1 deletion lib/Wallet.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions lib/tx.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ECPair } from "bitcoinjs-lib";
import { ECPairInterface } from "bitcoinjs-lib";
/**
* Options for a payment transaction
*/
Expand Down Expand Up @@ -65,7 +65,7 @@ export declare function estimatePubKeyHashTransactionMaxSend(utxos: IUTXO[], to:
* @param feeRate
* @param utxoList
*/
export declare function buildPubKeyHashTransaction(utxos: IUTXO[], keyPair: ECPair, to: string, amount: number, feeRate: number): string;
export declare function buildPubKeyHashTransaction(utxos: IUTXO[], keyPair: ECPairInterface, to: string, amount: number, feeRate: number): string;
/**
* Build a create-contract transaction
*
Expand All @@ -75,8 +75,8 @@ export declare function buildPubKeyHashTransaction(utxos: IUTXO[], keyPair: ECPa
* @param utxoList
* @returns the built tx
*/
export declare function buildCreateContractTransaction(utxos: IUTXO[], keyPair: ECPair, code: string, feeRate: number, opts?: IContractCreateTXOptions): string;
export declare function estimateSendToContractTransactionMaxValue(utxos: IUTXO[], keyPair: ECPair, contractAddress: string, encodedData: string, feeRate: number, opts?: IContractSendTXOptions): number;
export declare function buildCreateContractTransaction(utxos: IUTXO[], keyPair: ECPairInterface, code: string, feeRate: number, opts?: IContractCreateTXOptions): string;
export declare function estimateSendToContractTransactionMaxValue(utxos: IUTXO[], keyPair: ECPairInterface, contractAddress: string, encodedData: string, feeRate: number, opts?: IContractSendTXOptions): number;
/**
* Build a send-to-contract transaction
*
Expand All @@ -87,4 +87,4 @@ export declare function estimateSendToContractTransactionMaxValue(utxos: IUTXO[]
* @param utxoList
* @returns the built tx
*/
export declare function buildSendToContractTransaction(utxos: IUTXO[], keyPair: ECPair, contractAddress: string, encodedData: string, feeRate: number, opts?: IContractSendTXOptions): string;
export declare function buildSendToContractTransaction(utxos: IUTXO[], keyPair: ECPairInterface, contractAddress: string, encodedData: string, feeRate: number, opts?: IContractSendTXOptions): string;
Loading

0 comments on commit 67bb7cb

Please sign in to comment.