Skip to content

Commit

Permalink
fix: add missing chain type for assets
Browse files Browse the repository at this point in the history
  • Loading branch information
roynalnaruto committed Jul 5, 2021
1 parent 497f72e commit ccc8722
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions multichain.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (asset Asset) ChainType() ChainType {
switch asset {
case BCH, BTC, DGB, DOGE, ZEC:
return ChainTypeUTXOBased
case AVAX, BNB, ETH, FIL, GLMR, LUNA, MATIC, ArbETH:
case ArbETH, AVAX, BNB, ETH, FIL, FTM, GLMR, LUNA, MATIC, SOL:
return ChainTypeAccountBased

// These assets are handled separately because they are mock assets. These
Expand Down Expand Up @@ -217,8 +217,8 @@ type Chain string
// human-readable string to this set of enumerated values. Chains must be listed
// in alphabetical order.
const (
Avalanche = Chain("Avalanche")
Arbitrum = Chain("Arbitrum")
Avalanche = Chain("Avalanche")
BinanceSmartChain = Chain("BinanceSmartChain")
Bitcoin = Chain("Bitcoin")
BitcoinCash = Chain("BitcoinCash")
Expand Down
4 changes: 4 additions & 0 deletions multichain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,19 @@ var _ = Describe("Multichain", func() {
accountChain := accountChain
Specify(fmt.Sprintf("Chain=%v, Asset=%v should be supported", accountChain.chain, accountChain.asset), func() {
Expect(accountChain.chain.IsAccountBased()).To(BeTrue())
Expect(accountChain.chain.ChainType()).To(Equal(multichain.ChainTypeAccountBased))
Expect(accountChain.chain.NativeAsset()).To(Equal(accountChain.asset))
Expect(accountChain.asset.ChainType()).To(Equal(multichain.ChainTypeAccountBased))
Expect(accountChain.asset.OriginChain()).To(Equal(accountChain.chain))
})
}
for _, utxoChain := range utxoChains {
utxoChain := utxoChain
Specify(fmt.Sprintf("Chain=%v, Asset=%v should be supported", utxoChain.chain, utxoChain.asset), func() {
Expect(utxoChain.chain.IsUTXOBased()).To(BeTrue())
Expect(utxoChain.chain.ChainType()).To(Equal(multichain.ChainTypeUTXOBased))
Expect(utxoChain.chain.NativeAsset()).To(Equal(utxoChain.asset))
Expect(utxoChain.asset.ChainType()).To(Equal(multichain.ChainTypeUTXOBased))
Expect(utxoChain.asset.OriginChain()).To(Equal(utxoChain.chain))
})
}
Expand Down

0 comments on commit ccc8722

Please sign in to comment.