open-index/open-npm huggingface dataset:
npm package: @prepaid-gas/constants
Description: Shared constants for Prepaid Gas packages
Latest version: 0.0.6

# @prepaid-gas/constants

Shared constants, contract ABIs, and network configurations for the Prepaid Gas packages.

## Installation

```bash
npm install @prepaid-gas/constants
```

## Quick Start

### Using Contract ABIs

```typescript
import {
  GAS_LIMITED_PAYMASTER_ABI,
  ONE_TIME_USE_PAYMASTER_ABI,
  CACHE_ENABLED_GAS_LIMITED_PAYMASTER_ABI,
} from '@prepaid-gas/constants';
import { createPublicClient, http } from 'viem';

const client = createPublicClient({
  chain: baseSepolia,
  transport: http(),
});

// Read from paymaster contract
const scope = await client.readContract({
  abi: GAS_LIMITED_PAYMASTER_ABI,
  address: '0x3BEeC075aC5A77fFE0F9ee4bbb3DCBd07fA93fbf',
  functionName: 'SCOPE',
});
```

### Network Configuration

```typescript
import { getNetworkPreset, getSupportedChainIds, BASE_SEPOLIA_PRESET } from '@prepaid-gas/constants';

// Get configuration for Base Sepolia
const config = getNetworkPreset(84532);
console.log(config?.paymasterAddress.GasLimitedPaymaster);

// Use preset directly
console.log(BASE_SEPOLIA_PRESET.paymasterAddress.GasLimitedPaymaster);
// "0xA1c868aD7fae4159f07493df22E5004aaDb5467D"
```

### Constants

```typescript
import { POST_OP_GAS_LIMIT, POOL_ROOT_HISTORY_SIZE, EXPECTED_PAYMASTER_DATA_SIZE } from '@prepaid-gas/constants';

console.log('Post-op gas limit:', POST_OP_GAS_LIMIT); // 65000n
console.log('Pool root history size:', POOL_ROOT_HISTORY_SIZE); // 64
console.log('Paymaster data size:', EXPECTED_PAYMASTER_DATA_SIZE); // 448
```

## Available Exports

### Contract ABIs

- `GAS_LIMITED_PAYMASTER_ABI` - Multi-use gas credits with limits
- `ONE_TIME_USE_PAYMASTER_ABI` - Single-use credits with nullifier tracking
- `CACHE_ENABLED_GAS_LIMITED_PAYMASTER_ABI` - Optimized multi-use with caching

### Network Presets

- `BASE_SEPOLIA_PRESET` - Base Sepolia network configuration
- `getNetworkPreset(chainId)` - Get preset by chain ID
- `getSupportedChainIds()` - List supported chain IDs

### Constants

- `POST_OP_GAS_LIMIT` - Gas limit for post-operation processing (65000n)
- `POOL_ROOT_HISTORY_SIZE` - Number of Merkle roots to maintain (64)
- `EXPECTED_PAYMASTER_DATA_SIZE` - Size of paymaster data in bytes (448)
- `CONFIG_SIZE`, `PRIVACY_PROOF_SIZE` - Data structure sizes

### Network Types

```typescript
import type { ChainId, NetworkPreset, PaymasterType } from '@prepaid-gas/constants';
```

## Supported Networks

| Network      | Chain ID | Status    |
| ------------ | -------- | --------- |
| Base Sepolia | 84532    | ✅ Active |

## License

MIT
npm package: @prepaid-gas/data
Description: Data layer for Prepaid Gas with fluent query builders
Latest version: 0.0.6

# @prepaid-gas/data

Type-safe GraphQL client and query builders for the Prepaid Gas subgraph.

## Installation

```bash
npm install @prepaid-gas/data
```

## Quick Start

### Basic Usage

```typescript
import { SubgraphClient } from '@prepaid-gas/data';

// Create client for Base Sepolia
const client = SubgraphClient.createForNetwork(84532);

// Query deposit activities
const activities = await client
  .query()
  .depositActivities()
  .byPaymasterAddress('0x3BEeC075aC5A77fFE0F9ee4bbb3DCBd07fA93fbf')
  .orderBy('timestamp', 'desc')
  .limit(50)
  .execute();

console.log('Found activities:', activities.length);
```

### Advanced Querying

```typescript
// Query user operations with filtering
const userOps = await client
  .query()
  .userOperations()
  .byPaymasterAddress('0x3BEeC075aC5A77fFE0F9ee4bbb3DCBd07fA93fbf')
  .successful()
  .orderBy('timestamp', 'desc')
  .limit(25)
  .executeAndSerialize(); // Returns serialized data (BigInt → string)
```

## Core API

### SubgraphClient

