@zama-fhe/react-sdk 2.5.0 → 3.0.0-alpha.10
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 +7 -42
- package/dist/index.d.ts +86 -132
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/wagmi/index.js +1 -1
- package/dist/wagmi/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -698,38 +698,6 @@ const { data: meta } = useTokenMetadata("0xTokenAddress");
|
|
|
698
698
|
// meta?.name, meta?.symbol, meta?.decimals
|
|
699
699
|
```
|
|
700
700
|
|
|
701
|
-
### Activity Feed
|
|
702
|
-
|
|
703
|
-
#### `useActivityFeed`
|
|
704
|
-
|
|
705
|
-
Parse raw event logs into a classified, optionally decrypted activity feed.
|
|
706
|
-
|
|
707
|
-
```ts
|
|
708
|
-
function useActivityFeed(config: UseActivityFeedConfig): UseQueryResult<ActivityItem[], Error>;
|
|
709
|
-
|
|
710
|
-
interface UseActivityFeedConfig {
|
|
711
|
-
tokenAddress: Address;
|
|
712
|
-
userAddress: Address | undefined;
|
|
713
|
-
logs: readonly (RawLog & Partial<ActivityLogMetadata>)[] | undefined;
|
|
714
|
-
decrypt?: boolean; // default: true — batch-decrypt encrypted amounts
|
|
715
|
-
}
|
|
716
|
-
```
|
|
717
|
-
|
|
718
|
-
Enabled when both `logs` and `userAddress` are defined. When `decrypt` is `true` (default), encrypted transfer amounts are automatically decrypted via the relayer.
|
|
719
|
-
|
|
720
|
-
```tsx
|
|
721
|
-
const { data: feed } = useActivityFeed({
|
|
722
|
-
tokenAddress: "0xTokenAddress",
|
|
723
|
-
logs, // from getLogs or a similar source
|
|
724
|
-
userAddress,
|
|
725
|
-
decrypt: true,
|
|
726
|
-
});
|
|
727
|
-
|
|
728
|
-
feed?.forEach((item) => {
|
|
729
|
-
console.log(item.type, item.direction, item.amount);
|
|
730
|
-
});
|
|
731
|
-
```
|
|
732
|
-
|
|
733
701
|
### Low-Level FHE Hooks
|
|
734
702
|
|
|
735
703
|
These hooks are for **custom FHE contracts** (non-token contracts that use encrypted types directly). For confidential ERC-20 tokens, use the high-level token hooks above instead. For detailed usage examples, see the [Encrypt & Decrypt guide](../../docs/gitbook/src/guides/encrypt-decrypt.md).
|
|
@@ -798,14 +766,13 @@ Use `zamaQueryKeys` for manual cache management (invalidation, prefetching, remo
|
|
|
798
766
|
import { zamaQueryKeys, decryptionKeys } from "@zama-fhe/react-sdk";
|
|
799
767
|
```
|
|
800
768
|
|
|
801
|
-
| Factory | Keys
|
|
802
|
-
| ------------------------------------ |
|
|
803
|
-
| `zamaQueryKeys.confidentialBalance` | `.all`, `.token(address)`, `.owner(address, owner)`
|
|
804
|
-
| `zamaQueryKeys.confidentialBalances` | `.all`, `.tokens(addresses, owner)`
|
|
805
|
-
| `zamaQueryKeys.isAllowed` | `.all`
|
|
806
|
-
| `zamaQueryKeys.underlyingAllowance` | `.all`, `.token(address)`, `.scope(address, owner, wrapper)`
|
|
807
|
-
| `
|
|
808
|
-
| `decryptionKeys` | `.value(handle)` | Individual decrypted handle values. |
|
|
769
|
+
| Factory | Keys | Description |
|
|
770
|
+
| ------------------------------------ | ------------------------------------------------------------ | ----------------------------------- |
|
|
771
|
+
| `zamaQueryKeys.confidentialBalance` | `.all`, `.token(address)`, `.owner(address, owner)` | Single-token decrypted balance. |
|
|
772
|
+
| `zamaQueryKeys.confidentialBalances` | `.all`, `.tokens(addresses, owner)` | Multi-token batch balances. |
|
|
773
|
+
| `zamaQueryKeys.isAllowed` | `.all` | Session signature status. |
|
|
774
|
+
| `zamaQueryKeys.underlyingAllowance` | `.all`, `.token(address)`, `.scope(address, owner, wrapper)` | Underlying ERC-20 allowance. |
|
|
775
|
+
| `decryptionKeys` | `.value(handle)` | Individual decrypted handle values. |
|
|
809
776
|
|
|
810
777
|
```tsx
|
|
811
778
|
import { useQueryClient } from "@tanstack/react-query";
|
|
@@ -959,6 +926,4 @@ All public exports from `@zama-fhe/sdk` are re-exported from the main entry poin
|
|
|
959
926
|
|
|
960
927
|
**Event decoders:** `decodeConfidentialTransfer`, `decodeWrapped`, `decodeUnwrapRequested`, `decodeUnwrappedFinalized`, `decodeUnwrappedStarted`, `decodeOnChainEvent`, `decodeOnChainEvents`, `findUnwrapRequested`, `findWrapped`.
|
|
961
928
|
|
|
962
|
-
**Activity feed:** `ActivityDirection`, `ActivityType`, `ActivityAmount`, `ActivityLogMetadata`, `ActivityItem`, `parseActivityFeed`, `extractEncryptedHandles`, `applyDecryptedValues`, `sortByBlockNumber`.
|
|
963
|
-
|
|
964
929
|
**Contract call builders:** `confidentialBalanceOfContract`, `confidentialTransferContract`, `confidentialTransferFromContract`, `isOperatorContract`, `unwrapContract`, `unwrapFromBalanceContract`, `finalizeUnwrapContract`, `setOperatorContract`, `underlyingContract`, `inferredTotalSupplyContract`, `wrapContract`, `supportsInterfaceContract`, `isConfidentialTokenContract`, `isConfidentialWrapperContract`, `nameContract`, `symbolContract`, `decimalsContract`, `allowanceContract`, `approveContract`, `confidentialTotalSupplyContract`, `totalSupplyContract`, `rateContract`.
|