Custom Transport
The custom Transport accepts an request function as a parameter, This transport is useful for integrating with injected wallets. or even providing your own custom request function.
Import
import { } from "cive";Usage
import { , } from "cive";
import { } from "cive/chains";
const = ({
: ,
: (.!),
});Or you can define your own:
import { , } from "cive";
import { } from "cive/chains";
const = ({
: ,
: ({
async ({ , }) {
const = await ("https:/...");
return ;
},
}),
});Parameters
provider
- Type:
custom
import { , } from "cive";
import { } from "cive/chains";
const = ({
: ,
: ({
async ({ , }) {
const = await ("https:/...");
return ;
},
}),
});key (optional)
- Type:
string - Default:
"custom"
A key for the Transport.
const = (.!, {
: "windowProvider",
});name (optional)
- Type:
string - Default:
"Provider"
A name for the Transport
const = (.!, {
: "Window Provider",
});retryCount (optional)
- Type:
number - Default:
3
The max number of times to retry when a request fails.
const = (.!, {
: 5,
});retryDelay (optional)
- Type:
number - Default:
150
The base delay (in ms) between retries. By default, the Transport will use exponential backoff (~~(1 << count) * retryDelay), which means the time between retries is not constant.
const = (.!, {
: 100,
});Gotchas
- If you are pairing the
customTransport with a Public Client, ensure that your provider supports Public Actions.