@stacks/stacking
Advanced tools
Comparing version 4.0.1 to 4.0.2-beta.1
@@ -1,4 +0,3 @@ | ||
import { Buffer, intToBigInt } from '@stacks/common'; | ||
import { intToBigInt, toBuffer } from '@stacks/common'; | ||
import { makeContractCall, bufferCV, uintCV, tupleCV, ClarityType, broadcastTransaction, standardPrincipalCV, callReadOnlyFunction, cvToString, noneCV, someCV, validateStacksAddress, AnchorMode, getFee, } from '@stacks/transactions'; | ||
import BN from 'bn.js'; | ||
import { StackingErrors } from './constants'; | ||
@@ -84,3 +83,3 @@ import { fetchPrivate } from '@stacks/common'; | ||
const { hashMode, data } = decodeBtcAddress(poxAddress); | ||
const hashModeBuffer = bufferCV(new BN(hashMode, 10).toArrayLike(Buffer)); | ||
const hashModeBuffer = bufferCV(toBuffer(BigInt(hashMode))); | ||
const hashbytes = bufferCV(data); | ||
@@ -182,3 +181,3 @@ const poxAddressCV = tupleCV({ | ||
const { hashMode, data } = decodeBtcAddress(poxAddress); | ||
const hashModeBuffer = bufferCV(new BN(hashMode, 10).toArrayLike(Buffer)); | ||
const hashModeBuffer = bufferCV(toBuffer(BigInt(hashMode))); | ||
const hashbytes = bufferCV(data); | ||
@@ -206,3 +205,3 @@ const address = tupleCV({ | ||
const { hashMode, data } = decodeBtcAddress(poxAddress); | ||
const hashModeBuffer = bufferCV(new BN(hashMode, 10).toArrayLike(Buffer)); | ||
const hashModeBuffer = bufferCV(toBuffer(BigInt(hashMode))); | ||
const hashbytes = bufferCV(data); | ||
@@ -234,3 +233,3 @@ address = someCV(tupleCV({ | ||
const { hashMode, data } = decodeBtcAddress(poxAddress); | ||
const hashModeBuffer = bufferCV(new BN(hashMode, 10).toArrayLike(Buffer)); | ||
const hashModeBuffer = bufferCV(toBuffer(BigInt(hashMode))); | ||
const hashbytes = bufferCV(data); | ||
@@ -265,3 +264,3 @@ const address = tupleCV({ | ||
const { hashMode, data } = decodeBtcAddress(poxAddress); | ||
const hashModeBuffer = bufferCV(new BN(hashMode, 10).toArrayLike(Buffer)); | ||
const hashModeBuffer = bufferCV(toBuffer(BigInt(hashMode))); | ||
const hashbytes = bufferCV(data); | ||
@@ -268,0 +267,0 @@ const address = tupleCV({ |
@@ -31,3 +31,3 @@ /// <reference types="node" /> | ||
export declare function poxAddressToBtcAddress(...args: PoxAddressArgs): string; | ||
export declare function getBTCAddress(version: Buffer, checksum: Buffer): string; | ||
export declare function getBTCAddress(version: number | Buffer, checksum: Buffer): string; | ||
export declare function getErrorString(error: StackingErrors): string; |
import { AddressHashMode, ClarityType, } from '@stacks/transactions'; | ||
import { address } from 'bitcoinjs-lib'; | ||
import BN from 'bn.js'; | ||
import { StackingErrors } from './constants'; | ||
@@ -118,4 +117,4 @@ export class InvalidAddressError extends Error { | ||
export function getBTCAddress(version, checksum) { | ||
const btcAddress = address.toBase58Check(checksum, new BN(version).toNumber()); | ||
return btcAddress; | ||
const versionNumber = typeof version === 'number' ? version : version[0]; | ||
return address.toBase58Check(checksum, versionNumber); | ||
} | ||
@@ -122,0 +121,0 @@ export function getErrorString(error) { |
@@ -16,5 +16,2 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -24,3 +21,2 @@ exports.StackingClient = void 0; | ||
const transactions_1 = require("@stacks/transactions"); | ||
const bn_js_1 = __importDefault(require("bn.js")); | ||
const constants_1 = require("./constants"); | ||
@@ -106,3 +102,3 @@ const common_2 = require("@stacks/common"); | ||
const { hashMode, data } = (0, utils_1.decodeBtcAddress)(poxAddress); | ||
const hashModeBuffer = (0, transactions_1.bufferCV)(new bn_js_1.default(hashMode, 10).toArrayLike(common_1.Buffer)); | ||
const hashModeBuffer = (0, transactions_1.bufferCV)((0, common_1.toBuffer)(BigInt(hashMode))); | ||
const hashbytes = (0, transactions_1.bufferCV)(data); | ||
@@ -204,3 +200,3 @@ const poxAddressCV = (0, transactions_1.tupleCV)({ | ||
const { hashMode, data } = (0, utils_1.decodeBtcAddress)(poxAddress); | ||
const hashModeBuffer = (0, transactions_1.bufferCV)(new bn_js_1.default(hashMode, 10).toArrayLike(common_1.Buffer)); | ||
const hashModeBuffer = (0, transactions_1.bufferCV)((0, common_1.toBuffer)(BigInt(hashMode))); | ||
const hashbytes = (0, transactions_1.bufferCV)(data); | ||
@@ -228,3 +224,3 @@ const address = (0, transactions_1.tupleCV)({ | ||
const { hashMode, data } = (0, utils_1.decodeBtcAddress)(poxAddress); | ||
const hashModeBuffer = (0, transactions_1.bufferCV)(new bn_js_1.default(hashMode, 10).toArrayLike(common_1.Buffer)); | ||
const hashModeBuffer = (0, transactions_1.bufferCV)((0, common_1.toBuffer)(BigInt(hashMode))); | ||
const hashbytes = (0, transactions_1.bufferCV)(data); | ||
@@ -256,3 +252,3 @@ address = (0, transactions_1.someCV)((0, transactions_1.tupleCV)({ | ||
const { hashMode, data } = (0, utils_1.decodeBtcAddress)(poxAddress); | ||
const hashModeBuffer = (0, transactions_1.bufferCV)(new bn_js_1.default(hashMode, 10).toArrayLike(common_1.Buffer)); | ||
const hashModeBuffer = (0, transactions_1.bufferCV)((0, common_1.toBuffer)(BigInt(hashMode))); | ||
const hashbytes = (0, transactions_1.bufferCV)(data); | ||
@@ -287,3 +283,3 @@ const address = (0, transactions_1.tupleCV)({ | ||
const { hashMode, data } = (0, utils_1.decodeBtcAddress)(poxAddress); | ||
const hashModeBuffer = (0, transactions_1.bufferCV)(new bn_js_1.default(hashMode, 10).toArrayLike(common_1.Buffer)); | ||
const hashModeBuffer = (0, transactions_1.bufferCV)((0, common_1.toBuffer)(BigInt(hashMode))); | ||
const hashbytes = (0, transactions_1.bufferCV)(data); | ||
@@ -290,0 +286,0 @@ const address = (0, transactions_1.tupleCV)({ |
@@ -31,3 +31,3 @@ /// <reference types="node" /> | ||
export declare function poxAddressToBtcAddress(...args: PoxAddressArgs): string; | ||
export declare function getBTCAddress(version: Buffer, checksum: Buffer): string; | ||
export declare function getBTCAddress(version: number | Buffer, checksum: Buffer): string; | ||
export declare function getErrorString(error: StackingErrors): string; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -9,3 +6,2 @@ exports.getErrorString = exports.getBTCAddress = exports.poxAddressToBtcAddress = exports.extractPoxAddressFromClarityValue = exports.decodeBtcAddress = exports.getAddressHashMode = exports.hashModeToBtcAddressVersion = exports.btcAddressVersionToHashMode = exports.BitcoinNetworkVersion = exports.InvalidAddressError = void 0; | ||
const bitcoinjs_lib_1 = require("bitcoinjs-lib"); | ||
const bn_js_1 = __importDefault(require("bn.js")); | ||
const constants_1 = require("./constants"); | ||
@@ -132,4 +128,4 @@ class InvalidAddressError extends Error { | ||
function getBTCAddress(version, checksum) { | ||
const btcAddress = bitcoinjs_lib_1.address.toBase58Check(checksum, new bn_js_1.default(version).toNumber()); | ||
return btcAddress; | ||
const versionNumber = typeof version === 'number' ? version : version[0]; | ||
return bitcoinjs_lib_1.address.toBase58Check(checksum, versionNumber); | ||
} | ||
@@ -136,0 +132,0 @@ exports.getBTCAddress = getBTCAddress; |
{ | ||
"name": "@stacks/stacking", | ||
"version": "4.0.1", | ||
"version": "4.0.2-beta.1", | ||
"description": "Library for Stacking.", | ||
@@ -39,9 +39,7 @@ "keywords": [ | ||
"dependencies": { | ||
"@stacks/common": "^4.0.1", | ||
"@stacks/network": "^4.0.1", | ||
"@stacks/common": "^4.0.2-beta.1", | ||
"@stacks/network": "^4.0.2-beta.1", | ||
"@stacks/stacks-blockchain-api-types": "^0.61.0", | ||
"@stacks/transactions": "^4.0.0", | ||
"@types/bn.js": "^4.11.6", | ||
"bitcoinjs-lib": "^5.2.0", | ||
"bn.js": "^5.2.0" | ||
"@stacks/transactions": "^4.0.2-beta.1", | ||
"bitcoinjs-lib": "^5.2.0" | ||
}, | ||
@@ -70,3 +68,3 @@ "devDependencies": { | ||
"unpkg": "dist/umd/index.js", | ||
"gitHead": "2add622be6429d5d73559af12872eab0fb66b996" | ||
"gitHead": "0f65e5b363986e830faaf8050c9b3c7aa30e4924" | ||
} |
@@ -1,2 +0,3 @@ | ||
import { Buffer, IntegerType, intToBigInt } from '@stacks/common'; | ||
// @ts-ignore | ||
import { Buffer, IntegerType, intToBigInt, toBuffer } from '@stacks/common'; | ||
import { | ||
@@ -33,3 +34,2 @@ makeContractCall, | ||
import { StacksNetwork } from '@stacks/network'; | ||
import BN from 'bn.js'; | ||
import { StackingErrors } from './constants'; | ||
@@ -330,3 +330,3 @@ import { fetchPrivate } from '@stacks/common'; | ||
const { hashMode, data } = decodeBtcAddress(poxAddress); | ||
const hashModeBuffer = bufferCV(new BN(hashMode, 10).toArrayLike(Buffer)); | ||
const hashModeBuffer = bufferCV(toBuffer(BigInt(hashMode))); | ||
const hashbytes = bufferCV(data); | ||
@@ -533,3 +533,3 @@ const poxAddressCV = tupleCV({ | ||
const { hashMode, data } = decodeBtcAddress(poxAddress); | ||
const hashModeBuffer = bufferCV(new BN(hashMode, 10).toArrayLike(Buffer)); | ||
const hashModeBuffer = bufferCV(toBuffer(BigInt(hashMode))); | ||
const hashbytes = bufferCV(data); | ||
@@ -572,3 +572,3 @@ const address = tupleCV({ | ||
const { hashMode, data } = decodeBtcAddress(poxAddress); | ||
const hashModeBuffer = bufferCV(new BN(hashMode, 10).toArrayLike(Buffer)); | ||
const hashModeBuffer = bufferCV(toBuffer(BigInt(hashMode))); | ||
const hashbytes = bufferCV(data); | ||
@@ -620,3 +620,3 @@ address = someCV( | ||
const { hashMode, data } = decodeBtcAddress(poxAddress); | ||
const hashModeBuffer = bufferCV(new BN(hashMode, 10).toArrayLike(Buffer)); | ||
const hashModeBuffer = bufferCV(toBuffer(BigInt(hashMode))); | ||
const hashbytes = bufferCV(data); | ||
@@ -663,3 +663,3 @@ const address = tupleCV({ | ||
const { hashMode, data } = decodeBtcAddress(poxAddress); | ||
const hashModeBuffer = bufferCV(new BN(hashMode, 10).toArrayLike(Buffer)); | ||
const hashModeBuffer = bufferCV(toBuffer(BigInt(hashMode))); | ||
const hashbytes = bufferCV(data); | ||
@@ -666,0 +666,0 @@ const address = tupleCV({ |
@@ -11,3 +11,2 @@ // @ts-ignore | ||
import { address } from 'bitcoinjs-lib'; | ||
import BN from 'bn.js'; | ||
import { StackingErrors } from './constants'; | ||
@@ -143,5 +142,5 @@ | ||
export function getBTCAddress(version: Buffer, checksum: Buffer) { | ||
const btcAddress = address.toBase58Check(checksum, new BN(version).toNumber()); | ||
return btcAddress; | ||
export function getBTCAddress(version: number | Buffer, checksum: Buffer) { | ||
const versionNumber: number = typeof version === 'number' ? version : version[0]; | ||
return address.toBase58Check(checksum, versionNumber); | ||
} | ||
@@ -148,0 +147,0 @@ |
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 too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5
3297368
6252
1
- Removed@types/bn.js@^4.11.6
- Removedbn.js@^5.2.0
- Removed@types/bn.js@4.11.6(transitive)
- Removedbn.js@5.2.1(transitive)
Updated@stacks/common@^4.0.2-beta.1