Skip to content

Commit

Permalink
refactor: Gas, GasPrice now in utils.BigInt instead of uint64. update…
Browse files Browse the repository at this point in the history
…dict.py changed to do this too. edit.py no longer used, dropping.
  • Loading branch information
randomshinichi committed May 27, 2019
1 parent b6f1054 commit bd5e5a6
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 156 deletions.
116 changes: 0 additions & 116 deletions api/edit.py

This file was deleted.

63 changes: 29 additions & 34 deletions api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -4612,8 +4612,7 @@
"$ref": "#/definitions/EncodedHash"
},
"gas_price": {
"type": "integer",
"format": "uint64"
"$ref": "#/definitions/GasPrice"
},
"gas_used": {
"type": "integer",
Expand Down Expand Up @@ -5195,16 +5194,10 @@
"$ref": "#/definitions/Amount"
},
"gas": {
"type": "integer",
"description": "Contract gas",
"minimum": 0,
"format": "uint64"
"$ref": "#/definitions/Gas"
},
"gas_price": {
"type": "integer",
"description": "Gas price",
"minimum": 0,
"format": "uint64"
"$ref": "#/definitions/GasPrice"
},
"fee": {
"$ref": "#/definitions/Fee"
Expand Down Expand Up @@ -5285,16 +5278,10 @@
"$ref": "#/definitions/Amount"
},
"gas": {
"type": "integer",
"description": "Contract gas",
"minimum": 0,
"format": "uint64"
"$ref": "#/definitions/Gas"
},
"gas_price": {
"type": "integer",
"description": "Gas price",
"minimum": 0,
"format": "uint64"
"$ref": "#/definitions/GasPrice"
},
"fee": {
"$ref": "#/definitions/Fee"
Expand Down Expand Up @@ -5382,16 +5369,10 @@
"$ref": "#/definitions/Amount"
},
"gas": {
"type": "integer",
"description": "Contract gas",
"minimum": 0,
"format": "uint64"
"$ref": "#/definitions/Gas"
},
"gas_price": {
"type": "integer",
"description": "Gas price",
"minimum": 0,
"format": "uint64"
"$ref": "#/definitions/GasPrice"
},
"call_data": {
"description": "Contract call data",
Expand Down Expand Up @@ -5462,16 +5443,10 @@
"$ref": "#/definitions/Amount"
},
"gas": {
"type": "integer",
"description": "Contract gas",
"minimum": 0,
"format": "uint64"
"$ref": "#/definitions/Gas"
},
"gas_price": {
"type": "integer",
"description": "Gas price",
"minimum": 0,
"format": "uint64"
"$ref": "#/definitions/GasPrice"
},
"function": {
"type": "string",
Expand Down Expand Up @@ -5951,6 +5926,26 @@
},
"type": "BigInt"
}
},
"Gas": {
"type": "integer",
"minimum": 0,
"x-go-type": {
"import": {
"package": "github.com/aeternity/aepp-sdk-go/utils"
},
"type": "BigInt"
}
},
"GasPrice": {
"type": "integer",
"minimum": 0,
"x-go-type": {
"import": {
"package": "github.com/aeternity/aepp-sdk-go/utils"
},
"type": "BigInt"
}
}
},
"externalDocs": {
Expand Down
18 changes: 12 additions & 6 deletions api/updatedict.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,29 @@ def add_definitions(data):
data["definitions"]["Balance"] = bigint
data["definitions"]["Fee"] = bigint
data["definitions"]["NameSalt"] = bigint
data["definitions"]["Gas"] = bigint
data["definitions"]["GasPrice"] = bigint
return data

def add_references_to_definitions(data):
swaggerD = DottedDict(data)
for l in json_objects:
l_last_key = l.split('.')[-1]
swaggerD_old = swaggerD[l]
if 'fee' in l:
if 'fee' == l_last_key:
swaggerD[l] = {"$ref": "#/definitions/Fee"}
elif "balance" in l:
elif "balance" == l_last_key:
swaggerD[l] = {"$ref": "#/definitions/Balance"}
elif "amount" in l:
elif "amount" == l_last_key:
swaggerD[l] = {"$ref": "#/definitions/Amount"}
elif "channel_reserve" in l:
elif "channel_reserve" == l_last_key:
swaggerD[l] = {"$ref": "#/definitions/Amount"}
elif "name_salt" in l:
elif "name_salt" == l_last_key:
swaggerD[l] = {"$ref": "#/definitions/NameSalt"}

elif "gas" == l_last_key:
swaggerD[l] = {"$ref": "#/definitions/Gas"}
elif "gas_price" == l_last_key:
swaggerD[l] = {"$ref": "#/definitions/GasPrice"}
# I want to see what was changed.
if swaggerD[l] != swaggerD_old:
print(l, swaggerD[l])
Expand Down

0 comments on commit bd5e5a6

Please sign in to comment.