Skip to main content
Version: Next

Function: byteArrayFromString()

byteArrayFromString(targetString): ByteArray

Defined in: src/utils/calldata/byteArray.ts:48

convert a JS string to a Cairo ByteArray

Parameters

targetString

string

a JS string

Returns

ByteArray

Cairo representation of a LongString

Example

const myByteArray: ByteArray = byteArrayFromString("ABCDEFGHI");

Result is : { data: [], pending_word: '0x414243444546474849', pending_word_len: 9 }