66 "strconv"
77
88 "github.com/dave/jennifer/jen"
9- "github.com/dipdup-net/go-lib/tzkt/api "
9+ "github.com/dipdup-net/go-lib/tzkt/data "
1010 "github.com/iancoleman/strcase"
1111 "github.com/pkg/errors"
1212)
@@ -20,9 +20,9 @@ var reservedNames = map[string]string{
2020
2121// Type -
2222type Type interface {
23- AsField (name , path string , schema api .JSONSchema , isRequired bool , result * ContractTypeResult ) (jen.Code , error )
24- AsCode (name , path string , schema api .JSONSchema , result * ContractTypeResult ) (Code , error )
25- AsType (name , path string , schema api .JSONSchema , result * ContractTypeResult ) (Code , error )
23+ AsField (name , path string , schema data .JSONSchema , isRequired bool , result * ContractTypeResult ) (jen.Code , error )
24+ AsCode (name , path string , schema data .JSONSchema , result * ContractTypeResult ) (Code , error )
25+ AsType (name , path string , schema data .JSONSchema , result * ContractTypeResult ) (Code , error )
2626}
2727
2828// Code -
@@ -32,7 +32,7 @@ type Code struct {
3232}
3333
3434// Generate -
35- func Generate (name string , schema api .JSONSchema , result * ContractTypeResult ) (string , error ) {
35+ func Generate (name string , schema data .JSONSchema , result * ContractTypeResult ) (string , error ) {
3636 typ , err := selectType (schema )
3737 if err != nil {
3838 return "" , err
@@ -90,7 +90,7 @@ type BigMapData struct {
9090}
9191
9292// GenerateContractTypes -
93- func GenerateContractTypes (schema api .ContractJSONSchema , packageName string ) (ContractTypeResult , error ) {
93+ func GenerateContractTypes (schema data .ContractJSONSchema , packageName string ) (ContractTypeResult , error ) {
9494 result := ContractTypeResult {
9595 File : jen .NewFile (packageName ),
9696 Entrypoints : make (map [string ]EntrypointData ),
@@ -110,7 +110,7 @@ func GenerateContractTypes(schema api.ContractJSONSchema, packageName string) (C
110110 return result , nil
111111}
112112
113- func generateForContract (schema api .ContractJSONSchema , result * ContractTypeResult ) error {
113+ func generateForContract (schema data .ContractJSONSchema , result * ContractTypeResult ) error {
114114 for _ , entrypoint := range schema .Entrypoints {
115115 entrypointType , err := Generate (entrypoint .Name , entrypoint .Parameter , result )
116116 if err != nil {
@@ -140,7 +140,7 @@ func generateForContract(schema api.ContractJSONSchema, result *ContractTypeResu
140140 return nil
141141}
142142
143- func selectType (schema api .JSONSchema ) (Type , error ) {
143+ func selectType (schema data .JSONSchema ) (Type , error ) {
144144 switch schema .Type {
145145 case "object" :
146146 switch schema .Comment {
0 commit comments