@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,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
|
// ============================================================
|
|
@@ -1516,11 +1517,11 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1516
1517
|
);
|
|
1517
1518
|
}
|
|
1518
1519
|
if (paused) {
|
|
1519
|
-
blockers.push(new
|
|
1520
|
+
blockers.push(new chunk67OV5CX2_cjs.PausedError({ method: "claim", contractAddress: this.address }));
|
|
1520
1521
|
}
|
|
1521
1522
|
if (feeInfo.feeType === 0 /* Gas */ && callerBalance < feeInfo.fee) {
|
|
1522
1523
|
blockers.push(
|
|
1523
|
-
new
|
|
1524
|
+
new chunk67OV5CX2_cjs.InsufficientFeeError({
|
|
1524
1525
|
method: "claim",
|
|
1525
1526
|
contractAddress: this.address,
|
|
1526
1527
|
feeKind: "gas",
|
|
@@ -1531,6 +1532,100 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1531
1532
|
}
|
|
1532
1533
|
return { ready: blockers.length === 0, blockers };
|
|
1533
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
|
+
}
|
|
1534
1629
|
// ============================================================
|
|
1535
1630
|
// ENCRYPTED VIEWS (TX)
|
|
1536
1631
|
// ============================================================
|
|
@@ -1596,6 +1691,14 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1596
1691
|
*
|
|
1597
1692
|
* Pass `encryptedInput` to bypass the encryptor when you manage encryption yourself.
|
|
1598
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
|
+
*
|
|
1599
1702
|
* @returns Transaction hash. Parse the `VestingCreated` event to extract the `vestingId`.
|
|
1600
1703
|
* @example
|
|
1601
1704
|
* const hash = await manager.createVesting({
|
|
@@ -1637,12 +1740,20 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1637
1740
|
*
|
|
1638
1741
|
* Respects `maxBatchSize` — check before calling on large lists.
|
|
1639
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
|
+
*
|
|
1640
1751
|
* @returns Transaction hash.
|
|
1641
1752
|
*/
|
|
1642
1753
|
async batchCreateVesting(args) {
|
|
1643
1754
|
return chunkVJKZWYYJ_cjs.withTelemetry(this.#telemetry, "fhe-vesting.manager.batchCreateVesting", async () => {
|
|
1644
1755
|
if (args.items.length === 0) {
|
|
1645
|
-
throw new
|
|
1756
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1646
1757
|
method: "batchCreateVesting",
|
|
1647
1758
|
argument: "items",
|
|
1648
1759
|
reason: "must be non-empty"
|
|
@@ -1655,7 +1766,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1655
1766
|
const account = this.#resolveAccount(wallet, args.account, "batchCreateVesting");
|
|
1656
1767
|
const encryptor = args.encryptor ?? resolveEncryptor(this.encryptor);
|
|
1657
1768
|
if (!encryptor) {
|
|
1658
|
-
throw new
|
|
1769
|
+
throw new chunk67OV5CX2_cjs.MissingEncryptorError("batchCreateVesting");
|
|
1659
1770
|
}
|
|
1660
1771
|
const userAddress = accountAddress(account);
|
|
1661
1772
|
let batch;
|
|
@@ -1667,7 +1778,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1667
1778
|
values: args.items.map((it) => it.amount)
|
|
1668
1779
|
});
|
|
1669
1780
|
} catch (err) {
|
|
1670
|
-
throw
|
|
1781
|
+
throw chunkTEBM66WA_cjs.mapZamaError(err, { method: "batchCreateVesting", operation: "encrypt" });
|
|
1671
1782
|
}
|
|
1672
1783
|
try {
|
|
1673
1784
|
return await wallet.writeContract({
|
|
@@ -1687,6 +1798,9 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1687
1798
|
/**
|
|
1688
1799
|
* Claim all currently vested tokens for `vestingId`.
|
|
1689
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
|
+
*
|
|
1690
1804
|
* @param args Discriminated by `feeType`: pass `{ feeType, vestingId, value }` for Gas, `{ feeType, vestingId }` for DistributionToken.
|
|
1691
1805
|
* @returns Transaction hash.
|
|
1692
1806
|
* @example
|
|
@@ -1715,6 +1829,9 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1715
1829
|
/**
|
|
1716
1830
|
* Admin variant of `claim` — callable by the manager admin on behalf of any recipient.
|
|
1717
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
|
+
*
|
|
1718
1835
|
* @param args Same discriminated union as `claim`.
|
|
1719
1836
|
* @returns Transaction hash.
|
|
1720
1837
|
*/
|
|
@@ -1743,6 +1860,15 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1743
1860
|
/**
|
|
1744
1861
|
* Claim a specific encrypted amount from a vesting schedule rather than the full claimable balance.
|
|
1745
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
|
+
*
|
|
1746
1872
|
* @param args Includes `vestingId`, `amount` or `encryptedInput`, and optional `value` for Gas-fee managers.
|
|
1747
1873
|
* @returns Transaction hash.
|
|
1748
1874
|
*/
|
|
@@ -1777,6 +1903,15 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1777
1903
|
}
|
|
1778
1904
|
/**
|
|
1779
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
|
+
*
|
|
1780
1915
|
* @param args Same as `partialClaim`.
|
|
1781
1916
|
* @returns Transaction hash.
|
|
1782
1917
|
*/
|
|
@@ -1827,7 +1962,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1827
1962
|
*/
|
|
1828
1963
|
async batchRevokeVesting(vestingIds, account) {
|
|
1829
1964
|
if (vestingIds.length === 0) {
|
|
1830
|
-
throw new
|
|
1965
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1831
1966
|
method: "batchRevokeVesting",
|
|
1832
1967
|
argument: "vestingIds",
|
|
1833
1968
|
reason: "must be non-empty"
|
|
@@ -1883,7 +2018,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1883
2018
|
async splitVesting(args) {
|
|
1884
2019
|
const wallet = this.#requireWallet("splitVesting");
|
|
1885
2020
|
const account = this.#resolveAccount(wallet, args.account, "splitVesting");
|
|
1886
|
-
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({
|
|
1887
2022
|
numerator: args.numerator,
|
|
1888
2023
|
denominator: args.denominator,
|
|
1889
2024
|
// The encrypted numerator is submitted via `encryptUint64`, so
|
|
@@ -1893,7 +2028,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1893
2028
|
width: "uint64"
|
|
1894
2029
|
});
|
|
1895
2030
|
if (denominator < 10000n) {
|
|
1896
|
-
throw new
|
|
2031
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1897
2032
|
method: "splitVesting",
|
|
1898
2033
|
argument: "denominator",
|
|
1899
2034
|
reason: "must be \u2265 10000 (the contract's MIN_SPLIT_DENOMINATOR floor)",
|
|
@@ -1901,7 +2036,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1901
2036
|
});
|
|
1902
2037
|
}
|
|
1903
2038
|
if (args.newRecipient === ZERO_ADDRESS) {
|
|
1904
|
-
throw new
|
|
2039
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1905
2040
|
method: "splitVesting",
|
|
1906
2041
|
argument: "newRecipient",
|
|
1907
2042
|
reason: "must not be the zero address"
|
|
@@ -1941,7 +2076,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1941
2076
|
(ev) => ev.args.originalVestingId.toLowerCase() === args.vestingId.toLowerCase() && ev.args.newRecipient.toLowerCase() === args.newRecipient.toLowerCase()
|
|
1942
2077
|
);
|
|
1943
2078
|
if (matches.length === 0) {
|
|
1944
|
-
throw new
|
|
2079
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventNotFoundError({
|
|
1945
2080
|
method: "splitVesting",
|
|
1946
2081
|
eventName: "VestingSplit",
|
|
1947
2082
|
contractAddress: this.address,
|
|
@@ -1950,7 +2085,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1950
2085
|
});
|
|
1951
2086
|
}
|
|
1952
2087
|
if (matches.length > 1) {
|
|
1953
|
-
throw new
|
|
2088
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventAmbiguousError({
|
|
1954
2089
|
method: "splitVesting",
|
|
1955
2090
|
eventName: "VestingSplit",
|
|
1956
2091
|
contractAddress: this.address,
|
|
@@ -1971,7 +2106,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1971
2106
|
*/
|
|
1972
2107
|
async initiateVestingTransfer(args) {
|
|
1973
2108
|
if (!viem.isAddress(args.newRecipient, { strict: true })) {
|
|
1974
|
-
throw new
|
|
2109
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1975
2110
|
method: "initiateVestingTransfer",
|
|
1976
2111
|
argument: "newRecipient",
|
|
1977
2112
|
reason: "must be a valid EIP-55 checksummed address",
|
|
@@ -1979,14 +2114,14 @@ var ConfidentialVestingManagerClient = class {
|
|
|
1979
2114
|
});
|
|
1980
2115
|
}
|
|
1981
2116
|
if (args.newRecipient === ZERO_ADDRESS) {
|
|
1982
|
-
throw new
|
|
2117
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1983
2118
|
method: "initiateVestingTransfer",
|
|
1984
2119
|
argument: "newRecipient",
|
|
1985
2120
|
reason: "must not be the zero address"
|
|
1986
2121
|
});
|
|
1987
2122
|
}
|
|
1988
2123
|
if (args.transferDurationSeconds <= 0) {
|
|
1989
|
-
throw new
|
|
2124
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1990
2125
|
method: "initiateVestingTransfer",
|
|
1991
2126
|
argument: "transferDurationSeconds",
|
|
1992
2127
|
reason: "must be > 0",
|
|
@@ -2025,7 +2160,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2025
2160
|
*/
|
|
2026
2161
|
async directVestingTransfer(vestingId, newOwner, account) {
|
|
2027
2162
|
if (!viem.isAddress(newOwner, { strict: true })) {
|
|
2028
|
-
throw new
|
|
2163
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2029
2164
|
method: "directVestingTransfer",
|
|
2030
2165
|
argument: "newOwner",
|
|
2031
2166
|
reason: "must be a valid EIP-55 checksummed address",
|
|
@@ -2033,7 +2168,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2033
2168
|
});
|
|
2034
2169
|
}
|
|
2035
2170
|
if (newOwner === ZERO_ADDRESS) {
|
|
2036
|
-
throw new
|
|
2171
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2037
2172
|
method: "directVestingTransfer",
|
|
2038
2173
|
argument: "newOwner",
|
|
2039
2174
|
reason: "must not be the zero address"
|
|
@@ -2073,14 +2208,14 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2073
2208
|
*/
|
|
2074
2209
|
async batchDiscloseToParty(args) {
|
|
2075
2210
|
if (args.vestingIds.length === 0) {
|
|
2076
|
-
throw new
|
|
2211
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2077
2212
|
method: "batchDiscloseToParty",
|
|
2078
2213
|
argument: "vestingIds",
|
|
2079
2214
|
reason: "must be non-empty"
|
|
2080
2215
|
});
|
|
2081
2216
|
}
|
|
2082
2217
|
if (args.vestingIds.length !== args.disclosureTypes.length) {
|
|
2083
|
-
throw new
|
|
2218
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2084
2219
|
method: "batchDiscloseToParty",
|
|
2085
2220
|
argument: "disclosureTypes",
|
|
2086
2221
|
reason: `length mismatch: vestingIds=${args.vestingIds.length}, disclosureTypes=${args.disclosureTypes.length}`
|
|
@@ -2113,14 +2248,14 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2113
2248
|
*/
|
|
2114
2249
|
async adminBatchDiscloseToParty(args) {
|
|
2115
2250
|
if (args.vestingIds.length === 0) {
|
|
2116
|
-
throw new
|
|
2251
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2117
2252
|
method: "adminBatchDiscloseToParty",
|
|
2118
2253
|
argument: "vestingIds",
|
|
2119
2254
|
reason: "must be non-empty"
|
|
2120
2255
|
});
|
|
2121
2256
|
}
|
|
2122
2257
|
if (args.vestingIds.length !== args.disclosureTypes.length) {
|
|
2123
|
-
throw new
|
|
2258
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2124
2259
|
method: "adminBatchDiscloseToParty",
|
|
2125
2260
|
argument: "disclosureTypes",
|
|
2126
2261
|
reason: `length mismatch: vestingIds=${args.vestingIds.length}, disclosureTypes=${args.disclosureTypes.length}`
|
|
@@ -2152,7 +2287,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2152
2287
|
*/
|
|
2153
2288
|
async batchDiscloseHandlesToParty(handles, party, account) {
|
|
2154
2289
|
if (handles.length === 0) {
|
|
2155
|
-
throw new
|
|
2290
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2156
2291
|
method: "batchDiscloseHandlesToParty",
|
|
2157
2292
|
argument: "handles",
|
|
2158
2293
|
reason: "must be non-empty"
|
|
@@ -2166,6 +2301,13 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2166
2301
|
/**
|
|
2167
2302
|
* Withdraw a confidential token amount from the manager's balance back to the admin.
|
|
2168
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
|
+
*
|
|
2169
2311
|
* @param args `{ amount }` (plaintext, SDK encrypts) or `{ encryptedInput }` (pre-encrypted).
|
|
2170
2312
|
* @returns Transaction hash.
|
|
2171
2313
|
*/
|
|
@@ -2222,12 +2364,19 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2222
2364
|
/**
|
|
2223
2365
|
* Withdraw accumulated token fees from a `FeeType.DistributionToken` manager. Admin only.
|
|
2224
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
|
+
*
|
|
2225
2374
|
* @param args `{ to, amount }` (plaintext, SDK encrypts) or `{ to, encryptedInput }` (pre-encrypted).
|
|
2226
2375
|
* @returns Transaction hash.
|
|
2227
2376
|
*/
|
|
2228
2377
|
async withdrawTokenFee(args) {
|
|
2229
2378
|
if (args.to === ZERO_ADDRESS) {
|
|
2230
|
-
throw new
|
|
2379
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2231
2380
|
method: "withdrawTokenFee",
|
|
2232
2381
|
argument: "to",
|
|
2233
2382
|
reason: "must not be the zero address"
|
|
@@ -2392,21 +2541,21 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2392
2541
|
// ============================================================
|
|
2393
2542
|
#requireWallet(method) {
|
|
2394
2543
|
if (!this.walletClient) {
|
|
2395
|
-
throw new
|
|
2544
|
+
throw new chunk67OV5CX2_cjs.MissingWalletClientError(method);
|
|
2396
2545
|
}
|
|
2397
2546
|
return this.walletClient;
|
|
2398
2547
|
}
|
|
2399
2548
|
#resolveAccount(wallet, override, method) {
|
|
2400
2549
|
const acct = override ?? wallet.account;
|
|
2401
2550
|
if (!acct) {
|
|
2402
|
-
throw new
|
|
2551
|
+
throw new chunk67OV5CX2_cjs.MissingAccountError(method);
|
|
2403
2552
|
}
|
|
2404
2553
|
return acct;
|
|
2405
2554
|
}
|
|
2406
2555
|
async #encryptUint64(value, encryptor, account) {
|
|
2407
2556
|
const enc = encryptor ?? resolveEncryptor(this.encryptor);
|
|
2408
2557
|
if (!enc) {
|
|
2409
|
-
throw new
|
|
2558
|
+
throw new chunk67OV5CX2_cjs.MissingEncryptorError("encryptUint64", {
|
|
2410
2559
|
hint: "Pass `encryptor` to the call or the client config (eager or lazy factory)."
|
|
2411
2560
|
});
|
|
2412
2561
|
}
|
|
@@ -2418,7 +2567,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2418
2567
|
value
|
|
2419
2568
|
});
|
|
2420
2569
|
} catch (err) {
|
|
2421
|
-
throw
|
|
2570
|
+
throw chunkTEBM66WA_cjs.mapZamaError(err, { method: "encryptUint64", operation: "encrypt" });
|
|
2422
2571
|
}
|
|
2423
2572
|
}
|
|
2424
2573
|
/**
|
|
@@ -2432,14 +2581,14 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2432
2581
|
const hasAmount = args.amount !== void 0;
|
|
2433
2582
|
const hasInput = args.encryptedInput !== void 0;
|
|
2434
2583
|
if (hasAmount && hasInput) {
|
|
2435
|
-
throw new
|
|
2584
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2436
2585
|
method: args.method,
|
|
2437
2586
|
argument: "amount/encryptedInput",
|
|
2438
2587
|
reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got both"
|
|
2439
2588
|
});
|
|
2440
2589
|
}
|
|
2441
2590
|
if (!hasAmount && !hasInput) {
|
|
2442
|
-
throw new
|
|
2591
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2443
2592
|
method: args.method,
|
|
2444
2593
|
argument: "amount/encryptedInput",
|
|
2445
2594
|
reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got neither"
|
|
@@ -2455,7 +2604,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2455
2604
|
* the offending schedule id in its context.
|
|
2456
2605
|
*/
|
|
2457
2606
|
#mapRevert(method, err, productContext, account) {
|
|
2458
|
-
return
|
|
2607
|
+
return chunkKLKI352M_cjs.mapContractRevert(err, {
|
|
2459
2608
|
method,
|
|
2460
2609
|
contractAddress: this.address,
|
|
2461
2610
|
abi: confidentialVestingManagerAbi,
|
|
@@ -2501,7 +2650,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2501
2650
|
...value !== void 0 ? { value } : {}
|
|
2502
2651
|
});
|
|
2503
2652
|
} catch (err) {
|
|
2504
|
-
if (
|
|
2653
|
+
if (chunkKLKI352M_cjs.isContractRevert(err)) {
|
|
2505
2654
|
throw this.#mapRevert(method, err, productContext, accountAddress(account));
|
|
2506
2655
|
}
|
|
2507
2656
|
}
|
|
@@ -2514,7 +2663,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2514
2663
|
*/
|
|
2515
2664
|
async #discloseSingleWithReceipt(input) {
|
|
2516
2665
|
if (!viem.isAddress(input.party, { strict: true })) {
|
|
2517
|
-
throw new
|
|
2666
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2518
2667
|
method: input.functionName,
|
|
2519
2668
|
argument: "party",
|
|
2520
2669
|
reason: "must be a valid EIP-55 checksummed address",
|
|
@@ -2551,7 +2700,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2551
2700
|
(ev) => ev.args.vestingId.toLowerCase() === input.vestingId.toLowerCase() && ev.args.discloser.toLowerCase() === callerAddress && ev.args.party.toLowerCase() === input.party.toLowerCase()
|
|
2552
2701
|
);
|
|
2553
2702
|
if (matches.length === 0) {
|
|
2554
|
-
throw new
|
|
2703
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventNotFoundError({
|
|
2555
2704
|
method: input.functionName,
|
|
2556
2705
|
eventName: "AmountDisclosed",
|
|
2557
2706
|
contractAddress: this.address,
|
|
@@ -2560,7 +2709,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2560
2709
|
});
|
|
2561
2710
|
}
|
|
2562
2711
|
if (matches.length > 1) {
|
|
2563
|
-
throw new
|
|
2712
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventAmbiguousError({
|
|
2564
2713
|
method: input.functionName,
|
|
2565
2714
|
eventName: "AmountDisclosed",
|
|
2566
2715
|
contractAddress: this.address,
|
|
@@ -2577,7 +2726,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2577
2726
|
*/
|
|
2578
2727
|
async #discloseBatchWithReceipt(input) {
|
|
2579
2728
|
if (!viem.isAddress(input.party, { strict: true })) {
|
|
2580
|
-
throw new
|
|
2729
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2581
2730
|
method: input.functionName,
|
|
2582
2731
|
argument: "party",
|
|
2583
2732
|
reason: "must be a valid EIP-55 checksummed address",
|
|
@@ -2616,7 +2765,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2616
2765
|
for (const id of input.vestingIds) {
|
|
2617
2766
|
const handle = byVestingId.get(id.toLowerCase());
|
|
2618
2767
|
if (handle === void 0) {
|
|
2619
|
-
throw new
|
|
2768
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventNotFoundError({
|
|
2620
2769
|
method: input.functionName,
|
|
2621
2770
|
eventName: "AmountDisclosed",
|
|
2622
2771
|
contractAddress: this.address,
|
|
@@ -2635,45 +2784,8 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2635
2784
|
* than wait for the on-chain revert.
|
|
2636
2785
|
*/
|
|
2637
2786
|
#validateVestingParams(params, where) {
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
method: where,
|
|
2641
|
-
argument: "recipient",
|
|
2642
|
-
reason: "must be a valid EIP-55 checksummed address",
|
|
2643
|
-
value: params.recipient
|
|
2644
|
-
});
|
|
2645
|
-
}
|
|
2646
|
-
if (params.recipient === ZERO_ADDRESS) {
|
|
2647
|
-
throw new chunk56UI7LUR_cjs.InvalidArgumentError({
|
|
2648
|
-
method: where,
|
|
2649
|
-
argument: "recipient",
|
|
2650
|
-
reason: "must not be the zero address"
|
|
2651
|
-
});
|
|
2652
|
-
}
|
|
2653
|
-
if (params.startTimestamp >= params.endTimestamp) {
|
|
2654
|
-
throw new chunk56UI7LUR_cjs.InvalidArgumentError({
|
|
2655
|
-
method: where,
|
|
2656
|
-
argument: "startTimestamp/endTimestamp",
|
|
2657
|
-
reason: "startTimestamp must be strictly less than endTimestamp",
|
|
2658
|
-
value: { startTimestamp: params.startTimestamp, endTimestamp: params.endTimestamp }
|
|
2659
|
-
});
|
|
2660
|
-
}
|
|
2661
|
-
if (params.startTimestamp + params.cliffSeconds > params.endTimestamp) {
|
|
2662
|
-
throw new chunk56UI7LUR_cjs.InvalidArgumentError({
|
|
2663
|
-
method: where,
|
|
2664
|
-
argument: "cliffSeconds",
|
|
2665
|
-
reason: "cliff cannot extend past endTimestamp",
|
|
2666
|
-
value: params.cliffSeconds
|
|
2667
|
-
});
|
|
2668
|
-
}
|
|
2669
|
-
if (params.initialUnlockBps + params.cliffAmountBps > 1e4) {
|
|
2670
|
-
throw new chunk56UI7LUR_cjs.InvalidArgumentError({
|
|
2671
|
-
method: where,
|
|
2672
|
-
argument: "initialUnlockBps + cliffAmountBps",
|
|
2673
|
-
reason: "must be \u2264 10000 (100%)",
|
|
2674
|
-
value: { initialUnlockBps: params.initialUnlockBps, cliffAmountBps: params.cliffAmountBps }
|
|
2675
|
-
});
|
|
2676
|
-
}
|
|
2787
|
+
const [first] = collectVestingParamsErrors(params, where);
|
|
2788
|
+
if (first) throw first;
|
|
2677
2789
|
}
|
|
2678
2790
|
async #read(functionName, args = []) {
|
|
2679
2791
|
const result = await this.publicClient.readContract({
|
|
@@ -2719,12 +2831,12 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2719
2831
|
const aclLogs = receipt.logs.filter(
|
|
2720
2832
|
(log) => log.address.toLowerCase() === this.aclAddress.toLowerCase()
|
|
2721
2833
|
);
|
|
2722
|
-
const events = viem.parseEventLogs({ abi: [
|
|
2834
|
+
const events = viem.parseEventLogs({ abi: [chunkFAXIIH5R_cjs.ACL_ALLOWED_EVENT], logs: aclLogs });
|
|
2723
2835
|
const granted = events.filter(
|
|
2724
2836
|
(ev) => ev.args.account.toLowerCase() === callerAddress && ev.args.caller.toLowerCase() === this.address.toLowerCase()
|
|
2725
2837
|
);
|
|
2726
2838
|
if (granted.length === 0) {
|
|
2727
|
-
throw new
|
|
2839
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventNotFoundError({
|
|
2728
2840
|
method: functionName,
|
|
2729
2841
|
eventName: "Allowed",
|
|
2730
2842
|
contractAddress: this.aclAddress,
|
|
@@ -2733,7 +2845,7 @@ var ConfidentialVestingManagerClient = class {
|
|
|
2733
2845
|
});
|
|
2734
2846
|
}
|
|
2735
2847
|
if (granted.length > 1) {
|
|
2736
|
-
throw new
|
|
2848
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventAmbiguousError({
|
|
2737
2849
|
method: functionName,
|
|
2738
2850
|
eventName: "Allowed",
|
|
2739
2851
|
contractAddress: this.aclAddress,
|
|
@@ -2752,6 +2864,58 @@ function accountAddress(account) {
|
|
|
2752
2864
|
return typeof account === "string" ? account : account.address;
|
|
2753
2865
|
}
|
|
2754
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
|
+
}
|
|
2755
2919
|
|
|
2756
2920
|
exports.ClaimLockedError = ClaimLockedError;
|
|
2757
2921
|
exports.ConfidentialVestingManagerClient = ConfidentialVestingManagerClient;
|