File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -903,7 +903,14 @@ export function getCoinConstructor(coinName: string): CoinConstructor | undefine
903903 }
904904}
905905
906+ const ethLikeChainToTestnetMap : Record < string , string > = { } ;
906907export function getTokenConstructor ( tokenConfig : TokenConfig ) : CoinConstructor | undefined {
908+ if ( tokenConfig . coin in ethLikeChainToTestnetMap ) {
909+ return EthLikeErc20Token . createTokenConstructor ( tokenConfig as EthLikeTokenConfig , {
910+ Mainnet : tokenConfig . coin ,
911+ Testnet : ethLikeChainToTestnetMap [ tokenConfig . coin ] ,
912+ } ) ;
913+ }
907914 switch ( tokenConfig . coin ) {
908915 case 'eth' :
909916 case 'hteth' :
Original file line number Diff line number Diff line change @@ -805,6 +805,25 @@ const getFormattedXdcTokens = (customCoinMap = coins) =>
805805 return acc ;
806806 } , [ ] ) ;
807807
808+ function getEthLikeTokenConfig ( coin : EthLikeERC20Token ) : EthLikeTokenConfig {
809+ return {
810+ type : coin . name ,
811+ coin : coin . network . type === NetworkType . MAINNET ? coin . name : 't' . concat ( coin . name ) ,
812+ network : coin . network . type === NetworkType . MAINNET ? 'Mainnet' : 'Testnet' ,
813+ name : coin . fullName ,
814+ tokenContractAddress : coin . contractAddress . toString ( ) . toLowerCase ( ) ,
815+ decimalPlaces : coin . decimalPlaces ,
816+ } ;
817+ }
818+
819+ export const getFormattedEthLikeTokenConfig = ( customCoinMap = coins ) =>
820+ customCoinMap . reduce ( ( acc : EthLikeTokenConfig [ ] , coin ) => {
821+ if ( coin instanceof EthLikeERC20Token ) {
822+ acc . push ( getEthLikeTokenConfig ( coin ) ) ;
823+ }
824+ return acc ;
825+ } , [ ] ) ;
826+
808827function getFlowTokenConfig ( coin : EthLikeERC20Token ) : EthLikeTokenConfig {
809828 return {
810829 type : coin . name ,
You can’t perform that action at this time.
0 commit comments