```typescript
// Factory method (recommended)
SubgraphClient.createForNetwork(chainId: number)

// Constructor
new SubgraphClient(chainId: number, options?: {
  subgraphUrl?: string;
  timeout?: number;
})
```

### Query Builders

#### Deposit Activities

```typescript
const activities = await client
  .query()
  .depositActivities()
  .byPaymasterAddress('0x...')
  .byCommitment('123...')
  .orderBy('timestamp', 'desc')
  .limit(100)
  .execute();
```

#### User Operations

```typescript
const userOps = await client
  .query()
  .userOperations()
  .byPaymasterAddress('0x...')
  .bySender('0x...')
  .successful() // or .failed()
  .orderBy('timestamp', 'desc')
  .execute();
```

#### Paymaster Contracts

```typescript
const paymasters = await client.query().paymasterContracts().byAddress('0x...').isActive().execute();
```

### Execution Methods

```typescript
.execute()               // Returns entities with BigInt values
.executeAndSerialize()   // BigInt values converted to strings
.first()                 // Get first result
.count()                 // Count results
```

## Data Types

### DepositActivity

```typescript
interface DepositActivity {
  id: string;
  transactionHash: string;
  paymaster: string;
  commitment: string;
  amount: bigint;
  timestamp: bigint;
}
```

### UserOperation

```typescript
interface UserOperation {
  id: string;
  userOpHash: string;
  paymaster: string;
  sender: string;
  actualGasCost: bigint;
  actualGasUsed: bigint;
  success: boolean;
  timestamp: bigint;
}
```

## BigInt Serialization

```typescript
import { convertBigIntsToStrings, convertStringsToBigInts } from '@prepaid-gas/data';

// Convert any object for JSON compatibility
const serialized = convertBigIntsToStrings(data);
const deserialized = convertStringsToBigInts(serialized);
```

## Supported Networks

| Network      | Chain ID | Status    |
| ------------ | -------- | --------- |
| Base Sepolia | 84532    | ✅ Active |

## License

MIT
npm package: @prepair/basic-loader
Description: David Walsh's super simple loader for loading image, CSS, and JavaScript files.
Author: Szabolcs Kurdi
Latest version: 1.3.0

# basic-loader

David Walsh's [super simple loader](https://davidwalsh.name/javascript-loader) for loading image, CSS, and JavaScript files.

## installation

```shell
npm i -S @prepair/basic-loader
```

- Requires browser environment (dom).
- Transpiled to es2015+ie context (polyfills not included).

## usage

```
import load from '@prepair/basic-loader'

Promise.all([
  load.js('lib/highlighter.js'),
  load.js('lib/main.js'),
  load.css('lib/highlighter.css'),
  load.img('images/logo.png')
]).then(() => {
  console.log('Everything has loaded!');
}).catch(err => {
  console.log('Oh no, epic failure!');
});
```

## add optional attributes

```
load.js('lib/main.js', {
  'data-foo': 'new-attribute',
  'data-bar': 'new-attribute-2'
})
```

## caveats

- Loading is not sequential of course. In the above example "main.js" may be parsed
  before "highlighter.js". If you want in order loading, use a sequential promise
  executor or a then chain.
