@umbra-privacy/sdk 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -25
- package/dist/{addresses-Brzgurv_.d.ts → addresses-B7HybtbJ.d.ts} +2 -1
- package/dist/{addresses-D_0YAS6B.d.cts → addresses-CTVY1oi7.d.cts} +2 -1
- package/dist/arcium-BXXlryfe.d.cts +20 -0
- package/dist/arcium-BXXlryfe.d.ts +20 -0
- package/dist/chunk-4RHXVBNI.js +203 -0
- package/dist/chunk-4RHXVBNI.js.map +1 -0
- package/dist/chunk-4TZVXB5G.js +324 -0
- package/dist/chunk-4TZVXB5G.js.map +1 -0
- package/dist/chunk-5GUSMQ74.cjs +549 -0
- package/dist/chunk-5GUSMQ74.cjs.map +1 -0
- package/dist/chunk-5KPQXPQM.js +36 -0
- package/dist/chunk-5KPQXPQM.js.map +1 -0
- package/dist/chunk-AXD7LXYY.cjs +405 -0
- package/dist/chunk-AXD7LXYY.cjs.map +1 -0
- package/dist/{chunk-HOEXDXRC.cjs → chunk-BL6WXLPV.cjs} +32 -360
- package/dist/chunk-BL6WXLPV.cjs.map +1 -0
- package/dist/chunk-CFFLOE7D.cjs +598 -0
- package/dist/chunk-CFFLOE7D.cjs.map +1 -0
- package/dist/{chunk-BM7N6N7E.js → chunk-CFTW5WNG.js} +3 -325
- package/dist/chunk-CFTW5WNG.js.map +1 -0
- package/dist/chunk-DD2WCK4C.js +327 -0
- package/dist/chunk-DD2WCK4C.js.map +1 -0
- package/dist/chunk-DMPMQ74B.cjs +246 -0
- package/dist/chunk-DMPMQ74B.cjs.map +1 -0
- package/dist/{chunk-2Q75CQQJ.js → chunk-EEKF4553.js} +2 -2
- package/dist/chunk-EEKF4553.js.map +1 -0
- package/dist/chunk-ENVYYEM4.cjs +113 -0
- package/dist/chunk-ENVYYEM4.cjs.map +1 -0
- package/dist/chunk-FQX6ZYGJ.js +500 -0
- package/dist/chunk-FQX6ZYGJ.js.map +1 -0
- package/dist/chunk-FSK2ICMB.cjs +39 -0
- package/dist/chunk-FSK2ICMB.cjs.map +1 -0
- package/dist/chunk-FZYWLQAF.cjs +355 -0
- package/dist/chunk-FZYWLQAF.cjs.map +1 -0
- package/dist/chunk-GP26R377.js +436 -0
- package/dist/chunk-GP26R377.js.map +1 -0
- package/dist/chunk-HA5FLM63.js +393 -0
- package/dist/chunk-HA5FLM63.js.map +1 -0
- package/dist/chunk-INJ73LXQ.js +1107 -0
- package/dist/chunk-INJ73LXQ.js.map +1 -0
- package/dist/chunk-JPDF7BIT.cjs +10892 -0
- package/dist/chunk-JPDF7BIT.cjs.map +1 -0
- package/dist/{chunk-MDFSBU5W.cjs → chunk-LTCKPTZC.cjs} +2 -351
- package/dist/chunk-LTCKPTZC.cjs.map +1 -0
- package/dist/chunk-MKNCBUFA.js +564 -0
- package/dist/chunk-MKNCBUFA.js.map +1 -0
- package/dist/chunk-NKVMSABR.cjs +207 -0
- package/dist/chunk-NKVMSABR.cjs.map +1 -0
- package/dist/chunk-OFDWNWCL.js +70 -0
- package/dist/chunk-OFDWNWCL.js.map +1 -0
- package/dist/chunk-QJAUUYZU.cjs +331 -0
- package/dist/chunk-QJAUUYZU.cjs.map +1 -0
- package/dist/chunk-RVUYPKKD.js +10750 -0
- package/dist/chunk-RVUYPKKD.js.map +1 -0
- package/dist/chunk-TLR7A64G.js +103 -0
- package/dist/chunk-TLR7A64G.js.map +1 -0
- package/dist/{chunk-MVKTV3FT.cjs → chunk-TQQZGNOI.cjs} +2 -2
- package/dist/chunk-TQQZGNOI.cjs.map +1 -0
- package/dist/chunk-UOFYS6M3.js +219 -0
- package/dist/chunk-UOFYS6M3.js.map +1 -0
- package/dist/chunk-UXMQI6B7.js +2406 -0
- package/dist/chunk-UXMQI6B7.js.map +1 -0
- package/dist/chunk-WN75ORDT.js +571 -0
- package/dist/chunk-WN75ORDT.js.map +1 -0
- package/dist/chunk-Y55PYKXH.cjs +595 -0
- package/dist/chunk-Y55PYKXH.cjs.map +1 -0
- package/dist/chunk-YEZBTYCP.cjs +77 -0
- package/dist/chunk-YEZBTYCP.cjs.map +1 -0
- package/dist/chunk-ZQOIYCGA.cjs +1126 -0
- package/dist/chunk-ZQOIYCGA.cjs.map +1 -0
- package/dist/chunk-ZY3TSHMJ.cjs +2665 -0
- package/dist/chunk-ZY3TSHMJ.cjs.map +1 -0
- package/dist/client-DkVBHMWb.d.cts +2613 -0
- package/dist/client-V4AF6Bz9.d.ts +2613 -0
- package/dist/common/pda/index.cjs +145 -0
- package/dist/common/pda/index.cjs.map +1 -0
- package/dist/common/pda/index.d.cts +1250 -0
- package/dist/common/pda/index.d.ts +1250 -0
- package/dist/common/pda/index.js +8 -0
- package/dist/common/pda/index.js.map +1 -0
- package/dist/constants/index.cjs +38 -164
- package/dist/constants/index.cjs.map +1 -1
- package/dist/constants/index.d.cts +8 -425
- package/dist/constants/index.d.ts +8 -425
- package/dist/constants/index.js +15 -124
- package/dist/constants/index.js.map +1 -1
- package/dist/crypto/index.cjs +583 -0
- package/dist/crypto/index.cjs.map +1 -0
- package/dist/crypto/index.d.cts +6731 -0
- package/dist/crypto/index.d.ts +6731 -0
- package/dist/crypto/index.js +14 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/{cryptography-BTGC72u-.d.ts → cryptography-BFSJcvi6.d.ts} +3 -2465
- package/dist/{cryptography-BTGC72u-.d.cts → cryptography-D6tPDh-Y.d.cts} +3 -2465
- package/dist/errors/index.cjs +64 -54
- package/dist/errors/index.d.cts +7 -797
- package/dist/errors/index.d.ts +7 -797
- package/dist/errors/index.js +3 -1
- package/dist/errors-B9EoPeWV.d.cts +593 -0
- package/dist/errors-B9EoPeWV.d.ts +593 -0
- package/dist/errors-DAIrstEL.d.cts +300 -0
- package/dist/errors-DPNMfyh0.d.ts +300 -0
- package/dist/index-BG0yjL7C.d.cts +6006 -0
- package/dist/index-ByynoyBO.d.ts +6006 -0
- package/dist/index.cjs +5126 -16118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1031 -7685
- package/dist/index.d.ts +1031 -7685
- package/dist/index.js +3219 -14905
- package/dist/index.js.map +1 -1
- package/dist/interfaces/index.d.cts +14 -6
- package/dist/interfaces/index.d.ts +14 -6
- package/dist/interfaces-43cReBcS.d.cts +3346 -0
- package/dist/interfaces-B8xKNl_6.d.ts +997 -0
- package/dist/interfaces-D2NO6kDD.d.cts +997 -0
- package/dist/interfaces-z_xYJlgV.d.ts +3346 -0
- package/dist/math/index.cjs +115 -0
- package/dist/math/index.cjs.map +1 -0
- package/dist/math/index.d.cts +1327 -0
- package/dist/math/index.d.ts +1327 -0
- package/dist/math/index.js +10 -0
- package/dist/math/index.js.map +1 -0
- package/dist/networks-RMd3abPE.d.ts +44 -0
- package/dist/networks-yAoO8peQ.d.cts +44 -0
- package/dist/relayer-NRRMSMNB.js +4 -0
- package/dist/relayer-NRRMSMNB.js.map +1 -0
- package/dist/relayer-RJHEIXJG.cjs +21 -0
- package/dist/relayer-RJHEIXJG.cjs.map +1 -0
- package/dist/solana/index.cjs +56 -0
- package/dist/solana/index.cjs.map +1 -0
- package/dist/solana/index.d.cts +105 -0
- package/dist/solana/index.d.ts +105 -0
- package/dist/solana/index.js +7 -0
- package/dist/solana/index.js.map +1 -0
- package/dist/{index-CLj_zWSD.d.ts → temporal-BbRaEPoO.d.ts} +1 -1
- package/dist/{index-CX6_pIRS.d.cts → temporal-oUj7iCaq.d.cts} +1 -1
- package/dist/transaction-forwarder-5mAMTjw6.d.ts +1155 -0
- package/dist/transaction-forwarder-C6gMUG7a.d.cts +1155 -0
- package/dist/types/index.cjs +232 -231
- package/dist/types/index.d.cts +15 -1485
- package/dist/types/index.d.ts +15 -1485
- package/dist/types/index.js +2 -1
- package/dist/types-BohhvPth.d.cts +87 -0
- package/dist/types-CW0oTT0j.d.ts +87 -0
- package/dist/types-C_V_CaKK.d.cts +2468 -0
- package/dist/types-C_V_CaKK.d.ts +2468 -0
- package/dist/types-Ca7frykr.d.ts +793 -0
- package/dist/types-CuKeoI19.d.cts +1296 -0
- package/dist/types-CxfTIpN9.d.ts +1052 -0
- package/dist/{types-n-sHFcgr.d.ts → types-D1jDUjfN.d.ts} +2 -2
- package/dist/types-DKEDUlH9.d.ts +1296 -0
- package/dist/types-EKuIfxTz.d.cts +1052 -0
- package/dist/{types-BBuELtY8.d.cts → types-IMGYmlv-.d.cts} +2 -2
- package/dist/types-PwNLi_2k.d.cts +793 -0
- package/dist/utils/index.cjs +823 -525
- package/dist/utils/index.d.cts +1711 -4021
- package/dist/utils/index.d.ts +1711 -4021
- package/dist/utils/index.js +9 -3
- package/dist/{versions-D9PqsEvj.d.cts → versions-BRlR36EA.d.cts} +1 -0
- package/dist/{versions-D9PqsEvj.d.ts → versions-BRlR36EA.d.ts} +1 -0
- package/package.json +79 -18
- package/dist/chunk-2Q75CQQJ.js.map +0 -1
- package/dist/chunk-BM7N6N7E.js.map +0 -1
- package/dist/chunk-GXKSUB2U.cjs +0 -4416
- package/dist/chunk-GXKSUB2U.cjs.map +0 -1
- package/dist/chunk-HOEXDXRC.cjs.map +0 -1
- package/dist/chunk-MDFSBU5W.cjs.map +0 -1
- package/dist/chunk-MQY7HDIA.js +0 -600
- package/dist/chunk-MQY7HDIA.js.map +0 -1
- package/dist/chunk-MVKTV3FT.cjs.map +0 -1
- package/dist/chunk-PG2J6V6Y.js +0 -4094
- package/dist/chunk-PG2J6V6Y.js.map +0 -1
- package/dist/chunk-VEGLTTYQ.cjs +0 -621
- package/dist/chunk-VEGLTTYQ.cjs.map +0 -1
- package/dist/chunk-WVHQ46DD.js +0 -758
- package/dist/chunk-WVHQ46DD.js.map +0 -1
- package/dist/index-B9pDY73x.d.ts +0 -12933
- package/dist/index-D33yo0qB.d.cts +0 -12933
- package/dist/networks-C-orpSFW.d.ts +0 -65
- package/dist/networks-FxYERGD1.d.cts +0 -65
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
import { ARCIUM_MXE_ACCOUNT_SEED, ARCIUM_MEMPOOL_SEED, ARCIUM_EXEC_POOL_SEED, ARCIUM_COMPUTATION_SEED, ARCIUM_COMP_DEF_SEED, ARCIUM_CLUSTER_SEED } from './chunk-EEKF4553.js';
|
|
2
|
+
import { encodeU128ToU128LeBytes, encodeU32ToU32LeBytes, encodeU64ToU64LeBytes } from './chunk-FQX6ZYGJ.js';
|
|
3
|
+
import { assertU32, assertU64 } from './chunk-CFTW5WNG.js';
|
|
4
|
+
import { __name } from './chunk-7QVYU63E.js';
|
|
5
|
+
import { getProgramDerivedAddress, getAddressEncoder } from '@solana/kit';
|
|
6
|
+
import { getAccountOffsetEncoder, getArciumX25519PublicKeyEncoder, getArciumX25519NonceEncoder } from '@umbra-privacy/umbra-codama';
|
|
7
|
+
import { sha256 } from '@noble/hashes/sha2.js';
|
|
8
|
+
|
|
9
|
+
function computeStructSeed(name) {
|
|
10
|
+
return sha256(new TextEncoder().encode(name));
|
|
11
|
+
}
|
|
12
|
+
__name(computeStructSeed, "computeStructSeed");
|
|
13
|
+
var STEALTH_POOL_SEED = computeStructSeed("StealthPool");
|
|
14
|
+
var CONF_UTXO_BURNER_SEED = computeStructSeed("ConfidentialNullifierLinkerBuffer");
|
|
15
|
+
var PUB_UTXO_BURNER_SEED = computeStructSeed("PublicNullifierLinkerBuffer");
|
|
16
|
+
var TREAP_SEED = computeStructSeed("Treap");
|
|
17
|
+
async function findStealthPoolPda(index, umbraProgram) {
|
|
18
|
+
const [pda] = await getProgramDerivedAddress({
|
|
19
|
+
programAddress: umbraProgram,
|
|
20
|
+
seeds: [STEALTH_POOL_SEED, encodeU128ToU128LeBytes(index)]
|
|
21
|
+
});
|
|
22
|
+
return pda;
|
|
23
|
+
}
|
|
24
|
+
__name(findStealthPoolPda, "findStealthPoolPda");
|
|
25
|
+
async function findActiveStealthPoolPda(umbraProgram) {
|
|
26
|
+
return findStealthPoolPda(0n, umbraProgram);
|
|
27
|
+
}
|
|
28
|
+
__name(findActiveStealthPoolPda, "findActiveStealthPoolPda");
|
|
29
|
+
async function findConfidentialNullifierBufferPda(relayerAddress, receiverAddress, burnerAccountOffset, umbraProgram) {
|
|
30
|
+
const addressEncoder = getAddressEncoder();
|
|
31
|
+
const [pda] = await getProgramDerivedAddress({
|
|
32
|
+
programAddress: umbraProgram,
|
|
33
|
+
seeds: [
|
|
34
|
+
CONF_UTXO_BURNER_SEED,
|
|
35
|
+
addressEncoder.encode(relayerAddress),
|
|
36
|
+
addressEncoder.encode(receiverAddress),
|
|
37
|
+
getAccountOffsetEncoder().encode({
|
|
38
|
+
first: BigInt(burnerAccountOffset)
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
return pda;
|
|
43
|
+
}
|
|
44
|
+
__name(findConfidentialNullifierBufferPda, "findConfidentialNullifierBufferPda");
|
|
45
|
+
async function findPublicNullifierBufferPda(relayerAddress, receiverAddress, burnerAccountOffset, umbraProgram) {
|
|
46
|
+
const addressEncoder = getAddressEncoder();
|
|
47
|
+
const [pda] = await getProgramDerivedAddress({
|
|
48
|
+
programAddress: umbraProgram,
|
|
49
|
+
seeds: [
|
|
50
|
+
PUB_UTXO_BURNER_SEED,
|
|
51
|
+
addressEncoder.encode(relayerAddress),
|
|
52
|
+
addressEncoder.encode(receiverAddress),
|
|
53
|
+
getAccountOffsetEncoder().encode({
|
|
54
|
+
first: BigInt(burnerAccountOffset)
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
return pda;
|
|
59
|
+
}
|
|
60
|
+
__name(findPublicNullifierBufferPda, "findPublicNullifierBufferPda");
|
|
61
|
+
async function findNullifierSetPdas(stealthPoolIndex, umbraProgram) {
|
|
62
|
+
const treapSeedBytes = TREAP_SEED;
|
|
63
|
+
const indexBytes = encodeU128ToU128LeBytes(stealthPoolIndex);
|
|
64
|
+
const derivePda = /* @__PURE__ */ __name(async (variant) => {
|
|
65
|
+
const [pda] = await getProgramDerivedAddress({
|
|
66
|
+
programAddress: umbraProgram,
|
|
67
|
+
seeds: [treapSeedBytes, indexBytes, new Uint8Array([variant])]
|
|
68
|
+
});
|
|
69
|
+
return pda;
|
|
70
|
+
}, "derivePda");
|
|
71
|
+
const [treap0, treap1, treap2, treap3, treap4] = await Promise.all([
|
|
72
|
+
derivePda(0),
|
|
73
|
+
derivePda(1),
|
|
74
|
+
derivePda(2),
|
|
75
|
+
derivePda(3),
|
|
76
|
+
derivePda(4)
|
|
77
|
+
]);
|
|
78
|
+
return { treap0, treap1, treap2, treap3, treap4 };
|
|
79
|
+
}
|
|
80
|
+
__name(findNullifierSetPdas, "findNullifierSetPdas");
|
|
81
|
+
|
|
82
|
+
// src/common/pda/user.ts
|
|
83
|
+
var ENCRYPTED_USER_ACCOUNT_SEED = computeStructSeed("EncryptedUserAccount");
|
|
84
|
+
var ENCRYPTED_TOKEN_ACCOUNT_SEED = computeStructSeed("EncryptedTokenAccount");
|
|
85
|
+
async function findEncryptedUserAccountPda(userPubkey, umbraProgram) {
|
|
86
|
+
const addressEncoder = getAddressEncoder();
|
|
87
|
+
const [pda] = await getProgramDerivedAddress({
|
|
88
|
+
programAddress: umbraProgram,
|
|
89
|
+
seeds: [ENCRYPTED_USER_ACCOUNT_SEED, addressEncoder.encode(userPubkey)]
|
|
90
|
+
});
|
|
91
|
+
return pda;
|
|
92
|
+
}
|
|
93
|
+
__name(findEncryptedUserAccountPda, "findEncryptedUserAccountPda");
|
|
94
|
+
async function findEncryptedTokenAccountPda(userPubkey, mintPubkey, umbraProgram) {
|
|
95
|
+
const addressEncoder = getAddressEncoder();
|
|
96
|
+
const [pda] = await getProgramDerivedAddress({
|
|
97
|
+
programAddress: umbraProgram,
|
|
98
|
+
seeds: [
|
|
99
|
+
ENCRYPTED_TOKEN_ACCOUNT_SEED,
|
|
100
|
+
addressEncoder.encode(userPubkey),
|
|
101
|
+
addressEncoder.encode(mintPubkey)
|
|
102
|
+
]
|
|
103
|
+
});
|
|
104
|
+
return pda;
|
|
105
|
+
}
|
|
106
|
+
__name(findEncryptedTokenAccountPda, "findEncryptedTokenAccountPda");
|
|
107
|
+
function computeCompDefOffset(instructionName) {
|
|
108
|
+
const hash = sha256(new TextEncoder().encode(instructionName));
|
|
109
|
+
const byte0 = hash[0];
|
|
110
|
+
const byte1 = hash[1];
|
|
111
|
+
const byte2 = hash[2];
|
|
112
|
+
const byte3 = hash[3];
|
|
113
|
+
const offset = byte0 | byte1 << 8 | byte2 << 16 | byte3 << 24;
|
|
114
|
+
return offset >>> 0;
|
|
115
|
+
}
|
|
116
|
+
__name(computeCompDefOffset, "computeCompDefOffset");
|
|
117
|
+
async function findArciumMxePda(umbraProgram, arciumProgram) {
|
|
118
|
+
const [address] = await getProgramDerivedAddress({
|
|
119
|
+
programAddress: arciumProgram,
|
|
120
|
+
seeds: [
|
|
121
|
+
new TextEncoder().encode(ARCIUM_MXE_ACCOUNT_SEED),
|
|
122
|
+
getAddressEncoder().encode(umbraProgram)
|
|
123
|
+
]
|
|
124
|
+
});
|
|
125
|
+
return address;
|
|
126
|
+
}
|
|
127
|
+
__name(findArciumMxePda, "findArciumMxePda");
|
|
128
|
+
async function findArciumMempoolPda(arciumProgram, clusterOffset) {
|
|
129
|
+
assertU32(BigInt(clusterOffset));
|
|
130
|
+
const [address] = await getProgramDerivedAddress({
|
|
131
|
+
programAddress: arciumProgram,
|
|
132
|
+
seeds: [
|
|
133
|
+
new TextEncoder().encode(ARCIUM_MEMPOOL_SEED),
|
|
134
|
+
encodeU32ToU32LeBytes(BigInt(clusterOffset))
|
|
135
|
+
]
|
|
136
|
+
});
|
|
137
|
+
return address;
|
|
138
|
+
}
|
|
139
|
+
__name(findArciumMempoolPda, "findArciumMempoolPda");
|
|
140
|
+
async function findArciumExecutingPoolPda(arciumProgram, clusterOffset) {
|
|
141
|
+
assertU32(BigInt(clusterOffset));
|
|
142
|
+
const [address] = await getProgramDerivedAddress({
|
|
143
|
+
programAddress: arciumProgram,
|
|
144
|
+
seeds: [
|
|
145
|
+
new TextEncoder().encode(ARCIUM_EXEC_POOL_SEED),
|
|
146
|
+
encodeU32ToU32LeBytes(BigInt(clusterOffset))
|
|
147
|
+
]
|
|
148
|
+
});
|
|
149
|
+
return address;
|
|
150
|
+
}
|
|
151
|
+
__name(findArciumExecutingPoolPda, "findArciumExecutingPoolPda");
|
|
152
|
+
async function findArciumComputationPda(arciumProgram, clusterOffset, computationOffset) {
|
|
153
|
+
assertU32(BigInt(clusterOffset));
|
|
154
|
+
assertU64(computationOffset);
|
|
155
|
+
const [address] = await getProgramDerivedAddress({
|
|
156
|
+
programAddress: arciumProgram,
|
|
157
|
+
seeds: [
|
|
158
|
+
new TextEncoder().encode(ARCIUM_COMPUTATION_SEED),
|
|
159
|
+
encodeU32ToU32LeBytes(BigInt(clusterOffset)),
|
|
160
|
+
encodeU64ToU64LeBytes(computationOffset)
|
|
161
|
+
]
|
|
162
|
+
});
|
|
163
|
+
return address;
|
|
164
|
+
}
|
|
165
|
+
__name(findArciumComputationPda, "findArciumComputationPda");
|
|
166
|
+
async function findArciumCompDefPda(umbraProgram, arciumProgram, compDefOffset) {
|
|
167
|
+
assertU32(BigInt(compDefOffset));
|
|
168
|
+
const [address] = await getProgramDerivedAddress({
|
|
169
|
+
programAddress: arciumProgram,
|
|
170
|
+
seeds: [
|
|
171
|
+
new TextEncoder().encode(ARCIUM_COMP_DEF_SEED),
|
|
172
|
+
getAddressEncoder().encode(umbraProgram),
|
|
173
|
+
encodeU32ToU32LeBytes(BigInt(compDefOffset))
|
|
174
|
+
]
|
|
175
|
+
});
|
|
176
|
+
return address;
|
|
177
|
+
}
|
|
178
|
+
__name(findArciumCompDefPda, "findArciumCompDefPda");
|
|
179
|
+
async function findArciumClusterPda(arciumProgram, clusterOffset) {
|
|
180
|
+
assertU32(BigInt(clusterOffset));
|
|
181
|
+
const [address] = await getProgramDerivedAddress({
|
|
182
|
+
programAddress: arciumProgram,
|
|
183
|
+
seeds: [
|
|
184
|
+
new TextEncoder().encode(ARCIUM_CLUSTER_SEED),
|
|
185
|
+
encodeU32ToU32LeBytes(BigInt(clusterOffset))
|
|
186
|
+
]
|
|
187
|
+
});
|
|
188
|
+
return address;
|
|
189
|
+
}
|
|
190
|
+
__name(findArciumClusterPda, "findArciumClusterPda");
|
|
191
|
+
async function findArciumInfrastructurePdas(umbraProgram, arciumProgram, clusterOffset, computationOffset, instructionName) {
|
|
192
|
+
const compDefOffset = computeCompDefOffset(instructionName);
|
|
193
|
+
const [
|
|
194
|
+
mxeAccount,
|
|
195
|
+
mempoolAccount,
|
|
196
|
+
executingPoolAccount,
|
|
197
|
+
computationAccount,
|
|
198
|
+
compDefAccount,
|
|
199
|
+
clusterAccount
|
|
200
|
+
] = await Promise.all([
|
|
201
|
+
findArciumMxePda(umbraProgram, arciumProgram),
|
|
202
|
+
findArciumMempoolPda(arciumProgram, clusterOffset),
|
|
203
|
+
findArciumExecutingPoolPda(arciumProgram, clusterOffset),
|
|
204
|
+
findArciumComputationPda(arciumProgram, clusterOffset, computationOffset),
|
|
205
|
+
findArciumCompDefPda(umbraProgram, arciumProgram, compDefOffset),
|
|
206
|
+
findArciumClusterPda(arciumProgram, clusterOffset)
|
|
207
|
+
]);
|
|
208
|
+
return {
|
|
209
|
+
mxeAccount,
|
|
210
|
+
mempoolAccount,
|
|
211
|
+
executingPoolAccount,
|
|
212
|
+
computationAccount,
|
|
213
|
+
compDefAccount,
|
|
214
|
+
clusterAccount
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
__name(findArciumInfrastructurePdas, "findArciumInfrastructurePdas");
|
|
218
|
+
var VIEWING_GRANT_SEED = new Uint8Array([
|
|
219
|
+
209,
|
|
220
|
+
198,
|
|
221
|
+
56,
|
|
222
|
+
240,
|
|
223
|
+
66,
|
|
224
|
+
199,
|
|
225
|
+
19,
|
|
226
|
+
205,
|
|
227
|
+
112,
|
|
228
|
+
18,
|
|
229
|
+
168,
|
|
230
|
+
165,
|
|
231
|
+
236,
|
|
232
|
+
235,
|
|
233
|
+
81,
|
|
234
|
+
198,
|
|
235
|
+
191,
|
|
236
|
+
71,
|
|
237
|
+
73,
|
|
238
|
+
191,
|
|
239
|
+
110,
|
|
240
|
+
113,
|
|
241
|
+
189,
|
|
242
|
+
97,
|
|
243
|
+
139,
|
|
244
|
+
226,
|
|
245
|
+
152,
|
|
246
|
+
252,
|
|
247
|
+
229,
|
|
248
|
+
184,
|
|
249
|
+
187,
|
|
250
|
+
253
|
|
251
|
+
]);
|
|
252
|
+
var USER_GRANT_VARIANT_SEED = new Uint8Array([
|
|
253
|
+
184,
|
|
254
|
+
137,
|
|
255
|
+
63,
|
|
256
|
+
24,
|
|
257
|
+
18,
|
|
258
|
+
54,
|
|
259
|
+
138,
|
|
260
|
+
200,
|
|
261
|
+
151,
|
|
262
|
+
217,
|
|
263
|
+
219,
|
|
264
|
+
241,
|
|
265
|
+
119,
|
|
266
|
+
150,
|
|
267
|
+
66,
|
|
268
|
+
8,
|
|
269
|
+
27,
|
|
270
|
+
105,
|
|
271
|
+
131,
|
|
272
|
+
187,
|
|
273
|
+
58,
|
|
274
|
+
182,
|
|
275
|
+
24,
|
|
276
|
+
203,
|
|
277
|
+
146,
|
|
278
|
+
119,
|
|
279
|
+
188,
|
|
280
|
+
210,
|
|
281
|
+
197,
|
|
282
|
+
104,
|
|
283
|
+
238,
|
|
284
|
+
33
|
|
285
|
+
]);
|
|
286
|
+
var NETWORK_MXE_GRANT_VARIANT_SEED = new Uint8Array([
|
|
287
|
+
142,
|
|
288
|
+
219,
|
|
289
|
+
209,
|
|
290
|
+
143,
|
|
291
|
+
158,
|
|
292
|
+
68,
|
|
293
|
+
71,
|
|
294
|
+
58,
|
|
295
|
+
193,
|
|
296
|
+
244,
|
|
297
|
+
116,
|
|
298
|
+
159,
|
|
299
|
+
48,
|
|
300
|
+
68,
|
|
301
|
+
160,
|
|
302
|
+
95,
|
|
303
|
+
175,
|
|
304
|
+
131,
|
|
305
|
+
151,
|
|
306
|
+
209,
|
|
307
|
+
81,
|
|
308
|
+
213,
|
|
309
|
+
51,
|
|
310
|
+
159,
|
|
311
|
+
98,
|
|
312
|
+
98,
|
|
313
|
+
138,
|
|
314
|
+
109,
|
|
315
|
+
254,
|
|
316
|
+
69,
|
|
317
|
+
221,
|
|
318
|
+
95
|
|
319
|
+
]);
|
|
320
|
+
var NETWORK_SHARED_GRANT_VARIANT_SEED = new Uint8Array([
|
|
321
|
+
172,
|
|
322
|
+
245,
|
|
323
|
+
86,
|
|
324
|
+
61,
|
|
325
|
+
89,
|
|
326
|
+
235,
|
|
327
|
+
170,
|
|
328
|
+
92,
|
|
329
|
+
253,
|
|
330
|
+
117,
|
|
331
|
+
241,
|
|
332
|
+
14,
|
|
333
|
+
2,
|
|
334
|
+
33,
|
|
335
|
+
164,
|
|
336
|
+
107,
|
|
337
|
+
22,
|
|
338
|
+
131,
|
|
339
|
+
100,
|
|
340
|
+
113,
|
|
341
|
+
39,
|
|
342
|
+
173,
|
|
343
|
+
185,
|
|
344
|
+
55,
|
|
345
|
+
254,
|
|
346
|
+
100,
|
|
347
|
+
108,
|
|
348
|
+
218,
|
|
349
|
+
180,
|
|
350
|
+
105,
|
|
351
|
+
75,
|
|
352
|
+
184
|
|
353
|
+
]);
|
|
354
|
+
async function findUserComplianceGrantPda(granterX25519, nonce, receiverX25519, umbraProgram) {
|
|
355
|
+
const [pda] = await getProgramDerivedAddress({
|
|
356
|
+
programAddress: umbraProgram,
|
|
357
|
+
seeds: [
|
|
358
|
+
VIEWING_GRANT_SEED,
|
|
359
|
+
USER_GRANT_VARIANT_SEED,
|
|
360
|
+
getArciumX25519PublicKeyEncoder().encode({ first: granterX25519 }),
|
|
361
|
+
getArciumX25519NonceEncoder().encode({ first: nonce }),
|
|
362
|
+
getArciumX25519PublicKeyEncoder().encode({ first: receiverX25519 })
|
|
363
|
+
]
|
|
364
|
+
});
|
|
365
|
+
return pda;
|
|
366
|
+
}
|
|
367
|
+
__name(findUserComplianceGrantPda, "findUserComplianceGrantPda");
|
|
368
|
+
async function findNetworkComplianceGrantPda(nonce, receiverX25519, umbraProgram) {
|
|
369
|
+
const [pda] = await getProgramDerivedAddress({
|
|
370
|
+
programAddress: umbraProgram,
|
|
371
|
+
seeds: [
|
|
372
|
+
VIEWING_GRANT_SEED,
|
|
373
|
+
NETWORK_MXE_GRANT_VARIANT_SEED,
|
|
374
|
+
getArciumX25519NonceEncoder().encode({ first: nonce }),
|
|
375
|
+
getArciumX25519PublicKeyEncoder().encode({ first: receiverX25519 })
|
|
376
|
+
]
|
|
377
|
+
});
|
|
378
|
+
return pda;
|
|
379
|
+
}
|
|
380
|
+
__name(findNetworkComplianceGrantPda, "findNetworkComplianceGrantPda");
|
|
381
|
+
async function findSharedComplianceGrantPda(granterX25519, nonce, receiverX25519, umbraProgram) {
|
|
382
|
+
const [pda] = await getProgramDerivedAddress({
|
|
383
|
+
programAddress: umbraProgram,
|
|
384
|
+
seeds: [
|
|
385
|
+
VIEWING_GRANT_SEED,
|
|
386
|
+
NETWORK_SHARED_GRANT_VARIANT_SEED,
|
|
387
|
+
getArciumX25519PublicKeyEncoder().encode({ first: granterX25519 }),
|
|
388
|
+
getArciumX25519NonceEncoder().encode({ first: nonce }),
|
|
389
|
+
getArciumX25519PublicKeyEncoder().encode({ first: receiverX25519 })
|
|
390
|
+
]
|
|
391
|
+
});
|
|
392
|
+
return pda;
|
|
393
|
+
}
|
|
394
|
+
__name(findSharedComplianceGrantPda, "findSharedComplianceGrantPda");
|
|
395
|
+
var PROTOCOL_CONFIG_SEED = computeStructSeed("ProtocolConfig");
|
|
396
|
+
async function findProtocolConfigPda(umbraProgram) {
|
|
397
|
+
const [pda] = await getProgramDerivedAddress({
|
|
398
|
+
programAddress: umbraProgram,
|
|
399
|
+
seeds: [PROTOCOL_CONFIG_SEED]
|
|
400
|
+
});
|
|
401
|
+
return pda;
|
|
402
|
+
}
|
|
403
|
+
__name(findProtocolConfigPda, "findProtocolConfigPda");
|
|
404
|
+
var TOKEN_POOL_SEED = computeStructSeed("TokenPool");
|
|
405
|
+
async function findTokenPoolPda(mintAddress, umbraProgram) {
|
|
406
|
+
const [pda] = await getProgramDerivedAddress({
|
|
407
|
+
programAddress: umbraProgram,
|
|
408
|
+
seeds: [TOKEN_POOL_SEED, getAddressEncoder().encode(mintAddress)]
|
|
409
|
+
});
|
|
410
|
+
return pda;
|
|
411
|
+
}
|
|
412
|
+
__name(findTokenPoolPda, "findTokenPoolPda");
|
|
413
|
+
var RELAYER_SEED = computeStructSeed("Relayer");
|
|
414
|
+
async function findRelayerPda(relayerAddress, mintAddress, umbraProgram) {
|
|
415
|
+
const addressEncoder = getAddressEncoder();
|
|
416
|
+
const [pda] = await getProgramDerivedAddress({
|
|
417
|
+
programAddress: umbraProgram,
|
|
418
|
+
seeds: [
|
|
419
|
+
RELAYER_SEED,
|
|
420
|
+
addressEncoder.encode(relayerAddress),
|
|
421
|
+
addressEncoder.encode(mintAddress)
|
|
422
|
+
]
|
|
423
|
+
});
|
|
424
|
+
return pda;
|
|
425
|
+
}
|
|
426
|
+
__name(findRelayerPda, "findRelayerPda");
|
|
427
|
+
var FEE_VAULT_SEED = computeStructSeed("FeeVault");
|
|
428
|
+
var DOMAIN_PROTOCOL_FEES = computeStructSeed("ProtocolFees");
|
|
429
|
+
var DOMAIN_PROTOCOL_RELAYER_FEES = computeStructSeed("ProtocolRelayerFees");
|
|
430
|
+
var FEE_SCHEDULE_SEED = computeStructSeed("FeeSchedule");
|
|
431
|
+
var RELAYER_FEE_SCHEDULE_SEED = computeStructSeed("RelayerFeeSchedule");
|
|
432
|
+
async function findProtocolFeeVaultPda(instructionSeed, mintAddress, offset, umbraProgram) {
|
|
433
|
+
const addressEncoder = getAddressEncoder();
|
|
434
|
+
return getProgramDerivedAddress({
|
|
435
|
+
programAddress: umbraProgram,
|
|
436
|
+
seeds: [
|
|
437
|
+
FEE_VAULT_SEED,
|
|
438
|
+
DOMAIN_PROTOCOL_FEES,
|
|
439
|
+
encodeU128ToU128LeBytes(instructionSeed),
|
|
440
|
+
addressEncoder.encode(mintAddress),
|
|
441
|
+
getAccountOffsetEncoder().encode({ first: BigInt(offset) })
|
|
442
|
+
]
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
__name(findProtocolFeeVaultPda, "findProtocolFeeVaultPda");
|
|
446
|
+
async function findRelayerFeeVaultPda(instructionSeed, relayerAddress, mintAddress, offset, umbraProgram) {
|
|
447
|
+
const addressEncoder = getAddressEncoder();
|
|
448
|
+
return getProgramDerivedAddress({
|
|
449
|
+
programAddress: umbraProgram,
|
|
450
|
+
seeds: [
|
|
451
|
+
FEE_VAULT_SEED,
|
|
452
|
+
DOMAIN_PROTOCOL_RELAYER_FEES,
|
|
453
|
+
encodeU128ToU128LeBytes(instructionSeed),
|
|
454
|
+
addressEncoder.encode(relayerAddress),
|
|
455
|
+
addressEncoder.encode(mintAddress),
|
|
456
|
+
getAccountOffsetEncoder().encode({ first: BigInt(offset) })
|
|
457
|
+
]
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
__name(findRelayerFeeVaultPda, "findRelayerFeeVaultPda");
|
|
461
|
+
async function findFeeSchedulePda(instructionSeed, mintAddress, offset, umbraProgram) {
|
|
462
|
+
const addressEncoder = getAddressEncoder();
|
|
463
|
+
return getProgramDerivedAddress({
|
|
464
|
+
programAddress: umbraProgram,
|
|
465
|
+
seeds: [
|
|
466
|
+
FEE_SCHEDULE_SEED,
|
|
467
|
+
encodeU128ToU128LeBytes(instructionSeed),
|
|
468
|
+
addressEncoder.encode(mintAddress),
|
|
469
|
+
getAccountOffsetEncoder().encode({ first: BigInt(offset) })
|
|
470
|
+
]
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
__name(findFeeSchedulePda, "findFeeSchedulePda");
|
|
474
|
+
async function findRelayerFeeSchedulePda(instructionSeed, relayerAddress, mintAddress, offset, umbraProgram) {
|
|
475
|
+
const addressEncoder = getAddressEncoder();
|
|
476
|
+
return getProgramDerivedAddress({
|
|
477
|
+
programAddress: umbraProgram,
|
|
478
|
+
seeds: [
|
|
479
|
+
RELAYER_FEE_SCHEDULE_SEED,
|
|
480
|
+
encodeU128ToU128LeBytes(instructionSeed),
|
|
481
|
+
addressEncoder.encode(relayerAddress),
|
|
482
|
+
addressEncoder.encode(mintAddress),
|
|
483
|
+
getAccountOffsetEncoder().encode({ first: BigInt(offset) })
|
|
484
|
+
]
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
__name(findRelayerFeeSchedulePda, "findRelayerFeeSchedulePda");
|
|
488
|
+
var GROTH16_VERIFYING_KEY_SEED = computeStructSeed("Groth16VerifyingKey");
|
|
489
|
+
var CONFIDENTIAL_CLAIM_PROOF_ACCOUNT_SEED = computeStructSeed("ConfidentialClaimProofAccount");
|
|
490
|
+
var CONFIDENTIAL_UTXO_PROOF_ACCOUNT_SEED = computeStructSeed("ConfidentialUtxoProofAccount");
|
|
491
|
+
var PUBLIC_UTXO_PROOF_ACCOUNT_SEED = computeStructSeed("PublicUtxoProofAccount");
|
|
492
|
+
var PUBLIC_CLAIM_PROOF_ACCOUNT_SEED = computeStructSeed("PublicClaimProofAccount");
|
|
493
|
+
var PUBLIC_CLAIM_MXE_MPC_CALLBACK_DATA_SEED = computeStructSeed("PublicClaimMxeMpcCallbackData");
|
|
494
|
+
async function findVerifyingKeyPda(instructionSeed, umbraProgram) {
|
|
495
|
+
const [pda] = await getProgramDerivedAddress({
|
|
496
|
+
programAddress: umbraProgram,
|
|
497
|
+
seeds: [GROTH16_VERIFYING_KEY_SEED, encodeU128ToU128LeBytes(instructionSeed)]
|
|
498
|
+
});
|
|
499
|
+
return pda;
|
|
500
|
+
}
|
|
501
|
+
__name(findVerifyingKeyPda, "findVerifyingKeyPda");
|
|
502
|
+
async function findClaimInputBufferPda(payerAddress, offset, umbraProgram) {
|
|
503
|
+
const [pda] = await getProgramDerivedAddress({
|
|
504
|
+
programAddress: umbraProgram,
|
|
505
|
+
seeds: [
|
|
506
|
+
CONFIDENTIAL_CLAIM_PROOF_ACCOUNT_SEED,
|
|
507
|
+
getAddressEncoder().encode(payerAddress),
|
|
508
|
+
getAccountOffsetEncoder().encode({ first: BigInt(offset) })
|
|
509
|
+
]
|
|
510
|
+
});
|
|
511
|
+
return pda;
|
|
512
|
+
}
|
|
513
|
+
__name(findClaimInputBufferPda, "findClaimInputBufferPda");
|
|
514
|
+
async function findUtxoInputBufferPda(depositorAddress, offset, umbraProgram) {
|
|
515
|
+
const [pda] = await getProgramDerivedAddress({
|
|
516
|
+
programAddress: umbraProgram,
|
|
517
|
+
seeds: [
|
|
518
|
+
CONFIDENTIAL_UTXO_PROOF_ACCOUNT_SEED,
|
|
519
|
+
getAddressEncoder().encode(depositorAddress),
|
|
520
|
+
getAccountOffsetEncoder().encode({ first: BigInt(offset) })
|
|
521
|
+
]
|
|
522
|
+
});
|
|
523
|
+
return pda;
|
|
524
|
+
}
|
|
525
|
+
__name(findUtxoInputBufferPda, "findUtxoInputBufferPda");
|
|
526
|
+
async function findPublicUtxoInputBufferPda(depositorAddress, offset, umbraProgram) {
|
|
527
|
+
const [pda] = await getProgramDerivedAddress({
|
|
528
|
+
programAddress: umbraProgram,
|
|
529
|
+
seeds: [
|
|
530
|
+
PUBLIC_UTXO_PROOF_ACCOUNT_SEED,
|
|
531
|
+
getAddressEncoder().encode(depositorAddress),
|
|
532
|
+
getAccountOffsetEncoder().encode({ first: BigInt(offset) })
|
|
533
|
+
]
|
|
534
|
+
});
|
|
535
|
+
return pda;
|
|
536
|
+
}
|
|
537
|
+
__name(findPublicUtxoInputBufferPda, "findPublicUtxoInputBufferPda");
|
|
538
|
+
async function findPublicClaimInputBufferPda(relayerAddress, offset, umbraProgram) {
|
|
539
|
+
const [pda] = await getProgramDerivedAddress({
|
|
540
|
+
programAddress: umbraProgram,
|
|
541
|
+
seeds: [
|
|
542
|
+
PUBLIC_CLAIM_PROOF_ACCOUNT_SEED,
|
|
543
|
+
getAddressEncoder().encode(relayerAddress),
|
|
544
|
+
getAccountOffsetEncoder().encode({ first: BigInt(offset) })
|
|
545
|
+
]
|
|
546
|
+
});
|
|
547
|
+
return pda;
|
|
548
|
+
}
|
|
549
|
+
__name(findPublicClaimInputBufferPda, "findPublicClaimInputBufferPda");
|
|
550
|
+
async function findPublicClaimComputationDataPda(relayerAddress, offset, umbraProgram) {
|
|
551
|
+
return getProgramDerivedAddress({
|
|
552
|
+
programAddress: umbraProgram,
|
|
553
|
+
seeds: [
|
|
554
|
+
PUBLIC_CLAIM_MXE_MPC_CALLBACK_DATA_SEED,
|
|
555
|
+
getAddressEncoder().encode(relayerAddress),
|
|
556
|
+
getAccountOffsetEncoder().encode({ first: BigInt(offset) })
|
|
557
|
+
]
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
__name(findPublicClaimComputationDataPda, "findPublicClaimComputationDataPda");
|
|
561
|
+
|
|
562
|
+
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 };
|
|
563
|
+
//# sourceMappingURL=chunk-MKNCBUFA.js.map
|
|
564
|
+
//# sourceMappingURL=chunk-MKNCBUFA.js.map
|