@primuslabs/fhetransform-sdk 0.4.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 +198 -0
- package/dist/abis/acl.abi.d.ts +379 -0
- package/dist/abis/acl.abi.js +495 -0
- package/dist/abis/acl.abi.js.map +1 -0
- package/dist/abis/alphatrion_reward.abi.d.ts +407 -0
- package/dist/abis/alphatrion_reward.abi.js +532 -0
- package/dist/abis/alphatrion_reward.abi.js.map +1 -0
- package/dist/abis/ciphertext_digests.abi.d.ts +336 -0
- package/dist/abis/ciphertext_digests.abi.js +444 -0
- package/dist/abis/ciphertext_digests.abi.js.map +1 -0
- package/dist/abis/ciphertext_verification.abi.d.ts +637 -0
- package/dist/abis/ciphertext_verification.abi.js +830 -0
- package/dist/abis/ciphertext_verification.abi.js.map +1 -0
- package/dist/abis/convert_token.abi.d.ts +922 -0
- package/dist/abis/convert_token.abi.js +1208 -0
- package/dist/abis/convert_token.abi.js.map +1 -0
- package/dist/abis/decryption.abi.d.ts +956 -0
- package/dist/abis/decryption.abi.js +1244 -0
- package/dist/abis/decryption.abi.js.map +1 -0
- package/dist/abis/erc20.abi.d.ts +265 -0
- package/dist/abis/erc20.abi.js +350 -0
- package/dist/abis/erc20.abi.js.map +1 -0
- package/dist/abis/fhe_executor.abi.d.ts +1535 -0
- package/dist/abis/fhe_executor.abi.js +1962 -0
- package/dist/abis/fhe_executor.abi.js.map +1 -0
- package/dist/abis/space_bridge_config.abi.d.ts +792 -0
- package/dist/abis/space_bridge_config.abi.js +1032 -0
- package/dist/abis/space_bridge_config.abi.js.map +1 -0
- package/dist/abis/token.abi.d.ts +630 -0
- package/dist/abis/token.abi.js +828 -0
- package/dist/abis/token.abi.js.map +1 -0
- package/dist/cli/eusdc.d.ts +2 -0
- package/dist/cli/eusdc.js +41 -0
- package/dist/cli/eusdc.js.map +1 -0
- package/dist/contract/callbacks.d.ts +59 -0
- package/dist/contract/callbacks.js +2 -0
- package/dist/contract/callbacks.js.map +1 -0
- package/dist/contract/convert-token.d.ts +107 -0
- package/dist/contract/convert-token.js +249 -0
- package/dist/contract/convert-token.js.map +1 -0
- package/dist/contract/token.d.ts +167 -0
- package/dist/contract/token.js +404 -0
- package/dist/contract/token.js.map +1 -0
- package/dist/contract/transaction.d.ts +29 -0
- package/dist/contract/transaction.js +2 -0
- package/dist/contract/transaction.js.map +1 -0
- package/dist/core/address.d.ts +118 -0
- package/dist/core/address.js +200 -0
- package/dist/core/address.js.map +1 -0
- package/dist/core/auth.d.ts +68 -0
- package/dist/core/auth.js +58 -0
- package/dist/core/auth.js.map +1 -0
- package/dist/core/bytes.d.ts +48 -0
- package/dist/core/bytes.js +117 -0
- package/dist/core/bytes.js.map +1 -0
- package/dist/core/cache-manager.d.ts +138 -0
- package/dist/core/cache-manager.js +440 -0
- package/dist/core/cache-manager.js.map +1 -0
- package/dist/core/chain.d.ts +41 -0
- package/dist/core/chain.js +59 -0
- package/dist/core/chain.js.map +1 -0
- package/dist/core/constants.d.ts +24 -0
- package/dist/core/constants.js +25 -0
- package/dist/core/constants.js.map +1 -0
- package/dist/core/error.d.ts +2 -0
- package/dist/core/error.js +14 -0
- package/dist/core/error.js.map +1 -0
- package/dist/core/errors/error-catalog.d.ts +29 -0
- package/dist/core/errors/error-catalog.js +84 -0
- package/dist/core/errors/error-catalog.js.map +1 -0
- package/dist/core/errors/error-codes.d.ts +52 -0
- package/dist/core/errors/error-codes.js +61 -0
- package/dist/core/errors/error-codes.js.map +1 -0
- package/dist/core/errors/error-utils.d.ts +27 -0
- package/dist/core/errors/error-utils.js +110 -0
- package/dist/core/errors/error-utils.js.map +1 -0
- package/dist/core/errors/fhe-error.d.ts +98 -0
- package/dist/core/errors/fhe-error.js +190 -0
- package/dist/core/errors/fhe-error.js.map +1 -0
- package/dist/core/errors/index.d.ts +4 -0
- package/dist/core/errors/index.js +5 -0
- package/dist/core/errors/index.js.map +1 -0
- package/dist/core/estimate.d.ts +39 -0
- package/dist/core/estimate.js +111 -0
- package/dist/core/estimate.js.map +1 -0
- package/dist/core/event.d.ts +212 -0
- package/dist/core/event.js +42 -0
- package/dist/core/event.js.map +1 -0
- package/dist/core/fhe-type.d.ts +75 -0
- package/dist/core/fhe-type.js +115 -0
- package/dist/core/fhe-type.js.map +1 -0
- package/dist/core/fhe.d.ts +11 -0
- package/dist/core/fhe.js +23 -0
- package/dist/core/fhe.js.map +1 -0
- package/dist/core/handle.d.ts +42 -0
- package/dist/core/handle.js +99 -0
- package/dist/core/handle.js.map +1 -0
- package/dist/core/json-utils.d.ts +18 -0
- package/dist/core/json-utils.js +37 -0
- package/dist/core/json-utils.js.map +1 -0
- package/dist/core/kms.d.ts +42 -0
- package/dist/core/kms.js +70 -0
- package/dist/core/kms.js.map +1 -0
- package/dist/core/logger.d.ts +3 -0
- package/dist/core/logger.js +11 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/pretty-print.d.ts +18 -0
- package/dist/core/pretty-print.js +84 -0
- package/dist/core/pretty-print.js.map +1 -0
- package/dist/core/primitives.d.ts +22 -0
- package/dist/core/primitives.js +2 -0
- package/dist/core/primitives.js.map +1 -0
- package/dist/core/retryable-handler.d.ts +74 -0
- package/dist/core/retryable-handler.js +227 -0
- package/dist/core/retryable-handler.js.map +1 -0
- package/dist/core/signer-address-info.d.ts +15 -0
- package/dist/core/signer-address-info.js +33 -0
- package/dist/core/signer-address-info.js.map +1 -0
- package/dist/core/string.d.ts +28 -0
- package/dist/core/string.js +33 -0
- package/dist/core/string.js.map +1 -0
- package/dist/core/swallow.d.ts +23 -0
- package/dist/core/swallow.js +37 -0
- package/dist/core/swallow.js.map +1 -0
- package/dist/core/system-contract-info.d.ts +17 -0
- package/dist/core/system-contract-info.js +41 -0
- package/dist/core/system-contract-info.js.map +1 -0
- package/dist/core/ttl-cache.d.ts +81 -0
- package/dist/core/ttl-cache.js +113 -0
- package/dist/core/ttl-cache.js.map +1 -0
- package/dist/core/tx-error-parser.d.ts +40 -0
- package/dist/core/tx-error-parser.js +83 -0
- package/dist/core/tx-error-parser.js.map +1 -0
- package/dist/core/utils.d.ts +62 -0
- package/dist/core/utils.js +143 -0
- package/dist/core/utils.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/jazz/encrypt-key-p.d.ts +65 -0
- package/dist/jazz/encrypt-key-p.js +283 -0
- package/dist/jazz/encrypt-key-p.js.map +1 -0
- package/dist/jazz/encrypt-p.d.ts +82 -0
- package/dist/jazz/encrypt-p.js +139 -0
- package/dist/jazz/encrypt-p.js.map +1 -0
- package/dist/jazz/encrypt.d.ts +58 -0
- package/dist/jazz/encrypt.js +155 -0
- package/dist/jazz/encrypt.js.map +1 -0
- package/dist/jazz/input-proof-p.d.ts +122 -0
- package/dist/jazz/input-proof-p.js +265 -0
- package/dist/jazz/input-proof-p.js.map +1 -0
- package/dist/jazz/jazz-client-i.d.ts +16 -0
- package/dist/jazz/jazz-client-i.js +2 -0
- package/dist/jazz/jazz-client-i.js.map +1 -0
- package/dist/jazz/jazz-client.d.ts +18 -0
- package/dist/jazz/jazz-client.js +24 -0
- package/dist/jazz/jazz-client.js.map +1 -0
- package/dist/jazz/key-pair.d.ts +50 -0
- package/dist/jazz/key-pair.js +166 -0
- package/dist/jazz/key-pair.js.map +1 -0
- package/dist/jazz/mock/fake.d.ts +3 -0
- package/dist/jazz/mock/fake.js +23 -0
- package/dist/jazz/mock/fake.js.map +1 -0
- package/dist/jazz/mock/fetch-input-proof.d.ts +4 -0
- package/dist/jazz/mock/fetch-input-proof.js +63 -0
- package/dist/jazz/mock/fetch-input-proof.js.map +1 -0
- package/dist/jazz/mock/fetch-key-url.d.ts +3 -0
- package/dist/jazz/mock/fetch-key-url.js +15 -0
- package/dist/jazz/mock/fetch-key-url.js.map +1 -0
- package/dist/jazz/mock/fetch-public-decrypt.d.ts +3 -0
- package/dist/jazz/mock/fetch-public-decrypt.js +81 -0
- package/dist/jazz/mock/fetch-public-decrypt.js.map +1 -0
- package/dist/jazz/mock/fetch-user-decrypt.d.ts +4 -0
- package/dist/jazz/mock/fetch-user-decrypt.js +174 -0
- package/dist/jazz/mock/fetch-user-decrypt.js.map +1 -0
- package/dist/jazz/module/fetch-input-proof.d.ts +19 -0
- package/dist/jazz/module/fetch-input-proof.js +72 -0
- package/dist/jazz/module/fetch-input-proof.js.map +1 -0
- package/dist/jazz/module/fetch-key-url.d.ts +17 -0
- package/dist/jazz/module/fetch-key-url.js +46 -0
- package/dist/jazz/module/fetch-key-url.js.map +1 -0
- package/dist/jazz/module/fetch-public-decrypt.d.ts +19 -0
- package/dist/jazz/module/fetch-public-decrypt.js +65 -0
- package/dist/jazz/module/fetch-public-decrypt.js.map +1 -0
- package/dist/jazz/module/fetch-user-decrypt.d.ts +19 -0
- package/dist/jazz/module/fetch-user-decrypt.js +109 -0
- package/dist/jazz/module/fetch-user-decrypt.js.map +1 -0
- package/dist/jazz/module/jazz-async-request.d.ts +102 -0
- package/dist/jazz/module/jazz-async-request.js +515 -0
- package/dist/jazz/module/jazz-async-request.js.map +1 -0
- package/dist/jazz/module/jazz-p.d.ts +61 -0
- package/dist/jazz/module/jazz-p.js +33 -0
- package/dist/jazz/module/jazz-p.js.map +1 -0
- package/dist/jazz/module/s3-download.d.ts +85 -0
- package/dist/jazz/module/s3-download.js +293 -0
- package/dist/jazz/module/s3-download.js.map +1 -0
- package/dist/jazz/permit.d.ts +200 -0
- package/dist/jazz/permit.js +319 -0
- package/dist/jazz/permit.js.map +1 -0
- package/dist/jazz/public-decrypt-p.d.ts +96 -0
- package/dist/jazz/public-decrypt-p.js +258 -0
- package/dist/jazz/public-decrypt-p.js.map +1 -0
- package/dist/jazz/public-decrypt.d.ts +48 -0
- package/dist/jazz/public-decrypt.js +156 -0
- package/dist/jazz/public-decrypt.js.map +1 -0
- package/dist/jazz/read-contract.d.ts +81 -0
- package/dist/jazz/read-contract.js +125 -0
- package/dist/jazz/read-contract.js.map +1 -0
- package/dist/jazz/types/common.d.ts +17 -0
- package/dist/jazz/types/common.js +2 -0
- package/dist/jazz/types/common.js.map +1 -0
- package/dist/jazz/types/input-proof.d.ts +76 -0
- package/dist/jazz/types/input-proof.js +2 -0
- package/dist/jazz/types/input-proof.js.map +1 -0
- package/dist/jazz/types/key-url.d.ts +68 -0
- package/dist/jazz/types/key-url.js +5 -0
- package/dist/jazz/types/key-url.js.map +1 -0
- package/dist/jazz/types/public-decrypt.d.ts +61 -0
- package/dist/jazz/types/public-decrypt.js +2 -0
- package/dist/jazz/types/public-decrypt.js.map +1 -0
- package/dist/jazz/types/user-decrypt.d.ts +123 -0
- package/dist/jazz/types/user-decrypt.js +2 -0
- package/dist/jazz/types/user-decrypt.js.map +1 -0
- package/dist/jazz/user-decrypt-p.d.ts +111 -0
- package/dist/jazz/user-decrypt-p.js +280 -0
- package/dist/jazz/user-decrypt-p.js.map +1 -0
- package/dist/jazz/user-decrypt.d.ts +74 -0
- package/dist/jazz/user-decrypt.js +143 -0
- package/dist/jazz/user-decrypt.js.map +1 -0
- package/dist/native/fhe-api.js +5959 -0
- package/dist/native/fhe-api.node.cjs +6167 -0
- package/dist/native/fhe-api.node.worker.cjs +210 -0
- package/dist/native/fhe-api.wasm +0 -0
- package/dist/native/fhe-api.worker.js +164 -0
- package/dist/native/kms/node/kms_lib.d.ts +38 -0
- package/dist/native/kms/node/kms_lib.js +356 -0
- package/dist/native/kms/node/kms_lib_bg.wasm +0 -0
- package/dist/native/kms/node/kms_lib_bg.wasm.d.ts +21 -0
- package/dist/native/kms/node/package.json +11 -0
- package/dist/native/kms/web/kms_lib.d.ts +84 -0
- package/dist/native/kms/web/kms_lib.js +443 -0
- package/dist/native/kms/web/kms_lib_bg.wasm +0 -0
- package/dist/native/kms/web/kms_lib_bg.wasm.d.ts +21 -0
- package/dist/native/kms/web/package.json +15 -0
- package/dist/runtime/browser.d.ts +36 -0
- package/dist/runtime/browser.js +115 -0
- package/dist/runtime/browser.js.map +1 -0
- package/dist/runtime/node.d.ts +30 -0
- package/dist/runtime/node.js +95 -0
- package/dist/runtime/node.js.map +1 -0
- package/dist/sdk/fhetransform-sdk-b.d.ts +102 -0
- package/dist/sdk/fhetransform-sdk-b.js +294 -0
- package/dist/sdk/fhetransform-sdk-b.js.map +1 -0
- package/dist/sdk/fhetransform-sdk.d.ts +87 -0
- package/dist/sdk/fhetransform-sdk.js +135 -0
- package/dist/sdk/fhetransform-sdk.js.map +1 -0
- package/dist/sdk/jazz-service.d.ts +13 -0
- package/dist/sdk/jazz-service.js +58 -0
- package/dist/sdk/jazz-service.js.map +1 -0
- package/dist/sdk/permit-service.d.ts +45 -0
- package/dist/sdk/permit-service.js +144 -0
- package/dist/sdk/permit-service.js.map +1 -0
- package/dist/wasm/fhe-wasm-client.d.ts +19 -0
- package/dist/wasm/fhe-wasm-client.js +23 -0
- package/dist/wasm/fhe-wasm-client.js.map +1 -0
- package/dist/wasm/fhe-wasm-module.d.ts +24 -0
- package/dist/wasm/fhe-wasm-module.js +141 -0
- package/dist/wasm/fhe-wasm-module.js.map +1 -0
- package/dist/wasm/fhe-wasm-type.d.ts +59 -0
- package/dist/wasm/fhe-wasm-type.js +244 -0
- package/dist/wasm/fhe-wasm-type.js.map +1 -0
- package/dist/wasm/wasm-loader.browser.d.ts +21 -0
- package/dist/wasm/wasm-loader.browser.js +143 -0
- package/dist/wasm/wasm-loader.browser.js.map +1 -0
- package/dist/wasm/wasm-loader.node.d.ts +24 -0
- package/dist/wasm/wasm-loader.node.js +114 -0
- package/dist/wasm/wasm-loader.node.js.map +1 -0
- package/dist/wasm/worker-client.browser.d.ts +6 -0
- package/dist/wasm/worker-client.browser.js +21 -0
- package/dist/wasm/worker-client.browser.js.map +1 -0
- package/dist/wasm/worker-client.d.ts +34 -0
- package/dist/wasm/worker-client.js +160 -0
- package/dist/wasm/worker-client.js.map +1 -0
- package/dist/wasm/worker-client.node.d.ts +6 -0
- package/dist/wasm/worker-client.node.js +20 -0
- package/dist/wasm/worker-client.node.js.map +1 -0
- package/dist/wasm/worker-message.d.ts +61 -0
- package/dist/wasm/worker-message.js +2 -0
- package/dist/wasm/worker-message.js.map +1 -0
- package/dist/wasm/worker-transport.browser.d.ts +15 -0
- package/dist/wasm/worker-transport.browser.js +35 -0
- package/dist/wasm/worker-transport.browser.js.map +1 -0
- package/dist/wasm/worker-transport.d.ts +6 -0
- package/dist/wasm/worker-transport.js +2 -0
- package/dist/wasm/worker-transport.js.map +1 -0
- package/dist/wasm/worker-transport.node.d.ts +17 -0
- package/dist/wasm/worker-transport.node.js +39 -0
- package/dist/wasm/worker-transport.node.js.map +1 -0
- package/dist/wasm/worker.d.ts +1 -0
- package/dist/wasm/worker.js +69 -0
- package/dist/wasm/worker.js.map +1 -0
- package/package.json +81 -0
package/README.md
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# fhetransform-sdk
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for FHETransform. It provides helpers for:
|
|
4
|
+
|
|
5
|
+
- Connecting to the FHETransform blockchain contracts
|
|
6
|
+
- Encrypting and decrypting values through the Jazz service
|
|
7
|
+
- Interacting with confidential token contracts
|
|
8
|
+
- Running shield / unshield flows for converter contracts
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install fhetransform-sdk
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Requirements:
|
|
17
|
+
|
|
18
|
+
- Node.js `>= 20` for server-side usage
|
|
19
|
+
- ESM-aware tooling
|
|
20
|
+
- A blockchain provider and signer for write operations
|
|
21
|
+
|
|
22
|
+
### Environment variables
|
|
23
|
+
|
|
24
|
+
If you do not pass a provider or signer directly, the SDK can fall back to environment configuration in Node.js:
|
|
25
|
+
|
|
26
|
+
- `RPC_URL` or `FHE_RPC_URL` for the JSON-RPC endpoint
|
|
27
|
+
- `PRIVATE_KEY` for a signer
|
|
28
|
+
- `JAZZ_URL` for the Jazz API endpoint when the default is not suitable
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
### Node.js
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { FheTransformSDK } from "fhetransform-sdk";
|
|
36
|
+
import { ethers } from "ethers";
|
|
37
|
+
|
|
38
|
+
const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
|
|
39
|
+
const signer = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);
|
|
40
|
+
|
|
41
|
+
const sdk = new FheTransformSDK({
|
|
42
|
+
provider,
|
|
43
|
+
signer,
|
|
44
|
+
// Optional:
|
|
45
|
+
// jazzUrl: process.env.JAZZ_URL,
|
|
46
|
+
// mock: false,
|
|
47
|
+
onEvent: (event) => {
|
|
48
|
+
console.log("SDK event:", event.type);
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const token = sdk.createToken("0x0000000000000000000000000000000000000000");
|
|
53
|
+
|
|
54
|
+
console.log("Name:", await token.name());
|
|
55
|
+
console.log("Decimals:", await token.decimals());
|
|
56
|
+
console.log("Balance:", await token.balanceOf(await signer.getAddress()));
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Confidential transfer
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
const result = await token.confidentialTransfer(
|
|
63
|
+
"0x0000000000000000000000000000000000000001",
|
|
64
|
+
100n
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
console.log(result.txHash);
|
|
68
|
+
console.log(result.transferred);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Transfer methods also accept transaction options and lifecycle callbacks:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
await token.confidentialTransfer(
|
|
75
|
+
"0x0000000000000000000000000000000000000001",
|
|
76
|
+
100n,
|
|
77
|
+
{ gasLimit: 500_000n },
|
|
78
|
+
{
|
|
79
|
+
onEncryptComplete: () => console.log("Amount encrypted"),
|
|
80
|
+
onTransferSubmitted: (txHash) => console.log("Submitted:", txHash),
|
|
81
|
+
onTransferConfirmed: (receipt) => console.log("Confirmed:", receipt.hash),
|
|
82
|
+
onError: (error) => console.error("Transfer failed:", error),
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Converter flow
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
const convert = sdk.createConvertToken("0x0000000000000000000000000000000000000002");
|
|
91
|
+
|
|
92
|
+
const shield = await convert.shield(1000n);
|
|
93
|
+
console.log(shield.roundedAmount);
|
|
94
|
+
|
|
95
|
+
const unshield = await convert.unshieldAndFinalize(1000n);
|
|
96
|
+
console.log(unshield.cleartext);
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Browser
|
|
100
|
+
|
|
101
|
+
In browsers, the SDK will attempt to use MetaMask when a signer is not supplied. Pass a provider and signer explicitly if you want to control the connection flow yourself.
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import { FheTransformSDK } from "fhetransform-sdk";
|
|
105
|
+
|
|
106
|
+
const sdk = new FheTransformSDK({
|
|
107
|
+
onEvent: (event) => console.log(event.type),
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Events
|
|
112
|
+
|
|
113
|
+
The SDK emits structured events for encryption, decryption, and transaction lifecycles. Subscribe by passing an `onEvent` listener in the config:
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
import { FheTransformSDK, FheTransformSDKEvents } from "fhetransform-sdk";
|
|
117
|
+
|
|
118
|
+
const sdk = new FheTransformSDK({
|
|
119
|
+
provider,
|
|
120
|
+
signer,
|
|
121
|
+
onEvent: (event) => {
|
|
122
|
+
switch (event.type) {
|
|
123
|
+
case FheTransformSDKEvents.EncryptStart:
|
|
124
|
+
console.log("Encryption started", event.dappAddress);
|
|
125
|
+
break;
|
|
126
|
+
case FheTransformSDKEvents.EncryptEnd:
|
|
127
|
+
console.log(`Encryption finished in ${event.durationMs}ms`);
|
|
128
|
+
break;
|
|
129
|
+
case FheTransformSDKEvents.DecryptEnd:
|
|
130
|
+
console.log("Decrypted values:", event.plaintexts);
|
|
131
|
+
break;
|
|
132
|
+
case FheTransformSDKEvents.TransactionError:
|
|
133
|
+
console.error("Transaction failed:", event.error);
|
|
134
|
+
break;
|
|
135
|
+
case FheTransformSDKEvents.ShieldSubmitted:
|
|
136
|
+
console.log("Shield transaction submitted:", event.txHash);
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Every event carries a `type` and a `timestamp`. Events tied to a contract —
|
|
144
|
+
encryption operations and events from the `Token` / `ConvertToken` wrappers —
|
|
145
|
+
also include `dappAddress`, the relevant contract address. Use the exported
|
|
146
|
+
`FheTransformSDKEvents` constants and the `FheTransformSDKEvent` type instead
|
|
147
|
+
of hardcoding event strings.
|
|
148
|
+
|
|
149
|
+
### Event types
|
|
150
|
+
|
|
151
|
+
| Event type | Payload |
|
|
152
|
+
| --- | --- |
|
|
153
|
+
| `encrypt:start` | — |
|
|
154
|
+
| `encrypt:end` | `durationMs` |
|
|
155
|
+
| `encrypt:error` | `durationMs`, `error` |
|
|
156
|
+
| `decrypt:start` | `encryptedValues` |
|
|
157
|
+
| `decrypt:end` | `durationMs`, `encryptedValues`, `plaintexts` |
|
|
158
|
+
| `decrypt:error` | `encryptedValues`, `error`, `durationMs` |
|
|
159
|
+
| `transaction:end` | `functionName`, `txHash`, `durationMs` |
|
|
160
|
+
| `transaction:error` | `functionName`, `error`, `durationMs` |
|
|
161
|
+
| `shield:submitted` / `shield:confirmed` / `shield:end` | `txHash`, `elapsedMs` or `durationMs` |
|
|
162
|
+
| `unshield:submitted` / `unshield:confirmed` / `unshield:end` | `txHash`, `elapsedMs` or `durationMs` |
|
|
163
|
+
| `finalizeUnshield:submitted` / `finalizeUnshield:confirmed` / `finalizeUnshield:end` | `txHash`, `elapsedMs` or `durationMs` |
|
|
164
|
+
|
|
165
|
+
Notes:
|
|
166
|
+
|
|
167
|
+
- Listener exceptions are caught and logged; a misbehaving subscriber never breaks SDK operations.
|
|
168
|
+
- Decrypt events carry decrypted plaintext values — treat them as sensitive data.
|
|
169
|
+
- `transfer:submitted`, `transferFrom:submitted`, and `setOperator:submitted` are reserved event types and are not emitted yet.
|
|
170
|
+
- The encryption/decryption pipelines also emit low-level progress events such as
|
|
171
|
+
`encryptWithZk:end` and `fetchInputProof:start`; see the
|
|
172
|
+
[API reference](docs/API.md#internal-pipeline-events) for the full list.
|
|
173
|
+
|
|
174
|
+
## Build
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
npm run build
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
This compiles the TypeScript sources into `dist/`, copies the native assets used by the SDK, and prepares the package for publication or local consumption.
|
|
181
|
+
|
|
182
|
+
Useful companion commands:
|
|
183
|
+
|
|
184
|
+
- `npm test` - run the test suite
|
|
185
|
+
- `npm run lint` - lint the source tree
|
|
186
|
+
- `npm run format` - format the TypeScript sources
|
|
187
|
+
|
|
188
|
+
## API
|
|
189
|
+
|
|
190
|
+
See [docs/API.md](docs/API.md) for the class reference.
|
|
191
|
+
|
|
192
|
+
Besides the SDK classes, the package exports helpers and types for events
|
|
193
|
+
(`FheTransformSDKEvents`, `FheTransformSDKEvent`), addresses
|
|
194
|
+
(`toChecksumAddress`, `isZeroAddress`, …), chain and fee utilities
|
|
195
|
+
(`getChainKey`, `estimateFheFee`, …), contract operation types, and the unified
|
|
196
|
+
error system (`FheError`, `FheErrorCode`, `toFheError`, …). See the
|
|
197
|
+
[Supporting exports](docs/API.md#supporting-exports) section of the API
|
|
198
|
+
reference for the full list.
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
export declare const aclAbi: readonly [{
|
|
2
|
+
readonly inputs: readonly [{
|
|
3
|
+
readonly internalType: "address";
|
|
4
|
+
readonly name: "target";
|
|
5
|
+
readonly type: "address";
|
|
6
|
+
}];
|
|
7
|
+
readonly name: "AddressEmptyCode";
|
|
8
|
+
readonly type: "error";
|
|
9
|
+
}, {
|
|
10
|
+
readonly inputs: readonly [];
|
|
11
|
+
readonly name: "EnforcedPause";
|
|
12
|
+
readonly type: "error";
|
|
13
|
+
}, {
|
|
14
|
+
readonly inputs: readonly [];
|
|
15
|
+
readonly name: "ExpectedPause";
|
|
16
|
+
readonly type: "error";
|
|
17
|
+
}, {
|
|
18
|
+
readonly inputs: readonly [];
|
|
19
|
+
readonly name: "FailedCall";
|
|
20
|
+
readonly type: "error";
|
|
21
|
+
}, {
|
|
22
|
+
readonly inputs: readonly [];
|
|
23
|
+
readonly name: "HandlesListIsEmpty";
|
|
24
|
+
readonly type: "error";
|
|
25
|
+
}, {
|
|
26
|
+
readonly inputs: readonly [];
|
|
27
|
+
readonly name: "InvalidInitialization";
|
|
28
|
+
readonly type: "error";
|
|
29
|
+
}, {
|
|
30
|
+
readonly inputs: readonly [];
|
|
31
|
+
readonly name: "NotInitializing";
|
|
32
|
+
readonly type: "error";
|
|
33
|
+
}, {
|
|
34
|
+
readonly inputs: readonly [{
|
|
35
|
+
readonly internalType: "address";
|
|
36
|
+
readonly name: "owner";
|
|
37
|
+
readonly type: "address";
|
|
38
|
+
}];
|
|
39
|
+
readonly name: "OwnableInvalidOwner";
|
|
40
|
+
readonly type: "error";
|
|
41
|
+
}, {
|
|
42
|
+
readonly inputs: readonly [{
|
|
43
|
+
readonly internalType: "address";
|
|
44
|
+
readonly name: "account";
|
|
45
|
+
readonly type: "address";
|
|
46
|
+
}];
|
|
47
|
+
readonly name: "OwnableUnauthorizedAccount";
|
|
48
|
+
readonly type: "error";
|
|
49
|
+
}, {
|
|
50
|
+
readonly inputs: readonly [{
|
|
51
|
+
readonly internalType: "address";
|
|
52
|
+
readonly name: "sender";
|
|
53
|
+
readonly type: "address";
|
|
54
|
+
}];
|
|
55
|
+
readonly name: "SenderNotAllowed";
|
|
56
|
+
readonly type: "error";
|
|
57
|
+
}, {
|
|
58
|
+
readonly anonymous: false;
|
|
59
|
+
readonly inputs: readonly [{
|
|
60
|
+
readonly indexed: true;
|
|
61
|
+
readonly internalType: "address";
|
|
62
|
+
readonly name: "caller";
|
|
63
|
+
readonly type: "address";
|
|
64
|
+
}, {
|
|
65
|
+
readonly indexed: true;
|
|
66
|
+
readonly internalType: "address";
|
|
67
|
+
readonly name: "account";
|
|
68
|
+
readonly type: "address";
|
|
69
|
+
}, {
|
|
70
|
+
readonly indexed: false;
|
|
71
|
+
readonly internalType: "bytes32";
|
|
72
|
+
readonly name: "handle";
|
|
73
|
+
readonly type: "bytes32";
|
|
74
|
+
}];
|
|
75
|
+
readonly name: "Allowed";
|
|
76
|
+
readonly type: "event";
|
|
77
|
+
}, {
|
|
78
|
+
readonly anonymous: false;
|
|
79
|
+
readonly inputs: readonly [{
|
|
80
|
+
readonly indexed: true;
|
|
81
|
+
readonly internalType: "address";
|
|
82
|
+
readonly name: "caller";
|
|
83
|
+
readonly type: "address";
|
|
84
|
+
}, {
|
|
85
|
+
readonly indexed: false;
|
|
86
|
+
readonly internalType: "bytes32[]";
|
|
87
|
+
readonly name: "handlesList";
|
|
88
|
+
readonly type: "bytes32[]";
|
|
89
|
+
}];
|
|
90
|
+
readonly name: "AllowedForDecryption";
|
|
91
|
+
readonly type: "event";
|
|
92
|
+
}, {
|
|
93
|
+
readonly anonymous: false;
|
|
94
|
+
readonly inputs: readonly [{
|
|
95
|
+
readonly indexed: false;
|
|
96
|
+
readonly internalType: "uint64";
|
|
97
|
+
readonly name: "version";
|
|
98
|
+
readonly type: "uint64";
|
|
99
|
+
}];
|
|
100
|
+
readonly name: "Initialized";
|
|
101
|
+
readonly type: "event";
|
|
102
|
+
}, {
|
|
103
|
+
readonly anonymous: false;
|
|
104
|
+
readonly inputs: readonly [{
|
|
105
|
+
readonly indexed: true;
|
|
106
|
+
readonly internalType: "address";
|
|
107
|
+
readonly name: "previousOwner";
|
|
108
|
+
readonly type: "address";
|
|
109
|
+
}, {
|
|
110
|
+
readonly indexed: true;
|
|
111
|
+
readonly internalType: "address";
|
|
112
|
+
readonly name: "newOwner";
|
|
113
|
+
readonly type: "address";
|
|
114
|
+
}];
|
|
115
|
+
readonly name: "OwnershipTransferred";
|
|
116
|
+
readonly type: "event";
|
|
117
|
+
}, {
|
|
118
|
+
readonly anonymous: false;
|
|
119
|
+
readonly inputs: readonly [{
|
|
120
|
+
readonly indexed: false;
|
|
121
|
+
readonly internalType: "address";
|
|
122
|
+
readonly name: "account";
|
|
123
|
+
readonly type: "address";
|
|
124
|
+
}];
|
|
125
|
+
readonly name: "Paused";
|
|
126
|
+
readonly type: "event";
|
|
127
|
+
}, {
|
|
128
|
+
readonly anonymous: false;
|
|
129
|
+
readonly inputs: readonly [{
|
|
130
|
+
readonly indexed: false;
|
|
131
|
+
readonly internalType: "address";
|
|
132
|
+
readonly name: "account";
|
|
133
|
+
readonly type: "address";
|
|
134
|
+
}];
|
|
135
|
+
readonly name: "Unpaused";
|
|
136
|
+
readonly type: "event";
|
|
137
|
+
}, {
|
|
138
|
+
readonly inputs: readonly [{
|
|
139
|
+
readonly internalType: "bytes32";
|
|
140
|
+
readonly name: "handle";
|
|
141
|
+
readonly type: "bytes32";
|
|
142
|
+
}, {
|
|
143
|
+
readonly internalType: "address";
|
|
144
|
+
readonly name: "account";
|
|
145
|
+
readonly type: "address";
|
|
146
|
+
}, {
|
|
147
|
+
readonly internalType: "enum PermissionType";
|
|
148
|
+
readonly name: "pt";
|
|
149
|
+
readonly type: "uint8";
|
|
150
|
+
}];
|
|
151
|
+
readonly name: "accessPolicy";
|
|
152
|
+
readonly outputs: readonly [];
|
|
153
|
+
readonly stateMutability: "nonpayable";
|
|
154
|
+
readonly type: "function";
|
|
155
|
+
}, {
|
|
156
|
+
readonly inputs: readonly [{
|
|
157
|
+
readonly internalType: "bytes32";
|
|
158
|
+
readonly name: "handle";
|
|
159
|
+
readonly type: "bytes32";
|
|
160
|
+
}, {
|
|
161
|
+
readonly internalType: "address";
|
|
162
|
+
readonly name: "account";
|
|
163
|
+
readonly type: "address";
|
|
164
|
+
}];
|
|
165
|
+
readonly name: "accessPolicy";
|
|
166
|
+
readonly outputs: readonly [];
|
|
167
|
+
readonly stateMutability: "nonpayable";
|
|
168
|
+
readonly type: "function";
|
|
169
|
+
}, {
|
|
170
|
+
readonly inputs: readonly [{
|
|
171
|
+
readonly internalType: "bytes32";
|
|
172
|
+
readonly name: "handle";
|
|
173
|
+
readonly type: "bytes32";
|
|
174
|
+
}, {
|
|
175
|
+
readonly internalType: "address";
|
|
176
|
+
readonly name: "account";
|
|
177
|
+
readonly type: "address";
|
|
178
|
+
}];
|
|
179
|
+
readonly name: "allow";
|
|
180
|
+
readonly outputs: readonly [];
|
|
181
|
+
readonly stateMutability: "nonpayable";
|
|
182
|
+
readonly type: "function";
|
|
183
|
+
}, {
|
|
184
|
+
readonly inputs: readonly [{
|
|
185
|
+
readonly internalType: "bytes32[]";
|
|
186
|
+
readonly name: "handlesList";
|
|
187
|
+
readonly type: "bytes32[]";
|
|
188
|
+
}];
|
|
189
|
+
readonly name: "allowForDecryption";
|
|
190
|
+
readonly outputs: readonly [];
|
|
191
|
+
readonly stateMutability: "nonpayable";
|
|
192
|
+
readonly type: "function";
|
|
193
|
+
}, {
|
|
194
|
+
readonly inputs: readonly [{
|
|
195
|
+
readonly internalType: "bytes32";
|
|
196
|
+
readonly name: "handle";
|
|
197
|
+
readonly type: "bytes32";
|
|
198
|
+
}, {
|
|
199
|
+
readonly internalType: "address";
|
|
200
|
+
readonly name: "account";
|
|
201
|
+
readonly type: "address";
|
|
202
|
+
}];
|
|
203
|
+
readonly name: "allowTransient";
|
|
204
|
+
readonly outputs: readonly [];
|
|
205
|
+
readonly stateMutability: "nonpayable";
|
|
206
|
+
readonly type: "function";
|
|
207
|
+
}, {
|
|
208
|
+
readonly inputs: readonly [{
|
|
209
|
+
readonly internalType: "bytes32";
|
|
210
|
+
readonly name: "handle";
|
|
211
|
+
readonly type: "bytes32";
|
|
212
|
+
}, {
|
|
213
|
+
readonly internalType: "address";
|
|
214
|
+
readonly name: "account";
|
|
215
|
+
readonly type: "address";
|
|
216
|
+
}];
|
|
217
|
+
readonly name: "allowedTransient";
|
|
218
|
+
readonly outputs: readonly [{
|
|
219
|
+
readonly internalType: "bool";
|
|
220
|
+
readonly name: "";
|
|
221
|
+
readonly type: "bool";
|
|
222
|
+
}];
|
|
223
|
+
readonly stateMutability: "view";
|
|
224
|
+
readonly type: "function";
|
|
225
|
+
}, {
|
|
226
|
+
readonly inputs: readonly [];
|
|
227
|
+
readonly name: "cleanTransientStorage";
|
|
228
|
+
readonly outputs: readonly [];
|
|
229
|
+
readonly stateMutability: "nonpayable";
|
|
230
|
+
readonly type: "function";
|
|
231
|
+
}, {
|
|
232
|
+
readonly inputs: readonly [];
|
|
233
|
+
readonly name: "getVersion";
|
|
234
|
+
readonly outputs: readonly [{
|
|
235
|
+
readonly internalType: "string";
|
|
236
|
+
readonly name: "";
|
|
237
|
+
readonly type: "string";
|
|
238
|
+
}];
|
|
239
|
+
readonly stateMutability: "pure";
|
|
240
|
+
readonly type: "function";
|
|
241
|
+
}, {
|
|
242
|
+
readonly inputs: readonly [{
|
|
243
|
+
readonly internalType: "address";
|
|
244
|
+
readonly name: "owner";
|
|
245
|
+
readonly type: "address";
|
|
246
|
+
}];
|
|
247
|
+
readonly name: "initialize";
|
|
248
|
+
readonly outputs: readonly [];
|
|
249
|
+
readonly stateMutability: "nonpayable";
|
|
250
|
+
readonly type: "function";
|
|
251
|
+
}, {
|
|
252
|
+
readonly inputs: readonly [{
|
|
253
|
+
readonly internalType: "bytes32";
|
|
254
|
+
readonly name: "handle";
|
|
255
|
+
readonly type: "bytes32";
|
|
256
|
+
}, {
|
|
257
|
+
readonly internalType: "address";
|
|
258
|
+
readonly name: "account";
|
|
259
|
+
readonly type: "address";
|
|
260
|
+
}];
|
|
261
|
+
readonly name: "isAllowed";
|
|
262
|
+
readonly outputs: readonly [{
|
|
263
|
+
readonly internalType: "bool";
|
|
264
|
+
readonly name: "";
|
|
265
|
+
readonly type: "bool";
|
|
266
|
+
}];
|
|
267
|
+
readonly stateMutability: "view";
|
|
268
|
+
readonly type: "function";
|
|
269
|
+
}, {
|
|
270
|
+
readonly inputs: readonly [{
|
|
271
|
+
readonly internalType: "bytes32";
|
|
272
|
+
readonly name: "handle";
|
|
273
|
+
readonly type: "bytes32";
|
|
274
|
+
}];
|
|
275
|
+
readonly name: "isAllowedForDecryption";
|
|
276
|
+
readonly outputs: readonly [{
|
|
277
|
+
readonly internalType: "bool";
|
|
278
|
+
readonly name: "";
|
|
279
|
+
readonly type: "bool";
|
|
280
|
+
}];
|
|
281
|
+
readonly stateMutability: "view";
|
|
282
|
+
readonly type: "function";
|
|
283
|
+
}, {
|
|
284
|
+
readonly inputs: readonly [{
|
|
285
|
+
readonly internalType: "bytes32";
|
|
286
|
+
readonly name: "handle";
|
|
287
|
+
readonly type: "bytes32";
|
|
288
|
+
}, {
|
|
289
|
+
readonly internalType: "address";
|
|
290
|
+
readonly name: "account";
|
|
291
|
+
readonly type: "address";
|
|
292
|
+
}];
|
|
293
|
+
readonly name: "isAllowedForDecryption";
|
|
294
|
+
readonly outputs: readonly [{
|
|
295
|
+
readonly internalType: "bool";
|
|
296
|
+
readonly name: "";
|
|
297
|
+
readonly type: "bool";
|
|
298
|
+
}];
|
|
299
|
+
readonly stateMutability: "view";
|
|
300
|
+
readonly type: "function";
|
|
301
|
+
}, {
|
|
302
|
+
readonly inputs: readonly [{
|
|
303
|
+
readonly internalType: "bytes[]";
|
|
304
|
+
readonly name: "data";
|
|
305
|
+
readonly type: "bytes[]";
|
|
306
|
+
}];
|
|
307
|
+
readonly name: "multicall";
|
|
308
|
+
readonly outputs: readonly [{
|
|
309
|
+
readonly internalType: "bytes[]";
|
|
310
|
+
readonly name: "results";
|
|
311
|
+
readonly type: "bytes[]";
|
|
312
|
+
}];
|
|
313
|
+
readonly stateMutability: "nonpayable";
|
|
314
|
+
readonly type: "function";
|
|
315
|
+
}, {
|
|
316
|
+
readonly inputs: readonly [];
|
|
317
|
+
readonly name: "owner";
|
|
318
|
+
readonly outputs: readonly [{
|
|
319
|
+
readonly internalType: "address";
|
|
320
|
+
readonly name: "";
|
|
321
|
+
readonly type: "address";
|
|
322
|
+
}];
|
|
323
|
+
readonly stateMutability: "view";
|
|
324
|
+
readonly type: "function";
|
|
325
|
+
}, {
|
|
326
|
+
readonly inputs: readonly [];
|
|
327
|
+
readonly name: "paused";
|
|
328
|
+
readonly outputs: readonly [{
|
|
329
|
+
readonly internalType: "bool";
|
|
330
|
+
readonly name: "";
|
|
331
|
+
readonly type: "bool";
|
|
332
|
+
}];
|
|
333
|
+
readonly stateMutability: "view";
|
|
334
|
+
readonly type: "function";
|
|
335
|
+
}, {
|
|
336
|
+
readonly inputs: readonly [{
|
|
337
|
+
readonly internalType: "bytes32";
|
|
338
|
+
readonly name: "handle";
|
|
339
|
+
readonly type: "bytes32";
|
|
340
|
+
}, {
|
|
341
|
+
readonly internalType: "address";
|
|
342
|
+
readonly name: "account";
|
|
343
|
+
readonly type: "address";
|
|
344
|
+
}];
|
|
345
|
+
readonly name: "persistAllowed";
|
|
346
|
+
readonly outputs: readonly [{
|
|
347
|
+
readonly internalType: "bool";
|
|
348
|
+
readonly name: "";
|
|
349
|
+
readonly type: "bool";
|
|
350
|
+
}];
|
|
351
|
+
readonly stateMutability: "view";
|
|
352
|
+
readonly type: "function";
|
|
353
|
+
}, {
|
|
354
|
+
readonly inputs: readonly [];
|
|
355
|
+
readonly name: "renounceOwnership";
|
|
356
|
+
readonly outputs: readonly [];
|
|
357
|
+
readonly stateMutability: "nonpayable";
|
|
358
|
+
readonly type: "function";
|
|
359
|
+
}, {
|
|
360
|
+
readonly inputs: readonly [{
|
|
361
|
+
readonly internalType: "address";
|
|
362
|
+
readonly name: "addr";
|
|
363
|
+
readonly type: "address";
|
|
364
|
+
}];
|
|
365
|
+
readonly name: "setFheExecutorAddress";
|
|
366
|
+
readonly outputs: readonly [];
|
|
367
|
+
readonly stateMutability: "nonpayable";
|
|
368
|
+
readonly type: "function";
|
|
369
|
+
}, {
|
|
370
|
+
readonly inputs: readonly [{
|
|
371
|
+
readonly internalType: "address";
|
|
372
|
+
readonly name: "newOwner";
|
|
373
|
+
readonly type: "address";
|
|
374
|
+
}];
|
|
375
|
+
readonly name: "transferOwnership";
|
|
376
|
+
readonly outputs: readonly [];
|
|
377
|
+
readonly stateMutability: "nonpayable";
|
|
378
|
+
readonly type: "function";
|
|
379
|
+
}];
|