• Converts a Uint8Array to a BufferCV clarity type

    Parameters

    • buffer: Uint8Array

      value to be converted to clarity type

    Returns BufferCV

    returns instance of type BufferCV

    Example

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

    const buffer = utf8ToBytes('this is a test');
    const buf = bufferCV(buffer);
    // { type: 'buffer', buffer: <Uint8Array 74 68 69 73 20 69 73 20 61 20 74 65 73 74> }
    const value = bytesToUtf8(buf.buffer);
    // this is a test

    See

    clarity test cases for more examples

Generated using TypeDoc