The Polywrap Client accepts a
ClientConfig argument at construction.
The default configuration can be modified to redirect URIs, use different plugins, register interface implementations,
set environmental variables, and customize URI resolution.
redirects property can be used to redirect queries from one URI to another.
This redirection occurs in all queries to the URI, even in cases where one wrapper calls another during its execution.
Polywrap plugin wrappers are written in a Client’s native language. They offer a user experience similar to that of wrappers, but with different benefits.
Plugins are declared and constructed in the Client config by providing an array of
PluginRegistration contains the URI at which the plugin will be queried and a
PluginPackage is a factory function the
PolywrapClient uses to create new
instances of the plugin.
Each plugin can have its own configuration.
Users can declare custom implementations for an interface by providing the interface URI and one or more URIs that resolve to implementations.
Because wrapper calls are sandboxed and stateless, they cannot access the global state that persists outside the call. Users can instead provide wrapper-specific environmental variables in the Client configuration. Wrapper developers are expected to inform users which environmental variables should be set for their API.
Users can extend the Client's URI resolution capabilities by providing new implementations of
UriResolver takes a URI as input and resolves it to a wrapper or plugin.
By default, the Client includes an ExtendableUriResolver that can accept ENS, IPFS, and filesystem URIs as input and fetch wrappers from those sources.
It is "extendable" in the sense that it works with any plugin or wrapper that implements the
The Client's default resolvers can also resolve URI's that point to redirects, plugins, and cached wrappers.
The current default
PolywrapClient can be viewed on Github.
When a user provides a
ClientConfig to the Client, the default configuration is still applied.
The default configuration is modified by the user's configuration.
The Client's configuration is sanitized when the Client is constructed.
During the sanitization process, URI strings are validated and transformed into instances of the