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
8 changes: 8 additions & 0 deletions modules/statics/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4816,6 +4816,7 @@ export interface BaseCoinConstructorOptions {
asset: UnderlyingAsset;
network: BaseNetwork;
primaryKeyCurve: KeyCurve;
otherSupportedKeyCurves?: KeyCurve[];
}

export abstract class BaseCoin {
Expand Down Expand Up @@ -4862,6 +4863,12 @@ export abstract class BaseCoin {
*/
public readonly primaryKeyCurve: KeyCurve;

/**
* Additional elliptic curves this coin supports besides its primary key curve,
* e.g. for shielded pools requiring a different curve than the coin's base transactions.
*/
public readonly otherSupportedKeyCurves?: KeyCurve[];

/**
* Set of features which are required by a coin subclass
* @return {Set<CoinFeature>}
Expand Down Expand Up @@ -4945,6 +4952,7 @@ export abstract class BaseCoin {
this.asset = options.asset;
this.network = options.network;
this.primaryKeyCurve = options.primaryKeyCurve;
this.otherSupportedKeyCurves = options.otherSupportedKeyCurves;
}

/**
Expand Down
18 changes: 15 additions & 3 deletions modules/statics/src/utxo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface UtxoConstructorOptions {
prefix?: string;
suffix?: string;
primaryKeyCurve: KeyCurve;
otherSupportedKeyCurves?: KeyCurve[];
}

export class UtxoCoin extends BaseCoin {
Expand Down Expand Up @@ -65,6 +66,7 @@ export class UtxoCoin extends BaseCoin {
* @param prefix? Optional coin prefix. Defaults to empty string
* @param suffix? Optional coin suffix. Defaults to coin name.
* @param primaryKeyCurve The elliptic curve for this chain/token
* @param otherSupportedKeyCurves? Additional elliptic curves this coin supports, e.g. for shielded pools
*/
export function utxo(
id: string,
Expand All @@ -77,7 +79,8 @@ export function utxo(
prefix = '',
suffix: string = name.toUpperCase(),
/** All UTXOs BitGo supports are SECP256K1 **/
primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1
primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1,
otherSupportedKeyCurves?: KeyCurve[]
) {
return Object.freeze(
new UtxoCoin({
Expand All @@ -90,6 +93,7 @@ export function utxo(
features,
asset,
primaryKeyCurve,
otherSupportedKeyCurves,
baseUnit,
})
);
Expand Down Expand Up @@ -310,7 +314,11 @@ export const utxoCoins: Readonly<BaseCoin>[] = [
Networks.main.zCash,
UnderlyingAsset.ZEC,
BaseUnit.ZEC,
ZEC_FEATURES
ZEC_FEATURES,
'',
Comment thread
veetragjain marked this conversation as resolved.
'ZEC',
KeyCurve.Secp256k1,
[KeyCurve.Pallas]
),
utxo(
'549a4499-387c-42d3-9048-c01d6724d98a',
Expand All @@ -319,7 +327,11 @@ export const utxoCoins: Readonly<BaseCoin>[] = [
Networks.test.zCash,
UnderlyingAsset.ZEC,
BaseUnit.ZEC,
ZEC_FEATURES
ZEC_FEATURES,
'',
'TZEC',
KeyCurve.Secp256k1,
[KeyCurve.Pallas]
),
utxo(
'4518a5b9-00d3-476e-bc40-d3f87eb82250',
Expand Down