For the complete documentation index, see llms.txt. This page is also available as Markdown.

postConditionToHex

Converts a post condition object to a hex-encoded string.


Usage

import { postConditionToHex } from '@stacks/transactions';

const hex = postConditionToHex({
  type: 'stx-postcondition',
  address: 'SP000000000000000000002Q6VF78',
  condition: 'eq',
  amount: '1000000000000000000',
});

Notes

  • The inverse of Pc.fromHex.

  • Useful for serializing post conditions for storage or transmission.

Reference Link

StakingPostCondition and PoxPostCondition were added for Stacks epoch 4.0 and are available in @stacks/transactions 7.5.0 and later.


Signature


Returns

string

The wire-format serialization: the same bytes the post condition occupies inside a signed transaction.


Parameters

postcondition (required)

The post condition object to serialize.

Last updated

Was this helpful?