connect
connect(
blockchainRpcWsUrl
,apiOpts
):Promise
<ApiPromise
>
Establishes a connection to the CORD blockchain via WebSocket URL.
Parameters
• blockchainRpcWsUrl: string
WebSocket URL for the CORD blockchain RPC endpoint.
• apiOpts: Omit
<ApiOptions
, "provider"
>= {}
Additional API connection options.
Returns
Promise
<ApiPromise
>
A promise resolving to the ApiPromise instance.
Remarks
Initializes the connection and makes the API instance available for SDK functionalities.
Example
import { connect } from './CordConfig';
const wsUrl = 'ws://localhost:9944';connect(wsUrl).then(api => { console.log('Connected to CORD blockchain:', api);}).catch(error => { console.error('Connection failed:', error);});