fix: Pass additional data when community token is received (#4954)

This commit is contained in:
Cuteivist 2024-03-25 18:30:59 +01:00 committed by GitHub
parent 0d9b6138d6
commit 2aa306ef4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 18 deletions

View File

@ -63,15 +63,10 @@ type Token struct {
}
type ReceivedToken struct {
Address common.Address `json:"address"`
Name string `json:"name"`
Symbol string `json:"symbol"`
Image string `json:"image,omitempty"`
ChainID uint64 `json:"chainId"`
CommunityData *community.Data `json:"community_data,omitempty"`
Amount float64 `json:"amount"`
TxHash common.Hash `json:"txHash"`
IsFirst bool `json:"isFirst"`
Token
Amount float64 `json:"amount"`
TxHash common.Hash `json:"txHash"`
IsFirst bool `json:"isFirst"`
}
func (t *Token) IsNative() bool {
@ -829,17 +824,13 @@ func (tm *Manager) SignalCommunityTokenReceived(address common.Address, txHash c
}
floatAmount, _ := new(big.Float).Quo(new(big.Float).SetInt(value), new(big.Float).SetInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(int64(t.Decimals)), nil))).Float64()
t.Image = tm.mediaServer.MakeCommunityTokenImagesURL(t.CommunityData.ID, t.ChainID, t.Symbol)
receivedToken := ReceivedToken{
Address: t.Address,
Name: t.Name,
Symbol: t.Symbol,
Image: t.Image,
ChainID: t.ChainID,
CommunityData: t.CommunityData,
Amount: floatAmount,
TxHash: txHash,
IsFirst: isFirst,
Token: *t,
Amount: floatAmount,
TxHash: txHash,
IsFirst: isFirst,
}
encodedMessage, err := json.Marshal(receivedToken)