File tree Expand file tree Collapse file tree 15 files changed +62
-31
lines changed
Expand file tree Collapse file tree 15 files changed +62
-31
lines changed Original file line number Diff line number Diff line change @@ -40,10 +40,15 @@ export class EthLikeToken extends AbstractEthLikeNewCoins {
4040 return ( bitgo : BitGoBase ) => new this ( bitgo , config , coinNames ) ;
4141 }
4242
43- static createTokenConstructors ( coinNames : CoinNames ) : NamedCoinConstructor [ ] {
43+ static createTokenConstructors (
44+ coinNames : CoinNames ,
45+ tokenConfigs : EthLikeTokenConfig [ ] = [
46+ ...tokens . bitcoin [ coinNames . Mainnet ] . tokens ,
47+ ...tokens . testnet [ coinNames . Mainnet ] . tokens ,
48+ ]
49+ ) : NamedCoinConstructor [ ] {
4450 const tokensCtors : NamedCoinConstructor [ ] = [ ] ;
45- const chain = coinNames . Mainnet ;
46- for ( const token of [ ...tokens . bitcoin [ chain ] . tokens , ...tokens . testnet [ chain ] . tokens ] ) {
51+ for ( const token of tokenConfigs ) {
4752 const tokenConstructor = this . createTokenConstructor ( token , coinNames ) ;
4853 tokensCtors . push ( { name : token . type , coinConstructor : tokenConstructor } ) ;
4954 tokensCtors . push ( { name : token . tokenContractAddress , coinConstructor : tokenConstructor } ) ;
Original file line number Diff line number Diff line change @@ -25,9 +25,11 @@ export class AdaToken extends Ada {
2525 return ( bitgo : BitGoBase ) => new AdaToken ( bitgo , config ) ;
2626 }
2727
28- static createTokenConstructors ( ) : NamedCoinConstructor [ ] {
28+ static createTokenConstructors (
29+ tokenConfigs : AdaTokenConfig [ ] = [ ...tokens . bitcoin . ada . tokens , ...tokens . testnet . ada . tokens ]
30+ ) : NamedCoinConstructor [ ] {
2931 const tokensCtors : NamedCoinConstructor [ ] = [ ] ;
30- for ( const token of [ ... tokens . bitcoin . ada . tokens , ... tokens . testnet . ada . tokens ] ) {
32+ for ( const token of tokenConfigs ) {
3133 const tokenConstructor = AdaToken . createTokenConstructor ( token ) ;
3234 tokensCtors . push ( { name : token . type , coinConstructor : tokenConstructor } ) ;
3335 }
Original file line number Diff line number Diff line change @@ -33,9 +33,9 @@ export class AlgoToken extends Algo {
3333 return ( bitgo : BitGoBase ) => new AlgoToken ( bitgo , config ) ;
3434 }
3535
36- static createTokenConstructors ( ) : NamedCoinConstructor [ ] {
36+ static createTokenConstructors ( tokenConfigs : AlgoTokenConfig [ ] = formattedAlgoTokens ) : NamedCoinConstructor [ ] {
3737 const tokensCtors : NamedCoinConstructor [ ] = [ ] ;
38- formattedAlgoTokens . forEach ( ( config ) => {
38+ tokenConfigs . forEach ( ( config ) => {
3939 tokensCtors . push ( { name : config . type , coinConstructor : AlgoToken . createTokenConstructor ( config ) } ) ;
4040 if ( config . alias ) {
4141 tokensCtors . push ( { name : config . alias , coinConstructor : AlgoToken . createTokenConstructor ( config ) } ) ;
Original file line number Diff line number Diff line change @@ -15,9 +15,11 @@ export class AptToken extends Apt {
1515 static createTokenConstructor ( config : AptTokenConfig ) : CoinConstructor {
1616 return ( bitgo : BitGoBase ) => new AptToken ( bitgo , config ) ;
1717 }
18- static createTokenConstructors ( ) : NamedCoinConstructor [ ] {
18+ static createTokenConstructors (
19+ tokenConfigs : AptTokenConfig [ ] = [ ...tokens . bitcoin . apt . tokens , ...tokens . testnet . apt . tokens ]
20+ ) : NamedCoinConstructor [ ] {
1921 const tokensCtors : NamedCoinConstructor [ ] = [ ] ;
20- for ( const token of [ ... tokens . bitcoin . apt . tokens , ... tokens . testnet . apt . tokens ] ) {
22+ for ( const token of tokenConfigs ) {
2123 const tokenConstructor = AptToken . createTokenConstructor ( token ) ;
2224 tokensCtors . push ( { name : token . type , coinConstructor : tokenConstructor } ) ;
2325 }
Original file line number Diff line number Diff line change @@ -21,9 +21,11 @@ export class AvaxCToken extends AvaxC {
2121 return ( bitgo : BitGoBase ) => new AvaxCToken ( bitgo , config ) ;
2222 }
2323
24- static createTokenConstructors ( ) : NamedCoinConstructor [ ] {
24+ static createTokenConstructors (
25+ tokenConfigs : AvaxcTokenConfig [ ] = [ ...tokens . bitcoin . avaxc . tokens , ...tokens . testnet . avaxc . tokens ]
26+ ) : NamedCoinConstructor [ ] {
2527 const tokensCtors : NamedCoinConstructor [ ] = [ ] ;
26- for ( const token of [ ... tokens . bitcoin . avaxc . tokens , ... tokens . testnet . avaxc . tokens ] ) {
28+ for ( const token of tokenConfigs ) {
2729 const tokenConstructor = AvaxCToken . createTokenConstructor ( token ) ;
2830 tokensCtors . push ( { name : token . type , coinConstructor : tokenConstructor } ) ;
2931 tokensCtors . push ( { name : token . tokenContractAddress , coinConstructor : tokenConstructor } ) ;
Original file line number Diff line number Diff line change @@ -20,9 +20,11 @@ export class CeloToken extends Celo {
2020 return ( bitgo : BitGoBase ) => new CeloToken ( bitgo , config ) ;
2121 }
2222
23- static createTokenConstructors ( ) : NamedCoinConstructor [ ] {
23+ static createTokenConstructors (
24+ tokenConfigs : CeloTokenConfig [ ] = [ ...tokens . bitcoin . celo . tokens , ...tokens . testnet . celo . tokens ]
25+ ) : NamedCoinConstructor [ ] {
2426 const tokensCtors : NamedCoinConstructor [ ] = [ ] ;
25- for ( const token of [ ... tokens . bitcoin . celo . tokens , ... tokens . testnet . celo . tokens ] ) {
27+ for ( const token of tokenConfigs ) {
2628 const tokenConstructor = CeloToken . createTokenConstructor ( token ) ;
2729 tokensCtors . push ( { name : token . type , coinConstructor : tokenConstructor } ) ;
2830 tokensCtors . push ( { name : token . tokenContractAddress , coinConstructor : tokenConstructor } ) ;
Original file line number Diff line number Diff line change @@ -19,9 +19,11 @@ export class EosToken extends Eos {
1919 return ( bitgo : BitGoBase ) => new EosToken ( bitgo , config ) ;
2020 }
2121
22- static createTokenConstructors ( ) : NamedCoinConstructor [ ] {
22+ static createTokenConstructors (
23+ tokenConfigs : EosTokenConfig [ ] = [ ...tokens . bitcoin . eos . tokens , ...tokens . testnet . eos . tokens ]
24+ ) : NamedCoinConstructor [ ] {
2325 const tokensCtors : NamedCoinConstructor [ ] = [ ] ;
24- for ( const token of [ ... tokens . bitcoin . eos . tokens , ... tokens . testnet . eos . tokens ] ) {
26+ for ( const token of tokenConfigs ) {
2527 const tokenConstructor = EosToken . createTokenConstructor ( token ) ;
2628 tokensCtors . push ( { name : token . type , coinConstructor : tokenConstructor } ) ;
2729 }
Original file line number Diff line number Diff line change @@ -41,9 +41,11 @@ export class Erc20Token extends Eth {
4141 return ( bitgo : BitGoBase ) => new Erc20Token ( bitgo , config ) ;
4242 }
4343
44- static createTokenConstructors ( ) : NamedCoinConstructor [ ] {
44+ static createTokenConstructors (
45+ tokenConfigs : Erc20TokenConfig [ ] = [ ...tokens . bitcoin . eth . tokens , ...tokens . testnet . eth . tokens ]
46+ ) : NamedCoinConstructor [ ] {
4547 const tokensCtors : NamedCoinConstructor [ ] = [ ] ;
46- for ( const token of [ ... tokens . bitcoin . eth . tokens , ... tokens . testnet . eth . tokens ] ) {
48+ for ( const token of tokenConfigs ) {
4749 const tokenConstructor = Erc20Token . createTokenConstructor ( token ) ;
4850 tokensCtors . push ( { name : token . type , coinConstructor : tokenConstructor } ) ;
4951 tokensCtors . push ( { name : token . tokenContractAddress , coinConstructor : tokenConstructor } ) ;
Original file line number Diff line number Diff line change @@ -15,9 +15,11 @@ export class HbarToken extends Hbar {
1515 return ( bitgo : BitGoBase ) => new HbarToken ( bitgo , config ) ;
1616 }
1717
18- static createTokenConstructors ( ) : NamedCoinConstructor [ ] {
18+ static createTokenConstructors (
19+ tokenConfigs : HbarTokenConfig [ ] = [ ...tokens . bitcoin . hbar . tokens , ...tokens . testnet . hbar . tokens ]
20+ ) : NamedCoinConstructor [ ] {
1921 const tokensCtors : NamedCoinConstructor [ ] = [ ] ;
20- for ( const token of [ ... tokens . bitcoin . hbar . tokens , ... tokens . testnet . hbar . tokens ] ) {
22+ for ( const token of tokenConfigs ) {
2123 const tokenConstructor = HbarToken . createTokenConstructor ( token ) ;
2224 tokensCtors . push ( { name : token . type , coinConstructor : tokenConstructor } ) ;
2325 }
Original file line number Diff line number Diff line change @@ -24,9 +24,11 @@ export class SolToken extends Sol {
2424 return ( bitgo : BitGoBase ) => new SolToken ( bitgo , config ) ;
2525 }
2626
27- static createTokenConstructors ( ) : NamedCoinConstructor [ ] {
27+ static createTokenConstructors (
28+ tokenConfigs : SolTokenConfig [ ] = [ ...tokens . bitcoin . sol . tokens , ...tokens . testnet . sol . tokens ]
29+ ) : NamedCoinConstructor [ ] {
2830 const tokensCtors : NamedCoinConstructor [ ] = [ ] ;
29- for ( const token of [ ... tokens . bitcoin . sol . tokens , ... tokens . testnet . sol . tokens ] ) {
31+ for ( const token of tokenConfigs ) {
3032 const tokenConstructor = SolToken . createTokenConstructor ( token ) ;
3133 tokensCtors . push ( { name : token . type , coinConstructor : tokenConstructor } ) ;
3234 }
You can’t perform that action at this time.
0 commit comments