planetarium / lib9c-wasm

The experimental project to port Lib9c into JavaScript environment through WASM. Build your Nine Chronicles network transaction in your local at once.
https://planetarium.github.io/lib9c-wasm/
GNU General Public License v3.0
5 stars 2 forks source link

Refactor how to provide actions' arguments #32

Open moreal opened 1 year ago

moreal commented 1 year ago

Now

Currently, it provides actions' arguments by inlining all types. It means there is no reuse of any type. For example:

export function update_sell5(plainValue: {sellerAvatarAddress: Address;updateSellInfos: {orderId: Guid;updateSellOrderId: Guid;tradableId: Guid;itemSubType: "Food" | "FullCostume" | "HairCostume" | "EarCostume" | "EyeCostume" | "TailCostume" | "Weapon" | "Armor" | "Belt" | "Necklace" | "Ring" | "EquipmentMaterial" | "FoodMaterial" | "MonsterPart" | "NormalMaterial" | "Hourglass" | "ApStone" | "Chest" | "Title";price: {currency: Currency;sign: number;majorUnit: string;minorUnit: string;};count: number;}[];}): Uint8Array {

Enums and types can be reused but it didn't.

Plan