Request API
Stacks
Representations

Stacks methods may include "post-conditions" or "clarity values". You can find definitions on how to construct them in JSON below.

Post-conditions

STX

{
  type: 'stx-postcondition',
  address: string | `${string}.${string}`, // Stacks c32-encoded, with optional contract name suffix
  condition: 'eq' | 'gt' | 'gte' | 'lt' | 'lte',
  amount: string // `bigint` compatible, amount in micro-STX
}

Fungible token

{
  type: 'ft-postcondition',
  address: string | `${string}.${string}`, // Stacks c32-encoded, with optional contract name suffix
  condition: 'eq' | 'gt' | 'gte' | 'lt' | 'lte',
  asset: `${string}.${string}::${string}`, // Stacks c32-encoded address, with contract name suffix, with asset suffix
  amount: string // `bigint` compatible, amount in lowest integer denomination of fungible token
}

Non-fungible token

{
  type: 'nft-postcondition',
  address: string | `${string}.${string}`, // Stacks c32-encoded, with optional contract name suffix
  condition: 'sent' | 'not-sent',
  asset: `${string}.${string}::${string}`, // address with contract name suffix with asset suffix, Stacks c32-encoded
  assetId: object, // Clarity value
}

Clarity values

Comment: For encoding larger than JS Number big integers, string is used. Values should be parseable by the JavaScript BigInt constructor.

int

{
  type: 'int',
  value: number | string // `bigint` compatible
}

uint

{
  type: 'uint',
  value: number | string // `bigint` compatible
}

buffer

{
  type: 'buffer',
  value: string // hex-encoded string
}

bool true

{
  type: 'true',
}

bool false

{
  type: 'false',
}

address

(aka "standard principal")

{
  type: 'address',
  value: string // Stacks c32-encoded
}

contract

(aka "contract principal")

{
  type: 'contract',
  value: `${string}.${string}` // Stacks c32-encoded, with contract name suffix
}

ok

(aka "response ok")

{
  type: 'ok',
  value: object // Clarity value
}

err

(aka "response err")

{
  type: 'err',
  value: object // Clarity value
}

none

(aka "optional none")

{
  type: 'none',
}

some

(aka "optional some")

{
  type: 'some',
  value: object // Clarity value
}

list

{
  type: 'list',
  value: object[] // Array of Clarity values
}

tuple

{
  type: 'tuple',
  value: Record<string, object> // Record of Clarity values
}

ascii

{
  type: 'ascii',
  value: string // ASCII-compatible string
}

utf8

{
  type: 'utf8',
  value: string
}

References