Skip to content

Commit

Permalink
refactor!: Update Cl.serialize to return string instead of bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
janniks committed Oct 23, 2024
1 parent 912069b commit aa69c1c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/transactions/src/cl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
noneCV,
responseErrorCV,
responseOkCV,
serializeCV,
serializeCVBytes,
someCV,
standardPrincipalCV,
Expand Down Expand Up @@ -270,15 +271,15 @@ export const tuple = tupleCV;
/**
* `Cl.serialize` — Serializes a Clarity JS object to the equivalent hex-encoded representation
*
* Alias for {@link serializeCVBytes}
* Alias for {@link serializeCV}
* @example
* ```
* import { Cl } from '@stacks/transactions';
* Cl.serialize(Cl.uint(100));
* ```
* @see {@link deserialize}
*/
export const serialize = serializeCVBytes;
export const serialize = serializeCV;
/**
* `Cl.deserialize` — Deserializes a hex string to the equivalent Clarity JS object
*
Expand Down
1 change: 1 addition & 0 deletions packages/transactions/src/clarity/serialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ function serializeStringUtf8CV(cv: StringUtf8CV) {
export function serializeCV(value: ClarityValue): string {
return bytesToHex(serializeCVBytes(value));
}

/** @ignore */
export function serializeCVBytes(value: ClarityValue): Uint8Array {
switch (value.type) {
Expand Down

0 comments on commit aa69c1c

Please sign in to comment.