• Initialize connection to Near network.

    Parameters

    • config: ConnectConfig

      The configuration object for connecting to NEAR Protocol.

    Returns Promise<Near>

    A Promise that resolves to a Near object representing the connection.

    Example

    const connectionConfig = {
    networkId: 'testnet',
    nodeUrl: 'https://rpc.testnet.near.org',
    walletUrl: 'https://wallet.testnet.near.org',
    helperUrl: 'https://helper.testnet.near.org',
    keyStore: new InMemoryKeyStore(),
    deps: { keyStore: new BrowserLocalStorageKeyStore() },
    logger: true,
    keyPath: '/path/to/account-key.json',
    masterAccount: 'master-account.near',
    };

    const nearConnection = await connect(connectionConfig);
    console.log(nearConnection); // Near object representing the connection