telosnetwork / open-block-explorer

The Open Block Explorer (OBE) is the first open source block explorer that is designed to support all AntelopeIO-based blockchains.
https://explorer.telos.net
Apache License 2.0
27 stars 24 forks source link

Implement ABI caching on msig page #532

Open aaroncox opened 1 year ago

aaroncox commented 1 year ago

Noticed on: https://explorer.telos.net/proposal/ibcaccounts

The msig page needs an ABI cache put in place, so it doesn't need to load the same ABI over and over again on the client.

Load it the first time, then use the cached version for each subsequent request by the client.

image
aaroncox commented 1 year ago

This line specifically:

https://github.com/telosnetwork/open-block-explorer/blob/4f53e087d9253e191f5daca46c288262015cee47/src/api/eosio_core.ts#L54

As an example, a cache can be setup by defining two maps in the script (outside of the scope of the function):

https://github.com/greymass/anchor-link/blob/a96c19ec007ac3571febefd90fdc5838983e5779/src/link.ts#L135-L136

and wrapping the get_abi call in a function that looks in the cache:

https://github.com/greymass/anchor-link/blob/a96c19ec007ac3571febefd90fdc5838983e5779/src/link.ts#L149-L166