@tokenops/sdk 1.0.0 → 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 +120 -26
- package/dist/{chunk-5SGMJADP.cjs → chunk-2NCLOQ56.cjs} +9 -9
- package/dist/{chunk-QIHZVLIK.js → chunk-2PWNH3UE.js} +35 -6
- package/dist/{chunk-T5LVV3KY.cjs → chunk-4WPGQSNT.cjs} +3 -3
- package/dist/{chunk-SUOG3BQS.cjs → chunk-5X5WL5CU.cjs} +266 -103
- 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-62DF53UQ.cjs → chunk-C7BRZXJA.cjs} +19 -21
- package/dist/{chunk-UOG4PJL5.js → chunk-DUZIIRPF.js} +181 -14
- package/dist/{chunk-Q7ARQSUH.cjs → chunk-FAXIIH5R.cjs} +3 -3
- package/dist/chunk-FT4LNBOS.js +11 -0
- package/dist/chunk-IJFQ5L4I.js +2171 -0
- package/dist/{chunk-52TC6BF7.js → chunk-IXLO7GO5.js} +210 -47
- 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-ECT3NL2L.js → chunk-NTZY6IB7.js} +4 -4
- package/dist/{chunk-ZHFLRKFY.js → chunk-ODLTEGHB.js} +1 -1
- package/dist/{chunk-HGXNRR25.js → chunk-ORFTDNFZ.js} +4 -4
- package/dist/{chunk-72YGZEQE.js → chunk-OXTLPTO3.js} +9 -11
- package/dist/{chunk-HTOMTEA3.cjs → chunk-PFXURMBZ.cjs} +77 -48
- package/dist/{chunk-OLDGMKW2.cjs → chunk-PUPKNW3R.cjs} +35 -2
- package/dist/{chunk-IVE3QEGD.js → chunk-QBJ7O2B4.js} +18 -1
- package/dist/{chunk-JFLEEXKP.js → chunk-SG65XWH7.js} +58 -2
- package/dist/{chunk-K6MFFDBJ.cjs → chunk-T46YXSBP.cjs} +11 -11
- package/dist/{chunk-NS44KBV5.cjs → chunk-TEBM66WA.cjs} +12 -12
- package/dist/{chunk-6ECAHP5O.cjs → chunk-TIUKIY5V.cjs} +200 -33
- package/dist/{chunk-QCA7O2Q5.cjs → chunk-V2PXZVBF.cjs} +4 -4
- package/dist/{chunk-JFR5J4FL.cjs → chunk-W7IGCOVL.cjs} +11 -11
- package/dist/chunk-WENHUPZC.cjs +2180 -0
- package/dist/{chunk-ZXCOJY2Z.js → chunk-WMACINXO.js} +1 -1
- package/dist/{chunk-COPFW5Z4.js → chunk-XGGTQQFH.js} +31 -2
- package/dist/{chunk-CMRETRZO.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/addresses.d.ts +22 -0
- package/dist/core/errors.d.ts +41 -1
- package/dist/core/revert-mapper.d.ts +77 -0
- package/dist/core/telemetry.d.ts +0 -3
- 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/operators.d.ts +1 -1
- 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/factory-advanced.d.ts +3 -3
- package/dist/fhe-airdrop/advanced/index.cjs +9 -8
- package/dist/fhe-airdrop/advanced/index.d.cts +2 -2
- package/dist/fhe-airdrop/advanced/index.d.ts +2 -2
- 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.d.cts +1 -1
- package/dist/fhe-airdrop/advanced/react/index.d.ts +1 -1
- 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 +94 -11
- 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 +8 -2
- 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/factory-advanced.d.ts +2 -2
- package/dist/fhe-vesting/advanced/index.cjs +8 -8
- package/dist/fhe-vesting/advanced/index.d.cts +2 -2
- package/dist/fhe-vesting/advanced/index.d.ts +2 -2
- 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.d.cts +1 -1
- package/dist/fhe-vesting/advanced/react/index.d.ts +1 -1
- package/dist/fhe-vesting/advanced/react/index.js +12 -11
- package/dist/fhe-vesting/encryption.d.ts +8 -0
- package/dist/fhe-vesting/factory.d.ts +6 -8
- 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 +101 -3
- 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 +7 -1
- 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 -2
- package/dist/index.cjs +73 -49
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/testnet-faucet/abis/confidential-test-token.d.ts +1039 -0
- package/dist/testnet-faucet/abis/index.d.ts +2 -0
- package/dist/testnet-faucet/abis/test-token.d.ts +253 -0
- package/dist/testnet-faucet/errors.d.ts +21 -0
- package/dist/testnet-faucet/faucet.d.ts +173 -0
- package/dist/testnet-faucet/index.cjs +212 -0
- package/dist/testnet-faucet/index.d.cts +8 -0
- package/dist/testnet-faucet/index.d.ts +8 -0
- package/dist/testnet-faucet/index.js +7 -0
- package/dist/testnet-faucet/react/_shared.d.ts +61 -0
- package/dist/testnet-faucet/react/index.cjs +384 -0
- package/dist/testnet-faucet/react/index.d.cts +39 -0
- package/dist/testnet-faucet/react/index.d.ts +39 -0
- package/dist/testnet-faucet/react/index.js +220 -0
- package/dist/testnet-faucet/react/useConfidentialBalance.d.ts +25 -0
- package/dist/testnet-faucet/react/useFaucetDecimals.d.ts +9 -0
- package/dist/testnet-faucet/react/useFaucetMetadata.d.ts +14 -0
- package/dist/testnet-faucet/react/useFaucetRate.d.ts +11 -0
- package/dist/testnet-faucet/react/useInferredTotalSupply.d.ts +11 -0
- package/dist/testnet-faucet/react/useMaxTotalSupply.d.ts +10 -0
- package/dist/testnet-faucet/react/useMintConfidential.d.ts +35 -0
- package/dist/testnet-faucet/react/useMintUnderlying.d.ts +31 -0
- package/dist/testnet-faucet/react/useUnderlyingBalance.d.ts +19 -0
- package/dist/testnet-faucet/react/useUnderlyingDecimals.d.ts +9 -0
- package/dist/testnet-faucet/react/useUnderlyingTokenAddress.d.ts +12 -0
- package/dist/testnet-faucet/types.d.ts +92 -0
- package/dist/testnet-faucet/validate.d.ts +44 -0
- package/package.json +79 -30
|
@@ -1,13 +1,14 @@
|
|
|
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 chunk2NCLOQ56_cjs = require('./chunk-2NCLOQ56.cjs');
|
|
5
|
+
var chunkFAXIIH5R_cjs = require('./chunk-FAXIIH5R.cjs');
|
|
6
|
+
var chunkFWHYQZ5E_cjs = require('./chunk-FWHYQZ5E.cjs');
|
|
7
|
+
var chunkKLKI352M_cjs = require('./chunk-KLKI352M.cjs');
|
|
8
|
+
var chunkJK4XMMKM_cjs = require('./chunk-JK4XMMKM.cjs');
|
|
8
9
|
var chunkVJKZWYYJ_cjs = require('./chunk-VJKZWYYJ.cjs');
|
|
9
10
|
var chunk66IHPTOK_cjs = require('./chunk-66IHPTOK.cjs');
|
|
10
|
-
var
|
|
11
|
+
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
11
12
|
var viem = require('viem');
|
|
12
13
|
|
|
13
14
|
// src/fhe-vesting/abis/manager.ts
|
|
@@ -995,7 +996,7 @@ function resolveEncryptor(source) {
|
|
|
995
996
|
var MAX_UINT64 = (1n << 64n) - 1n;
|
|
996
997
|
function assertUint64(value, label) {
|
|
997
998
|
if (value < 0n || value > MAX_UINT64) {
|
|
998
|
-
throw new
|
|
999
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
999
1000
|
method: "encryptUint64",
|
|
1000
1001
|
argument: label,
|
|
1001
1002
|
reason: `does not fit in uint64 (0..2^64-1)`,
|
|
@@ -1016,7 +1017,7 @@ async function encryptUint64({
|
|
|
1016
1017
|
userAddress
|
|
1017
1018
|
});
|
|
1018
1019
|
if (handles.length !== 1) {
|
|
1019
|
-
throw new
|
|
1020
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1020
1021
|
method: "encryptUint64",
|
|
1021
1022
|
argument: "handles",
|
|
1022
1023
|
reason: `expected 1 handle, got ${handles.length}`,
|
|
@@ -1035,7 +1036,7 @@ async function encryptUint64Batch({
|
|
|
1035
1036
|
values
|
|
1036
1037
|
}) {
|
|
1037
1038
|
if (values.length === 0) {
|
|
1038
|
-
throw new
|
|
1039
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1039
1040
|
method: "encryptUint64Batch",
|
|
1040
1041
|
argument: "values",
|
|
1041
1042
|
reason: "must be non-empty"
|
|
@@ -1048,7 +1049,7 @@ async function encryptUint64Batch({
|
|
|
1048
1049
|
userAddress
|
|
1049
1050
|
});
|
|
1050
1051
|
if (handles.length !== values.length) {
|
|
1051
|
-
throw new
|
|
1052
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1052
1053
|
method: "encryptUint64Batch",
|
|
1053
1054
|
argument: "handles",
|
|
1054
1055
|
reason: `expected ${values.length} handles, got ${handles.length}`,
|
|
@@ -1062,7 +1063,7 @@ async function encryptUint64Batch({
|
|
|
1062
1063
|
}
|
|
1063
1064
|
|
|
1064
1065
|
// src/fhe-vesting/errors.ts
|
|
1065
|
-
var VestingNotFoundError = class extends
|
|
1066
|
+
var VestingNotFoundError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1066
1067
|
name = "VestingNotFoundError";
|
|
1067
1068
|
constructor(args) {
|
|
1068
1069
|
super(`${args.method}: no vesting schedule found for ${args.vestingId}.`, {
|
|
@@ -1076,7 +1077,7 @@ var VestingNotFoundError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
|
|
|
1076
1077
|
});
|
|
1077
1078
|
}
|
|
1078
1079
|
};
|
|
1079
|
-
var NotVestingRecipientError = class extends
|
|
1080
|
+
var NotVestingRecipientError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1080
1081
|
name = "NotVestingRecipientError";
|
|
1081
1082
|
constructor(args) {
|
|
1082
1083
|
super(`${args.method}: caller is not the recipient of vesting ${args.vestingId}.`, {
|
|
@@ -1092,7 +1093,7 @@ var NotVestingRecipientError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError
|
|
|
1092
1093
|
});
|
|
1093
1094
|
}
|
|
1094
1095
|
};
|
|
1095
|
-
var ClaimLockedError = class extends
|
|
1096
|
+
var ClaimLockedError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1096
1097
|
name = "ClaimLockedError";
|
|
1097
1098
|
constructor(args) {
|
|
1098
1099
|
const detail = args.unlocksAt !== void 0 ? ` Unlocks at unix timestamp ${args.unlocksAt}.` : "";
|
|
@@ -1108,7 +1109,7 @@ var ClaimLockedError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
|
|
|
1108
1109
|
});
|
|
1109
1110
|
}
|
|
1110
1111
|
};
|
|
1111
|
-
var VestingRevokedError = class extends
|
|
1112
|
+
var VestingRevokedError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1112
1113
|
name = "VestingRevokedError";
|
|
1113
1114
|
constructor(args) {
|
|
1114
1115
|
const detail = args.revokedAt !== void 0 ? ` at unix timestamp ${args.revokedAt}` : "";
|
|
@@ -1124,7 +1125,7 @@ var VestingRevokedError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
|
|
|
1124
1125
|
});
|
|
1125
1126
|
}
|
|
1126
1127
|
};
|
|
1127
|
-
var VestingNotRevocableError = class extends
|
|
1128
|
+
var VestingNotRevocableError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1128
1129
|
name = "VestingNotRevocableError";
|
|
1129
1130
|
constructor(args) {
|
|
1130
1131
|
super(`${args.method}: vesting ${args.vestingId} was created as non-revocable.`, {
|
|
@@ -1138,7 +1139,7 @@ var VestingNotRevocableError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError
|
|
|
1138
1139
|
});
|
|
1139
1140
|
}
|
|
1140
1141
|
};
|
|
1141
|
-
var VestingExpiredError = class extends
|
|
1142
|
+
var VestingExpiredError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1142
1143
|
name = "VestingExpiredError";
|
|
1143
1144
|
constructor(args) {
|
|
1144
1145
|
super(`${args.method}: vesting ${args.vestingId} has already ended.`, {
|
|
@@ -1153,7 +1154,7 @@ var VestingExpiredError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
|
|
|
1153
1154
|
});
|
|
1154
1155
|
}
|
|
1155
1156
|
};
|
|
1156
|
-
var TransferAlreadyPendingError = class extends
|
|
1157
|
+
var TransferAlreadyPendingError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1157
1158
|
name = "TransferAlreadyPendingError";
|
|
1158
1159
|
constructor(args) {
|
|
1159
1160
|
super(`${args.method}: a transfer is already pending for vesting ${args.vestingId}.`, {
|
|
@@ -1169,7 +1170,7 @@ var TransferAlreadyPendingError = class extends chunk56UI7LUR_cjs.TokenOpsSdkErr
|
|
|
1169
1170
|
});
|
|
1170
1171
|
}
|
|
1171
1172
|
};
|
|
1172
|
-
var NoPendingTransferError = class extends
|
|
1173
|
+
var NoPendingTransferError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1173
1174
|
name = "NoPendingTransferError";
|
|
1174
1175
|
constructor(args) {
|
|
1175
1176
|
super(`${args.method}: no pending transfer for vesting ${args.vestingId}.`, {
|
|
@@ -1183,7 +1184,7 @@ var NoPendingTransferError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
|
|
|
1183
1184
|
});
|
|
1184
1185
|
}
|
|
1185
1186
|
};
|
|
1186
|
-
var NotPendingRecipientError = class extends
|
|
1187
|
+
var NotPendingRecipientError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1187
1188
|
name = "NotPendingRecipientError";
|
|
1188
1189
|
constructor(args) {
|
|
1189
1190
|
super(`${args.method}: caller is not the pending recipient of vesting ${args.vestingId}.`, {
|
|
@@ -1199,7 +1200,7 @@ var NotPendingRecipientError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError
|
|
|
1199
1200
|
});
|
|
1200
1201
|
}
|
|
1201
1202
|
};
|
|
1202
|
-
var TransferExpiredError = class extends
|
|
1203
|
+
var TransferExpiredError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1203
1204
|
name = "TransferExpiredError";
|
|
1204
1205
|
constructor(args) {
|
|
1205
1206
|
super(`${args.method}: pending transfer for vesting ${args.vestingId} has expired.`, {
|
|
@@ -1252,7 +1253,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1252
1253
|
constructor(config) {
|
|
1253
1254
|
this.publicClient = config.publicClient;
|
|
1254
1255
|
this.walletClient = config.walletClient;
|
|
1255
|
-
this.address =
|
|
1256
|
+
this.address = chunkJK4XMMKM_cjs.normaliseAddress(config.address);
|
|
1256
1257
|
this.encryptor = config.encryptor;
|
|
1257
1258
|
this.#telemetry = config.telemetry;
|
|
1258
1259
|
this.#aclAddressOverride = config.aclAddress;
|
|
@@ -1261,8 +1262,8 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1261
1262
|
surface: "manager",
|
|
1262
1263
|
chainId: chainIdForInit ?? null,
|
|
1263
1264
|
hasWallet: !!this.walletClient,
|
|
1264
|
-
aclResolved: !!config.aclAddress || chainIdForInit !== void 0 && !!
|
|
1265
|
-
sdkVersion:
|
|
1265
|
+
aclResolved: !!config.aclAddress || chainIdForInit !== void 0 && !!chunkFAXIIH5R_cjs.getFhevmAclAddress(chainIdForInit),
|
|
1266
|
+
sdkVersion: chunkKLKI352M_cjs.SDK_VERSION
|
|
1266
1267
|
});
|
|
1267
1268
|
}
|
|
1268
1269
|
/**
|
|
@@ -1273,7 +1274,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1273
1274
|
*/
|
|
1274
1275
|
get aclAddress() {
|
|
1275
1276
|
if (this.#cachedAclAddress) return this.#cachedAclAddress;
|
|
1276
|
-
this.#cachedAclAddress = this.#aclAddressOverride ??
|
|
1277
|
+
this.#cachedAclAddress = this.#aclAddressOverride ?? chunkFAXIIH5R_cjs.requireFhevmAclAddress(this.publicClient.chain?.id, "ConfidentialVestingManagerClient");
|
|
1277
1278
|
return this.#cachedAclAddress;
|
|
1278
1279
|
}
|
|
1279
1280
|
// ============================================================
|
|
@@ -1400,8 +1401,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1400
1401
|
* Accepts `bigint | number` for `start` / `end` for ergonomics on read paths
|
|
1401
1402
|
* — CI scripts typically derive these from `Number(process.env.X)` and
|
|
1402
1403
|
* forcing bigint coercion at the call site is a pure paper cut. The
|
|
1403
|
-
* underlying contract reads through unchanged (viem coerces).
|
|
1404
|
-
* devops-integrator MINOR-4; R25 close.
|
|
1404
|
+
* underlying contract reads through unchanged (viem coerces).
|
|
1405
1405
|
*/
|
|
1406
1406
|
async getAllRecipientsSliced(start, end) {
|
|
1407
1407
|
return this.#read("getAllRecipientsSliced", [BigInt(start), BigInt(end)]);
|
|
@@ -1517,11 +1517,11 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1517
1517
|
);
|
|
1518
1518
|
}
|
|
1519
1519
|
if (paused) {
|
|
1520
|
-
blockers.push(new
|
|
1520
|
+
blockers.push(new chunk67OV5CX2_cjs.PausedError({ method: "claim", contractAddress: this.address }));
|
|
1521
1521
|
}
|
|
1522
1522
|
if (feeInfo.feeType === 0 /* Gas */ && callerBalance < feeInfo.fee) {
|
|
1523
1523
|
blockers.push(
|
|
1524
|
-
new
|
|
1524
|
+
new chunk67OV5CX2_cjs.InsufficientFeeError({
|
|
1525
1525
|
method: "claim",
|
|
1526
1526
|
contractAddress: this.address,
|
|
1527
1527
|
feeKind: "gas",
|
|
@@ -1532,6 +1532,100 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1532
1532
|
}
|
|
1533
1533
|
return { ready: blockers.length === 0, blockers };
|
|
1534
1534
|
}
|
|
1535
|
+
/**
|
|
1536
|
+
* Read-only preflight for {@link createVesting} / {@link batchCreateVesting}.
|
|
1537
|
+
* Runs the deterministic-from-off-chain checks and reports blockers both as
|
|
1538
|
+
* human-readable strings (`blockers`) and as typed {@link TokenOpsSdkError}s
|
|
1539
|
+
* (`blockerErrors`), index-aligned.
|
|
1540
|
+
*
|
|
1541
|
+
* Preflight is **opt-in**. Consumers who have already validated state can
|
|
1542
|
+
* skip this call and invoke the write directly — they'll receive the same
|
|
1543
|
+
* typed errors at write time via the revert mapper.
|
|
1544
|
+
*
|
|
1545
|
+
* Report fields: `token`, `hasCreatorRole`, `isOperatorSet`, `ready`,
|
|
1546
|
+
* `blockers`, `blockerErrors` — see {@link CreateVestingPreflightReport} for
|
|
1547
|
+
* the meaning of each.
|
|
1548
|
+
*
|
|
1549
|
+
* Checks performed (all read-only, no gas):
|
|
1550
|
+
* - Structural `params` validation mirroring the contract's
|
|
1551
|
+
* `_validateVestingParams` (`InvalidArgumentError` blockers): recipient is
|
|
1552
|
+
* a checksummed non-zero address, `startTimestamp < endTimestamp`, cliff
|
|
1553
|
+
* within the window, `initialUnlockBps + cliffAmountBps ≤ 10000`.
|
|
1554
|
+
* - Role: creator holds `VESTING_CREATOR_ROLE`
|
|
1555
|
+
* ({@link AccessDeniedError} blocker).
|
|
1556
|
+
* - Operator: creator has approved this manager as an ERC-7984 operator on
|
|
1557
|
+
* the distribution token, required for the manager's
|
|
1558
|
+
* `confidentialTransferFrom` pull ({@link OperatorNotApprovedError} blocker).
|
|
1559
|
+
*
|
|
1560
|
+
* **Not preflight-detectable — read before trusting `ready: true`:**
|
|
1561
|
+
* - The creator's confidential token balance is an encrypted `euint64` the
|
|
1562
|
+
* SDK cannot read in plaintext. An underfunded create does **not** revert:
|
|
1563
|
+
* the contract's all-or-nothing `FHE.select` pattern silently zeroes the
|
|
1564
|
+
* vesting amounts instead. Confirm the creator's balance covers the total
|
|
1565
|
+
* before submitting.
|
|
1566
|
+
* - `batchCreateVesting` additionally enforces `items.length ≤ maxBatchSize()`
|
|
1567
|
+
* on-chain; check {@link maxBatchSize} for batches.
|
|
1568
|
+
*
|
|
1569
|
+
* Pausing the manager does NOT block vesting creation (only claims), so
|
|
1570
|
+
* paused state is intentionally not a blocker here.
|
|
1571
|
+
*
|
|
1572
|
+
* @param args.params The vesting schedule parameters to validate.
|
|
1573
|
+
* @param args.creator The address that will send the create transaction.
|
|
1574
|
+
* @returns A {@link CreateVestingPreflightReport}.
|
|
1575
|
+
*/
|
|
1576
|
+
async preflightCreateVesting(args) {
|
|
1577
|
+
const blockers = [];
|
|
1578
|
+
const blockerErrors = [];
|
|
1579
|
+
const pushBlocker = (err) => {
|
|
1580
|
+
blockerErrors.push(err);
|
|
1581
|
+
blockers.push(err.message);
|
|
1582
|
+
};
|
|
1583
|
+
for (const err of collectVestingParamsErrors(args.params, "createVesting")) {
|
|
1584
|
+
pushBlocker(err);
|
|
1585
|
+
}
|
|
1586
|
+
const [token, creatorRole] = await Promise.all([
|
|
1587
|
+
this.token(),
|
|
1588
|
+
this.#read("VESTING_CREATOR_ROLE")
|
|
1589
|
+
]);
|
|
1590
|
+
const [hasCreatorRole, isOperatorSet] = await Promise.all([
|
|
1591
|
+
this.hasRole(creatorRole, args.creator),
|
|
1592
|
+
this.publicClient.readContract({
|
|
1593
|
+
address: token,
|
|
1594
|
+
abi: chunkFWHYQZ5E_cjs.erc7984OperatorAbi,
|
|
1595
|
+
functionName: "isOperator",
|
|
1596
|
+
args: [args.creator, this.address]
|
|
1597
|
+
})
|
|
1598
|
+
]);
|
|
1599
|
+
if (!hasCreatorRole) {
|
|
1600
|
+
pushBlocker(
|
|
1601
|
+
new chunk67OV5CX2_cjs.AccessDeniedError({
|
|
1602
|
+
method: "createVesting",
|
|
1603
|
+
contractAddress: this.address,
|
|
1604
|
+
account: args.creator,
|
|
1605
|
+
role: creatorRole
|
|
1606
|
+
})
|
|
1607
|
+
);
|
|
1608
|
+
}
|
|
1609
|
+
if (!isOperatorSet) {
|
|
1610
|
+
pushBlocker(
|
|
1611
|
+
new chunk67OV5CX2_cjs.OperatorNotApprovedError({
|
|
1612
|
+
method: "createVesting",
|
|
1613
|
+
contractAddress: this.address,
|
|
1614
|
+
tokenAddress: token,
|
|
1615
|
+
holder: args.creator,
|
|
1616
|
+
spender: this.address
|
|
1617
|
+
})
|
|
1618
|
+
);
|
|
1619
|
+
}
|
|
1620
|
+
return {
|
|
1621
|
+
token,
|
|
1622
|
+
hasCreatorRole,
|
|
1623
|
+
isOperatorSet,
|
|
1624
|
+
ready: blockers.length === 0,
|
|
1625
|
+
blockers,
|
|
1626
|
+
blockerErrors
|
|
1627
|
+
};
|
|
1628
|
+
}
|
|
1535
1629
|
// ============================================================
|
|
1536
1630
|
// ENCRYPTED VIEWS (TX)
|
|
1537
1631
|
// ============================================================
|
|
@@ -1597,6 +1691,14 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1597
1691
|
*
|
|
1598
1692
|
* Pass `encryptedInput` to bypass the encryptor when you manage encryption yourself.
|
|
1599
1693
|
*
|
|
1694
|
+
* **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.
|
|
1695
|
+
*
|
|
1696
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
1697
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
1698
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
1699
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
1700
|
+
* transparent TTT test token uses 18 decimals.
|
|
1701
|
+
*
|
|
1600
1702
|
* @returns Transaction hash. Parse the `VestingCreated` event to extract the `vestingId`.
|
|
1601
1703
|
* @example
|
|
1602
1704
|
* const hash = await manager.createVesting({
|
|
@@ -1638,12 +1740,20 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1638
1740
|
*
|
|
1639
1741
|
* Respects `maxBatchSize` — check before calling on large lists.
|
|
1640
1742
|
*
|
|
1743
|
+
* **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.
|
|
1744
|
+
*
|
|
1745
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
1746
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
1747
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
1748
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
1749
|
+
* transparent TTT test token uses 18 decimals.
|
|
1750
|
+
*
|
|
1641
1751
|
* @returns Transaction hash.
|
|
1642
1752
|
*/
|
|
1643
1753
|
async batchCreateVesting(args) {
|
|
1644
1754
|
return chunkVJKZWYYJ_cjs.withTelemetry(this.#telemetry, "fhe-vesting.manager.batchCreateVesting", async () => {
|
|
1645
1755
|
if (args.items.length === 0) {
|
|
1646
|
-
throw new
|
|
1756
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1647
1757
|
method: "batchCreateVesting",
|
|
1648
1758
|
argument: "items",
|
|
1649
1759
|
reason: "must be non-empty"
|
|
@@ -1656,7 +1766,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1656
1766
|
const account = this.#resolveAccount(wallet, args.account, "batchCreateVesting");
|
|
1657
1767
|
const encryptor = args.encryptor ?? resolveEncryptor(this.encryptor);
|
|
1658
1768
|
if (!encryptor) {
|
|
1659
|
-
throw new
|
|
1769
|
+
throw new chunk67OV5CX2_cjs.MissingEncryptorError("batchCreateVesting");
|
|
1660
1770
|
}
|
|
1661
1771
|
const userAddress = accountAddress(account);
|
|
1662
1772
|
let batch;
|
|
@@ -1668,7 +1778,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1668
1778
|
values: args.items.map((it) => it.amount)
|
|
1669
1779
|
});
|
|
1670
1780
|
} catch (err) {
|
|
1671
|
-
throw
|
|
1781
|
+
throw chunkTEBM66WA_cjs.mapZamaError(err, { method: "batchCreateVesting", operation: "encrypt" });
|
|
1672
1782
|
}
|
|
1673
1783
|
try {
|
|
1674
1784
|
return await wallet.writeContract({
|
|
@@ -1688,6 +1798,9 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1688
1798
|
/**
|
|
1689
1799
|
* Claim all currently vested tokens for `vestingId`.
|
|
1690
1800
|
* For `FeeType.Gas` managers, pass `value` (gas fee in wei from `getFeeInfo()`).
|
|
1801
|
+
*
|
|
1802
|
+
* **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.
|
|
1803
|
+
*
|
|
1691
1804
|
* @param args Discriminated by `feeType`: pass `{ feeType, vestingId, value }` for Gas, `{ feeType, vestingId }` for DistributionToken.
|
|
1692
1805
|
* @returns Transaction hash.
|
|
1693
1806
|
* @example
|
|
@@ -1716,6 +1829,9 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1716
1829
|
/**
|
|
1717
1830
|
* Admin variant of `claim` — callable by the manager admin on behalf of any recipient.
|
|
1718
1831
|
* Useful for gas-sponsored claim flows. Same fee rules as `claim`.
|
|
1832
|
+
*
|
|
1833
|
+
* **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.
|
|
1834
|
+
*
|
|
1719
1835
|
* @param args Same discriminated union as `claim`.
|
|
1720
1836
|
* @returns Transaction hash.
|
|
1721
1837
|
*/
|
|
@@ -1744,6 +1860,15 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1744
1860
|
/**
|
|
1745
1861
|
* Claim a specific encrypted amount from a vesting schedule rather than the full claimable balance.
|
|
1746
1862
|
* The SDK encrypts `amount` — pass plaintext. Alternatively pass `encryptedInput` to bypass encryption.
|
|
1863
|
+
*
|
|
1864
|
+
* **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.
|
|
1865
|
+
*
|
|
1866
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
1867
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
1868
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
1869
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
1870
|
+
* transparent TTT test token uses 18 decimals.
|
|
1871
|
+
*
|
|
1747
1872
|
* @param args Includes `vestingId`, `amount` or `encryptedInput`, and optional `value` for Gas-fee managers.
|
|
1748
1873
|
* @returns Transaction hash.
|
|
1749
1874
|
*/
|
|
@@ -1778,6 +1903,15 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1778
1903
|
}
|
|
1779
1904
|
/**
|
|
1780
1905
|
* Admin variant of `partialClaim` — callable by the manager admin on behalf of any recipient.
|
|
1906
|
+
*
|
|
1907
|
+
* **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.
|
|
1908
|
+
*
|
|
1909
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
1910
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
1911
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
1912
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
1913
|
+
* transparent TTT test token uses 18 decimals.
|
|
1914
|
+
*
|
|
1781
1915
|
* @param args Same as `partialClaim`.
|
|
1782
1916
|
* @returns Transaction hash.
|
|
1783
1917
|
*/
|
|
@@ -1828,7 +1962,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1828
1962
|
*/
|
|
1829
1963
|
async batchRevokeVesting(vestingIds, account) {
|
|
1830
1964
|
if (vestingIds.length === 0) {
|
|
1831
|
-
throw new
|
|
1965
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1832
1966
|
method: "batchRevokeVesting",
|
|
1833
1967
|
argument: "vestingIds",
|
|
1834
1968
|
reason: "must be non-empty"
|
|
@@ -1884,7 +2018,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1884
2018
|
async splitVesting(args) {
|
|
1885
2019
|
const wallet = this.#requireWallet("splitVesting");
|
|
1886
2020
|
const account = this.#resolveAccount(wallet, args.account, "splitVesting");
|
|
1887
|
-
const { numerator, denominator } = args.preScaled ? { numerator: args.numerator, denominator: args.denominator } :
|
|
2021
|
+
const { numerator, denominator } = args.preScaled ? { numerator: args.numerator, denominator: args.denominator } : chunk2NCLOQ56_cjs.scaleRatio({
|
|
1888
2022
|
numerator: args.numerator,
|
|
1889
2023
|
denominator: args.denominator,
|
|
1890
2024
|
// The encrypted numerator is submitted via `encryptUint64`, so
|
|
@@ -1894,7 +2028,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1894
2028
|
width: "uint64"
|
|
1895
2029
|
});
|
|
1896
2030
|
if (denominator < 10000n) {
|
|
1897
|
-
throw new
|
|
2031
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1898
2032
|
method: "splitVesting",
|
|
1899
2033
|
argument: "denominator",
|
|
1900
2034
|
reason: "must be \u2265 10000 (the contract's MIN_SPLIT_DENOMINATOR floor)",
|
|
@@ -1902,7 +2036,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1902
2036
|
});
|
|
1903
2037
|
}
|
|
1904
2038
|
if (args.newRecipient === ZERO_ADDRESS) {
|
|
1905
|
-
throw new
|
|
2039
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1906
2040
|
method: "splitVesting",
|
|
1907
2041
|
argument: "newRecipient",
|
|
1908
2042
|
reason: "must not be the zero address"
|
|
@@ -1942,7 +2076,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1942
2076
|
(ev) => ev.args.originalVestingId.toLowerCase() === args.vestingId.toLowerCase() && ev.args.newRecipient.toLowerCase() === args.newRecipient.toLowerCase()
|
|
1943
2077
|
);
|
|
1944
2078
|
if (matches.length === 0) {
|
|
1945
|
-
throw new
|
|
2079
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventNotFoundError({
|
|
1946
2080
|
method: "splitVesting",
|
|
1947
2081
|
eventName: "VestingSplit",
|
|
1948
2082
|
contractAddress: this.address,
|
|
@@ -1951,7 +2085,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1951
2085
|
});
|
|
1952
2086
|
}
|
|
1953
2087
|
if (matches.length > 1) {
|
|
1954
|
-
throw new
|
|
2088
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventAmbiguousError({
|
|
1955
2089
|
method: "splitVesting",
|
|
1956
2090
|
eventName: "VestingSplit",
|
|
1957
2091
|
contractAddress: this.address,
|
|
@@ -1972,7 +2106,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1972
2106
|
*/
|
|
1973
2107
|
async initiateVestingTransfer(args) {
|
|
1974
2108
|
if (!viem.isAddress(args.newRecipient, { strict: true })) {
|
|
1975
|
-
throw new
|
|
2109
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1976
2110
|
method: "initiateVestingTransfer",
|
|
1977
2111
|
argument: "newRecipient",
|
|
1978
2112
|
reason: "must be a valid EIP-55 checksummed address",
|
|
@@ -1980,14 +2114,14 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1980
2114
|
});
|
|
1981
2115
|
}
|
|
1982
2116
|
if (args.newRecipient === ZERO_ADDRESS) {
|
|
1983
|
-
throw new
|
|
2117
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1984
2118
|
method: "initiateVestingTransfer",
|
|
1985
2119
|
argument: "newRecipient",
|
|
1986
2120
|
reason: "must not be the zero address"
|
|
1987
2121
|
});
|
|
1988
2122
|
}
|
|
1989
2123
|
if (args.transferDurationSeconds <= 0) {
|
|
1990
|
-
throw new
|
|
2124
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1991
2125
|
method: "initiateVestingTransfer",
|
|
1992
2126
|
argument: "transferDurationSeconds",
|
|
1993
2127
|
reason: "must be > 0",
|
|
@@ -2026,7 +2160,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2026
2160
|
*/
|
|
2027
2161
|
async directVestingTransfer(vestingId, newOwner, account) {
|
|
2028
2162
|
if (!viem.isAddress(newOwner, { strict: true })) {
|
|
2029
|
-
throw new
|
|
2163
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2030
2164
|
method: "directVestingTransfer",
|
|
2031
2165
|
argument: "newOwner",
|
|
2032
2166
|
reason: "must be a valid EIP-55 checksummed address",
|
|
@@ -2034,7 +2168,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2034
2168
|
});
|
|
2035
2169
|
}
|
|
2036
2170
|
if (newOwner === ZERO_ADDRESS) {
|
|
2037
|
-
throw new
|
|
2171
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2038
2172
|
method: "directVestingTransfer",
|
|
2039
2173
|
argument: "newOwner",
|
|
2040
2174
|
reason: "must not be the zero address"
|
|
@@ -2074,14 +2208,14 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2074
2208
|
*/
|
|
2075
2209
|
async batchDiscloseToParty(args) {
|
|
2076
2210
|
if (args.vestingIds.length === 0) {
|
|
2077
|
-
throw new
|
|
2211
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2078
2212
|
method: "batchDiscloseToParty",
|
|
2079
2213
|
argument: "vestingIds",
|
|
2080
2214
|
reason: "must be non-empty"
|
|
2081
2215
|
});
|
|
2082
2216
|
}
|
|
2083
2217
|
if (args.vestingIds.length !== args.disclosureTypes.length) {
|
|
2084
|
-
throw new
|
|
2218
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2085
2219
|
method: "batchDiscloseToParty",
|
|
2086
2220
|
argument: "disclosureTypes",
|
|
2087
2221
|
reason: `length mismatch: vestingIds=${args.vestingIds.length}, disclosureTypes=${args.disclosureTypes.length}`
|
|
@@ -2114,14 +2248,14 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2114
2248
|
*/
|
|
2115
2249
|
async adminBatchDiscloseToParty(args) {
|
|
2116
2250
|
if (args.vestingIds.length === 0) {
|
|
2117
|
-
throw new
|
|
2251
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2118
2252
|
method: "adminBatchDiscloseToParty",
|
|
2119
2253
|
argument: "vestingIds",
|
|
2120
2254
|
reason: "must be non-empty"
|
|
2121
2255
|
});
|
|
2122
2256
|
}
|
|
2123
2257
|
if (args.vestingIds.length !== args.disclosureTypes.length) {
|
|
2124
|
-
throw new
|
|
2258
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2125
2259
|
method: "adminBatchDiscloseToParty",
|
|
2126
2260
|
argument: "disclosureTypes",
|
|
2127
2261
|
reason: `length mismatch: vestingIds=${args.vestingIds.length}, disclosureTypes=${args.disclosureTypes.length}`
|
|
@@ -2153,7 +2287,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2153
2287
|
*/
|
|
2154
2288
|
async batchDiscloseHandlesToParty(handles, party, account) {
|
|
2155
2289
|
if (handles.length === 0) {
|
|
2156
|
-
throw new
|
|
2290
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2157
2291
|
method: "batchDiscloseHandlesToParty",
|
|
2158
2292
|
argument: "handles",
|
|
2159
2293
|
reason: "must be non-empty"
|
|
@@ -2167,6 +2301,13 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2167
2301
|
/**
|
|
2168
2302
|
* Withdraw a confidential token amount from the manager's balance back to the admin.
|
|
2169
2303
|
* The SDK encrypts `amount` — pass plaintext. Alternatively pass `encryptedInput`.
|
|
2304
|
+
*
|
|
2305
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
2306
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
2307
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
2308
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
2309
|
+
* transparent TTT test token uses 18 decimals.
|
|
2310
|
+
*
|
|
2170
2311
|
* @param args `{ amount }` (plaintext, SDK encrypts) or `{ encryptedInput }` (pre-encrypted).
|
|
2171
2312
|
* @returns Transaction hash.
|
|
2172
2313
|
*/
|
|
@@ -2223,12 +2364,19 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2223
2364
|
/**
|
|
2224
2365
|
* Withdraw accumulated token fees from a `FeeType.DistributionToken` manager. Admin only.
|
|
2225
2366
|
* The SDK encrypts `amount` — pass plaintext. Alternatively pass `encryptedInput`.
|
|
2367
|
+
*
|
|
2368
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
2369
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
2370
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
2371
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
2372
|
+
* transparent TTT test token uses 18 decimals.
|
|
2373
|
+
*
|
|
2226
2374
|
* @param args `{ to, amount }` (plaintext, SDK encrypts) or `{ to, encryptedInput }` (pre-encrypted).
|
|
2227
2375
|
* @returns Transaction hash.
|
|
2228
2376
|
*/
|
|
2229
2377
|
async withdrawTokenFee(args) {
|
|
2230
2378
|
if (args.to === ZERO_ADDRESS) {
|
|
2231
|
-
throw new
|
|
2379
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2232
2380
|
method: "withdrawTokenFee",
|
|
2233
2381
|
argument: "to",
|
|
2234
2382
|
reason: "must not be the zero address"
|
|
@@ -2393,21 +2541,21 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2393
2541
|
// ============================================================
|
|
2394
2542
|
#requireWallet(method) {
|
|
2395
2543
|
if (!this.walletClient) {
|
|
2396
|
-
throw new
|
|
2544
|
+
throw new chunk67OV5CX2_cjs.MissingWalletClientError(method);
|
|
2397
2545
|
}
|
|
2398
2546
|
return this.walletClient;
|
|
2399
2547
|
}
|
|
2400
2548
|
#resolveAccount(wallet, override, method) {
|
|
2401
2549
|
const acct = override ?? wallet.account;
|
|
2402
2550
|
if (!acct) {
|
|
2403
|
-
throw new
|
|
2551
|
+
throw new chunk67OV5CX2_cjs.MissingAccountError(method);
|
|
2404
2552
|
}
|
|
2405
2553
|
return acct;
|
|
2406
2554
|
}
|
|
2407
2555
|
async #encryptUint64(value, encryptor, account) {
|
|
2408
2556
|
const enc = encryptor ?? resolveEncryptor(this.encryptor);
|
|
2409
2557
|
if (!enc) {
|
|
2410
|
-
throw new
|
|
2558
|
+
throw new chunk67OV5CX2_cjs.MissingEncryptorError("encryptUint64", {
|
|
2411
2559
|
hint: "Pass `encryptor` to the call or the client config (eager or lazy factory)."
|
|
2412
2560
|
});
|
|
2413
2561
|
}
|
|
@@ -2419,7 +2567,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2419
2567
|
value
|
|
2420
2568
|
});
|
|
2421
2569
|
} catch (err) {
|
|
2422
|
-
throw
|
|
2570
|
+
throw chunkTEBM66WA_cjs.mapZamaError(err, { method: "encryptUint64", operation: "encrypt" });
|
|
2423
2571
|
}
|
|
2424
2572
|
}
|
|
2425
2573
|
/**
|
|
@@ -2433,14 +2581,14 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2433
2581
|
const hasAmount = args.amount !== void 0;
|
|
2434
2582
|
const hasInput = args.encryptedInput !== void 0;
|
|
2435
2583
|
if (hasAmount && hasInput) {
|
|
2436
|
-
throw new
|
|
2584
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2437
2585
|
method: args.method,
|
|
2438
2586
|
argument: "amount/encryptedInput",
|
|
2439
2587
|
reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got both"
|
|
2440
2588
|
});
|
|
2441
2589
|
}
|
|
2442
2590
|
if (!hasAmount && !hasInput) {
|
|
2443
|
-
throw new
|
|
2591
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2444
2592
|
method: args.method,
|
|
2445
2593
|
argument: "amount/encryptedInput",
|
|
2446
2594
|
reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got neither"
|
|
@@ -2456,7 +2604,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2456
2604
|
* the offending schedule id in its context.
|
|
2457
2605
|
*/
|
|
2458
2606
|
#mapRevert(method, err, productContext, account) {
|
|
2459
|
-
return
|
|
2607
|
+
return chunkKLKI352M_cjs.mapContractRevert(err, {
|
|
2460
2608
|
method,
|
|
2461
2609
|
contractAddress: this.address,
|
|
2462
2610
|
abi: confidentialVestingManagerAbi,
|
|
@@ -2502,7 +2650,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2502
2650
|
...value !== void 0 ? { value } : {}
|
|
2503
2651
|
});
|
|
2504
2652
|
} catch (err) {
|
|
2505
|
-
if (
|
|
2653
|
+
if (chunkKLKI352M_cjs.isContractRevert(err)) {
|
|
2506
2654
|
throw this.#mapRevert(method, err, productContext, accountAddress(account));
|
|
2507
2655
|
}
|
|
2508
2656
|
}
|
|
@@ -2515,7 +2663,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2515
2663
|
*/
|
|
2516
2664
|
async #discloseSingleWithReceipt(input) {
|
|
2517
2665
|
if (!viem.isAddress(input.party, { strict: true })) {
|
|
2518
|
-
throw new
|
|
2666
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2519
2667
|
method: input.functionName,
|
|
2520
2668
|
argument: "party",
|
|
2521
2669
|
reason: "must be a valid EIP-55 checksummed address",
|
|
@@ -2552,7 +2700,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2552
2700
|
(ev) => ev.args.vestingId.toLowerCase() === input.vestingId.toLowerCase() && ev.args.discloser.toLowerCase() === callerAddress && ev.args.party.toLowerCase() === input.party.toLowerCase()
|
|
2553
2701
|
);
|
|
2554
2702
|
if (matches.length === 0) {
|
|
2555
|
-
throw new
|
|
2703
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventNotFoundError({
|
|
2556
2704
|
method: input.functionName,
|
|
2557
2705
|
eventName: "AmountDisclosed",
|
|
2558
2706
|
contractAddress: this.address,
|
|
@@ -2561,7 +2709,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2561
2709
|
});
|
|
2562
2710
|
}
|
|
2563
2711
|
if (matches.length > 1) {
|
|
2564
|
-
throw new
|
|
2712
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventAmbiguousError({
|
|
2565
2713
|
method: input.functionName,
|
|
2566
2714
|
eventName: "AmountDisclosed",
|
|
2567
2715
|
contractAddress: this.address,
|
|
@@ -2578,7 +2726,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2578
2726
|
*/
|
|
2579
2727
|
async #discloseBatchWithReceipt(input) {
|
|
2580
2728
|
if (!viem.isAddress(input.party, { strict: true })) {
|
|
2581
|
-
throw new
|
|
2729
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2582
2730
|
method: input.functionName,
|
|
2583
2731
|
argument: "party",
|
|
2584
2732
|
reason: "must be a valid EIP-55 checksummed address",
|
|
@@ -2617,7 +2765,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2617
2765
|
for (const id of input.vestingIds) {
|
|
2618
2766
|
const handle = byVestingId.get(id.toLowerCase());
|
|
2619
2767
|
if (handle === void 0) {
|
|
2620
|
-
throw new
|
|
2768
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventNotFoundError({
|
|
2621
2769
|
method: input.functionName,
|
|
2622
2770
|
eventName: "AmountDisclosed",
|
|
2623
2771
|
contractAddress: this.address,
|
|
@@ -2636,45 +2784,8 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2636
2784
|
* than wait for the on-chain revert.
|
|
2637
2785
|
*/
|
|
2638
2786
|
#validateVestingParams(params, where) {
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
method: where,
|
|
2642
|
-
argument: "recipient",
|
|
2643
|
-
reason: "must be a valid EIP-55 checksummed address",
|
|
2644
|
-
value: params.recipient
|
|
2645
|
-
});
|
|
2646
|
-
}
|
|
2647
|
-
if (params.recipient === ZERO_ADDRESS) {
|
|
2648
|
-
throw new chunk56UI7LUR_cjs.InvalidArgumentError({
|
|
2649
|
-
method: where,
|
|
2650
|
-
argument: "recipient",
|
|
2651
|
-
reason: "must not be the zero address"
|
|
2652
|
-
});
|
|
2653
|
-
}
|
|
2654
|
-
if (params.startTimestamp >= params.endTimestamp) {
|
|
2655
|
-
throw new chunk56UI7LUR_cjs.InvalidArgumentError({
|
|
2656
|
-
method: where,
|
|
2657
|
-
argument: "startTimestamp/endTimestamp",
|
|
2658
|
-
reason: "startTimestamp must be strictly less than endTimestamp",
|
|
2659
|
-
value: { startTimestamp: params.startTimestamp, endTimestamp: params.endTimestamp }
|
|
2660
|
-
});
|
|
2661
|
-
}
|
|
2662
|
-
if (params.startTimestamp + params.cliffSeconds > params.endTimestamp) {
|
|
2663
|
-
throw new chunk56UI7LUR_cjs.InvalidArgumentError({
|
|
2664
|
-
method: where,
|
|
2665
|
-
argument: "cliffSeconds",
|
|
2666
|
-
reason: "cliff cannot extend past endTimestamp",
|
|
2667
|
-
value: params.cliffSeconds
|
|
2668
|
-
});
|
|
2669
|
-
}
|
|
2670
|
-
if (params.initialUnlockBps + params.cliffAmountBps > 1e4) {
|
|
2671
|
-
throw new chunk56UI7LUR_cjs.InvalidArgumentError({
|
|
2672
|
-
method: where,
|
|
2673
|
-
argument: "initialUnlockBps + cliffAmountBps",
|
|
2674
|
-
reason: "must be \u2264 10000 (100%)",
|
|
2675
|
-
value: { initialUnlockBps: params.initialUnlockBps, cliffAmountBps: params.cliffAmountBps }
|
|
2676
|
-
});
|
|
2677
|
-
}
|
|
2787
|
+
const [first] = collectVestingParamsErrors(params, where);
|
|
2788
|
+
if (first) throw first;
|
|
2678
2789
|
}
|
|
2679
2790
|
async #read(functionName, args = []) {
|
|
2680
2791
|
const result = await this.publicClient.readContract({
|
|
@@ -2720,12 +2831,12 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2720
2831
|
const aclLogs = receipt.logs.filter(
|
|
2721
2832
|
(log) => log.address.toLowerCase() === this.aclAddress.toLowerCase()
|
|
2722
2833
|
);
|
|
2723
|
-
const events = viem.parseEventLogs({ abi: [
|
|
2834
|
+
const events = viem.parseEventLogs({ abi: [chunkFAXIIH5R_cjs.ACL_ALLOWED_EVENT], logs: aclLogs });
|
|
2724
2835
|
const granted = events.filter(
|
|
2725
2836
|
(ev) => ev.args.account.toLowerCase() === callerAddress && ev.args.caller.toLowerCase() === this.address.toLowerCase()
|
|
2726
2837
|
);
|
|
2727
2838
|
if (granted.length === 0) {
|
|
2728
|
-
throw new
|
|
2839
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventNotFoundError({
|
|
2729
2840
|
method: functionName,
|
|
2730
2841
|
eventName: "Allowed",
|
|
2731
2842
|
contractAddress: this.aclAddress,
|
|
@@ -2734,7 +2845,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2734
2845
|
});
|
|
2735
2846
|
}
|
|
2736
2847
|
if (granted.length > 1) {
|
|
2737
|
-
throw new
|
|
2848
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventAmbiguousError({
|
|
2738
2849
|
method: functionName,
|
|
2739
2850
|
eventName: "Allowed",
|
|
2740
2851
|
contractAddress: this.aclAddress,
|
|
@@ -2753,6 +2864,58 @@ function accountAddress(account) {
|
|
|
2753
2864
|
return typeof account === "string" ? account : account.address;
|
|
2754
2865
|
}
|
|
2755
2866
|
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
2867
|
+
function collectVestingParamsErrors(params, where) {
|
|
2868
|
+
const errors = [];
|
|
2869
|
+
if (!viem.isAddress(params.recipient, { strict: true })) {
|
|
2870
|
+
errors.push(
|
|
2871
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2872
|
+
method: where,
|
|
2873
|
+
argument: "recipient",
|
|
2874
|
+
reason: "must be a valid EIP-55 checksummed address",
|
|
2875
|
+
value: params.recipient
|
|
2876
|
+
})
|
|
2877
|
+
);
|
|
2878
|
+
} else if (params.recipient === ZERO_ADDRESS) {
|
|
2879
|
+
errors.push(
|
|
2880
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2881
|
+
method: where,
|
|
2882
|
+
argument: "recipient",
|
|
2883
|
+
reason: "must not be the zero address"
|
|
2884
|
+
})
|
|
2885
|
+
);
|
|
2886
|
+
}
|
|
2887
|
+
if (params.startTimestamp >= params.endTimestamp) {
|
|
2888
|
+
errors.push(
|
|
2889
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2890
|
+
method: where,
|
|
2891
|
+
argument: "startTimestamp/endTimestamp",
|
|
2892
|
+
reason: "startTimestamp must be strictly less than endTimestamp",
|
|
2893
|
+
value: { startTimestamp: params.startTimestamp, endTimestamp: params.endTimestamp }
|
|
2894
|
+
})
|
|
2895
|
+
);
|
|
2896
|
+
}
|
|
2897
|
+
if (params.startTimestamp < params.endTimestamp && params.startTimestamp + params.cliffSeconds > params.endTimestamp) {
|
|
2898
|
+
errors.push(
|
|
2899
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2900
|
+
method: where,
|
|
2901
|
+
argument: "cliffSeconds",
|
|
2902
|
+
reason: "cliff cannot extend past endTimestamp",
|
|
2903
|
+
value: params.cliffSeconds
|
|
2904
|
+
})
|
|
2905
|
+
);
|
|
2906
|
+
}
|
|
2907
|
+
if (params.initialUnlockBps + params.cliffAmountBps > 1e4) {
|
|
2908
|
+
errors.push(
|
|
2909
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2910
|
+
method: where,
|
|
2911
|
+
argument: "initialUnlockBps + cliffAmountBps",
|
|
2912
|
+
reason: "must be \u2264 10000 (100%)",
|
|
2913
|
+
value: { initialUnlockBps: params.initialUnlockBps, cliffAmountBps: params.cliffAmountBps }
|
|
2914
|
+
})
|
|
2915
|
+
);
|
|
2916
|
+
}
|
|
2917
|
+
return errors;
|
|
2918
|
+
}
|
|
2756
2919
|
|
|
2757
2920
|
exports.ClaimLockedError = ClaimLockedError;
|
|
2758
2921
|
exports.ConfidentialVestingManagerClient = ConfidentialVestingManagerClient;
|