adamant api jsclient
v2.4.0
Adamant JavaScript API는 JavaScript 개발자를위한 단호한 블록 체인과 상호 작용하기위한 라이브러리입니다. 또한 단호한 콘솔 및 Adamant Node Direct API를 사용할 수 있습니다.
특징:
JS API는 네트워크 노드가 귀하의 요청을 충족시킬 수없는 경우 라이브러리가 다른 노드로 여러 번 리디렉션되는 등의 행동을 보여줍니다. 결과를 얻을 수 있으며 요청 처리에 대해 생각할 필요가 없습니다.
건강 검사 시스템은 /status 끝점을 사용하여 목록의 모든 노드를 핑하고 실제 높이의 노드에 연결합니다. 라이브러리가 현재 노드로 요청을 처리 할 수없는 경우 건강 검사를 재개 할 수 있습니다.
NPM에서 라이브러리 설치 :
npm i adamant-api라이브러리 초기화 :
const { AdamantApi } = require ( 'adamant-api' )
const nodes = [
"http://localhost:36666" ,
"https://endless.adamant.im" ,
"https://clown.adamant.im" ,
"http://23.226.231.225:36666" ,
"http://88.198.156.44:36666" ,
"https://lake.adamant.im"
] ;
const api = new AdamantApi ( {
nodes ,
} ) ;Request example:
const response = await api . getBlocks ( )
console . log ( response . data ) 문서 및 사용법은 Wiki를 참조하십시오.