Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-tron committed Sep 24, 2024
2 parents 8716e19 + df65491 commit 18f5faf
Show file tree
Hide file tree
Showing 16 changed files with 741 additions and 39 deletions.
14 changes: 14 additions & 0 deletions api/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -6214,6 +6214,7 @@
"schema": {
"example": 1668436763,
"format": "int64",
"maximum": 2114380800,
"type": "integer"
}
},
Expand All @@ -6224,6 +6225,7 @@
"schema": {
"example": 1668436763,
"format": "int64",
"maximum": 2114380800,
"type": "integer"
}
}
Expand Down Expand Up @@ -6373,6 +6375,7 @@
"schema": {
"example": 1668436763,
"format": "int64",
"maximum": 2114380800,
"type": "integer"
}
},
Expand All @@ -6383,6 +6386,7 @@
"schema": {
"example": 1668436763,
"format": "int64",
"maximum": 2114380800,
"type": "integer"
}
}
Expand Down Expand Up @@ -6572,6 +6576,7 @@
"schema": {
"example": 1668436763,
"format": "int64",
"maximum": 2114380800,
"type": "integer"
}
},
Expand All @@ -6582,6 +6587,7 @@
"schema": {
"example": 1668436763,
"format": "int64",
"maximum": 2114380800,
"type": "integer"
}
}
Expand Down Expand Up @@ -6688,6 +6694,7 @@
"schema": {
"example": 1668436763,
"format": "int64",
"maximum": 2114380800,
"type": "integer"
}
},
Expand All @@ -6698,6 +6705,7 @@
"schema": {
"example": 1668436763,
"format": "int64",
"maximum": 2114380800,
"type": "integer"
}
}
Expand Down Expand Up @@ -6840,6 +6848,7 @@
"schema": {
"example": 1668436763,
"format": "int64",
"maximum": 2114380800,
"type": "integer"
}
},
Expand All @@ -6850,6 +6859,7 @@
"schema": {
"example": 1668436763,
"format": "int64",
"maximum": 2114380800,
"type": "integer"
}
}
Expand Down Expand Up @@ -9648,6 +9658,7 @@
"schema": {
"example": 1668436763,
"format": "int64",
"maximum": 2114380800,
"type": "integer"
}
},
Expand All @@ -9658,6 +9669,7 @@
"schema": {
"example": 1668436763,
"format": "int64",
"maximum": 2114380800,
"type": "integer"
}
}
Expand Down Expand Up @@ -9814,6 +9826,7 @@
"schema": {
"example": 1668436763,
"format": "int64",
"maximum": 2114380800,
"type": "integer"
}
},
Expand All @@ -9824,6 +9837,7 @@
"schema": {
"example": 1668436763,
"format": "int64",
"maximum": 2114380800,
"type": "integer"
}
},
Expand Down
14 changes: 14 additions & 0 deletions api/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -641,13 +641,15 @@ paths:
schema:
type: integer
format: int64
maximum: 2114380800
example: 1668436763
- name: end_date
in: query
required: false
schema:
type: integer
format: int64
maximum: 2114380800
example: 1668436763
responses:
'200':
Expand Down Expand Up @@ -691,13 +693,15 @@ paths:
schema:
type: integer
format: int64
maximum: 2114380800
example: 1668436763
- name: end_date
in: query
required: false
schema:
type: integer
format: int64
maximum: 2114380800
example: 1668436763
responses:
'200':
Expand Down Expand Up @@ -768,13 +772,15 @@ paths:
schema:
type: integer
format: int64
maximum: 2114380800
example: 1668436763
- name: end_date
in: query
required: false
schema:
type: integer
format: int64
maximum: 2114380800
example: 1668436763
responses:
'200':
Expand Down Expand Up @@ -825,13 +831,15 @@ paths:
schema:
type: integer
format: int64
maximum: 2114380800
example: 1668436763
- name: end_date
in: query
required: false
schema:
type: integer
format: int64
maximum: 2114380800
example: 1668436763
responses:
'200':
Expand Down Expand Up @@ -1028,13 +1036,15 @@ paths:
schema:
type: integer
format: int64
maximum: 2114380800
example: 1668436763
- name: end_date
in: query
required: true
schema:
type: integer
format: int64
maximum: 2114380800
example: 1668436763
responses:
'200':
Expand Down Expand Up @@ -1257,13 +1267,15 @@ paths:
schema:
type: integer
format: int64
maximum: 2114380800
example: 1668436763
- name: end_date
in: query
required: false
schema:
type: integer
format: int64
maximum: 2114380800
example: 1668436763
responses:
'200':
Expand Down Expand Up @@ -1787,13 +1799,15 @@ paths:
schema:
type: integer
format: int64
maximum: 2114380800
example: 1668436763
- name: end_date
in: query
required: false
schema:
type: integer
format: int64
maximum: 2114380800
example: 1668436763
- name: points_count
in: query
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/emulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func emulatedTreeToTrace(
transaction, err := core.ConvertTransaction(int32(a.AddrStd.WorkchainId), tongo.Transaction{
Transaction: tree.TX,
BlockID: tongo.BlockIDExt{BlockID: tongo.BlockID{Workchain: int32(a.AddrStd.WorkchainId)}},
})
}, nil)
filteredMsgs := make([]core.Message, 0, len(transaction.OutMsgs))
for _, msg := range transaction.OutMsgs {
if msg.Destination == nil {
Expand Down
9 changes: 6 additions & 3 deletions pkg/api/event_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,11 @@ func (h *Handler) GetEvent(ctx context.Context, params oas.GetEventParams) (*oas
if err != nil {
return nil, toError(http.StatusInternalServerError, err)
}
result, err := bath.FindActions(ctx, trace, bath.WithInformationSource(h.storage))
actions, err := bath.FindActions(ctx, trace, bath.WithInformationSource(h.storage))
if err != nil {
return nil, toError(http.StatusInternalServerError, err)
}
result := bath.EnrichWithIntentions(trace, actions)
event, err := h.toEvent(ctx, trace, result, params.AcceptLanguage)
if err != nil {
return nil, toError(http.StatusInternalServerError, err)
Expand Down Expand Up @@ -234,12 +235,13 @@ func (h *Handler) GetAccountEvents(ctx context.Context, params oas.GetAccountEve
skippedInProgress = append(skippedInProgress, traceID.Hash)
continue
}
result, err := bath.FindActions(ctx, trace, bath.ForAccount(account.ID), bath.WithInformationSource(h.storage))
actions, err := bath.FindActions(ctx, trace, bath.ForAccount(account.ID), bath.WithInformationSource(h.storage))
if err != nil {
events = append(events, h.toUnknownAccountEvent(account.ID, traceID))
continue
//return nil, toError(http.StatusInternalServerError, err)
}
result := bath.EnrichWithIntentions(trace, actions)
e, err := h.toAccountEvent(ctx, account.ID, trace, result, params.AcceptLanguage, params.SubjectOnly.Value)
if err != nil {
events = append(events, h.toUnknownAccountEvent(account.ID, traceID))
Expand All @@ -262,10 +264,11 @@ func (h *Handler) GetAccountEvents(ctx context.Context, params oas.GetAccountEve
continue
}
i++
result, err := bath.FindActions(ctx, trace, bath.ForAccount(account.ID), bath.WithInformationSource(h.storage))
actions, err := bath.FindActions(ctx, trace, bath.ForAccount(account.ID), bath.WithInformationSource(h.storage))
if err != nil {
return nil, toError(http.StatusInternalServerError, err)
}
result := bath.EnrichWithIntentions(trace, actions)
event, err := h.toAccountEvent(ctx, account.ID, trace, result, params.AcceptLanguage, params.SubjectOnly.Value)
if err != nil {
return nil, toError(http.StatusInternalServerError, err)
Expand Down
1 change: 1 addition & 0 deletions pkg/bath/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ type (
InscriptionTransfer *InscriptionTransferAction `json:",omitempty"`
Success bool
Type ActionType
Error *string `json:",omitempty"`
BaseTransactions []ton.Bits256
}
TonTransferAction struct {
Expand Down
18 changes: 18 additions & 0 deletions pkg/bath/bath_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ func TestFindActions(t *testing.T) {
tongo.MustParseBlockID("(0,8000000000000000,34021598)"),
// nft transfer
tongo.MustParseBlockID("(0,8000000000000000,33600829)"),
// failed dedust swap
tongo.MustParseBlockID("(0,7000000000000000,45592983)"),
}),
)

Expand Down Expand Up @@ -394,6 +396,21 @@ func TestFindActions(t *testing.T) {
hash: "e27cdf1d6987a3e74dc8d9c4a52a5b22112fe3946d0dceadf8160b74f80b9d46",
filenamePrefix: "governance_jetton_mint",
},
{
name: "failed simple transfer",
hash: "63d358331c0154ade48ab92b4634c3fff004f42ce7201a37973938862d232c0f",
filenamePrefix: "failed-simple-transfer",
},
{
name: "simple transfers, one of two failed",
hash: "ac0b8bf04949cb72759832ec6c123b3677b8ca140899ac859aa66a558e4f4c11",
filenamePrefix: "simple-transfers-one-failed",
},
{
name: "failed dedust swap",
hash: "887c7763f41ca4a4b9de28900ab514caabc0c27ed5b41d9918d60f5e7f4a9d96",
filenamePrefix: "failed-dedust-swap",
},
} {
t.Run(c.name, func(t *testing.T) {
trace, err := storage.GetTrace(context.Background(), tongo.MustParseHash(c.hash))
Expand All @@ -411,6 +428,7 @@ func TestFindActions(t *testing.T) {
WithStraws(straws),
WithInformationSource(source))
require.Nil(t, err)
actionsList = EnrichWithIntentions(trace, actionsList)
results := result{
Actions: actionsList.Actions,
}
Expand Down
Loading

0 comments on commit 18f5faf

Please sign in to comment.