Skip to content

Commit

Permalink
add to sns api
Browse files Browse the repository at this point in the history
  • Loading branch information
ordinariusprof committed May 17, 2024
1 parent 9039e60 commit 38c5d38
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions modules/sns_api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,30 @@ app.get('/v1/sns/get_registered_namespaces', async (request, response) => {
response.send({ error: null, result: res.rows })
});

app.get('/v1/sns/get_sns_count_of_address', async (request, response) => {
let address = request.query.address

let query = ` select count(*)
from sns_names
where address = $1;`
let params = [address]

let res = await db_pool.query(query, params)

response.send({ error: null, result: res.rows })
});

app.get('/v1/sns/get_sns_of_address', async (request, response) => {
let address = request.query.address

let query = ` select inscription_id, inscription_number, "name" as sns_name
from sns_names
where address = $1;`
let params = [address]

let res = await db_pool.query(query, params)

response.send({ error: null, result: res.rows })
});

app.listen(api_port, api_host);

0 comments on commit 38c5d38

Please sign in to comment.