Skip to content

Commit

Permalink
chore: release version 1.0.0-alpha.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteZhang1024 committed Aug 19, 2024
1 parent c020c4e commit 41e8eab
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ declare module '@onekeyfe/kaspacore-lib' {
export namespace Transaction {

static class sighash {
static sign(transaction, privateKey, sighashType, inputIndex, subscript, satoshisBN, flags, signingMethod);
// static sign(transaction, privateKey, sighashType, inputIndex, subscript, satoshisBN, flags, signingMethod);
static sighash(transaction, sighashType, inputNumber, subscript, satoshisBN, flags): Buffer;
}
class UnspentOutput {
Expand Down Expand Up @@ -155,7 +155,7 @@ declare module '@onekeyfe/kaspacore-lib' {
fee(amount: number): this;
setVersion(version: number): this;
feePerKb(amount: number): this;
sign(privateKey: PrivateKey|PrivateKey[] | string|string[], sigtype:number, signingMethod:string|undefined): this;
// sign(privateKey: PrivateKey|PrivateKey[] | string|string[], sigtype:number, signingMethod:string|undefined): this;
applySignature(sig: crypto.Signature): this;
addInput(input: Transaction.Input): this;
addOutput(output: Transaction.Output): this;
Expand Down
4 changes: 2 additions & 2 deletions lib/transaction/sighash.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,6 @@ function verify(transaction, signature, publicKey, inputIndex, subscript, satosh
*/
module.exports = {
sighash: sighash,
sign: sign,
verify: verify
// sign: sign,
// verify: verify
};
13 changes: 11 additions & 2 deletions lib/transaction/unspentoutput.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var JSUtil = require('../util/js');
var Script = require('../script');
var Address = require('../address');
var Unit = require('../unit');
var BN = require('../crypto/bn');

/**
* Represents an unspent output information: its script, associated amount and address,
Expand Down Expand Up @@ -46,8 +47,16 @@ function UnspentOutput(data) {
var script = new Script(data.scriptPubKey || data.script);
$.checkArgument(!_.isUndefined(data.amount) || !_.isUndefined(data.satoshis),
'Must provide an amount for the output');
var amount = !_.isUndefined(data.amount) ? new Unit.fromBTC(data.amount).toSatoshis() : data.satoshis;
$.checkArgument(_.isNumber(amount), 'Amount must be a number');

var amount;
if (!_.isUndefined(data.amount)) {
amount = BN.fromNumber(data.amount);
amount = amount.mul(new BN(1e8)).toString();
} else {
amount = BN.fromNumber(data.satoshis).toString();
}
$.checkArgument(!amount.isNaN() && amount.gte(0) && amount.includes('.'), 'Amount must be a number');

JSUtil.defineImmutable(this, {
address: address,
txId: txId,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/kaspacore-lib",
"version": "1.0.0-alpha.1",
"version": "1.0.0-alpha.2",
"main": "index.js",
"authors": [
{
Expand Down

0 comments on commit 41e8eab

Please sign in to comment.