Browse Source

add cvToHex instructions

fix/bump-version-redirects
Reed Rosenbluth 4 years ago
parent
commit
8fc0a3b57d
  1. 10
      src/pages/smart-contracts/clarity-values.md

10
src/pages/smart-contracts/clarity-values.md

@ -257,7 +257,7 @@ if (result.type === ClarityType.ResponseOk) {
### Deserializing Clarity Values from Hex
If you receive a response from a transaction in the form of a Hex string, you can deserialize it into a Clarity value like so:
If you receive a response from a transaction in the form of a `hex` string, you can deserialize it into a Clarity value like so:
```javascript
import { hexToCV } from '@stacks/transactions';
@ -265,6 +265,14 @@ import { hexToCV } from '@stacks/transactions';
let cv = hexToCV('hex_string');
```
Similarly, you can convert a Clarity value to `hex` string like so:
```javascript
import { cvToHex, trueCV } from '@stacks/transactions';
let trueHex = cvToHex(trueCV());
```
## Debugging Clarity Values
Sometimes you might receive a Clarity value that you were not expecting. Logging the value to your console won't always prove to be useful, unless you have memorized the Clarity value type enum values.

Loading…
Cancel
Save