@umbra-privacy/sdk 2.0.1 → 2.0.3
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/dist/{chunk-MKNCBUFA.js → chunk-KH3YTDKA.js} +16 -16
- package/dist/chunk-KH3YTDKA.js.map +1 -0
- package/dist/{chunk-CFFLOE7D.cjs → chunk-UEI7SYH6.cjs} +16 -16
- package/dist/chunk-UEI7SYH6.cjs.map +1 -0
- package/dist/common/pda/index.cjs +34 -34
- package/dist/common/pda/index.d.cts +5 -5
- package/dist/common/pda/index.d.ts +5 -5
- package/dist/common/pda/index.js +1 -1
- package/dist/crypto/index.cjs +1 -1
- package/dist/crypto/index.js +1 -1
- package/dist/index.cjs +35 -35
- package/dist/index.js +2 -2
- package/dist/utils/index.cjs +34 -34
- package/dist/utils/index.js +1 -1
- package/package.json +19 -19
- package/dist/chunk-CFFLOE7D.cjs.map +0 -1
- package/dist/chunk-MKNCBUFA.js.map +0 -1
package/dist/utils/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkZY3TSHMJ_cjs = require('../chunk-ZY3TSHMJ.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkUEI7SYH6_cjs = require('../chunk-UEI7SYH6.cjs');
|
|
5
5
|
require('../chunk-TQQZGNOI.cjs');
|
|
6
6
|
var chunkDMPMQ74B_cjs = require('../chunk-DMPMQ74B.cjs');
|
|
7
7
|
var chunk5GUSMQ74_cjs = require('../chunk-5GUSMQ74.cjs');
|
|
@@ -1047,135 +1047,135 @@ Object.defineProperty(exports, "splitX25519PublicKeyIntoTwoU128s", {
|
|
|
1047
1047
|
});
|
|
1048
1048
|
Object.defineProperty(exports, "TOKEN_POOL_SEED", {
|
|
1049
1049
|
enumerable: true,
|
|
1050
|
-
get: function () { return
|
|
1050
|
+
get: function () { return chunkUEI7SYH6_cjs.TOKEN_POOL_SEED; }
|
|
1051
1051
|
});
|
|
1052
1052
|
Object.defineProperty(exports, "computeCompDefOffset", {
|
|
1053
1053
|
enumerable: true,
|
|
1054
|
-
get: function () { return
|
|
1054
|
+
get: function () { return chunkUEI7SYH6_cjs.computeCompDefOffset; }
|
|
1055
1055
|
});
|
|
1056
1056
|
Object.defineProperty(exports, "computeStructSeed", {
|
|
1057
1057
|
enumerable: true,
|
|
1058
|
-
get: function () { return
|
|
1058
|
+
get: function () { return chunkUEI7SYH6_cjs.computeStructSeed; }
|
|
1059
1059
|
});
|
|
1060
1060
|
Object.defineProperty(exports, "findActiveStealthPoolPda", {
|
|
1061
1061
|
enumerable: true,
|
|
1062
|
-
get: function () { return
|
|
1062
|
+
get: function () { return chunkUEI7SYH6_cjs.findActiveStealthPoolPda; }
|
|
1063
1063
|
});
|
|
1064
1064
|
Object.defineProperty(exports, "findArciumClusterPda", {
|
|
1065
1065
|
enumerable: true,
|
|
1066
|
-
get: function () { return
|
|
1066
|
+
get: function () { return chunkUEI7SYH6_cjs.findArciumClusterPda; }
|
|
1067
1067
|
});
|
|
1068
1068
|
Object.defineProperty(exports, "findArciumCompDefPda", {
|
|
1069
1069
|
enumerable: true,
|
|
1070
|
-
get: function () { return
|
|
1070
|
+
get: function () { return chunkUEI7SYH6_cjs.findArciumCompDefPda; }
|
|
1071
1071
|
});
|
|
1072
1072
|
Object.defineProperty(exports, "findArciumComputationPda", {
|
|
1073
1073
|
enumerable: true,
|
|
1074
|
-
get: function () { return
|
|
1074
|
+
get: function () { return chunkUEI7SYH6_cjs.findArciumComputationPda; }
|
|
1075
1075
|
});
|
|
1076
1076
|
Object.defineProperty(exports, "findArciumExecutingPoolPda", {
|
|
1077
1077
|
enumerable: true,
|
|
1078
|
-
get: function () { return
|
|
1078
|
+
get: function () { return chunkUEI7SYH6_cjs.findArciumExecutingPoolPda; }
|
|
1079
1079
|
});
|
|
1080
1080
|
Object.defineProperty(exports, "findArciumInfrastructurePdas", {
|
|
1081
1081
|
enumerable: true,
|
|
1082
|
-
get: function () { return
|
|
1082
|
+
get: function () { return chunkUEI7SYH6_cjs.findArciumInfrastructurePdas; }
|
|
1083
1083
|
});
|
|
1084
1084
|
Object.defineProperty(exports, "findArciumMempoolPda", {
|
|
1085
1085
|
enumerable: true,
|
|
1086
|
-
get: function () { return
|
|
1086
|
+
get: function () { return chunkUEI7SYH6_cjs.findArciumMempoolPda; }
|
|
1087
1087
|
});
|
|
1088
1088
|
Object.defineProperty(exports, "findArciumMxePda", {
|
|
1089
1089
|
enumerable: true,
|
|
1090
|
-
get: function () { return
|
|
1090
|
+
get: function () { return chunkUEI7SYH6_cjs.findArciumMxePda; }
|
|
1091
1091
|
});
|
|
1092
1092
|
Object.defineProperty(exports, "findClaimInputBufferPda", {
|
|
1093
1093
|
enumerable: true,
|
|
1094
|
-
get: function () { return
|
|
1094
|
+
get: function () { return chunkUEI7SYH6_cjs.findClaimInputBufferPda; }
|
|
1095
1095
|
});
|
|
1096
1096
|
Object.defineProperty(exports, "findConfidentialNullifierBufferPda", {
|
|
1097
1097
|
enumerable: true,
|
|
1098
|
-
get: function () { return
|
|
1098
|
+
get: function () { return chunkUEI7SYH6_cjs.findConfidentialNullifierBufferPda; }
|
|
1099
1099
|
});
|
|
1100
1100
|
Object.defineProperty(exports, "findEncryptedTokenAccountPda", {
|
|
1101
1101
|
enumerable: true,
|
|
1102
|
-
get: function () { return
|
|
1102
|
+
get: function () { return chunkUEI7SYH6_cjs.findEncryptedTokenAccountPda; }
|
|
1103
1103
|
});
|
|
1104
1104
|
Object.defineProperty(exports, "findEncryptedUserAccountPda", {
|
|
1105
1105
|
enumerable: true,
|
|
1106
|
-
get: function () { return
|
|
1106
|
+
get: function () { return chunkUEI7SYH6_cjs.findEncryptedUserAccountPda; }
|
|
1107
1107
|
});
|
|
1108
1108
|
Object.defineProperty(exports, "findFeeSchedulePda", {
|
|
1109
1109
|
enumerable: true,
|
|
1110
|
-
get: function () { return
|
|
1110
|
+
get: function () { return chunkUEI7SYH6_cjs.findFeeSchedulePda; }
|
|
1111
1111
|
});
|
|
1112
1112
|
Object.defineProperty(exports, "findNetworkComplianceGrantPda", {
|
|
1113
1113
|
enumerable: true,
|
|
1114
|
-
get: function () { return
|
|
1114
|
+
get: function () { return chunkUEI7SYH6_cjs.findNetworkComplianceGrantPda; }
|
|
1115
1115
|
});
|
|
1116
1116
|
Object.defineProperty(exports, "findNullifierSetPdas", {
|
|
1117
1117
|
enumerable: true,
|
|
1118
|
-
get: function () { return
|
|
1118
|
+
get: function () { return chunkUEI7SYH6_cjs.findNullifierSetPdas; }
|
|
1119
1119
|
});
|
|
1120
1120
|
Object.defineProperty(exports, "findProtocolConfigPda", {
|
|
1121
1121
|
enumerable: true,
|
|
1122
|
-
get: function () { return
|
|
1122
|
+
get: function () { return chunkUEI7SYH6_cjs.findProtocolConfigPda; }
|
|
1123
1123
|
});
|
|
1124
1124
|
Object.defineProperty(exports, "findProtocolFeeVaultPda", {
|
|
1125
1125
|
enumerable: true,
|
|
1126
|
-
get: function () { return
|
|
1126
|
+
get: function () { return chunkUEI7SYH6_cjs.findProtocolFeeVaultPda; }
|
|
1127
1127
|
});
|
|
1128
1128
|
Object.defineProperty(exports, "findPublicClaimComputationDataPda", {
|
|
1129
1129
|
enumerable: true,
|
|
1130
|
-
get: function () { return
|
|
1130
|
+
get: function () { return chunkUEI7SYH6_cjs.findPublicClaimComputationDataPda; }
|
|
1131
1131
|
});
|
|
1132
1132
|
Object.defineProperty(exports, "findPublicClaimInputBufferPda", {
|
|
1133
1133
|
enumerable: true,
|
|
1134
|
-
get: function () { return
|
|
1134
|
+
get: function () { return chunkUEI7SYH6_cjs.findPublicClaimInputBufferPda; }
|
|
1135
1135
|
});
|
|
1136
1136
|
Object.defineProperty(exports, "findPublicNullifierBufferPda", {
|
|
1137
1137
|
enumerable: true,
|
|
1138
|
-
get: function () { return
|
|
1138
|
+
get: function () { return chunkUEI7SYH6_cjs.findPublicNullifierBufferPda; }
|
|
1139
1139
|
});
|
|
1140
1140
|
Object.defineProperty(exports, "findPublicUtxoInputBufferPda", {
|
|
1141
1141
|
enumerable: true,
|
|
1142
|
-
get: function () { return
|
|
1142
|
+
get: function () { return chunkUEI7SYH6_cjs.findPublicUtxoInputBufferPda; }
|
|
1143
1143
|
});
|
|
1144
1144
|
Object.defineProperty(exports, "findRelayerFeeSchedulePda", {
|
|
1145
1145
|
enumerable: true,
|
|
1146
|
-
get: function () { return
|
|
1146
|
+
get: function () { return chunkUEI7SYH6_cjs.findRelayerFeeSchedulePda; }
|
|
1147
1147
|
});
|
|
1148
1148
|
Object.defineProperty(exports, "findRelayerFeeVaultPda", {
|
|
1149
1149
|
enumerable: true,
|
|
1150
|
-
get: function () { return
|
|
1150
|
+
get: function () { return chunkUEI7SYH6_cjs.findRelayerFeeVaultPda; }
|
|
1151
1151
|
});
|
|
1152
1152
|
Object.defineProperty(exports, "findRelayerPda", {
|
|
1153
1153
|
enumerable: true,
|
|
1154
|
-
get: function () { return
|
|
1154
|
+
get: function () { return chunkUEI7SYH6_cjs.findRelayerPda; }
|
|
1155
1155
|
});
|
|
1156
1156
|
Object.defineProperty(exports, "findSharedComplianceGrantPda", {
|
|
1157
1157
|
enumerable: true,
|
|
1158
|
-
get: function () { return
|
|
1158
|
+
get: function () { return chunkUEI7SYH6_cjs.findSharedComplianceGrantPda; }
|
|
1159
1159
|
});
|
|
1160
1160
|
Object.defineProperty(exports, "findStealthPoolPda", {
|
|
1161
1161
|
enumerable: true,
|
|
1162
|
-
get: function () { return
|
|
1162
|
+
get: function () { return chunkUEI7SYH6_cjs.findStealthPoolPda; }
|
|
1163
1163
|
});
|
|
1164
1164
|
Object.defineProperty(exports, "findTokenPoolPda", {
|
|
1165
1165
|
enumerable: true,
|
|
1166
|
-
get: function () { return
|
|
1166
|
+
get: function () { return chunkUEI7SYH6_cjs.findTokenPoolPda; }
|
|
1167
1167
|
});
|
|
1168
1168
|
Object.defineProperty(exports, "findUserComplianceGrantPda", {
|
|
1169
1169
|
enumerable: true,
|
|
1170
|
-
get: function () { return
|
|
1170
|
+
get: function () { return chunkUEI7SYH6_cjs.findUserComplianceGrantPda; }
|
|
1171
1171
|
});
|
|
1172
1172
|
Object.defineProperty(exports, "findUtxoInputBufferPda", {
|
|
1173
1173
|
enumerable: true,
|
|
1174
|
-
get: function () { return
|
|
1174
|
+
get: function () { return chunkUEI7SYH6_cjs.findUtxoInputBufferPda; }
|
|
1175
1175
|
});
|
|
1176
1176
|
Object.defineProperty(exports, "findVerifyingKeyPda", {
|
|
1177
1177
|
enumerable: true,
|
|
1178
|
-
get: function () { return
|
|
1178
|
+
get: function () { return chunkUEI7SYH6_cjs.findVerifyingKeyPda; }
|
|
1179
1179
|
});
|
|
1180
1180
|
Object.defineProperty(exports, "ConversionError", {
|
|
1181
1181
|
enumerable: true,
|
package/dist/utils/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { bigintToBinaryArrayLSB, calculateNetAmountAfterFee, calculateTransferFee, convertBn254FieldElementToCurve25519FieldElement, convertBn254FieldElementToDailyViewingKey, convertBn254FieldElementToMasterViewingKey, convertBn254FieldElementToMintViewingKey, convertBn254FieldElementToMonthlyViewingKey, convertBn254FieldElementToPoseidonCiphertext, convertBn254FieldElementToPoseidonHash, convertBn254FieldElementToPoseidonKey, convertBn254FieldElementToPoseidonPlaintext, convertBn254FieldElementToU256, convertBn254FieldElementToYearlyViewingKey, convertCurve25519FieldElementToBn254FieldElement, convertCurve25519FieldElementToRcCiphertext, convertCurve25519FieldElementToRcCounter, convertCurve25519FieldElementToRcKey, convertCurve25519FieldElementToRcPlaintext, convertCurve25519FieldElementToU256, convertI1024ToI128, convertI1024ToI16, convertI1024ToI256, convertI1024ToI32, convertI1024ToI512, convertI1024ToI64, convertI1024ToI8, convertI1024ToNumber, convertI1024ToU1024, convertI128ToI1024, convertI128ToI16, convertI128ToI256, convertI128ToI32, convertI128ToI512, convertI128ToI64, convertI128ToI8, convertI128ToNumber, convertI128ToU128, convertI16ToI1024, convertI16ToI128, convertI16ToI256, convertI16ToI32, convertI16ToI512, convertI16ToI64, convertI16ToI8, convertI16ToNumber, convertI16ToU16, convertI256ToI1024, convertI256ToI128, convertI256ToI16, convertI256ToI32, convertI256ToI512, convertI256ToI64, convertI256ToI8, convertI256ToNumber, convertI256ToU256, convertI32ToI1024, convertI32ToI128, convertI32ToI16, convertI32ToI256, convertI32ToI512, convertI32ToI64, convertI32ToI8, convertI32ToNumber, convertI32ToU32, convertI512ToI1024, convertI512ToI128, convertI512ToI16, convertI512ToI256, convertI512ToI32, convertI512ToI64, convertI512ToI8, convertI512ToNumber, convertI512ToU512, convertI64ToI1024, convertI64ToI128, convertI64ToI16, convertI64ToI256, convertI64ToI32, convertI64ToI512, convertI64ToI8, convertI64ToNumber, convertI64ToU64, convertI8ToI1024, convertI8ToI128, convertI8ToI16, convertI8ToI256, convertI8ToI32, convertI8ToI512, convertI8ToI64, convertI8ToNumber, convertI8ToU8, convertNumberToI1024, convertNumberToI128, convertNumberToI16, convertNumberToI256, convertNumberToI32, convertNumberToI512, convertNumberToI64, convertNumberToI8, convertNumberToU1024, convertNumberToU128, convertNumberToU16, convertNumberToU256, convertNumberToU32, convertNumberToU512, convertNumberToU64, convertNumberToU8, convertPoseidonCiphertextToBn254FieldElement, convertPoseidonCiphertextToU256, convertPoseidonHashToBn254FieldElement, convertPoseidonHashToU256, convertPoseidonKeyToBn254FieldElement, convertPoseidonKeyToU256, convertPoseidonPlaintextToBn254FieldElement, convertPoseidonPlaintextToU256, convertRcCiphertextToCurve25519FieldElement, convertRcCiphertextToU256, convertRcCounterToCurve25519FieldElement, convertRcCounterToU256, convertRcEncryptionNonceToU128, convertRcKeyToCurve25519FieldElement, convertRcKeyToU256, convertRcPlaintextToCurve25519FieldElement, convertRcPlaintextToU256, convertSharedSecretToX25519Bytes, convertU1024ToI1024, convertU1024ToNumber, convertU1024ToU128, convertU1024ToU16, convertU1024ToU256, convertU1024ToU32, convertU1024ToU512, convertU1024ToU64, convertU1024ToU8, convertU128ToI128, convertU128ToNumber, convertU128ToRcEncryptionNonce, convertU128ToU1024, convertU128ToU16, convertU128ToU256, convertU128ToU32, convertU128ToU512, convertU128ToU64, convertU128ToU8, convertU16ToI16, convertU16ToNumber, convertU16ToU1024, convertU16ToU128, convertU16ToU256, convertU16ToU32, convertU16ToU512, convertU16ToU64, convertU16ToU8, convertU256ToBase85Limbs, convertU256ToBn254FieldElement, convertU256ToCurve25519FieldElement, convertU256ToI256, convertU256ToNumber, convertU256ToPoseidonCiphertext, convertU256ToPoseidonHash, convertU256ToPoseidonKey, convertU256ToPoseidonPlaintext, convertU256ToRcCiphertext, convertU256ToRcCounter, convertU256ToRcKey, convertU256ToRcPlaintext, convertU256ToU1024, convertU256ToU128, convertU256ToU16, convertU256ToU32, convertU256ToU512, convertU256ToU64, convertU256ToU8, convertU32ToI32, convertU32ToNumber, convertU32ToU1024, convertU32ToU128, convertU32ToU16, convertU32ToU256, convertU32ToU512, convertU32ToU64, convertU32ToU8, convertU512ToI512, convertU512ToNumber, convertU512ToU1024, convertU512ToU128, convertU512ToU16, convertU512ToU256, convertU512ToU32, convertU512ToU64, convertU512ToU8, convertU64ToI64, convertU64ToNumber, convertU64ToU1024, convertU64ToU128, convertU64ToU16, convertU64ToU256, convertU64ToU32, convertU64ToU512, convertU64ToU8, convertU8ToI8, convertU8ToNumber, convertU8ToU1024, convertU8ToU128, convertU8ToU16, convertU8ToU256, convertU8ToU32, convertU8ToU512, convertU8ToU64, convertX25519BytesToSharedSecret, convertX25519BytesToX25519PrivateKey, convertX25519BytesToX25519PublicKey, convertX25519PrivateKeyToX25519Bytes, convertX25519PublicKeyToX25519Bytes, createBase85Limb, createBn254FieldElement, createCurve25519FieldElement, createMicroLamportsPerAcu, createOptionalData32, createPoseidonKey, createRcCiphertext, createRcEncryptionNonce, createRcKey, createRcPlaintext, createU128, createU256, createU32, createU64, decodeBeBytesToBn254FieldElement, decodeBeBytesToCurve25519FieldElement, decodeBeBytesToRcEncryptionNonce, decodeLeBytesToBn254FieldElement, decodeLeBytesToCurve25519FieldElement, decodeLeBytesToRcEncryptionNonce, defaultExtractUtcComponents, defaultGetUtcNow, encodeBn254FieldElementToBeBytes, encodeBn254FieldElementToLeBytes, encodeCurve25519FieldElementToBeBytes, encodeCurve25519FieldElementToLeBytes, encodeRcEncryptionNonceToBeBytes, encodeRcEncryptionNonceToLeBytes, extractClusterOffsetFromMxeAccount, extractTransferFeeConfig, extractUtcComponents, generateComputationOffset, generateRandomNonce, generateRandomU128, generateRandomU256, generateRandomU64, getByteAt, getExtractUtcComponentsFunction, getUtcNow, getUtcNowFunction, splitAddressToLowHigh, splitU256IntoTwoU128s, splitX25519PublicKeyIntoTwoU128s } from '../chunk-UXMQI6B7.js';
|
|
2
|
-
export { TOKEN_POOL_SEED, computeCompDefOffset, computeStructSeed, findActiveStealthPoolPda, findArciumClusterPda, findArciumCompDefPda, findArciumComputationPda, findArciumExecutingPoolPda, findArciumInfrastructurePdas, findArciumMempoolPda, findArciumMxePda, findClaimInputBufferPda, findConfidentialNullifierBufferPda, findEncryptedTokenAccountPda, findEncryptedUserAccountPda, findFeeSchedulePda, findNetworkComplianceGrantPda, findNullifierSetPdas, findProtocolConfigPda, findProtocolFeeVaultPda, findPublicClaimComputationDataPda, findPublicClaimInputBufferPda, findPublicNullifierBufferPda, findPublicUtxoInputBufferPda, findRelayerFeeSchedulePda, findRelayerFeeVaultPda, findRelayerPda, findSharedComplianceGrantPda, findStealthPoolPda, findTokenPoolPda, findUserComplianceGrantPda, findUtxoInputBufferPda, findVerifyingKeyPda } from '../chunk-
|
|
2
|
+
export { TOKEN_POOL_SEED, computeCompDefOffset, computeStructSeed, findActiveStealthPoolPda, findArciumClusterPda, findArciumCompDefPda, findArciumComputationPda, findArciumExecutingPoolPda, findArciumInfrastructurePdas, findArciumMempoolPda, findArciumMxePda, findClaimInputBufferPda, findConfidentialNullifierBufferPda, findEncryptedTokenAccountPda, findEncryptedUserAccountPda, findFeeSchedulePda, findNetworkComplianceGrantPda, findNullifierSetPdas, findProtocolConfigPda, findProtocolFeeVaultPda, findPublicClaimComputationDataPda, findPublicClaimInputBufferPda, findPublicNullifierBufferPda, findPublicUtxoInputBufferPda, findRelayerFeeSchedulePda, findRelayerFeeVaultPda, findRelayerPda, findSharedComplianceGrantPda, findStealthPoolPda, findTokenPoolPda, findUserComplianceGrantPda, findUtxoInputBufferPda, findVerifyingKeyPda } from '../chunk-KH3YTDKA.js';
|
|
3
3
|
import '../chunk-EEKF4553.js';
|
|
4
4
|
export { ConversionError, assertBigintInRange, assertByteLength, assertNumberInRange, createBytes, createSharedSecret, createU1024BeBytes, createU1024LeBytes, createU128BeBytes, createU128LeBytes, createU16BeBytes, createU16LeBytes, createU256BeBytes, createU256LeBytes, createU32BeBytes, createU32LeBytes, createU512BeBytes, createU512LeBytes, createU64BeBytes, createU64LeBytes, createU8BeBytes, createU8LeBytes, createX25519Bytes, createX25519PrivateKey, createX25519PublicKey, isConversionError } from '../chunk-UOFYS6M3.js';
|
|
5
5
|
export { convertU1024BeBytesToU1024LeBytes, convertU1024LeBytesToU1024BeBytes, convertU128BeBytesToU128LeBytes, convertU128LeBytesToU128BeBytes, convertU16BeBytesToU16LeBytes, convertU16LeBytesToU16BeBytes, convertU256BeBytesToU256LeBytes, convertU256LeBytesToU256BeBytes, convertU32BeBytesToU32LeBytes, convertU32LeBytesToU32BeBytes, convertU512BeBytesToU512LeBytes, convertU512LeBytesToU512BeBytes, convertU64BeBytesToU64LeBytes, convertU64LeBytesToU64BeBytes, convertU8BeBytesToU8LeBytes, convertU8LeBytesToU8BeBytes, decodeU1024BeBytesToU1024, decodeU1024LeBytesToU1024, decodeU128BeBytesToU128, decodeU128LeBytesToU128, decodeU16BeBytesToU16, decodeU16LeBytesToU16, decodeU256BeBytesToU256, decodeU256LeBytesToU256, decodeU32BeBytesToU32, decodeU32LeBytesToU32, decodeU512BeBytesToU512, decodeU512LeBytesToU512, decodeU64BeBytesToU64, decodeU64LeBytesToU64, decodeU8BeBytesToU8, decodeU8LeBytesToU8, encodeU1024ToU1024BeBytes, encodeU1024ToU1024LeBytes, encodeU128ToU128BeBytes, encodeU128ToU128LeBytes, encodeU16ToU16BeBytes, encodeU16ToU16LeBytes, encodeU256ToU256BeBytes, encodeU256ToU256LeBytes, encodeU32ToU32BeBytes, encodeU32ToU32LeBytes, encodeU512ToU512BeBytes, encodeU512ToU512LeBytes, encodeU64ToU64BeBytes, encodeU64ToU64LeBytes, encodeU8ToU8BeBytes, encodeU8ToU8LeBytes } from '../chunk-FQX6ZYGJ.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umbra-privacy/sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "A comprehensive TypeScript SDK for Umbra Privacy",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -148,28 +148,16 @@
|
|
|
148
148
|
"LICENSE"
|
|
149
149
|
],
|
|
150
150
|
"sideEffects": false,
|
|
151
|
-
"scripts": {
|
|
152
|
-
"build": "tsup",
|
|
153
|
-
"build:watch": "tsup --watch",
|
|
154
|
-
"dev": "tsup --watch",
|
|
155
|
-
"clean": "rm -rf dist node_modules/.cache",
|
|
156
|
-
"typecheck": "tsc --noEmit",
|
|
157
|
-
"lint": "eslint . --max-warnings 0",
|
|
158
|
-
"lint:fix": "eslint . --fix",
|
|
159
|
-
"test": "vitest run",
|
|
160
|
-
"test:watch": "vitest",
|
|
161
|
-
"test:coverage": "vitest run --coverage"
|
|
162
|
-
},
|
|
163
151
|
"dependencies": {
|
|
164
152
|
"@noble/ciphers": "^2.1.1",
|
|
165
153
|
"@noble/curves": "^2.0.1",
|
|
166
154
|
"@noble/hashes": "^2.0.1",
|
|
167
155
|
"@solana/kit": "^6.0.1",
|
|
168
156
|
"@solana/wallet-standard-features": "^1.3.0",
|
|
169
|
-
"@
|
|
170
|
-
"@umbra-privacy/umbra-codama": "
|
|
171
|
-
"@umbra-privacy/indexer-read-service-client": "
|
|
172
|
-
"@
|
|
157
|
+
"@wallet-standard/core": "^1.1.0",
|
|
158
|
+
"@umbra-privacy/umbra-codama": "2.0.1",
|
|
159
|
+
"@umbra-privacy/indexer-read-service-client": "2.0.1",
|
|
160
|
+
"@umbra-privacy/arcium-codama": "2.0.1"
|
|
173
161
|
},
|
|
174
162
|
"devDependencies": {
|
|
175
163
|
"@arcium-hq/client": "0.8.3",
|
|
@@ -208,5 +196,17 @@
|
|
|
208
196
|
"typescript",
|
|
209
197
|
"solana",
|
|
210
198
|
"cryptography"
|
|
211
|
-
]
|
|
212
|
-
|
|
199
|
+
],
|
|
200
|
+
"scripts": {
|
|
201
|
+
"build": "tsup",
|
|
202
|
+
"build:watch": "tsup --watch",
|
|
203
|
+
"dev": "tsup --watch",
|
|
204
|
+
"clean": "rm -rf dist node_modules/.cache",
|
|
205
|
+
"typecheck": "tsc --noEmit",
|
|
206
|
+
"lint": "eslint . --max-warnings 0",
|
|
207
|
+
"lint:fix": "eslint . --fix",
|
|
208
|
+
"test": "vitest run",
|
|
209
|
+
"test:watch": "vitest",
|
|
210
|
+
"test:coverage": "vitest run --coverage"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common/pda/umbra.ts","../src/common/pda/user.ts","../src/common/pda/arcium.ts","../src/common/pda/compliance.ts","../src/common/pda/global.ts","../src/common/pda/pool.ts","../src/common/pda/relayer.ts","../src/common/pda/fees.ts","../src/common/pda/zk.ts"],"names":["sha256","__name","getProgramDerivedAddress","encodeU128ToU128LeBytes","getAddressEncoder","getAccountOffsetEncoder","ARCIUM_MXE_ACCOUNT_SEED","assertU32","ARCIUM_MEMPOOL_SEED","encodeU32ToU32LeBytes","ARCIUM_EXEC_POOL_SEED","assertU64","ARCIUM_COMPUTATION_SEED","encodeU64ToU64LeBytes","ARCIUM_COMP_DEF_SEED","AR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yB;AAAA,IAC3C,cAAA,EAAgB,YAAA;AAAA,IAChB,KAAA,EAAO;AAAA,MACL,+BAAA;AAAA,MACAE,qBAAAA,EAAkB,CAAE,MAAA,CAAO,cAAc,CAAA;AAAA,MACzCC,mCAAAA,GAA0B,MAAA,CAAO,EAAE,OAAO,MAAA,CAAO,MAAM,GAAG;AAAA;AAC5D,GACD,CAAA;AACD,EAAA,OAAO,GAAA;AACT;AAdsBJ,wBAAA,CAAA,6BAAA,EAAA,+BAAA,CAAA;AAgDtB,eAAsB,iCAAA,CACpB,cAAA,EACA,MAAA,EACA,YAAA,EACqC;AACrC,EAAA,OAAOC,4BAAAA,CAAyB;AAAA,IAC9B,cAAA,EAAgB,YAAA;AAAA,IAChB,KAAA,EAAO;AAAA,MACL,uCAAA;AAAA,MACAE,qBAAAA,EAAkB,CAAE,MAAA,CAAO,cAAc,CAAA;AAAA,MACzCC,mCAAAA,GAA0B,MAAA,CAAO,EAAE,OAAO,MAAA,CAAO,MAAM,GAAG;AAAA;AAC5D,GACD,CAAA;AACH;AAbsBJ,wBAAA,CAAA,iCAAA,EAAA,mCAAA,CAAA","file":"chunk-CFFLOE7D.cjs","sourcesContent":["/**\n * Umbra PDA (Program Derived Address) Generator Utilities\n *\n * This module provides functions for deriving Umbra protocol account addresses,\n * specifically for mixer tree accounts used in the privacy-preserving UTXO system.\n *\n * @remarks\n * ## Mixer Tree Overview\n *\n * The mixer tree is an Indexed Merkle Tree (IMT) that stores Poseidon H2 hash\n * commitments to UTXOs. Multiple mixer trees can exist, with each tree indexed\n * sequentially (0, 1, 2, ...). When a tree reaches capacity, a new tree is\n * created and becomes the active tree. Old trees remain readable for proof\n * generation and claiming.\n *\n * ## Nullifier Set Overview\n *\n * Each mixer tree has five associated nullifier set accounts (variants 0-4). These\n * accounts form an Indexed Merkle Tree of nullifiers and serve as the primary\n * double-spend prevention mechanism: before a UTXO can be claimed its\n * nullifier is checked against -- and then inserted into -- the nullifier set.\n *\n * ## UTXO Burner Accounts\n *\n * Confidential and public UTXO burner accounts act as temporary storage for\n * nullifiers during relayer-submitted claim transactions. They are scoped to\n * a `(relayer, receiver_address, offset)` triple and are created and closed\n * within the same transaction.\n *\n * ## Utility Functions\n *\n * `computeStructSeed` is re-exported from this module because every other PDA module\n * depends on it to compute seed constants.\n *\n * @see {@link findStealthPoolPda}\n * @see {@link findActiveStealthPoolPda}\n * @see {@link findNullifierSetPdas}\n * @see {@link findConfidentialNullifierBufferPda}\n * @see {@link findPublicNullifierBufferPda}\n * @see {@link computeStructSeed}\n *\n * @packageDocumentation\n * @since 2.0.0\n * @module utils/pda/umbra\n */\n\nimport { type Address, getAddressEncoder, getProgramDerivedAddress } from \"@solana/kit\";\nimport { getAccountOffsetEncoder } from \"@umbra-privacy/umbra-codama\";\nimport { sha256 } from \"@noble/hashes/sha2.js\";\nimport type { U128 } from \"../../types\";\nimport { encodeU128ToU128LeBytes } from \"../converters/mathematics\";\n\n/**\n * Computes the SHA-256 hash of a struct/seed name string and returns the\n * result as a 32-byte `Uint8Array`.\n *\n * This mirrors the `sha256_seed!` macro and the `#[umbra_account]` macro used\n * in the Rust smart contract. Every PDA seed constant in the Umbra program is\n * derived as `SHA-256(struct_name_utf8)`.\n *\n * This function is also exported from the barrel (`index.ts`) for callers that\n * need to compute arbitrary struct seeds outside the SDK, for example when\n * verifying a PDA derivation manually or in tests.\n *\n * @param name - The struct or domain name to hash (UTF-8 string, e.g. `\"TokenPool\"`).\n * @returns A 32-byte `Uint8Array` containing the SHA-256 digest.\n *\n * @example\n * ```typescript\n * import { computeStructSeed } from \"@umbra-privacy/sdk\";\n *\n * const poolSeed = computeStructSeed(\"TokenPool\");\n * // poolSeed is SHA-256(\"TokenPool\") as a 32-byte Uint8Array\n * ```\n *\n * @public\n */\nexport function computeStructSeed(name: string): Uint8Array {\n return sha256(new TextEncoder().encode(name));\n}\n\n/**\n * SHA-256 of the string `\"StealthPool\"`, stored as a 32-byte `Uint8Array`.\n *\n * Matches `sha256_seed!(\"StealthPool\")` in the Rust smart contract. Used as\n * the first seed when deriving `StealthPool` PDAs.\n *\n * @internal\n */\nconst STEALTH_POOL_SEED = computeStructSeed(\"StealthPool\");\n\n/**\n * SHA-256 of the string `\"ConfidentialNullifierLinkerBuffer\"`, stored as a 32-byte `Uint8Array`.\n *\n * Matches `sha256_seed!(\"ConfidentialNullifierLinkerBuffer\")` in the Rust smart contract.\n * Used as the first seed when deriving confidential UTXO burner PDAs.\n *\n * @internal\n */\nconst CONF_UTXO_BURNER_SEED = computeStructSeed(\"ConfidentialNullifierLinkerBuffer\");\n\n/**\n * SHA-256 of the string `\"PublicNullifierLinkerBuffer\"`, stored as a 32-byte `Uint8Array`.\n *\n * Matches `sha256_seed!(\"PublicNullifierLinkerBuffer\")` in the Rust smart contract.\n * Used as the first seed when deriving public UTXO burner PDAs.\n *\n * @internal\n */\nconst PUB_UTXO_BURNER_SEED = computeStructSeed(\"PublicNullifierLinkerBuffer\");\n\n/**\n * SHA-256 of the string `\"Treap\"`, stored as a 32-byte `Uint8Array`.\n *\n * Matches `sha256_seed!(\"Treap\")` in the Rust smart contract. Used as the\n * first seed when deriving nullifier set account PDAs.\n *\n * @internal\n */\nconst TREAP_SEED = computeStructSeed(\"Treap\");\n\n/**\n * Derives the Program Derived Address for a stealth pool (mixer tree) at the given index.\n * Seeds: [StealthPool::SEED, index_u128_le]\n *\n * The mixer tree is an Indexed Merkle Tree (IMT) that stores Poseidon H2 hash\n * commitments for UTXOs. Multiple trees can exist simultaneously, each\n * identified by a sequential integer index.\n *\n * @param index - The mixer tree index, starting from `0n`.\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the derived PDA `Address`.\n *\n * @example\n * ```typescript\n * import { findStealthPoolPda } from \"@umbra-privacy/sdk\";\n *\n * const mixerTree0 = await findStealthPoolPda(0n as U128, networkConfig.programId);\n * ```\n *\n * @see {@link findActiveStealthPoolPda} for the convenience wrapper that always returns tree index 0\n * @see {@link findNullifierSetPdas} for the nullifier storage accounts associated with each tree\n * @see {@link findProtocolConfigPda} for the global account that stores the active tree index\n *\n * @public\n */\nexport async function findStealthPoolPda(index: U128, umbraProgram: Address): Promise<Address> {\n const [pda] = await getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [STEALTH_POOL_SEED, encodeU128ToU128LeBytes(index)],\n });\n\n return pda;\n}\n\n/**\n * Derives the Program Derived Address for the currently active stealth pool (tree index 0).\n * Seeds: [StealthPool::SEED, 0_u128_le]\n *\n * This is a convenience wrapper around `findStealthPoolPda(0n)` for the\n * common case where a caller needs the genesis tree address.\n *\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the PDA `Address` of tree index 0.\n *\n * @example\n * ```typescript\n * import { findActiveStealthPoolPda } from \"@umbra-privacy/sdk\";\n *\n * const activeMixer = await findActiveStealthPoolPda(networkConfig.programId);\n * ```\n *\n * @see {@link findStealthPoolPda} for arbitrary tree index derivation\n * @see {@link findProtocolConfigPda} for the account that tracks the true active index\n *\n * @public\n */\nexport async function findActiveStealthPoolPda(umbraProgram: Address): Promise<Address> {\n return findStealthPoolPda(0n as U128, umbraProgram);\n}\n\n/**\n * Derives the Program Derived Address for a confidential nullifier buffer account.\n * Seeds: [ConfidentialNullifierLinkerBuffer::SEED, relayer_pubkey, receiver_address, offset_u128_le]\n *\n * Confidential nullifier buffer accounts are temporary storage PDAs that hold\n * the nullifier set for a batch of confidential UTXOs being claimed in a\n * single relayer-submitted transaction.\n *\n * @param relayerAddress - The relayer's public key.\n * @param receiverAddress - The receiver's public key (claim destination address).\n * @param burnerAccountOffset - The U128 offset discriminator.\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the derived PDA `Address`.\n *\n * @example\n * ```typescript\n * import { findConfidentialNullifierBufferPda } from \"@umbra-privacy/sdk\";\n *\n * const burnerPda = await findConfidentialNullifierBufferPda(\n * relayerAddress,\n * receiverAddress,\n * 0n as U128,\n * networkConfig.programId,\n * );\n * ```\n *\n * @see {@link findPublicNullifierBufferPda} for the public-balance variant\n * @see {@link findNullifierSetPdas} for the nullifier storage accounts the burner writes into\n *\n * @public\n */\nexport async function findConfidentialNullifierBufferPda(\n relayerAddress: Address,\n receiverAddress: Address,\n burnerAccountOffset: U128,\n umbraProgram: Address,\n): Promise<Address> {\n const addressEncoder = getAddressEncoder();\n\n const [pda] = await getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [\n CONF_UTXO_BURNER_SEED,\n addressEncoder.encode(relayerAddress),\n addressEncoder.encode(receiverAddress),\n getAccountOffsetEncoder().encode({\n first: BigInt(burnerAccountOffset),\n }),\n ],\n });\n\n return pda;\n}\n\n/**\n * Derives the Program Derived Address for a public nullifier buffer account.\n * Seeds: [PublicNullifierLinkerBuffer::SEED, relayer_pubkey, receiver_address, offset_u128_le]\n *\n * Public nullifier buffer accounts serve the same purpose as confidential\n * nullifier buffer accounts but for claims that deposit into a public ATA\n * rather than an encrypted balance.\n *\n * @param relayerAddress - The relayer's public key.\n * @param receiverAddress - The receiver's public key (claim destination address).\n * @param burnerAccountOffset - The U128 offset discriminator.\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the derived PDA `Address`.\n *\n * @example\n * ```typescript\n * import { findPublicNullifierBufferPda } from \"@umbra-privacy/sdk\";\n *\n * const burnerPda = await findPublicNullifierBufferPda(\n * relayerAddress,\n * receiverAddress,\n * 0n as U128,\n * networkConfig.programId,\n * );\n * ```\n *\n * @see {@link findConfidentialNullifierBufferPda} for the confidential-balance variant\n * @see {@link findNullifierSetPdas} for the nullifier storage accounts the burner writes into\n *\n * @public\n */\nexport async function findPublicNullifierBufferPda(\n relayerAddress: Address,\n receiverAddress: Address,\n burnerAccountOffset: U128,\n umbraProgram: Address,\n): Promise<Address> {\n const addressEncoder = getAddressEncoder();\n\n const [pda] = await getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [\n PUB_UTXO_BURNER_SEED,\n addressEncoder.encode(relayerAddress),\n addressEncoder.encode(receiverAddress),\n getAccountOffsetEncoder().encode({\n first: BigInt(burnerAccountOffset),\n }),\n ],\n });\n\n return pda;\n}\n\n/**\n * Return type for `findNullifierSetPdas` containing all five nullifier set\n * account addresses for a given mixer tree index.\n *\n * @remarks\n * Each mixer tree has exactly five associated nullifier set accounts (variants 0-4).\n * Together they form the Indexed Merkle Tree of nullifiers that prevents\n * double-spending. All five accounts must be passed to claim instructions\n * so the program can update the correct nullifier set node.\n *\n * @see {@link findNullifierSetPdas}\n *\n * @public\n */\nexport interface NullifierSetPdas {\n /** Nullifier set account variant 0 (first segment of the nullifier IMT). @readonly */\n readonly treap0: Address;\n /** Nullifier set account variant 1 (second segment of the nullifier IMT). @readonly */\n readonly treap1: Address;\n /** Nullifier set account variant 2 (third segment of the nullifier IMT). @readonly */\n readonly treap2: Address;\n /** Nullifier set account variant 3 (fourth segment of the nullifier IMT). @readonly */\n readonly treap3: Address;\n /** Nullifier set account variant 4 (fifth segment of the nullifier IMT). @readonly */\n readonly treap4: Address;\n}\n\n/**\n * Derives all five nullifier set PDAs for a given mixer tree index.\n * Seeds (per variant): [Treap::SEED, stealth_pool_index_u128_le, variant_byte]\n *\n * Nullifier set accounts implement the Indexed Merkle Tree (IMT) of nullifiers\n * used to prevent double-spending of UTXOs. There are exactly five accounts\n * per mixer tree, addressed by variant byte 0-4.\n *\n * @param stealthPoolIndex - The mixer tree index whose nullifier set PDAs to derive.\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to a {@link NullifierSetPdas} object containing all\n * five nullifier set account addresses (`treap0` through `treap4`).\n *\n * @example\n * ```typescript\n * import { findNullifierSetPdas } from \"@umbra-privacy/sdk\";\n *\n * const nullifierSetPdas = await findNullifierSetPdas(0n as U128, networkConfig.programId);\n * console.log(nullifierSetPdas.treap0, nullifierSetPdas.treap1, nullifierSetPdas.treap2);\n * ```\n *\n * @see {@link findStealthPoolPda} for the Merkle commitment tree PDAs\n * @see {@link NullifierSetPdas} for the return type shape\n *\n * @public\n */\nexport async function findNullifierSetPdas(\n stealthPoolIndex: U128,\n umbraProgram: Address,\n): Promise<NullifierSetPdas> {\n const treapSeedBytes = TREAP_SEED;\n const indexBytes = encodeU128ToU128LeBytes(stealthPoolIndex);\n\n const derivePda = async (variant: number): Promise<Address> => {\n const [pda] = await getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [treapSeedBytes, indexBytes, new Uint8Array([variant])],\n });\n return pda;\n };\n\n const [treap0, treap1, treap2, treap3, treap4] = await Promise.all([\n derivePda(0),\n derivePda(1),\n derivePda(2),\n derivePda(3),\n derivePda(4),\n ]);\n\n return { treap0, treap1, treap2, treap3, treap4 };\n}\n","/**\n * User PDA Utilities\n *\n * This module provides functions to derive Program Derived Addresses (PDAs)\n * for user-related accounts in the Umbra protocol.\n *\n * @remarks\n * Umbra users have two distinct on-chain account types, both stored as\n * Arcium-encrypted accounts so their contents are opaque to on-chain\n * observers:\n *\n * - **`EncryptedUserAccount`** — stores the user's protocol-level state,\n * including their registered X25519 public key and account generation index.\n * Created once per user wallet via `RegisterUser`. Referenced by all\n * confidential and compliance instructions that need to look up the user's\n * encryption key.\n *\n * - **`EncryptedTokenAccount`** — stores the user's encrypted SPL token\n * balance for a specific mint. Created once per `(user, mint)` pair via\n * `InitialiseUserTokenAccount`. Modified by deposit, withdrawal, transfer,\n * and claim instructions.\n *\n * Both PDAs are keyed under the Umbra program address (not the Arcium program)\n * because the Umbra program owns and manages these accounts through its\n * instruction handlers and Arcium callbacks.\n *\n * @see {@link findEncryptedUserAccountPda}\n * @see {@link findEncryptedTokenAccountPda}\n *\n * @packageDocumentation\n * @since 2.0.0\n * @module utils/pda/user\n */\n\nimport { type Address, getAddressEncoder, getProgramDerivedAddress } from \"@solana/kit\";\nimport { computeStructSeed } from \"./umbra\";\n\n/**\n * SHA-256 of the string `\"EncryptedUserAccount\"`, stored as a 32-byte `Uint8Array`.\n *\n * Matches `EncryptedUserAccount::SEED` as generated by the\n * `#[umbra_account]` macro in `state/arcium/arcium_encrypted_user_account.rs`.\n * Used as the first seed when deriving encrypted user account PDAs.\n *\n * @internal\n */\nconst ENCRYPTED_USER_ACCOUNT_SEED = computeStructSeed(\"EncryptedUserAccount\");\n\n/**\n * SHA-256 of the string `\"EncryptedTokenAccount\"`, stored as a 32-byte `Uint8Array`.\n *\n * Matches `EncryptedTokenAccount::SEED` as generated by the\n * `#[umbra_account]` macro in `state/arcium/arcium_encrypted_token_account.rs`.\n * Used as the first seed when deriving encrypted token account PDAs.\n *\n * @internal\n */\nconst ENCRYPTED_TOKEN_ACCOUNT_SEED = computeStructSeed(\"EncryptedTokenAccount\");\n\n/**\n * Derives the Program Derived Address for an encrypted user account.\n * Seeds: [EncryptedUserAccount::SEED, user_pubkey]\n *\n * The `EncryptedUserAccount` is the user's top-level protocol identity\n * within Umbra. It is a singleton per user wallet and stores the user's\n * registered X25519 public key and account generation index.\n *\n * @param userPubkey - The user's wallet public key (Solana Ed25519 address).\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the derived PDA `Address`.\n *\n * @example\n * ```typescript\n * import { findEncryptedUserAccountPda } from \"@umbra-privacy/sdk\";\n *\n * const userAccountPda = await findEncryptedUserAccountPda(\n * userWalletAddress,\n * networkConfig.programId,\n * );\n * ```\n *\n * @see {@link findEncryptedTokenAccountPda} for per-mint encrypted balance accounts\n *\n * @public\n */\nexport async function findEncryptedUserAccountPda(\n userPubkey: Address,\n umbraProgram: Address,\n): Promise<Address> {\n const addressEncoder = getAddressEncoder();\n\n const [pda] = await getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [ENCRYPTED_USER_ACCOUNT_SEED, addressEncoder.encode(userPubkey)],\n });\n\n return pda;\n}\n\n/**\n * Derives the Program Derived Address for an encrypted token account.\n * Seeds: [EncryptedTokenAccount::SEED, user_pubkey, mint_pubkey]\n *\n * The `EncryptedTokenAccount` holds the user's encrypted SPL token\n * balance for a specific mint. A separate account exists for each\n * `(user, mint)` pair.\n *\n * @param userPubkey - The user's wallet public key (Solana Ed25519 address).\n * @param mintPubkey - The SPL token mint address.\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the derived PDA `Address`.\n *\n * @example\n * ```typescript\n * import { findEncryptedTokenAccountPda } from \"@umbra-privacy/sdk\";\n *\n * const tokenAccountPda = await findEncryptedTokenAccountPda(\n * userWalletAddress,\n * usdcMint,\n * networkConfig.programId,\n * );\n * ```\n *\n * @see {@link findEncryptedUserAccountPda} for the top-level user identity account\n * @see {@link findTokenPoolPda} for the per-mint pool configuration that governs this account's features\n *\n * @public\n */\nexport async function findEncryptedTokenAccountPda(\n userPubkey: Address,\n mintPubkey: Address,\n umbraProgram: Address,\n): Promise<Address> {\n const addressEncoder = getAddressEncoder();\n\n const [pda] = await getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [\n ENCRYPTED_TOKEN_ACCOUNT_SEED,\n addressEncoder.encode(userPubkey),\n addressEncoder.encode(mintPubkey),\n ],\n });\n\n return pda;\n}\n","/**\n * Arcium PDA (Program Derived Address) Generator Utilities\n *\n * This module provides functions for deriving Arcium protocol account addresses.\n * These PDAs are used to locate various Arcium accounts on-chain, including\n * MXE accounts, computation accounts, and cluster accounts.\n *\n * @see {@link findArciumMxePda}\n * @see {@link findArciumMempoolPda}\n * @see {@link findArciumExecutingPoolPda}\n * @see {@link findArciumComputationPda}\n * @see {@link findArciumCompDefPda}\n * @see {@link findArciumClusterPda}\n * @see {@link findArciumInfrastructurePdas}\n * @see {@link computeCompDefOffset}\n *\n * @packageDocumentation\n * @since 2.0.0\n * @module utils/pda/arcium\n */\n\nimport { type Address, getAddressEncoder, getProgramDerivedAddress } from \"@solana/kit\";\nimport { sha256 } from \"@noble/hashes/sha2.js\";\nimport {\n ARCIUM_MXE_ACCOUNT_SEED,\n ARCIUM_MEMPOOL_SEED,\n ARCIUM_EXEC_POOL_SEED,\n ARCIUM_COMPUTATION_SEED,\n ARCIUM_COMP_DEF_SEED,\n ARCIUM_CLUSTER_SEED,\n} from \"../../constants/arcium\";\nimport { type U32, assertU32, assertU64 } from \"../../types\";\nimport { encodeU32ToU32LeBytes, encodeU64ToU64LeBytes } from \"../converters/mathematics\";\n\n/* =============================================================================\n * COMPUTATION DEFINITION OFFSET DERIVATION\n * ============================================================================= */\n\n/**\n * Computes the computation definition offset from an Arcium instruction name.\n *\n * The comp-def offset uniquely identifies which comp-def account corresponds\n * to a given Umbra instruction. It is derived deterministically by taking the\n * SHA-256 hash of the instruction name and interpreting the first four bytes\n * as a little-endian u32.\n *\n * @param instructionName - The Arcium instruction name in snake_case format\n * (e.g. `\"register_user\"`, `\"deposit_into_existing_mxe_v3\"`).\n * @returns The computation definition offset as an unsigned 32-bit integer.\n *\n * @example\n * ```typescript\n * import { computeCompDefOffset } from \"@umbra-privacy/sdk\";\n *\n * const offset = computeCompDefOffset(\"register_user\");\n *\n * const compDefPda = await findArciumCompDefPda(\n * networkConfig.programId,\n * networkConfig.arciumProgramAddress,\n * offset,\n * );\n * ```\n *\n * @see {@link findArciumCompDefPda} for deriving the full comp-def PDA\n * @see {@link findArciumInfrastructurePdas} for deriving all Arcium accounts at once\n *\n * @public\n */\nexport function computeCompDefOffset(instructionName: string): number {\n // Hash the instruction name with SHA256\n const hash = sha256(new TextEncoder().encode(instructionName));\n\n // Take first 4 bytes and interpret as little-endian u32\n\n const byte0 = hash[0];\n\n const byte1 = hash[1];\n\n const byte2 = hash[2];\n\n const byte3 = hash[3];\n\n const offset = byte0 | (byte1 << 8) | (byte2 << 16) | (byte3 << 24);\n\n // Return as unsigned 32-bit integer\n return offset >>> 0;\n}\n\n/* =============================================================================\n * PDA DERIVATION FUNCTIONS\n * ============================================================================= */\n\n/**\n * Derives the Program Derived Address for the Arcium MXE registration account.\n * Seeds: [ARCIUM_MXE_ACCOUNT_SEED, umbra_program_pubkey] (against Arcium program)\n *\n * The MXE account is the Arcium protocol's main registration account for a\n * guest program (Umbra). Required as a read-only account on every\n * Arcium-integrated instruction.\n *\n * @param umbraProgram - The Umbra program address.\n * @param arciumProgram - The Arcium program address.\n * @returns A Promise resolving to the derived MXE account `Address`.\n *\n * @example\n * ```typescript\n * import { findArciumMxePda } from \"@umbra-privacy/sdk\";\n *\n * const mxeAccount = await findArciumMxePda(\n * networkConfig.programId,\n * networkConfig.arciumProgramAddress,\n * );\n * ```\n *\n * @see {@link findArciumInfrastructurePdas} for deriving all Arcium accounts at once\n *\n * @public\n */\nexport async function findArciumMxePda(\n umbraProgram: Address,\n arciumProgram: Address,\n): Promise<Address> {\n const [address] = await getProgramDerivedAddress({\n programAddress: arciumProgram,\n seeds: [\n new TextEncoder().encode(ARCIUM_MXE_ACCOUNT_SEED),\n getAddressEncoder().encode(umbraProgram),\n ],\n });\n return address;\n}\n\n/**\n * Derives the Program Derived Address for an Arcium cluster mempool account.\n * Seeds: [ARCIUM_MEMPOOL_SEED, cluster_offset_u32_le] (against Arcium program)\n *\n * The mempool account is a queue that holds pending computation requests\n * waiting to be picked up by cluster nodes.\n *\n * @param arciumProgram - The Arcium program address.\n * @param clusterOffset - The cluster offset (u32).\n * @returns A Promise resolving to the derived mempool account `Address`.\n *\n * @example\n * ```typescript\n * import { findArciumMempoolPda } from \"@umbra-privacy/sdk\";\n *\n * const mempoolAccount = await findArciumMempoolPda(\n * networkConfig.arciumProgramAddress,\n * networkConfig.clusterOffset,\n * );\n * ```\n *\n * @see {@link findArciumClusterPda} for the parent cluster account\n *\n * @public\n */\nexport async function findArciumMempoolPda(\n arciumProgram: Address,\n clusterOffset: number,\n): Promise<Address> {\n assertU32(BigInt(clusterOffset));\n const [address] = await getProgramDerivedAddress({\n programAddress: arciumProgram,\n seeds: [\n new TextEncoder().encode(ARCIUM_MEMPOOL_SEED),\n encodeU32ToU32LeBytes(BigInt(clusterOffset) as U32),\n ],\n });\n return address;\n}\n\n/**\n * Derives the Program Derived Address for an Arcium cluster executing pool account.\n * Seeds: [ARCIUM_EXEC_POOL_SEED, cluster_offset_u32_le] (against Arcium program)\n *\n * The executing pool account tracks computations currently being processed\n * by cluster nodes.\n *\n * @param arciumProgram - The Arcium program address.\n * @param clusterOffset - The cluster offset (u32).\n * @returns A Promise resolving to the derived executing pool account `Address`.\n *\n * @example\n * ```typescript\n * import { findArciumExecutingPoolPda } from \"@umbra-privacy/sdk\";\n *\n * const execPoolAccount = await findArciumExecutingPoolPda(\n * networkConfig.arciumProgramAddress,\n * networkConfig.clusterOffset,\n * );\n * ```\n *\n * @see {@link findArciumMempoolPda} for the pending computation queue\n * @see {@link findArciumClusterPda} for the parent cluster account\n *\n * @public\n */\nexport async function findArciumExecutingPoolPda(\n arciumProgram: Address,\n clusterOffset: number,\n): Promise<Address> {\n assertU32(BigInt(clusterOffset));\n const [address] = await getProgramDerivedAddress({\n programAddress: arciumProgram,\n seeds: [\n new TextEncoder().encode(ARCIUM_EXEC_POOL_SEED),\n encodeU32ToU32LeBytes(BigInt(clusterOffset) as U32),\n ],\n });\n return address;\n}\n\n/**\n * Derives the Program Derived Address for an individual Arcium computation account.\n * Seeds: [ARCIUM_COMPUTATION_SEED, cluster_offset_u32_le, computation_offset_u64_le] (against Arcium program)\n *\n * Each computation request gets its own account that stores the computation's\n * state. Created by `queue_computation` and closed when the callback executes.\n *\n * @param arciumProgram - The Arcium program address.\n * @param clusterOffset - The cluster offset (u32).\n * @param computationOffset - The computation offset (u64).\n * @returns A Promise resolving to the derived computation account `Address`.\n *\n * @example\n * ```typescript\n * import { findArciumComputationPda } from \"@umbra-privacy/sdk\";\n *\n * const computationAccount = await findArciumComputationPda(\n * networkConfig.arciumProgramAddress,\n * networkConfig.clusterOffset,\n * computationOffset,\n * );\n * ```\n *\n * @see {@link findArciumInfrastructurePdas} for deriving all required accounts at once\n * @see {@link findArciumCompDefPda} for the computation definition account\n *\n * @public\n */\nexport async function findArciumComputationPda(\n arciumProgram: Address,\n clusterOffset: number,\n computationOffset: bigint,\n): Promise<Address> {\n assertU32(BigInt(clusterOffset));\n assertU64(computationOffset);\n const [address] = await getProgramDerivedAddress({\n programAddress: arciumProgram,\n seeds: [\n new TextEncoder().encode(ARCIUM_COMPUTATION_SEED),\n encodeU32ToU32LeBytes(BigInt(clusterOffset) as U32),\n encodeU64ToU64LeBytes(computationOffset),\n ],\n });\n return address;\n}\n\n/**\n * Derives the Program Derived Address for an Arcium computation definition account.\n * Seeds: [ARCIUM_COMP_DEF_SEED, umbra_program_pubkey, comp_def_offset_u32_le] (against Arcium program)\n *\n * A computation definition account stores the encrypted circuit program that\n * cluster nodes execute for a specific Arcium instruction. One comp-def\n * account exists per Umbra instruction that uses Arcium MPC.\n *\n * @param umbraProgram - The Umbra program address.\n * @param arciumProgram - The Arcium program address.\n * @param compDefOffset - The computation definition offset, derived via\n * `computeCompDefOffset(instructionName)`.\n * @returns A Promise resolving to the derived comp-def account `Address`.\n *\n * @example\n * ```typescript\n * import { computeCompDefOffset, findArciumCompDefPda } from \"@umbra-privacy/sdk\";\n *\n * const offset = computeCompDefOffset(\"deposit_into_existing_mxe_v3\");\n * const compDefAccount = await findArciumCompDefPda(\n * networkConfig.programId,\n * networkConfig.arciumProgramAddress,\n * offset,\n * );\n * ```\n *\n * @see {@link computeCompDefOffset} for computing the offset from an instruction name\n * @see {@link findArciumInfrastructurePdas} for deriving all required accounts at once\n *\n * @public\n */\nexport async function findArciumCompDefPda(\n umbraProgram: Address,\n arciumProgram: Address,\n compDefOffset: number,\n): Promise<Address> {\n assertU32(BigInt(compDefOffset));\n const [address] = await getProgramDerivedAddress({\n programAddress: arciumProgram,\n seeds: [\n new TextEncoder().encode(ARCIUM_COMP_DEF_SEED),\n getAddressEncoder().encode(umbraProgram),\n encodeU32ToU32LeBytes(BigInt(compDefOffset) as U32),\n ],\n });\n return address;\n}\n\n/**\n * Derives the Program Derived Address for an Arcium cluster account.\n * Seeds: [ARCIUM_CLUSTER_SEED, cluster_offset_u32_le] (against Arcium program)\n *\n * A cluster account represents a group of Arcium MXE nodes that jointly\n * process computations using multi-party computation (MPC).\n *\n * @param arciumProgram - The Arcium program address.\n * @param clusterOffset - The cluster offset (u32).\n * @returns A Promise resolving to the derived cluster account `Address`.\n *\n * @example\n * ```typescript\n * import { findArciumClusterPda } from \"@umbra-privacy/sdk\";\n *\n * const clusterAccount = await findArciumClusterPda(\n * networkConfig.arciumProgramAddress,\n * networkConfig.clusterOffset,\n * );\n * ```\n *\n * @see {@link findArciumMempoolPda} for the cluster's pending computation queue\n * @see {@link findArciumExecutingPoolPda} for the cluster's active computation pool\n *\n * @public\n */\nexport async function findArciumClusterPda(\n arciumProgram: Address,\n clusterOffset: number,\n): Promise<Address> {\n assertU32(BigInt(clusterOffset));\n const [address] = await getProgramDerivedAddress({\n programAddress: arciumProgram,\n seeds: [\n new TextEncoder().encode(ARCIUM_CLUSTER_SEED),\n encodeU32ToU32LeBytes(BigInt(clusterOffset) as U32),\n ],\n });\n return address;\n}\n\n/* =============================================================================\n * AGGREGATE ADDRESS GENERATION\n * ============================================================================= */\n\n/**\n * Collection of all Arcium infrastructure account addresses needed to submit\n * a computation to the Arcium MPC network.\n *\n * @see {@link findArciumInfrastructurePdas} for the function that produces this object\n *\n * @public\n */\nexport interface ArciumInfrastructurePdas {\n /** The MXE protocol account address for the Umbra program. @readonly */\n readonly mxeAccount: Address;\n\n /** The mempool account address for the cluster. @readonly */\n readonly mempoolAccount: Address;\n\n /** The executing pool account address for the cluster. @readonly */\n readonly executingPoolAccount: Address;\n\n /** The computation account address for this specific computation request. @readonly */\n readonly computationAccount: Address;\n\n /** The computation definition account address for the target instruction. @readonly */\n readonly compDefAccount: Address;\n\n /** The cluster account address. @readonly */\n readonly clusterAccount: Address;\n}\n\n/**\n * Derives all Arcium infrastructure account addresses required for a single\n * computation request.\n *\n * This is a convenience function that computes all six required Arcium PDAs in\n * parallel and returns them as an {@link ArciumInfrastructurePdas} object.\n *\n * @param umbraProgram - The Umbra program address.\n * @param arciumProgram - The Arcium program address.\n * @param clusterOffset - The cluster offset identifying which Arcium cluster to use.\n * @param computationOffset - The unique u64 offset for this specific computation.\n * @param instructionName - The snake_case Arcium instruction name used to derive\n * the comp-def offset.\n * @returns A Promise resolving to an {@link ArciumInfrastructurePdas} object.\n *\n * @example\n * ```typescript\n * import { findArciumInfrastructurePdas } from \"@umbra-privacy/sdk\";\n *\n * const arciumAccounts = await findArciumInfrastructurePdas(\n * networkConfig.programId,\n * networkConfig.arciumProgramAddress,\n * networkConfig.clusterOffset,\n * computationOffset,\n * \"deposit_into_existing_mxe_v3\",\n * );\n * ```\n *\n * @see {@link computeCompDefOffset} for the comp-def offset derivation\n * @see {@link ArciumInfrastructurePdas} for the return type shape\n *\n * @public\n */\nexport async function findArciumInfrastructurePdas(\n umbraProgram: Address,\n arciumProgram: Address,\n clusterOffset: number,\n computationOffset: bigint,\n instructionName: string,\n): Promise<ArciumInfrastructurePdas> {\n const compDefOffset = computeCompDefOffset(instructionName);\n\n // Derive all addresses in parallel for efficiency\n const [\n mxeAccount,\n mempoolAccount,\n executingPoolAccount,\n computationAccount,\n compDefAccount,\n clusterAccount,\n ] = await Promise.all([\n findArciumMxePda(umbraProgram, arciumProgram),\n findArciumMempoolPda(arciumProgram, clusterOffset),\n findArciumExecutingPoolPda(arciumProgram, clusterOffset),\n findArciumComputationPda(arciumProgram, clusterOffset, computationOffset),\n findArciumCompDefPda(umbraProgram, arciumProgram, compDefOffset),\n findArciumClusterPda(arciumProgram, clusterOffset),\n ]);\n\n return {\n mxeAccount,\n mempoolAccount,\n executingPoolAccount,\n computationAccount,\n compDefAccount,\n clusterAccount,\n };\n}\n","/**\n * Compliance Grant PDA Utilities\n *\n * This module provides functions to derive Program Derived Addresses (PDAs)\n * for compliance grant accounts in the Umbra protocol.\n *\n * @remarks\n * Umbra implements a master viewing key system that allows authorised parties\n * to decrypt encrypted user data without gaining control over funds. Three\n * grant variants exist, each modelling a different trust relationship:\n *\n * - **Network grant** — the Arcium MXE network itself can decrypt the\n * user's data; the granter is implicitly the network. Used for regulatory\n * or protocol-level compliance.\n * - **Shared grant** — the user explicitly shares a re-encrypted view\n * key with the network for a specific receiver, scoped to a nonce to\n * prevent replay.\n * - **User grant** — the user directly grants a named receiver (e.g. an\n * auditor) the ability to read their encrypted data by re-encrypting the\n * view key under the receiver's X25519 public key.\n *\n * All three grant PDAs share a common prefix (`VIEWING_GRANT_SEED`)\n * and are disambiguated by a variant seed (`USER_GRANT_VARIANT_SEED`, etc.).\n * The nonce component prevents one grant from accidentally overwriting another.\n *\n * @see {@link findUserComplianceGrantPda}\n * @see {@link findNetworkComplianceGrantPda}\n * @see {@link findSharedComplianceGrantPda}\n *\n * @packageDocumentation\n * @since 2.0.0\n * @module utils/pda/compliance\n */\n\nimport { type Address, getProgramDerivedAddress } from \"@solana/kit\";\nimport {\n getArciumX25519NonceEncoder,\n getArciumX25519PublicKeyEncoder,\n} from \"@umbra-privacy/umbra-codama\";\nimport type { RcEncryptionNonce } from \"../../types\";\n\n/**\n * Seed prefix shared by all compliance grant PDAs.\n *\n * This is the SHA-256 hash of the UTF-8 string `\"ViewingGrant\"`,\n * encoded as a 32-byte `Uint8Array`. It matches the `SEED` constant generated\n * by the `#[umbra_account]` macro on the `ViewingGrant` struct in\n * `state/arcium/arcium_compliance_grant.rs`.\n *\n * @internal\n */\nconst VIEWING_GRANT_SEED = new Uint8Array([\n 209, 198, 56, 240, 66, 199, 19, 205, 112, 18, 168, 165, 236, 235, 81, 198, 191, 71, 73, 191, 110,\n 113, 189, 97, 139, 226, 152, 252, 229, 184, 187, 253,\n]);\n\n/**\n * Variant discriminator seed for user-granted compliance grants.\n *\n * This is the SHA-256 hash of the UTF-8 string `\"UserGrant\"`, encoded as a\n * 32-byte `Uint8Array`.\n *\n * @internal\n */\nconst USER_GRANT_VARIANT_SEED = new Uint8Array([\n 184, 137, 63, 24, 18, 54, 138, 200, 151, 217, 219, 241, 119, 150, 66, 8, 27, 105, 131, 187, 58,\n 182, 24, 203, 146, 119, 188, 210, 197, 104, 238, 33,\n]);\n\n/**\n * Variant discriminator seed for network MXE compliance grants.\n *\n * This is the SHA-256 hash of the UTF-8 string `\"NetworkMxeGrant\"`, encoded\n * as a 32-byte `Uint8Array`.\n *\n * @internal\n */\nconst NETWORK_MXE_GRANT_VARIANT_SEED = new Uint8Array([\n 142, 219, 209, 143, 158, 68, 71, 58, 193, 244, 116, 159, 48, 68, 160, 95, 175, 131, 151, 209, 81,\n 213, 51, 159, 98, 98, 138, 109, 254, 69, 221, 95,\n]);\n\n/**\n * Variant discriminator seed for network shared compliance grants.\n *\n * This is the SHA-256 hash of the UTF-8 string `\"NetworkSharedGrant\"`, encoded\n * as a 32-byte `Uint8Array`.\n *\n * @internal\n */\nconst NETWORK_SHARED_GRANT_VARIANT_SEED = new Uint8Array([\n 172, 245, 86, 61, 89, 235, 170, 92, 253, 117, 241, 14, 2, 33, 164, 107, 22, 131, 100, 113, 39,\n 173, 185, 55, 254, 100, 108, 218, 180, 105, 75, 184,\n]);\n\n/**\n * Derives the Program Derived Address for a user-granted compliance grant.\n * Seeds: [ViewingGrant::SEED, UserGrant::VARIANT, granter_x25519, nonce, receiver_x25519]\n *\n * A user-granted compliance grant stores a re-encrypted view of the granter's\n * private data under the receiver's X25519 public key, enabling a specific\n * party (e.g. an auditor) to decrypt the granter's encrypted balances.\n *\n * @param granterX25519 - The 32-byte X25519 public key of the granter.\n * @param nonce - A `RcEncryptionNonce` (u128) uniquely identifying this grant issuance.\n * @param receiverX25519 - The 32-byte X25519 public key of the receiver.\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the derived PDA `Address`.\n *\n * @example\n * ```typescript\n * import { findUserComplianceGrantPda } from \"@umbra-privacy/sdk\";\n *\n * const grantPda = await findUserComplianceGrantPda(\n * granterX25519PublicKey,\n * nonce,\n * auditorX25519PublicKey,\n * networkConfig.programId,\n * );\n * ```\n *\n * @see {@link findNetworkComplianceGrantPda} for network-level MXE grants\n * @see {@link findSharedComplianceGrantPda} for network shared grants\n *\n * @public\n */\nexport async function findUserComplianceGrantPda(\n granterX25519: Uint8Array,\n nonce: RcEncryptionNonce,\n receiverX25519: Uint8Array,\n umbraProgram: Address,\n): Promise<Address> {\n const [pda] = await getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [\n VIEWING_GRANT_SEED,\n USER_GRANT_VARIANT_SEED,\n getArciumX25519PublicKeyEncoder().encode({ first: granterX25519 }),\n getArciumX25519NonceEncoder().encode({ first: nonce }),\n getArciumX25519PublicKeyEncoder().encode({ first: receiverX25519 }),\n ],\n });\n return pda;\n}\n\n/**\n * Derives the Program Derived Address for a network (MXE) compliance grant.\n * Seeds: [ViewingGrant::SEED, NetworkMxeGrant::VARIANT, nonce, receiver_x25519]\n *\n * A network compliance grant allows the Arcium MXE network itself to\n * decrypt a user's encrypted data. There is no explicit granter key in the\n * seeds -- the granter is implicitly the network.\n *\n * @param nonce - A `RcEncryptionNonce` (u128) uniquely identifying this grant issuance.\n * @param receiverX25519 - The 32-byte X25519 public key of the receiver.\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the derived PDA `Address`.\n *\n * @example\n * ```typescript\n * import { findNetworkComplianceGrantPda } from \"@umbra-privacy/sdk\";\n *\n * const grantPda = await findNetworkComplianceGrantPda(\n * nonce,\n * networkX25519PublicKey,\n * networkConfig.programId,\n * );\n * ```\n *\n * @see {@link findUserComplianceGrantPda} for user-to-auditor grants\n * @see {@link findSharedComplianceGrantPda} for network shared grants\n *\n * @public\n */\nexport async function findNetworkComplianceGrantPda(\n nonce: RcEncryptionNonce,\n receiverX25519: Uint8Array,\n umbraProgram: Address,\n): Promise<Address> {\n const [pda] = await getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [\n VIEWING_GRANT_SEED,\n NETWORK_MXE_GRANT_VARIANT_SEED,\n getArciumX25519NonceEncoder().encode({ first: nonce }),\n getArciumX25519PublicKeyEncoder().encode({ first: receiverX25519 }),\n ],\n });\n return pda;\n}\n\n/**\n * Derives the Program Derived Address for a shared (network-shared) compliance grant.\n * Seeds: [ViewingGrant::SEED, NetworkSharedGrant::VARIANT, granter_x25519, nonce, receiver_x25519]\n *\n * A shared compliance grant is issued by a specific user to share a\n * re-encrypted view key with a named receiver via the Arcium network.\n * Unlike the network compliance grant, this variant includes the granter's\n * key so multiple users can each issue independent shared grants.\n *\n * @param granterX25519 - The 32-byte X25519 public key of the granter.\n * @param nonce - A `RcEncryptionNonce` (u128) uniquely identifying this grant issuance.\n * @param receiverX25519 - The 32-byte X25519 public key of the receiver.\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the derived PDA `Address`.\n *\n * @example\n * ```typescript\n * import { findSharedComplianceGrantPda } from \"@umbra-privacy/sdk\";\n *\n * const grantPda = await findSharedComplianceGrantPda(\n * granterX25519PublicKey,\n * nonce,\n * receiverX25519PublicKey,\n * networkConfig.programId,\n * );\n * ```\n *\n * @see {@link findUserComplianceGrantPda} for direct user-to-auditor grants\n * @see {@link findNetworkComplianceGrantPda} for implicit network-level grants\n *\n * @public\n */\nexport async function findSharedComplianceGrantPda(\n granterX25519: Uint8Array,\n nonce: RcEncryptionNonce,\n receiverX25519: Uint8Array,\n umbraProgram: Address,\n): Promise<Address> {\n const [pda] = await getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [\n VIEWING_GRANT_SEED,\n NETWORK_SHARED_GRANT_VARIANT_SEED,\n getArciumX25519PublicKeyEncoder().encode({ first: granterX25519 }),\n getArciumX25519NonceEncoder().encode({ first: nonce }),\n getArciumX25519PublicKeyEncoder().encode({ first: receiverX25519 }),\n ],\n });\n return pda;\n}\n","/**\n * Global PDA Utilities\n *\n * This module provides functions to derive Program Derived Addresses (PDAs)\n * for singleton program-level accounts in the Umbra protocol.\n *\n * Mirrors the smart contract's `state/global/` module, which holds\n * `ProtocolConfig` — a singleton account storing protocol-wide state.\n *\n * @remarks\n * There is exactly one `ProtocolConfig` account per Umbra program\n * deployment. It acts as the canonical source of truth for cross-instruction\n * protocol state: the index of the currently active mixer tree, global\n * feature activation flags, and the program upgrade authority. Most\n * instructions pass it as a read-only account for validation.\n *\n * @see {@link findProtocolConfigPda} for the derivation function\n * @see {@link findTokenPoolPda} for per-mint pool configuration\n *\n * @packageDocumentation\n * @since 2.0.0\n * @module utils/pda/global\n */\n\nimport { type Address, getProgramDerivedAddress } from \"@solana/kit\";\nimport { computeStructSeed } from \"./umbra\";\n\n/**\n * SHA-256 of the string `\"ProtocolConfig\"`, stored as a 32-byte `Uint8Array`.\n *\n * Matches `ProtocolConfig::SEED` as generated by the `#[umbra_account]`\n * macro in `state/global/program_information.rs`. This is the sole seed used\n * when deriving the singleton `ProtocolConfig` PDA.\n *\n * @internal\n */\nconst PROTOCOL_CONFIG_SEED = computeStructSeed(\"ProtocolConfig\");\n\n/**\n * Derives the Program Derived Address for the singleton protocol configuration account.\n * Seeds: [ProtocolConfig::SEED]\n *\n * The `ProtocolConfig` account stores global configuration state including\n * the active mixer tree index, feature flags, and the upgrade authority.\n *\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the derived PDA `Address`.\n *\n * @example\n * ```typescript\n * import { findProtocolConfigPda } from \"@umbra-privacy/sdk\";\n *\n * const protocolConfig = await findProtocolConfigPda(networkConfig.programId);\n * ```\n *\n * @see {@link findTokenPoolPda} for per-mint pool configuration\n * @see {@link findStealthPoolPda} for per-index mixer tree accounts\n *\n * @public\n */\nexport async function findProtocolConfigPda(umbraProgram: Address): Promise<Address> {\n const [pda] = await getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [PROTOCOL_CONFIG_SEED],\n });\n return pda;\n}\n","/**\n * Pool PDA Utilities\n *\n * This module provides functions to derive Program Derived Addresses (PDAs)\n * for pool-related accounts in the Umbra protocol.\n *\n * Mirrors the smart contract's `state/pool/` module, which holds the `Pool`\n * account — a per-mint configuration account that enables confidentiality and\n * mixer features for a specific SPL token.\n *\n * @remarks\n * The `Pool` account is a singleton per SPL token mint. It is created by the\n * protocol administrator and acts as the root configuration object for all\n * privacy operations involving that mint. Instructions that add or remove\n * privacy features (confidentiality, mixer) modify this account.\n *\n * @see {@link findTokenPoolPda} for the derivation function\n * @see {@link findProtocolConfigPda} for the global singleton that tracks active tree index\n *\n * @packageDocumentation\n * @since 2.0.0\n * @module utils/pda/pool\n */\n\nimport { type Address, getAddressEncoder, getProgramDerivedAddress } from \"@solana/kit\";\nimport { computeStructSeed } from \"./umbra\";\n\n/**\n * SHA-256 of the string `\"TokenPool\"`, stored as a 32-byte `Uint8Array`.\n *\n * Matches `Pool::SEED` as generated by the `#[umbra_account]` macro\n * in `state/pool/pool.rs`. Used as the first seed when deriving Pool PDAs.\n *\n * Also re-exported from the barrel (`index.ts`) as `TOKEN_POOL_SEED` for callers\n * that need the raw bytes — for example, to verify a PDA server-side without\n * calling `findTokenPoolPda`.\n *\n * @internal\n */\nexport const TOKEN_POOL_SEED = computeStructSeed(\"TokenPool\");\n\n/**\n * Derives the Program Derived Address for a token pool configuration account.\n * Seeds: [TokenPool::SEED, mint_pubkey]\n *\n * The `Pool` account is a per-mint singleton that stores whether\n * confidentiality and mixer features are activated for a specific SPL token.\n *\n * @param mintAddress - The SPL token mint address for this pool.\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the derived PDA `Address`.\n *\n * @example\n * ```typescript\n * import { findTokenPoolPda } from \"@umbra-privacy/sdk\";\n *\n * const pool = await findTokenPoolPda(mintAddress, networkConfig.programId);\n * ```\n *\n * @see {@link TOKEN_POOL_SEED} for the raw seed bytes\n * @see {@link findProtocolConfigPda} for the global singleton account\n *\n * @public\n */\nexport async function findTokenPoolPda(mintAddress: Address, umbraProgram: Address): Promise<Address> {\n const [pda] = await getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [TOKEN_POOL_SEED, getAddressEncoder().encode(mintAddress)],\n });\n return pda;\n}\n","/**\n * Relayer PDA Utilities\n *\n * This module provides functions to derive Program Derived Addresses (PDAs)\n * for relayer-related accounts in the Umbra protocol.\n *\n * Mirrors the smart contract's `state/relayer/` module, which holds:\n * - `Relayer` — a per-relayer, per-mint account that stores the\n * relayer's registration state and fee configuration references.\n *\n * @remarks\n * Relayers are permissioned transaction forwarders in the Umbra privacy\n * protocol. They submit user-generated proofs and encrypted payloads\n * on-chain, collecting a commission fee for the service. Each relayer must\n * register a `Relayer` for every SPL token mint they wish to support.\n *\n * The `Relayer` PDA is scoped to a `(relayer, mint)` pair so that a\n * single relayer wallet can independently manage fee configurations for\n * multiple mints without conflicting accounts.\n *\n * @see {@link findRelayerPda} for the derivation function\n * @see {@link findRelayerFeeVaultPda} for the associated fee pool derivation\n *\n * @packageDocumentation\n * @since 2.0.0\n * @module utils/pda/relayer\n */\n\nimport { type Address, getAddressEncoder, getProgramDerivedAddress } from \"@solana/kit\";\nimport { computeStructSeed } from \"./umbra\";\n\n/**\n * SHA-256 of the string `\"Relayer\"`, stored as a 32-byte `Uint8Array`.\n *\n * Matches `Relayer::SEED` as generated by the `#[umbra_account]`\n * macro in `state/relayer/relayer_account.rs`. Used as the first seed when\n * deriving `Relayer` PDAs.\n *\n * @internal\n */\nconst RELAYER_SEED = computeStructSeed(\"Relayer\");\n\n/**\n * Derives the Program Derived Address for a relayer registration account.\n * Seeds: [Relayer::SEED, relayer_pubkey, mint_pubkey]\n *\n * The `Relayer` stores a relayer's registration data and fee\n * configuration for a specific SPL token mint. A unique account exists per\n * `(relayer, mint)` pair.\n *\n * @param relayerAddress - The relayer's wallet public key.\n * @param mintAddress - The SPL token mint address that this relayer supports.\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the derived PDA `Address`.\n *\n * @example\n * ```typescript\n * import { findRelayerPda } from \"@umbra-privacy/sdk\";\n *\n * const relayerAccount = await findRelayerPda(\n * relayerPublicKey,\n * mintAddress,\n * networkConfig.programId,\n * );\n * ```\n *\n * @see {@link findRelayerFeeVaultPda} for the associated unified fee pool\n * @see {@link findFeeSchedulePda} for the fee rate configuration account\n *\n * @public\n */\nexport async function findRelayerPda(\n relayerAddress: Address,\n mintAddress: Address,\n umbraProgram: Address,\n): Promise<Address> {\n const addressEncoder = getAddressEncoder();\n const [pda] = await getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [\n RELAYER_SEED,\n addressEncoder.encode(relayerAddress),\n addressEncoder.encode(mintAddress),\n ],\n });\n return pda;\n}\n","/**\n * Fees PDA Utilities\n *\n * This module provides functions to derive Program Derived Addresses (PDAs)\n * for protocol and relayer fee accounts in the Umbra protocol.\n *\n * Mirrors the smart contract's `state/fees/` module, which holds:\n * - `FeeVault` — a single account storing both protocol and relayer fees,\n * partitioned by a domain seed into two variants:\n * - Protocol-only pools (deposits, withdrawals, public UTXO creation)\n * - Relayer pools (transfers, confidential/public claims)\n * - `FeeSchedule` — admin-managed fee rate config per mint\n *\n * @remarks\n * Umbra separates fee collection from fee disbursement by accumulating fees in\n * dedicated PDA accounts (`FeeVault`) that can be swept by the protocol\n * treasury or relayer at any time. The fee amount charged per instruction is\n * governed by the `FeeSchedule` account for that instruction + mint\n * pair.\n *\n * Both `FeeVault` variants and `FeeSchedule` include an\n * `offset` seed, following the canonical seed pattern:\n *\n * `SEED -> domain_seed (for fees pool) -> instructionSeed -> entity_key -> mint -> offset`\n *\n * The `offset` allows the protocol to create multiple fee pool or config\n * accounts for the same instruction + mint combination if needed in future.\n * Currently `offset` is always `0n` for `FeeSchedule` and an\n * instruction-specific constant for `FeeVault`.\n *\n * @see {@link findProtocolFeeVaultPda}\n * @see {@link findRelayerFeeVaultPda}\n * @see {@link findFeeSchedulePda}\n *\n * @packageDocumentation\n * @since 2.0.0\n * @module utils/pda/fees\n */\n\nimport { type Address, getAddressEncoder, getProgramDerivedAddress } from \"@solana/kit\";\nimport { getAccountOffsetEncoder } from \"@umbra-privacy/umbra-codama\";\nimport type { U128 } from \"../../types\";\nimport { encodeU128ToU128LeBytes } from \"../converters/mathematics\";\nimport { computeStructSeed } from \"./umbra\";\n\n/**\n * SHA-256 of the string `\"FeeVault\"`, stored as a 32-byte `Uint8Array`.\n *\n * Matches `FeeVault::SEED` as generated by the `#[umbra_account]`\n * macro in `state/fees/unified_fees_pool.rs`. Used as the first seed when\n * deriving all `FeeVault` PDAs (both protocol-only and relayer variants).\n *\n * @internal\n */\nconst FEE_VAULT_SEED = computeStructSeed(\"FeeVault\");\n\n/**\n * Domain separator that identifies protocol-only fee pools.\n *\n * This is the SHA-256 hash of `\"ProtocolFees\"`, matching\n * `FeeVault::DOMAIN_PROTOCOL_FEES` (`sha256_seed!(\"ProtocolFees\")`)\n * in `state/fees/unified_fees_pool.rs`.\n *\n * @internal\n */\nconst DOMAIN_PROTOCOL_FEES = computeStructSeed(\"ProtocolFees\");\n\n/**\n * Domain separator that identifies combined protocol + relayer fee pools.\n *\n * This is the SHA-256 hash of `\"ProtocolRelayerFees\"`, matching\n * `FeeVault::DOMAIN_PROTOCOL_RELAYER_FEES`\n * (`sha256_seed!(\"ProtocolRelayerFees\")`) in `state/fees/unified_fees_pool.rs`.\n *\n * @internal\n */\nconst DOMAIN_PROTOCOL_RELAYER_FEES = computeStructSeed(\"ProtocolRelayerFees\");\n\n/**\n * SHA-256 of the string `\"FeeSchedule\"`, stored as a 32-byte `Uint8Array`.\n *\n * Matches `FeeSchedule::SEED` as generated by the\n * `#[umbra_account]` macro in `state/fees/protocol_fees_configuration.rs`.\n * Used as the first seed when deriving `FeeSchedule` PDAs.\n *\n * @internal\n */\nconst FEE_SCHEDULE_SEED = computeStructSeed(\"FeeSchedule\");\n\n/**\n * SHA-256 of the string `\"RelayerFeeSchedule\"`, stored as a 32-byte `Uint8Array`.\n *\n * Matches `RelayerFeeSchedule::SEED` as generated by the `#[umbra_account]`\n * macro in `state/relayer/relayer_fees_configuration.rs`. Used as the first seed\n * when deriving `RelayerFeeSchedule` PDAs.\n *\n * @internal\n */\nconst RELAYER_FEE_SCHEDULE_SEED = computeStructSeed(\"RelayerFeeSchedule\");\n\n/**\n * Derives the Program Derived Address for a protocol-only fee vault account.\n * Seeds: [FeeVault::SEED, ProtocolFees::DOMAIN, instruction_seed, mint_pubkey, offset]\n *\n * Protocol-only fee pools accumulate the protocol's share of fees for\n * instructions that have no relayer commission component (deposits,\n * withdrawals, and public UTXO creation).\n *\n * @param instructionSeed - The instruction-specific U128 seed constant.\n * @param mintAddress - The SPL token mint address for this pool.\n * @param offset - The account offset discriminator (U128).\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the `[pda, bump]` tuple.\n *\n * @example\n * ```typescript\n * import { findProtocolFeeVaultPda } from \"@umbra-privacy/sdk\";\n *\n * const [feesPoolPda] = await findProtocolFeeVaultPda(\n * instructionSeed as U128,\n * mintAddress,\n * PROTOCOL_FEES_POOL_OFFSET as U128,\n * networkConfig.programId,\n * );\n * ```\n *\n * @see {@link findRelayerFeeVaultPda} for the relayer commission pool variant\n * @see {@link findFeeSchedulePda} for the fee rate configuration account\n *\n * @public\n */\nexport async function findProtocolFeeVaultPda(\n instructionSeed: U128,\n mintAddress: Address,\n offset: U128,\n umbraProgram: Address,\n): Promise<readonly [Address, number]> {\n const addressEncoder = getAddressEncoder();\n return getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [\n FEE_VAULT_SEED,\n DOMAIN_PROTOCOL_FEES,\n encodeU128ToU128LeBytes(instructionSeed),\n addressEncoder.encode(mintAddress),\n getAccountOffsetEncoder().encode({ first: BigInt(offset) }),\n ],\n });\n}\n\n/**\n * Derives the Program Derived Address for a relayer fee vault account.\n * Seeds: [FeeVault::SEED, ProtocolRelayerFees::DOMAIN, instruction_seed, relayer_pubkey, mint_pubkey, offset]\n *\n * Relayer fee pools accumulate both the protocol's share and the relayer's\n * commission for instructions that involve a relayer (claims and transfers).\n *\n * @param instructionSeed - The instruction-specific U128 seed constant.\n * @param relayerAddress - The relayer's wallet public key.\n * @param mintAddress - The SPL token mint address for this pool.\n * @param offset - The account offset discriminator (U128).\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the `[pda, bump]` tuple.\n *\n * @example\n * ```typescript\n * import { findRelayerFeeVaultPda } from \"@umbra-privacy/sdk\";\n *\n * const [unifiedFeesPoolPda] = await findRelayerFeeVaultPda(\n * instructionSeed as U128,\n * relayerPublicKey,\n * mintAddress,\n * PROTOCOL_FEES_POOL_OFFSET as U128,\n * networkConfig.programId,\n * );\n * ```\n *\n * @see {@link findProtocolFeeVaultPda} for the protocol-only pool variant\n * @see {@link findRelayerPda} for the relayer registration account\n *\n * @public\n */\nexport async function findRelayerFeeVaultPda(\n instructionSeed: U128,\n relayerAddress: Address,\n mintAddress: Address,\n offset: U128,\n umbraProgram: Address,\n): Promise<readonly [Address, number]> {\n const addressEncoder = getAddressEncoder();\n return getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [\n FEE_VAULT_SEED,\n DOMAIN_PROTOCOL_RELAYER_FEES,\n encodeU128ToU128LeBytes(instructionSeed),\n addressEncoder.encode(relayerAddress),\n addressEncoder.encode(mintAddress),\n getAccountOffsetEncoder().encode({ first: BigInt(offset) }),\n ],\n });\n}\n\n/**\n * Derives the Program Derived Address for a protocol fee schedule account.\n * Seeds: [FeeSchedule::SEED, instruction_seed, mint_pubkey, offset]\n *\n * The `FeeSchedule` account defines the fee rates for a specific instruction\n * variant and SPL token mint. Consulted during instruction validation to\n * calculate how much the user must pay.\n *\n * @param instructionSeed - The instruction-specific U128 seed constant.\n * @param mintAddress - The SPL token mint address for this fee configuration.\n * @param offset - The account offset discriminator (U128).\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the `[pda, bump]` tuple.\n *\n * @example\n * ```typescript\n * import { findFeeSchedulePda } from \"@umbra-privacy/sdk\";\n *\n * const [feeConfigPda] = await findFeeSchedulePda(\n * instructionSeed as U128,\n * mintAddress,\n * 0n as U128,\n * networkConfig.programId,\n * );\n * ```\n *\n * @see {@link findProtocolFeeVaultPda} for the corresponding fee collection account\n * @see {@link findRelayerFeeVaultPda} for the relayer fee collection account\n *\n * @public\n */\nexport async function findFeeSchedulePda(\n instructionSeed: U128,\n mintAddress: Address,\n offset: U128,\n umbraProgram: Address,\n): Promise<readonly [Address, number]> {\n const addressEncoder = getAddressEncoder();\n return getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [\n FEE_SCHEDULE_SEED,\n encodeU128ToU128LeBytes(instructionSeed),\n addressEncoder.encode(mintAddress),\n getAccountOffsetEncoder().encode({ first: BigInt(offset) }),\n ],\n });\n}\n\n/**\n * Derives the Program Derived Address for a relayer fee schedule account.\n * Seeds: [RelayerFeeSchedule::SEED, instruction_seed, relayer_pubkey, mint_pubkey, offset]\n *\n * The `RelayerFeeSchedule` account defines the fee rates a specific relayer\n * charges for a given instruction variant and SPL token mint.\n *\n * @param instructionSeed - The instruction-specific U128 seed constant.\n * @param relayerAddress - The relayer's wallet public key.\n * @param mintAddress - The SPL token mint address for this fee configuration.\n * @param offset - The account offset discriminator (U128).\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the `[pda, bump]` tuple.\n *\n * @public\n */\nexport async function findRelayerFeeSchedulePda(\n instructionSeed: U128,\n relayerAddress: Address,\n mintAddress: Address,\n offset: U128,\n umbraProgram: Address,\n): Promise<readonly [Address, number]> {\n const addressEncoder = getAddressEncoder();\n return getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [\n RELAYER_FEE_SCHEDULE_SEED,\n encodeU128ToU128LeBytes(instructionSeed),\n addressEncoder.encode(relayerAddress),\n addressEncoder.encode(mintAddress),\n getAccountOffsetEncoder().encode({ first: BigInt(offset) }),\n ],\n });\n}\n","/**\n * ZK and MPC Callback PDA Utilities\n *\n * This module provides functions to derive Program Derived Addresses (PDAs)\n * for zero-knowledge proof accounts and MPC callback data accounts in the\n * Umbra protocol.\n *\n * @see {@link findVerifyingKeyPda}\n * @see {@link findClaimInputBufferPda}\n * @see {@link findUtxoInputBufferPda}\n * @see {@link findPublicClaimInputBufferPda}\n * @see {@link findPublicClaimComputationDataPda}\n *\n * @packageDocumentation\n * @since 2.0.0\n * @module utils/pda/zk\n */\n\nimport { type Address, getAddressEncoder, getProgramDerivedAddress } from \"@solana/kit\";\nimport { getAccountOffsetEncoder } from \"@umbra-privacy/umbra-codama\";\nimport type { U128 } from \"../../types\";\nimport { encodeU128ToU128LeBytes } from \"../converters/mathematics\";\nimport { computeStructSeed } from \"./umbra\";\n\n/**\n * SHA-256 of the string `\"Groth16VerifyingKey\"`, stored as a 32-byte `Uint8Array`.\n * @internal\n */\nconst GROTH16_VERIFYING_KEY_SEED = computeStructSeed(\"Groth16VerifyingKey\");\n\n/**\n * SHA-256 of the string `\"ConfidentialClaimProofAccount\"`, stored as a 32-byte `Uint8Array`.\n * @internal\n */\nconst CONFIDENTIAL_CLAIM_PROOF_ACCOUNT_SEED = computeStructSeed(\"ConfidentialClaimProofAccount\");\n\n/**\n * SHA-256 of the string `\"ConfidentialUtxoProofAccount\"`, stored as a 32-byte `Uint8Array`.\n * @internal\n */\nconst CONFIDENTIAL_UTXO_PROOF_ACCOUNT_SEED = computeStructSeed(\"ConfidentialUtxoProofAccount\");\n\n/**\n * SHA-256 of the string `\"PublicUtxoProofAccount\"`, stored as a 32-byte `Uint8Array`.\n * @internal\n */\nconst PUBLIC_UTXO_PROOF_ACCOUNT_SEED = computeStructSeed(\"PublicUtxoProofAccount\");\n\n/**\n * SHA-256 of the string `\"PublicClaimProofAccount\"`, stored as a 32-byte `Uint8Array`.\n * @internal\n */\nconst PUBLIC_CLAIM_PROOF_ACCOUNT_SEED = computeStructSeed(\"PublicClaimProofAccount\");\n\n/**\n * SHA-256 of the string `\"PublicClaimMxeMpcCallbackData\"`, stored as a 32-byte `Uint8Array`.\n * @internal\n */\nconst PUBLIC_CLAIM_MXE_MPC_CALLBACK_DATA_SEED = computeStructSeed(\"PublicClaimMxeMpcCallbackData\");\n\n/**\n * Derives the Program Derived Address for a Groth16 verifying key account.\n * Seeds: [Groth16VerifyingKey::SEED, instruction_seed]\n *\n * Stores the on-chain Groth16 verifying key for a specific proof circuit\n * variant. Set up by the protocol administrator and read as immutable input\n * in claim and UTXO instructions.\n *\n * @param instructionSeed - The U128 seed identifying the specific verifying key.\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the derived PDA `Address`.\n *\n * @example\n * ```typescript\n * import { findVerifyingKeyPda } from \"@umbra-privacy/sdk\";\n *\n * const zkVerifyingKeyAccount = await findVerifyingKeyPda(\n * zkSeed as U128,\n * networkConfig.programId,\n * );\n * ```\n *\n * @see {@link findClaimInputBufferPda} for the proof buffer read alongside this account\n *\n * @public\n */\nexport async function findVerifyingKeyPda(\n instructionSeed: U128,\n umbraProgram: Address,\n): Promise<Address> {\n const [pda] = await getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [GROTH16_VERIFYING_KEY_SEED, encodeU128ToU128LeBytes(instructionSeed)],\n });\n return pda;\n}\n\n/**\n * Derives the Program Derived Address for a confidential claim input buffer account.\n * Seeds: [ConfidentialClaimProofAccount::SEED, payer_pubkey, offset]\n *\n * An ephemeral buffer account that holds the Groth16 proof bytes and encrypted\n * public inputs required for a confidential claim instruction. Created by the\n * relayer, consumed by the claim instruction, and closed in the MPC callback.\n *\n * @param payerAddress - The relayer's public key (proof account creator).\n * @param offset - The U128 offset discriminator.\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the derived PDA `Address`.\n *\n * @example\n * ```typescript\n * import { findClaimInputBufferPda } from \"@umbra-privacy/sdk\";\n *\n * const proofAccountPda = await findClaimInputBufferPda(\n * relayerPublicKey,\n * proofAccountOffset as U128,\n * networkConfig.programId,\n * );\n * ```\n *\n * @see {@link findVerifyingKeyPda} for the verifying key used to check this proof\n * @see {@link findPublicClaimInputBufferPda} for the public-balance claim variant\n *\n * @public\n */\nexport async function findClaimInputBufferPda(\n payerAddress: Address,\n offset: U128,\n umbraProgram: Address,\n): Promise<Address> {\n const [pda] = await getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [\n CONFIDENTIAL_CLAIM_PROOF_ACCOUNT_SEED,\n getAddressEncoder().encode(payerAddress),\n getAccountOffsetEncoder().encode({ first: BigInt(offset) }),\n ],\n });\n return pda;\n}\n\n/**\n * Derives the Program Derived Address for a confidential UTXO input buffer account.\n * Seeds: [ConfidentialUtxoProofAccount::SEED, depositor_pubkey, offset]\n *\n * An ephemeral buffer account that holds the Groth16 proof data required to\n * create a new confidential UTXO from an existing encrypted MXE balance.\n *\n * @param depositorAddress - The depositor's public key (account creator).\n * @param offset - The U128 offset discriminator.\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the derived PDA `Address`.\n *\n * @example\n * ```typescript\n * import { findUtxoInputBufferPda } from \"@umbra-privacy/sdk\";\n *\n * const proofAccountPda = await findUtxoInputBufferPda(\n * client.signer.address,\n * offset as U128,\n * networkConfig.programId,\n * );\n * ```\n *\n * @see {@link findVerifyingKeyPda} for the verifying key used to check this proof\n * @see {@link findClaimInputBufferPda} for the claim-side proof buffer\n *\n * @public\n */\nexport async function findUtxoInputBufferPda(\n depositorAddress: Address,\n offset: U128,\n umbraProgram: Address,\n): Promise<Address> {\n const [pda] = await getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [\n CONFIDENTIAL_UTXO_PROOF_ACCOUNT_SEED,\n getAddressEncoder().encode(depositorAddress),\n getAccountOffsetEncoder().encode({ first: BigInt(offset) }),\n ],\n });\n return pda;\n}\n\n/**\n * Derives the Program Derived Address for a public UTXO input buffer account.\n * Seeds: [PublicUtxoProofAccount::SEED, depositor_pubkey, offset]\n *\n * An ephemeral buffer account that holds cryptographic proof data for the\n * `create_deposit_into_mixer_tree_from_public_balance` instruction.\n *\n * @param depositorAddress - The depositor's public key (account creator).\n * @param offset - The U128 offset discriminator.\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the derived PDA `Address`.\n *\n * @public\n */\nexport async function findPublicUtxoInputBufferPda(\n depositorAddress: Address,\n offset: U128,\n umbraProgram: Address,\n): Promise<Address> {\n const [pda] = await getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [\n PUBLIC_UTXO_PROOF_ACCOUNT_SEED,\n getAddressEncoder().encode(depositorAddress),\n getAccountOffsetEncoder().encode({ first: BigInt(offset) }),\n ],\n });\n return pda;\n}\n\n/**\n * Derives the Program Derived Address for a public claim input buffer account.\n * Seeds: [PublicClaimProofAccount::SEED, relayer_pubkey, offset]\n *\n * An ephemeral buffer account that holds the Groth16 proof data for a\n * public-balance claim instruction (claiming UTXOs into a standard SPL\n * token ATA).\n *\n * @param relayerAddress - The relayer's public key (proof account creator).\n * @param offset - The U128 offset discriminator.\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the derived PDA `Address`.\n *\n * @example\n * ```typescript\n * import { findPublicClaimInputBufferPda } from \"@umbra-privacy/sdk\";\n *\n * const proofAccountPda = await findPublicClaimInputBufferPda(\n * relayerPublicKey,\n * proofAccountOffset as U128,\n * networkConfig.programId,\n * );\n * ```\n *\n * @see {@link findVerifyingKeyPda} for the verifying key used to check this proof\n * @see {@link findClaimInputBufferPda} for the confidential-balance claim variant\n * @see {@link findPublicClaimComputationDataPda} for the companion MPC callback data account\n *\n * @public\n */\nexport async function findPublicClaimInputBufferPda(\n relayerAddress: Address,\n offset: U128,\n umbraProgram: Address,\n): Promise<Address> {\n const [pda] = await getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [\n PUBLIC_CLAIM_PROOF_ACCOUNT_SEED,\n getAddressEncoder().encode(relayerAddress),\n getAccountOffsetEncoder().encode({ first: BigInt(offset) }),\n ],\n });\n return pda;\n}\n\n/**\n * Derives the Program Derived Address for a public claim MPC computation data account.\n * Seeds: [PublicClaimMxeMpcCallbackData::SEED, relayer_pubkey, offset]\n *\n * Stores all data needed by the Arcium MPC callback handler for a public\n * claim instruction. Initialised in the handler and closed when the callback\n * executes.\n *\n * Returns the full `[address, bump]` tuple because the canonical bump must be\n * passed as the `mpcCallbackDataCanonicalBump` instruction argument.\n *\n * @param relayerAddress - The relayer's public key.\n * @param offset - The U128 offset discriminator.\n * @param umbraProgram - The Umbra program address.\n * @returns A Promise resolving to the `[pda, bump]` tuple.\n *\n * @example\n * ```typescript\n * import { findPublicClaimComputationDataPda } from \"@umbra-privacy/sdk\";\n *\n * const [callbackDataPda, mpcCallbackDataCanonicalBump] =\n * await findPublicClaimComputationDataPda(\n * relayerPublicKey,\n * 0n as U128,\n * networkConfig.programId,\n * );\n * ```\n *\n * @see {@link findPublicClaimInputBufferPda} for the companion proof buffer account\n *\n * @public\n */\nexport async function findPublicClaimComputationDataPda(\n relayerAddress: Address,\n offset: U128,\n umbraProgram: Address,\n): Promise<readonly [Address, number]> {\n return getProgramDerivedAddress({\n programAddress: umbraProgram,\n seeds: [\n PUBLIC_CLAIM_MXE_MPC_CALLBACK_DATA_SEED,\n getAddressEncoder().encode(relayerAddress),\n getAccountOffsetEncoder().encode({ first: BigInt(offset) }),\n ],\n });\n}\n"]}
|