New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

unielon-coin-bitcoin

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unielon-coin-bitcoin - npm Package Compare versions

Comparing version 1.0.20 to 1.0.21

18

dist/bitcoinjs-lib/address.js

@@ -31,3 +31,3 @@ "use strict";

const types = __importStar(require("./types"));
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
const { typeforce } = types;

@@ -58,3 +58,3 @@ const FUTURE_SEGWIT_MAX_SIZE = 40;

function fromBase58Check(address) {
const payload = crypto_lib_1.base.fromBase58Check(address);
const payload = unielon_crypto_lib_1.base.fromBase58Check(address);
if (payload.length < 21)

@@ -73,3 +73,3 @@ throw new TypeError(address + ' is too short');

try {
result = crypto_lib_1.base.bech32.decode(address);
result = unielon_crypto_lib_1.base.bech32.decode(address);
}

@@ -83,3 +83,3 @@ catch (e) { }

else {
result = crypto_lib_1.base.bech32m.decode(address);
result = unielon_crypto_lib_1.base.bech32m.decode(address);
version = result.words[0];

@@ -89,3 +89,3 @@ if (version === 0)

}
const data = crypto_lib_1.base.bech32.fromWords(result.words.slice(1));
const data = unielon_crypto_lib_1.base.bech32.fromWords(result.words.slice(1));
return {

@@ -103,11 +103,11 @@ version,

hash.copy(payload, 1);
return crypto_lib_1.base.toBase58Check(payload);
return unielon_crypto_lib_1.base.toBase58Check(payload);
}
exports.toBase58Check = toBase58Check;
function toBech32(data, version, prefix) {
const words = crypto_lib_1.base.bech32.toWords(data);
const words = unielon_crypto_lib_1.base.bech32.toWords(data);
words.unshift(version);
return version === 0
? crypto_lib_1.base.bech32.encode(prefix, words)
: crypto_lib_1.base.bech32m.encode(prefix, words);
? unielon_crypto_lib_1.base.bech32.encode(prefix, words)
: unielon_crypto_lib_1.base.bech32m.encode(prefix, words);
}

@@ -114,0 +114,0 @@ exports.toBech32 = toBech32;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.verifySimple = exports.signSimple = void 0;
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
const address_1 = require("./address");

@@ -14,5 +14,5 @@ const transaction_1 = require("./transaction");

const tag = 'BIP0322-signed-message';
const tagHash = crypto_lib_1.base.sha256(Buffer.from(tag));
const result = crypto_lib_1.base.sha256(Buffer.concat([tagHash, tagHash, Buffer.from(message)]));
return crypto_lib_1.base.toHex(result);
const tagHash = unielon_crypto_lib_1.base.sha256(Buffer.from(tag));
const result = unielon_crypto_lib_1.base.sha256(Buffer.concat([tagHash, tagHash, Buffer.from(message)]));
return unielon_crypto_lib_1.base.toHex(result);
}

@@ -54,3 +54,3 @@ async function signSimple(message, address, privateKey, network) {

const result = Buffer.concat([len, ...txToSign.ins[0].witness.map((w) => encodeVarString(w))]);
return crypto_lib_1.base.toBase64(result);
return unielon_crypto_lib_1.base.toBase64(result);
}

