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

@stacks/stacking

Package Overview
Dependencies
Maintainers
5
Versions
662
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stacks/stacking - npm Package Compare versions

Comparing version 6.14.1-pr.44 to 6.14.1-pr.64

48

dist/esm/index.js
import { StacksNodeApi, } from '@stacks/api';
import { hexToBytes, intToBigInt, isInstance, } from '@stacks/common';
import { networkFrom } from '@stacks/network';
import { ClarityType, broadcastTransaction, bufferCV, callReadOnlyFunction, cvToString, getFee, makeContractCall, noneCV, principalCV, principalToString, someCV, stringAsciiCV, uintCV, validateStacksAddress, } from '@stacks/transactions';
import { ClarityType, broadcastTransaction, bufferCV, cvToString, fetchCallReadOnlyFunction, getFee, makeContractCall, noneCV, principalCV, someCV, stringAsciiCV, uintCV, validateStacksAddress, } from '@stacks/transactions';
import { PoxOperationPeriod, StackingErrors } from './constants';

@@ -55,3 +55,3 @@ import { ensureLegacyBtcAddressForPox1, ensurePox2Activated, ensureSignerArgsReadiness, poxAddressToTuple, signPox4SignatureHash, unwrap, unwrapMap, } from './utils';

const [contractAddress, contractName] = this.parseContractId(options?.contractId);
const result = await callReadOnlyFunction({
const result = await fetchCallReadOnlyFunction({
api: this.api,

@@ -66,6 +66,6 @@ senderAddress: this.address,

pox_address: {
version: tuple.data['pox-addr'].data['version'].buffer,
hashbytes: tuple.data['pox-addr'].data['hashbytes'].buffer,
version: hexToBytes(tuple.value['pox-addr'].value['version'].value),
hashbytes: hexToBytes(tuple.value['pox-addr'].value['hashbytes'].value),
},
total_ustx: tuple.data['total-ustx'].value,
total_ustx: BigInt(tuple.value['total-ustx'].value),
}));

@@ -109,3 +109,3 @@ }

