@tokenops/sdk 1.1.1 → 1.5.1
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 +18 -8
- package/dist/{chunk-5SGMJADP.cjs → chunk-2NCLOQ56.cjs} +9 -9
- package/dist/{chunk-FXCW7LVB.js → chunk-2PWNH3UE.js} +35 -6
- package/dist/{chunk-FPQBFIUW.cjs → chunk-4WPGQSNT.cjs} +3 -3
- package/dist/{chunk-OYLZEEHF.cjs → chunk-5X5WL5CU.cjs} +265 -101
- package/dist/{chunk-56UI7LUR.cjs → chunk-67OV5CX2.cjs} +19 -0
- package/dist/{chunk-WRCUDSUJ.js → chunk-6BMP4ICG.js} +2 -2
- package/dist/{chunk-XXXDQSHE.js → chunk-6R4KNAPK.js} +5 -3
- package/dist/{chunk-XSNLAS5M.js → chunk-AOP6HMPW.js} +1 -1
- package/dist/{chunk-SAGJIEQK.cjs → chunk-C7BRZXJA.cjs} +14 -14
- package/dist/{chunk-OQZAZIAS.js → chunk-DUZIIRPF.js} +174 -5
- package/dist/{chunk-Q7ARQSUH.cjs → chunk-FAXIIH5R.cjs} +3 -3
- package/dist/chunk-FT4LNBOS.js +11 -0
- package/dist/{chunk-QE7ZONJ2.js → chunk-IJFQ5L4I.js} +4 -4
- package/dist/{chunk-X56UVEXS.js → chunk-IXLO7GO5.js} +209 -45
- package/dist/{chunk-CQIPRNS7.cjs → chunk-JK4XMMKM.cjs} +3 -3
- package/dist/{chunk-ITQ7WKVC.cjs → chunk-JYOTGRSO.cjs} +8 -8
- package/dist/{chunk-VDXVNZCO.cjs → chunk-KLKI352M.cjs} +85 -29
- package/dist/{chunk-5SA2HF2W.cjs → chunk-MCRBVJGZ.cjs} +24 -22
- package/dist/{chunk-3PQ2RFPC.js → chunk-NTZY6IB7.js} +4 -4
- package/dist/{chunk-JJ4R5QXF.js → chunk-ODLTEGHB.js} +1 -1
- package/dist/{chunk-XWDVPV42.js → chunk-ORFTDNFZ.js} +4 -4
- package/dist/{chunk-IR5AK5U5.js → chunk-OXTLPTO3.js} +4 -4
- package/dist/{chunk-23F7JIK5.cjs → chunk-PFXURMBZ.cjs} +77 -48
- package/dist/{chunk-3ZRHDTEX.cjs → chunk-PUPKNW3R.cjs} +2 -2
- package/dist/{chunk-IVE3QEGD.js → chunk-QBJ7O2B4.js} +18 -1
- package/dist/{chunk-JFLEEXKP.js → chunk-SG65XWH7.js} +58 -2
- package/dist/{chunk-G7G75C46.cjs → chunk-T46YXSBP.cjs} +11 -11
- package/dist/{chunk-NS44KBV5.cjs → chunk-TEBM66WA.cjs} +12 -12
- package/dist/{chunk-SYHXDHWX.cjs → chunk-TIUKIY5V.cjs} +193 -24
- package/dist/{chunk-W7JHOK7G.cjs → chunk-V2PXZVBF.cjs} +4 -4
- package/dist/{chunk-SEKC7H5Y.cjs → chunk-W7IGCOVL.cjs} +11 -11
- package/dist/{chunk-5KHIQG7Y.cjs → chunk-WENHUPZC.cjs} +31 -31
- package/dist/{chunk-ZXCOJY2Z.js → chunk-WMACINXO.js} +1 -1
- package/dist/{chunk-M7V2EDPB.js → chunk-XGGTQQFH.js} +1 -1
- package/dist/{chunk-ITQBDRWX.js → chunk-YQIBBEFJ.js} +1 -1
- package/dist/{chunk-BE2AIZ3K.js → chunk-ZA673I3O.js} +1 -1
- package/dist/chunk-ZQUE2B3Q.cjs +33 -0
- package/dist/{chunk-FYQ2UW4T.js → chunk-ZWXJTBZO.js} +1 -1
- package/dist/core/errors.d.ts +41 -1
- package/dist/core/revert-mapper.d.ts +77 -0
- package/dist/core/wagmi-compat.d.ts +40 -0
- package/dist/fhe/index.cjs +112 -66
- package/dist/fhe/index.d.cts +1 -1
- package/dist/fhe/index.d.ts +1 -1
- package/dist/fhe/index.js +50 -8
- package/dist/fhe/react/index.cjs +7 -7
- package/dist/fhe/react/index.js +2 -2
- package/dist/fhe/sepolia-encryptor-web.d.ts +27 -1
- package/dist/fhe/sepolia-encryptor.d.ts +38 -0
- package/dist/fhe-airdrop/advanced/index.cjs +9 -8
- package/dist/fhe-airdrop/advanced/index.js +7 -6
- package/dist/fhe-airdrop/advanced/react/index.cjs +14 -13
- package/dist/fhe-airdrop/advanced/react/index.js +10 -9
- package/dist/fhe-airdrop/airdrop.d.ts +2 -0
- package/dist/fhe-airdrop/encryption.d.ts +8 -0
- package/dist/fhe-airdrop/factory.d.ts +86 -1
- package/dist/fhe-airdrop/index.cjs +61 -57
- package/dist/fhe-airdrop/index.d.cts +3 -3
- package/dist/fhe-airdrop/index.d.ts +3 -3
- package/dist/fhe-airdrop/index.js +7 -7
- package/dist/fhe-airdrop/react/index.cjs +163 -133
- package/dist/fhe-airdrop/react/index.d.cts +4 -3
- package/dist/fhe-airdrop/react/index.d.ts +4 -3
- package/dist/fhe-airdrop/react/index.js +38 -13
- package/dist/fhe-airdrop/react/useAirdropClaim.d.ts +2 -0
- package/dist/fhe-airdrop/react/useAirdropIsSignatureValid.d.ts +3 -2
- package/dist/fhe-airdrop/react/useClaim.d.ts +2 -0
- package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdrop.d.ts +8 -0
- package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdropAndGetAddress.d.ts +8 -0
- package/dist/fhe-airdrop/react/useFundConfidentialAirdrop.d.ts +8 -0
- package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +51 -0
- package/dist/fhe-airdrop/types.d.ts +45 -0
- package/dist/fhe-disperse/encryption.d.ts +8 -0
- package/dist/fhe-disperse/index.cjs +69 -65
- package/dist/fhe-disperse/index.d.cts +1 -1
- package/dist/fhe-disperse/index.d.ts +1 -1
- package/dist/fhe-disperse/index.js +8 -8
- package/dist/fhe-disperse/react/index.cjs +90 -86
- package/dist/fhe-disperse/react/index.d.cts +1 -1
- package/dist/fhe-disperse/react/index.d.ts +1 -1
- package/dist/fhe-disperse/react/index.js +10 -10
- package/dist/fhe-disperse/react/useCalculateFee.d.ts +7 -0
- package/dist/fhe-disperse/react/useDisperse.d.ts +9 -0
- package/dist/fhe-disperse/react/usePreflightDisperse.d.ts +7 -0
- package/dist/fhe-disperse/react/useSingletonCalculateFee.d.ts +7 -0
- package/dist/fhe-disperse/react/useSingletonWithdrawTokenFee.d.ts +6 -0
- package/dist/fhe-disperse/react/useWithdrawTokenFee.d.ts +6 -0
- package/dist/fhe-disperse/singleton.d.ts +29 -0
- package/dist/fhe-disperse/subtotals.d.ts +6 -0
- package/dist/fhe-vesting/advanced/index.cjs +8 -8
- package/dist/fhe-vesting/advanced/index.js +6 -6
- package/dist/fhe-vesting/advanced/react/index.cjs +15 -14
- package/dist/fhe-vesting/advanced/react/index.js +12 -11
- package/dist/fhe-vesting/encryption.d.ts +8 -0
- package/dist/fhe-vesting/index.cjs +79 -75
- package/dist/fhe-vesting/index.d.cts +2 -2
- package/dist/fhe-vesting/index.d.ts +2 -2
- package/dist/fhe-vesting/index.js +9 -9
- package/dist/fhe-vesting/manager.d.ts +100 -1
- package/dist/fhe-vesting/react/index.cjs +241 -219
- package/dist/fhe-vesting/react/index.d.cts +3 -2
- package/dist/fhe-vesting/react/index.d.ts +3 -2
- package/dist/fhe-vesting/react/index.js +29 -12
- package/dist/fhe-vesting/react/useAdminClaim.d.ts +2 -0
- package/dist/fhe-vesting/react/useAdminPartialClaim.d.ts +2 -0
- package/dist/fhe-vesting/react/useBatchCreateVesting.d.ts +8 -0
- package/dist/fhe-vesting/react/useClaim.d.ts +2 -0
- package/dist/fhe-vesting/react/useCreateVesting.d.ts +8 -0
- package/dist/fhe-vesting/react/useManagerWithdrawTokenFee.d.ts +6 -0
- package/dist/fhe-vesting/react/usePartialClaim.d.ts +8 -0
- package/dist/fhe-vesting/react/usePreflightCreateVesting.d.ts +37 -0
- package/dist/fhe-vesting/react/useVestingClaim.d.ts +2 -0
- package/dist/fhe-vesting/react/useWithdrawAdmin.d.ts +6 -0
- package/dist/fhe-vesting/react/useWithdrawTokenFee.d.ts +6 -0
- package/dist/fhe-vesting/types.d.ts +34 -0
- package/dist/index.cjs +61 -53
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/testnet-faucet/index.cjs +58 -54
- package/dist/testnet-faucet/index.d.cts +1 -1
- package/dist/testnet-faucet/index.d.ts +1 -1
- package/dist/testnet-faucet/index.js +5 -5
- package/dist/testnet-faucet/react/index.cjs +60 -55
- package/dist/testnet-faucet/react/index.d.cts +3 -2
- package/dist/testnet-faucet/react/index.d.ts +3 -2
- package/dist/testnet-faucet/react/index.js +11 -10
- package/dist/testnet-faucet/react/useConfidentialBalance.d.ts +3 -2
- package/dist/testnet-faucet/react/useUnderlyingBalance.d.ts +2 -2
- package/package.json +3 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkFAXIIH5R_cjs = require('./chunk-FAXIIH5R.cjs');
|
|
4
|
+
var chunkKLKI352M_cjs = require('./chunk-KLKI352M.cjs');
|
|
5
5
|
var chunkVJKZWYYJ_cjs = require('./chunk-VJKZWYYJ.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
7
7
|
var viem = require('viem');
|
|
8
8
|
|
|
9
9
|
// src/fhe-airdrop/abis/cloneable.ts
|
|
@@ -1016,7 +1016,7 @@ var confidentialAirdropCloneableAbi = [
|
|
|
1016
1016
|
];
|
|
1017
1017
|
|
|
1018
1018
|
// src/fhe-airdrop/errors.ts
|
|
1019
|
-
var AlreadyClaimedError = class extends
|
|
1019
|
+
var AlreadyClaimedError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1020
1020
|
name = "AlreadyClaimedError";
|
|
1021
1021
|
constructor(args) {
|
|
1022
1022
|
const who = args.caller ? `${args.caller}: ` : "";
|
|
@@ -1031,7 +1031,7 @@ var AlreadyClaimedError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
|
|
|
1031
1031
|
});
|
|
1032
1032
|
}
|
|
1033
1033
|
};
|
|
1034
|
-
var ClaimNotStartedError = class extends
|
|
1034
|
+
var ClaimNotStartedError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1035
1035
|
name = "ClaimNotStartedError";
|
|
1036
1036
|
constructor(args) {
|
|
1037
1037
|
const detail = args.startsAt !== void 0 ? ` Opens at unix timestamp ${args.startsAt}.` : "";
|
|
@@ -1046,7 +1046,7 @@ var ClaimNotStartedError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
|
|
|
1046
1046
|
});
|
|
1047
1047
|
}
|
|
1048
1048
|
};
|
|
1049
|
-
var ClaimWindowClosedError = class extends
|
|
1049
|
+
var ClaimWindowClosedError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1050
1050
|
name = "ClaimWindowClosedError";
|
|
1051
1051
|
constructor(args) {
|
|
1052
1052
|
const detail = args.endedAt !== void 0 ? ` Closed at unix timestamp ${args.endedAt}.` : "";
|
|
@@ -1081,10 +1081,10 @@ var airdropProductMapper = (name, _args, ctx) => {
|
|
|
1081
1081
|
case "ECDSAInvalidSignature":
|
|
1082
1082
|
case "ECDSAInvalidSignatureS":
|
|
1083
1083
|
case "ECDSAInvalidSignatureLength":
|
|
1084
|
-
return new
|
|
1084
|
+
return new chunk67OV5CX2_cjs.InvalidSignatureError(ctx);
|
|
1085
1085
|
case "ZeroBalance":
|
|
1086
1086
|
case "InsufficientBalance":
|
|
1087
|
-
return CONFIDENTIAL_POOL_BALANCE_METHODS.has(ctx.method) ? new
|
|
1087
|
+
return CONFIDENTIAL_POOL_BALANCE_METHODS.has(ctx.method) ? new chunk67OV5CX2_cjs.InsufficientBalanceError({ ...ctx, balanceKind: "confidential" }) : void 0;
|
|
1088
1088
|
default:
|
|
1089
1089
|
return void 0;
|
|
1090
1090
|
}
|
|
@@ -1107,8 +1107,8 @@ var ConfidentialAirdropClient = class {
|
|
|
1107
1107
|
surface: "client",
|
|
1108
1108
|
chainId: chainIdForInit ?? null,
|
|
1109
1109
|
hasWallet: !!this.walletClient,
|
|
1110
|
-
aclResolved: !!config.aclAddress || chainIdForInit !== void 0 && !!
|
|
1111
|
-
sdkVersion:
|
|
1110
|
+
aclResolved: !!config.aclAddress || chainIdForInit !== void 0 && !!chunkFAXIIH5R_cjs.getFhevmAclAddress(chainIdForInit),
|
|
1111
|
+
sdkVersion: chunkKLKI352M_cjs.SDK_VERSION
|
|
1112
1112
|
});
|
|
1113
1113
|
}
|
|
1114
1114
|
/**
|
|
@@ -1119,7 +1119,7 @@ var ConfidentialAirdropClient = class {
|
|
|
1119
1119
|
*/
|
|
1120
1120
|
get aclAddress() {
|
|
1121
1121
|
if (this.#cachedAclAddress) return this.#cachedAclAddress;
|
|
1122
|
-
this.#cachedAclAddress = this.#aclAddressOverride ??
|
|
1122
|
+
this.#cachedAclAddress = this.#aclAddressOverride ?? chunkFAXIIH5R_cjs.requireFhevmAclAddress(this.publicClient.chain?.id, "ConfidentialAirdropClient");
|
|
1123
1123
|
return this.#cachedAclAddress;
|
|
1124
1124
|
}
|
|
1125
1125
|
// ============================================================
|
|
@@ -1254,7 +1254,7 @@ var ConfidentialAirdropClient = class {
|
|
|
1254
1254
|
account: args.caller
|
|
1255
1255
|
});
|
|
1256
1256
|
} catch (err) {
|
|
1257
|
-
throw
|
|
1257
|
+
throw chunkKLKI352M_cjs.mapContractRevert(err, {
|
|
1258
1258
|
method: "isSignatureValid",
|
|
1259
1259
|
contractAddress: this.address,
|
|
1260
1260
|
abi: confidentialAirdropCloneableAbi,
|
|
@@ -1308,7 +1308,7 @@ var ConfidentialAirdropClient = class {
|
|
|
1308
1308
|
]);
|
|
1309
1309
|
const now = Number(block.timestamp);
|
|
1310
1310
|
if (isPaused) {
|
|
1311
|
-
blockers.push(new
|
|
1311
|
+
blockers.push(new chunk67OV5CX2_cjs.PausedError({ method: "claim", contractAddress: this.address }));
|
|
1312
1312
|
}
|
|
1313
1313
|
if (now < startTime) {
|
|
1314
1314
|
blockers.push(
|
|
@@ -1339,7 +1339,7 @@ var ConfidentialAirdropClient = class {
|
|
|
1339
1339
|
}
|
|
1340
1340
|
if (callerBalance < gasFee) {
|
|
1341
1341
|
blockers.push(
|
|
1342
|
-
new
|
|
1342
|
+
new chunk67OV5CX2_cjs.InsufficientFeeError({
|
|
1343
1343
|
method: "claim",
|
|
1344
1344
|
contractAddress: this.address,
|
|
1345
1345
|
feeKind: "gas",
|
|
@@ -1360,6 +1360,8 @@ var ConfidentialAirdropClient = class {
|
|
|
1360
1360
|
* {@link signClaimAuthorization}. The signature commits to that handle, so the SDK
|
|
1361
1361
|
* does NOT re-encrypt — submit the admin-issued payload as-is.
|
|
1362
1362
|
*
|
|
1363
|
+
* **Silent-zero transfers.** ERC-7984 transfers do not revert when the sender's encrypted balance is insufficient — the transfer succeeds and moves an encrypted zero instead. This is by design: reverting would leak balance information. The transaction receipt alone cannot tell you whether value actually moved.
|
|
1364
|
+
*
|
|
1363
1365
|
* @returns Transaction hash.
|
|
1364
1366
|
* @example
|
|
1365
1367
|
* const fee = await airdrop.gasFee();
|
|
@@ -1433,12 +1435,12 @@ var ConfidentialAirdropClient = class {
|
|
|
1433
1435
|
const aclLogs = receipt.logs.filter(
|
|
1434
1436
|
(log) => log.address.toLowerCase() === this.aclAddress.toLowerCase()
|
|
1435
1437
|
);
|
|
1436
|
-
const events = viem.parseEventLogs({ abi: [
|
|
1438
|
+
const events = viem.parseEventLogs({ abi: [chunkFAXIIH5R_cjs.ACL_ALLOWED_EVENT], logs: aclLogs });
|
|
1437
1439
|
const granted = events.filter(
|
|
1438
1440
|
(ev) => ev.args.account.toLowerCase() === callerAddress && ev.args.caller.toLowerCase() === this.address.toLowerCase()
|
|
1439
1441
|
);
|
|
1440
1442
|
if (granted.length === 0) {
|
|
1441
|
-
throw new
|
|
1443
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventNotFoundError({
|
|
1442
1444
|
method: "getClaimAmount",
|
|
1443
1445
|
eventName: "Allowed",
|
|
1444
1446
|
contractAddress: this.aclAddress,
|
|
@@ -1447,7 +1449,7 @@ var ConfidentialAirdropClient = class {
|
|
|
1447
1449
|
});
|
|
1448
1450
|
}
|
|
1449
1451
|
if (granted.length > 1) {
|
|
1450
|
-
throw new
|
|
1452
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventAmbiguousError({
|
|
1451
1453
|
method: "getClaimAmount",
|
|
1452
1454
|
eventName: "Allowed",
|
|
1453
1455
|
contractAddress: this.aclAddress,
|
|
@@ -1535,7 +1537,7 @@ var ConfidentialAirdropClient = class {
|
|
|
1535
1537
|
// ============================================================
|
|
1536
1538
|
#requireChecksumAddress(method, argument, value) {
|
|
1537
1539
|
if (!viem.isAddress(value, { strict: true })) {
|
|
1538
|
-
throw new
|
|
1540
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1539
1541
|
method,
|
|
1540
1542
|
argument,
|
|
1541
1543
|
reason: "must be a valid EIP-55 checksummed address",
|
|
@@ -1545,14 +1547,14 @@ var ConfidentialAirdropClient = class {
|
|
|
1545
1547
|
}
|
|
1546
1548
|
#requireWallet(method) {
|
|
1547
1549
|
if (!this.walletClient) {
|
|
1548
|
-
throw new
|
|
1550
|
+
throw new chunk67OV5CX2_cjs.MissingWalletClientError(method);
|
|
1549
1551
|
}
|
|
1550
1552
|
return this.walletClient;
|
|
1551
1553
|
}
|
|
1552
1554
|
#resolveAccount(wallet, override, method) {
|
|
1553
1555
|
const acct = override ?? wallet.account;
|
|
1554
1556
|
if (!acct) {
|
|
1555
|
-
throw new
|
|
1557
|
+
throw new chunk67OV5CX2_cjs.MissingAccountError(method);
|
|
1556
1558
|
}
|
|
1557
1559
|
if (typeof acct === "string") {
|
|
1558
1560
|
this.#requireChecksumAddress(method, "account", acct);
|
|
@@ -1560,7 +1562,7 @@ var ConfidentialAirdropClient = class {
|
|
|
1560
1562
|
return acct;
|
|
1561
1563
|
}
|
|
1562
1564
|
#mapRevert(method, err, account) {
|
|
1563
|
-
return
|
|
1565
|
+
return chunkKLKI352M_cjs.mapContractRevert(err, {
|
|
1564
1566
|
method,
|
|
1565
1567
|
contractAddress: this.address,
|
|
1566
1568
|
abi: confidentialAirdropCloneableAbi,
|
|
@@ -1605,7 +1607,7 @@ var ConfidentialAirdropClient = class {
|
|
|
1605
1607
|
...value !== void 0 ? { value } : {}
|
|
1606
1608
|
});
|
|
1607
1609
|
} catch (err) {
|
|
1608
|
-
if (
|
|
1610
|
+
if (chunkKLKI352M_cjs.isContractRevert(err)) {
|
|
1609
1611
|
throw this.#mapRevert(method, err, accountAddress(account));
|
|
1610
1612
|
}
|
|
1611
1613
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createConfidentialVestingManagerClient, resolveEncryptor } from './chunk-
|
|
2
|
-
import { createConfidentialVestingFactoryClient } from './chunk-
|
|
3
|
-
import { getFheVestingFactoryAddress } from './chunk-
|
|
4
|
-
import { DeploymentAddressUnavailableError } from './chunk-
|
|
1
|
+
import { createConfidentialVestingManagerClient, resolveEncryptor } from './chunk-IXLO7GO5.js';
|
|
2
|
+
import { createConfidentialVestingFactoryClient } from './chunk-OXTLPTO3.js';
|
|
3
|
+
import { getFheVestingFactoryAddress } from './chunk-XGGTQQFH.js';
|
|
4
|
+
import { DeploymentAddressUnavailableError } from './chunk-QBJ7O2B4.js';
|
|
5
5
|
import { useMemo, useRef, useEffect } from 'react';
|
|
6
6
|
import { usePublicClient, useWalletClient } from 'wagmi';
|
|
7
7
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfidentialAirdropFactoryClient, confidentialAirdropFactoryAbi } from './chunk-
|
|
1
|
+
import { ConfidentialAirdropFactoryClient, confidentialAirdropFactoryAbi } from './chunk-DUZIIRPF.js';
|
|
2
2
|
|
|
3
3
|
// src/fhe-airdrop/advanced/factory-advanced.ts
|
|
4
4
|
var ConfidentialAirdropFactoryAdvancedClient = class extends ConfidentialAirdropFactoryClient {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createConfidentialAirdropClient } from './chunk-
|
|
2
|
-
import { createConfidentialAirdropFactoryClient, resolveEncryptor } from './chunk-
|
|
3
|
-
import { getFheAirdropFactoryAddress } from './chunk-
|
|
4
|
-
import { DeploymentAddressUnavailableError } from './chunk-
|
|
1
|
+
import { createConfidentialAirdropClient } from './chunk-6R4KNAPK.js';
|
|
2
|
+
import { createConfidentialAirdropFactoryClient, resolveEncryptor } from './chunk-DUZIIRPF.js';
|
|
3
|
+
import { getFheAirdropFactoryAddress } from './chunk-XGGTQQFH.js';
|
|
4
|
+
import { DeploymentAddressUnavailableError } from './chunk-QBJ7O2B4.js';
|
|
5
5
|
import { useRef, useMemo } from 'react';
|
|
6
6
|
import { usePublicClient, useWalletClient } from 'wagmi';
|
|
7
7
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { SDK_VERSION, mapContractRevert, isContractRevert } from './chunk-
|
|
2
|
-
import { getFheVestingFactoryAddress } from './chunk-
|
|
3
|
-
import { normaliseAddress } from './chunk-
|
|
1
|
+
import { SDK_VERSION, mapContractRevert, isContractRevert } from './chunk-SG65XWH7.js';
|
|
2
|
+
import { getFheVestingFactoryAddress } from './chunk-XGGTQQFH.js';
|
|
3
|
+
import { normaliseAddress } from './chunk-ZA673I3O.js';
|
|
4
4
|
import { withTelemetry } from './chunk-Q2GP5UDC.js';
|
|
5
5
|
import { asTxHash } from './chunk-KWFFIJYX.js';
|
|
6
|
-
import { DeploymentAddressUnavailableError, TokenOpsSdkError, MissingWalletClientError, MissingAccountError } from './chunk-
|
|
6
|
+
import { DeploymentAddressUnavailableError, TokenOpsSdkError, MissingWalletClientError, MissingAccountError } from './chunk-QBJ7O2B4.js';
|
|
7
7
|
import { parseEventLogs } from 'viem';
|
|
8
8
|
|
|
9
9
|
// src/fhe-vesting/abis/factory.ts
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
3
|
+
var chunkTEBM66WA_cjs = require('./chunk-TEBM66WA.cjs');
|
|
4
|
+
var chunkFAXIIH5R_cjs = require('./chunk-FAXIIH5R.cjs');
|
|
5
|
+
var chunkKLKI352M_cjs = require('./chunk-KLKI352M.cjs');
|
|
6
|
+
var chunkPUPKNW3R_cjs = require('./chunk-PUPKNW3R.cjs');
|
|
7
|
+
var chunkJK4XMMKM_cjs = require('./chunk-JK4XMMKM.cjs');
|
|
8
8
|
var chunkVJKZWYYJ_cjs = require('./chunk-VJKZWYYJ.cjs');
|
|
9
9
|
var chunk66IHPTOK_cjs = require('./chunk-66IHPTOK.cjs');
|
|
10
|
-
var
|
|
10
|
+
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
11
11
|
var viem = require('viem');
|
|
12
12
|
|
|
13
13
|
// src/fhe-disperse/abis/singleton.ts
|
|
@@ -1689,7 +1689,7 @@ function resolveEncryptor(source) {
|
|
|
1689
1689
|
var MAX_UINT64 = (1n << 64n) - 1n;
|
|
1690
1690
|
function assertUint64(value, label) {
|
|
1691
1691
|
if (value < 0n || value > MAX_UINT64) {
|
|
1692
|
-
throw new
|
|
1692
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1693
1693
|
method: "encryptUint64",
|
|
1694
1694
|
argument: label,
|
|
1695
1695
|
reason: "exceeds uint64 range (0..2^64-1)",
|
|
@@ -1710,7 +1710,7 @@ async function encryptUint64({
|
|
|
1710
1710
|
userAddress
|
|
1711
1711
|
});
|
|
1712
1712
|
if (handles.length !== 1) {
|
|
1713
|
-
throw new
|
|
1713
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1714
1714
|
method: "encryptUint64",
|
|
1715
1715
|
argument: "handles",
|
|
1716
1716
|
reason: `expected 1 handle, got ${handles.length}`,
|
|
@@ -1729,7 +1729,7 @@ async function encryptUint64Batch({
|
|
|
1729
1729
|
values
|
|
1730
1730
|
}) {
|
|
1731
1731
|
if (values.length === 0) {
|
|
1732
|
-
throw new
|
|
1732
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1733
1733
|
method: "encryptUint64Batch",
|
|
1734
1734
|
argument: "values",
|
|
1735
1735
|
reason: "must be non-empty"
|
|
@@ -1742,7 +1742,7 @@ async function encryptUint64Batch({
|
|
|
1742
1742
|
userAddress
|
|
1743
1743
|
});
|
|
1744
1744
|
if (handles.length !== values.length) {
|
|
1745
|
-
throw new
|
|
1745
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1746
1746
|
method: "encryptUint64Batch",
|
|
1747
1747
|
argument: "handles",
|
|
1748
1748
|
reason: `expected ${values.length} handles, got ${handles.length}`,
|
|
@@ -1756,7 +1756,7 @@ async function encryptUint64Batch({
|
|
|
1756
1756
|
}
|
|
1757
1757
|
|
|
1758
1758
|
// src/fhe-disperse/errors.ts
|
|
1759
|
-
var NotRegisteredError = class extends
|
|
1759
|
+
var NotRegisteredError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1760
1760
|
name = "NotRegisteredError";
|
|
1761
1761
|
constructor(args) {
|
|
1762
1762
|
super(
|
|
@@ -1773,7 +1773,7 @@ var NotRegisteredError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
|
|
|
1773
1773
|
);
|
|
1774
1774
|
}
|
|
1775
1775
|
};
|
|
1776
|
-
var AlreadyRegisteredError = class extends
|
|
1776
|
+
var AlreadyRegisteredError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1777
1777
|
name = "AlreadyRegisteredError";
|
|
1778
1778
|
constructor(args) {
|
|
1779
1779
|
super(
|
|
@@ -1810,7 +1810,7 @@ function validateDisperseInputs(args) {
|
|
|
1810
1810
|
const errors = [];
|
|
1811
1811
|
if (recipients.length === 0) {
|
|
1812
1812
|
errors.push(
|
|
1813
|
-
new
|
|
1813
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1814
1814
|
method,
|
|
1815
1815
|
argument: "recipients",
|
|
1816
1816
|
reason: "must be non-empty"
|
|
@@ -1819,7 +1819,7 @@ function validateDisperseInputs(args) {
|
|
|
1819
1819
|
}
|
|
1820
1820
|
if (amounts.length !== recipients.length) {
|
|
1821
1821
|
errors.push(
|
|
1822
|
-
new
|
|
1822
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1823
1823
|
method,
|
|
1824
1824
|
argument: "amounts",
|
|
1825
1825
|
reason: `length mismatch: recipients.length (${recipients.length}) !== amounts.length (${amounts.length})`
|
|
@@ -1829,7 +1829,7 @@ function validateDisperseInputs(args) {
|
|
|
1829
1829
|
recipients.forEach((r, i) => {
|
|
1830
1830
|
if (!viem.isAddress(r, { strict: true })) {
|
|
1831
1831
|
errors.push(
|
|
1832
|
-
new
|
|
1832
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1833
1833
|
method,
|
|
1834
1834
|
argument: `recipients[${i}]`,
|
|
1835
1835
|
reason: "must be a valid EIP-55 checksummed address",
|
|
@@ -1840,7 +1840,7 @@ function validateDisperseInputs(args) {
|
|
|
1840
1840
|
}
|
|
1841
1841
|
if (r === ZERO_ADDRESS) {
|
|
1842
1842
|
errors.push(
|
|
1843
|
-
new
|
|
1843
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1844
1844
|
method,
|
|
1845
1845
|
argument: `recipients[${i}]`,
|
|
1846
1846
|
reason: "zero address",
|
|
@@ -1852,7 +1852,7 @@ function validateDisperseInputs(args) {
|
|
|
1852
1852
|
amounts.forEach((v, i) => {
|
|
1853
1853
|
if (v < 0n || v > MAX_UINT642) {
|
|
1854
1854
|
errors.push(
|
|
1855
|
-
new
|
|
1855
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1856
1856
|
method,
|
|
1857
1857
|
argument: `amounts[${i}]`,
|
|
1858
1858
|
reason: "exceeds uint64 range (0..2^64-1)"
|
|
@@ -1866,7 +1866,7 @@ function validateDisperseInputs(args) {
|
|
|
1866
1866
|
const { group0, group1 } = computeSubtotals([...amounts]);
|
|
1867
1867
|
if (group0 > MAX_UINT642) {
|
|
1868
1868
|
errors.push(
|
|
1869
|
-
new
|
|
1869
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1870
1870
|
method,
|
|
1871
1871
|
argument: "amounts",
|
|
1872
1872
|
reason: "wallet-mode subtotal exceeds uint64 range"
|
|
@@ -1875,7 +1875,7 @@ function validateDisperseInputs(args) {
|
|
|
1875
1875
|
}
|
|
1876
1876
|
if (group1 > MAX_UINT642) {
|
|
1877
1877
|
errors.push(
|
|
1878
|
-
new
|
|
1878
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1879
1879
|
method,
|
|
1880
1880
|
argument: "amounts",
|
|
1881
1881
|
reason: "wallet-mode subtotal exceeds uint64 range"
|
|
@@ -1884,7 +1884,7 @@ function validateDisperseInputs(args) {
|
|
|
1884
1884
|
}
|
|
1885
1885
|
if (group0 <= MAX_UINT642 && group1 <= MAX_UINT642 && group0 + group1 > MAX_UINT642) {
|
|
1886
1886
|
errors.push(
|
|
1887
|
-
new
|
|
1887
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1888
1888
|
method,
|
|
1889
1889
|
argument: "amounts",
|
|
1890
1890
|
reason: "wallet-mode subtotals sum exceeds uint64 range (would silently zero on-chain)"
|
|
@@ -1894,7 +1894,7 @@ function validateDisperseInputs(args) {
|
|
|
1894
1894
|
}
|
|
1895
1895
|
if (batchLimit > 0n && BigInt(recipients.length) > batchLimit) {
|
|
1896
1896
|
errors.push(
|
|
1897
|
-
new
|
|
1897
|
+
new chunk67OV5CX2_cjs.BatchTooLargeError({
|
|
1898
1898
|
method,
|
|
1899
1899
|
contractAddress,
|
|
1900
1900
|
requested: recipients.length,
|
|
@@ -1907,7 +1907,7 @@ function validateDisperseInputs(args) {
|
|
|
1907
1907
|
function assertChecksumAddress(value, argument, method) {
|
|
1908
1908
|
if (value === void 0) return;
|
|
1909
1909
|
if (!viem.isAddress(value, { strict: true })) {
|
|
1910
|
-
throw new
|
|
1910
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1911
1911
|
method,
|
|
1912
1912
|
argument,
|
|
1913
1913
|
reason: "must be a valid EIP-55 checksummed address \u2014 use viem's getAddress(addr) to fix the checksum",
|
|
@@ -1919,7 +1919,7 @@ function assertNonZeroChecksumAddress(value, argument, method) {
|
|
|
1919
1919
|
if (value === void 0) return;
|
|
1920
1920
|
assertChecksumAddress(value, argument, method);
|
|
1921
1921
|
if (value === ZERO_ADDRESS) {
|
|
1922
|
-
throw new
|
|
1922
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1923
1923
|
method,
|
|
1924
1924
|
argument,
|
|
1925
1925
|
reason: "must not be the zero address",
|
|
@@ -1934,7 +1934,7 @@ function batchLimitForMode(mode, limits) {
|
|
|
1934
1934
|
}
|
|
1935
1935
|
|
|
1936
1936
|
// src/fhe-disperse/types.ts
|
|
1937
|
-
var DisperseSubwalletNotFoundError = class extends
|
|
1937
|
+
var DisperseSubwalletNotFoundError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1938
1938
|
name = "DisperseSubwalletNotFoundError";
|
|
1939
1939
|
constructor(txHash, singletonAddress) {
|
|
1940
1940
|
super(
|
|
@@ -1946,7 +1946,7 @@ var DisperseSubwalletNotFoundError = class extends chunk56UI7LUR_cjs.TokenOpsSdk
|
|
|
1946
1946
|
);
|
|
1947
1947
|
}
|
|
1948
1948
|
};
|
|
1949
|
-
var DisperseEncryptedReserveNotGrantedError = class extends
|
|
1949
|
+
var DisperseEncryptedReserveNotGrantedError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1950
1950
|
name = "DisperseEncryptedReserveNotGrantedError";
|
|
1951
1951
|
constructor(txHash, callerAddress) {
|
|
1952
1952
|
super(
|
|
@@ -1968,7 +1968,7 @@ var disperseProductMapper = (name, _args, ctx) => {
|
|
|
1968
1968
|
case "UserNotRegistered":
|
|
1969
1969
|
return new NotRegisteredError({ ...ctx, user });
|
|
1970
1970
|
case "ContractNotAllowed":
|
|
1971
|
-
return new
|
|
1971
|
+
return new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1972
1972
|
method: ctx.method,
|
|
1973
1973
|
argument: "handle",
|
|
1974
1974
|
reason: "the handle's origin contract did not grant this singleton persistent ACL on the handle. ERC-7984 `transferred` handles are scoped to the token contract \u2014 disclose them through the token, not through `DisperseConfidential`."
|
|
@@ -2012,10 +2012,10 @@ var ConfidentialDisperseClient = class {
|
|
|
2012
2012
|
this.encryptor = config.encryptor;
|
|
2013
2013
|
this.#telemetry = config.telemetry;
|
|
2014
2014
|
const chainId = config.chainId ?? config.publicClient.chain?.id;
|
|
2015
|
-
const addressOverride = config.address ?
|
|
2016
|
-
const resolved = addressOverride ?? (chainId === void 0 ? void 0 :
|
|
2015
|
+
const addressOverride = config.address ? chunkJK4XMMKM_cjs.normaliseAddress(config.address) : void 0;
|
|
2016
|
+
const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunkPUPKNW3R_cjs.getFheDisperseSingletonAddress(chainId));
|
|
2017
2017
|
if (!resolved) {
|
|
2018
|
-
throw new
|
|
2018
|
+
throw new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
2019
2019
|
reason: chainId === void 0 ? "chain-id-missing" : "registry-not-deployed",
|
|
2020
2020
|
product: "fheDisperse",
|
|
2021
2021
|
contract: "disperseConfidentialSingleton",
|
|
@@ -2029,8 +2029,8 @@ var ConfidentialDisperseClient = class {
|
|
|
2029
2029
|
surface: "singleton",
|
|
2030
2030
|
chainId: chainId ?? null,
|
|
2031
2031
|
hasWallet: !!this.walletClient,
|
|
2032
|
-
aclResolved: !!config.aclAddress || chainId !== void 0 && !!
|
|
2033
|
-
sdkVersion:
|
|
2032
|
+
aclResolved: !!config.aclAddress || chainId !== void 0 && !!chunkFAXIIH5R_cjs.getFhevmAclAddress(chainId),
|
|
2033
|
+
sdkVersion: chunkKLKI352M_cjs.SDK_VERSION
|
|
2034
2034
|
});
|
|
2035
2035
|
}
|
|
2036
2036
|
/**
|
|
@@ -2041,7 +2041,7 @@ var ConfidentialDisperseClient = class {
|
|
|
2041
2041
|
*/
|
|
2042
2042
|
get aclAddress() {
|
|
2043
2043
|
if (this.#cachedAclAddress) return this.#cachedAclAddress;
|
|
2044
|
-
this.#cachedAclAddress = this.#aclAddressOverride ??
|
|
2044
|
+
this.#cachedAclAddress = this.#aclAddressOverride ?? chunkFAXIIH5R_cjs.requireFhevmAclAddress(this.publicClient.chain?.id, "ConfidentialDisperseClient");
|
|
2045
2045
|
return this.#cachedAclAddress;
|
|
2046
2046
|
}
|
|
2047
2047
|
// ============================================================
|
|
@@ -2168,13 +2168,20 @@ var ConfidentialDisperseClient = class {
|
|
|
2168
2168
|
* subtotal1` for the result to match the on-chain computation. Both this
|
|
2169
2169
|
* SDK and the contract round the BPS multiplication down (floor division).
|
|
2170
2170
|
*
|
|
2171
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
2172
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
2173
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
2174
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
2175
|
+
* transparent TTT test token uses 18 decimals. `totalTokens` follows this
|
|
2176
|
+
* convention.
|
|
2177
|
+
*
|
|
2171
2178
|
* @throws {TokenOpsSdkError} if mode is `"wallet-token-fee"` and `totalTokens` is not provided.
|
|
2172
2179
|
*/
|
|
2173
2180
|
async calculateFee(args) {
|
|
2174
2181
|
const fees = await this.getFees(args.user);
|
|
2175
2182
|
if (args.mode === "wallet-token-fee") {
|
|
2176
2183
|
if (args.totalTokens === void 0) {
|
|
2177
|
-
throw new
|
|
2184
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2178
2185
|
method: "calculateFee",
|
|
2179
2186
|
argument: "totalTokens",
|
|
2180
2187
|
reason: "is required for wallet-token-fee mode"
|
|
@@ -2231,6 +2238,13 @@ var ConfidentialDisperseClient = class {
|
|
|
2231
2238
|
* - `hasApprovedSubwallets` (wallet modes) or `isOperator(sender, singleton)` (direct mode)
|
|
2232
2239
|
* - `calculateFee` / `getBatchLimits`
|
|
2233
2240
|
* - Structural recipient + amount validation
|
|
2241
|
+
*
|
|
2242
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
2243
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
2244
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
2245
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
2246
|
+
* transparent TTT test token uses 18 decimals. Pass `amounts[]` in the same
|
|
2247
|
+
* units you will pass to `disperse` so the report reflects the real call.
|
|
2234
2248
|
*/
|
|
2235
2249
|
async preflightDisperse(args) {
|
|
2236
2250
|
const { user, token, recipients, amounts, mode } = args;
|
|
@@ -2334,12 +2348,12 @@ var ConfidentialDisperseClient = class {
|
|
|
2334
2348
|
if (isPaused) {
|
|
2335
2349
|
blockers.push("Singleton is paused");
|
|
2336
2350
|
blockerErrors.push(
|
|
2337
|
-
new
|
|
2351
|
+
new chunk67OV5CX2_cjs.PausedError({ method: "preflightDisperse", contractAddress: this.address })
|
|
2338
2352
|
);
|
|
2339
2353
|
}
|
|
2340
2354
|
if (callerBalance < fee.ethValue) {
|
|
2341
2355
|
blockerErrors.push(
|
|
2342
|
-
new
|
|
2356
|
+
new chunk67OV5CX2_cjs.InsufficientFeeError({
|
|
2343
2357
|
method: "preflightDisperse",
|
|
2344
2358
|
contractAddress: this.address,
|
|
2345
2359
|
feeKind: "gas",
|
|
@@ -2476,6 +2490,15 @@ var ConfidentialDisperseClient = class {
|
|
|
2476
2490
|
* 4. Computes `msg.value` for gas-fee modes; `0` for token-fee mode.
|
|
2477
2491
|
* 5. Dispatches to the correct contract function based on `mode`.
|
|
2478
2492
|
*
|
|
2493
|
+
* **Silent-zero transfers.** ERC-7984 transfers do not revert when the sender's encrypted balance is insufficient — the transfer succeeds and moves an encrypted zero instead. This is by design: reverting would leak balance information. The transaction receipt alone cannot tell you whether value actually moved.
|
|
2494
|
+
*
|
|
2495
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
2496
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
2497
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
2498
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
2499
|
+
* transparent TTT test token uses 18 decimals. Every entry of `amounts[]`
|
|
2500
|
+
* follows this convention.
|
|
2501
|
+
*
|
|
2479
2502
|
* @throws {TokenOpsSdkError} on input validation failure (first deterministic error).
|
|
2480
2503
|
* @throws {TokenOpsSdkError} if no encryptor is available at call time.
|
|
2481
2504
|
*/
|
|
@@ -2487,7 +2510,7 @@ var ConfidentialDisperseClient = class {
|
|
|
2487
2510
|
const account = this.#resolveAccount(wallet, args.account, "disperse");
|
|
2488
2511
|
const enc = resolveEncryptor(this.encryptor);
|
|
2489
2512
|
if (!enc) {
|
|
2490
|
-
throw new
|
|
2513
|
+
throw new chunk67OV5CX2_cjs.MissingEncryptorError("disperse", {
|
|
2491
2514
|
hint: "Pass `encryptor` to the call or the client config."
|
|
2492
2515
|
});
|
|
2493
2516
|
}
|
|
@@ -2582,7 +2605,7 @@ var ConfidentialDisperseClient = class {
|
|
|
2582
2605
|
const aclLogs = receipt.logs.filter(
|
|
2583
2606
|
(log) => log.address.toLowerCase() === this.aclAddress.toLowerCase()
|
|
2584
2607
|
);
|
|
2585
|
-
const events = viem.parseEventLogs({ abi: [
|
|
2608
|
+
const events = viem.parseEventLogs({ abi: [chunkFAXIIH5R_cjs.ACL_ALLOWED_EVENT], logs: aclLogs });
|
|
2586
2609
|
const granted = events.filter(
|
|
2587
2610
|
(ev) => ev.args.account.toLowerCase() === callerAddress && ev.args.caller.toLowerCase() === this.address.toLowerCase()
|
|
2588
2611
|
);
|
|
@@ -2590,7 +2613,7 @@ var ConfidentialDisperseClient = class {
|
|
|
2590
2613
|
throw new DisperseEncryptedReserveNotGrantedError(hash, accountAddress(account));
|
|
2591
2614
|
}
|
|
2592
2615
|
if (granted.length > 1) {
|
|
2593
|
-
throw new
|
|
2616
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventAmbiguousError({
|
|
2594
2617
|
method: "getEncryptedFeeReserve",
|
|
2595
2618
|
eventName: "Allowed",
|
|
2596
2619
|
contractAddress: this.aclAddress,
|
|
@@ -2791,6 +2814,12 @@ var ConfidentialDisperseClient = class {
|
|
|
2791
2814
|
* encryptor, or pass `encryptedInput` directly. The contract caps the
|
|
2792
2815
|
* withdrawal at the available reserve via `FHE.min`.
|
|
2793
2816
|
*
|
|
2817
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
2818
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
2819
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
2820
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
2821
|
+
* transparent TTT test token uses 18 decimals.
|
|
2822
|
+
*
|
|
2794
2823
|
* Returns the tx hash plus the **transferred** handle parsed from the
|
|
2795
2824
|
* `TokenFeeWithdrawn` event. Decrypt the handle via Zama's `userDecrypt`
|
|
2796
2825
|
* to view the actual amount moved (which can be less than requested when
|
|
@@ -2936,7 +2965,7 @@ var ConfidentialDisperseClient = class {
|
|
|
2936
2965
|
values: amounts
|
|
2937
2966
|
});
|
|
2938
2967
|
} catch (err) {
|
|
2939
|
-
throw
|
|
2968
|
+
throw chunkTEBM66WA_cjs.mapZamaError(err, { method: "disperse[direct]", operation: "encrypt" });
|
|
2940
2969
|
}
|
|
2941
2970
|
let ethValue = gasFeeOverride;
|
|
2942
2971
|
if (ethValue === void 0) {
|
|
@@ -2982,7 +3011,7 @@ var ConfidentialDisperseClient = class {
|
|
|
2982
3011
|
values: allValues
|
|
2983
3012
|
});
|
|
2984
3013
|
} catch (err) {
|
|
2985
|
-
throw
|
|
3014
|
+
throw chunkTEBM66WA_cjs.mapZamaError(err, { method: `disperse[${mode}]`, operation: "encrypt" });
|
|
2986
3015
|
}
|
|
2987
3016
|
const amountHandles = encrypted.handles.slice(0, count);
|
|
2988
3017
|
const subtotal0Handle = encrypted.handles[count];
|
|
@@ -3109,14 +3138,14 @@ var ConfidentialDisperseClient = class {
|
|
|
3109
3138
|
const hasAmount = amount !== void 0;
|
|
3110
3139
|
const hasInput = preEncrypted !== void 0;
|
|
3111
3140
|
if (hasAmount && hasInput) {
|
|
3112
|
-
throw new
|
|
3141
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
3113
3142
|
method,
|
|
3114
3143
|
argument: "amount/encryptedInput",
|
|
3115
3144
|
reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got both"
|
|
3116
3145
|
});
|
|
3117
3146
|
}
|
|
3118
3147
|
if (!hasAmount && !hasInput) {
|
|
3119
|
-
throw new
|
|
3148
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
3120
3149
|
method,
|
|
3121
3150
|
argument: "amount/encryptedInput",
|
|
3122
3151
|
reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got neither"
|
|
@@ -3125,7 +3154,7 @@ var ConfidentialDisperseClient = class {
|
|
|
3125
3154
|
if (hasInput) return preEncrypted;
|
|
3126
3155
|
const enc = encryptor ?? resolveEncryptor(this.encryptor);
|
|
3127
3156
|
if (!enc) {
|
|
3128
|
-
throw new
|
|
3157
|
+
throw new chunk67OV5CX2_cjs.MissingEncryptorError("encryptSingle", {
|
|
3129
3158
|
hint: "Pass `encryptor` to the call or the client config (eager or lazy factory)."
|
|
3130
3159
|
});
|
|
3131
3160
|
}
|
|
@@ -3137,19 +3166,19 @@ var ConfidentialDisperseClient = class {
|
|
|
3137
3166
|
value: amount
|
|
3138
3167
|
});
|
|
3139
3168
|
} catch (err) {
|
|
3140
|
-
throw
|
|
3169
|
+
throw chunkTEBM66WA_cjs.mapZamaError(err, { method: "encryptSingle", operation: "encrypt" });
|
|
3141
3170
|
}
|
|
3142
3171
|
}
|
|
3143
3172
|
#requireWallet(method) {
|
|
3144
3173
|
if (!this.walletClient) {
|
|
3145
|
-
throw new
|
|
3174
|
+
throw new chunk67OV5CX2_cjs.MissingWalletClientError(method);
|
|
3146
3175
|
}
|
|
3147
3176
|
return this.walletClient;
|
|
3148
3177
|
}
|
|
3149
3178
|
#resolveAccount(wallet, override, method) {
|
|
3150
3179
|
const acct = override ?? wallet.account;
|
|
3151
3180
|
if (!acct) {
|
|
3152
|
-
throw new
|
|
3181
|
+
throw new chunk67OV5CX2_cjs.MissingAccountError(method);
|
|
3153
3182
|
}
|
|
3154
3183
|
return acct;
|
|
3155
3184
|
}
|
|
@@ -3202,13 +3231,13 @@ var ConfidentialDisperseClient = class {
|
|
|
3202
3231
|
...value !== void 0 ? { value } : {}
|
|
3203
3232
|
});
|
|
3204
3233
|
} catch (err) {
|
|
3205
|
-
if (
|
|
3234
|
+
if (chunkKLKI352M_cjs.isContractRevert(err)) {
|
|
3206
3235
|
throw this.#mapRevert(method, err, productContext, accountAddress(account));
|
|
3207
3236
|
}
|
|
3208
3237
|
}
|
|
3209
3238
|
}
|
|
3210
3239
|
#mapRevert(method, err, productContext, account) {
|
|
3211
|
-
return
|
|
3240
|
+
return chunkKLKI352M_cjs.mapContractRevert(err, {
|
|
3212
3241
|
method,
|
|
3213
3242
|
contractAddress: this.address,
|
|
3214
3243
|
abi: disperseConfidentialAbi,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
4
4
|
var chains = require('viem/chains');
|
|
5
5
|
|
|
6
6
|
var DEPLOYED_ADDRESSES = {
|
|
@@ -50,7 +50,7 @@ function requireDeployedAddress(product, contract, chainId) {
|
|
|
50
50
|
const contractEntry = productEntry[contract];
|
|
51
51
|
const entry = contractEntry?.[chainId];
|
|
52
52
|
if (entry) return entry;
|
|
53
|
-
throw new
|
|
53
|
+
throw new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
54
54
|
reason: entry === null ? "registry-not-deployed" : "registry-unknown-chain",
|
|
55
55
|
product: String(product),
|
|
56
56
|
contract: String(contract),
|