- Style loading may not work with very old mobile borwsers.
  [Followup is here](https://github.com/w3core/import.js/issues/2), see addendum below.
- The e2e test runner breaks (in phantom, but the test.html works in the browser)
  this is caused by an old phantomjs version in the _mocha-phantomjs_ package.
  [Issue is here](https://github.com/nathanboktae/mocha-phantomjs/issues/248). Solutions:
  - either wait for the upstream package to be updated
  - or update the binary manually (inside node_modules)

## exposed test

Temporarily the e2e standalone test page has been exposed to [docs](./docs) and is made
available as a [github page](https://prepair.github.io/basic-loader/).
TODO: use browserstack or smg similar?

- [x] Chrome/30 Mobile Safari/537.6 (android 4.4.2), from [2013](https://en.wikipedia.org/wiki/Safari_version_history)
- [x] iOS 10.2.1 (vanilla iphone 6)
- [x] Firefox 51.0.3 (android 4.4.2)
npm package: @prepair/ga-timing
Description: Google Analytics user timings helper for UI component metrics
Author: Zsolt Vad
Latest version: 2.0.2

# GA timing
Google Analytics user timing for UI components
## Installation
```bash
npm i -S @prepair/ga-timing
```
## Setup

```js
import { setup } from '@prepair/ga-timing';
import { myCustomGetStorageItem, myCustomSetStorageItem, myCustomGetConfig } from '../my-custom';

...

setup({
    isAutoReset: false,
    isTrackingEnabled: true,
    storageApi: {
        getItem: myCustomGetStorageItem,
        setItem: myCustomSetStorageItem
    },
    configApi: {
        get: myCustomGetConfig
    },
    googleAnalyticsApi: window.gtag
});
```

## Options
| name | type | default | description |
| - | - | - | - |
| key | **String** | `userTimingConfigurations` | the root key of the config JSON and the key for the storage item |
| isAutoReset | **Boolean** | `false`  | if `true` it loads the default configuration into the storage on every page load |
| isTrackingEnabled | **Boolean** | `true`  | if `false` it won't call the googleAnalyticsApi |
| storageApi | **Object** | [default implementation](../master/src/session-storage.js) | get and set methods for interacting the storage |
| configApi | **Object** | [default implementation](../master/src/request.js) | XHR request wrapper for config endpoint |
| googleAnalyticsApi | **Object** | `window.gtag` | Google Analytics gtag object |

## Example for config JSON
```json
{
  "userTimingConfigurations": [
    {
      "name": "timingCategory.childCategory",
      "conditions": {
        "interactivity": ["COND_0"],
        "loadCompletion": ["COND_1", "COND_2"]
      },
      "analytics": {
        "timingCategory": "Timing category / Child category"
      }
    }
  ]
}
```

## Tracking example
```js
import * as gaTiming from '@prepair/ga-timing';

const TIMING_CATEGORY = 'timingCategory.childCategory';

...

onStart () {
    gaTiming.startTracking(TIMING_CATEGORY);
    // OR gaTiming.startTracking(TIMING_CATEGORY, window.performance.timing.*)
}

...

componentReady () {
    gaTiming.fulfillCondition(TIMING_CATEGORY, 'COND_0');
    // emits the following GA 'timing' event
    // timingCategory: TIMING_CATEGORY, timingVar: 'Interactivity', timingVal: ~1000
}

onLoad1 () {
    gaTiming.fulfillCondition(TIMING_CATEGORY, 'COND_1');
}

onLoad2 () {
    gaTiming.fulfillCondition(TIMING_CATEGORY, 'COND_2');
    // emits the following GA 'timing' event
    // timingCategory: TIMING_CATEGORY, timingVar: 'Load completion', timingVal: ~2000
}

...

onSpecialEvent () {
	gaTiming.skipTracking(TIMING_CATEGORY);
}

...
```
npm package: @prepair/get-location
Description: Get geolocation with a promise.
Author: prepair
Latest version: 1.2.1

# get-location

Get geolocation with a promise.

## installation

```shell
npm i -S @prepair/get-location
```

* Requires browser environment (geolocation api).
* Transpiled to es2015+ie context (polyfills not included).

## usage

### hasGeoApi

```js
import { hasGeoApi } from '@prepair/get-location';

console.log(hasGeoApi); // true or false
```

### getLocation

```js
import getLocation from '@prepair/get-location';

getLocation({
    // https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions
    enableHighAccuracy: true,
    timeout: 5000,
    maximumAge: Infinity
    // extensions
    precision: 6
  })
  .then(loc => console.log(loc.coords))
  .catch(console.error);
```

### setup

```js
import getLocation, { setup as getLocationSetup } from '@prepair/get-location';

getLocationSetup({ precision: 0 });
getLocation().then(console.log);
```

## caveats

Using the additional parameters (`precision` for now) will clone the result object,
which would be read only otherwise. Clone deep is manual and deterministic, further
api changes in the `Geoposition` object will not be reflected. Do NOT use `instanceOf`
on the result.

## development

* the node context is not exactly the same as the browser context (hence the `typeof window`)
* `npm run release` now does a test build, so the release will **fail** if you have an outdated
  lib, in that case do a `chore(build): latest lib` commit
npm package: @prepair/locale-support
Description: Locale related data for prepair in a bundle.
Author: prepair
Latest version: 2.2.3

# locale-support

Locale related data in a neat bundle.

Warning: locale and currency connections are defined by @prepair specs
(meaning that even though in a country the standard currency may be XXX, we support payments in
YYY so we will use the latter in the config file).

## supported locales

```js
supportedLocales = ["ar-ae","bg-BG","bs-Latn-BA","ca-ES","cs-CZ","de-DE","el-GR","en-GB","es-ES","fr-FR","he-IL","hi-IN","hu-HU","it-IT","ka-GE","lt-LT","lv-LV","mk-MK","nb-NO","nl-NL","pl-PL","pt-PT","ro-RO","ru-RU","sk-SK","sq-AL","sr-Cyrl-CS","sv-SE","uk-UA","zh-CN"];
```

## installation

```shell
npm i -S @prepair/locale-support
```

* metadata code generator assumes a node context.
* use metadata in the browser with webpack or browserify.
* use generated code in your own repository.

## usage

### metadata

```js
import { metadata } from '@prepair/locale-support';
```

* contains locale data for [accounting](http://openexchangerates.github.io/accounting.js/)
* contains currency data (code, short symbol, precision)

### mod rewrite partial regexp

Returns a regexpish partial string for mod rewrite, created from the dotnet lang ids.

For example: `bg-bg|bs-latn-ba|cs-cz`

```js
const localeSupport = require('@prepair/locale-support');
const ruleChunk = localeSupport.getModRewriteRex();
```

* with no params it returns all the lang ids
* ids are sorted before concatenation
* `localeSupport.getModRewriteRex({rtl: true})` - rtl only ids
* `localeSupport.getModRewriteRex({rtl: false})` - non rtl only ids

## adding new locales

Add new data to _./src/config.js_

* .NET locale id (see: http://www.localeplanet.com/)
* currency preferred by @prepair
* cldr id

then run `npm run build`.

## TODO

* refactor "src - lib - lib-es5" so that instead of 2 build cycles we should use 1
* transpile config.js, before someone accidentally adds an es6 keyword there
npm package: @prepair/parse-price
Description: Parse price text into currency and value.
Author: Szabolcs Kurdi
Latest version: 1.1.6

# parse-price

Parse price text into currency and value.

```
"US$238.27"  --> { currencyCode: 'USD', value: 238.27 }
"221,81 €"   --> { currencyCode: 'EUR', value: 221.81 }
```

* Supported currencies: AED, BAM, BGN, CHF, CZK, DKK, EUR, GBP, GEL, HRK, HUF, ILS, LVL, MKD, NOK, PLN, RON, RSD, RUB, SEK, UAH, USD
* Will not be supported: BHD, IQD, JOD, KWD, LYD, OMR, TND
* Exact list may be found in [locale-support](https://github.com/prepair/locale-support) package.

## installation

```
npm i -S @prepair/parse-price
```

Requires node v6+ context.

## usage

```
const parsePrice = require('@prepair/parse-price');

console.log(parsePrice('MKD12,955.86'));
```

## development

Do not forget to `npm run build`, or set it up in the CI.
npm package: @prepair/routie
Description: Tiny little hash routing library
Author: Zsolt Vad
Latest version: 1.0.3

# Routie

Originally repo here: https://github.com/jgallen23/routie


Routie is a javascript hash routing library.  It is designed for scenarios when push state is not an option (IE8 support, static/Github pages, Phonegap, simple sites, etc). It is very tiny (800 bytes gzipped), and should be able to handle all your routing needs.

## Basic Usage

There are three ways to call routie:

Here is the most basic way:

```js
routie('users', function() {
  //this gets called when hash == #users
});
```

If you want to define multiple routes you can pass in an object like this:

```js
routie({
  'users': function() {

  },
  'about': function() {
  }
});
```

If you want to trigger a route manually, you can call routie like this:

```js
routie('users/bob');  //window.location.hash will be #users/bob
```

## Regex Routes

Routie also supports regex style routes, so you can do advanced routing like this:

```js
routie('users/:name', function(name) {
  //name == 'bob';
});
routie('users/bob');
```

### Optional Params:
```js
routie('users/:name?', function(name) {
  //name == undefined
  //then
  //name == bob
});
routie('users/');
routie('users/bob');
```

### Wildcard:
```js
routie('users/*', function() {
});
routie('users/12312312');
```

### Catch All:
```js
routie('*', function() {
});
routie('anything');
```

## Named Routes

Named routes make it easy to build urls for use in your templates.  Instead of re-creating the url, you can just name your url when you define it and then perform a lookup.  The name of the route is optional.  The syntax is "\[name\] \[route\]".

```js
routie('user users/:name', function() {});
```

then in your template code, you can do:

```js
routie.lookup('user', { name: 'bob'}) // == users/bob
```


## Dependencies

None

## Supports

Any modern browser and IE8+
npm package: @prepared/promise-helpers
Description: A bunch of useful helpers for working with promises and async things
Latest version: 0.0.1

# @prepared/promise-helpers

A bunch of useful helpers for working with promises and async things

## Installation

```sh
yarn add @prepared/promise-helpers
```

## API

### Completer

A `Completer` is a promise-like class that can be resolved or rejected imperatively.

#### Example

```ts
import { Completer } from "@prepared/promise-helpers";

// Completer accepts a generic type argument for the expected type to be
// returned when the completer's promise is resolved
const completer = new Completer<string>();

// Completers can be awaited, or you can use the `.then` method
// Completers also expose their promise (i.e. `completer.promise`)
completer.then((result) => {
  console.log(result);
});

// Calling `.resolve` will resolve the completer's promise
// In this case, we should see "Hello world" logged into the console
completer.resolve("Hello world");
```