@aztec/bb.js 3.0.0-nightly.20251208 → 3.0.0-nightly.20251209
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/build/amd64-linux/bb +0 -0
- package/build/amd64-linux/nodejs_module.node +0 -0
- package/build/amd64-macos/bb +0 -0
- package/build/amd64-macos/nodejs_module.node +0 -0
- package/build/arm64-linux/bb +0 -0
- package/build/arm64-linux/nodejs_module.node +0 -0
- package/build/arm64-macos/bb +0 -0
- package/build/arm64-macos/nodejs_module.node +0 -0
- package/dest/browser/barretenberg_wasm/fetch_code/browser/barretenberg-threads.js +1 -1
- package/dest/browser/barretenberg_wasm/fetch_code/browser/barretenberg.js +1 -1
- package/dest/node/barretenberg_wasm/barretenberg-threads.wasm.gz +0 -0
- package/dest/node-cjs/barretenberg_wasm/barretenberg-threads.wasm.gz +0 -0
- package/package.json +1 -1
- package/src/cbind/generated/api_types.ts +4241 -0
- package/src/cbind/generated/async.ts +717 -0
- package/src/cbind/generated/curve_constants.ts +53 -0
- package/src/cbind/generated/sync.ts +663 -0
|
@@ -0,0 +1,717 @@
|
|
|
1
|
+
// AUTOGENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
import { IMsgpackBackendAsync } from '../../bb_backends/interface.js';
|
|
4
|
+
import { Decoder, Encoder } from 'msgpackr';
|
|
5
|
+
import { BBApiException } from '../../bbapi_exception.js';
|
|
6
|
+
import { AesDecrypt, AesDecryptResponse, AesEncrypt, AesEncryptResponse, BbApiBase, Blake2s, Blake2sResponse, Blake2sToField, Blake2sToFieldResponse, Bn254FqSqrt, Bn254FqSqrtResponse, Bn254FrSqrt, Bn254FrSqrtResponse, Bn254G1FromCompressed, Bn254G1FromCompressedResponse, Bn254G1IsOnCurve, Bn254G1IsOnCurveResponse, Bn254G1Mul, Bn254G1MulResponse, Bn254G1Point, Bn254G2Mul, Bn254G2MulResponse, Bn254G2Point, ChonkAccumulate, ChonkAccumulateResponse, ChonkCheckPrecomputedVk, ChonkCheckPrecomputedVkResponse, ChonkComputeIvcVk, ChonkComputeIvcVkResponse, ChonkComputeStandaloneVk, ChonkComputeStandaloneVkResponse, ChonkLoad, ChonkLoadResponse, ChonkProof, ChonkProve, ChonkProveResponse, ChonkStart, ChonkStartResponse, ChonkStats, ChonkStatsResponse, ChonkVerify, ChonkVerifyResponse, CircuitComputeVk, CircuitComputeVkResponse, CircuitInfoResponse, CircuitInput, CircuitInputNoVK, CircuitProve, CircuitProveResponse, CircuitStats, CircuitVerify, CircuitVerifyResponse, CircuitWriteSolidityVerifier, CircuitWriteSolidityVerifierResponse, EcdsaSecp256k1ComputePublicKey, EcdsaSecp256k1ComputePublicKeyResponse, EcdsaSecp256k1ConstructSignature, EcdsaSecp256k1ConstructSignatureResponse, EcdsaSecp256k1RecoverPublicKey, EcdsaSecp256k1RecoverPublicKeyResponse, EcdsaSecp256k1VerifySignature, EcdsaSecp256k1VerifySignatureResponse, EcdsaSecp256r1ComputePublicKey, EcdsaSecp256r1ComputePublicKeyResponse, EcdsaSecp256r1ConstructSignature, EcdsaSecp256r1ConstructSignatureResponse, EcdsaSecp256r1RecoverPublicKey, EcdsaSecp256r1RecoverPublicKeyResponse, EcdsaSecp256r1VerifySignature, EcdsaSecp256r1VerifySignatureResponse, ErrorResponse, Field2, Fq, Fr, GoblinProof, GrumpkinAdd, GrumpkinAddResponse, GrumpkinBatchMul, GrumpkinBatchMulResponse, GrumpkinGetRandomFr, GrumpkinGetRandomFrResponse, GrumpkinMul, GrumpkinMulResponse, GrumpkinPoint, GrumpkinReduce512, GrumpkinReduce512Response, MegaVkAsFields, MegaVkAsFieldsResponse, PedersenCommit, PedersenCommitResponse, PedersenHash, PedersenHashBuffer, PedersenHashBufferResponse, PedersenHashResponse, Poseidon2Hash, Poseidon2HashAccumulate, Poseidon2HashAccumulateResponse, Poseidon2HashResponse, Poseidon2Permutation, Poseidon2PermutationResponse, ProofSystemSettings, SchnorrComputePublicKey, SchnorrComputePublicKeyResponse, SchnorrConstructSignature, SchnorrConstructSignatureResponse, SchnorrVerifySignature, SchnorrVerifySignatureResponse, Secp256k1Fq, Secp256k1Fr, Secp256k1GetRandomFr, Secp256k1GetRandomFrResponse, Secp256k1Mul, Secp256k1MulResponse, Secp256k1Point, Secp256k1Reduce512, Secp256k1Reduce512Response, Secp256r1Fq, Secp256r1Fr, Secp256r1Point, Shutdown, ShutdownResponse, SrsInitGrumpkinSrs, SrsInitGrumpkinSrsResponse, SrsInitSrs, SrsInitSrsResponse, Uint256T, VkAsFields, VkAsFieldsResponse, fromAesDecrypt, fromAesEncrypt, fromBlake2s, fromBlake2sToField, fromBn254FqSqrt, fromBn254FrSqrt, fromBn254G1FromCompressed, fromBn254G1IsOnCurve, fromBn254G1Mul, fromBn254G2Mul, fromChonkAccumulate, fromChonkCheckPrecomputedVk, fromChonkComputeIvcVk, fromChonkComputeStandaloneVk, fromChonkLoad, fromChonkProve, fromChonkStart, fromChonkStats, fromChonkVerify, fromCircuitComputeVk, fromCircuitProve, fromCircuitStats, fromCircuitVerify, fromCircuitWriteSolidityVerifier, fromEcdsaSecp256k1ComputePublicKey, fromEcdsaSecp256k1ConstructSignature, fromEcdsaSecp256k1RecoverPublicKey, fromEcdsaSecp256k1VerifySignature, fromEcdsaSecp256r1ComputePublicKey, fromEcdsaSecp256r1ConstructSignature, fromEcdsaSecp256r1RecoverPublicKey, fromEcdsaSecp256r1VerifySignature, fromGrumpkinAdd, fromGrumpkinBatchMul, fromGrumpkinGetRandomFr, fromGrumpkinMul, fromGrumpkinReduce512, fromMegaVkAsFields, fromPedersenCommit, fromPedersenHash, fromPedersenHashBuffer, fromPoseidon2Hash, fromPoseidon2HashAccumulate, fromPoseidon2Permutation, fromSchnorrComputePublicKey, fromSchnorrConstructSignature, fromSchnorrVerifySignature, fromSecp256k1GetRandomFr, fromSecp256k1Mul, fromSecp256k1Reduce512, fromShutdown, fromSrsInitGrumpkinSrs, fromSrsInitSrs, fromVkAsFields, toAesDecryptResponse, toAesEncryptResponse, toBlake2sResponse, toBlake2sToFieldResponse, toBn254FqSqrtResponse, toBn254FrSqrtResponse, toBn254G1FromCompressedResponse, toBn254G1IsOnCurveResponse, toBn254G1MulResponse, toBn254G2MulResponse, toChonkAccumulateResponse, toChonkCheckPrecomputedVkResponse, toChonkComputeIvcVkResponse, toChonkComputeStandaloneVkResponse, toChonkLoadResponse, toChonkProveResponse, toChonkStartResponse, toChonkStatsResponse, toChonkVerifyResponse, toCircuitComputeVkResponse, toCircuitInfoResponse, toCircuitProveResponse, toCircuitVerifyResponse, toCircuitWriteSolidityVerifierResponse, toEcdsaSecp256k1ComputePublicKeyResponse, toEcdsaSecp256k1ConstructSignatureResponse, toEcdsaSecp256k1RecoverPublicKeyResponse, toEcdsaSecp256k1VerifySignatureResponse, toEcdsaSecp256r1ComputePublicKeyResponse, toEcdsaSecp256r1ConstructSignatureResponse, toEcdsaSecp256r1RecoverPublicKeyResponse, toEcdsaSecp256r1VerifySignatureResponse, toGrumpkinAddResponse, toGrumpkinBatchMulResponse, toGrumpkinGetRandomFrResponse, toGrumpkinMulResponse, toGrumpkinReduce512Response, toMegaVkAsFieldsResponse, toPedersenCommitResponse, toPedersenHashBufferResponse, toPedersenHashResponse, toPoseidon2HashAccumulateResponse, toPoseidon2HashResponse, toPoseidon2PermutationResponse, toSchnorrComputePublicKeyResponse, toSchnorrConstructSignatureResponse, toSchnorrVerifySignatureResponse, toSecp256k1GetRandomFrResponse, toSecp256k1MulResponse, toSecp256k1Reduce512Response, toShutdownResponse, toSrsInitGrumpkinSrsResponse, toSrsInitSrsResponse, toVkAsFieldsResponse } from './api_types.js';
|
|
7
|
+
|
|
8
|
+
async function msgpackCall(backend: IMsgpackBackendAsync, input: any[]) { const inputBuffer = new Encoder({ useRecords: false }).pack(input); const encodedResult = await backend.call(inputBuffer); return new Decoder({ useRecords: false }).unpack(encodedResult);}
|
|
9
|
+
export class AsyncApi implements BbApiBase {
|
|
10
|
+
constructor(protected backend: IMsgpackBackendAsync) {}
|
|
11
|
+
|
|
12
|
+
circuitProve(command: CircuitProve): Promise<CircuitProveResponse> {
|
|
13
|
+
const msgpackCommand = fromCircuitProve(command);
|
|
14
|
+
return msgpackCall(this.backend, [["CircuitProve", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
15
|
+
if (variantName === 'ErrorResponse') {
|
|
16
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
17
|
+
}
|
|
18
|
+
if (variantName !== 'CircuitProveResponse') {
|
|
19
|
+
throw new BBApiException(`Expected variant name 'CircuitProveResponse' but got '${variantName}'`);
|
|
20
|
+
}
|
|
21
|
+
return toCircuitProveResponse(result);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
circuitComputeVk(command: CircuitComputeVk): Promise<CircuitComputeVkResponse> {
|
|
26
|
+
const msgpackCommand = fromCircuitComputeVk(command);
|
|
27
|
+
return msgpackCall(this.backend, [["CircuitComputeVk", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
28
|
+
if (variantName === 'ErrorResponse') {
|
|
29
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
30
|
+
}
|
|
31
|
+
if (variantName !== 'CircuitComputeVkResponse') {
|
|
32
|
+
throw new BBApiException(`Expected variant name 'CircuitComputeVkResponse' but got '${variantName}'`);
|
|
33
|
+
}
|
|
34
|
+
return toCircuitComputeVkResponse(result);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
circuitStats(command: CircuitStats): Promise<CircuitInfoResponse> {
|
|
39
|
+
const msgpackCommand = fromCircuitStats(command);
|
|
40
|
+
return msgpackCall(this.backend, [["CircuitStats", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
41
|
+
if (variantName === 'ErrorResponse') {
|
|
42
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
43
|
+
}
|
|
44
|
+
if (variantName !== 'CircuitInfoResponse') {
|
|
45
|
+
throw new BBApiException(`Expected variant name 'CircuitInfoResponse' but got '${variantName}'`);
|
|
46
|
+
}
|
|
47
|
+
return toCircuitInfoResponse(result);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
circuitVerify(command: CircuitVerify): Promise<CircuitVerifyResponse> {
|
|
52
|
+
const msgpackCommand = fromCircuitVerify(command);
|
|
53
|
+
return msgpackCall(this.backend, [["CircuitVerify", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
54
|
+
if (variantName === 'ErrorResponse') {
|
|
55
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
56
|
+
}
|
|
57
|
+
if (variantName !== 'CircuitVerifyResponse') {
|
|
58
|
+
throw new BBApiException(`Expected variant name 'CircuitVerifyResponse' but got '${variantName}'`);
|
|
59
|
+
}
|
|
60
|
+
return toCircuitVerifyResponse(result);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
chonkComputeStandaloneVk(command: ChonkComputeStandaloneVk): Promise<ChonkComputeStandaloneVkResponse> {
|
|
65
|
+
const msgpackCommand = fromChonkComputeStandaloneVk(command);
|
|
66
|
+
return msgpackCall(this.backend, [["ChonkComputeStandaloneVk", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
67
|
+
if (variantName === 'ErrorResponse') {
|
|
68
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
69
|
+
}
|
|
70
|
+
if (variantName !== 'ChonkComputeStandaloneVkResponse') {
|
|
71
|
+
throw new BBApiException(`Expected variant name 'ChonkComputeStandaloneVkResponse' but got '${variantName}'`);
|
|
72
|
+
}
|
|
73
|
+
return toChonkComputeStandaloneVkResponse(result);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
chonkComputeIvcVk(command: ChonkComputeIvcVk): Promise<ChonkComputeIvcVkResponse> {
|
|
78
|
+
const msgpackCommand = fromChonkComputeIvcVk(command);
|
|
79
|
+
return msgpackCall(this.backend, [["ChonkComputeIvcVk", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
80
|
+
if (variantName === 'ErrorResponse') {
|
|
81
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
82
|
+
}
|
|
83
|
+
if (variantName !== 'ChonkComputeIvcVkResponse') {
|
|
84
|
+
throw new BBApiException(`Expected variant name 'ChonkComputeIvcVkResponse' but got '${variantName}'`);
|
|
85
|
+
}
|
|
86
|
+
return toChonkComputeIvcVkResponse(result);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
chonkStart(command: ChonkStart): Promise<ChonkStartResponse> {
|
|
91
|
+
const msgpackCommand = fromChonkStart(command);
|
|
92
|
+
return msgpackCall(this.backend, [["ChonkStart", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
93
|
+
if (variantName === 'ErrorResponse') {
|
|
94
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
95
|
+
}
|
|
96
|
+
if (variantName !== 'ChonkStartResponse') {
|
|
97
|
+
throw new BBApiException(`Expected variant name 'ChonkStartResponse' but got '${variantName}'`);
|
|
98
|
+
}
|
|
99
|
+
return toChonkStartResponse(result);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
chonkLoad(command: ChonkLoad): Promise<ChonkLoadResponse> {
|
|
104
|
+
const msgpackCommand = fromChonkLoad(command);
|
|
105
|
+
return msgpackCall(this.backend, [["ChonkLoad", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
106
|
+
if (variantName === 'ErrorResponse') {
|
|
107
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
108
|
+
}
|
|
109
|
+
if (variantName !== 'ChonkLoadResponse') {
|
|
110
|
+
throw new BBApiException(`Expected variant name 'ChonkLoadResponse' but got '${variantName}'`);
|
|
111
|
+
}
|
|
112
|
+
return toChonkLoadResponse(result);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
chonkAccumulate(command: ChonkAccumulate): Promise<ChonkAccumulateResponse> {
|
|
117
|
+
const msgpackCommand = fromChonkAccumulate(command);
|
|
118
|
+
return msgpackCall(this.backend, [["ChonkAccumulate", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
119
|
+
if (variantName === 'ErrorResponse') {
|
|
120
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
121
|
+
}
|
|
122
|
+
if (variantName !== 'ChonkAccumulateResponse') {
|
|
123
|
+
throw new BBApiException(`Expected variant name 'ChonkAccumulateResponse' but got '${variantName}'`);
|
|
124
|
+
}
|
|
125
|
+
return toChonkAccumulateResponse(result);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
chonkProve(command: ChonkProve): Promise<ChonkProveResponse> {
|
|
130
|
+
const msgpackCommand = fromChonkProve(command);
|
|
131
|
+
return msgpackCall(this.backend, [["ChonkProve", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
132
|
+
if (variantName === 'ErrorResponse') {
|
|
133
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
134
|
+
}
|
|
135
|
+
if (variantName !== 'ChonkProveResponse') {
|
|
136
|
+
throw new BBApiException(`Expected variant name 'ChonkProveResponse' but got '${variantName}'`);
|
|
137
|
+
}
|
|
138
|
+
return toChonkProveResponse(result);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
chonkVerify(command: ChonkVerify): Promise<ChonkVerifyResponse> {
|
|
143
|
+
const msgpackCommand = fromChonkVerify(command);
|
|
144
|
+
return msgpackCall(this.backend, [["ChonkVerify", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
145
|
+
if (variantName === 'ErrorResponse') {
|
|
146
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
147
|
+
}
|
|
148
|
+
if (variantName !== 'ChonkVerifyResponse') {
|
|
149
|
+
throw new BBApiException(`Expected variant name 'ChonkVerifyResponse' but got '${variantName}'`);
|
|
150
|
+
}
|
|
151
|
+
return toChonkVerifyResponse(result);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
vkAsFields(command: VkAsFields): Promise<VkAsFieldsResponse> {
|
|
156
|
+
const msgpackCommand = fromVkAsFields(command);
|
|
157
|
+
return msgpackCall(this.backend, [["VkAsFields", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
158
|
+
if (variantName === 'ErrorResponse') {
|
|
159
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
160
|
+
}
|
|
161
|
+
if (variantName !== 'VkAsFieldsResponse') {
|
|
162
|
+
throw new BBApiException(`Expected variant name 'VkAsFieldsResponse' but got '${variantName}'`);
|
|
163
|
+
}
|
|
164
|
+
return toVkAsFieldsResponse(result);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
megaVkAsFields(command: MegaVkAsFields): Promise<MegaVkAsFieldsResponse> {
|
|
169
|
+
const msgpackCommand = fromMegaVkAsFields(command);
|
|
170
|
+
return msgpackCall(this.backend, [["MegaVkAsFields", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
171
|
+
if (variantName === 'ErrorResponse') {
|
|
172
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
173
|
+
}
|
|
174
|
+
if (variantName !== 'MegaVkAsFieldsResponse') {
|
|
175
|
+
throw new BBApiException(`Expected variant name 'MegaVkAsFieldsResponse' but got '${variantName}'`);
|
|
176
|
+
}
|
|
177
|
+
return toMegaVkAsFieldsResponse(result);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
circuitWriteSolidityVerifier(command: CircuitWriteSolidityVerifier): Promise<CircuitWriteSolidityVerifierResponse> {
|
|
182
|
+
const msgpackCommand = fromCircuitWriteSolidityVerifier(command);
|
|
183
|
+
return msgpackCall(this.backend, [["CircuitWriteSolidityVerifier", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
184
|
+
if (variantName === 'ErrorResponse') {
|
|
185
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
186
|
+
}
|
|
187
|
+
if (variantName !== 'CircuitWriteSolidityVerifierResponse') {
|
|
188
|
+
throw new BBApiException(`Expected variant name 'CircuitWriteSolidityVerifierResponse' but got '${variantName}'`);
|
|
189
|
+
}
|
|
190
|
+
return toCircuitWriteSolidityVerifierResponse(result);
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
chonkCheckPrecomputedVk(command: ChonkCheckPrecomputedVk): Promise<ChonkCheckPrecomputedVkResponse> {
|
|
195
|
+
const msgpackCommand = fromChonkCheckPrecomputedVk(command);
|
|
196
|
+
return msgpackCall(this.backend, [["ChonkCheckPrecomputedVk", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
197
|
+
if (variantName === 'ErrorResponse') {
|
|
198
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
199
|
+
}
|
|
200
|
+
if (variantName !== 'ChonkCheckPrecomputedVkResponse') {
|
|
201
|
+
throw new BBApiException(`Expected variant name 'ChonkCheckPrecomputedVkResponse' but got '${variantName}'`);
|
|
202
|
+
}
|
|
203
|
+
return toChonkCheckPrecomputedVkResponse(result);
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
chonkStats(command: ChonkStats): Promise<ChonkStatsResponse> {
|
|
208
|
+
const msgpackCommand = fromChonkStats(command);
|
|
209
|
+
return msgpackCall(this.backend, [["ChonkStats", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
210
|
+
if (variantName === 'ErrorResponse') {
|
|
211
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
212
|
+
}
|
|
213
|
+
if (variantName !== 'ChonkStatsResponse') {
|
|
214
|
+
throw new BBApiException(`Expected variant name 'ChonkStatsResponse' but got '${variantName}'`);
|
|
215
|
+
}
|
|
216
|
+
return toChonkStatsResponse(result);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
poseidon2Hash(command: Poseidon2Hash): Promise<Poseidon2HashResponse> {
|
|
221
|
+
const msgpackCommand = fromPoseidon2Hash(command);
|
|
222
|
+
return msgpackCall(this.backend, [["Poseidon2Hash", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
223
|
+
if (variantName === 'ErrorResponse') {
|
|
224
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
225
|
+
}
|
|
226
|
+
if (variantName !== 'Poseidon2HashResponse') {
|
|
227
|
+
throw new BBApiException(`Expected variant name 'Poseidon2HashResponse' but got '${variantName}'`);
|
|
228
|
+
}
|
|
229
|
+
return toPoseidon2HashResponse(result);
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
poseidon2Permutation(command: Poseidon2Permutation): Promise<Poseidon2PermutationResponse> {
|
|
234
|
+
const msgpackCommand = fromPoseidon2Permutation(command);
|
|
235
|
+
return msgpackCall(this.backend, [["Poseidon2Permutation", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
236
|
+
if (variantName === 'ErrorResponse') {
|
|
237
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
238
|
+
}
|
|
239
|
+
if (variantName !== 'Poseidon2PermutationResponse') {
|
|
240
|
+
throw new BBApiException(`Expected variant name 'Poseidon2PermutationResponse' but got '${variantName}'`);
|
|
241
|
+
}
|
|
242
|
+
return toPoseidon2PermutationResponse(result);
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
poseidon2HashAccumulate(command: Poseidon2HashAccumulate): Promise<Poseidon2HashAccumulateResponse> {
|
|
247
|
+
const msgpackCommand = fromPoseidon2HashAccumulate(command);
|
|
248
|
+
return msgpackCall(this.backend, [["Poseidon2HashAccumulate", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
249
|
+
if (variantName === 'ErrorResponse') {
|
|
250
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
251
|
+
}
|
|
252
|
+
if (variantName !== 'Poseidon2HashAccumulateResponse') {
|
|
253
|
+
throw new BBApiException(`Expected variant name 'Poseidon2HashAccumulateResponse' but got '${variantName}'`);
|
|
254
|
+
}
|
|
255
|
+
return toPoseidon2HashAccumulateResponse(result);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
pedersenCommit(command: PedersenCommit): Promise<PedersenCommitResponse> {
|
|
260
|
+
const msgpackCommand = fromPedersenCommit(command);
|
|
261
|
+
return msgpackCall(this.backend, [["PedersenCommit", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
262
|
+
if (variantName === 'ErrorResponse') {
|
|
263
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
264
|
+
}
|
|
265
|
+
if (variantName !== 'PedersenCommitResponse') {
|
|
266
|
+
throw new BBApiException(`Expected variant name 'PedersenCommitResponse' but got '${variantName}'`);
|
|
267
|
+
}
|
|
268
|
+
return toPedersenCommitResponse(result);
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
pedersenHash(command: PedersenHash): Promise<PedersenHashResponse> {
|
|
273
|
+
const msgpackCommand = fromPedersenHash(command);
|
|
274
|
+
return msgpackCall(this.backend, [["PedersenHash", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
275
|
+
if (variantName === 'ErrorResponse') {
|
|
276
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
277
|
+
}
|
|
278
|
+
if (variantName !== 'PedersenHashResponse') {
|
|
279
|
+
throw new BBApiException(`Expected variant name 'PedersenHashResponse' but got '${variantName}'`);
|
|
280
|
+
}
|
|
281
|
+
return toPedersenHashResponse(result);
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
pedersenHashBuffer(command: PedersenHashBuffer): Promise<PedersenHashBufferResponse> {
|
|
286
|
+
const msgpackCommand = fromPedersenHashBuffer(command);
|
|
287
|
+
return msgpackCall(this.backend, [["PedersenHashBuffer", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
288
|
+
if (variantName === 'ErrorResponse') {
|
|
289
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
290
|
+
}
|
|
291
|
+
if (variantName !== 'PedersenHashBufferResponse') {
|
|
292
|
+
throw new BBApiException(`Expected variant name 'PedersenHashBufferResponse' but got '${variantName}'`);
|
|
293
|
+
}
|
|
294
|
+
return toPedersenHashBufferResponse(result);
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
blake2s(command: Blake2s): Promise<Blake2sResponse> {
|
|
299
|
+
const msgpackCommand = fromBlake2s(command);
|
|
300
|
+
return msgpackCall(this.backend, [["Blake2s", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
301
|
+
if (variantName === 'ErrorResponse') {
|
|
302
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
303
|
+
}
|
|
304
|
+
if (variantName !== 'Blake2sResponse') {
|
|
305
|
+
throw new BBApiException(`Expected variant name 'Blake2sResponse' but got '${variantName}'`);
|
|
306
|
+
}
|
|
307
|
+
return toBlake2sResponse(result);
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
blake2sToField(command: Blake2sToField): Promise<Blake2sToFieldResponse> {
|
|
312
|
+
const msgpackCommand = fromBlake2sToField(command);
|
|
313
|
+
return msgpackCall(this.backend, [["Blake2sToField", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
314
|
+
if (variantName === 'ErrorResponse') {
|
|
315
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
316
|
+
}
|
|
317
|
+
if (variantName !== 'Blake2sToFieldResponse') {
|
|
318
|
+
throw new BBApiException(`Expected variant name 'Blake2sToFieldResponse' but got '${variantName}'`);
|
|
319
|
+
}
|
|
320
|
+
return toBlake2sToFieldResponse(result);
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
aesEncrypt(command: AesEncrypt): Promise<AesEncryptResponse> {
|
|
325
|
+
const msgpackCommand = fromAesEncrypt(command);
|
|
326
|
+
return msgpackCall(this.backend, [["AesEncrypt", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
327
|
+
if (variantName === 'ErrorResponse') {
|
|
328
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
329
|
+
}
|
|
330
|
+
if (variantName !== 'AesEncryptResponse') {
|
|
331
|
+
throw new BBApiException(`Expected variant name 'AesEncryptResponse' but got '${variantName}'`);
|
|
332
|
+
}
|
|
333
|
+
return toAesEncryptResponse(result);
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
aesDecrypt(command: AesDecrypt): Promise<AesDecryptResponse> {
|
|
338
|
+
const msgpackCommand = fromAesDecrypt(command);
|
|
339
|
+
return msgpackCall(this.backend, [["AesDecrypt", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
340
|
+
if (variantName === 'ErrorResponse') {
|
|
341
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
342
|
+
}
|
|
343
|
+
if (variantName !== 'AesDecryptResponse') {
|
|
344
|
+
throw new BBApiException(`Expected variant name 'AesDecryptResponse' but got '${variantName}'`);
|
|
345
|
+
}
|
|
346
|
+
return toAesDecryptResponse(result);
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
grumpkinMul(command: GrumpkinMul): Promise<GrumpkinMulResponse> {
|
|
351
|
+
const msgpackCommand = fromGrumpkinMul(command);
|
|
352
|
+
return msgpackCall(this.backend, [["GrumpkinMul", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
353
|
+
if (variantName === 'ErrorResponse') {
|
|
354
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
355
|
+
}
|
|
356
|
+
if (variantName !== 'GrumpkinMulResponse') {
|
|
357
|
+
throw new BBApiException(`Expected variant name 'GrumpkinMulResponse' but got '${variantName}'`);
|
|
358
|
+
}
|
|
359
|
+
return toGrumpkinMulResponse(result);
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
grumpkinAdd(command: GrumpkinAdd): Promise<GrumpkinAddResponse> {
|
|
364
|
+
const msgpackCommand = fromGrumpkinAdd(command);
|
|
365
|
+
return msgpackCall(this.backend, [["GrumpkinAdd", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
366
|
+
if (variantName === 'ErrorResponse') {
|
|
367
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
368
|
+
}
|
|
369
|
+
if (variantName !== 'GrumpkinAddResponse') {
|
|
370
|
+
throw new BBApiException(`Expected variant name 'GrumpkinAddResponse' but got '${variantName}'`);
|
|
371
|
+
}
|
|
372
|
+
return toGrumpkinAddResponse(result);
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
grumpkinBatchMul(command: GrumpkinBatchMul): Promise<GrumpkinBatchMulResponse> {
|
|
377
|
+
const msgpackCommand = fromGrumpkinBatchMul(command);
|
|
378
|
+
return msgpackCall(this.backend, [["GrumpkinBatchMul", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
379
|
+
if (variantName === 'ErrorResponse') {
|
|
380
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
381
|
+
}
|
|
382
|
+
if (variantName !== 'GrumpkinBatchMulResponse') {
|
|
383
|
+
throw new BBApiException(`Expected variant name 'GrumpkinBatchMulResponse' but got '${variantName}'`);
|
|
384
|
+
}
|
|
385
|
+
return toGrumpkinBatchMulResponse(result);
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
grumpkinGetRandomFr(command: GrumpkinGetRandomFr): Promise<GrumpkinGetRandomFrResponse> {
|
|
390
|
+
const msgpackCommand = fromGrumpkinGetRandomFr(command);
|
|
391
|
+
return msgpackCall(this.backend, [["GrumpkinGetRandomFr", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
392
|
+
if (variantName === 'ErrorResponse') {
|
|
393
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
394
|
+
}
|
|
395
|
+
if (variantName !== 'GrumpkinGetRandomFrResponse') {
|
|
396
|
+
throw new BBApiException(`Expected variant name 'GrumpkinGetRandomFrResponse' but got '${variantName}'`);
|
|
397
|
+
}
|
|
398
|
+
return toGrumpkinGetRandomFrResponse(result);
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
grumpkinReduce512(command: GrumpkinReduce512): Promise<GrumpkinReduce512Response> {
|
|
403
|
+
const msgpackCommand = fromGrumpkinReduce512(command);
|
|
404
|
+
return msgpackCall(this.backend, [["GrumpkinReduce512", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
405
|
+
if (variantName === 'ErrorResponse') {
|
|
406
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
407
|
+
}
|
|
408
|
+
if (variantName !== 'GrumpkinReduce512Response') {
|
|
409
|
+
throw new BBApiException(`Expected variant name 'GrumpkinReduce512Response' but got '${variantName}'`);
|
|
410
|
+
}
|
|
411
|
+
return toGrumpkinReduce512Response(result);
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
secp256k1Mul(command: Secp256k1Mul): Promise<Secp256k1MulResponse> {
|
|
416
|
+
const msgpackCommand = fromSecp256k1Mul(command);
|
|
417
|
+
return msgpackCall(this.backend, [["Secp256k1Mul", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
418
|
+
if (variantName === 'ErrorResponse') {
|
|
419
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
420
|
+
}
|
|
421
|
+
if (variantName !== 'Secp256k1MulResponse') {
|
|
422
|
+
throw new BBApiException(`Expected variant name 'Secp256k1MulResponse' but got '${variantName}'`);
|
|
423
|
+
}
|
|
424
|
+
return toSecp256k1MulResponse(result);
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
secp256k1GetRandomFr(command: Secp256k1GetRandomFr): Promise<Secp256k1GetRandomFrResponse> {
|
|
429
|
+
const msgpackCommand = fromSecp256k1GetRandomFr(command);
|
|
430
|
+
return msgpackCall(this.backend, [["Secp256k1GetRandomFr", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
431
|
+
if (variantName === 'ErrorResponse') {
|
|
432
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
433
|
+
}
|
|
434
|
+
if (variantName !== 'Secp256k1GetRandomFrResponse') {
|
|
435
|
+
throw new BBApiException(`Expected variant name 'Secp256k1GetRandomFrResponse' but got '${variantName}'`);
|
|
436
|
+
}
|
|
437
|
+
return toSecp256k1GetRandomFrResponse(result);
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
secp256k1Reduce512(command: Secp256k1Reduce512): Promise<Secp256k1Reduce512Response> {
|
|
442
|
+
const msgpackCommand = fromSecp256k1Reduce512(command);
|
|
443
|
+
return msgpackCall(this.backend, [["Secp256k1Reduce512", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
444
|
+
if (variantName === 'ErrorResponse') {
|
|
445
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
446
|
+
}
|
|
447
|
+
if (variantName !== 'Secp256k1Reduce512Response') {
|
|
448
|
+
throw new BBApiException(`Expected variant name 'Secp256k1Reduce512Response' but got '${variantName}'`);
|
|
449
|
+
}
|
|
450
|
+
return toSecp256k1Reduce512Response(result);
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
bn254FrSqrt(command: Bn254FrSqrt): Promise<Bn254FrSqrtResponse> {
|
|
455
|
+
const msgpackCommand = fromBn254FrSqrt(command);
|
|
456
|
+
return msgpackCall(this.backend, [["Bn254FrSqrt", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
457
|
+
if (variantName === 'ErrorResponse') {
|
|
458
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
459
|
+
}
|
|
460
|
+
if (variantName !== 'Bn254FrSqrtResponse') {
|
|
461
|
+
throw new BBApiException(`Expected variant name 'Bn254FrSqrtResponse' but got '${variantName}'`);
|
|
462
|
+
}
|
|
463
|
+
return toBn254FrSqrtResponse(result);
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
bn254FqSqrt(command: Bn254FqSqrt): Promise<Bn254FqSqrtResponse> {
|
|
468
|
+
const msgpackCommand = fromBn254FqSqrt(command);
|
|
469
|
+
return msgpackCall(this.backend, [["Bn254FqSqrt", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
470
|
+
if (variantName === 'ErrorResponse') {
|
|
471
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
472
|
+
}
|
|
473
|
+
if (variantName !== 'Bn254FqSqrtResponse') {
|
|
474
|
+
throw new BBApiException(`Expected variant name 'Bn254FqSqrtResponse' but got '${variantName}'`);
|
|
475
|
+
}
|
|
476
|
+
return toBn254FqSqrtResponse(result);
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
bn254G1Mul(command: Bn254G1Mul): Promise<Bn254G1MulResponse> {
|
|
481
|
+
const msgpackCommand = fromBn254G1Mul(command);
|
|
482
|
+
return msgpackCall(this.backend, [["Bn254G1Mul", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
483
|
+
if (variantName === 'ErrorResponse') {
|
|
484
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
485
|
+
}
|
|
486
|
+
if (variantName !== 'Bn254G1MulResponse') {
|
|
487
|
+
throw new BBApiException(`Expected variant name 'Bn254G1MulResponse' but got '${variantName}'`);
|
|
488
|
+
}
|
|
489
|
+
return toBn254G1MulResponse(result);
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
bn254G2Mul(command: Bn254G2Mul): Promise<Bn254G2MulResponse> {
|
|
494
|
+
const msgpackCommand = fromBn254G2Mul(command);
|
|
495
|
+
return msgpackCall(this.backend, [["Bn254G2Mul", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
496
|
+
if (variantName === 'ErrorResponse') {
|
|
497
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
498
|
+
}
|
|
499
|
+
if (variantName !== 'Bn254G2MulResponse') {
|
|
500
|
+
throw new BBApiException(`Expected variant name 'Bn254G2MulResponse' but got '${variantName}'`);
|
|
501
|
+
}
|
|
502
|
+
return toBn254G2MulResponse(result);
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
bn254G1IsOnCurve(command: Bn254G1IsOnCurve): Promise<Bn254G1IsOnCurveResponse> {
|
|
507
|
+
const msgpackCommand = fromBn254G1IsOnCurve(command);
|
|
508
|
+
return msgpackCall(this.backend, [["Bn254G1IsOnCurve", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
509
|
+
if (variantName === 'ErrorResponse') {
|
|
510
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
511
|
+
}
|
|
512
|
+
if (variantName !== 'Bn254G1IsOnCurveResponse') {
|
|
513
|
+
throw new BBApiException(`Expected variant name 'Bn254G1IsOnCurveResponse' but got '${variantName}'`);
|
|
514
|
+
}
|
|
515
|
+
return toBn254G1IsOnCurveResponse(result);
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
bn254G1FromCompressed(command: Bn254G1FromCompressed): Promise<Bn254G1FromCompressedResponse> {
|
|
520
|
+
const msgpackCommand = fromBn254G1FromCompressed(command);
|
|
521
|
+
return msgpackCall(this.backend, [["Bn254G1FromCompressed", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
522
|
+
if (variantName === 'ErrorResponse') {
|
|
523
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
524
|
+
}
|
|
525
|
+
if (variantName !== 'Bn254G1FromCompressedResponse') {
|
|
526
|
+
throw new BBApiException(`Expected variant name 'Bn254G1FromCompressedResponse' but got '${variantName}'`);
|
|
527
|
+
}
|
|
528
|
+
return toBn254G1FromCompressedResponse(result);
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
schnorrComputePublicKey(command: SchnorrComputePublicKey): Promise<SchnorrComputePublicKeyResponse> {
|
|
533
|
+
const msgpackCommand = fromSchnorrComputePublicKey(command);
|
|
534
|
+
return msgpackCall(this.backend, [["SchnorrComputePublicKey", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
535
|
+
if (variantName === 'ErrorResponse') {
|
|
536
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
537
|
+
}
|
|
538
|
+
if (variantName !== 'SchnorrComputePublicKeyResponse') {
|
|
539
|
+
throw new BBApiException(`Expected variant name 'SchnorrComputePublicKeyResponse' but got '${variantName}'`);
|
|
540
|
+
}
|
|
541
|
+
return toSchnorrComputePublicKeyResponse(result);
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
schnorrConstructSignature(command: SchnorrConstructSignature): Promise<SchnorrConstructSignatureResponse> {
|
|
546
|
+
const msgpackCommand = fromSchnorrConstructSignature(command);
|
|
547
|
+
return msgpackCall(this.backend, [["SchnorrConstructSignature", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
548
|
+
if (variantName === 'ErrorResponse') {
|
|
549
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
550
|
+
}
|
|
551
|
+
if (variantName !== 'SchnorrConstructSignatureResponse') {
|
|
552
|
+
throw new BBApiException(`Expected variant name 'SchnorrConstructSignatureResponse' but got '${variantName}'`);
|
|
553
|
+
}
|
|
554
|
+
return toSchnorrConstructSignatureResponse(result);
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
schnorrVerifySignature(command: SchnorrVerifySignature): Promise<SchnorrVerifySignatureResponse> {
|
|
559
|
+
const msgpackCommand = fromSchnorrVerifySignature(command);
|
|
560
|
+
return msgpackCall(this.backend, [["SchnorrVerifySignature", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
561
|
+
if (variantName === 'ErrorResponse') {
|
|
562
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
563
|
+
}
|
|
564
|
+
if (variantName !== 'SchnorrVerifySignatureResponse') {
|
|
565
|
+
throw new BBApiException(`Expected variant name 'SchnorrVerifySignatureResponse' but got '${variantName}'`);
|
|
566
|
+
}
|
|
567
|
+
return toSchnorrVerifySignatureResponse(result);
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
ecdsaSecp256k1ComputePublicKey(command: EcdsaSecp256k1ComputePublicKey): Promise<EcdsaSecp256k1ComputePublicKeyResponse> {
|
|
572
|
+
const msgpackCommand = fromEcdsaSecp256k1ComputePublicKey(command);
|
|
573
|
+
return msgpackCall(this.backend, [["EcdsaSecp256k1ComputePublicKey", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
574
|
+
if (variantName === 'ErrorResponse') {
|
|
575
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
576
|
+
}
|
|
577
|
+
if (variantName !== 'EcdsaSecp256k1ComputePublicKeyResponse') {
|
|
578
|
+
throw new BBApiException(`Expected variant name 'EcdsaSecp256k1ComputePublicKeyResponse' but got '${variantName}'`);
|
|
579
|
+
}
|
|
580
|
+
return toEcdsaSecp256k1ComputePublicKeyResponse(result);
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
ecdsaSecp256r1ComputePublicKey(command: EcdsaSecp256r1ComputePublicKey): Promise<EcdsaSecp256r1ComputePublicKeyResponse> {
|
|
585
|
+
const msgpackCommand = fromEcdsaSecp256r1ComputePublicKey(command);
|
|
586
|
+
return msgpackCall(this.backend, [["EcdsaSecp256r1ComputePublicKey", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
587
|
+
if (variantName === 'ErrorResponse') {
|
|
588
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
589
|
+
}
|
|
590
|
+
if (variantName !== 'EcdsaSecp256r1ComputePublicKeyResponse') {
|
|
591
|
+
throw new BBApiException(`Expected variant name 'EcdsaSecp256r1ComputePublicKeyResponse' but got '${variantName}'`);
|
|
592
|
+
}
|
|
593
|
+
return toEcdsaSecp256r1ComputePublicKeyResponse(result);
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
ecdsaSecp256k1ConstructSignature(command: EcdsaSecp256k1ConstructSignature): Promise<EcdsaSecp256k1ConstructSignatureResponse> {
|
|
598
|
+
const msgpackCommand = fromEcdsaSecp256k1ConstructSignature(command);
|
|
599
|
+
return msgpackCall(this.backend, [["EcdsaSecp256k1ConstructSignature", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
600
|
+
if (variantName === 'ErrorResponse') {
|
|
601
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
602
|
+
}
|
|
603
|
+
if (variantName !== 'EcdsaSecp256k1ConstructSignatureResponse') {
|
|
604
|
+
throw new BBApiException(`Expected variant name 'EcdsaSecp256k1ConstructSignatureResponse' but got '${variantName}'`);
|
|
605
|
+
}
|
|
606
|
+
return toEcdsaSecp256k1ConstructSignatureResponse(result);
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
ecdsaSecp256r1ConstructSignature(command: EcdsaSecp256r1ConstructSignature): Promise<EcdsaSecp256r1ConstructSignatureResponse> {
|
|
611
|
+
const msgpackCommand = fromEcdsaSecp256r1ConstructSignature(command);
|
|
612
|
+
return msgpackCall(this.backend, [["EcdsaSecp256r1ConstructSignature", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
613
|
+
if (variantName === 'ErrorResponse') {
|
|
614
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
615
|
+
}
|
|
616
|
+
if (variantName !== 'EcdsaSecp256r1ConstructSignatureResponse') {
|
|
617
|
+
throw new BBApiException(`Expected variant name 'EcdsaSecp256r1ConstructSignatureResponse' but got '${variantName}'`);
|
|
618
|
+
}
|
|
619
|
+
return toEcdsaSecp256r1ConstructSignatureResponse(result);
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
ecdsaSecp256k1RecoverPublicKey(command: EcdsaSecp256k1RecoverPublicKey): Promise<EcdsaSecp256k1RecoverPublicKeyResponse> {
|
|
624
|
+
const msgpackCommand = fromEcdsaSecp256k1RecoverPublicKey(command);
|
|
625
|
+
return msgpackCall(this.backend, [["EcdsaSecp256k1RecoverPublicKey", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
626
|
+
if (variantName === 'ErrorResponse') {
|
|
627
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
628
|
+
}
|
|
629
|
+
if (variantName !== 'EcdsaSecp256k1RecoverPublicKeyResponse') {
|
|
630
|
+
throw new BBApiException(`Expected variant name 'EcdsaSecp256k1RecoverPublicKeyResponse' but got '${variantName}'`);
|
|
631
|
+
}
|
|
632
|
+
return toEcdsaSecp256k1RecoverPublicKeyResponse(result);
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
ecdsaSecp256r1RecoverPublicKey(command: EcdsaSecp256r1RecoverPublicKey): Promise<EcdsaSecp256r1RecoverPublicKeyResponse> {
|
|
637
|
+
const msgpackCommand = fromEcdsaSecp256r1RecoverPublicKey(command);
|
|
638
|
+
return msgpackCall(this.backend, [["EcdsaSecp256r1RecoverPublicKey", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
639
|
+
if (variantName === 'ErrorResponse') {
|
|
640
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
641
|
+
}
|
|
642
|
+
if (variantName !== 'EcdsaSecp256r1RecoverPublicKeyResponse') {
|
|
643
|
+
throw new BBApiException(`Expected variant name 'EcdsaSecp256r1RecoverPublicKeyResponse' but got '${variantName}'`);
|
|
644
|
+
}
|
|
645
|
+
return toEcdsaSecp256r1RecoverPublicKeyResponse(result);
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
ecdsaSecp256k1VerifySignature(command: EcdsaSecp256k1VerifySignature): Promise<EcdsaSecp256k1VerifySignatureResponse> {
|
|
650
|
+
const msgpackCommand = fromEcdsaSecp256k1VerifySignature(command);
|
|
651
|
+
return msgpackCall(this.backend, [["EcdsaSecp256k1VerifySignature", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
652
|
+
if (variantName === 'ErrorResponse') {
|
|
653
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
654
|
+
}
|
|
655
|
+
if (variantName !== 'EcdsaSecp256k1VerifySignatureResponse') {
|
|
656
|
+
throw new BBApiException(`Expected variant name 'EcdsaSecp256k1VerifySignatureResponse' but got '${variantName}'`);
|
|
657
|
+
}
|
|
658
|
+
return toEcdsaSecp256k1VerifySignatureResponse(result);
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
ecdsaSecp256r1VerifySignature(command: EcdsaSecp256r1VerifySignature): Promise<EcdsaSecp256r1VerifySignatureResponse> {
|
|
663
|
+
const msgpackCommand = fromEcdsaSecp256r1VerifySignature(command);
|
|
664
|
+
return msgpackCall(this.backend, [["EcdsaSecp256r1VerifySignature", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
665
|
+
if (variantName === 'ErrorResponse') {
|
|
666
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
667
|
+
}
|
|
668
|
+
if (variantName !== 'EcdsaSecp256r1VerifySignatureResponse') {
|
|
669
|
+
throw new BBApiException(`Expected variant name 'EcdsaSecp256r1VerifySignatureResponse' but got '${variantName}'`);
|
|
670
|
+
}
|
|
671
|
+
return toEcdsaSecp256r1VerifySignatureResponse(result);
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
srsInitSrs(command: SrsInitSrs): Promise<SrsInitSrsResponse> {
|
|
676
|
+
const msgpackCommand = fromSrsInitSrs(command);
|
|
677
|
+
return msgpackCall(this.backend, [["SrsInitSrs", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
678
|
+
if (variantName === 'ErrorResponse') {
|
|
679
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
680
|
+
}
|
|
681
|
+
if (variantName !== 'SrsInitSrsResponse') {
|
|
682
|
+
throw new BBApiException(`Expected variant name 'SrsInitSrsResponse' but got '${variantName}'`);
|
|
683
|
+
}
|
|
684
|
+
return toSrsInitSrsResponse(result);
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
srsInitGrumpkinSrs(command: SrsInitGrumpkinSrs): Promise<SrsInitGrumpkinSrsResponse> {
|
|
689
|
+
const msgpackCommand = fromSrsInitGrumpkinSrs(command);
|
|
690
|
+
return msgpackCall(this.backend, [["SrsInitGrumpkinSrs", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
691
|
+
if (variantName === 'ErrorResponse') {
|
|
692
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
693
|
+
}
|
|
694
|
+
if (variantName !== 'SrsInitGrumpkinSrsResponse') {
|
|
695
|
+
throw new BBApiException(`Expected variant name 'SrsInitGrumpkinSrsResponse' but got '${variantName}'`);
|
|
696
|
+
}
|
|
697
|
+
return toSrsInitGrumpkinSrsResponse(result);
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
shutdown(command: Shutdown): Promise<ShutdownResponse> {
|
|
702
|
+
const msgpackCommand = fromShutdown(command);
|
|
703
|
+
return msgpackCall(this.backend, [["Shutdown", msgpackCommand]]).then(([variantName, result]: [string, any]) => {
|
|
704
|
+
if (variantName === 'ErrorResponse') {
|
|
705
|
+
throw new BBApiException(result.message || 'Unknown error from barretenberg');
|
|
706
|
+
}
|
|
707
|
+
if (variantName !== 'ShutdownResponse') {
|
|
708
|
+
throw new BBApiException(`Expected variant name 'ShutdownResponse' but got '${variantName}'`);
|
|
709
|
+
}
|
|
710
|
+
return toShutdownResponse(result);
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
destroy(): Promise<void> {
|
|
715
|
+
return this.backend.destroy ? this.backend.destroy() : Promise.resolve();
|
|
716
|
+
}
|
|
717
|
+
}
|