LiskArchive / lisk-elements

⚙️ Library for sending Lisk transactions from the client or server
https://lisk.io/
GNU General Public License v3.0
250 stars 64 forks source link

Remove processRequiredState from transaction #1051

Closed shuse2 closed 5 years ago

shuse2 commented 5 years ago

Description

In order to make custom transaction processing more easy, processRequiredState and getRequiredAttribute will be removed. Instead, abstract async prepareTransaction(store: StateStorePrepare) will be introduced.

where StateStore is implemented in the framework with the interface

interface StateStoreFunction<T> {
   cache<T>([key: string]: value: string | number): ReadonlyArray<T>;
   get(key: string): T;
   find((item: T) => boolean): T | undefined;
   set(key: string, value: T): void
}

and apply/undo will have interface

apply(store: StateStore): TransactionResponse;
undo(store: StateStore): TransactionResponse;