Skip to content

Commit dcaa0ef

Browse files
committed
Changing these APIs to use object params:
* ProgramManager * checkFee * buildDeploymentTransaction * deploy * run * join * split * synthesizeKeys * buildTransferTransaction * buildTransferPublicTransaction * buildTransferPublicAsSignerTransaction * transfer * buildBondPublicTransaction * bondPublic * buildBondValidatorTransaction * bondValidator * buildUnbondPublicTransaction * unbondPublic * buildClaimUnbondPublicTransaction * claimUnbondPublic * buildSetValidatorStateTransaction * setValidatorState * verifyExecution * getCreditsRecord
1 parent 4c266e1 commit dcaa0ef

File tree

3 files changed

+464
-360
lines changed

3 files changed

+464
-360
lines changed

sdk/src/offline-key-provider.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ class OfflineKeyProvider implements FunctionKeyProvider {
290290
const provingKey = ProvingKey.fromBytes(provingKeyBytes);
291291
const verifyingKey = VerifyingKey.fromBytes(verifyingKeyBytes);
292292
if (verifyCreditsKeys) {
293-
const keysMatchExpected = this.verifyCreditsKeys(keyId, provingKey, verifyingKey)
293+
const keysMatchExpected = this.verifyCreditsKeys({ locator: keyId, provingKey, verifyingKey })
294294
if (!keysMatchExpected) {
295295
reject (new Error(`Cached keys do not match expected keys for ${keyId}`));
296296
}
@@ -306,9 +306,18 @@ class OfflineKeyProvider implements FunctionKeyProvider {
306306
/**
307307
* Determines if the keys for a given credits function match the expected keys.
308308
*
309+
* @param {Object} params
310+
* @param {ProvingKey} params.provingKey
311+
* @param {VerifyingKey} params.verifyingKey
309312
* @returns {boolean} Whether the keys match the expected keys
310313
*/
311-
verifyCreditsKeys(locator: string, provingKey: ProvingKey, verifyingKey: VerifyingKey): boolean {
314+
verifyCreditsKeys(params: {
315+
locator: string,
316+
provingKey: ProvingKey,
317+
verifyingKey: VerifyingKey,
318+
}): boolean {
319+
const { locator, provingKey, verifyingKey } = params;
320+
312321
switch (locator) {
313322
case CREDITS_PROGRAM_KEYS.bond_public.locator:
314323
return provingKey.isBondPublicProver() && verifyingKey.isBondPublicVerifier();

0 commit comments

Comments
 (0)