-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #851 from crypto-com/fix/tendermint-blcokresult-at…
…tributes-decode Add event attribute decoder configuration
- Loading branch information
Showing
79 changed files
with
269 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package tendermint | ||
|
||
type BlockResultEventAttributeDecoder interface { | ||
DecodeKey(string) (string, error) | ||
DecodeValue(string) (string, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
infrastructure/tendermint/blockresulteventattrivutedecoder.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package tendermint | ||
|
||
import "encoding/base64" | ||
|
||
type RawBlockResultEventAttributeDecoder struct { | ||
} | ||
|
||
func (decoder RawBlockResultEventAttributeDecoder) DecodeKey(s string) (string, error) { | ||
return s, nil | ||
} | ||
|
||
func (decoder RawBlockResultEventAttributeDecoder) DecodeValue(s string) (string, error) { | ||
return s, nil | ||
} | ||
|
||
type Base64BlockResultEventAttributeDecoder struct { | ||
} | ||
|
||
func (decoder Base64BlockResultEventAttributeDecoder) DecodeKey(s string) (string, error) { | ||
decoded, err := base64.StdEncoding.DecodeString(s) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
return string(decoded), nil | ||
} | ||
|
||
func (decoder Base64BlockResultEventAttributeDecoder) DecodeValue(s string) (string, error) { | ||
decoded, err := base64.StdEncoding.DecodeString(s) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
return string(decoded), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.