@zkp2p/contracts-v2 0.0.1-rc3 → 0.0.1-rc4
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 +29 -21
- package/dist/addresses/base.json +1 -1
- package/dist/addresses/baseSepolia.json +1 -1
- package/dist/index.esm.js +2 -14489
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -14494
- package/dist/index.js.map +1 -1
- package/dist/paymentMethods/baseSepolia.json +1 -1
- package/dist/paymentMethods/index.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,23 +12,25 @@ yarn add @zkp2p/contracts-v2
|
|
|
12
12
|
pnpm add @zkp2p/contracts-v2
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
## Quick Start (
|
|
15
|
+
## Quick Start (subpath imports)
|
|
16
16
|
|
|
17
17
|
```typescript
|
|
18
|
-
import
|
|
18
|
+
import baseAddresses from '@zkp2p/contracts-v2/addresses/base.json';
|
|
19
|
+
import * as baseAbis from '@zkp2p/contracts-v2/abis/base';
|
|
20
|
+
import { base as baseConstants } from '@zkp2p/contracts-v2/constants';
|
|
21
|
+
import { base as basePaymentMethods } from '@zkp2p/contracts-v2/paymentMethods';
|
|
19
22
|
import { ethers } from 'ethers';
|
|
20
23
|
|
|
21
24
|
// Create contract instance
|
|
22
25
|
const provider = new ethers.providers.JsonRpcProvider('https://mainnet.base.org');
|
|
23
26
|
const orchestrator = new ethers.Contract(
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
baseAddresses.Orchestrator,
|
|
28
|
+
baseAbis.Orchestrator,
|
|
26
29
|
provider
|
|
27
30
|
);
|
|
28
31
|
|
|
29
|
-
console.log('Intent expiration:',
|
|
30
|
-
console.log('Venmo config:',
|
|
31
|
-
console.log('USD info:', utils.getCurrencyInfo(utils.Currency.USD));
|
|
32
|
+
console.log('Intent expiration:', baseConstants.INTENT_EXPIRATION_PERIOD);
|
|
33
|
+
console.log('Venmo config:', basePaymentMethods.venmo);
|
|
32
34
|
```
|
|
33
35
|
|
|
34
36
|
## Features
|
|
@@ -38,10 +40,11 @@ console.log('USD info:', utils.getCurrencyInfo(utils.Currency.USD));
|
|
|
38
40
|
Pre-configured addresses for all deployed networks, exported per-network:
|
|
39
41
|
|
|
40
42
|
```typescript
|
|
41
|
-
import
|
|
42
|
-
|
|
43
|
-
console.log(
|
|
44
|
-
console.log(
|
|
43
|
+
import base from '@zkp2p/contracts-v2/addresses/base.json';
|
|
44
|
+
import baseSepolia from '@zkp2p/contracts-v2/addresses/baseSepolia.json';
|
|
45
|
+
console.log(base.Orchestrator);
|
|
46
|
+
console.log(base.Escrow);
|
|
47
|
+
console.log(baseSepolia.UnifiedPaymentVerifier);
|
|
45
48
|
```
|
|
46
49
|
|
|
47
50
|
Supported networks:
|
|
@@ -53,9 +56,9 @@ Supported networks:
|
|
|
53
56
|
Minimal ABIs extracted from on-chain deployments:
|
|
54
57
|
|
|
55
58
|
```typescript
|
|
56
|
-
import
|
|
57
|
-
const orchestratorABI =
|
|
58
|
-
const escrowABI =
|
|
59
|
+
import * as baseAbis from '@zkp2p/contracts-v2/abis/base';
|
|
60
|
+
const orchestratorABI = baseAbis.Orchestrator;
|
|
61
|
+
const escrowABI = baseAbis.Escrow;
|
|
59
62
|
```
|
|
60
63
|
|
|
61
64
|
### 🔧 Network-Specific Protocol Constants
|
|
@@ -63,8 +66,8 @@ const escrowABI = abis.base.Escrow;
|
|
|
63
66
|
All protocol parameters and configurations per network:
|
|
64
67
|
|
|
65
68
|
```typescript
|
|
66
|
-
import {
|
|
67
|
-
const { INTENT_EXPIRATION_PERIOD, MAX_INTENTS_PER_DEPOSIT, DUST_THRESHOLD } =
|
|
69
|
+
import { base as baseConstants } from '@zkp2p/contracts-v2/constants';
|
|
70
|
+
const { INTENT_EXPIRATION_PERIOD, MAX_INTENTS_PER_DEPOSIT, DUST_THRESHOLD } = baseConstants;
|
|
68
71
|
```
|
|
69
72
|
|
|
70
73
|
### 💳 Payment Methods with Provider Hashes
|
|
@@ -72,8 +75,8 @@ const { INTENT_EXPIRATION_PERIOD, MAX_INTENTS_PER_DEPOSIT, DUST_THRESHOLD } = co
|
|
|
72
75
|
Unified payment method configurations including provider hashes from deployment:
|
|
73
76
|
|
|
74
77
|
```typescript
|
|
75
|
-
import {
|
|
76
|
-
const venmoConfig =
|
|
78
|
+
import { base as basePaymentMethods } from '@zkp2p/contracts-v2/paymentMethods';
|
|
79
|
+
const venmoConfig = basePaymentMethods.venmo;
|
|
77
80
|
console.log('Payment Method Hash:', venmoConfig.paymentMethodHash);
|
|
78
81
|
console.log('Provider Hashes:', venmoConfig.providerHashes);
|
|
79
82
|
console.log('Currencies:', venmoConfig.currencies);
|
|
@@ -85,7 +88,7 @@ console.log('Timestamp Buffer:', venmoConfig.timestampBuffer);
|
|
|
85
88
|
Protocol utility functions:
|
|
86
89
|
|
|
87
90
|
```typescript
|
|
88
|
-
import
|
|
91
|
+
import * as utils from '@zkp2p/contracts-v2/utils';
|
|
89
92
|
const usdInfo = utils.getCurrencyInfo(utils.Currency.USD);
|
|
90
93
|
console.log('Currency code:', usdInfo.code);
|
|
91
94
|
console.log('Decimals:', usdInfo.decimals);
|
|
@@ -96,8 +99,13 @@ console.log('Decimals:', usdInfo.decimals);
|
|
|
96
99
|
|
|
97
100
|
### Imports
|
|
98
101
|
|
|
99
|
-
-
|
|
100
|
-
-
|
|
102
|
+
- Prefer subpaths for clarity and smaller bundles:
|
|
103
|
+
- `@zkp2p/contracts-v2/addresses` and `@zkp2p/contracts-v2/addresses/*.json`
|
|
104
|
+
- `@zkp2p/contracts-v2/abis/<network>`
|
|
105
|
+
- `@zkp2p/contracts-v2/constants`
|
|
106
|
+
- `@zkp2p/contracts-v2/paymentMethods`
|
|
107
|
+
- `@zkp2p/contracts-v2/utils`
|
|
108
|
+
- `@zkp2p/contracts-v2/types`
|
|
101
109
|
|
|
102
110
|
## Development
|
|
103
111
|
|
package/dist/addresses/base.json
CHANGED