x402z-shared 0.0.15 → 0.1.0
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 +53 -0
- package/dist/index.d.mts +980 -176
- package/dist/index.d.ts +980 -176
- package/dist/index.js +1658 -171
- package/dist/index.mjs +1640 -158
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -26,6 +26,22 @@ import {
|
|
|
26
26
|
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
## Unwrap helpers (Node)
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import {
|
|
33
|
+
getTokenEip712Domain,
|
|
34
|
+
prepareUnwrapAuthorization,
|
|
35
|
+
getUnwrapHandleFromLogs,
|
|
36
|
+
} from "x402z-shared";
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Wrap helpers (Node)
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { ensureUnderlyingAllowance, getUnderlyingTokenAddress } from "x402z-shared";
|
|
43
|
+
```
|
|
44
|
+
|
|
29
45
|
## Token helper (Node)
|
|
30
46
|
|
|
31
47
|
```ts
|
|
@@ -85,3 +101,40 @@ console.log(txHash);
|
|
|
85
101
|
|
|
86
102
|
- Scheme name: `erc7984-mind-v1`
|
|
87
103
|
- For browser usage, use `x402z-shared-web`.
|
|
104
|
+
|
|
105
|
+
## API surface
|
|
106
|
+
|
|
107
|
+
Exports:
|
|
108
|
+
- `confidentialTokenAbi`: FHEToken ABI fragment used by helpers.
|
|
109
|
+
- `confidentialPaymentTypes`: EIP-712 type definitions for confidential payments.
|
|
110
|
+
- `confidentialErrorCodes`: mapped error codes for relayer/decryption flows.
|
|
111
|
+
- `createNonce`: generates a random `bytes32` nonce.
|
|
112
|
+
- `hashEncryptedAmountInput`: hashes an encrypted handle for authorization binding.
|
|
113
|
+
- `normalizeAmount`: coerces amounts to on-chain `uint64`-safe values.
|
|
114
|
+
- `createRelayer`: creates a Zama relayer instance (node).
|
|
115
|
+
- `createEncryptedAmountInput`: builds encrypted handle + proof for amounts.
|
|
116
|
+
- `publicDecrypt`: performs public decryption with proof.
|
|
117
|
+
- `SepoliaConfig`: default relayer config for Sepolia.
|
|
118
|
+
- `decryptEuint64`: user decryption flow for a single handle.
|
|
119
|
+
- `getTokenEip712Domain`: reads token EIP-712 domain with fallbacks.
|
|
120
|
+
- `getUnwrapHandleFromLogs`: extracts unwrap handle from receipt logs.
|
|
121
|
+
- `prepareUnwrapAuthorization`: creates/ signs unwrap authorization payload.
|
|
122
|
+
- `ensureUnderlyingAllowance`: checks/approves underlying ERC-20 allowance.
|
|
123
|
+
- `getUnderlyingTokenAddress`: reads underlying ERC-20 address from FHEToken.
|
|
124
|
+
- `getTransferAmounts`: decrypts transfer amounts for a payment tx.
|
|
125
|
+
- `ConfidentialToken`: high-level token helper (balance, wrap/unwrap).
|
|
126
|
+
|
|
127
|
+
Types:
|
|
128
|
+
- `ConfidentialErrorCode`: discriminated error codes for decrypt flows.
|
|
129
|
+
- `ConfidentialPaymentAuthorization`: signed payment authorization shape.
|
|
130
|
+
- `UnwrapAuthorization`: signed unwrap authorization shape.
|
|
131
|
+
- `ConfidentialPaymentPayload`: full payment payload sent to server.
|
|
132
|
+
- `ConfidentialRequirementsExtra`: scheme requirements extension payload.
|
|
133
|
+
- `ConfidentialPaymentInput`: relayer input for confidential payments.
|
|
134
|
+
- `TransferAmount`: decrypted transfer amount record.
|
|
135
|
+
- `TransferQueryOptions`: query options for transfer amount lookup.
|
|
136
|
+
- `ConfidentialTokenOptions`: constructor config for `ConfidentialToken`.
|
|
137
|
+
- `FhevmInstanceConfig`: relayer configuration type.
|
|
138
|
+
- `RelayerInstance`: relayer instance type.
|
|
139
|
+
- `RelayerSigner`: EIP-712 signer interface for relayer ops.
|
|
140
|
+
- re-exported types from `@x402/core/types`: shared x402 types.
|