open-index/open-npm huggingface dataset:
npm package: 3pi
Description: The NPM package to interact with 3PI contracts.
Author: Ncookie
Latest version: 1.0.3

# SDK

The NPM package to interact with 3PI contracts.

![CodeQL](https://github.com/3PIKeys/sdk/actions/workflows/codeql-analysis.yml/badge.svg)
![Version](https://img.shields.io/github/package-json/v/3PIKeys/sdk)
![Downloads](https://img.shields.io/npm/dw/3pi)

![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white)
![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge&logo=typescript&logoColor=white)

## Usage

Install the package using the following:

```
npm i 3pi
```

Importing the package can be done through the following:

```ts
import { KeyManager } from '3pi';
```

The `KeyManager` class includes all the functionality of 3PI, including functions like `isKeyActive()`, `getExpiry()`, `extendKey()`, etc.

It also exposes attributes like `contractAddress`, `providers` and `contractToken` for ease of use.

In order to initialize `KeyManager`, you will need to provide it with the contract address of your 3PI Key Manager contract on-chain, as well as at least 1 RPC URL to use when querying data. The more RPCs you add, the more robust the queries will be, since extra RPCs are used when any call fails.

You can initialize `KeyManager` as follows:

```ts
const keyManager = new KeyManager('<YOUR_CONTRACT_ADDRESS_HERE>', ['<YOUR_RPC_URL_HERE>']);
```

## Functions Available

### Read Only
- `isTierActive(tierID)`
- `getTierPrice(tierID)`
- `getNumTiers()`
- `getNumKeys()`
- `isKeyActive(hash)`
- `keyExists(hash)`
- `getKeyHash(id)`
- `getUserKeys(address)`
- `getRemainingBalance(hash)`
- `getUsedBalance(hash)`
- `getKeyInfo(hash)`
- `findUnrealizedAccounts()`
- `getRealizedProfit()`
- `getUnrealizedProfit()`

### Key Management
- `approve(amountInWei, signer)`
- `activateKey(hash, duration, tierID, signer)`
- `extendKey(hash, duration, signer)`
- `deactivateKey(hash, signer)`

### Admin Controls
- `addTier(price, signer)`
- `archiveTier(tierId, signer)`
- `realizeProfit(hash, signer)`
- `withdraw(signer)`

### Other
- `getPublicHash(apiKey)`
- `generateNewKey()`
- `getWalletBalance(wallet)`
- `getWalletAllowance(wallet)`

## Types

The SDK is written entirely in TypeScript, and any types used within the SDK are located in the `src/types.ts` file.

If needed, these can be imported from `3pi/dist/types` as follows:

```ts
import type { Address, ABIEntry } from '3pi/dist/types';
```
npm package: 3pl-central
Description: 3PL Central API Wrapper
Author: Gabriel Bull
Latest version: 0.1.7

# 3PL Central

## Microservice

Config in `.env` file.

```
docker pull smartio/3pl-central
docker run -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 25672:25672 it --rm --name 3pl-central smartio/3pl-central 
```

## Docker Compose

```yaml
3pl-central:
  env_file: .env
  image: smartio/3pl-central
  volumes:
   - "/mnt/sda1/var/3pl_central_data:/data/db"
  ports:
    - "4369:4369"
```

## Usage

### Listen to new orders
 
```js
import { connect, listen } from '3pl-central';

connect(host)
  .then(client => {
    client.on('newOrder', order => console.log(order));
  })
  .then(listen);
```

### Find orders
 
```js
import { connect, close, findOrders } from '3pl-central';
import moment from 'moment';

connect(host)
  .then(() => findOrders(moment().subtract(14, 'days')))
  .then(orders => console.log(orders))
  .then(close);
```

### Data Structure

#### Order

```
CustomerName
CustomerEmail
CustomerPhone
Facility
FacilityID
WarehouseTransactionID
ReferenceNum
PONum
Retailer
ShipToCompanyName
ShipToName
ShipToEmail
ShipToPhone
ShipToAddress1
ShipToAddress2
ShipToCity
ShipToState
ShipToZip
ShipToCountry
ShipMethod
MarkForName
BatchOrderID
CreationDate
EarliestShipDate
ShipCancelDate
PickupDate
Carrier
BillingCode
TotWeight
TotCuFt
TotPackages
TotOrdQty
TotLines
Notes
OverAllocated
PickTicketPrintDate
ProcessDate
TrackingNumber
LoadNumber
BillOfLading
MasterBillOfLading
ASNSentDate
ConfirmASNSentDate
RememberRowInfo
```
npm package: 3ps-node
Description: Node.js SDK for 3PS
Author: Anthony Budd
Latest version: 1.4.3

<p align="center">
  <img width="192" src="https://ideea.io/static/img/3ps.png" alt="3PS">
</p>

---

### [3PS](https://ideea.io/3ps) &nbsp;&nbsp;|&nbsp;&nbsp; [Ideea.io](https://ideea.io) &nbsp;&nbsp;|&nbsp;&nbsp; [Full Documentation](https://ideea.io/docs/3ps) &nbsp;&nbsp;|&nbsp;&nbsp; [NPM](https://www.npmjs.com/package/3ps-node)

---

# 3PS Node SDK

The 3PS API represents an abstraction of a 3D printer, with this API you can upload a .STL file and receive a tangible object just hours later. With this API you can print in any material, at any size, shipped anywhere in the world. Add 3D printing to your app, product or service in a matter of minutes with 3PS.

## Installation

```
$ npm install 3ps-node
```

## Getting Started

```js
const TPS = require('3ps-node')
const fs = require('fs')

var tps = new TPS('API_KEY')

var component = {
	name: 'Dice',
	is_public: false,
	group_id: '00ffedbb-ff29-5138-9b5d-cd1f6ae3bc6b',

	// .stl File
	stl: fs.readFileSync('./dice.stl'),

	// Default Print Settings
	material: 'PLA',
	process: 'FDM',
	resolution: '200',
	infill: '20',
	color: 'Red',
}


// Create Component
tps.components.create(component).then(function(newComponent) {

	// Print Component
	tps.jobs.create({
		group_id: '00ffedbb-ff29-5138-9b5d-cd1f6ae3bc6b',
		fulfillment_type: 'standard',
		components: [{
			id: newComponent.id
		}]
	}).then(function(job) {
		console.log(`Printing ${job.id}`)
	})
})
```

## Methods

Please refer to the [full documentation](https://ideea.io/3ps/docs) for the full list of methods.

### TPS.components.create(component)
In 3PS a component represents a single .STL file and an object is a collection of multiple components. Your component can be public or private, public components are accessible by all users and can be printed by anyone. You can also set your component’s default print settings for easy replication.

```js
tps.components.create({
	name: 'Dice',
	is_public: false,
	group_id: '00ffedbb-ff29-5138-9b5d-cd1f6ae3bc6b',

	// .stl File
	stl: fs.readFileSync('./dice.stl'),

	// Default Print Settings
	material: 'PLA',
	process: 'FDM',
	resolution: '200',
	infill: '20',
	color: 'Red',
}).then((component) => {

	console.log(component)

})
```

### TPS.jobs.create(job)
A job reprsents a request from a customer to print one or more componets. To create a job send an array of objects and compoents using method TPS.job.create().

```js
tps.jobs.create({
	group_id: '00ffedbb-ff29-5138-9b5d-cd1f6ae3bc6b',
	components: [{
		id: 'cead04bc-cf4f-402a-8e90-1f33669efa03'
	}]
}).then((job) => {

	console.log(`Printing Job: ${job.id}`)

})
```