MCPcopy Create free account
hub / github.com/subquery/subql / performConnection

Function performConnection

packages/node-core/src/api.service.ts:139–165  ·  view source on GitHub ↗
(
    createConnection: (endpoint: string, config: EndpointConfig) => Promise<Connection>,
    network: ProjectNetworkConfig & {chainId: string},
    index: number,
    endpoint: string,
    config: EndpointConfig,
    postConnectedHook?: (connection: Connection, endpoint: string, index: number) => void
  )

Source from the content-addressed store, hash-verified

137 }
138
139 private async performConnection(
140 createConnection: (endpoint: string, config: EndpointConfig) => Promise<Connection>,
141 network: ProjectNetworkConfig & {chainId: string},
142 index: number,
143 endpoint: string,
144 config: EndpointConfig,
145 postConnectedHook?: (connection: Connection, endpoint: string, index: number) => void
146 ): Promise<Connection> {
147 const connection = await createConnection(endpoint, config);
148
149 this.assertChainId(network, connection);
150 if (!this._networkMeta) {
151 this._networkMeta = connection.networkMeta;
152 }
153
154 this.eventEmitter.emit(IndexerEvent.ApiConnected, {
155 value: 1,
156 apiIndex: index,
157 endpoint: endpoint,
158 });
159
160 if (postConnectedHook) {
161 postConnectedHook(connection, endpoint, index);
162 }
163
164 return connection;
165 }
166
167 retryConnection(...args: Parameters<ApiService<A, SA, B, Connection, EndpointConfig>['performConnection']>): void {
168 const endpoint = args[3];

Callers

nothing calls this directly

Calls 1

assertChainIdMethod · 0.80

Tested by

no test coverage detected