Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  fix: track channel tip tx (#1231)
  • Loading branch information
trkhoi committed Nov 15, 2023
2 parents b9cab86 + b22e21e commit 5b85de2
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 28 deletions.
1 change: 1 addition & 0 deletions pkg/entities/offchain_tip_bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ func (e *Entity) TransferTokenV2(req request.TransferV2Request) (*response.Trans
"channel_id": req.ChannelId,
"channel_name": req.ChannelName,
"channel_url": req.ChannelUrl,
"channel_avatar": req.ChannelAvatar,
"template": template,
}

Expand Down
35 changes: 21 additions & 14 deletions pkg/entities/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,22 +343,29 @@ func (e *Entity) TransferVaultToken(req *request.TransferVaultTokenRequest) erro
if req.Address != "" {
destination = req.Address
}
// get discord guild for tracking
guild, err := e.svc.Discord.GetGuild(req.GuildId)
if err != nil {
e.log.Fields(logger.Fields{"req": req}).Errorf(err, "[entity.TransferVaultToken] - e.svc.Discord.GetGuild failed")
return err
}

_, err = e.svc.MochiPay.TransferVaultMochiPay(request.MochiPayVaultRequest{
ProfileId: treasurerRequest.RequesterProfileId,
Amount: amountBigIntStr,
To: destination,
PrivateKey: privateKey,
Token: token.Symbol,
Chain: token.Chain.ChainId,
Name: vault.Name,
VaultId: vault.Id,
Reciever: treasurerRequest.UserProfileId,
Message: treasurerRequest.Message,
ListNotify: listNotify,
RequestId: treasurerRequest.Id,
Platform: req.Platform,
MesssageUrl: treasurerRequest.MessageUrl,
ProfileId: treasurerRequest.RequesterProfileId,
Amount: amountBigIntStr,
To: destination,
PrivateKey: privateKey,
Token: token.Symbol,
Chain: token.Chain.ChainId,
Name: vault.Name,
VaultId: vault.Id,
Reciever: treasurerRequest.UserProfileId,
Message: treasurerRequest.Message,
ListNotify: listNotify,
RequestId: treasurerRequest.Id,
Platform: req.Platform,
ServerName: guild.Name,
ServerAvatar: guild.Icon,
})
if err != nil {
e.log.Fields(logger.Fields{"req": req}).Errorf(err, "[entity.TransferVaultToken] - e.svc.MochiPay.TransferVaultMochiPay failed")
Expand Down
1 change: 1 addition & 0 deletions pkg/request/offchain_tip_bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ type TransferV2Request struct {
ChannelId string `json:"channel_id"`
ChannelName string `json:"channel_name"`
ChannelUrl string `json:"channel_url"`
ChannelAvatar string `json:"channel_avatar"`
}
29 changes: 15 additions & 14 deletions pkg/request/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,21 @@ type CreateTreasurerSubmission struct {
}

type MochiPayVaultRequest struct {
ProfileId string `json:"profile_id"`
PrivateKey string `json:"private_key"`
To string `json:"to"`
Amount string `json:"amount"`
Token string `json:"token"`
Chain string `json:"chain"`
Name string `json:"name"`
VaultId int64 `json:"vault_id"`
Reciever string `json:"receiver"`
Message string `json:"message"`
ListNotify []string `json:"list_notify"`
RequestId int64 `json:"request_id"`
Platform string `json:"platform"`
MesssageUrl string `json:"message_url"`
ProfileId string `json:"profile_id"`
PrivateKey string `json:"private_key"`
To string `json:"to"`
Amount string `json:"amount"`
Token string `json:"token"`
Chain string `json:"chain"`
Name string `json:"name"`
VaultId int64 `json:"vault_id"`
Reciever string `json:"receiver"`
Message string `json:"message"`
ListNotify []string `json:"list_notify"`
RequestId int64 `json:"request_id"`
Platform string `json:"platform"`
ServerName string `json:"server_name"`
ServerAvatar string `json:"server_avatar"`
}

type GetVaultsRequest struct {
Expand Down

0 comments on commit 5b85de2

Please sign in to comment.