Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow null for eventHandlerUrl param #186

Merged
merged 1 commit into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/ain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ export default class Ain {
/**
* Creates a new Ain object.
* @param {string} providerUrl The endpoint URL of the network provider.
* @param {string} eventHandlerUrl The endpoint URL of the event handler websocket server.
* @param {string | null} eventHandlerUrl The endpoint URL of the event handler websocket server.
* @param {number} chainId The chain ID of the blockchain network.
* @param {AinOptions} ainOptions The options of the class.
*/
constructor(providerUrl: string, eventHandlerUrl?: string, chainId?: number, ainOptions?: AinOptions) {
constructor(providerUrl: string, eventHandlerUrl?: string | null, chainId?: number, ainOptions?: AinOptions) {
this.axiosConfig = ainOptions?.axiosConfig;
this.provider = new Provider(this, providerUrl, this.axiosConfig);
this.eventHandlerUrl = eventHandlerUrl;
Expand All @@ -66,11 +66,11 @@ export default class Ain {
/**
* Sets a new provider.
* @param {string} providerUrl The endpoint URL of the network provider. e.g. http://localhost:8081, https://testnet-api.ainetwork.ai
* @param {string} eventHandlerUrl The endpoint URL of the event handler websocket server. e.g. ws://localhost:5100, wss://testnet-event.ainetwork.ai
* @param {string | null} eventHandlerUrl The endpoint URL of the event handler websocket server. e.g. ws://localhost:5100, wss://testnet-event.ainetwork.ai
* @param {number} chainId The chain ID of the blockchain network. e.g. 0 for local or testnet, and 1 for mainnet
* @param {AxiosRequestConfig} axiosConfig The axios request config.
*/
setProvider(providerUrl: string, eventHandlerUrl?: string, chainId?: number, axiosConfig?: AxiosRequestConfig | undefined) {
setProvider(providerUrl: string, eventHandlerUrl?: string | null, chainId?: number, axiosConfig?: AxiosRequestConfig | undefined) {
if (axiosConfig) {
this.axiosConfig = axiosConfig;
}
Expand Down
Loading