This repository has been archived by the owner on Mar 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
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 #71 from irisnet/develop
R4R: merge master from develop branch
- Loading branch information
Showing
36 changed files
with
1,385 additions
and
1,974 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package block | ||
|
||
import ( | ||
"github.com/irisnet/rainbow-sync/conf" | ||
"github.com/kaifei-bianjie/msg-parser/codec" | ||
) | ||
|
||
var ( | ||
|
||
// Bech32ChainPrefix defines the prefix of this chain | ||
Bech32ChainPrefix = "i" | ||
|
||
// PrefixAcc is the prefix for account | ||
PrefixAcc = "a" | ||
|
||
// PrefixValidator is the prefix for validator keys | ||
PrefixValidator = "v" | ||
|
||
// PrefixConsensus is the prefix for consensus keys | ||
PrefixConsensus = "c" | ||
|
||
// PrefixPublic is the prefix for public | ||
PrefixPublic = "p" | ||
|
||
// PrefixAddress is the prefix for address | ||
PrefixAddress = "a" | ||
|
||
// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address | ||
Bech32PrefixAccAddr = conf.SvrConf.Bech32ChainPrefix + PrefixAcc + PrefixAddress | ||
// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key | ||
Bech32PrefixAccPub = conf.SvrConf.Bech32ChainPrefix + PrefixAcc + PrefixPublic | ||
// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address | ||
Bech32PrefixValAddr = conf.SvrConf.Bech32ChainPrefix + PrefixValidator + PrefixAddress | ||
// Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key | ||
Bech32PrefixValPub = conf.SvrConf.Bech32ChainPrefix + PrefixValidator + PrefixPublic | ||
// Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address | ||
Bech32PrefixConsAddr = conf.SvrConf.Bech32ChainPrefix + PrefixConsensus + PrefixAddress | ||
// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key | ||
Bech32PrefixConsPub = conf.SvrConf.Bech32ChainPrefix + PrefixConsensus + PrefixPublic | ||
) | ||
|
||
func init() { | ||
codec.SetBech32Prefix(Bech32PrefixAccAddr, Bech32PrefixAccPub, Bech32PrefixValAddr, Bech32PrefixValPub, Bech32PrefixConsAddr, Bech32PrefixConsPub) | ||
} |
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,67 @@ | ||
package block | ||
|
||
import ( | ||
"github.com/irisnet/rainbow-sync/lib/msgparser" | ||
. "github.com/kaifei-bianjie/msg-parser/modules" | ||
"github.com/kaifei-bianjie/msg-parser/types" | ||
) | ||
|
||
func HandleTxMsg(v types.SdkMsg) MsgDocInfo { | ||
if BankDocInfo, ok := msgparser.MsgClient.Bank.HandleTxMsg(v); ok { | ||
return BankDocInfo | ||
} | ||
if IServiceDocInfo, ok := msgparser.MsgClient.Service.HandleTxMsg(v); ok { | ||
return IServiceDocInfo | ||
} | ||
if NftDocInfo, ok := msgparser.MsgClient.Nft.HandleTxMsg(v); ok { | ||
return NftDocInfo | ||
} | ||
if RecordDocInfo, ok := msgparser.MsgClient.Record.HandleTxMsg(v); ok { | ||
return RecordDocInfo | ||
} | ||
if TokenDocInfo, ok := msgparser.MsgClient.Token.HandleTxMsg(v); ok { | ||
return TokenDocInfo | ||
} | ||
if CoinswapDocInfo, ok := msgparser.MsgClient.Coinswap.HandleTxMsg(v); ok { | ||
return CoinswapDocInfo | ||
} | ||
if CrisisDocInfo, ok := msgparser.MsgClient.Crisis.HandleTxMsg(v); ok { | ||
return CrisisDocInfo | ||
} | ||
if DistrubutionDocInfo, ok := msgparser.MsgClient.Distribution.HandleTxMsg(v); ok { | ||
return DistrubutionDocInfo | ||
} | ||
if SlashingDocInfo, ok := msgparser.MsgClient.Slashing.HandleTxMsg(v); ok { | ||
return SlashingDocInfo | ||
} | ||
if EvidenceDocInfo, ok := msgparser.MsgClient.Evidence.HandleTxMsg(v); ok { | ||
return EvidenceDocInfo | ||
} | ||
if HtlcDocInfo, ok := msgparser.MsgClient.Htlc.HandleTxMsg(v); ok { | ||
return HtlcDocInfo | ||
} | ||
if StakingDocInfo, ok := msgparser.MsgClient.Staking.HandleTxMsg(v); ok { | ||
return StakingDocInfo | ||
} | ||
if GovDocInfo, ok := msgparser.MsgClient.Gov.HandleTxMsg(v); ok { | ||
return GovDocInfo | ||
} | ||
if IbcDocInfo, ok := msgparser.MsgClient.Ibc.HandleTxMsg(v); ok { | ||
return IbcDocInfo | ||
} | ||
return MsgDocInfo{} | ||
} | ||
|
||
func removeDuplicatesFromSlice(data []string) (result []string) { | ||
tempSet := make(map[string]string, len(data)) | ||
for _, val := range data { | ||
if _, ok := tempSet[val]; ok || val == "" { | ||
continue | ||
} | ||
tempSet[val] = val | ||
} | ||
for one := range tempSet { | ||
result = append(result, one) | ||
} | ||
return | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.