@zkp2p/contracts-v2 0.0.1-rc2 → 0.0.1-rc3
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 +28 -106
- package/dist/addresses/base.json +1 -1
- package/dist/addresses/baseSepolia.json +1 -1
- package/dist/index.esm.js +14489 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +14494 -1
- 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,35 +12,23 @@ yarn add @zkp2p/contracts-v2
|
|
|
12
12
|
pnpm add @zkp2p/contracts-v2
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
## Quick Start
|
|
15
|
+
## Quick Start (root import)
|
|
16
16
|
|
|
17
17
|
```typescript
|
|
18
|
-
import { addresses, abis, constants, paymentMethods } from '@zkp2p/contracts-v2';
|
|
18
|
+
import { addresses, abis, constants, paymentMethods, utils } from '@zkp2p/contracts-v2';
|
|
19
19
|
import { ethers } from 'ethers';
|
|
20
20
|
|
|
21
|
-
// Get contract addresses for Base mainnet
|
|
22
|
-
const baseAddresses = addresses.base;
|
|
23
|
-
console.log('Orchestrator:', baseAddresses.Orchestrator);
|
|
24
|
-
console.log('Escrow:', baseAddresses.Escrow);
|
|
25
|
-
|
|
26
|
-
// Get ABIs for Base mainnet
|
|
27
|
-
const baseAbis = abis.base;
|
|
28
|
-
|
|
29
21
|
// Create contract instance
|
|
30
22
|
const provider = new ethers.providers.JsonRpcProvider('https://mainnet.base.org');
|
|
31
23
|
const orchestrator = new ethers.Contract(
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
addresses.base.Orchestrator,
|
|
25
|
+
abis.base.Orchestrator,
|
|
34
26
|
provider
|
|
35
27
|
);
|
|
36
28
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
console.log('
|
|
40
|
-
|
|
41
|
-
// Access payment methods with provider hashes
|
|
42
|
-
const basePaymentMethods = paymentMethods.base;
|
|
43
|
-
console.log('Venmo config:', basePaymentMethods.venmo);
|
|
29
|
+
console.log('Intent expiration:', constants.base.INTENT_EXPIRATION_PERIOD);
|
|
30
|
+
console.log('Venmo config:', paymentMethods.base.venmo);
|
|
31
|
+
console.log('USD info:', utils.getCurrencyInfo(utils.Currency.USD));
|
|
44
32
|
```
|
|
45
33
|
|
|
46
34
|
## Features
|
|
@@ -51,16 +39,9 @@ Pre-configured addresses for all deployed networks, exported per-network:
|
|
|
51
39
|
|
|
52
40
|
```typescript
|
|
53
41
|
import { addresses } from '@zkp2p/contracts-v2';
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const baseSepoliaAddresses = addresses.baseSepolia;
|
|
58
|
-
|
|
59
|
-
// Access individual contracts
|
|
60
|
-
console.log(baseAddresses.Orchestrator);
|
|
61
|
-
console.log(baseAddresses.Escrow);
|
|
62
|
-
console.log(baseAddresses.UnifiedPaymentVerifier);
|
|
63
|
-
console.log(baseAddresses.SimpleAttestationVerifier);
|
|
42
|
+
console.log(addresses.base.Orchestrator);
|
|
43
|
+
console.log(addresses.base.Escrow);
|
|
44
|
+
console.log(addresses.baseSepolia.UnifiedPaymentVerifier);
|
|
64
45
|
```
|
|
65
46
|
|
|
66
47
|
Supported networks:
|
|
@@ -73,14 +54,8 @@ Minimal ABIs extracted from on-chain deployments:
|
|
|
73
54
|
|
|
74
55
|
```typescript
|
|
75
56
|
import { abis } from '@zkp2p/contracts-v2';
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const baseAbis = abis.base;
|
|
79
|
-
const baseSepoliaAbis = abis.baseSepolia;
|
|
80
|
-
|
|
81
|
-
// Individual contract ABIs
|
|
82
|
-
const orchestratorABI = baseAbis.Orchestrator;
|
|
83
|
-
const escrowABI = baseAbis.Escrow;
|
|
57
|
+
const orchestratorABI = abis.base.Orchestrator;
|
|
58
|
+
const escrowABI = abis.base.Escrow;
|
|
84
59
|
```
|
|
85
60
|
|
|
86
61
|
### 🔧 Network-Specific Protocol Constants
|
|
@@ -89,17 +64,7 @@ All protocol parameters and configurations per network:
|
|
|
89
64
|
|
|
90
65
|
```typescript
|
|
91
66
|
import { constants } from '@zkp2p/contracts-v2';
|
|
92
|
-
|
|
93
|
-
// Network-specific constants
|
|
94
|
-
const baseConstants = constants.base;
|
|
95
|
-
|
|
96
|
-
// Protocol parameters
|
|
97
|
-
const {
|
|
98
|
-
INTENT_EXPIRATION_PERIOD,
|
|
99
|
-
MAX_INTENTS_PER_DEPOSIT,
|
|
100
|
-
DUST_THRESHOLD,
|
|
101
|
-
PARTIAL_MANUAL_RELEASE_DELAY
|
|
102
|
-
} = baseConstants;
|
|
67
|
+
const { INTENT_EXPIRATION_PERIOD, MAX_INTENTS_PER_DEPOSIT, DUST_THRESHOLD } = constants.base;
|
|
103
68
|
```
|
|
104
69
|
|
|
105
70
|
### 💳 Payment Methods with Provider Hashes
|
|
@@ -108,14 +73,9 @@ Unified payment method configurations including provider hashes from deployment:
|
|
|
108
73
|
|
|
109
74
|
```typescript
|
|
110
75
|
import { paymentMethods } from '@zkp2p/contracts-v2';
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
// Access payment method configuration
|
|
116
|
-
const venmoConfig = basePaymentMethods.venmo;
|
|
117
|
-
console.log('Payment ID:', venmoConfig.paymentId);
|
|
118
|
-
console.log('Provider Hash:', venmoConfig.providerHash);
|
|
76
|
+
const venmoConfig = paymentMethods.base.venmo;
|
|
77
|
+
console.log('Payment Method Hash:', venmoConfig.paymentMethodHash);
|
|
78
|
+
console.log('Provider Hashes:', venmoConfig.providerHashes);
|
|
119
79
|
console.log('Currencies:', venmoConfig.currencies);
|
|
120
80
|
console.log('Timestamp Buffer:', venmoConfig.timestampBuffer);
|
|
121
81
|
```
|
|
@@ -126,67 +86,29 @@ Protocol utility functions:
|
|
|
126
86
|
|
|
127
87
|
```typescript
|
|
128
88
|
import { utils } from '@zkp2p/contracts-v2';
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
// Currency utilities
|
|
132
|
-
const usdInfo = getCurrencyInfo(Currency.USD);
|
|
89
|
+
const usdInfo = utils.getCurrencyInfo(utils.Currency.USD);
|
|
133
90
|
console.log('Currency code:', usdInfo.code);
|
|
134
91
|
console.log('Decimals:', usdInfo.decimals);
|
|
135
|
-
|
|
136
|
-
// Payment method utilities
|
|
137
|
-
const venmoId = getPaymentMethodId('venmo');
|
|
138
92
|
```
|
|
139
93
|
|
|
140
94
|
|
|
141
95
|
## API Reference
|
|
142
96
|
|
|
143
|
-
###
|
|
144
|
-
|
|
145
|
-
| Export | Type | Description |
|
|
146
|
-
|--------|------|-------------|
|
|
147
|
-
| `addresses` | Object | Network-specific contract addresses |
|
|
148
|
-
| `abis` | Object | Network-specific contract ABIs |
|
|
149
|
-
| `constants` | Object | Network-specific protocol constants |
|
|
150
|
-
| `paymentMethods` | Object | Network-specific payment method configs |
|
|
151
|
-
| `utils` | Object | Protocol utility functions |
|
|
152
|
-
| `Currency` | Enum | Currency enumeration |
|
|
153
|
-
| `getCurrencyInfo` | Function | Get currency details |
|
|
154
|
-
| `getPaymentMethodId` | Function | Get payment method identifier |
|
|
155
|
-
|
|
156
|
-
### Package Exports
|
|
157
|
-
|
|
158
|
-
The package provides multiple entry points:
|
|
159
|
-
|
|
160
|
-
```json
|
|
161
|
-
{
|
|
162
|
-
"@zkp2p/contracts-v2": "Main package exports",
|
|
163
|
-
"@zkp2p/contracts-v2/addresses": "Address exports only",
|
|
164
|
-
"@zkp2p/contracts-v2/addresses/*": "Network-specific addresses",
|
|
165
|
-
"@zkp2p/contracts-v2/abis/*": "Network-specific ABIs",
|
|
166
|
-
"@zkp2p/contracts-v2/constants": "Constants exports",
|
|
167
|
-
"@zkp2p/contracts-v2/constants/*": "Network-specific constants",
|
|
168
|
-
"@zkp2p/contracts-v2/paymentMethods": "Payment method configs",
|
|
169
|
-
"@zkp2p/contracts-v2/paymentMethods/*": "Network-specific payment methods",
|
|
170
|
-
"@zkp2p/contracts-v2/types": "TypeChain types",
|
|
171
|
-
"@zkp2p/contracts-v2/utils": "Utility functions"
|
|
172
|
-
}
|
|
173
|
-
```
|
|
97
|
+
### Imports
|
|
174
98
|
|
|
175
|
-
|
|
99
|
+
- Preferred (simple): `import { addresses, abis, constants, paymentMethods, utils } from '@zkp2p/contracts-v2'`
|
|
100
|
+
- Advanced (fine-grained): subpath imports like `@zkp2p/contracts-v2/addresses/base.json` or `@zkp2p/contracts-v2/abis/base`
|
|
176
101
|
|
|
177
|
-
|
|
102
|
+
## Development
|
|
178
103
|
|
|
179
|
-
|
|
180
|
-
- `yarn package:extract` - Extract addresses, ABIs, and constants from deployments
|
|
181
|
-
- `yarn package:build` - Build the package for distribution
|
|
104
|
+
### Build & Publish
|
|
182
105
|
|
|
183
|
-
From
|
|
184
|
-
- `yarn
|
|
185
|
-
- `
|
|
186
|
-
- `
|
|
187
|
-
- `yarn test` - Run package tests
|
|
106
|
+
From `packages/contracts`:
|
|
107
|
+
- `yarn build` – Clean, extract, and bundle to `dist/`
|
|
108
|
+
- `npm pack` – Preview tarball contents
|
|
109
|
+
- `npm publish --access public` – Publish (runs prepublishOnly)
|
|
188
110
|
|
|
189
|
-
|
|
111
|
+
Note: The package publishes `dist/` only. Tests and config files are excluded.
|
|
190
112
|
|
|
191
113
|
## License
|
|
192
114
|
|
|
@@ -196,4 +118,4 @@ MIT
|
|
|
196
118
|
|
|
197
119
|
- [GitHub Repository](https://github.com/zkp2p/zkp2p-v2-contracts)
|
|
198
120
|
- [Documentation](https://docs.zkp2p.xyz)
|
|
199
|
-
- [Website](https://zkp2p.xyz)
|
|
121
|
+
- [Website](https://zkp2p.xyz)
|
package/dist/addresses/base.json
CHANGED