open-index/open-npm huggingface dataset:
npm package: @huma-shan/advanced-logic
Description: Main package for the Advanced Request Network logic layer.
Latest version: 0.39.0

# @huma-shan/advanced-logic

`@huma-shan/advanced-logic` is a typescript library part of the [Request Network protocol](https://github.com/RequestNetwork/requestNetwork).
It is the default implementation of the Advanced Logic layer. This layer hosts the extensions to the protocol, see Implemented Extensions for the list.

## Installation

```bash
npm install @huma-shan/advanced-logic
```

## Specifications

Specifications of Advanced Logic can be found [here](/packages/advanced-logic/specs/advanced-logic-specs-0.1.0.md)

## Implemented Extensions

### Content Data

This extension allows linking content data to the request. The content data can be used to give extra information about the request. You can find examples of content data format [here](/packages/data-format).

Specifications of Content Data can be found [here](/packages/advanced-logic/specs/content-data-0.1.0.md)

### Declarative payments

This extension allows the payments and the refunds to be made in any currency.
The payments and refunds are documented by the payer and the payee of the request.

This extension do not ensure payment detection, only a consensus is made between the payer and the payee.

Specifications of Declarative payments can be found [here](/packages/advanced-logic/specs/payment-network-any-declarative-0.1.0.md)

### Address based bitcoin payments

This extension allows the payments and the refunds to be made on the Bitcoin blockchain.

Note: this extension can be used with the bitcoin mainnet and testnet.

Specifications of Address based bitcoin payments can be found [here](/packages/advanced-logic/specs/payment-network-btc-address-based-0.1.0.md)

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
[Read the contributing guide](/CONTRIBUTING.md)

## License

[MIT](/LICENSE)
npm package: @huma-shan/currency
Description: Currency tools for Request Network packages.
Latest version: 0.13.0

# @huma-shan/currency

`@huma-shan/currency` is a typescript library part of the [Request Network protocol](https://github.com/RequestNetwork/requestNetwork).
It is a collection of tools for the currencies shared between the @requestnetwork packages.

## Installation

```bash
npm install @huma-shan/currency
```

## Usage

```javascript
import { RequestLogicTypes } from '@huma-shan/types';
import { Currency, Token } from '@huma-shan/currency';

const decimals = new Currency({
  type: RequestLogicTypes.CURRENCY.ETH,
  value: 'ETH',
}).getDecimals();

console.log(decimals); // 18

const ETHHash = new Currency({
  type: RequestLogicTypes.CURRENCY.ETH,
  value: 'ETH',
}).getHash();

console.log(ETHHash); // 0xF5AF88e117747e87fC5929F2ff87221B1447652E

// Get currencies from their symbol
const ETHCurrency: RequestLogicTypes.ICurrency = Currency.from('ETH');
const FAUCurrency: RequestLogicTypes.ICurrency = Currency.from('DAI');
// Get currencies from their address
const DAICurrency: RequestLogicTypes.ICurrency = Currency.from(
  '0x6B175474E89094C44Da98b954EedeAC495271d0F',
);

console.log(FAUCurrency.toString()); // FAU-rinkeby
console.log(DAICurrency.toString()); // DAI

// Get a token symbol from its address
const FAUToken = Token.from('0xFab46E002BbF0b4509813474841E0716E6730136');

console.log(FAUToken.symbol); // FAU
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
[Read the contributing guide](/CONTRIBUTING.md)

## License

[MIT](/LICENSE)
npm package: @huma-shan/data-format
Description: Data format for the Request Network protocol.
Latest version: 0.14.0

# @huma-shan/data-format

`@huma-shan/data-format` is a typescript library part of the [Request Network protocol](https://github.com/RequestNetwork/requestNetwork).
It is a JSON Schema library providing standard for the data of the Request Network protocol. It also provide a javascript entry point to validate a given JSON.

## Installation

```bash
npm install @huma-shan/data-format
```

### Usage

```js
import dataFormat from '@huma-shan/data-format';

let result = data - format.validate(A_JSON_OBJECT);

if (!result.valid) {
  // use the errors from result.errors
}
```

## Available JSON Schema

| Name                                                    | Last version | Last version | Description                 |
| ------------------------------------------------------- | ------------ | ------------ | --------------------------- |
| [Invoice](/packages/data-format/src/format/rnf_invoice) | rnf_invoice  | 0.0.3        | Format to create an invoice |

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
[Read the contributing guide](/CONTRIBUTING.md)

## License

[MIT](/LICENSE)
npm package: @huma-shan/epk-decryption
Description: Decryption provider using ethereum private keys.
Latest version: 0.7.0

# @huma-shan/epk-decryption

Ethereum Private Key Decryption Provider.

`@huma-shan/epk-decryption` is a typescript library part of the [Request Network protocol](https://github.com/RequestNetwork/requestNetwork).

Implementation of the decryption provider from the private keys.
The decryption provider is used to make decryption in the Request Network Protocol (e.g.: see [Transaction Manager](/packages/transaction-manager)).

It uses the Request Network Protocol concept of `Identity` described in the [request logic specification](/packages/request-logic/specs/request-logic-specification.md).

## Installation

```bash
npm install @huma-shan/epk-decryption
```

## Usage

```javascript
import { EncryptionTypes, IdentityTypes } from '@huma-shan/types'

import EthereumPrivateKeyDecryptionProvider from '@huma-shan/epk-decryption'

const decryptionParametersExample: EncryptionTypes.IDecryptionParameters = {
  key: '0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3',
  method: EncryptionTypes.METHOD.ECIES,
};

// Identity from the previous signature parameter
const identityExample: IdentityTypes.IIdentity = {
  type: IdentityTypes.TYPE.ETHEREUM_ADDRESS,
  value: '0x627306090abab3a6e1400e9345bc60c78a8bef57'
};

// Construct the provider with a
const decryptionProvider = new EthereumPrivateKeyDecryptionProvider(decryptionParametersExample);

// can list the identity usable
const listOfAvailableIdentity = decryptionProvider.getAllRegisteredIdentities(); // [identityExample]

// can decrypt data with identity
const dataToDecrypt = "02....";
const decryptedData = await decryptionProvider.decrypt(dataToDecrypt, identityExample); // "Decrypted data..."

// can add a new decryption parameters
decryptionProvider.addDecryptionParameters({method: EncryptionTypes.METHOD.ECIES, key: ...});

// can remove a decryption parameters from its identity
decryptionProvider.removeRegisteredIdentity({type: IdentityTypes.TYPE.ETHEREUM_ADDRESS, value: ...});

// can remove all decryption parameters
decryptionProvider.clearAllRegisteredIdentities();
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
[Read the contributing guide](/CONTRIBUTING.md)

## License

[MIT](/LICENSE)
npm package: @huma-shan/epk-signature
Description: Signature provider using ethereum private keys.
Latest version: 0.9.0

# @huma-shan/epk-signature

Ethereum Private Key Signature Provider.

`@huma-shan/epk-signature` is a typescript library part of the [Request Network protocol](https://github.com/RequestNetwork/requestNetwork).

Implementation of the signature provider from the private keys.
The signature provider is used to make signature in the Request Network Protocol (e.g.: see [Request Logic](/packages/request-logic)).

It uses the Request Network Protocol concepts of `Identity` and `Signature` described in the [request logic specification](/packages/request-logic/specs/request-logic-specification-v2.0.0.md).

## Installation

```bash
npm install @huma-shan/epk-signature
```

## Usage

```javascript
import { IdentityTypes,  SignatureTypes } from '@huma-shan/types'

import EthereumPrivateKeySignatureProvider from '@huma-shan/epk-signature'

const signatureParametersExample: SignatureTypes.ISignatureParameters = {
  method: SignatureTypes.METHOD.ECDSA,
  privateKey: '0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3',
};

// Identity from the previous signature parameter
const identityExample: IdentityTypes.IIdentity = {
  type: IdentityTypes.TYPE.ETHEREUM_ADDRESS,
  value: '0x627306090abab3a6e1400e9345bc60c78a8bef57'
};

// Construct the provider with a
const signatureProvider = new EthereumPrivateKeySignatureProvider(signatureParametersExample);

// can list the identity usable
const listOfAvailableIdentity = signatureProvider.getAllRegisteredIdentities(); // [identityExample]

// can sign data with identity
const dataToSign = { ... };
const signedData = await signatureProvider.sign(dataToSign, identityExample); // { data: { ... }, signature: { method: SignatureTypes.METHOD.ECDSA, value: '0x...' }}

// can add a new signature parameters
signatureProvider.addSignatureParameters({method: ..., privateKey: ...});

// can remove a signature parameters from its identity
signatureProvider.removeRegisteredIdentity({type: ..., value: ...});

// can remove all signature parameters
signatureProvider.clearAllRegisteredIdentities();
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
[Read the contributing guide](/CONTRIBUTING.md)

## License

[MIT](/LICENSE)
npm package: @huma-shan/multi-format
Description: Multi-format for Request Network packages.
Latest version: 0.18.0

# @huma-shan/multi-format

`@huma-shan/multi-format` is a typescript library part of the [Request Network protocol](https://github.com/RequestNetwork/requestNetwork).
It allows to serialize and deserialize object in the Request Network protocol.

## Installation

```bash
npm install @huma-shan/multi-format
```

## Usage

```javascript
import MultiFormat from '@huma-shan/multi-format';
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
[Read the contributing guide](/CONTRIBUTING.md)

## License

[MIT](/LICENSE)
npm package: @huma-shan/multi-formatt
Description: Multi-format for Request Network packages.
Latest version: 0.19.0

# @huma-shan/multi-formatt

`@huma-shan/multi-formatt` is a typescript library part of the [Request Network protocol](https://github.com/RequestNetwork/requestNetwork).
It allows to serialize and deserialize object in the Request Network protocol.

## Installation

```bash
npm install @huma-shan/multi-formatt
```

## Usage

```javascript
import MultiFormat from '@huma-shan/multi-formatt';
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
[Read the contributing guide](/CONTRIBUTING.md)

## License

[MIT](/LICENSE)
npm package: @huma-shan/payment-processor
Description: Payment processing using ethers.
Latest version: 0.42.0

# @huma-shan/payment-processor

`@huma-shan/payment-processor` is a typescript library part of the [Request Network protocol](https://github.com/RequestNetwork/requestNetwork).
It contains client-side payment methods for:

- ERC20 proxy contract
- ETH input data

### Test

To run the payment-processor tests we need a local running ganache with all our smart contracts deployed.
Do not define "NETWORK" variable in the smart-contracts .env file.
You can open two terminals and do:

```
# Terminal 1
cd ../smart-contracts/
yarn ganache

# Terminal 2
cd ../smart-contracts/
yarn deploy
cd ../payment-processor
yarn test
```

### Basic Usage

see [ERC20](/packages/usage-examples/src/pay-erc20-request.ts) and [ETH](/packages/usage-examples/src/pay-eth-request.ts) usage examples.
npm package: @huma-shan/request-logic
Description: Main package for the Request Network logic layer.
Latest version: 0.31.0

# @huma-shan/request-logic

`@huma-shan/request-logic` is a typescript library part of the [Request Network protocol](https://github.com/RequestNetwork/requestNetwork).
It is the default implementation of the Request Logic layer. This layer is responsible for the business logic: properties and actions of requests.

Request logic creates actions, that are signed and sends them to the layer below, Transaction.

## Installation

```bash
npm install @huma-shan/request-logic
```

## Usage

See [packages/usage-examples/request-logic.ts](`packages/usage-examples/src/request-logic.ts`).

## Features

- `createRequest` : create a request
- `createEncryptedRequest` : create an encrypted request
- `acceptRequest` : accept a request
- `cancelRequest` : cancel a request
- `increaseExpectedAmountRequest` : increase the amount of a request
- `reduceExpectedAmountRequest` : reduce the amount of a request
- `getFirstRequestFromTopic` : get the first request from the actions indexed by a topic (should be used with requestId)
- `getRequestsByTopic` : get all the requests for a topic
- `computeRequestId` : compute the ID of a request before actually creating it.

## Action topics

When an action is sent to the Transaction layer, strings named topics can be attached to it. These topics are used to index the action and, therefore, allow to retrieve it later in order to reconstruct the request.

Every action has at least its request id as a topic.

When creating a request, arbitrary topics can be attached to the `createRequest` action to index the request. For example, it can be the identity of the request creator in order to be able, later, to retrieve every request created by a user. Other actions than `createRequest` doesn't need additional topics since it contains the request id that can be linked to the corresponding `createRequest` action of the request.

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
[Read the contributing guide](/CONTRIBUTING.md)

## License

[MIT](/LICENSE)