Skip to content

Commit e6aa095

Browse files
authored
return cached output for Tron, add chain type to chain family mapping helper (#2176)
1 parent b86bd40 commit e6aa095

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

framework/.changeset/v0.10.31.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Return cached output for Tron
2+
- Add chain type to chain family mapping helper

framework/components/blockchain/blockchain.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,24 @@ func NewBlockchainNetwork(in *Input) (*Output, error) {
125125
in.Out = out
126126
return out, nil
127127
}
128+
129+
type ChainFamily string
130+
131+
func TypeToFamily(t string) (ChainFamily, error) {
132+
switch t {
133+
case TypeAnvil, TypeGeth, TypeBesu, TypeAnvilZKSync:
134+
return ChainFamily(FamilyEVM), nil
135+
case TypeSolana:
136+
return ChainFamily(FamilySolana), nil
137+
case TypeAptos:
138+
return ChainFamily(FamilyAptos), nil
139+
case TypeSui:
140+
return ChainFamily(FamilySui), nil
141+
case TypeTron:
142+
return ChainFamily(FamilyTron), nil
143+
case TypeTon:
144+
return ChainFamily(FamilyTon), nil
145+
default:
146+
return "", fmt.Errorf("blockchain type is not supported or empty: %s", t)
147+
}
148+
}

framework/components/blockchain/tron.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ func defaultTron(in *Input) {
5656
}
5757

5858
func newTron(in *Input) (*Output, error) {
59+
if in.Out != nil && in.Out.UseCache {
60+
return in.Out, nil
61+
}
5962
defaultTron(in)
6063
ctx := context.Background()
6164

0 commit comments

Comments
 (0)