XRPL-Labs / XRPL-HookScript-Ideas

PR HookScript ideas.
3 stars 0 forks source link

Reduce the use of ByteArray and ByteView. #9

Open tequdev opened 1 year ago

tequdev commented 1 year ago

I think the developer experience would be greatly improved if we no longer have to be aware of ByteArray and ByteView.

from

const memos = Tx.Memos
let memos_array = SerializedArrayView.fromByteArray(memos)
const memo_wrapper = new SerializedObjectView<ObjectField>(memos_array[i])
const memo_object = new SerializedObjectView<MemoField>(memo_wrapper[ObjectField.Memo])
const data_lookup = memo_object[MemoField.MemoData]

to


I know there is a size issue, but it would be nice if state_set could be called directly without converting to a ByteArray.

state_set("some-key", "some-value")