Reduce the use of ByteArray and ByteView.
Opened this issue · 0 comments
tequdev commented
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
- best
const memos = Tx.Memos
const memo_wrapper = memos[0]
const memo_object = memo_wrapper[ObjectField.Memo]
const data_lookup = memo_object[MemoField.MemoData]
- better(Personally, I prefer the experience if I don't have to know
SerializedObjectView
and can guess it from the editor's completion.)
const memos = Tx.Memos
let memos_array = memos.toSerializedArray()
const memo_wrapper = memos_array[i].toSerializedObject<ObjectField>()
const memo_object = memo_wrapper[ObjectField.Memo].toSerializedObject<MemoField>()
const data_lookup = memo_object[MemoField.MemoData]
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")