Skip to content

Commit

Permalink
rename createnode => node
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Aug 10, 2019
1 parent c03ce4d commit e3938c6
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 36 deletions.
36 changes: 18 additions & 18 deletions include/xy/xy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class [[eosio::contract("xy")]] xy : public contract {
{}

/**
* ACTION `createnode`
* ACTION `node`
*
* Create node (longitude & latitude) with tags
*
Expand All @@ -86,15 +86,15 @@ class [[eosio::contract("xy")]] xy : public contract {
* @returns {uint64_t} node id
* @example
*
* cleos push action xy createnode '["myaccount", [45.0, 110.5], [{"k": "key", "v": "value"}]]'
* cleos push action xy node '["myaccount", [45.0, 110.5], [{"k": "key", "v": "value"}]]'
*/
[[eosio::action]]
uint64_t createnode( const name owner,
const point node,
const vector<tag> tags );
uint64_t node( const name owner,
const point node,
const vector<tag> tags );

/**
* ACTION `createway`
* ACTION `way`
*
* Create way with tags
*
Expand All @@ -104,15 +104,15 @@ class [[eosio::contract("xy")]] xy : public contract {
* @returns {uint64_t} way id
* @example
*
* cleos push action xy createway '["myaccount", [[45.0, 110.5], [25.0, 130.5]], [{"k": "key", "v": "value"}]]'
* cleos push action xy way '["myaccount", [[45.0, 110.5], [25.0, 130.5]], [{"k": "key", "v": "value"}]]'
*/
[[eosio::action]]
uint64_t createway( const name owner,
const vector<point> way,
const vector<tag> tags );
uint64_t way( const name owner,
const vector<point> way,
const vector<tag> tags );

/**
* ACTION `createrel`
* ACTION `relation`
*
* Create relation with tags
*
Expand All @@ -122,12 +122,12 @@ class [[eosio::contract("xy")]] xy : public contract {
* @returns {uint64_t} member id
* @example
*
* cleos push action xy createway '["myaccount", [{"type": "way", "ref": 1, "role": "outer"}], [{"k": "key", "v": "value"}]]'
* cleos push action xy relation '["myaccount", [{"type": "way", "ref": 1, "role": "outer"}], [{"k": "key", "v": "value"}]]'
*/
[[eosio::action]]
uint64_t createrel( const name owner,
const vector<member> members,
const vector<tag> tags );
uint64_t relation( const name owner,
const vector<member> members,
const vector<tag> tags );

/**
* ACTION `erase`
Expand Down Expand Up @@ -202,9 +202,9 @@ class [[eosio::contract("xy")]] xy : public contract {
const asset& quantity,
const string& memo );

using createnode_action = eosio::action_wrapper<"createnode"_n, &xy::createnode>;
using createway_action = eosio::action_wrapper<"createway"_n, &xy::createway>;
using createrel_action = eosio::action_wrapper<"createrel"_n, &xy::createrel>;
using node_action = eosio::action_wrapper<"node"_n, &xy::node>;
using way_action = eosio::action_wrapper<"way"_n, &xy::way>;
using relation_action = eosio::action_wrapper<"relation"_n, &xy::relation>;
using erase_action = eosio::action_wrapper<"erase"_n, &xy::erase>;
using modify_action = eosio::action_wrapper<"modify"_n, &xy::modify>;
using move_action = eosio::action_wrapper<"move"_n, &xy::move>;
Expand Down
6 changes: 3 additions & 3 deletions resource/xy.contracts.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<h1 class="contract">createnode</h1>
<h1 class="contract">node</h1>

## Description

Create new node with tags

<h1 class="contract">createway</h1>
<h1 class="contract">way</h1>

## Description

Create new way with tags

<h1 class="contract">createrel</h1>
<h1 class="contract">relation</h1>

## Description

Expand Down
8 changes: 4 additions & 4 deletions src/node.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* ACTION createnode
* ACTION node
*/
uint64_t xy::createnode( const name owner,
const point node,
const vector<tag> tags )
uint64_t xy::node( const name owner,
const point node,
const vector<tag> tags )
{
require_auth( owner );
uint64_t id = emplace_node( owner, node, tags );
Expand Down
8 changes: 4 additions & 4 deletions src/relation.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* ACTION createrel
* ACTION relation
*/
uint64_t xy::createrel( const name owner,
const vector<member> members,
const vector<tag> tags )
uint64_t xy::relation( const name owner,
const vector<member> members,
const vector<tag> tags )
{
require_auth( owner );
uint64_t id = emplace_relation( owner, members, tags );
Expand Down
8 changes: 4 additions & 4 deletions src/way.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* ACTION createway
* ACTION way
*/
uint64_t xy::createway( const name owner,
const vector<point> way,
const vector<tag> tags )
uint64_t xy::way( const name owner,
const vector<point> way,
const vector<tag> tags )
{
require_auth( owner );
check_way( way );
Expand Down
6 changes: 3 additions & 3 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ cleos push action $CODE setrate '["4,EOS"]' -p $CODE

cleos -u $ENDPOINT transfer $USER $CODE "1.0000 EOS"

cleos -u $ENDPOINT push action $CODE createnode \
cleos -u $ENDPOINT push action $CODE node \
"[${USER},[45.123, 150.123], [{\"k\":\"second\",\"v\":\"value0\"}]]" \
-p $USER

cleos -u $ENDPOINT push action $CODE createway \
cleos -u $ENDPOINT push action $CODE way \
"[${USER},[[-25, -45], [65, 180]], [{\"k\":\"second\",\"v\":\"value0\"}]]" \
-p $USER

cleos -u $ENDPOINT push action $CODE createrel \
cleos -u $ENDPOINT push action $CODE relation \
"[${USER},[{\"type\": \"way\", \"ref\": 1, \"role\": \"\"}, {\"type\": \"node\", \"ref\": 0, \"role\": \"\"}], [{\"k\":\"foo\", \"v\": \"bar\"}]]" \
-p $USER

Expand Down

0 comments on commit e3938c6

Please sign in to comment.