Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hive-js
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hive-js
Commits
ad26114a
Commit
ad26114a
authored
8 years ago
by
adcpm
Browse files
Options
Downloads
Patches
Plain Diff
- Add browser support
parent
5773030d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+1
-1
1 addition, 1 deletion
README.md
examples/steem.min.js
+1
-0
1 addition, 0 deletions
examples/steem.min.js
with
2 additions
and
1 deletion
README.md
+
1
−
1
View file @
ad26114a
...
...
@@ -4,7 +4,7 @@ SteemJS the JavaScript API for Steem blockchain
## Documentation
Here is full documentation: https://github.com/adcpm/steem/tree/master/doc
## Browser
## Browser
```
html
<script
src=
"./steem.min.js"
></script>
<script>
...
...
This diff is collapsed.
Click to expand it.
examples/steem.min.js
0 → 100644
+
1
−
0
View file @
ad26114a
(
function
e
(
t
,
n
,
r
){
function
s
(
o
,
u
){
if
(
!
n
[
o
]){
if
(
!
t
[
o
]){
var
a
=
typeof
require
==
"
function
"
&&
require
;
if
(
!
u
&&
a
)
return
a
(
o
,
!
0
);
if
(
i
)
return
i
(
o
,
!
0
);
var
f
=
new
Error
(
"
Cannot find module '
"
+
o
+
"
'
"
);
throw
f
.
code
=
"
MODULE_NOT_FOUND
"
,
f
}
var
l
=
n
[
o
]
=
{
exports
:{}};
t
[
o
][
0
].
call
(
l
.
exports
,
function
(
e
){
var
n
=
t
[
o
][
1
][
e
];
return
s
(
n
?
n
:
e
)},
l
,
l
.
exports
,
e
,
t
,
n
,
r
)}
return
n
[
o
].
exports
}
var
i
=
typeof
require
==
"
function
"
&&
require
;
for
(
var
o
=
0
;
o
<
r
.
length
;
o
++
)
s
(
r
[
o
]);
return
s
})({
1
:[
function
(
require
,
module
,
exports
){
var
Steem
=
require
(
"
./steem.js
"
);
steem
=
new
Steem
(
"
wss://steemit.com/wstmp3
"
)},{
"
./steem.js
"
:
2
}],
2
:[
function
(
require
,
module
,
exports
){
var
apiIds
=
{
database_api
:
0
,
login_api
:
1
,
follow_api
:
2
};
var
Steem
=
function
(
url
){
this
.
url
=
url
||
"
wss://this.piston.rocks
"
};
Steem
.
prototype
.
send
=
function
(
api
,
data
,
callback
){
data
.
id
=
data
.
id
||
0
;
var
ws
=
new
WebSocket
(
this
.
url
);
ws
.
addEventListener
(
"
message
"
,
function
(
msg
){
var
data
=
JSON
.
parse
(
msg
.
data
);
var
err
=
data
.
error
||
""
;
callback
(
err
,
data
.
result
)});
ws
.
addEventListener
(
"
open
"
,
function
(){
data
.
params
=
data
.
params
||
[];
var
call
=
{};
call
.
id
=
data
.
id
;
call
.
method
=
"
call
"
;
call
.
params
=
[
apiIds
[
api
],
data
.
method
,
data
.
params
];
ws
.
send
(
JSON
.
stringify
(
call
))});
ws
.
addEventListener
(
"
error
"
,
function
(
error
){
callback
(
error
,
null
)})};
Steem
.
prototype
.
setSubscribeCallback
=
function
(
cb
,
clearFilter
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
set_subscribe_callback
"
,
params
:[
cb
,
clearFilter
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
setPendingTransactionCallback
=
function
(
cb
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
set_pending_transaction_callback
"
,
params
:[
cb
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
setBlockAppliedCallback
=
function
(
cb
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
set_block_applied_callback
"
,
params
:[
cb
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
cancelAllSubscriptions
=
function
(
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
cancel_all_subscriptions
"
},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getTrendingTags
=
function
(
afterTag
,
limit
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_trending_tags
"
,
params
:[
afterTag
,
limit
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getDiscussionsByTrending
=
function
(
query
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_discussions_by_trending
"
,
params
:[
query
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getDiscussionsByCreated
=
function
(
query
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_discussions_by_created
"
,
params
:[
query
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getDiscussionsByActive
=
function
(
query
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_discussions_by_active
"
,
params
:[
query
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getDiscussionsByCashout
=
function
(
query
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_discussions_by_cashout
"
,
params
:[
query
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getDiscussionsByPayout
=
function
(
query
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_discussions_by_payout
"
,
params
:[
query
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getDiscussionsByVotes
=
function
(
query
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_discussions_by_votes
"
,
params
:[
query
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getDiscussionsByChildren
=
function
(
query
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_discussions_by_children
"
,
params
:[
query
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getDiscussionsByHot
=
function
(
query
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_discussions_by_hot
"
,
params
:[
query
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getBlockHeader
=
function
(
blockNum
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_block_header
"
,
params
:[
blockNum
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getBlock
=
function
(
blockNum
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_block
"
,
params
:[
blockNum
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getState
=
function
(
path
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_state
"
,
params
:[
path
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getTrendingCategories
=
function
(
after
,
limit
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_trending_categories
"
,
params
:[
after
,
limit
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getBestCategories
=
function
(
after
,
limit
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_best_categories
"
,
params
:[
after
,
limit
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getActiveCategories
=
function
(
after
,
limit
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_active_categories
"
,
params
:[
after
,
limit
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getRecentCategories
=
function
(
after
,
limit
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_recent_categories
"
,
params
:[
after
,
limit
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getConfig
=
function
(
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_config
"
},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getDynamicGlobalProperties
=
function
(
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_dynamic_global_properties
"
},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getChainProperties
=
function
(
after
,
limit
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_chain_properties
"
},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getFeedHistory
=
function
(
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_feed_history
"
},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getCurrentMedianHistoryPrice
=
function
(
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_current_median_history_price
"
},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getWitnessSchedule
=
function
(
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_recent_categories
"
,
params
:[
after
,
limit
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getHardforkVersion
=
function
(
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_hardfork_version
"
},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getNextScheduledHardfork
=
function
(
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_next_scheduled_hardfork
"
},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getKeyReferences
=
function
(
key
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_key_references
"
,
params
:[
key
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getAccounts
=
function
(
names
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_accounts
"
,
params
:[
names
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getAccountReferences
=
function
(
accountId
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_account_references
"
,
params
:[
accountId
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
lookupAccountNames
=
function
(
accountNames
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
lookup_account_names
"
,
params
:[
accountNames
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
lookupAccounts
=
function
(
lowerBoundName
,
limit
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
lookup_accounts
"
,
params
:[
lowerBoundName
,
limit
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getAccountCount
=
function
(
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_account_count
"
},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getConversionRequests
=
function
(
accountName
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_conversion_requests
"
,
params
:[
accountName
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getAccountHistory
=
function
(
account
,
from
,
limit
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_account_history
"
,
params
:[
account
,
from
,
limit
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getOwnerHistory
=
function
(
account
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_owner_history
"
,
params
:[
account
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getRecoveryRequest
=
function
(
account
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_recovery_request
"
,
params
:[
account
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getOrderBook
=
function
(
limit
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
getOrderBook
"
,
params
:[
limit
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getOpenOrders
=
function
(
owner
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_open_orders
"
,
params
:[
owner
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getLiquidityQueue
=
function
(
startAccount
,
limit
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_liquidity_queue
"
,
params
:[
startAccount
,
limit
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getTransactionHex
=
function
(
trx
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_transaction_hex
"
,
params
:[
trx
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getTransaction
=
function
(
trxId
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_transaction
"
,
params
:[
trxId
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getRequiredSignatures
=
function
(
trx
,
availableKeys
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_required_signatures
"
,
params
:[
trx
,
availableKeys
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getPotentialSignatures
=
function
(
trx
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_potential_signatures
"
,
params
:[
trx
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
verifyAuthority
=
function
(
trx
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
verify_authority
"
,
params
:[
trx
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
verifyAccountAuthority
=
function
(
nameOrId
,
signers
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
verify_account_authority
"
,
params
:[
nameOrId
,
signers
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getActiveVotes
=
function
(
author
,
permlink
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_active_votes
"
,
params
:[
author
,
permlink
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getAccountVotes
=
function
(
voter
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_account_votes
"
,
params
:[
voter
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getContent
=
function
(
author
,
permlink
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_content
"
,
params
:[
author
,
permlink
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getContentReplies
=
function
(
parent
,
parentPermlink
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_content_replies
"
,
params
:[
parent
,
parentPermlink
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getDiscussionsByAuthorBeforeDate
=
function
(
author
,
startPermlink
,
beforeDate
,
limit
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_discussions_by_author_before_date
"
,
params
:[
author
,
startPermlink
,
beforeDate
,
limit
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getRepliesByLastUpdate
=
function
(
startAuthor
,
startPermlink
,
limit
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_replies_by_last_update
"
,
params
:[
startAuthor
,
startPermlink
,
limit
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getWitnesses
=
function
(
witnessIds
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_witnesses
"
,
params
:[
witnessIds
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getWitnessByAccount
=
function
(
accountName
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_witness_by_account
"
,
params
:[
accountName
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getWitnessesByVote
=
function
(
from
,
limit
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_witnesses_by_vote
"
,
params
:[
from
,
limit
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
lookupWitnessAccounts
=
function
(
lowerBoundName
,
limit
,
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
lookup_witness_accounts
"
,
params
:[
lowerBoundName
,
limit
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getWitnessCount
=
function
(
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_witness_count
"
},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getActiveWitnesses
=
function
(
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_active_witnesses
"
},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getMinerQueue
=
function
(
callback
){
this
.
send
(
"
database_api
"
,{
method
:
"
get_miner_queue
"
},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
streamBlockNumber
=
function
(
callback
){
var
current
=
""
;
var
ws
=
new
WebSocket
(
this
.
url
);
ws
.
addEventListener
(
"
message
"
,
function
(
msg
){
var
data
=
JSON
.
parse
(
msg
.
data
);
var
blockId
=
data
.
result
.
head_block_number
;
if
(
blockId
!=
current
){
current
=
blockId
;
callback
(
null
,
current
)}});
ws
.
addEventListener
(
"
open
"
,
function
(){
setInterval
(
function
(){
ws
.
send
(
JSON
.
stringify
({
id
:
0
,
method
:
"
get_dynamic_global_properties
"
,
params
:[]}))},
200
)});
ws
.
addEventListener
(
"
error
"
,
function
(
error
){
callback
(
error
,
null
)})};
Steem
.
prototype
.
streamBlock
=
function
(
callback
){
var
ws
=
new
WebSocket
(
this
.
url
);
var
current
=
""
;
var
last
=
""
;
this
.
streamBlockNumber
(
function
(
err
,
id
){
current
=
id
});
var
self
=
this
;
ws
.
addEventListener
(
"
open
"
,
function
(){
setInterval
(
function
(){
if
(
current
!=
last
){
last
=
current
;
self
.
getBlock
(
current
,
function
(
err
,
result
){
callback
(
null
,
result
)})}},
200
)});
ws
.
addEventListener
(
"
error
"
,
function
(
error
){
callback
(
error
,
null
)})};
Steem
.
prototype
.
streamTransactions
=
function
(
callback
){
this
.
streamBlock
(
function
(
err
,
result
){
if
(
!!
result
){
result
.
transactions
.
forEach
(
function
(
transaction
){
callback
(
null
,
transaction
)})}})};
Steem
.
prototype
.
streamOperations
=
function
(
callback
){
this
.
streamBlock
(
function
(
err
,
result
){
if
(
!!
result
){
result
.
transactions
.
forEach
(
function
(
transaction
){
transaction
.
operations
.
forEach
(
function
(
operation
){
callback
(
null
,
operation
)})})}})};
Steem
.
prototype
.
login
=
function
(
username
,
password
,
callback
){
this
.
send
(
"
login_api
"
,{
method
:
"
login
"
,
params
:[
username
,
password
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getApiByName
=
function
(
apiName
,
callback
){
this
.
send
(
"
login_api
"
,{
method
:
"
get_api_by_name
"
,
params
:[
apiName
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getFollowers
=
function
(
following
,
startFollower
,
limit
,
callback
){
this
.
send
(
"
follow_api
"
,{
method
:
"
get_followers
"
,
params
:[
following
,
startFollower
,
limit
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
Steem
.
prototype
.
getFollowing
=
function
(
follower
,
startFollowing
,
limit
,
callback
){
this
.
send
(
"
follow_api
"
,{
method
:
"
get_following
"
,
params
:[
follower
,
startFollowing
,
limit
]},
function
(
err
,
result
){
callback
(
err
,
result
)})};
module
.
exports
=
Steem
},{}]},{},[
1
]);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment