@0xbow/privacy-pools-core-sdk 0.0.0-b21c14ba
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/dist/esm/fetchArtifacts.esm-TV4yMbDL.js +18 -0
- package/dist/esm/fetchArtifacts.esm-TV4yMbDL.js.map +1 -0
- package/dist/esm/fetchArtifacts.node-DC_rCgt3.js +31 -0
- package/dist/esm/fetchArtifacts.node-DC_rCgt3.js.map +1 -0
- package/dist/esm/index-Bw-RoJy9.js +70373 -0
- package/dist/esm/index-Bw-RoJy9.js.map +1 -0
- package/dist/esm/index.mjs +7 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/index.d.mts +1222 -0
- package/dist/node/fetchArtifacts.esm-i9-c1RlE.js +35 -0
- package/dist/node/fetchArtifacts.esm-i9-c1RlE.js.map +1 -0
- package/dist/node/fetchArtifacts.node-C5OS73zV.js +48 -0
- package/dist/node/fetchArtifacts.node-C5OS73zV.js.map +1 -0
- package/dist/node/index-BogHNKL8.js +77423 -0
- package/dist/node/index-BogHNKL8.js.map +1 -0
- package/dist/node/index.mjs +24 -0
- package/dist/node/index.mjs.map +1 -0
- package/dist/types/abi/ERC20.d.ts +38 -0
- package/dist/types/abi/IEntrypoint.d.ts +823 -0
- package/dist/types/abi/IPrivacyPool.d.ts +51 -0
- package/dist/types/circuits/circuits.impl.d.ts +120 -0
- package/dist/types/circuits/circuits.interface.d.ts +129 -0
- package/dist/types/circuits/fetchArtifacts.d.ts +1 -0
- package/dist/types/circuits/fetchArtifacts.esm.d.ts +1 -0
- package/dist/types/circuits/fetchArtifacts.node.d.ts +1 -0
- package/dist/types/circuits/index.d.ts +2 -0
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/core/account.service.d.ts +345 -0
- package/dist/types/core/bruteForce.service.d.ts +61 -0
- package/dist/types/core/commitment.service.d.ts +30 -0
- package/dist/types/core/contracts.service.d.ts +114 -0
- package/dist/types/core/data.service.d.ts +52 -0
- package/dist/types/core/sdk.d.ts +45 -0
- package/dist/types/core/withdrawal.service.d.ts +32 -0
- package/dist/types/crypto.d.ts +67 -0
- package/dist/types/dirname.helper.d.ts +2 -0
- package/dist/types/errors/account.error.d.ts +10 -0
- package/dist/types/errors/base.error.d.ts +53 -0
- package/dist/types/errors/data.error.d.ts +7 -0
- package/dist/types/errors/events.error.d.ts +9 -0
- package/dist/types/exceptions/circuitInitialization.exception.d.ts +3 -0
- package/dist/types/exceptions/fetchArtifacts.exception.d.ts +3 -0
- package/dist/types/exceptions/index.d.ts +4 -0
- package/dist/types/exceptions/invalidRpcUrl.exception.d.ts +3 -0
- package/dist/types/exceptions/privacyPool.exception.d.ts +13 -0
- package/dist/types/external.d.ts +7 -0
- package/dist/types/fetchArtifacts.esm-CwvN5XjW.js +34 -0
- package/dist/types/fetchArtifacts.node-VEzDC3k8.js +47 -0
- package/dist/types/filename.helper.d.ts +2 -0
- package/dist/types/index-CPuQ9H-0.js +77436 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.js +23 -0
- package/dist/types/interfaces/blockchainProvider.interface.d.ts +12 -0
- package/dist/types/interfaces/circuits.interface.d.ts +30 -0
- package/dist/types/interfaces/contracts.interface.d.ts +35 -0
- package/dist/types/interfaces/index.d.ts +1 -0
- package/dist/types/internal.d.ts +6 -0
- package/dist/types/keys.d.ts +18 -0
- package/dist/types/providers/blockchainProvider.d.ts +8 -0
- package/dist/types/providers/index.d.ts +1 -0
- package/dist/types/types/account.d.ts +31 -0
- package/dist/types/types/commitment.d.ts +48 -0
- package/dist/types/types/events.d.ts +72 -0
- package/dist/types/types/index.d.ts +3 -0
- package/dist/types/types/keys.d.ts +5 -0
- package/dist/types/types/withdrawal.d.ts +30 -0
- package/dist/types/utils/logger.d.ts +22 -0
- package/package.json +81 -0
- package/src/abi/ERC20.ts +222 -0
- package/src/abi/IEntrypoint.ts +1059 -0
- package/src/abi/IPrivacyPool.ts +576 -0
- package/src/circuits/circuits.impl.ts +232 -0
- package/src/circuits/circuits.interface.ts +166 -0
- package/src/circuits/fetchArtifacts.esm.ts +12 -0
- package/src/circuits/fetchArtifacts.node.ts +23 -0
- package/src/circuits/fetchArtifacts.ts +7 -0
- package/src/circuits/index.ts +2 -0
- package/src/constants.ts +3 -0
- package/src/core/account.service.ts +1093 -0
- package/src/core/bruteForce.service.ts +120 -0
- package/src/core/commitment.service.ts +84 -0
- package/src/core/contracts.service.ts +450 -0
- package/src/core/data.service.ts +276 -0
- package/src/core/sdk.ts +92 -0
- package/src/core/withdrawal.service.ts +126 -0
- package/src/crypto.ts +226 -0
- package/src/dirname.helper.ts +4 -0
- package/src/errors/account.error.ts +49 -0
- package/src/errors/base.error.ts +125 -0
- package/src/errors/data.error.ts +34 -0
- package/src/errors/events.error.ts +38 -0
- package/src/exceptions/circuitInitialization.exception.ts +6 -0
- package/src/exceptions/fetchArtifacts.exception.ts +7 -0
- package/src/exceptions/index.ts +4 -0
- package/src/exceptions/invalidRpcUrl.exception.ts +6 -0
- package/src/exceptions/privacyPool.exception.ts +19 -0
- package/src/external.ts +13 -0
- package/src/filename.helper.ts +4 -0
- package/src/index.ts +21 -0
- package/src/interfaces/blockchainProvider.interface.ts +13 -0
- package/src/interfaces/circuits.interface.ts +34 -0
- package/src/interfaces/contracts.interface.ts +66 -0
- package/src/interfaces/index.ts +1 -0
- package/src/internal.ts +6 -0
- package/src/keys.ts +42 -0
- package/src/providers/blockchainProvider.ts +30 -0
- package/src/providers/index.ts +1 -0
- package/src/types/account.ts +35 -0
- package/src/types/commitment.ts +50 -0
- package/src/types/events.ts +82 -0
- package/src/types/index.ts +3 -0
- package/src/types/keys.ts +6 -0
- package/src/types/withdrawal.ts +33 -0
- package/src/utils/logger.ts +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Privacy Pool Core SDK
|
|
2
|
+
|
|
3
|
+
A TypeScript SDK for interacting with the Privacy Pool protocol. This SDK provides a comprehensive set of tools and utilities for integrating with Privacy Pool, enabling deposits, withdrawals, and other core functionality.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @0xbow/privacy-pools-core-sdk
|
|
10
|
+
# or
|
|
11
|
+
yarn add @0xbow/privacy-pools-core-sdk
|
|
12
|
+
# or
|
|
13
|
+
pnpm add @0xbow/privacy-pools-core-sdk
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Setup
|
|
17
|
+
|
|
18
|
+
1. Install dependencies by running `pnpm install`
|
|
19
|
+
2. Build the SDK by running `pnpm build`
|
|
20
|
+
|
|
21
|
+
## Available Scripts
|
|
22
|
+
|
|
23
|
+
| Script | Description |
|
|
24
|
+
| ------------- | ------------------------------------------------------- |
|
|
25
|
+
| `build` | Build the SDK using Rollup |
|
|
26
|
+
| `build:bundle`| Build the SDK and set up circuits |
|
|
27
|
+
| `check-types` | Check for TypeScript type issues |
|
|
28
|
+
| `clean` | Remove build artifacts |
|
|
29
|
+
| `lint` | Run ESLint to check code quality |
|
|
30
|
+
| `lint:fix` | Fix linting issues automatically |
|
|
31
|
+
| `format` | Check code formatting using Prettier |
|
|
32
|
+
| `format:fix` | Fix formatting issues automatically |
|
|
33
|
+
| `test` | Run tests using Vitest |
|
|
34
|
+
| `test:cov` | Generate test coverage report |
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { PrivacyPoolSDK } from '@0xbow/privacy-pools-core-sdk';
|
|
40
|
+
|
|
41
|
+
// Initialize the SDK
|
|
42
|
+
const sdk = new PrivacyPoolSDK({
|
|
43
|
+
// Configuration options
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Example: Create a deposit
|
|
47
|
+
const deposit = await sdk.deposit({
|
|
48
|
+
// Deposit parameters
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Example: Create a withdrawal
|
|
52
|
+
const withdrawal = await sdk.withdraw({
|
|
53
|
+
// Withdrawal parameters
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
For detailed usage examples and API documentation, please refer to our [documentation](https://github.com/defi-wonderland/privacy-pool-core/tree/main/docs).
|
|
58
|
+
|
|
59
|
+
## Features
|
|
60
|
+
|
|
61
|
+
- Deposit and withdrawal functionality
|
|
62
|
+
- Zero-knowledge proof generation
|
|
63
|
+
- Commitment management
|
|
64
|
+
- Contract interactions
|
|
65
|
+
- Type-safe API
|
|
66
|
+
|
|
67
|
+
## Contributing
|
|
68
|
+
|
|
69
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
Apache-2.0 License - see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { F as FetchArtifact } from './index-Bw-RoJy9.js';
|
|
2
|
+
import 'viem/accounts';
|
|
3
|
+
import 'buffer';
|
|
4
|
+
import 'assert';
|
|
5
|
+
import 'viem';
|
|
6
|
+
import 'viem/chains';
|
|
7
|
+
|
|
8
|
+
async function fetchVersionedArtifact(artifactUrl) {
|
|
9
|
+
const res = await fetch(artifactUrl);
|
|
10
|
+
if (res.status !== 200) {
|
|
11
|
+
throw new FetchArtifact(artifactUrl);
|
|
12
|
+
}
|
|
13
|
+
const aBuf = await res.arrayBuffer();
|
|
14
|
+
return new Uint8Array(aBuf);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { fetchVersionedArtifact };
|
|
18
|
+
//# sourceMappingURL=fetchArtifacts.esm-TV4yMbDL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchArtifacts.esm-TV4yMbDL.js","sources":["../../src/circuits/fetchArtifacts.esm.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAEO,eAAe,sBAAsB,CAC1C,WAAgB,EAAA;AAEhB,IAAA,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC;AACpC,IAAA,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;AACtB,QAAA,MAAM,IAAI,aAAa,CAAC,WAAW,CAAC;;AAEtC,IAAA,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,WAAW,EAAE;AACpC,IAAA,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC;AAC7B;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { F as FetchArtifact } from './index-Bw-RoJy9.js';
|
|
2
|
+
import 'viem/accounts';
|
|
3
|
+
import 'buffer';
|
|
4
|
+
import 'assert';
|
|
5
|
+
import 'viem';
|
|
6
|
+
import 'viem/chains';
|
|
7
|
+
|
|
8
|
+
async function fetchVersionedArtifact(artifactUrl) {
|
|
9
|
+
try {
|
|
10
|
+
const fs = (await import('fs')).default;
|
|
11
|
+
const readPromise = new Promise((resolve, reject) => {
|
|
12
|
+
fs.readFile(artifactUrl.pathname, (err, data) => {
|
|
13
|
+
if (err) {
|
|
14
|
+
reject(err);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
resolve(data);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
const buf = await readPromise;
|
|
22
|
+
return new Uint8Array(buf);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
console.error(error);
|
|
26
|
+
throw new FetchArtifact(artifactUrl);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { fetchVersionedArtifact };
|
|
31
|
+
//# sourceMappingURL=fetchArtifacts.node-DC_rCgt3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchArtifacts.node-DC_rCgt3.js","sources":["../../src/circuits/fetchArtifacts.node.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAEO,eAAe,sBAAsB,CAC1C,WAAgB,EAAA;AAEhB,IAAA,IAAI;QACF,MAAM,EAAE,GAAG,CAAC,MAAM,OAAO,IAAI,CAAC,EAAE,OAAO;QACvC,MAAM,WAAW,GAAoB,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;AACnE,YAAA,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,IAAI,KAAI;gBAC9C,IAAI,GAAG,EAAE;oBACP,MAAM,CAAC,GAAG,CAAC;;qBACN;oBACL,OAAO,CAAC,IAAI,CAAC;;AAEjB,aAAC,CAAC;AACJ,SAAC,CAAC;AACF,QAAA,MAAM,GAAG,GAAG,MAAM,WAAW;AAC7B,QAAA,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC;;IAC1B,OAAO,KAAK,EAAE;AACd,QAAA,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;AACpB,QAAA,MAAM,IAAI,aAAa,CAAC,WAAW,CAAC;;AAExC;;;;"}
|