@@ -79,3 +79,3 @@ exports.signSimple = signSimple;

});
const pubBuf = crypto_lib_1.base.fromHex(publicKey);
const pubBuf = unielon_crypto_lib_1.base.fromHex(publicKey);
if ((0, psbtutils_1.isP2TR)(outputScript)) {

@@ -87,5 +87,5 @@ psbtToSign.updateInput(0, {

psbtToSign.addOutput({ script: Buffer.from('6a', 'hex'), value: 0 });
return psbtToSign.verify(pubBuf, Buffer.from(crypto_lib_1.base.fromBase64(witness)));
return psbtToSign.verify(pubBuf, Buffer.from(unielon_crypto_lib_1.base.fromBase64(witness)));
}
exports.verifySimple = verifySimple;
//# sourceMappingURL=bip0322.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.taggedHash = exports.hash256 = exports.hash160 = exports.sha256 = exports.ripemd160 = void 0;
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
function ripemd160(buffer) {
return Buffer.from(crypto_lib_1.base.ripemd160(buffer));
return Buffer.from(unielon_crypto_lib_1.base.ripemd160(buffer));
}
exports.ripemd160 = ripemd160;
function sha256(buffer) {
return Buffer.from(crypto_lib_1.base.sha256(buffer));
return Buffer.from(unielon_crypto_lib_1.base.sha256(buffer));
}

@@ -12,0 +12,0 @@ exports.sha256 = sha256;

@@ -33,3 +33,3 @@ "use strict";

const OPS = bscript.OPS;
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
function p2pkh(a, opts) {

@@ -49,3 +49,3 @@ if (!a.address && !a.hash && !a.output && !a.pubkey && !a.input)

const _address = lazy.value(() => {
const payload = crypto_lib_1.base.fromBase58Check(a.address);
const payload = unielon_crypto_lib_1.base.fromBase58Check(a.address);
const version = payload.readUInt8(0);

@@ -66,3 +66,3 @@ const hash = payload.slice(1);

o.hash.copy(payload, 1);
return crypto_lib_1.base.toBase58Check(payload);
return unielon_crypto_lib_1.base.toBase58Check(payload);
});

@@ -69,0 +69,0 @@ lazy.prop(o, 'hash', () => {

@@ -32,3 +32,3 @@ "use strict";

const lazy = __importStar(require("./lazy"));
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
const OPS = bscript.OPS;

@@ -66,3 +66,3 @@ function stacksEqual(a, b) {

const _address = lazy.value(() => {
const payload = crypto_lib_1.base.fromBase58Check(a.address);
const payload = unielon_crypto_lib_1.base.fromBase58Check(a.address);
const version = payload.readUInt8(0);

@@ -90,3 +90,3 @@ const hash = payload.slice(1);

o.hash.copy(payload, 1);
return crypto_lib_1.base.toBase58Check(payload);
return unielon_crypto_lib_1.base.toBase58Check(payload);
});

@@ -93,0 +93,0 @@ lazy.prop(o, 'hash', () => {

@@ -33,3 +33,3 @@ "use strict";

const lazy = __importStar(require("./lazy"));
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
const OPS = bscript.OPS;

@@ -64,5 +64,5 @@ const TAPROOT_WITNESS_VERSION = 0x01;

const _address = lazy.value(() => {
const result = crypto_lib_1.base.bech32m.decode(a.address);
const result = unielon_crypto_lib_1.base.bech32m.decode(a.address);
const version = result.words.shift();
const data = crypto_lib_1.base.bech32m.fromWords(result.words);
const data = unielon_crypto_lib_1.base.bech32m.fromWords(result.words);
return {

@@ -95,5 +95,5 @@ version,

return;
const words = crypto_lib_1.base.bech32m.toWords(o.pubkey);
const words = unielon_crypto_lib_1.base.bech32m.toWords(o.pubkey);
words.unshift(TAPROOT_WITNESS_VERSION);
return crypto_lib_1.base.bech32m.encode(network.bech32, words);
return unielon_crypto_lib_1.base.bech32m.encode(network.bech32, words);
});

@@ -100,0 +100,0 @@ lazy.prop(o, 'hash', () => {

@@ -32,3 +32,3 @@ "use strict";

const lazy = __importStar(require("./lazy"));
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
const OPS = bscript.OPS;

@@ -51,5 +51,5 @@ const EMPTY_BUFFER = Buffer.alloc(0);

const _address = lazy.value(() => {
const result = crypto_lib_1.base.bech32.decode(a.address);
const result = unielon_crypto_lib_1.base.bech32.decode(a.address);
const version = result.words.shift();
const data = crypto_lib_1.base.bech32.fromWords(result.words);
const data = unielon_crypto_lib_1.base.bech32.fromWords(result.words);
return {

@@ -66,5 +66,5 @@ version,

return;
const words = crypto_lib_1.base.bech32.toWords(o.hash);
const words = unielon_crypto_lib_1.base.bech32.toWords(o.hash);
words.unshift(0x00);
return crypto_lib_1.base.bech32.encode(network.bech32, words);
return unielon_crypto_lib_1.base.bech32.encode(network.bech32, words);
});

@@ -71,0 +71,0 @@ lazy.prop(o, 'hash', () => {

@@ -32,3 +32,3 @@ "use strict";

const lazy = __importStar(require("./lazy"));
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
const OPS = bscript.OPS;

@@ -73,5 +73,5 @@ const EMPTY_BUFFER = Buffer.alloc(0);

const _address = lazy.value(() => {
const result = crypto_lib_1.base.bech32.decode(a.address);
const result = unielon_crypto_lib_1.base.bech32.decode(a.address);
const version = result.words.shift();
const data = crypto_lib_1.base.bech32.fromWords(result.words);
const data = unielon_crypto_lib_1.base.bech32.fromWords(result.words);
return {

@@ -94,5 +94,5 @@ version,

return;
const words = crypto_lib_1.base.bech32.toWords(o.hash);
const words = unielon_crypto_lib_1.base.bech32.toWords(o.hash);
words.unshift(0x00);
return crypto_lib_1.base.bech32.encode(network.bech32, words);
return unielon_crypto_lib_1.base.bech32.encode(network.bech32, words);
});

@@ -99,0 +99,0 @@ lazy.prop(o, 'hash', () => {

@@ -39,6 +39,6 @@ "use strict";

const psbtutils_1 = require("./psbt/psbtutils");
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
const script_1 = require("./script");
const taproot_1 = require("../taproot");
const schnorr = crypto_lib_1.signUtil.schnorr.secp256k1.schnorr;
const schnorr = unielon_crypto_lib_1.signUtil.schnorr.secp256k1.schnorr;
const DEFAULT_OPTS = {

@@ -679,3 +679,3 @@ network: networks_1.bitcoin,

const messageToSign = hashesForSig.filter(h => !h.leafHash)[0].hash;
if (!schnorr.verify(crypto_lib_1.base.toHex(vector[0]), crypto_lib_1.base.toHex(messageToSign), crypto_lib_1.base.toHex(tweakKey))) {
if (!schnorr.verify(unielon_crypto_lib_1.base.toHex(vector[0]), unielon_crypto_lib_1.base.toHex(messageToSign), unielon_crypto_lib_1.base.toHex(tweakKey))) {
return false;

@@ -693,3 +693,3 @@ }

}
if (!crypto_lib_1.signUtil.secp256k1.verifyWithNoRecovery(hash, signature, pubBuf)) {
if (!unielon_crypto_lib_1.signUtil.secp256k1.verifyWithNoRecovery(hash, signature, pubBuf)) {
return false;

@@ -696,0 +696,0 @@ }

@@ -5,2 +5,3 @@ /// <reference types="node" />

export declare function isPoint(p: Buffer | number | undefined | null): boolean;
export declare function UInt31(value: number): boolean;
export declare function BIP32Path(value: string): boolean;

@@ -7,0 +8,0 @@ export declare namespace BIP32Path {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.oneOf = exports.Null = exports.BufferN = exports.Function = exports.UInt32 = exports.UInt8 = exports.tuple = exports.maybe = exports.Hex = exports.Buffer = exports.String = exports.Boolean = exports.Array = exports.Number = exports.Hash256bit = exports.Hash160bit = exports.Buffer256bit = exports.isTaptree = exports.isTapleaf = exports.TAPLEAF_VERSION_MASK = exports.Satoshi = exports.Signer = exports.BIP32Path = exports.isPoint = exports.typeforce = void 0;
exports.oneOf = exports.Null = exports.BufferN = exports.Function = exports.UInt32 = exports.UInt8 = exports.tuple = exports.maybe = exports.Hex = exports.Buffer = exports.String = exports.Boolean = exports.Array = exports.Number = exports.Hash256bit = exports.Hash160bit = exports.Buffer256bit = exports.isTaptree = exports.isTapleaf = exports.TAPLEAF_VERSION_MASK = exports.Satoshi = exports.Signer = exports.BIP32Path = exports.UInt31 = exports.isPoint = exports.typeforce = void 0;
const buffer_1 = require("buffer");

@@ -33,2 +33,7 @@ const unielon_crypto_lib_1 = require("unielon-crypto-lib");

exports.isPoint = isPoint;
const UINT31_MAX = Math.pow(2, 31) - 1;
function UInt31(value) {
return unielon_crypto_lib_1.typeforce.UInt32(value) && value <= UINT31_MAX;
}
exports.UInt31 = UInt31;
function BIP32Path(value) {

@@ -35,0 +40,0 @@ return unielon_crypto_lib_1.typeforce.String(value) && !!value.match(/^(m\/)?(\d+'?\/)*\d+'?$/);

@@ -28,3 +28,3 @@ "use strict";

const coin_base_1 = require("@okxweb3/coin-base");
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
const bitcoin = __importStar(require("./index"));

@@ -116,4 +116,4 @@ function convert2UtxoTx(utxoTx) {

address: address || "",
publicKey: crypto_lib_1.base.toHex(addressType === "segwit_taproot" ? publicKey.slice(1) : publicKey),
compressedPublicKey: crypto_lib_1.base.toHex(publicKey),
publicKey: unielon_crypto_lib_1.base.toHex(addressType === "segwit_taproot" ? publicKey.slice(1) : publicKey),
compressedPublicKey: unielon_crypto_lib_1.base.toHex(publicKey),
};

@@ -181,3 +181,3 @@ return Promise.resolve(data);

while (true) {
const privateKey = crypto_lib_1.base.randomBytes(32);
const privateKey = unielon_crypto_lib_1.base.randomBytes(32);
if ((0, coin_base_1.secp256k1SignTest)(privateKey)) {

@@ -195,5 +195,5 @@ const wif = bitcoin.private2Wif(privateKey, network);

let network = this.network();
return crypto_lib_1.bip39.mnemonicToSeed(param.mnemonic)
return unielon_crypto_lib_1.bip39.mnemonicToSeed(param.mnemonic)
.then(masterSeed => {
let childKey = crypto_lib_1.bip32.fromSeed(masterSeed).derivePath(param.hdPath);
let childKey = unielon_crypto_lib_1.bip32.fromSeed(masterSeed).derivePath(param.hdPath);
if (!childKey.privateKey) {

@@ -211,3 +211,3 @@ return Promise.reject(coin_base_1.GenPrivateKeyError);

const network = this.network();
const publicKey = crypto_lib_1.base.fromHex(param.publicKey);
const publicKey = unielon_crypto_lib_1.base.fromHex(param.publicKey);
if (!param.addressType) {

@@ -542,3 +542,3 @@ const addresses = [];

address: addressWithoutPrefix || "",
publicKey: crypto_lib_1.base.toHex(publicKey)
publicKey: unielon_crypto_lib_1.base.toHex(publicKey)
};

@@ -633,3 +633,3 @@ return Promise.resolve(data);

getAddressByPublicKey(param) {
const publicKey = crypto_lib_1.base.fromHex(param.publicKey);
const publicKey = unielon_crypto_lib_1.base.fromHex(param.publicKey);
const address = bitcoin.GetBitcashP2PkHAddressByPublicKey(publicKey);

@@ -636,0 +636,0 @@ return Promise.resolve(address.replace("bitcoincash:", ""));

@@ -28,3 +28,3 @@ "use strict";

const bitcoin = __importStar(require("./bitcoinjs-lib"));
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
const taproot = __importStar(require("./taproot"));

@@ -34,3 +34,3 @@ const bcrypto = __importStar(require("./bitcoinjs-lib/crypto"));

const txBuild_1 = require("./txBuild");
const schnorr = crypto_lib_1.signUtil.schnorr.secp256k1.schnorr;
const schnorr = unielon_crypto_lib_1.signUtil.schnorr.secp256k1.schnorr;
const defaultTxVersion = 2;

@@ -108,3 +108,3 @@ const defaultSequenceNum = 0xfffffffd;

commitTxPrevOutputList.forEach(commitTxPrevOutput => {
const hash = crypto_lib_1.base.reverseBuffer(crypto_lib_1.base.fromHex(commitTxPrevOutput.txId));
const hash = unielon_crypto_lib_1.base.reverseBuffer(unielon_crypto_lib_1.base.fromHex(commitTxPrevOutput.txId));
tx.addInput(hash, commitTxPrevOutput.vOut, defaultSequenceNum);

@@ -148,3 +148,3 @@ this.commitTxPrevOutputFetcher.push(commitTxPrevOutput.amount);

const hash = revealTx.hashForWitnessV1(0, prevOutScripts, values, bitcoin.Transaction.SIGHASH_DEFAULT, this.inscriptionTxCtxDataList[i].hash);
const signature = Buffer.from(schnorr.sign(hash, this.inscriptionTxCtxDataList[i].privateKey, crypto_lib_1.base.randomBytes(32)));
const signature = Buffer.from(schnorr.sign(hash, this.inscriptionTxCtxDataList[i].privateKey, unielon_crypto_lib_1.base.randomBytes(32)));
revealTx.ins[0].witness = [Buffer.from(signature), ...this.inscriptionTxCtxDataList[i].witness];

@@ -182,4 +182,4 @@ const revealWeight = revealTx.weight();

const addressType = (0, txBuild_1.getAddressType)(commitTxPrevOutputList[i].address, network);
const privateKey = crypto_lib_1.base.fromHex((0, txBuild_1.privateKeyFromWIF)(commitTxPrevOutputList[i].privateKey, network));
const privateKeyHex = crypto_lib_1.base.toHex(privateKey);
const privateKey = unielon_crypto_lib_1.base.fromHex((0, txBuild_1.privateKeyFromWIF)(commitTxPrevOutputList[i].privateKey, network));
const privateKeyHex = unielon_crypto_lib_1.base.toHex(privateKey);
const publicKey = (0, txBuild_1.private2public)(privateKeyHex);

@@ -191,3 +191,3 @@ if (addressType === 'segwit_taproot') {

const tweakedPrivKey = taproot.taprootTweakPrivKey(privateKey);
const signature = Buffer.from(schnorr.sign(hash, tweakedPrivKey, crypto_lib_1.base.randomBytes(32)));
const signature = Buffer.from(schnorr.sign(hash, tweakedPrivKey, unielon_crypto_lib_1.base.randomBytes(32)));
input.witness = [Buffer.from(signature)];

@@ -223,3 +223,3 @@ }

function createInscriptionTxCtxData(network, inscriptionData, privateKeyWif) {
const privateKey = crypto_lib_1.base.fromHex((0, txBuild_1.privateKeyFromWIF)(privateKeyWif, network));
const privateKey = unielon_crypto_lib_1.base.fromHex((0, txBuild_1.privateKeyFromWIF)(privateKeyWif, network));
const internalPubKey = (0, txBuild_1.wif2Public)(privateKeyWif, network).slice(1);

@@ -226,0 +226,0 @@ const ops = bitcoin.script.OPS;

@@ -28,3 +28,3 @@ "use strict";

const bitcoin = __importStar(require("./bitcoinjs-lib"));
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
const txBuild_1 = require("./txBuild");

@@ -147,3 +147,3 @@ const defaultTxVersion = 2;

commitTxPrevOutputList.forEach(commitTxPrevOutput => {
const hash = crypto_lib_1.base.reverseBuffer(crypto_lib_1.base.fromHex(commitTxPrevOutput.txId));
const hash = unielon_crypto_lib_1.base.reverseBuffer(unielon_crypto_lib_1.base.fromHex(commitTxPrevOutput.txId));
tx.addInput(hash, commitTxPrevOutput.vOut, defaultSequenceNum);

@@ -185,3 +185,3 @@ this.commitTxPrevOutputFetcher.push(commitTxPrevOutput.amount);

this.revealTxPrevOutputFetcher.push(this.inscriptionTxCtxDataList[i].revealTxPrevOutput.value);
const privateKeyHex = crypto_lib_1.base.toHex(this.inscriptionTxCtxDataList[i].privateKey);
const privateKeyHex = unielon_crypto_lib_1.base.toHex(this.inscriptionTxCtxDataList[i].privateKey);
const hash = revealTx.hashForSignature(i, this.inscriptionTxCtxDataList[i].inscriptionScript, bitcoin.Transaction.SIGHASH_ALL);

@@ -223,4 +223,4 @@ const signature = (0, txBuild_1.sign)(hash, privateKeyHex);

const addressType = (0, txBuild_1.getAddressType)(commitTxPrevOutputList[i].address, network);
const privateKey = crypto_lib_1.base.fromHex((0, txBuild_1.privateKeyFromWIF)(commitTxPrevOutputList[i].privateKey, network));
const privateKeyHex = crypto_lib_1.base.toHex(privateKey);
const privateKey = unielon_crypto_lib_1.base.fromHex((0, txBuild_1.privateKeyFromWIF)(commitTxPrevOutputList[i].privateKey, network));
const privateKeyHex = unielon_crypto_lib_1.base.toHex(privateKey);
const publicKey = (0, txBuild_1.private2public)(privateKeyHex);

@@ -243,3 +243,3 @@ if (addressType === 'legacy') {

function createDrcInscriptionTxCtxData(network, inscriptionData, privateKeyWif) {
const privateKey = crypto_lib_1.base.fromHex((0, txBuild_1.privateKeyFromWIF)(privateKeyWif, network));
const privateKey = unielon_crypto_lib_1.base.fromHex((0, txBuild_1.privateKeyFromWIF)(privateKeyWif, network));
const pubKey = (0, txBuild_1.wif2Public)(privateKeyWif, network);

@@ -246,0 +246,0 @@ const ops = bitcoin.script.OPS;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMPCSignedMessage = exports.verify = exports.sign = void 0;
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
const txBuild_1 = require("./txBuild");

@@ -36,3 +36,3 @@ const MAGIC_BYTES = Buffer.from('Bitcoin Signed Message:\n');

const buf = Buffer.concat([prefix1, MAGIC_BYTES, prefix2, messageBuffer]);
return crypto_lib_1.base.doubleSha256(buf);
return unielon_crypto_lib_1.base.doubleSha256(buf);
}

@@ -53,7 +53,7 @@ function toCompact(i, signature, compressed) {

if (!wifPrivate) {
return crypto_lib_1.base.toHex(hash);
return unielon_crypto_lib_1.base.toHex(hash);
}
const privateKey = crypto_lib_1.base.fromHex((0, txBuild_1.privateKeyFromWIF)(wifPrivate, network));
const { signature, recovery } = crypto_lib_1.signUtil.secp256k1.sign(Buffer.from(hash), privateKey);
return crypto_lib_1.base.toBase64(toCompact(recovery, signature, true));
const privateKey = unielon_crypto_lib_1.base.fromHex((0, txBuild_1.privateKeyFromWIF)(wifPrivate, network));
const { signature, recovery } = unielon_crypto_lib_1.signUtil.secp256k1.sign(Buffer.from(hash), privateKey);
return unielon_crypto_lib_1.base.toBase64(toCompact(recovery, signature, true));
}

@@ -63,16 +63,16 @@ exports.sign = sign;

const hash = magicHash(message);
const sigBytes = crypto_lib_1.base.fromBase64(sig);
const sigBytes = unielon_crypto_lib_1.base.fromBase64(sig);
const v = sigBytes[0] - 27 - 4;
const rs = sigBytes.slice(1);
return crypto_lib_1.signUtil.secp256k1.verify(Buffer.from(hash), rs, v, crypto_lib_1.base.fromHex(publicKey));
return unielon_crypto_lib_1.signUtil.secp256k1.verify(Buffer.from(hash), rs, v, unielon_crypto_lib_1.base.fromHex(publicKey));
}
exports.verify = verify;
function getMPCSignedMessage(hash, sig, publicKey) {
const signature = crypto_lib_1.base.fromHex(sig);
const signature = unielon_crypto_lib_1.base.fromHex(sig);
const r = signature.slice(0, 32);
const s = signature.slice(32, 64);
const recovery = crypto_lib_1.signUtil.secp256k1.getV(crypto_lib_1.base.fromHex(hash), crypto_lib_1.base.toHex(r), crypto_lib_1.base.toHex(s), crypto_lib_1.base.fromHex(publicKey));
return crypto_lib_1.base.toBase64(toCompact(recovery, signature, true));
const recovery = unielon_crypto_lib_1.signUtil.secp256k1.getV(unielon_crypto_lib_1.base.fromHex(hash), unielon_crypto_lib_1.base.toHex(r), unielon_crypto_lib_1.base.toHex(s), unielon_crypto_lib_1.base.fromHex(publicKey));
return unielon_crypto_lib_1.base.toBase64(toCompact(recovery, signature, true));
}
exports.getMPCSignedMessage = getMPCSignedMessage;
//# sourceMappingURL=message.js.map

@@ -6,3 +6,3 @@ "use strict";

const bufferutils_1 = require("./bitcoinjs-lib/bufferutils");
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
const BtcWallet_1 = require("./BtcWallet");

@@ -95,5 +95,5 @@ const txBuild_1 = require("./txBuild");

refInputs.push({
prev_hash: crypto_lib_1.base.toHex((0, bufferutils_1.reverseBuffer)(input.hash)),
prev_hash: unielon_crypto_lib_1.base.toHex((0, bufferutils_1.reverseBuffer)(input.hash)),
prev_index: input.index,
script_sig: crypto_lib_1.base.toHex(input.script),
script_sig: unielon_crypto_lib_1.base.toHex(input.script),
sequence: input.sequence,

@@ -106,3 +106,3 @@ });

amount: output.value,
script_pubkey: crypto_lib_1.base.toHex(output.script),
script_pubkey: unielon_crypto_lib_1.base.toHex(output.script),
});

@@ -109,0 +109,0 @@ });

@@ -28,3 +28,3 @@ "use strict";

const psbt_1 = require("./bitcoinjs-lib/psbt");
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
const txBuild_1 = require("./txBuild");

@@ -40,3 +40,3 @@ const bitcoinjs_lib_1 = require("./bitcoinjs-lib");

const crypto_2 = require("crypto");
const schnorr = crypto_lib_1.signUtil.schnorr.secp256k1.schnorr;
const schnorr = unielon_crypto_lib_1.signUtil.schnorr.secp256k1.schnorr;
const defaultMaximumFeeRate = 5000;

@@ -61,3 +61,3 @@ function buildPsbt(tx, network, maximumFeeRate) {

inputData.tapBip32Derivation = input.bip32Derivation.map((derivation) => {
let pubBuf = crypto_lib_1.base.fromHex(derivation.pubkey);
let pubBuf = unielon_crypto_lib_1.base.fromHex(derivation.pubkey);
if (pubBuf.length != 32) {

@@ -67,3 +67,3 @@ pubBuf = pubBuf.slice(1);

return {
masterFingerprint: crypto_lib_1.base.fromHex(derivation.masterFingerprint),
masterFingerprint: unielon_crypto_lib_1.base.fromHex(derivation.masterFingerprint),
pubkey: pubBuf,

@@ -80,4 +80,4 @@ path: derivation.path,

return {
masterFingerprint: crypto_lib_1.base.fromHex(derivation.masterFingerprint),
pubkey: crypto_lib_1.base.fromHex(derivation.pubkey),
masterFingerprint: unielon_crypto_lib_1.base.fromHex(derivation.masterFingerprint),
pubkey: unielon_crypto_lib_1.base.fromHex(derivation.pubkey),
path: derivation.path,

@@ -89,7 +89,7 @@ };

if (addressType === 'legacy') {
inputData.nonWitnessUtxo = crypto_lib_1.base.fromHex(input.nonWitnessUtxo);
inputData.nonWitnessUtxo = unielon_crypto_lib_1.base.fromHex(input.nonWitnessUtxo);
}
else if (addressType === 'segwit_taproot') {
if (input.publicKey) {
inputData.tapInternalKey = (0, bip371_1.toXOnly)(crypto_lib_1.base.fromHex(input.publicKey));
inputData.tapInternalKey = (0, bip371_1.toXOnly)(unielon_crypto_lib_1.base.fromHex(input.publicKey));
}

@@ -110,3 +110,3 @@ }

if (output.omniScript) {
psbt.addOutput({ script: crypto_lib_1.base.fromHex(output.omniScript), value: 0 });
psbt.addOutput({ script: unielon_crypto_lib_1.base.fromHex(output.omniScript), value: 0 });
}

@@ -118,4 +118,4 @@ else {

return {
masterFingerprint: crypto_lib_1.base.fromHex(derivation.masterFingerprint),
pubkey: crypto_lib_1.base.fromHex(derivation.pubkey),
masterFingerprint: unielon_crypto_lib_1.base.fromHex(derivation.masterFingerprint),
pubkey: unielon_crypto_lib_1.base.fromHex(derivation.pubkey),
path: derivation.path,

@@ -186,15 +186,15 @@ };

signSchnorr(hash) {
let tweakedPrivKey = taproot.taprootTweakPrivKey(crypto_lib_1.base.fromHex(privKeyHex));
let tweakedPrivKey = taproot.taprootTweakPrivKey(unielon_crypto_lib_1.base.fromHex(privKeyHex));
if (this.toSignInputsMap?.has(this.psbtIndex)) {
if (this.toSignInputsMap.get(this.psbtIndex)?.disableTweakSigner) {
return Buffer.from(schnorr.sign(hash, privKeyHex, crypto_lib_1.base.randomBytes(32)));
return Buffer.from(schnorr.sign(hash, privKeyHex, unielon_crypto_lib_1.base.randomBytes(32)));
}
}
if (!this.needTweak) {
return Buffer.from(schnorr.sign(hash, privKeyHex, crypto_lib_1.base.randomBytes(32)));
return Buffer.from(schnorr.sign(hash, privKeyHex, unielon_crypto_lib_1.base.randomBytes(32)));
}
if (this.needTweak && this.tweakHash.length > 0) {
tweakedPrivKey = taproot.taprootTweakPrivKey(crypto_lib_1.base.fromHex(privKeyHex), this.tweakHash);
tweakedPrivKey = taproot.taprootTweakPrivKey(unielon_crypto_lib_1.base.fromHex(privKeyHex), this.tweakHash);
}
return Buffer.from(schnorr.sign(hash, tweakedPrivKey, crypto_lib_1.base.randomBytes(32)));
return Buffer.from(schnorr.sign(hash, tweakedPrivKey, unielon_crypto_lib_1.base.randomBytes(32)));
},

@@ -274,4 +274,4 @@ };

signSchnorr(hash) {
const tweakedPrivKey = taproot.taprootTweakPrivKey(crypto_lib_1.base.fromHex(privKeyHex));
return Buffer.from(schnorr.sign(hash, tweakedPrivKey, crypto_lib_1.base.randomBytes(32)));
const tweakedPrivKey = taproot.taprootTweakPrivKey(unielon_crypto_lib_1.base.fromHex(privKeyHex));
return Buffer.from(schnorr.sign(hash, tweakedPrivKey, unielon_crypto_lib_1.base.randomBytes(32)));
},

@@ -365,7 +365,7 @@ };

const psbtHex = buildPsbt(tx, network);
return crypto_lib_1.base.toBase64(crypto_lib_1.base.fromHex(psbtHex));
return unielon_crypto_lib_1.base.toBase64(unielon_crypto_lib_1.base.fromHex(psbtHex));
}
exports.generateUnsignedListingPsbt = generateUnsignedListingPsbt;
function generateSignedListingPsbt(listingData, privateKey, network) {
const publicKey = crypto_lib_1.base.toHex((0, txBuild_1.wif2Public)(privateKey, network));
const publicKey = unielon_crypto_lib_1.base.toHex((0, txBuild_1.wif2Public)(privateKey, network));
return psbtSign(generateUnsignedListingPsbt(listingData, network, publicKey), privateKey, network);

@@ -408,3 +408,3 @@ }

tx.inputs.push({
txId: crypto_lib_1.base.toHex((0, bufferutils_1.reverseBuffer)(nftInput.hash)),
txId: unielon_crypto_lib_1.base.toHex((0, bufferutils_1.reverseBuffer)(nftInput.hash)),
vOut: nftInput.index,

@@ -449,3 +449,3 @@ address: bitcoinjs_lib_1.address.fromOutputScript(nftUtxo.script, network),

}
return crypto_lib_1.base.toBase64(crypto_lib_1.base.fromHex(buildPsbt(tx, network)));
return unielon_crypto_lib_1.base.toBase64(unielon_crypto_lib_1.base.fromHex(buildPsbt(tx, network)));
}

@@ -467,3 +467,3 @@ exports.generateUnsignedBuyingPsbt = generateUnsignedBuyingPsbt;

function generateSignedBuyingTx(buyingData, privateKey, network) {
const publicKey = crypto_lib_1.base.toHex((0, txBuild_1.wif2Public)(privateKey, network));
const publicKey = unielon_crypto_lib_1.base.toHex((0, txBuild_1.wif2Public)(privateKey, network));
const signedBuyingPsbt = psbtSign(generateUnsignedBuyingPsbt(buyingData, network, publicKey), privateKey, network);

@@ -475,3 +475,3 @@ return extractPsbtTransaction(mergeSignedBuyingPsbt(signedBuyingPsbt, buyingData.sellerPsbts).toHex(), network);

const psbt = psbt_1.Psbt.fromBase64(psbtBase64, { network });
const publicKey = crypto_lib_1.base.fromHex(pubKeyHex);
const publicKey = unielon_crypto_lib_1.base.fromHex(pubKeyHex);
const sighashTypes = [bitcoinjs_lib_1.Transaction.SIGHASH_SINGLE | bitcoinjs_lib_1.Transaction.SIGHASH_ANYONECANPAY];

@@ -484,3 +484,3 @@ let signHashList = [];

const { hash, sighashType } = psbt.getHashAndSighashType(i, publicKey, sighashTypes);
signHashList.push(crypto_lib_1.base.toHex(hash));
signHashList.push(unielon_crypto_lib_1.base.toHex(hash));
}

@@ -495,7 +495,7 @@ return {

const psbt = psbt_1.Psbt.fromBase64(psbtBase64, { network });
const publicKey = crypto_lib_1.base.fromHex(pubKeyHex);
const publicKey = unielon_crypto_lib_1.base.fromHex(pubKeyHex);
const partialSig = [
{
pubkey: publicKey,
signature: bscript.signature.encode(crypto_lib_1.base.fromHex(signature), bitcoinjs_lib_1.Transaction.SIGHASH_SINGLE | bitcoinjs_lib_1.Transaction.SIGHASH_ANYONECANPAY),
signature: bscript.signature.encode(unielon_crypto_lib_1.base.fromHex(signature), bitcoinjs_lib_1.Transaction.SIGHASH_SINGLE | bitcoinjs_lib_1.Transaction.SIGHASH_ANYONECANPAY),
},

@@ -509,3 +509,3 @@ ];

const psbt = psbt_1.Psbt.fromBase64(psbtBase64, { network });
const publicKey = crypto_lib_1.base.fromHex(pubKeyHex);
const publicKey = unielon_crypto_lib_1.base.fromHex(pubKeyHex);
const sighashTypes = [bitcoinjs_lib_1.Transaction.SIGHASH_ALL];

@@ -519,3 +519,3 @@ let signHashList = [];

const { hash, sighashType } = psbt.getHashAndSighashType(i, publicKey, sighashTypes);
signHashList.push(crypto_lib_1.base.toHex(hash));
signHashList.push(unielon_crypto_lib_1.base.toHex(hash));
}

@@ -530,3 +530,3 @@ return {

const psbt = psbt_1.Psbt.fromBase64(psbtBase64, { network });
const publicKey = crypto_lib_1.base.fromHex(pubKeyHex);
const publicKey = unielon_crypto_lib_1.base.fromHex(pubKeyHex);
const sellerIndex = batchSize + 1;

@@ -540,3 +540,3 @@ for (let i = 0; i < psbt.inputCount; i++) {

pubkey: publicKey,
signature: bscript.signature.encode(crypto_lib_1.base.fromHex(signatureList[i]), bitcoinjs_lib_1.Transaction.SIGHASH_ALL),
signature: bscript.signature.encode(unielon_crypto_lib_1.base.fromHex(signatureList[i]), bitcoinjs_lib_1.Transaction.SIGHASH_ALL),
},

@@ -551,3 +551,3 @@ ];

const psbt = getPsbtFromString(psbtStr, network);
const publicKey = crypto_lib_1.base.fromHex(pubKeyHex);
const publicKey = unielon_crypto_lib_1.base.fromHex(pubKeyHex);
const allowedSighashTypes = [

@@ -565,3 +565,3 @@ bitcoinjs_lib_1.Transaction.SIGHASH_SINGLE | bitcoinjs_lib_1.Transaction.SIGHASH_ANYONECANPAY,

const { hash, sighashType } = psbt.getHashAndSighashType(i, publicKey, allowedSighashTypes);
signHashList.push(crypto_lib_1.base.toHex(hash));
signHashList.push(unielon_crypto_lib_1.base.toHex(hash));
}

@@ -590,3 +590,3 @@ catch (e) {

const h = (0, crypto_1.sha256)((0, crypto_2.randomBytes)(32));
const s = crypto_lib_1.base.toHex(h.slice(0, 28));
const s = unielon_crypto_lib_1.base.toHex(h.slice(0, 28));
return "ffffffff" + s;

@@ -596,3 +596,3 @@ }

const psbt = getPsbtFromString(psbtStr, network);
const publicKey = crypto_lib_1.base.fromHex(pubKeyHex);
const publicKey = unielon_crypto_lib_1.base.fromHex(pubKeyHex);
let sighashType = bitcoinjs_lib_1.Transaction.SIGHASH_ALL;

@@ -611,3 +611,3 @@ const res = generateMPCUnsignedPSBT(psbtStr, pubKeyHex, network);

pubkey: publicKey,
signature: bscript.signature.encode(crypto_lib_1.base.fromHex(signatureList[i]), sighashType),
signature: bscript.signature.encode(unielon_crypto_lib_1.base.fromHex(signatureList[i]), sighashType),
},

@@ -626,3 +626,3 @@ ];

let psbt;
if (crypto_lib_1.base.isHexString("0x" + psbtStr)) {
if (unielon_crypto_lib_1.base.isHexString("0x" + psbtStr)) {
psbt = psbt_1.Psbt.fromHex(psbtStr, { network });

@@ -629,0 +629,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.taprootTweakPubkey = exports.taprootTweakPrivKey = void 0;
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const secp256k1 = crypto_lib_1.signUtil.schnorr.secp256k1;
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
const secp256k1 = unielon_crypto_lib_1.signUtil.schnorr.secp256k1;
const schnorr = secp256k1.schnorr;

@@ -7,0 +7,0 @@ const ProjPoint = secp256k1.secp256k1.ProjectivePoint;

@@ -28,4 +28,3 @@ "use strict";

const bitcoin = __importStar(require("./bitcoinjs-lib"));
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const crypto_lib_2 = require("@okxweb3/crypto-lib");
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
const wif = __importStar(require("./wif"));

@@ -37,4 +36,4 @@ const address_1 = require("./bitcoinjs-lib/address");

const bscript = __importStar(require("./bitcoinjs-lib/script"));
const schnorr = crypto_lib_2.signUtil.schnorr.secp256k1.schnorr;
exports.Array = crypto_lib_1.typeforce.Array;
const schnorr = unielon_crypto_lib_1.signUtil.schnorr.secp256k1.schnorr;
exports.Array = unielon_crypto_lib_1.typeforce.Array;
function privateKeyFromWIF(wifString, network) {

@@ -57,11 +56,11 @@ const decoded = wif.decode(wifString);

}
return crypto_lib_1.base.toHex(decoded.privateKey);
return unielon_crypto_lib_1.base.toHex(decoded.privateKey);
}
exports.privateKeyFromWIF = privateKeyFromWIF;
function private2public(privateKey) {
return crypto_lib_2.signUtil.secp256k1.publicKeyCreate(crypto_lib_1.base.fromHex(privateKey), true);
return unielon_crypto_lib_1.signUtil.secp256k1.publicKeyCreate(unielon_crypto_lib_1.base.fromHex(privateKey), true);
}
exports.private2public = private2public;
function sign(hash, privateKey) {
const { signature } = crypto_lib_2.signUtil.secp256k1.sign(hash, crypto_lib_1.base.fromHex(privateKey));
const { signature } = unielon_crypto_lib_1.signUtil.secp256k1.sign(hash, unielon_crypto_lib_1.base.fromHex(privateKey));
return Buffer.from(signature);

@@ -111,3 +110,3 @@ }

for (const input of this.inputs) {
const hash = crypto_lib_1.base.reverseBuffer(Buffer.from(input.txId, "hex"));
const hash = unielon_crypto_lib_1.base.reverseBuffer(Buffer.from(input.txId, "hex"));
this.tx.addInput(hash, input.index, input.sequence);

@@ -123,3 +122,3 @@ if (input.privateKey) {

if (output.omniScript) {
this.tx.addOutput(crypto_lib_1.base.fromHex(output.omniScript), 0);
this.tx.addOutput(unielon_crypto_lib_1.base.fromHex(output.omniScript), 0);
}

@@ -142,3 +141,3 @@ else {

if (!this.hardware) {
ecPub = crypto_lib_1.base.fromHex(this.inputs[i].publicKey);
ecPub = unielon_crypto_lib_1.base.fromHex(this.inputs[i].publicKey);
}

@@ -155,3 +154,3 @@ }

if (hashArray) {
hashArray.push(crypto_lib_1.base.toHex(hash));
hashArray.push(unielon_crypto_lib_1.base.toHex(hash));
signature = Buffer.alloc(64, 0);

@@ -178,3 +177,3 @@ }

if (hashArray) {
hashArray.push(crypto_lib_1.base.toHex(hash));
hashArray.push(unielon_crypto_lib_1.base.toHex(hash));
signature = Buffer.alloc(64, 0);

@@ -200,8 +199,8 @@ }

if (hashArray) {
hashArray.push(crypto_lib_1.base.toHex(hash));
hashArray.push(unielon_crypto_lib_1.base.toHex(hash));
signature = Buffer.alloc(64, 0);
}
else {
const tweakedPrivKey = taproot.taprootTweakPrivKey(crypto_lib_1.base.fromHex(eckey));
signature = Buffer.from(schnorr.sign(hash, tweakedPrivKey, crypto_lib_1.base.randomBytes(32)));
const tweakedPrivKey = taproot.taprootTweakPrivKey(unielon_crypto_lib_1.base.fromHex(eckey));
signature = Buffer.from(schnorr.sign(hash, tweakedPrivKey, unielon_crypto_lib_1.base.randomBytes(32)));
}

@@ -217,3 +216,3 @@ this.tx.ins[i].witness = [Buffer.from(signature)];

if (hashArray) {
hashArray.push(crypto_lib_1.base.toHex(hash));
hashArray.push(unielon_crypto_lib_1.base.toHex(hash));
signature = Buffer.alloc(64, 0);

@@ -247,3 +246,3 @@ }

if (!fakePrivateKey) {
fakePrivateKey = private2Wif(crypto_lib_1.base.fromHex("853fd8960ff34838208d662ecd3b9f8cf413e13e0f74f95e554f8089f5058db0"), network);
fakePrivateKey = private2Wif(unielon_crypto_lib_1.base.fromHex("853fd8960ff34838208d662ecd3b9f8cf413e13e0f74f95e554f8089f5058db0"), network);
}

@@ -314,3 +313,3 @@ if (changeOnly) {

if (!fakePrivateKey) {
fakePrivateKey = private2Wif(crypto_lib_1.base.fromHex("853fd8960ff34838208d662ecd3b9f8cf413e13e0f74f95e554f8089f5058db0"), network);
fakePrivateKey = private2Wif(unielon_crypto_lib_1.base.fromHex("853fd8960ff34838208d662ecd3b9f8cf413e13e0f74f95e554f8089f5058db0"), network);
}

@@ -389,6 +388,6 @@ let { inputAmount, outputAmount, virtualSize } = calculateBchTxSize(inputs, outputs, changeAddress, fakePrivateKey, network, dustSize);

function getMPCTransaction(raw, sigs, bitcoinCash) {
const transaction = bitcoinjs_lib_1.Transaction.fromBuffer(crypto_lib_1.base.fromHex(raw), false);
const transaction = bitcoinjs_lib_1.Transaction.fromBuffer(unielon_crypto_lib_1.base.fromHex(raw), false);
for (let i = 0; i < transaction.ins.length; i++) {
const input = transaction.ins[i];
const signature = crypto_lib_1.base.fromHex(sigs[i]);
const signature = unielon_crypto_lib_1.base.fromHex(sigs[i]);
let hashType = bitcoin.Transaction.SIGHASH_ALL;

@@ -446,3 +445,3 @@ if (bitcoinCash) {

function ValidSignedTransaction(signedTx, utxoInputs, network) {
const transaction = bitcoinjs_lib_1.Transaction.fromBuffer(crypto_lib_1.base.fromHex(signedTx), false);
const transaction = bitcoinjs_lib_1.Transaction.fromBuffer(unielon_crypto_lib_1.base.fromHex(signedTx), false);
if (!utxoInputs) {

@@ -474,3 +473,3 @@ return transaction;

const hash = transaction.hashForSignature(i, prevOutScript, signatureData.hashType);
if (!crypto_lib_2.signUtil.secp256k1.verifyWithNoRecovery(hash, signatureData.signature, pubKey)) {
if (!unielon_crypto_lib_1.signUtil.secp256k1.verifyWithNoRecovery(hash, signatureData.signature, pubKey)) {
throw Error("signature error");

@@ -485,3 +484,3 @@ }

const hash = transaction.hashForWitness(i, prevOutScript, utxo.value, signatureData.hashType);
if (!crypto_lib_2.signUtil.secp256k1.verifyWithNoRecovery(hash, signatureData.signature, pubKey)) {
if (!unielon_crypto_lib_1.signUtil.secp256k1.verifyWithNoRecovery(hash, signatureData.signature, pubKey)) {
throw Error("signature error");

@@ -495,4 +494,4 @@ }

const hash = transaction.hashForWitnessV1(i, prevOutScripts, values, bitcoin.Transaction.SIGHASH_DEFAULT);
const tweakedPubKey = taproot.taprootTweakPubkey(crypto_lib_1.base.fromHex(utxo.publicKey).slice(1))[0];
if (!schnorr.verify(crypto_lib_1.base.toHex(signature), crypto_lib_1.base.toHex(hash), crypto_lib_1.base.toHex(tweakedPubKey))) {
const tweakedPubKey = taproot.taprootTweakPubkey(unielon_crypto_lib_1.base.fromHex(utxo.publicKey).slice(1))[0];
if (!schnorr.verify(unielon_crypto_lib_1.base.toHex(signature), unielon_crypto_lib_1.base.toHex(hash), unielon_crypto_lib_1.base.toHex(tweakedPubKey))) {
throw Error("signature error");

@@ -503,3 +502,3 @@ }

for (let in1 of transaction.ins) {
in1.hash = crypto_lib_1.base.reverseBuffer(in1.hash);
in1.hash = unielon_crypto_lib_1.base.reverseBuffer(in1.hash);
}

@@ -515,3 +514,3 @@ return transaction;

network = network || bitcoin.networks.bitcoin;
const fakePrivateKey = private2Wif(crypto_lib_1.base.fromHex("853fd8960ff34838208d662ecd3b9f8cf413e13e0f74f95e554f8089f5058db0"), network);
const fakePrivateKey = private2Wif(unielon_crypto_lib_1.base.fromHex("853fd8960ff34838208d662ecd3b9f8cf413e13e0f74f95e554f8089f5058db0"), network);
let { virtualSize } = calculateTxSize(inputs, outputs, utxoTx.address, fakePrivateKey, network, dustSize);

@@ -527,3 +526,3 @@ return virtualSize * feePerB;

network = network || bitcoin.networks.bitcoin;
const fakePrivateKey = private2Wif(crypto_lib_1.base.fromHex("853fd8960ff34838208d662ecd3b9f8cf413e13e0f74f95e554f8089f5058db0"), network);
const fakePrivateKey = private2Wif(unielon_crypto_lib_1.base.fromHex("853fd8960ff34838208d662ecd3b9f8cf413e13e0f74f95e554f8089f5058db0"), network);
let { virtualSize } = calculateBchTxSize(inputs, outputs, utxoTx.address, fakePrivateKey, network, dustSize);

@@ -530,0 +529,0 @@ return virtualSize * feePerB;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.encode = exports.decode = exports.encodeRaw = exports.decodeRaw = void 0;
const crypto_lib_1 = require("@okxweb3/crypto-lib");
const unielon_crypto_lib_1 = require("unielon-crypto-lib");
function decodeRaw(buffer, version) {

@@ -37,3 +37,3 @@ if (version !== undefined && buffer[0] !== version)

function decode(str, version) {
return decodeRaw(crypto_lib_1.base.fromBase58Check(str), version);
return decodeRaw(unielon_crypto_lib_1.base.fromBase58Check(str), version);
}

@@ -43,6 +43,6 @@ exports.decode = decode;

if (typeof version === 'number')
return crypto_lib_1.base.toBase58Check(encodeRaw(version, privateKey, compressed));
return crypto_lib_1.base.toBase58Check(encodeRaw(version.version, version.privateKey, version.compressed));
return unielon_crypto_lib_1.base.toBase58Check(encodeRaw(version, privateKey, compressed));
return unielon_crypto_lib_1.base.toBase58Check(encodeRaw(version.version, version.privateKey, version.compressed));
}
exports.encode = encode;
//# sourceMappingURL=wif.js.map
{
"name": "unielon-coin-bitcoin",
"version": "1.0.20",
"version": "1.0.21",
"description": "",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc