Steem-js 사용하기 레슨3

in #kr6 years ago (edited)

steem-js를 사용하다보면 함수들이 너무 부족하다는걸 느끼는데요

steem.com에서 제공하는 api비해서요.

그럼 이런 문제는 어떻게 해결할까요? steem-js의 git 프로젝트를 수정할까요?

저는 이문제를 jquery로 풀어보고자 합니다. 

Steem-js 사용하기 레슨2에서 사용한 예를 jquery를 써서 해볼께요

일단 https://developers.steem.io/apidefinitions/#apidefinitions-condenser-api 해당 사이트에서

api 목록과 파라미터 값을 보고요

컨트롤+F를 눌러서 get_active_votes 검색해 보새요 그럼 어떻게 호출해야되는 지 나올거예요

예를 보시고 아래처럼 값만 바꿔서 처리하면 끝입니다.


소스코드

1. Jquery 레퍼런스 추가

 <script

  src="https://code.jquery.com/jquery-3.3.1.js"

  integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="

  crossorigin="anonymous"></script>

2. 실제 호출될 url과 data셋팅 후 전송

 <script>

  $.ajax({

  url:'

https://api.steemit.com / https://api.steemit.com
',

  type:"POST",

  data:'{"id":0,"jsonrpc":"2.0","method":"tags_api.get_active_votes","params":{"author": "fullmi", "permlink": "636686368340054479"}}',

  contentType:"application/json; charset=utf-8",

  dataType:"json",

  success: function(result){

   console.log(result);

  }

})

  </script>


크롬에서 데이터를 한번 보시면 변함없이 잘 가지고 옴을 알수 있습니다.

혹시 모르시는것 있으면 댓글로 말씀 주세요. 앞으로 Jquery로 api하나씩 다뤄나가는게 좋겠네요

steem-js는 제약이 넘 많아서 ^^

![캡처.PNG]()
Sort:  

Congratulations @fullmi! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

You published 4 posts in one day

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

You got a 33.33% upvote from @nado.bot courtesy of @fullmi!

Send at least 0.1 SBD to participate in bid and get upvote of 0%-100% with full voting power.

pairplay 가 kr-dev 컨텐츠를 응원합니다! :)

넘 넘 감사합니다.
@pairplay님도 더운데 힘내세요.

Coin Marketplace

STEEM 0.20
TRX 0.12
JST 0.028
BTC 64310.07
ETH 3504.54
USDT 1.00
SBD 2.49