Skip to content

Commit

Permalink
Merge pull request #181 from secretkeylabs/fix/post-condition-deny-me…
Browse files Browse the repository at this point in the history
…ssage

fix: check for post condition deny message
  • Loading branch information
abdulhaseeb4239 authored Sep 6, 2024
2 parents 03058fe + b4f5533 commit 433d3d9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions transactions/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ import {
NonFungibleConditionCode,
PostCondition,
PostConditionType,
setNonce,
StacksMessageType,
StacksTransaction,
setNonce,
} from '@stacks/transactions';
import BigNumber from 'bignumber.js';
import { fetchStxPendingTxData, getContractInterface, getXverseApiClient } from '../api';
import { btcToSats, getBtcFiatEquivalent, getStxFiatEquivalent, stxToMicrostacks } from '../currency';
import { Coin, FeesMultipliers, FungibleToken, PostConditionsOptions, StxMempoolTransactionData } from '../types';
import { generateContractDeployTransaction, generateUnsignedContractCall, getNonce } from './stx';
import { Coin, FeesMultipliers, PostConditionsOptions, StxMempoolTransactionData } from '../types';
import { FungibleToken } from '../types';

export function getNewNonce(pendingTransactions: StxMempoolTransactionData[], currentNonce: bigint): bigint {
if ((pendingTransactions ?? []).length === 0) {
Expand Down Expand Up @@ -169,7 +168,7 @@ export const createContractCallPromises = async (

const unSignedContractCall = await generateUnsignedContractCall(tx);

const checkForPostConditionMessage = payload?.postConditionMode === 2 && payload?.postConditions?.values.length <= 0;
const checkForPostConditionMessage = payload?.postConditionMode === 2 && payload?.postConditions?.length <= 0;
const showPostConditionMessage = !!checkForPostConditionMessage;

const newNonce = getNewNonce(pendingTransactions, getNonce(unSignedContractCall));
Expand Down

0 comments on commit 433d3d9

Please sign in to comment.