open-index/open-npm huggingface dataset:
npm package: @people-s-marketplace-tonconnect/isomorphic-eventsource
Description: This package provides `EventSource` applicable in different environments (browser & NodeJS).
Author: tonconnect
Latest version: 0.0.3

# @tonconnect/isomorphic-eventsource

This package provides `EventSource` applicable in different environments (browser & NodeJS).

## Get started
`npm i @tonconnect/isomorphic-eventsource`

## How to use
Just import the package and use global `EventSource` constructor:

```ts
import '@tonconnect/isomorphic-eventsource';

const eventSourceInstance = new EventSource();
```

That will work in both browser and NodeJS.

## How does it work
This package exports an empty script if bundler creates browser-compatible build. 
When package is imported in NodeJS environment, it assigns an `EventSource` imported from the `eventsource` package to the `global` variable.

Note that this package doesn't provide an `EventSource` polyfill for browsers which doesn't support `EventSource` natively.
npm package: @people-s-marketplace-tonconnect/isomorphic-fetch
Description: This package provides `fetch` applicable in different environments (browser & NodeJS).
Author: tonconnect
Latest version: 0.0.4

# @tonconnect/isomorphic-fetch

This package provides `fetch` applicable in different environments (browser & NodeJS).

## Get started
`npm i @tonconnect/isomorphic-fetch`

## How to use
Just import the package and use global `fetch` function:

```ts
import '@tonconnect/isomorphic-fetch';

const result = await fetch('https://example.com');
```

That will work in both browser and NodeJS.

## How does it work
This package exports an empty script if bundler creates browser-compatible build.
When package is imported in NodeJS environment, it assigns an `fetch` imported from the `node-fetch` package to the `global` variable.

Note that this package doesn't provide an `fetch` polyfill for browsers which doesn't support `fetch` natively.
npm package: @people-s-marketplace-tonconnect/protocol
Description: ℹ️ If you want to integrate TonConnect to your dApp, you should use [@tonconnect/sdk](https://www.npmjs.com/package/@tonconnect/sdk)
Author: tonconnect
Latest version: 2.2.7

# TON Connect protocol models

ℹ️ If you want to integrate TonConnect to your dApp, you should use [@tonconnect/sdk](https://www.npmjs.com/package/@tonconnect/sdk)

[Latest API documentation](https://ton-connect.github.io/sdk/modules/_tonconnect_protocol.html)

## Summary
Package contains protocol requests, responses and event models and encoding, decoding functions.

You can use it to integrate TonConnect to your wallet app (written with TypeScript).

## Get started

### Install package
`npm i @tonconnect/protocol`

### Use protocol models in your app

```ts
import { AppRequest, RpcMethod, WalletResponse } from '@tonconnect/protocol';

function myWalletAppRequestsHandler<T extends RpcMethod>(request: AppRequest<T>): Promise<WalletResponse<T>> {
    // handle request, ask the user for a confirmation and return WalletResponse
}

```

### Use protocol cryptography in your app

```ts
import { SessionCrypto, WalletMessage, Base64, hexToByteArray } from '@tonconnect/protocol';

function encodeIncommingHTTPBridgeRequest(encryptedMessage: string, from: string): WalletMessage {
    const sessionCrypto = new SessionCrypto(yourStoredSessionReypair);

    const decryptedMessage =
        sessionCrypto.decrypt(
            Base64.decode(bridgeIncomingMessage.message).toUint8Array(),
            hexToByteArray(bridgeIncomingMessage.from)
        );
    
    return  JSON.parse(decryptedMessage);
}
```