open-index/open-npm huggingface dataset:
npm package: @phuture/meta-router
Description: This library was generated with [Nx](https://nx.dev).
Latest version: 0.4.11

# auto-router

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build meta-router` to build the library.

## Running unit tests

Run `nx test meta-router` to execute the unit tests via [Jest](https://jestjs.io).
npm package: @phuture/price-oracle
Description: This library was generated with [Nx](https://nx.dev).
Latest version: 0.4.11

# price-oracle

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build price-oracle` to build the library.

## Running unit tests

Run `nx test price-oracle` to execute the unit tests via [Jest](https://jestjs.io).
npm package: @phuture/savings-vault
Description: This library was generated with [Nx](https://nx.dev).
Latest version: 0.4.11

# savings-vault

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build savings-vault` to build the library.

## Running unit tests

Run `nx test savings-vault` to execute the unit tests via [Jest](https://jestjs.io).
npm package: @phuture/sdk
Description: Phuture SDK is a JS library for using functionality related to defi indices made by [Phuture Finance](https://www.phuture.finance/) team.
Latest version: 1.0.3

# Phuture SDK

Phuture SDK is a JS library for using functionality related to defi indices made by [Phuture Finance](https://www.phuture.finance/) team.

## Installation

```bash
npm i @phuture/sdk
```

## Usage

### AutoRouter

AutoRouter package has been created to find the best deal to buy or sell an index based on gas price and returned amount. Depending on results this package can return mint/redeem transaction from Phuture's IndexRouter contract or 0x swap transaction.

```typescript
import {
  AutoRouter,
  Erc20,
  IndexRouter,
  ZeroExAggregator,
} from '@phuture/sdk'
import { ethers } from 'ethers'

const amount = '1000'
const account = new ethers.Wallet('PRIVATE_KEY', ethers.getDefaultProvider())

const indexRouter = new IndexRouter(account)
const zeroAggregator = new ZeroExAggregator()

const autoRouter = new AutoRouter(indexRouter, zeroAggregator)

// handle buy
autoRouter.autoBuy(indexTokenInterface, amount, erc20)

// handle sell
autoRouter.autoSell(indexTokenInterface, amount, erc20)
```

### 0x Aggregator

ZeroEx Aggregator package has been created to use methods related for managing Phuture's Index on most compatible defi exchanges

```typescript
import { Index, ZeroExAggregator } from '@phuture/sdk'
import { ethers } from 'ethers'

const amount = '1000000000000000';
const indexPDI = 'INDEX_CONTRACT';

const zeroAggregator = new ZeroExAggregator()

// get WETH/PDI swap params
const {
  buyAmount: buyAssetMinAmount,
  to: swapTarget,
  data: assetQuote,
} = await zeroEx.quote(
  '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH
  indexPDI,
  amount,
)
```
npm package: @phuture/subgraph
Description: Access Phuture's Subgraph
Latest version: 0.4.11

# Subgraph Client

Access Phuture's Subgraph

## Introduction

This is the graphQL package used by Phuture SDK.

# Getting started with development

In this section we will take a look at how to get up and running with this package.

Assuming you have correctly run all the Phuture SDK install commands. If not, take a look at the root Phuture SDK readme for more details.

## Building

Run `nx build subgraph` to build the library.

## Running unit tests

Run `nx test subgraph` to execute the unit tests via [Jest](https://jestjs.io).

## Adding a schema

in the `schemas` subdirectory, you can add queries to the liquidity subgraph or the Phuture subgraph by creating a `.graphql` file that conforms with [graphQL Queries and Mutations](https://graphql.org/learn/queries/)

Once done, run:

> npm generate

This will build a new SDK with the queries strongly typed and ready to go.
npm package: @phygitallabs/portal-platform
Description: This package provides a comprehensive platform setup with Firebase integration, authentication, and various UI components.
Latest version: 6.8.1

# Platform Package

This package provides a comprehensive platform setup with Firebase integration, authentication, and various UI components.

## Firebase Configuration

### New Dynamic Configuration (Recommended)

Instead of hardcoding Firebase config in JSON files, you can now pass the configuration dynamically through the provider:

```tsx
import { PlatformProvider, FirebaseConfig } from "@phygitallabs/portal-platform";

const firebaseConfig: FirebaseConfig = {
  apiKey: process.env.REACT_APP_FIREBASE_API_KEY!,
  authDomain: process.env.REACT_APP_FIREBASE_AUTH_DOMAIN!,
  projectId: process.env.REACT_APP_FIREBASE_PROJECT_ID!,
  storageBucket: process.env.REACT_APP_FIREBASE_STORAGE_BUCKET!,
  messagingSenderId: process.env.REACT_APP_FIREBASE_MESSAGING_SENDER_ID!,
  appId: process.env.REACT_APP_FIREBASE_APP_ID!,
  measurementId: process.env.REACT_APP_FIREBASE_MEASUREMENT_ID,
};

function App() {
  return (
    <PlatformProvider
      baseURL="https://your-api-url.com"
      firebaseConfig={firebaseConfig}
    >
      {/* Your app content */}
    </PlatformProvider>
  );
}
```

### Using Firebase Services

Use the provided hooks to access Firebase services:

```tsx
import {
  useFirebaseAuth,
  useFirebaseFirestore,
  useFirebaseStorage,
  useFirebaseAuthActions,
} from "@phygitallabs/portal-platform";

function MyComponent() {
  const auth = useFirebaseAuth();
  const firestore = useFirebaseFirestore();
  const storage = useFirebaseStorage();
  const { signInWithEmail, signInWithGoogle } = useFirebaseAuthActions();

  const handleLogin = async () => {
    try {
      await signInWithEmail("user@example.com", "password");
    } catch (error) {
      console.error("Login failed:", error);
    }
  };

  return <button onClick={handleLogin}>Login</button>;
}
```

### Migration from Static Config

If you're migrating from the old static configuration (`firebase_config.json`):

1. Remove the `firebase_config.json` file
2. Update your `PlatformProvider` to accept `firebaseConfig` prop
3. Pass your Firebase configuration through environment variables or other secure methods
4. Update any direct Firebase imports to use the new hooks

### Legacy Support

The package still provides backward compatibility for existing static Firebase imports, but they will show deprecation warnings and require the FirebaseProvider context.

## Environment Variables

Set up your environment variables:

```env
REACT_APP_FIREBASE_API_KEY=your-api-key
REACT_APP_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
REACT_APP_FIREBASE_PROJECT_ID=your-project-id
REACT_APP_FIREBASE_STORAGE_BUCKET=your-project.appspot.com
REACT_APP_FIREBASE_MESSAGING_SENDER_ID=123456789
REACT_APP_FIREBASE_APP_ID=1:123456789:web:abcdef
REACT_APP_FIREBASE_MEASUREMENT_ID=G-ABCDEF123
```