diff --git a/api/openapi.json b/api/openapi.json index 8bd64cc6..684c7828 100644 --- a/api/openapi.json +++ b/api/openapi.json @@ -3133,17 +3133,12 @@ "example": "https://cache.tonapi.io/images/extra.jpg", "type": "string" }, - "name": { - "example": "FMS", - "type": "string" - }, "symbol": { "example": "FMS", "type": "string" } }, "required": [ - "name", "symbol", "decimals", "image" @@ -3315,9 +3310,6 @@ "recipient": { "$ref": "#/components/schemas/AccountAddress" }, - "refund": { - "$ref": "#/components/schemas/Refund" - }, "sender": { "$ref": "#/components/schemas/AccountAddress" } diff --git a/api/openapi.yml b/api/openapi.yml index b78bd48a..ca858fd9 100644 --- a/api/openapi.yml +++ b/api/openapi.yml @@ -5848,14 +5848,10 @@ components: EcPreview: type: object required: - - name - symbol - decimals - image properties: - name: - type: string - example: FMS symbol: type: string example: FMS @@ -5887,8 +5883,6 @@ components: example: "Hi! This is your salary. \nFrom accounting with love." encrypted_comment: $ref: '#/components/schemas/EncryptedComment' - refund: - $ref: '#/components/schemas/Refund' currency: $ref: '#/components/schemas/EcPreview' SmartContractAction: diff --git a/pkg/api/event_converters.go b/pkg/api/event_converters.go index 7f3dc857..2db1ac19 100644 --- a/pkg/api/event_converters.go +++ b/pkg/api/event_converters.go @@ -162,18 +162,11 @@ func (h *Handler) convertActionExtraCurrencyTransfer(t *bath.ExtraCurrencyTransf Sender: convertAccountAddress(t.Sender, h.addressBook), EncryptedComment: convertEncryptedComment(t.EncryptedComment), Currency: oas.EcPreview{ - Name: meta.Name, Symbol: meta.Symbol, Decimals: meta.Decimals, Image: meta.Image, }, }) - if t.Refund != nil { - action.Value.Refund.SetTo(oas.Refund{ - Type: oas.RefundType(t.Refund.Type), - Origin: t.Refund.Origin, - }) - } simplePreview := oas.ActionSimplePreview{ Name: "Extra Currency Transfer", Description: "", // TODO: add description diff --git a/pkg/bath/actions.go b/pkg/bath/actions.go index 68d53890..771d8881 100644 --- a/pkg/bath/actions.go +++ b/pkg/bath/actions.go @@ -110,7 +110,6 @@ type ( EncryptedComment *EncryptedComment Recipient tongo.AccountID Sender tongo.AccountID - Refund *Refund } SmartContractAction struct { TonAttached int64 @@ -274,7 +273,7 @@ func (a Action) ContributeToExtra(account tongo.AccountID) int64 { return 0 } switch a.Type { - case NftItemTransfer, ContractDeploy, UnSubscription, JettonMint, JettonBurn, WithdrawStakeRequest, DomainRenew, InscriptionMint, InscriptionTransfer: // actions without extra + case NftItemTransfer, ContractDeploy, UnSubscription, JettonMint, JettonBurn, WithdrawStakeRequest, DomainRenew, InscriptionMint, InscriptionTransfer, ExtraCurrencyTransfer: // actions without extra return 0 case TonTransfer: return detectDirection(account, a.TonTransfer.Sender, a.TonTransfer.Recipient, a.TonTransfer.Amount) @@ -351,6 +350,10 @@ func (a *TonTransferAction) SubjectAccounts() []tongo.AccountID { return []tongo.AccountID{a.Sender, a.Recipient} } +func (a *ExtraCurrencyTransferAction) SubjectAccounts() []tongo.AccountID { + return []tongo.AccountID{a.Sender, a.Recipient} +} + func (a *SmartContractAction) SubjectAccounts() []tongo.AccountID { return []tongo.AccountID{a.Contract, a.Executor} } diff --git a/pkg/oas/oas_json_gen.go b/pkg/oas/oas_json_gen.go index 97071c2a..afe93451 100644 --- a/pkg/oas/oas_json_gen.go +++ b/pkg/oas/oas_json_gen.go @@ -14455,10 +14455,6 @@ func (s *EcPreview) Encode(e *jx.Encoder) { // encodeFields encodes fields. func (s *EcPreview) encodeFields(e *jx.Encoder) { - { - e.FieldStart("name") - e.Str(s.Name) - } { e.FieldStart("symbol") e.Str(s.Symbol) @@ -14473,11 +14469,10 @@ func (s *EcPreview) encodeFields(e *jx.Encoder) { } } -var jsonFieldsNameOfEcPreview = [4]string{ - 0: "name", - 1: "symbol", - 2: "decimals", - 3: "image", +var jsonFieldsNameOfEcPreview = [3]string{ + 0: "symbol", + 1: "decimals", + 2: "image", } // Decode decodes EcPreview from json. @@ -14489,20 +14484,8 @@ func (s *EcPreview) Decode(d *jx.Decoder) error { if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { switch string(k) { - case "name": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.Name = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"name\"") - } case "symbol": - requiredBitSet[0] |= 1 << 1 + requiredBitSet[0] |= 1 << 0 if err := func() error { v, err := d.Str() s.Symbol = string(v) @@ -14514,7 +14497,7 @@ func (s *EcPreview) Decode(d *jx.Decoder) error { return errors.Wrap(err, "decode field \"symbol\"") } case "decimals": - requiredBitSet[0] |= 1 << 2 + requiredBitSet[0] |= 1 << 1 if err := func() error { v, err := d.Int() s.Decimals = int(v) @@ -14526,7 +14509,7 @@ func (s *EcPreview) Decode(d *jx.Decoder) error { return errors.Wrap(err, "decode field \"decimals\"") } case "image": - requiredBitSet[0] |= 1 << 3 + requiredBitSet[0] |= 1 << 2 if err := func() error { v, err := d.Str() s.Image = string(v) @@ -14547,7 +14530,7 @@ func (s *EcPreview) Decode(d *jx.Decoder) error { // Validate required fields. var failures []validate.FieldError for i, mask := range [1]uint8{ - 0b00001111, + 0b00000111, } { if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { // Mask only required fields and check equality to mask using XOR. @@ -15964,26 +15947,19 @@ func (s *ExtraCurrencyTransferAction) encodeFields(e *jx.Encoder) { s.EncryptedComment.Encode(e) } } - { - if s.Refund.Set { - e.FieldStart("refund") - s.Refund.Encode(e) - } - } { e.FieldStart("currency") s.Currency.Encode(e) } } -var jsonFieldsNameOfExtraCurrencyTransferAction = [7]string{ +var jsonFieldsNameOfExtraCurrencyTransferAction = [6]string{ 0: "sender", 1: "recipient", 2: "amount", 3: "comment", 4: "encrypted_comment", - 5: "refund", - 6: "currency", + 5: "currency", } // Decode decodes ExtraCurrencyTransferAction from json. @@ -16047,18 +16023,8 @@ func (s *ExtraCurrencyTransferAction) Decode(d *jx.Decoder) error { }(); err != nil { return errors.Wrap(err, "decode field \"encrypted_comment\"") } - case "refund": - if err := func() error { - s.Refund.Reset() - if err := s.Refund.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"refund\"") - } case "currency": - requiredBitSet[0] |= 1 << 6 + requiredBitSet[0] |= 1 << 5 if err := func() error { if err := s.Currency.Decode(d); err != nil { return err @@ -16077,7 +16043,7 @@ func (s *ExtraCurrencyTransferAction) Decode(d *jx.Decoder) error { // Validate required fields. var failures []validate.FieldError for i, mask := range [1]uint8{ - 0b01000111, + 0b00100111, } { if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { // Mask only required fields and check equality to mask using XOR. diff --git a/pkg/oas/oas_schemas_gen.go b/pkg/oas/oas_schemas_gen.go index 5b7e2c69..588e9844 100644 --- a/pkg/oas/oas_schemas_gen.go +++ b/pkg/oas/oas_schemas_gen.go @@ -5124,17 +5124,11 @@ func (s *DomainRenewAction) SetRenewer(val AccountAddress) { // Ref: #/components/schemas/EcPreview type EcPreview struct { - Name string `json:"name"` Symbol string `json:"symbol"` Decimals int `json:"decimals"` Image string `json:"image"` } -// GetName returns the value of Name. -func (s *EcPreview) GetName() string { - return s.Name -} - // GetSymbol returns the value of Symbol. func (s *EcPreview) GetSymbol() string { return s.Symbol @@ -5150,11 +5144,6 @@ func (s *EcPreview) GetImage() string { return s.Image } -// SetName sets the value of Name. -func (s *EcPreview) SetName(val string) { - s.Name = val -} - // SetSymbol sets the value of Symbol. func (s *EcPreview) SetSymbol(val string) { s.Symbol = val @@ -5531,7 +5520,6 @@ type ExtraCurrencyTransferAction struct { Amount string `json:"amount"` Comment OptString `json:"comment"` EncryptedComment OptEncryptedComment `json:"encrypted_comment"` - Refund OptRefund `json:"refund"` Currency EcPreview `json:"currency"` } @@ -5560,11 +5548,6 @@ func (s *ExtraCurrencyTransferAction) GetEncryptedComment() OptEncryptedComment return s.EncryptedComment } -// GetRefund returns the value of Refund. -func (s *ExtraCurrencyTransferAction) GetRefund() OptRefund { - return s.Refund -} - // GetCurrency returns the value of Currency. func (s *ExtraCurrencyTransferAction) GetCurrency() EcPreview { return s.Currency @@ -5595,11 +5578,6 @@ func (s *ExtraCurrencyTransferAction) SetEncryptedComment(val OptEncryptedCommen s.EncryptedComment = val } -// SetRefund sets the value of Refund. -func (s *ExtraCurrencyTransferAction) SetRefund(val OptRefund) { - s.Refund = val -} - // SetCurrency sets the value of Currency. func (s *ExtraCurrencyTransferAction) SetCurrency(val EcPreview) { s.Currency = val diff --git a/pkg/oas/oas_validators_gen.go b/pkg/oas/oas_validators_gen.go index 0e5f49f4..0ad09224 100644 --- a/pkg/oas/oas_validators_gen.go +++ b/pkg/oas/oas_validators_gen.go @@ -261,24 +261,6 @@ func (s *Action) Validate() error { Error: err, }) } - if err := func() error { - if value, ok := s.ExtraCurrencyTransfer.Get(); ok { - if err := func() error { - if err := value.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return err - } - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "ExtraCurrencyTransfer", - Error: err, - }) - } if err := func() error { if value, ok := s.ContractDeploy.Get(); ok { if err := func() error { @@ -2381,36 +2363,6 @@ func (s *Event) Validate() error { return nil } -func (s *ExtraCurrencyTransferAction) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if value, ok := s.Refund.Get(); ok { - if err := func() error { - if err := value.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return err - } - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "refund", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - func (s *FoundAccounts) Validate() error { if s == nil { return validate.ErrNilPointer