@@ -112,7 +112,7 @@ const (
112
112
LUNA = Asset ("LUNA" ) // Luna
113
113
ZEC = Asset ("ZEC" ) // Zcash
114
114
115
- // These assets are define separately because they are mock assets. These
115
+ // These assets are defined separately because they are mock assets. These
116
116
// assets should only be used for testing.
117
117
118
118
AMOCK1 = Asset ("AMOCK1" ) // Account-based mock asset
@@ -149,7 +149,7 @@ func (asset Asset) OriginChain() Chain {
149
149
case ZEC :
150
150
return Zcash
151
151
152
- // These assets are define separately because they are mock assets. These
152
+ // These assets are handled separately because they are mock assets. These
153
153
// assets should only be used for testing.
154
154
155
155
case AMOCK1 :
@@ -172,8 +172,9 @@ func (asset Asset) ChainType() ChainType {
172
172
case BNB , ETH , FIL , LUNA :
173
173
return ChainTypeAccountBased
174
174
175
- // These assets are define separately because they are mock assets. These
175
+ // These assets are handled separately because they are mock assets. These
176
176
// assets should only be used for testing.
177
+
177
178
case AMOCK1 , AMOCK2 :
178
179
return ChainTypeAccountBased
179
180
case UMOCK :
@@ -221,7 +222,7 @@ const (
221
222
Terra = Chain ("Terra" )
222
223
Zcash = Chain ("Zcash" )
223
224
224
- // These chains are define separately because they are mock chains. These
225
+ // These chains are defined separately because they are mock chains. These
225
226
// chains should only be used for testing.
226
227
227
228
AccountMocker1 = Chain ("AccountMocker1" )
@@ -256,8 +257,9 @@ func (chain Chain) ChainType() ChainType {
256
257
case BinanceSmartChain , Ethereum , Filecoin , Terra :
257
258
return ChainTypeAccountBased
258
259
259
- // These chains are define separately because they are mock chains. These
260
+ // These chains are handled separately because they are mock chains. These
260
261
// chains should only be used for testing.
262
+
261
263
case AccountMocker1 , AccountMocker2 :
262
264
return ChainTypeAccountBased
263
265
case UTXOMocker :
@@ -280,6 +282,44 @@ func (chain Chain) IsUTXOBased() bool {
280
282
return chain .ChainType () == ChainTypeUTXOBased
281
283
}
282
284
285
+ // NativeAsset returns the underlying native asset for a chain. For example, the
286
+ // root asset of Bitcoin chain is BTC.
287
+ func (chain Chain ) NativeAsset () Asset {
288
+ switch chain {
289
+ case BinanceSmartChain :
290
+ return BNB
291
+ case BitcoinCash :
292
+ return BCH
293
+ case Bitcoin :
294
+ return BTC
295
+ case DigiByte :
296
+ return DGB
297
+ case Dogecoin :
298
+ return DOGE
299
+ case Ethereum :
300
+ return ETH
301
+ case Filecoin :
302
+ return FIL
303
+ case Terra :
304
+ return LUNA
305
+ case Zcash :
306
+ return ZEC
307
+
308
+ // These chains are handled separately because they are mock chains. These
309
+ // chains should only be used for testing.
310
+
311
+ case AccountMocker1 :
312
+ return AMOCK1
313
+ case AccountMocker2 :
314
+ return AMOCK2
315
+ case UTXOMocker :
316
+ return UMOCK
317
+
318
+ default :
319
+ return Asset ("" )
320
+ }
321
+ }
322
+
283
323
// ChainType represents the type of chain (whether account-based or utxo-based)
284
324
type ChainType string
285
325
0 commit comments