You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fetch may not always be available, for example if run in a hardened compartment.
Mocking in tests
To test code with a fake RpcClient requires hacking into the module loader to intercept Axios.
Possible solution
You could move to just using Fetch API but that would still be an ambient authority.
Better would be an option for the createRPCQueryClient helper (or whatever it be called) to take an RpcClient instead of an endpoint. Then consumers can make their own RpcClient using whatever authorities are available, including a test mock.
Inside the function you can create the Tendermint client from the RpcClient argument,
Problem
The
rpc.query.ts
that Telescope generates is like,Such a construction depends on ambient authority of
Tendermint34Client.connect
.This causes a couple problems:
Prototype lockdown
The module with
connect
importsaxios
and that fails to load in Hardened JS:Ambient authority
fetch
may not always be available, for example if run in a hardened compartment.Mocking in tests
To test code with a fake RpcClient requires hacking into the module loader to intercept Axios.
Possible solution
You could move to just using Fetch API but that would still be an ambient authority.
Better would be an option for the
createRPCQueryClient
helper (or whatever it be called) to take anRpcClient
instead of an endpoint. Then consumers can make their own RpcClient using whatever authorities are available, including a test mock.Inside the function you can create the Tendermint client from the RpcClient argument,
The text was updated successfully, but these errors were encountered: