near-runtime-ts
near-runtime-ts copied to clipboard
Make storage a namespace to prevent allocation
storage class had no internal state so allocation wasted space and gas.
Also added assemblyscript types reference in types file.
@willemneal the allocation of one object doesn't really add any meaningful overhead.
I'd prefer we keep this as class as it's then easier to switch to a model where you can inject any Storage object (including fake one for tests), though it requires abstract methods support landing in AS.
I think that the best way to mock the storage is at the API level. And while it is minimal overhead, it's still extra gas for every contract that uses this.