Skip to content

Commit

Permalink
change the account source to a non-required field
Browse files Browse the repository at this point in the history
  • Loading branch information
zakhar-petukhov committed Dec 17, 2024
1 parent 33089a0 commit 8e084eb
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 29 deletions.
3 changes: 1 addition & 2 deletions api/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1551,8 +1551,7 @@
"code",
"code_hash",
"methods",
"compiler",
"source"
"compiler"
],
"type": "object"
},
Expand Down
23 changes: 11 additions & 12 deletions api/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7410,7 +7410,6 @@ components:
- code_hash
- methods
- compiler
- source
properties:
code:
type: string
Expand Down Expand Up @@ -7480,17 +7479,17 @@ components:
format: int64
example: 1668436763
ExtraCurrency:
type: object
required:
- amount
- preview
properties:
amount:
type: string
x-js-format: bigint
example: "1000000000"
preview:
$ref: '#/components/schemas/EcPreview'
type: object
required:
- amount
- preview
properties:
amount:
type: string
x-js-format: bigint
example: "1000000000"
preview:
$ref: '#/components/schemas/EcPreview'
SourceFile:
type: object
required:
Expand Down
15 changes: 9 additions & 6 deletions pkg/api/account_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,10 +488,7 @@ func (h *Handler) BlockchainAccountInspect(ctx context.Context, params oas.Block
if err != nil {
return nil, toError(http.StatusInternalServerError, err)
}
source, err := h.verifierSource.GetAccountSource(account.ID)
if err != nil {
return nil, toError(http.StatusInternalServerError, err)
}
source, _ := h.verifierSource.GetAccountSource(account.ID)
sourceFiles := make([]oas.SourceFile, len(source.Files))
for idx, file := range source.Files {
sourceFiles[idx] = oas.SourceFile{
Expand All @@ -502,11 +499,17 @@ func (h *Handler) BlockchainAccountInspect(ctx context.Context, params oas.Block
IncludeInCommand: file.IncludeInCommand,
}
}
compiler := oas.BlockchainAccountInspectCompilerFunc
if source.Compiler != "" {
compiler = oas.BlockchainAccountInspectCompiler(source.Compiler)
}
resp := oas.BlockchainAccountInspect{
Code: hex.EncodeToString(rawAccount.Code),
CodeHash: hex.EncodeToString(codeHash),
Compiler: oas.BlockchainAccountInspectCompiler(source.Compiler),
Source: oas.Source{Files: sourceFiles},
Compiler: compiler,
}
if len(sourceFiles) > 0 {
resp.Source = oas.NewOptSource(oas.Source{Files: sourceFiles})
}
for _, methodID := range methods {
if method, ok := code.Methods[methodID]; ok {
Expand Down
43 changes: 39 additions & 4 deletions pkg/oas/oas_json_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 49 additions & 3 deletions pkg/oas/oas_schemas_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions pkg/oas/oas_validators_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8e084eb

Please sign in to comment.