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 Nov 16, 2024
2 parents 568b0fc + c9ad174 commit 046cb95
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 6 deletions.
38 changes: 37 additions & 1 deletion api/rt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,23 @@ paths:
$ref: '#/components/schemas/WebhookAccountTxSubscriptions'
'default':
$ref: '#/components/responses/Error'
/webhooks/{webhook_id}/msg-opcode/subscriptions:
get:
operationId: webhookNewContractsSubscriptions
parameters:
- $ref: '#/components/parameters/tokenQuery'
- $ref: '#/components/parameters/webhookId'
- $ref: '#/components/parameters/offsetQuery'
- $ref: '#/components/parameters/limitQuery'
responses:
'200':
description: "subscriptions"
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookMsgOpcodeSubscriptions'
'default':
$ref: '#/components/responses/Error'
/webhooks/{webhook_id}/subscribe-new-contracts:
post:
description: "receive a notification when a new contract is deployed to the blockchain"
Expand Down Expand Up @@ -429,6 +446,8 @@ components:
- status_failed_attempts
- subscribed_accounts
- subscribed_to_mempool
- subscribed_to_new_contracts
- subscribed_msg_opcodes
properties:
id:
type: integer
Expand All @@ -439,8 +458,12 @@ components:
type: string
subscribed_accounts:
type: integer
subscribed_msg_opcodes:
type: integer
subscribed_to_mempool:
type: boolean
subscribed_to_new_contracts:
type: boolean
status:
type: string
enum:
Expand Down Expand Up @@ -481,7 +504,20 @@ components:
failed_attempts:
type: integer
format: int64

WebhookMsgOpcodeSubscriptions:
type: object
required:
- subscriptions
properties:
subscriptions:
type: array
items:
type: object
required:
- opcode
properties:
opcode:
type: string

responses:
Error:
Expand Down
12 changes: 8 additions & 4 deletions pkg/api/event_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,11 @@ func (h *Handler) GetAccountEvent(ctx context.Context, params oas.GetAccountEven
if err != nil {
return nil, toError(http.StatusInternalServerError, err)
}
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 Expand Up @@ -374,10 +375,11 @@ func (h *Handler) EmulateMessageToAccountEvent(ctx context.Context, request *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.toAccountEvent(ctx, account.ID, trace, result, params.AcceptLanguage, false)
if err != nil {
return nil, toError(http.StatusInternalServerError, err)
Expand Down Expand Up @@ -425,10 +427,11 @@ func (h *Handler) EmulateMessageToEvent(ctx context.Context, request *oas.Emulat
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 @@ -601,10 +604,11 @@ func (h *Handler) EmulateMessageToWallet(ctx context.Context, request *oas.Emula
return nil, toError(http.StatusInternalServerError, err)
}
t := convertTrace(trace, h.addressBook)
result, err := bath.FindActions(ctx, trace, bath.ForAccount(*walletAddress), bath.WithInformationSource(h.storage))
actions, err := bath.FindActions(ctx, trace, bath.ForAccount(*walletAddress), bath.WithInformationSource(h.storage))
if err != nil {
return nil, toError(http.StatusInternalServerError, err)
}
result := bath.EnrichWithIntentions(trace, actions)
event, err := h.toAccountEvent(ctx, *walletAddress, trace, result, params.AcceptLanguage, true)
if err != nil {
return nil, toError(http.StatusInternalServerError, err)
Expand Down
3 changes: 2 additions & 1 deletion pkg/core/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ type Contract struct {
LastTransactionLt uint64
}

type AccountStats struct {
type AccountStat struct {
TonBalance int64
AccountID ton.AccountID
NftsCount int32
JettonsCount int32
Expand Down

0 comments on commit 046cb95

Please sign in to comment.