open-index/open-npm huggingface dataset:
npm package: @mainelyio/feathers-encryption
Description: FeathersJS encryption plugin for encrypting & decrypting data.
Author: Feathers contributors
Latest version: 0.0.4

# @mainelyio/feathers-encryption

[![Download Status](https://img.shields.io/npm/dm/@mainelyio/feathers-encryption.svg?style=flat-square)](https://www.npmjs.com/package/@mainelyio/feathers-encryption)

> FeathersJS encryption plugin for encrypting & decrypting data.

## Installation

```bash
npm install @mainelyio/feathers-encryption --save
```

## Documentation

To come

## Configuration

In order to use the module, the following configuration must be in place:

```js
{
  key: "my-key",
  secret: "my-secret",
  method: "aes-256-cbc"
}
```

To set the data, you may use the following command:

```js
app.set("encryptionConfig", {
  key: "my-key",
  secret: "my-secret",
  method: "aes-256-cbc"
});
```

## Usage

The purpose of the package is to be used with resolvers in setting & retrieving data from databases, to ensure sensitive data is not stored in plain text.

To encrypt data for rest, you may use a resolver like this:

```js
export const myServiceResolver = resolve<MyService, HookContext>({
  secretId: async (value, tenant, context) => {
    const encryption = context.app.get("encryption");
    return encryption.decryptData(value);
  }
});
```

To decrypt data when querying a database:

```js
export const azureTenantDataResolver = resolve<MyService, HookContext>({
  secretId: async (value, tenant, context) => {
    const encryption = context.app.get("encryption");
    return encryption.encryptData(value);
  }
});
```

## License

Licensed under the [MIT license](LICENSE).
npm package: @mainframe/cli
Description: Mainframe CLI
Author: Mainframe
Latest version: 0.2.0

# Mainframe CLI

## Usage

```sh
# In packages/cli
./bin/run
```

## Commands

- `env:create`: create a new environment
- `env:default`: get or set the default environment to use
- `env:delete`: delete an environment
- `env:list`: list the environments
- `daemon:setup`: configure the daemon binary and socket paths
- `daemon:status`: display the daemon running status and socket path
- `daemon:start`: start the daemon using the store configuration
- `daemon:stop`: start the daemon using the store configuration
- `client:repl`: open a node REPL with an injected `client` object connected to the daemon
- `client:setup`: ensure the environment has a default vault setup
- `vault:create`: create a vault
- `vault:delete`: delete a vault
- `vault:list`: list existing vaults
- `vault:settings`: set and/or display a vault settings
- `graphql:query`: execute a GraphQL query
- `graphql:schema`: write the GraphQL schema
- `graphql:server`: create a HTTP proxy for GraphQL queries
- `identity:create`: create an identity
- `identity:list`: list identities
- `app:create`: create an app
- `app:publish`: publish the app to Swarm
- `wallet:createEth`: create a new Ethereum wallet
- `wallet:connectLedgerAccount`: connect an account from ledger hardware wallet
- `wallet:delete`: delete a wallet
- `wallet:importEth`: import an Ethereum wallet

## Environment setup

1.  Run `env:create` to create a new environment, set it as default unless you want to provide it explicitly in the next commands
1.  Run `daemon:setup` to configure the path to the `daemon` CLI, ex `./bin/run daemon:setup --bin-path=../daemon/bin/run`
1.  Run `daemon:start` to start the daemon, use `DEBUG="mainframe:*" ./bin/run daemon:start` to see the logs
1.  Run `client:setup` to create a new vault and configure it to be used by default
1.  Run `client:repl` to start interacting with the daemon
npm package: @mainframe/config
Description: Shared local configuration for Mainframe packages.
Latest version: 0.3.0

# Mainframe config

Shared local configuration for Mainframe packages.

## Installation

```sh
yarn add @mainframe/config
```

## Usage

The `Environment` class provides a namespaced persisted configuration and paths to be used.

All other functions need to be provided with an `Environment` instance they use to interact.

```js
import { Environment, getDaemonSocketPath } from '@mainframe/config'

const env = new Environment('development')
const socketPath = getDaemonSocketPath(env)
```

## API

### new Environment()

**Arguments**

1.  `name: string`: name of the environment

### Environment instance

#### .name

**Returns** `string` the environment name

#### .config

**Returns** [`Conf` instance](https://github.com/sindresorhus/conf#api)

#### .paths

**Returns** [env paths](https://github.com/sindresorhus/env-paths#api) shared by the platform

### getDaemonBinPath()

**Arguments**

1.  `env: Environment`

**Returns** `string` the path to the daemon binary

### setDaemonBinPath()

**Arguments**

1.  `env: Environment`
1.  `path: string`: the path to the daemon binary

### getDaemonSocketPath()

**Arguments**

1.  `env: Environment`

**Returns** `string` the socket path

### setDaemonSocketPath()

**Arguments**

1.  `env: Environment`
1.  `path: string`: the socket path

## License

MIT
npm package: @mainframe/data-types
Description: ## Types
Latest version: 0.3.0

# Mainframe data types utilities

## Types

## MainframeID

Ed25519 public key encoded as multibase base64url string in URN.

## Constants

### MAINFRAME_ID_URN_NID

NID used for the manifest IDs URN.

### MAINFRAME_ID_URN_NSS_ENCODING

Encoding for the NSS value.

## API

### mainframeIDType()

**Arguments**

1.  `value: any`

**Returns** `MainframeID`

### isValidMainframeID()

**Arguments**

1.  `value: string`

**Returns** `boolean`

### encodeMainframeID()

**Arguments**

1.  `value: Buffer`

**Returns** `MainframeID`

### decodeMainframeID()

**Arguments**

1.  `value: MainframeID`

**Returns** `Buffer`
npm package: @mainframe/eth
Description: Mainframe Ethereum API and utilities
Author: Mainframe
Latest version: 0.4.1

# Mainframe Ethereum client

Used by [Mainframe OS](https://github.com/MainframeHQ/mainframe-os) and the [Mainframe SDK](https://github.com/MainframeHQ/mainframe-sdk).

## License

MIT.\
See [LICENSE](LICENSE) file.
npm package: @mainframe/rpc-base
Description: Base RPC class
Author: Mainframe
Latest version: 0.3.0

# rpc-base

Abstract class to handle JSON-RPC 2.0 calls, used by [`rpc-request`](../rpc-request) and [`rpc-stream`](../rpc-stream).

## Installation

```sh
yarn add @mainframe/rpc-base
```

## Usage

```js
import BaseRPC from '@mainframe/rpc-base'

class MyRPC extends BaseRPC {
  request(...params: any): Promise<any> {
    // ...
  }
}
```

## Types

### RPCID

```js
type RPCID = string | number | null
```

### RPCRequest

```js
interface RPCRequest<T = any> {
  jsonrpc: '2.0'
  method: string
  id?: RPCID
  params?: T
}
```

### RPCError

```js
interface RPCErrorObject<T = any> {
  code: number;
  message?: ?string;
  data?: T;
}
```

### RPCResponse

```js
interface RPCResponse<T = any, E = any> {
  jsonrpc: '2.0';
  id: RPCID;
  result?: T;
  error?: RPCErrorObject<E>;
}
```

## API

### new BaseRPC()

**Arguments**

1.  `canSubscribe: boolean = false`: whether subscription calls (using a stateful connection) are supported by the implementation or not.

### .canSubscribe

**Returns** `boolean`

### .createId()

**Returns** `string`: an unique ID for RPC calls.

### .request()

**⚠️ This is an abstract method, it must be implemented by extending classes**\

**Arguments**

1. `method: string`
1. `params?: P`

**Returns** `Promise<T = any>`

## License

MIT
npm package: @mainframe/rpc-browser
Description: RPC for browser
Author: Mainframe
Latest version: 0.3.0

# rpc-browser

[`rpc-request`](../rpc-request) or [`rpc-stream`](../rpc-stream) factory with automatic transport selection.

## Installation

```sh
yarn add @mainframe/rpc-browser
```

## Usage

```js
import browserRPC from '@mainframe/rpc-browser'

const rpcOverHTTP = browserRPC('http://localhost') // RequestRPC using HTTP transport
const rpcOverWS = browserRPC('ws://localhost') // StreamRPC using WebSocket transport
```

## API

### browserRPC()

**Arguments**

1.  `endpoint: string`: HTTP or WebSocket URL to connect to.

**Returns** [`RequestRPC`](../rpc-request) (with HTTP endpoint) or [`StreamRPC`](../rpc-stream) (with WebSocket endpoint).

## License

MIT
npm package: @mainframe/rpc-electron
Description: Electron RPC client
Author: Mainframe
Latest version: 0.2.0

# rpc-electron

[`rpc-stream`](../rpc-stream) factory using [`transport-electron`](../transport-electron).

## Installation

```sh
yarn add @mainframe/rpc-electron
```

## Usage

```js
import electronRPC from '@mainframe/rpc-electron'

const rpc = electronRPC('optional-channel-name')

rpc.request('getUser', ['1234']).then(console.log)
```

## API

### electronRPC()

**Arguments**

1.  `channel?: ?string`, defaults to `rpc-message`

**Returns** [`StreamRPC`](../rpc-stream)

## License

MIT
npm package: @mainframe/rpc-error
Description: JSON-RPC error
Author: Mainframe
Latest version: 0.4.0

# rpc-error

Error class and utilities for JSON-RPC errors.

## Installation

```sh
yarn add @mainframe/rpc-error
```

## Usage

```js
import RPCError, { parseError, methodNotFound } from '@mainframe/rpc-error'

const error1 = parseError()
const error2 = methodNotFound('get_user')
const error3 = new RPCError(-32600) // Invalid request
const error4 = new RPCError(1000, 'Custom app error', { user: 'alice' })
```

## API

### new RPCError()

**Arguments**

1.  `code: number`
1.  `message?: string`: will be set based on the `code` when not provided
1.  `data?: T`: optional additional error data

### .toObject()

**Returns** [`RPCErrorObject`](../rpc-base#rpcerrorobject)

### RPCError.fromObject()

Creates a RPCError instance from a [`RPCErrorObject`](../rpc-base#rpcerrorobject).

**Arguments**

1.  `error: RPCErrorObject`

**Returns** `RPCError` instance

### isServerError()

**Arguments**

1.  `code: number`

**Returns** `boolean`

### getErrorMessage()

**Arguments**

1.  `code: number`

**Returns** `string`

### parseError()

**Arguments**

1.  `data?: ?any`

**Returns** `RPCError` instance with code `-32700`

### invalidRequest()

**Arguments**

1.  `data?: ?any`

**Returns** `RPCError` instance with code `-32600`

### methodNotFound()

**Arguments**

1.  `data?: ?any`

**Returns** `RPCError` instance with code `-32601`

### invalidParams()

**Arguments**

1.  `data?: ?any`

**Returns** `RPCError` instance with code `-32602`

### internalError()

**Arguments**

1.  `data?: ?any`

**Returns** `RPCError` instance with code `-32603`

## License

MIT
npm package: @mainframe/rpc-handler
Description: JSON-RPC handler
Author: Mainframe
Latest version: 0.3.0

# rpc-handler

JSON-RPC messages handler.

## Installation

```sh
yarn add @mainframe/rpc-handler
```

## Usage

```js
import createHandler from '@mainframe/rpc-handler'

const handle = createHandler({
  methods: {
    hello: {
      params: {
        name: 'string'
      },
      handler(ctx, params) => `hello ${params.name}`,
    },
    ping: () => 'pong',
  },
})

const context = {}

const incomingMessage = {
  jsonrpc: '2.0',
  id: 'test',
  method: 'hello',
  params: {
    name: 'bob',
  },
}

const outgoingMessage = await handle(context, incomingMessage)
// outgoingMessage = {jsonrpc: '2.0', id: 'test', result: 'hello bob'}
```

## Types

### RPCRequest

Imported from `@mainframe/rpc-base`

### RPCResponse

Imported from `@mainframe/rpc-base`

### ErrorHandler

```js
type ErrorHandler = <C = any, P = any>(ctx: C, msg: RPCRequest<P>, error: Error) => void
```

### MethodHandler

```js
type MethodHandler = <C = any, P = any, R = any>(ctx: C, params: P) => R | Promise<R>
```

### NotificationHandler

```js
type NotificationHandler = <C = any, P = any>(ctx: C, msg: RPCRequest<P>) => void
```

### MethodWithParams

```js
interface MethodWithParams {
  params?: Record<string, any> | undefined
  handler: MethodHandler
}
```

### Methods

```js
type Methods = Record<string, MethodHandler | MethodWithParams>
```

### HandlerParams

```js
type HandlerParams = {
  methods: Methods,
  onHandlerError?: ErrorHandler | undefined,
  onInvalidMessage?: NotificationHandler | undefined,
  onNotification?: NotificationHandler | undefined,
  validatorOptions?: any | undefined,
}
```

### HandlerFunc

```js
type HandlerFunc = <C = any, P = any, R = any, E = any>(
  ctx: C,
  req: RPCRequest<P>,
) => Promise<RPCResponse<R, E>>
```

## API

### createHandler()

**Default export of the library**

**Arguments**

1.  `params: HandlerParams`

**Returns** `HandlerFunc`

### parseJSON()

Tries to parse a JSON string, or throws a RPCError with code `-32700` (parse error)

**Arguments**

1.  `input: string`

**Returns** `T = any`

## License

MIT
npm package: @mainframe/rpc-http-browser
Description: HTTP RPC for browser
Author: Mainframe
Latest version: 0.2.0

# rpc-http-browser

[`rpc-request`](../rpc-request) factory using [`transport-http-browser`](../transport-http-browser).

## Installation

```sh
yarn add @mainframe/rpc-http-browser
```

## Usage

```js
import httpRPC from '@mainframe/rpc-http-browser'

const rpc = httpRPC('http://localhost')

rpc.request('getUser', ['1234']).then(console.log)
```

## API

### httpRPC()

**Arguments**

1.  `url: string`

**Returns** [`RequestRPC`](../rpc-request)

## License

MIT
npm package: @mainframe/rpc-http-node
Description: HTTP RPC for node
Author: Mainframe
Latest version: 0.2.0

# rpc-http-node

[`rpc-request`](../rpc-request) factory using [`transport-http-node`](../transport-http-node).

## Installation

```sh
yarn add @mainframe/rpc-http-node
```

## Usage

```js
import httpRPC from '@mainframe/rpc-http-node'

const rpc = httpRPC('http://localhost')

rpc.request('getUser', ['1234']).then(console.log)
```

## API

### httpRPC()

**Arguments**

1.  `url: string`

**Returns** [`RequestRPC`](../rpc-request)

## License

MIT
npm package: @mainframe/rpc-ipc
Description: IPC RPC for node
Author: Mainframe
Latest version: 0.3.0

# rpc-ipc

[`rpc-stream`](../rpc-stream) factory using [`transport-ipc`](../transport-ipc).

## Installation

```sh
yarn add @mainframe/rpc-ipc
```

## Usage

```js
import ipcRPC from '@mainframe/rpc-ipc'

const rpc = ipcRPC('/path/to/socket')

rpc.request('getUser', ['1234']).then(console.log)
```

## API

### ipcRPC()

**Arguments**

1.  `path: string`

**Returns** [`StreamRPC`](../rpc-stream)

## License

MIT
npm package: @mainframe/rpc-node
Description: RPC for node
Author: Mainframe
Latest version: 0.3.0

# rpc-node

[`rpc-request`](../rpc-request) or [`rpc-stream`](../rpc-stream) factory with automatic transport selection.

## Installation

```sh
yarn add @mainframe/rpc-node
```

## Usage

```js
import nodeRPC from '@mainframe/rpc-node'

const rpcOverHTTP = nodeRPC('http://localhost') // RequestRPC using HTTP transport
const rpcOverWS = nodeRPC('ws://localhost') // StreamRPC using WebSocket transport
const rpcOverIPC = nodeRPC('/path/to/socket') // StreamRPC using ICP transport
```

## API

### nodeRPC()

**Arguments**

1.  `endpoint: string`: socket path, HTTP or WebSocket URL to connect to.

**Returns** [`RequestRPC`](../rpc-request) (with HTTP endpoint) or [`StreamRPC`](../rpc-stream) (with IPC or WebSocket endpoint).

## License

MIT
npm package: @mainframe/rpc-request
Description: Request-based RPC
Author: Mainframe
Latest version: 0.2.0

# rpc-request

Class extending [`rpc-base`](../rpc-base) to handle stateless JSON-RPC 2.0 calls.

See [`transport-create-http`](../transport-create-http), [`transport-http-browser`](../transport-http-browser) and [`transport-http-node`](../transport-http-node) for possible transports and [`rpc-stream`](../rpc-stream) to handle stateful JSON-RPC 2.0 calls.

## Installation

```sh
yarn add @mainframe/rpc-request
```

## Usage

```js
import RequestRPC from '@mainframe/rpc-request'
import httpTransport from '@mainframe/transport-http-node'

class MyAPI extends RequestRPC {
  constructor(url: string) {
    super(httpTransport(url))
  }

  getUser(id: string): Promise<{ name: string }> {
    return this.request('getUser', [id])
  }
}

const api = new MyAPI('http://my-api-url')
api.getUser('1234')
```

## Types

```js
type FetchFunction = <D = any, R = any>(data: D) => Promise<R>
```

## API

See [the `BaseRPC` API](../rpc-base/README.md#api) for inherited methods and properties.

### new RequestRPC()

**Arguments**

1.  `fetch: FetchFunction`: function making the server call using the JSON-RPC request Object and returning the response.

### .request()

**Arguments**

1.  `method: string`
1.  `params: T = any`

**Returns** `Promise<R = any>`

## License

MIT
npm package: @mainframe/rpc-stream
Description: Stream-based RPC
Author: Mainframe
Latest version: 0.3.0

# rpc-stream

Class extending [`rpc-base`](../rpc-base) to handle stateful JSON-RPC 2.0 calls.

See [`transport-ipc`](../transport-ipc), [`transport-ws-browser`](../transport-ws-browser) and [`transport-ws-node`](../transport-ws-node) for possible transports and [`rpc-request`](../rpc-request) to handle stateless JSON-RPC 2.0 calls.

## Installation

```sh
yarn add @mainframe/rpc-stream
```

## Usage

```js
import StreamRPC from '@mainframe/rpc-stream'
import ipcTransport from '@mainframe/transport-ipc'

class MyAPI extends StreamRPC {
  constructor(path: string) {
    super(ipcTransport(path))
  }

  getUser(id: string): Promise<{ name: string }> {
    return this.request('getUser', [id])
  }
}

const api = new MyAPI('/path/to/socket')
api.getUser('1234')
```

## API

See [the `BaseRPC` API](../rpc-base/README.md#api) for inherited methods and properties.

### new StreamRPC()

**Arguments**

1.  `subject: Subject`: a [RxJS `Subject`](http://reactivex.io/rxjs/class/es6/Subject.js~Subject.html) handling communication with the server.

### .request()

**Arguments**

1.  `method: string`
1.  `params: T = any`

**Returns** `Promise<R = any>`

## License

MIT
npm package: @mainframe/rpc-web3
Description: Web3 RPC
Author: Mainframe
Latest version: 0.1.1

# rpc-web3

[`rpc-request`](../rpc-request) factory using [`transport-web3`](../transport-web3).

## Installation

```sh
yarn add @mainframe/rpc-web3
```

## Usage

```js
import web3RPC from '@mainframe/rpc-web3'

const rpc = web3RPC('http://localhost')

rpc.request('getUser', ['1234']).then(console.log)
```

## API

### web3RPC()

**Arguments**

1.  `url?: string`: optional HTTP endpoint. When not provided, `window.web3.currentProvider` will be used if available.

**Returns** [`RequestRPC`](../rpc-request)

## License

MIT
npm package: @mainframe/rpc-ws-browser
Description: WebSocket RPC for browser
Author: Mainframe
Latest version: 0.3.0

# rpc-ws-browser

[`rpc-stream`](../rpc-stream) factory using [`transport-ws-browser`](../transport-ws-browser).

## Installation

```sh
yarn add @mainframe/rpc-ws-browser
```

## Usage

```js
import wsRPC from '@mainframe/rpc-ws-browser'

const rpc = wsRPC('ws://localhost')

rpc.request('getUser', ['1234']).then(console.log)
```

## API

### wsRPC()

**Arguments**

1.  `url: string`

**Returns** [`StreamRPC`](../rpc-stream)

## License

MIT
npm package: @mainframe/rpc-ws-node
Description: WebSocket RPC for node
Author: Mainframe
Latest version: 0.3.0

# rpc-ws-node

[`rpc-stream`](../rpc-stream) factory using [`transport-ws-node`](../transport-ws-node).

## Installation

```sh
yarn add @mainframe/rpc-ws-node
```

## Usage

```js
import wsRPC from '@mainframe/rpc-ws-node'

const rpc = wsRPC('ws://localhost')

rpc.request('getUser', ['1234']).then(console.log)
```

## API

### wsRPC()

**Arguments**

1.  `url: string`

**Returns** [`StreamRPC`](../rpc-stream)

## License

MIT
npm package: @mainframe/transport-create-http
Description: HTTP transport factory
Author: Mainframe
Latest version: 0.1.2

# transport-create-http

HTTP transport factory used by [`transport-http-browser`]('../transport-http-browser') and [`transport-http-node`]('../transport-http-node').

Throws `HTTPError` when the request fails.

## Installation

```sh
yarn add @mainframe/transport-create-http
```

## Usage

```js
import createTransport from '@mainframe/transport-create-http'

const request = createTransport(window.fetch)('http://localhost')

request({ hello: 'transport' }).then(console.log)
```

## API

### createTransport() (default export)

**Arguments**

1.  `fetch: (req: Request) => Response`: function implementing the [`Fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) interfaces.

**Returns** `(data: Object) => Promise<any>`

### HTTPError class

**Arguments**

1.  `status: number`: HTTP status code
1.  `message: string`: error message

**Properties**

- `status: number`: HTTP status code
- `message: string`: error message

## License

MIT
npm package: @mainframe/transport-electron
Description: Electron transport
Author: Mainframe
Latest version: 0.2.1

# transport-electron

[Electron IPC](https://electronjs.org/docs/api/ipc-renderer) transport as a [RxJS `Subject`](http://reactivex.io/rxjs/class/es6/Subject.js~Subject.html).

## Installation

```sh
yarn add @mainframe/transport-electron
```

## Usage

```js
import electronTransport from '@mainframe/transport-electron'

const transport = electronTransport('optional-channel-name')

transport.subcribe(console.log)
transport.next({ hello: 'transport' })
```

## API

### electronTransport()

**Arguments**

1.  `channel?: ?string`, defaults to `rpc-message`

**Returns** `Rx.Subject<Object>`

## License

MIT
npm package: @mainframe/transport-http-browser
Description: HTTP transport for browser
Author: Mainframe
Latest version: 0.2.0

# transport-http-browser

HTTP transport for browser.

## Installation

```sh
yarn add @mainframe/transport-http-browser
```

## Usage

```js
import httpTransport from '@mainframe/transport-http-browser'

const transport = httpTransport('http://localhost')

transport.request({ hello: 'transport' }).then(console.log)
```

## API

### httpTransport()

**Arguments**

1.  `url: string`

**Returns** `(data: Object) => Promise<any>`

## License

MIT
npm package: @mainframe/transport-http-node
Description: HTTP transport for node
Author: Mainframe
Latest version: 0.2.0

# transport-http-node

HTTP transport for node.

## Installation

```sh
yarn add @mainframe/transport-http-node
```

## Usage

```js
import httpTransport from '@mainframe/transport-http-node'

const transport = httpTransport('http://localhost')

transport.request({ hello: 'transport' }).then(console.log)
```

## API

### httpTransport()

**Arguments**

1.  `url: string`

**Returns** `(data: Object) => Promise<any>`

## License

MIT
npm package: @mainframe/transport-ipc
Description: IPC transport
Author: Mainframe
Latest version: 0.3.0

# transport-ipc

[IPC](https://nodejs.org/dist/latest-v9.x/docs/api/net.html#net_ipc_support) transport for node as a [RxJS `Subject`](http://reactivex.io/rxjs/class/es6/Subject.js~Subject.html).

## Installation

```sh
yarn add @mainframe/transport-ipc
```

## Usage

```js
import ipcTransport from '@mainframe/transport-ipc'

const transport = ipcTransport('/path/to/socket')

transport.subcribe(console.log)
transport.next({ hello: 'transport' })
```

## API

### ipcTransport()

**Arguments**

1.  `path: string`

**Returns** `Rx.Subject<Object>`

## License

MIT
npm package: @mainframe/transport-web3
Description: Web3 transport
Author: Mainframe
Latest version: 0.1.1

# transport-web3

Web3 transport for browser as a [RxJS `Subject`](http://reactivex.io/rxjs/class/es6/Subject.js~Subject.html).

## Installation

```sh
yarn add @mainframe/transport-web3
```

## Usage

```js
import web3Transport from '@mainframe/transport-web3'

const transport = web3Transport('http://localhost:8500')

transport.subcribe(console.log)
transport.next({ jsonrpc: '2.0', id: 1, method: 'web3_clientVersion' })
```

## API

### web3Transport()

**Arguments**

1.  `url?: string`: optional HTTP endpoint. When not provided, `window.web3.currentProvider` will be used if available.

**Returns** `Rx.Subject<Object>`

## License

MIT
npm package: @mainframe/transport-ws-browser
Description: WebSocket transport for browser
Author: Mainframe
Latest version: 0.3.0

# transport-ws-browser

WebSocket transport for browser as a [RxJS `Subject`](http://reactivex.io/rxjs/class/es6/Subject.js~Subject.html).

## Installation

```sh
yarn add @mainframe/transport-ws-browser
```

## Usage

```js
import wsTransport from '@mainframe/transport-ws-browser'

const transport = wsTransport('ws://localhost')

transport.subcribe(console.log)
transport.next({ hello: 'transport' })
```

## API

### wsTransport()

**Arguments**

1.  `url: string`

**Returns** `Rx.Subject<Object>`

## License

MIT
npm package: @mainframe/transport-ws-node
Description: WebSocket transport for node
Author: Mainframe
Latest version: 0.4.0

# transport-ws-node

WebSocket transport for node as a [RxJS `Subject`](http://reactivex.io/rxjs/class/es6/Subject.js~Subject.html).

## Installation

```sh
yarn add @mainframe/transport-ws-node
```

## Usage

```js
import wsTransport from '@mainframe/transport-ws-node'

const transport = wsTransport('ws://localhost')

transport.subcribe(console.log)
transport.next({ hello: 'transport' })
```

## API

### wsTransport()

**Arguments**

1.  `url: string`

**Returns** `Rx.Subject<T = any>`

## License

MIT
npm package: @mainframe/utils-base64
Description: Base64 encoding utilities
Author: Mainframe
Latest version: 0.1.1

# utils-base64

Utilities for base64-encoded strings.

## Installation

```sh
yarn add @mainframe/utils-base64
```

## Usage

```js
import { encodeBase64, decodeBase64 } from 'utils-base64'

const buffer = Buffer.from('test')
const encoded = encodeBase64(buffer) // base64 (string)
const decoded = decodeBase64(encoded) // Buffer
```

## Types

### base64

Opaque type representing a base64-encoded string.

## API

### base64Type()

Simple identity function casting the provided value as `base64` to properly type-check.

**Arguments**

1.  `value: any`

**Returns** `base64`

### encodeBase64()

**Arguments**

1.  `input: Buffer`

**Returns** `base64`

### decodeBase64()

**Arguments**

1.  `input: base64`

**Returns** `Buffer`

## License

MIT
npm package: @mainframe/utils-hex
Description: Hex encoding utilities
Author: Mainframe
Latest version: 0.1.1

# utils-hex

Utilities for hexadecimal-encoded strings.

## Installation

```sh
yarn add @mainframe/utils-hex
```

## Usage

```js
import { encodeHex, decodeHex } from 'utils-hex'

const encoded = encodeHex('hello')
const decoded = decodeHex(encoded) // 'hello'
```

## Types

### hex

Opaque type representing an hexadecimal-encoded string prefixed with `0x`

## API

### hexType()

Simple identity function casting the provided value as `hex` to properly type-check.

**Arguments**

1.  `value: any`

**Returns** `hex`

### hexEmpty

**Returns** `0x` value with `hex` type.

### encodeHex()

**Arguments**

1.  `input: string`
1.  `from?: buffer$Encoding = 'utf8'`

**Returns** `hex`

### decodeHex()

**Arguments**

1.  `input: hex`
1.  `to?: buffer$Encoding = 'utf8'`

**Returns** `string`

## License

MIT
npm package: @mainframe/utils-id
Description: Unique identifier utilities
Author: Mainframe
Latest version: 0.1.1

# utils-id

Unique identifier utilities.

## Installation

```sh
yarn add @mainframe/utils-id
```

## Usage

```js
import { uniqueID } from 'utils-id'

const id = uniqueID() // random string
```

## Types

### ID

Opaque type representing an unique ID as a `string`.

## API

### idType()

Simple identity function casting the provided value as `ID` to properly type-check.

**Arguments**

1.  `value: any`

**Returns** `ID`

### uniqueID()

**Returns** `ID`

## License

MIT
npm package: @mainframe/utils-time
Description: Time-related utilities
Author: Mainframe
Latest version: 0.2.0

# utils-time

Time-related utilities.

## Installation

```sh
yarn add @mainframe/utils-time
```

## Usage

```js
import { createWithTimeout, TimeoutError, withTimeout } from 'utils-id'

const max10secs = createWithTimeout(10000)

const run = async () => {
  try {
    const tooLong = await max10secs(fetch(...))
  } catch (err) {
    if (err instanceof TimeoutError) {
      ...
    }
  }

  const longerTime = await withTimeout(fetch(...), 60 * 1000) // 1 min
}
```

## API

### sleep

Waits for the given `time` before resolving.

**Arguments**

1.  `time: number`

**Returns** `Promise<void>`

### new TimeoutError

**Arguments**

1.  `message: string`

### withTimeout

Races between the given `wait` promise and `time` before rejecting with a `TimeoutError`.

**Arguments**

1.  `wait: Promise<T>`
1.  `time: number`

**Returns** `Promise<T>`

### createWithTimeout

Creates a `withTimeout()` function with a given default `time`.

**Arguments**

1.  `time: number`

**Returns** `(wait: Promise<T>, time?: number) => Promise<T>`

### createGetTime

Creates function that will return an always increasing current time value based on `Date.now()`.

**Returns** `() => number`

## License

MIT
npm package: @mainick/ts-streak-counter
Description: This is a basic streak counter - inspired by Duolingo - written in TypeScript and meant for the browser  (uses `localStorage`).
Author: mainick
Latest version: 0.0.2

# `@mainick/ts-streak-counter` - a basic streak counter

This is a basic streak counter - inspired by Duolingo - written in TypeScript and meant for the browser 
(uses `localStorage`). 

## Install

```shell
npm add @mainick/ts-streak-counter
```

## Usage

[![Edit streak-counter (ts-course) (forked)](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/streak-counter-ts-course-forked-li3jq9?fontsize=14&hidenavigation=1&theme=dark)

```javascript
import {streakCounter} from "@mainick/ts-streak-counter"

const today = new Date();
const streak = streakCounter(localStorage, today);
// streak returns an object: 
// {
//    currentCount: 1.
//    startDate: "11/10/2022",
//    lastLoginDate: "11/10/2022"
// }
```
npm package: @mainjs/image-finder
Description: Upload image and Picker
Author: mainjs
Latest version: 1.0.0
Deprecated: asdasd

# mainjs-images

> Upload image and Picker

[![NPM](https://img.shields.io/npm/v/mainjs-images.svg)](https://www.npmjs.com/package/mainjs-images) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save mainjs-images
```

## Usage

```jsx
import React, { Component } from 'react'

import MyComponent from 'mainjs-images'

class Example extends Component {
  render () {
    return (
      <MyComponent />
    )
  }
}
```

## License

MIT © [dangtienngoc](https://github.com/dangtienngoc)
npm package: @mainjs/react-custom-scrollbars
Description: Custom scrollbar
Author: mainjs
Latest version: 20.11.19

# @mainjs/react-custom-scrollbars

[![npm version](https://img.shields.io/npm/v/@mainjs/react-custom-scrollbars.svg?style=flat-square)](https://www.npmjs.com/package/@mainjs/react-custom-scrollbars)

## Example

```js
// In your React component:
render() {
  return (
    <Scroll
    />
  );
}
```

## React Custom Scrollbars as a component?

Yes! It's really easy to custom scroll in your app as part of the component tree in your React app.

* **Want to custom scroll.

## How to install

`npm install @mainjs/react-custom-scrollbars --save`

## How to use

```js
var React = require('react');
var Scroll = require('@mainjs/react-custom-scrollbars').default;

// ... or using import:
import React from 'react';
import { Scroll } from '@mainjs/react-custom-scrollbars';

class MyComponent extends React.Component {
  render() {
    return <Scroll {...props} />; // Check props in next section
  }
}
```

### Props

* *height (number)*: The height of the scroll container.
* *autoScroll*: Automatically scroll to the last position vs data (object)
* *data (object)*: the data of the content.

## How to contribute

Feel free to fork and send PRs or issues, be it for features, bug fixes, or documentation!
npm package: @mainkatz/image-input
Description: Javascript counterpart for image_input gem.
Author: Andrew Katz
Latest version: 0.0.7

# Image Input

A Rails helper for a simple, clean image input for use with Active Storage.

<img src="example.png" width="314" height="269" />

Example usage:

```ruby
class User < ApplicationRecord
  has_one_attached :profile_picture
end
```

```erb
<%= form_with(model: User.new) do |form| %>
  <%= image_input form, :profile_picture %>
<% end %>
```

NOTE: The styles of this project are constructed using Tailwind CSS.

## Installation

Add to your Gemfile:

```ruby
gem 'image_input'
```

```sh
bundle install
yarn add @mainkatz/image-input
```

Register Stimulus controller. By default in Rails, this is in `controllers/index.js`.

```js
import ImageInputController from '@mainkatz/dropzone-input';

application.register('image-input', ImageInputController);
```

## Development

To develop this locally you can update your Gemfile:

```ruby
gem 'image_input', path: 'PATH_TO_PROJECT'
```

In this project run:

```sh
yarn link
```

In your app project run:

```sh
yarn link @mainkatz/image-input
```

To auto-recompile this project, run:

```sh
yarn run dev
```
npm package: @mainmatter/ember-api-actions
Description: The default blueprint for ember-cli addons.
Latest version: 0.6.0

# @mainmatter/ember-api-actions

This is an [Ember.js] addon allowing you to easily implement non-[CRUD] actions
for your [Ember Data] models.


## Compatibility

* Ember.js v3.28 or above
* Ember CLI v3.28 or above
* Node.js v14 or above


## Installation

```
ember install @mainmatter/ember-api-actions
```


## Usage

```js
import Model from '@ember-data/model';
import { apiAction } from '@mainmatter/ember-api-actions';

class User extends Model {
  async follow() {
    return await apiAction(this, { method: 'PUT', path: 'follow' });
  }
}
```


## Contributing

See the [Contributing](CONTRIBUTING.md) guide for details.


## License

This project is licensed under the [MIT License](LICENSE.md).

[Ember.js]: https://emberjs.com
[CRUD]: https://en.wikipedia.org/wiki/Create,_read,_update_and_delete
[Ember Data]: https://github.com/emberjs/data
npm package: @mainnet-pat/electrum-fallback-client
Description: @mainnet-pat/electrum-fallback-client is a lightweight JavaScript library that lets you connect with one or more Electrum servers with fallback and ranking strategies.
Author: mainnet-pat
Latest version: 4.1.17

# ElectrumFallbackClient

Inspired by wagmi's fallback transport for RPC clients, this electrum-cash client allows for defining the fallback and ranking strategies.

## Getting started

A simple initialization routine is available for url-based connection strings:

```javascript
const electrum = ElectrumFallbackClient.FromHostUrls(ElectrumWebSocket, [
    'wss://bch.imaginary.cash:50004', 'ws://blackie.c3-soft.com:50003'
  ], { rank: true });
```

See in-code documentation for more customizations.
npm package: @mainnet-pat/opfs
Description: OPFS stands for [Origin Private File System](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system#browser_compatibility). It is a virtual file system available in browser and it requires no permission to access.
Latest version: 0.0.1

# OPFS

OPFS stands for [Origin Private File System](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system#browser_compatibility). It is a virtual file system available in browser and it requires no permission to access.

This package wraps fs-like OPFS adapter from [memfs](http://npmjs.com/package/memfs) to become a drop in `fs` replacement in webpack, rollup and other web applications which support aliasing the node packages.

You can install [OPFS Explorer](https://chrome.google.com/webstore/detail/opfs-explorer/acndjpgkpaclldomagafnognkcgjignd) Chrome
extension to verify the contents of the OPFS file system. Visit the [demo page](https://tomayac.github.io/opfs-explorer/) to try out the extension.