x402z-shared 0.0.1 → 0.0.2
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 +37 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,6 +53,10 @@ const result = await viewConfidentialBalance({
|
|
|
53
53
|
console.log(result.balance?.toString());
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
Notes:
|
|
57
|
+
- Balance decryption is allowed for the account or its `observer` (ERC7984ObserverAccess).
|
|
58
|
+
- Unauthorized observer errors throw `confidentialErrorCodes.observerNotAuthorized` (`ConfidentialErrorCode`).
|
|
59
|
+
|
|
56
60
|
## Transfer amount helper (Node)
|
|
57
61
|
|
|
58
62
|
```ts
|
|
@@ -70,6 +74,39 @@ const transfers = await viewConfidentialTransferAmounts({
|
|
|
70
74
|
console.log(transfers[0]?.amount?.toString());
|
|
71
75
|
```
|
|
72
76
|
|
|
77
|
+
Notes:
|
|
78
|
+
- Transfer amount decryption is allowed for `holder`, `payee`, or an `observer` set via `ERC7984ObserverAccess`.
|
|
79
|
+
- Unauthorized observer errors throw `confidentialErrorCodes.observerNotAuthorized` (`ConfidentialErrorCode`).
|
|
80
|
+
|
|
81
|
+
## Observer helper (Node)
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { setObserver } from "x402z-shared";
|
|
85
|
+
|
|
86
|
+
const txHash = await setObserver({
|
|
87
|
+
rpcUrl: "https://sepolia.infura.io/v3/...",
|
|
88
|
+
tokenAddress: "0xToken",
|
|
89
|
+
account: "0xHolder",
|
|
90
|
+
observer: "0xObserver",
|
|
91
|
+
signer,
|
|
92
|
+
});
|
|
93
|
+
console.log(txHash);
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Observer helper (Browser)
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
import { setObserverWeb } from "x402z-shared/web";
|
|
100
|
+
|
|
101
|
+
const txHash = await setObserverWeb({
|
|
102
|
+
tokenAddress: "0xToken",
|
|
103
|
+
account: "0xHolder",
|
|
104
|
+
observer: "0xObserver",
|
|
105
|
+
walletClient,
|
|
106
|
+
});
|
|
107
|
+
console.log(txHash);
|
|
108
|
+
```
|
|
109
|
+
|
|
73
110
|
## Balance helper (Browser)
|
|
74
111
|
|
|
75
112
|
```ts
|