Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 21x 21x 21x 39x 6x 6x 8x 4x 5x 4x 5x 10x 6x 8x 63x 5x 5x | import { ClarityType } from '../common/constants'; import { asciiToBytes, utf8ToBytes } from 'micro-stacks/common'; import { ClarityValue } from './types'; export function getCVTypeString(val: ClarityValue): string { switch (val.type) { case ClarityType.BoolTrue: case ClarityType.BoolFalse: return 'bool'; case ClarityType.Int: return 'int'; case ClarityType.UInt: return 'uint'; case ClarityType.Buffer: return `(buff ${val.buffer.length})`; case ClarityType.OptionalNone: return '(optional none)'; case ClarityType.OptionalSome: return `(optional ${getCVTypeString(val.value)})`; case ClarityType.ResponseErr: return `(response UnknownType ${getCVTypeString(val.value)})`; case ClarityType.ResponseOk: return `(response ${getCVTypeString(val.value)} UnknownType)`; case ClarityType.PrincipalStandard: case ClarityType.PrincipalContract: return 'principal'; case ClarityType.List: return `(list ${val.list.length} ${ val.list.length ? getCVTypeString(val.list[0]) : 'UnknownType' })`; case ClarityType.Tuple: return `(tuple ${Object.keys(val.data) .map(key => `(${key} ${getCVTypeString(val.data[key])})`) .join(' ')})`; case ClarityType.StringASCII: return `(string-ascii ${asciiToBytes(val.data).length})`; case ClarityType.StringUTF8: return `(string-utf8 ${utf8ToBytes(val.data).length})`; } } |