const [contractAddress, contractName] = this.parseContractId(poxInfo.contract_id);
return callReadOnlyFunction({
return fetchCallReadOnlyFunction({
api: this.api,

@@ -566,3 +566,3 @@ contractName,

const functionName = 'get-stacker-info';
return callReadOnlyFunction({
return fetchCallReadOnlyFunction({
contractAddress,

@@ -578,7 +578,7 @@ contractName,

const tupleCV = someCV.value;
const poxAddress = tupleCV.data['pox-addr'];
const firstRewardCycle = tupleCV.data['first-reward-cycle'];
const lockPeriod = tupleCV.data['lock-period'];
const version = poxAddress.data['version'];
const hashbytes = poxAddress.data['hashbytes'];
const poxAddress = tupleCV.value['pox-addr'];
const firstRewardCycle = tupleCV.value['first-reward-cycle'];
const lockPeriod = tupleCV.value['lock-period'];
const version = poxAddress.value['version'];
const hashbytes = poxAddress.value['hashbytes'];
return {

@@ -591,4 +591,4 @@ stacked: true,

pox_address: {
version: version.buffer,
hashbytes: hashbytes.buffer,
version: hexToBytes(version.value),
hashbytes: hexToBytes(hashbytes.value),
},

@@ -612,3 +612,3 @@ },

const functionName = 'get-delegation-info';
return callReadOnlyFunction({
return fetchCallReadOnlyFunction({
contractAddress,

@@ -623,9 +623,9 @@ contractName,

const tupleCV = responseCV.value;
const amountMicroStx = tupleCV.data['amount-ustx'];
const delegatedTo = tupleCV.data['delegated-to'];
const poxAddress = unwrapMap(tupleCV.data['pox-addr'], tuple => ({
version: tuple.data['version'].buffer[0],
hashbytes: tuple.data['hashbytes'].buffer,
const amountMicroStx = tupleCV.value['amount-ustx'];
const delegatedTo = tupleCV.value['delegated-to'];
const poxAddress = unwrapMap(tupleCV.value['pox-addr'], tuple => ({
version: hexToBytes(tuple.value['version'].value)[0],
hashbytes: hexToBytes(tuple.value['hashbytes'].value),
}));
const untilBurnBlockHeight = unwrap(tupleCV.data['until-burn-ht']);
const untilBurnBlockHeight = unwrap(tupleCV.value['until-burn-ht']);
return {

@@ -635,3 +635,3 @@ delegated: true,

amount_micro_stx: BigInt(amountMicroStx.value),
delegated_to: principalToString(delegatedTo),
delegated_to: delegatedTo.value,
pox_address: poxAddress,

@@ -667,3 +667,3 @@ until_burn_ht: untilBurnBlockHeight ? Number(untilBurnBlockHeight.value) : undefined,

];
return callReadOnlyFunction({
return fetchCallReadOnlyFunction({
contractAddress,

@@ -692,3 +692,3 @@ contractName,

const fee = getFee(tx.auth);
tx.payload.functionArgs[0] = uintCV(intToBigInt(amountMicroStx, false) - fee);
tx.payload.functionArgs[0] = uintCV(intToBigInt(amountMicroStx) - fee);
return tx;

@@ -695,0 +695,0 @@ }

import { sha256 } from '@noble/hashes/sha256';
import { bech32, bech32m } from '@scure/base';
import { bigIntToBytes } from '@stacks/common';
import { bigIntToBytes, hexToBytes } from '@stacks/common';
import { base58CheckDecode, base58CheckEncode, verifyMessageSignatureRsv, } from '@stacks/encryption';

@@ -96,10 +96,10 @@ import { StacksNetworks, networkFrom } from '@stacks/network';

const clarityValue = poxAddrClarityValue;
if (clarityValue.type !== ClarityType.Tuple || !clarityValue.data) {
if (clarityValue.type !== ClarityType.Tuple || !clarityValue.value) {
throw new Error('Invalid argument, expected ClarityValue to be a TupleCV');
}
if (!('version' in clarityValue.data) || !('hashbytes' in clarityValue.data)) {
if (!('version' in clarityValue.value) || !('hashbytes' in clarityValue.value)) {
throw new Error('Invalid argument, expected Clarity tuple value to contain `version` and `hashbytes` keys');
}
const versionCV = clarityValue.data['version'];
const hashBytesCV = clarityValue.data['hashbytes'];
const versionCV = clarityValue.value['version'];
const hashBytesCV = clarityValue.value['hashbytes'];
if (versionCV.type !== ClarityType.Buffer || hashBytesCV.type !== ClarityType.Buffer) {

@@ -109,4 +109,4 @@ throw new Error('Invalid argument, expected Clarity tuple value to contain `version` and `hashbytes` buffers');

return {
version: versionCV.buffer[0],
hashBytes: hashBytesCV.buffer,
version: hexToBytes(versionCV.value)[0],
hashBytes: hexToBytes(hashBytesCV.value),
};

@@ -276,3 +276,3 @@ }

privateKey,
}).data;
});
}

@@ -279,0 +279,0 @@ export function verifyPox4SignatureHash({ topic, poxAddress, rewardCycle, period, network, publicKey, signature, maxAmount, authId, }) {

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

const [contractAddress, contractName] = this.parseContractId(options?.contractId);
const result = await (0, transactions_1.callReadOnlyFunction)({
const result = await (0, transactions_1.fetchCallReadOnlyFunction)({
api: this.api,

@@ -83,6 +83,6 @@ senderAddress: this.address,

pox_address: {
version: tuple.data['pox-addr'].data['version'].buffer,
hashbytes: tuple.data['pox-addr'].data['hashbytes'].buffer,
version: (0, common_1.hexToBytes)(tuple.value['pox-addr'].value['version'].value),
hashbytes: (0, common_1.hexToBytes)(tuple.value['pox-addr'].value['hashbytes'].value),
},
total_ustx: tuple.data['total-ustx'].value,
total_ustx: BigInt(tuple.value['total-ustx'].value),
}));

@@ -126,3 +126,3 @@ }

const [contractAddress, contractName] = this.parseContractId(poxInfo.contract_id);
return (0, transactions_1.callReadOnlyFunction)({
return (0, transactions_1.fetchCallReadOnlyFunction)({
api: this.api,

@@ -583,3 +583,3 @@ contractName,

const functionName = 'get-stacker-info';
return (0, transactions_1.callReadOnlyFunction)({
return (0, transactions_1.fetchCallReadOnlyFunction)({
contractAddress,

@@ -595,7 +595,7 @@ contractName,

const tupleCV = someCV.value;
const poxAddress = tupleCV.data['pox-addr'];
const firstRewardCycle = tupleCV.data['first-reward-cycle'];
const lockPeriod = tupleCV.data['lock-period'];
const version = poxAddress.data['version'];
const hashbytes = poxAddress.data['hashbytes'];
const poxAddress = tupleCV.value['pox-addr'];
const firstRewardCycle = tupleCV.value['first-reward-cycle'];
const lockPeriod = tupleCV.value['lock-period'];
const version = poxAddress.value['version'];
const hashbytes = poxAddress.value['hashbytes'];
return {

@@ -608,4 +608,4 @@ stacked: true,

pox_address: {
version: version.buffer,
hashbytes: hashbytes.buffer,
version: (0, common_1.hexToBytes)(version.value),
hashbytes: (0, common_1.hexToBytes)(hashbytes.value),
},

@@ -629,3 +629,3 @@ },

const functionName = 'get-delegation-info';
return (0, transactions_1.callReadOnlyFunction)({
return (0, transactions_1.fetchCallReadOnlyFunction)({
contractAddress,

@@ -640,9 +640,9 @@ contractName,

const tupleCV = responseCV.value;
const amountMicroStx = tupleCV.data['amount-ustx'];
const delegatedTo = tupleCV.data['delegated-to'];
const poxAddress = (0, utils_1.unwrapMap)(tupleCV.data['pox-addr'], tuple => ({
version: tuple.data['version'].buffer[0],
hashbytes: tuple.data['hashbytes'].buffer,
const amountMicroStx = tupleCV.value['amount-ustx'];
const delegatedTo = tupleCV.value['delegated-to'];
const poxAddress = (0, utils_1.unwrapMap)(tupleCV.value['pox-addr'], tuple => ({
version: (0, common_1.hexToBytes)(tuple.value['version'].value)[0],
hashbytes: (0, common_1.hexToBytes)(tuple.value['hashbytes'].value),
}));
const untilBurnBlockHeight = (0, utils_1.unwrap)(tupleCV.data['until-burn-ht']);
const untilBurnBlockHeight = (0, utils_1.unwrap)(tupleCV.value['until-burn-ht']);
return {

@@ -652,3 +652,3 @@ delegated: true,

amount_micro_stx: BigInt(amountMicroStx.value),
delegated_to: (0, transactions_1.principalToString)(delegatedTo),
delegated_to: delegatedTo.value,
pox_address: poxAddress,

@@ -684,3 +684,3 @@ until_burn_ht: untilBurnBlockHeight ? Number(untilBurnBlockHeight.value) : undefined,

];
return (0, transactions_1.callReadOnlyFunction)({
return (0, transactions_1.fetchCallReadOnlyFunction)({
contractAddress,

@@ -709,3 +709,3 @@ contractName,

const fee = (0, transactions_1.getFee)(tx.auth);
tx.payload.functionArgs[0] = (0, transactions_1.uintCV)((0, common_1.intToBigInt)(amountMicroStx, false) - fee);
tx.payload.functionArgs[0] = (0, transactions_1.uintCV)((0, common_1.intToBigInt)(amountMicroStx) - fee);
return tx;

@@ -712,0 +712,0 @@ }

@@ -102,10 +102,10 @@ "use strict";

const clarityValue = poxAddrClarityValue;
if (clarityValue.type !== transactions_1.ClarityType.Tuple || !clarityValue.data) {
if (clarityValue.type !== transactions_1.ClarityType.Tuple || !clarityValue.value) {
throw new Error('Invalid argument, expected ClarityValue to be a TupleCV');
}
if (!('version' in clarityValue.data) || !('hashbytes' in clarityValue.data)) {
if (!('version' in clarityValue.value) || !('hashbytes' in clarityValue.value)) {
throw new Error('Invalid argument, expected Clarity tuple value to contain `version` and `hashbytes` keys');
}
const versionCV = clarityValue.data['version'];
const hashBytesCV = clarityValue.data['hashbytes'];
const versionCV = clarityValue.value['version'];
const hashBytesCV = clarityValue.value['hashbytes'];
if (versionCV.type !== transactions_1.ClarityType.Buffer || hashBytesCV.type !== transactions_1.ClarityType.Buffer) {

@@ -115,4 +115,4 @@ throw new Error('Invalid argument, expected Clarity tuple value to contain `version` and `hashbytes` buffers');

return {
version: versionCV.buffer[0],
hashBytes: hashBytesCV.buffer,
version: (0, common_1.hexToBytes)(versionCV.value)[0],
hashBytes: (0, common_1.hexToBytes)(hashBytesCV.value),
};

@@ -291,3 +291,3 @@ }

privateKey,
}).data;
});
}

@@ -294,0 +294,0 @@ exports.signPox4SignatureHash = signPox4SignatureHash;

{
"name": "@stacks/stacking",
"version": "6.14.1-pr.44+08a1cf37",
"version": "6.14.1-pr.64+bbe6c9a4",
"description": "Library for Stacking.",

@@ -25,8 +25,8 @@ "license": "MIT",

"@scure/base": "1.1.1",
"@stacks/api": "^6.14.1-pr.44+08a1cf37",
"@stacks/common": "^6.14.1-pr.44+08a1cf37",
"@stacks/encryption": "^6.14.1-pr.44+08a1cf37",
"@stacks/network": "^6.14.1-pr.44+08a1cf37",
"@stacks/api": "^6.14.1-pr.64+bbe6c9a4",
"@stacks/common": "^6.14.1-pr.64+bbe6c9a4",
"@stacks/encryption": "^6.14.1-pr.64+bbe6c9a4",
"@stacks/network": "^6.14.1-pr.64+bbe6c9a4",
"@stacks/stacks-blockchain-api-types": "^0.61.0",
"@stacks/transactions": "^6.14.1-pr.44+08a1cf37",
"@stacks/transactions": "^6.14.1-pr.64+bbe6c9a4",
"bs58": "^5.0.0"

@@ -36,2 +36,3 @@ },

"@stacks/blockchain-api-client": "^7.3.0",
"@stacks/internal": "^undefined",
"jest-fetch-mock": "^3.0.3",

@@ -63,3 +64,3 @@ "process": "^0.11.10",

},
"gitHead": "08a1cf370cc436ac37b859da38786a30646defe1"
"gitHead": "bbe6c9a41ac22d4d98a997634b964408357fa1de"
}

@@ -37,4 +37,4 @@ import {

bufferCV,
callReadOnlyFunction,
cvToString,
fetchCallReadOnlyFunction,
getFee,

@@ -44,3 +44,2 @@ makeContractCall,

principalCV,
principalToString,
someCV,

@@ -428,3 +427,3 @@ stringAsciiCV,

const [contractAddress, contractName] = this.parseContractId(options?.contractId);
const result = await callReadOnlyFunction({
const result = await fetchCallReadOnlyFunction({
api: this.api,

@@ -440,6 +439,10 @@ senderAddress: this.address,

pox_address: {
version: ((tuple.data['pox-addr'] as TupleCV).data['version'] as BufferCV).buffer,
hashbytes: ((tuple.data['pox-addr'] as TupleCV).data['hashbytes'] as BufferCV).buffer,
version: hexToBytes(
((tuple.value['pox-addr'] as TupleCV).value['version'] as BufferCV).value
),
hashbytes: hexToBytes(
((tuple.value['pox-addr'] as TupleCV).value['hashbytes'] as BufferCV).value
),
},
total_ustx: (tuple.data['total-ustx'] as UIntCV).value,
total_ustx: BigInt((tuple.value['total-ustx'] as UIntCV).value),
}));

@@ -537,3 +540,3 @@ }

return callReadOnlyFunction({
return fetchCallReadOnlyFunction({
api: this.api,

@@ -1385,3 +1388,3 @@ contractName,

return callReadOnlyFunction({
return fetchCallReadOnlyFunction({
contractAddress,

@@ -1397,7 +1400,7 @@ contractName,

const tupleCV: TupleCV = someCV.value as TupleCV;
const poxAddress: TupleCV = tupleCV.data['pox-addr'] as TupleCV;
const firstRewardCycle: UIntCV = tupleCV.data['first-reward-cycle'] as UIntCV;
const lockPeriod: UIntCV = tupleCV.data['lock-period'] as UIntCV;
const version: BufferCV = poxAddress.data['version'] as BufferCV;
const hashbytes: BufferCV = poxAddress.data['hashbytes'] as BufferCV;
const poxAddress: TupleCV = tupleCV.value['pox-addr'] as TupleCV;
const firstRewardCycle: UIntCV = tupleCV.value['first-reward-cycle'] as UIntCV;
const lockPeriod: UIntCV = tupleCV.value['lock-period'] as UIntCV;
const version: BufferCV = poxAddress.value['version'] as BufferCV;
const hashbytes: BufferCV = poxAddress.value['hashbytes'] as BufferCV;

@@ -1411,4 +1414,4 @@ return {

pox_address: {
version: version.buffer,
hashbytes: hashbytes.buffer,
version: hexToBytes(version.value),
hashbytes: hexToBytes(hashbytes.value),
},

@@ -1437,3 +1440,3 @@ },

return callReadOnlyFunction({
return fetchCallReadOnlyFunction({
contractAddress,

@@ -1448,10 +1451,10 @@ contractName,

const tupleCV = responseCV.value as TupleCV;
const amountMicroStx = tupleCV.data['amount-ustx'] as UIntCV;
const delegatedTo = tupleCV.data['delegated-to'] as PrincipalCV;
const amountMicroStx = tupleCV.value['amount-ustx'] as UIntCV;
const delegatedTo = tupleCV.value['delegated-to'] as PrincipalCV;
const poxAddress = unwrapMap(tupleCV.data['pox-addr'] as OptionalCV<TupleCV>, tuple => ({
version: (tuple.data['version'] as BufferCV).buffer[0],
hashbytes: (tuple.data['hashbytes'] as BufferCV).buffer,
const poxAddress = unwrapMap(tupleCV.value['pox-addr'] as OptionalCV<TupleCV>, tuple => ({
version: hexToBytes((tuple.value['version'] as BufferCV).value)[0],
hashbytes: hexToBytes((tuple.value['hashbytes'] as BufferCV).value),
}));
const untilBurnBlockHeight = unwrap(tupleCV.data['until-burn-ht'] as OptionalCV<UIntCV>);
const untilBurnBlockHeight = unwrap(tupleCV.value['until-burn-ht'] as OptionalCV<UIntCV>);

@@ -1462,3 +1465,3 @@ return {

amount_micro_stx: BigInt(amountMicroStx.value),
delegated_to: principalToString(delegatedTo),
delegated_to: delegatedTo.value,
pox_address: poxAddress,

@@ -1520,3 +1523,3 @@ until_burn_ht: untilBurnBlockHeight ? Number(untilBurnBlockHeight.value) : undefined,

return callReadOnlyFunction({
return fetchCallReadOnlyFunction({
contractAddress,

@@ -1556,5 +1559,3 @@ contractName,

const fee = getFee(tx.auth);
(tx.payload as ContractCallPayload).functionArgs[0] = uintCV(
intToBigInt(amountMicroStx, false) - fee
);
(tx.payload as ContractCallPayload).functionArgs[0] = uintCV(intToBigInt(amountMicroStx) - fee);
return tx;

@@ -1561,0 +1562,0 @@ }

import { sha256 } from '@noble/hashes/sha256';
import { bech32, bech32m } from '@scure/base';
import { IntegerType, PrivateKey, bigIntToBytes } from '@stacks/common';
import { IntegerType, PrivateKey, bigIntToBytes, hexToBytes } from '@stacks/common';
import {

@@ -145,8 +145,11 @@ base58CheckDecode,

export function extractPoxAddressFromClarityValue(poxAddrClarityValue: ClarityValue) {
export function extractPoxAddressFromClarityValue(poxAddrClarityValue: ClarityValue): {
version: number;
hashBytes: Uint8Array;
} {
const clarityValue = poxAddrClarityValue as TupleCV;
if (clarityValue.type !== ClarityType.Tuple || !clarityValue.data) {
if (clarityValue.type !== ClarityType.Tuple || !clarityValue.value) {
throw new Error('Invalid argument, expected ClarityValue to be a TupleCV');
}
if (!('version' in clarityValue.data) || !('hashbytes' in clarityValue.data)) {
if (!('version' in clarityValue.value) || !('hashbytes' in clarityValue.value)) {
throw new Error(

@@ -156,4 +159,4 @@ 'Invalid argument, expected Clarity tuple value to contain `version` and `hashbytes` keys'

}
const versionCV = clarityValue.data['version'] as BufferCV;
const hashBytesCV = clarityValue.data['hashbytes'] as BufferCV;
const versionCV = clarityValue.value['version'] as BufferCV;
const hashBytesCV = clarityValue.value['hashbytes'] as BufferCV;
if (versionCV.type !== ClarityType.Buffer || hashBytesCV.type !== ClarityType.Buffer) {

@@ -165,4 +168,4 @@ throw new Error(

return {
version: versionCV.buffer[0],
hashBytes: hashBytesCV.buffer,
version: hexToBytes(versionCV.value)[0],
hashBytes: hexToBytes(hashBytesCV.value),
};

@@ -441,3 +444,3 @@ }

privateKey,
}).data;
});
}

@@ -444,0 +447,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 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