Function: httpRequestorFromAxios()
GalaChain core SDK 1.0.0-rc.8 / index / httpRequestorFromAxios
Function: httpRequestorFromAxios()
httpRequestorFromAxios(
instance,options):HttpRequestor
Defined in: packages/gala-core-sdk/dist/index.d.ts:1958
An SDK HttpRequestor over an axios instance, so the SDK's requests travel through the app's own base URL, interceptors and error handling.
A POST's string body is parsed back to the object the SDK serialized it from (axios serializes
again, and an interceptor may read the object); a GET goes through instance.get. The answer
is an HTTP response whose json()/text() read response.data. An answer that is not an
axios response is a TRANSPORT_ERROR rejection, and so is a rejection that means no HTTP
answer arrived (the original error is cause): any rejection with rejectOnHttpError: false
(every status resolves there), an axios error without a response with true. Any other
rejection (an interceptor's error for a 4xx, say) is rethrown unchanged, and so is an abort.
Pair it with ChainGateway's dexBackendBaseUrl: '' when the instance owns the base URL.
Parameters
instance
options
Returns
Example
const submitGateway = new ChainGateway({
dexBackendBaseUrl: '',
httpRequestor: httpRequestorFromAxios(chainGatewayInstance, { rejectOnHttpError: true }),
});