Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion modules/abstract-utxo/src/impl/zec/zec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @prettier
*/
import { BitGoBase } from '@bitgo/sdk-core';
import { BitGoBase, MPCAlgorithm } from '@bitgo/sdk-core';
import { zcashAddress } from '@bitgo/wasm-utxo';

import { AbstractUtxoCoin } from '../../abstractUtxoCoin';
Expand All @@ -14,6 +14,16 @@ export class Zec extends AbstractUtxoCoin {
super(bitgo);
}

/**
* ZEC shielded (Orchard/Ironwood) custodial wallets use RedPallas threshold keys.
* Transparent (secp256k1 multisig) flows are unaffected: MPCAlgorithm is only
* consulted on the TSS custodial wallet-creation path.
* @inheritdoc
*/
getMPCAlgorithm(): MPCAlgorithm {
return 'redpallas';
}

static createInstance(bitgo: BitGoBase): Zec {
return new Zec(bitgo);
}
Expand Down
35 changes: 19 additions & 16 deletions modules/sdk-core/src/bitgo/wallet/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,25 @@ export class Wallets implements IWallets {
throw new Error('EVM TSS wallets are only supported for wallet version 3, 5 and 6');
}

// Transparent zcash wallets are multisig and isTSS is not set inherently.
// Shielded zcash wallets are MPC
if (params.isShielded) {
Comment thread
Ranjna-G marked this conversation as resolved.
assert(enterprise, 'enterprise is required for shielded wallet');
if (type !== 'custodial') {
throw new Error('shielded wallets can only be created as custodial wallets');
}
if (params.multisigType !== 'tss') {
throw new Error('shielded wallets must set/use multisigType tss');
}
return this.generateCustodialMpcWallet({
multisigType: 'tss',
isShielded: true,
label,
enterprise,
walletVersion: params.walletVersion,
});
}

if (isTss) {
if (!this.baseCoin.supportsTss()) {
throw new Error(`coin ${this.baseCoin.getFamily()} does not support TSS at this time`);
Expand Down Expand Up @@ -491,22 +510,6 @@ export class Wallets implements IWallets {
return walletData;
}

// Transparent zcash wallets are multisig and isTSS is not set inherently.
// Shielded zcash wallets are MPC
if (params.isShielded) {
assert(enterprise, 'enterprise is required for shielded wallet');
if (type !== 'custodial') {
throw new Error('shielded wallets can only be created as custodial wallets');
}
return this.generateCustodialMpcWallet({
multisigType: 'tss',
isShielded: true,
label,
enterprise,
walletVersion: params.walletVersion,
});
}

// Handle distributed custody
if (isDistributedCustody) {
if (!enterprise) {
Expand Down
Loading