| 2360 | } |
| 2361 | |
| 2362 | int execute_contract_api(lua_State *L, const char *contract_name, |
| 2363 | const char *api_name, const char *arg1, std::string *result_json_string) |
| 2364 | { |
| 2365 | auto contract_address = malloc_managed_string(L, CONTRACT_ID_MAX_LENGTH + 1); |
| 2366 | memset(contract_address, 0x0, CONTRACT_ID_MAX_LENGTH + 1); |
| 2367 | size_t address_size = 0; |
| 2368 | thinkyoung::lua::api::global_glua_chain_api->get_contract_address_by_name(L, contract_name, contract_address, &address_size); |
| 2369 | if (address_size > 0) |
| 2370 | { |
| 2371 | GluaStateValue value; |
| 2372 | value.string_value = contract_address; |
| 2373 | set_lua_state_value(L, STARTING_CONTRACT_ADDRESS, value, LUA_STATE_VALUE_STRING); |
| 2374 | } |
| 2375 | return lua_execute_contract_api(L, contract_name, api_name, arg1, result_json_string); |
| 2376 | } |
| 2377 | |
| 2378 | LUA_API int execute_contract_api_by_address(lua_State *L, const char *contract_address, |
| 2379 | const char *api_name, const char *arg1, std::string *result_json_string) |
no test coverage detected