refactor(curve): stateless contracts as state attribute instead of static.
This commit is contained in:
@@ -14,14 +14,18 @@ def encode_json_to_query_params(params: list[dict[str, Any]]):
|
||||
contracts: str = param.get("contracts", [])
|
||||
tx_hash: str = param["tx_hash"]
|
||||
tokens: list[str] = param["tokens"]
|
||||
static_attributes: dict[str, str] = param.get("static_attributes", {})
|
||||
static_attributes["name"] = param["name"]
|
||||
static_attributes["factory_name"] = "NA"
|
||||
static_attributes["factory"] = EMPTY
|
||||
attributes: dict[str, str] = param.get("attributes", {})
|
||||
attributes["name"] = param["name"]
|
||||
attributes["factory_name"] = "NA"
|
||||
attributes["factory"] = EMPTY
|
||||
|
||||
encoded_address = f"address={address}"
|
||||
encoded_contracts = "&" + "&".join(
|
||||
[f"contracts[]={contract}" for contract in contracts]) if contracts else ''
|
||||
encoded_contracts = (
|
||||
"&" + "&".join([f"contracts[]={contract}" for contract in contracts])
|
||||
if contracts
|
||||
else ""
|
||||
)
|
||||
encoded_tx_hash = f"tx_hash={tx_hash}"
|
||||
encoded_tokens = "&".join([f"tokens[]={token}" for token in tokens])
|
||||
encoded_attributes = "&".join(
|
||||
@@ -30,8 +34,14 @@ def encode_json_to_query_params(params: list[dict[str, Any]]):
|
||||
for key, value in attributes.items()
|
||||
]
|
||||
)
|
||||
encoded_static_attributes = "&".join(
|
||||
[
|
||||
f"static_attribute_keys[]={key}&static_attribute_vals[]={value}"
|
||||
for key, value in static_attributes.items()
|
||||
]
|
||||
)
|
||||
|
||||
encoded_param = f"{encoded_address}{encoded_contracts}&{encoded_tx_hash}&{encoded_tokens}&{encoded_attributes}"
|
||||
encoded_param = f"{encoded_address}{encoded_contracts}&{encoded_tx_hash}&{encoded_tokens}&{encoded_attributes}&{encoded_static_attributes}"
|
||||
encoded_param = encoded_param.rstrip("&")
|
||||
encoded_params.append(encoded_param)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user