
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
TokenPocket 已经兼容 Scatter,直接在钱包内 Dapp浏览器 内输入URL即可使用。(本项目只支持移动端TokenPocket)
TokenPocket is already compatible with Scatter. You can input your URL in the Dapp browser inside the TP Wallet. (mobile only)
在这里查看TokenPocket支持的其他区块链底层 JS API:
Check other blockchain js api here:
Javascript SDK for TokenPocket EOS Dapp

请在TokenPocket中使用该SDK。 请在发现 -> DApp浏览器中 开发调试
Open your site in TokenPocket as a Dapp. Develope and test in Discover -> DappBrowser.
Npm
var tp = require('tp-eosjs')
console.log(tp.isConnected());
Browser
<script src="./dist/tp.js"></script>
<script>
console.log(tp.isConnected());
</script>
tp.eosTokenTransfer(params)
params- Object:
from: Stringto: Stringamount: String|NumbertokenName: Stringprecision: Number|Stringcontract: Stringmemo: String- (optional),address: String - public key for current accountObject:
result: Boolean
data: Object
transactionId : Stirngtp.eosTokenTransfer({
from: 'abcabcabcabc',
to: 'itokenpocket',
amount: '0.0100',
tokenName: 'EOS',
precision: 4,
contract: 'eosio.token',
memo: 'test',
address: 'EOS7ds9A9FGDsKrdymQ4ynKbMgbCVaaaaaaaaaaa'
}).then(console.log)
> {
result: true,
data: {transactionId: 'b428357c7xxxxxxxxxxxxxx'}
}
tp.pushEosAction(params)
params- Object:
actions: Array- Standard eos actionsaccount: String - current accountaddress: String - public key for current accountObject:
result: Booleandata: Object
transactionId : Stirngtp.pushEosAction({
actions: [
{
account: 'eosio.token',
name: 'transfer',
authorization: [{
actor: 'aaaabbbbcccc',
permission: 'active'
}],
data: {
from: 'aaaabbbbcccc',
to: 'itokenpocket',
quantity: '1.3000 EOS',
memo: 'something to say'
}
},
{
account: "eosio",
name: "delegatebw",
authorization: [
{
actor: 'aaaabbbbcccc',
permission: "active"
}
],
data: {
from: 'aaaabbbbcccc',
receiver: 'itokenpocket',
stake_net_quantity: "0.0100 EOS",
stake_cpu_quantity: "0.0100 EOS",
transfer: 0
}
}
],
address: 'EOS7ds9A9FGDsKrdymQ4ynKbMgbCVaaaaaaaaaaa',
account: 'aaaabbbbcccc'
}).then(console.log)
> {
result: true,
data: {transactionId: 'b428357c7xxxxxxxxxxxxxx'}
}
tp.getEosBalance(params)
params- Object:
account: Stringcontract: Stringsymbol: StringObject:
result: Booleandata: Object
symbol: Stringbalance: Stringcontract: Stringaccount: Stringmsg: Stringtp.getEosBalance({
account: 'itokenpocket',
contract: 'eosio.token',
symbol: 'EOS'
}).then(console.log)
> {
result: true,
data:{"symbol":"EOS","balance":"["142.2648 EOS"]","contract":"eosio.token","account":"itokenpocket"},
msg: 'success'
}
获取合约内table数据
tp.getEosTableRows(params)
params- Object:
json: Booleancode: Stringscope: Stringtable: Stringtable_key: Stirnglower_bound: Stringupper_bound: Stringlimit: NumberObject:
result: Booleandata: Object
rows: Arraymore: booleanmsg: Stringtp.getEosTableRows({
json: true,
code: 'abcabcabcabc',
scope: 'abcabcabcabc',
table: 'table1',
lower_bound: '10',
limit: 20
}).then(console.log)
> {
result: true,
data:{
rows: [{a: 1, b: 'name' }, ...],
more: true
},
msg: 'success'
}
tp.getEosAccountInfo(params)
params- Object:
account: StringObject:
result: Booleandata: Object- Standard account objectmsg: Stringtp.getEosAccountInfo({
account: 'itokenpocket'
}).then(console.log)
> {
result: true,
data:{"account_name":"itokenpocket",..., "is_proxy":0}},
msg: 'success'
}
tp.getEosTransactionRecord(params)
params- Object:
account: Stringstart: Number - default: 0count: Number - default: 10sort: String - 'desc | asc' default: desctoken: String - optionalcontract: String - optionalObject:
result: Booleandata: Object- Standard account objectmsg: Stringtp.getEosTransactionRecord({
start: 10,
count: 20,
account: 'itokenpocket',
token: 'EOS',
sort: 'desc',
contract: 'eosio.token'
}).then(console.log)
> {
result: true,
data: [{
"title": "",
"comment": "",
"hid": "4bd63a191a1e3e00f13fe6df55d0c08803800a5e7cd0d0b15c92d52b3c42285e",
"producer": "bp4",
"timestamp": 1531578890,
"action_index": 2,
"account": "eosio",
"name": "delegatebw",
"from": "tokenpocket1",
"to": "clementtes43",
"blockNum": 4390980,
"quantity": "0.2000000000 EOS",
"count": "0.2000000000",
"symbol": "EOS",
"memo": "",
"maximum_upply": "",
"ram_price": "",
"bytes": "",
"status": 1,
"data": "",
real_value:"0.2000000000"
}, ...],
msg: 'success'
}
tp.eosAuthSign(params)
params- Object:
from: String - eos account namepublicKey: Stringsigndata: Stringtimestamp+wallet+signdata+ref string.Object:
result: Booleandata: Object
signature : Stringref: String - 'TokenPocket'signdata : Stringtimestamp: Stringwallet : String - eos account namemsg: Stringtp.eosAuthSign({
from: 'itokenpocket',
publicKey: 'EOS13we3sbereewwwwww',
signdata: 'something to sign'
}).then(console.log)
> {
result: true,
data: {
signature: 'SIG_EBEFWA-AFEBEf-eeee-aaaaa-eeeeea23d',
timestamp: '1534735280',
ref: 'TokenPocket',
signdata: 'something to sign',
wallet: 'itokenpocket'
},
msg: 'success'
}
tp.getAppInfo()
Object:
result: Booleandata: Object
name: Stringsystem: Stringversion: Stringsys_version: Stringmsg: Stringtp.getAppInfo().then(console.log)
> {
result: true,
data: {
name: 'TokenPocket',
system: 'android',
version: '0.3.4',
sys_version: '26'
},
msg: 'success'
}
tp.getWalletList(params)
params- String|Number - eth|1 for ETH, jingtum|2 for Jingtum, moac|3 for MOAC, eos|4 for EOS , enu|5 for ENU
Object:
wallets: Object
eos|eth|moac|jingtum: Array - Wallet infotp.getWalletList('eth').then(console.log)
> {
wallets: {
'eth': [{
name: 'pk-1',
address: '0xaaaaaaa',
tokens: {'eth': 1000},
...
},
...
]
}
}
tp.getDeviceId()
Object:
device_id: Stringtp.getDeviceId().then(console.log)
> {
device_id: 'dexa23333'
}
分享 share to SNS
tp.shareNewsToSNS(params)
params- Object:
title: Stringdesc: Stringurl: StringpreviewImage: Stringtp.shareNewsToSNS({
title: 'TokenPocket',
desc: 'Your Universal Wallet',
url: 'https://www.mytokenpocket.vip/',
previewImage: 'https://www.mytokenpocket.vip/images/index/logo.png'
})
扫码 Scan the QRcode
tp.invokeQRScanner()
String
tp.invokeQRScanner().then(console.log)
> "abcdefg"
获取用户当前钱包
1 for ETH, 2 for Jingtum, 3 for MOAC, 4 for EOS , 5 for ENU, 6 for BOS, 7 for IOST , 8 for COSMOS , 9for binance 10 for TRON
tp.getCurrentWallet()
Object:
result: Booleandata: Object
name: Stringaddress: Stringblockchain_id: Numberpermissions: Arraymsg: Stringtp.getCurrentWallet().then(console.log)
> {
result: true,
data: {
name: 'itokenpocket',
address: 'EOSaaaaaaaaabbbbbbbb',
blockchain_id: 4,
permissions: ['active']
},
msg: 'success'
}
获取用户钱包列表 Get user's wallet list
1 for ETH, 2 for Jingtum, 3 for MOAC, 4 for EOS , 5 for ENU
tp.getWallets()
Object:
result: Booleandata: Array
address: Stringname: Stringblockchain_id: Numbermsg: Stringtp.getWallets().then(console.log)
> {
result: true,
data: [
{
name: 'itokenpocket',
address: 'EOSaaaaaaaaabbbbbbbb',
blockchain_id: 4
},
{
name: 'ethwallet11',
address: '0x40e5A542087FA4b966209707177b103d158Fd3A4',
blockchain_id: 1
}
],
msg: 'success'
}
tp.sign(params)
params- Object:
appid: StringObject:
result: Booleandata: Object
deviceId : Stirngappid : Stringtimestamp : Numbersign : Stringmsg: Stringtp.sign({
appid: 'swEmwEQ666'
}).then(console.log)
> {
result: true,
data: {
deviceId: 'EBEFWA-AFEBEf-eeee-aaaaa-eeeeea23d',
appid: 'swEmwEQ666',
timestamp: 1534735280,
sign: '713efewwfegwohvnqooyge38h4n421ll3fwzib9e3q00'
},
msg: 'success'
}
页面后退一页 back forward
tp.back()
tp.back()
关闭当前Dapp页面 close the dapp
tp.close()
tp.close()
全屏应用 fullScreen the dapp
tp.fullScreen(params)
params- Object:
fullScreen: Number 1 - fullScreen, 0 - canceltp.fullScreen({
fullScreen: 0
})
钱包导入界面
Invoke the wallet importing window
tp.importWallet(blockchain)
blockchain- String: 'eos' | 'eth' | 'enu' | 'moac'
tp.importWallet('eos');
全屏时 设置dapp浏览器导航条可见性
When the fullscreen is on, set the dapp browser's navbar visiblity
tp.setMenubar(params)
params- Object:
flag: Number 1 - open, 0 - close(default)tp.setMenubar({
flag: 1
});
跳到TP聊天
Open TP IM
tp.startChat(params)
params- Object:
sessionType: Number 私聊是0 群聊是1account: String 私聊是目标用户的账号(eos,iost等)或地址(eth,moac等), 群聊是群的idblockChainId: Number 只有私聊需要填, 私聊时目标用户的底层 1 for ETH, 2 for Jingtum, 3 MOAC, 4 for EOS , 5 for ENU, 6 for BOS, 7 for IOSTtp.startChat({
account: 'itokenpocket',
sessionType: 0,
blockChainId: 4
});
保存图片
Save image
tp.saveImage(params)
params- Object:
url: String image's urltp.saveImage({
url: 'https://dapp.mytokenpocket.vip/tokenpocket_logo.png'
});
横屏
rotate the screen horizontal
tp.rollHorizontal(params)
params- Object:
horizontal: Booleantp.rollHorizontal({
horizontal: true
});
禁止iOS自带的左滑手势返回,对安卓无影响
Disable iOS's left-sliding gesture to return. There is no effect on Android
tp.popGestureRecognizerEnable(params)
params- Object:
enable: Boolean - default: truetp.popGestureRecognizerEnable({
enable: false
});
禁止webview自带的左滑手势触发goback, 对安卓无影响
Disable the left sliding gesture by WebView to trigger goback. There is no effect on Android
tp.forwardNavigationGesturesEnable(params)
params- Object:
enable: Boolean - default: truetp.forwardNavigationGesturesEnable({
enable: false
});
tp.tokenTransfer(params)
params- Object:
blockchain: String - 'eos' | 'bos'from: Stringto: Stringamount: String|NumbertokenName: Stringprecision: Number|Stringcontract: Stringmemo: String- (optional),address: String - public key for current accountObject:
result: Boolean
data: Object
transactionId : Stirngtp.tokenTransfer({
blockchain: 'eos',
from: 'abcabcabcabc',
to: 'itokenpocket',
amount: '0.0100',
tokenName: 'EOS',
precision: 4,
contract: 'eosio.token',
memo: 'test',
address: 'EOS7ds9A9FGDsKrdymQ4ynKbMgbCVaaaaaaaaaaa'
}).then(console.log)
> {
result: true,
data: {transactionId: 'b428357c7xxxxxxxxxxxxxx'}
}
tp.pushAction(params)
params- Object:
blockchain: String - 'eos' | 'bos'actions: Array- Standard eos actionsaccount: String - current accountaddress: String - public key for current accountObject:
result: Booleandata: Object
transactionId : Stirngtp.pushAction({
blockchain: 'eos',
actions: [
{
account: 'eosio.token',
name: 'transfer',
authorization: [{
actor: 'aaaabbbbcccc',
permission: 'active'
}],
data: {
from: 'aaaabbbbcccc',
to: 'itokenpocket',
quantity: '1.3000 EOS',
memo: 'something to say'
}
},
{
account: "eosio",
name: "delegatebw",
authorization: [
{
actor: 'aaaabbbbcccc',
permission: "active"
}
],
data: {
from: 'aaaabbbbcccc',
receiver: 'itokenpocket',
stake_net_quantity: "0.0100 EOS",
stake_cpu_quantity: "0.0100 EOS",
transfer: 0
}
}
],
address: 'EOS7ds9A9FGDsKrdymQ4ynKbMgbCVaaaaaaaaaaa',
account: 'aaaabbbbcccc'
}).then(console.log)
> {
result: true,
data: {transactionId: 'b428357c7xxxxxxxxxxxxxx'}
}
tp.getBalance(params)
params- Object
blockchain: String - 'eos' | 'bos'account: Stringcontract: Stringsymbol: StringObject:
result: Booleandata: Object
symbol: Stringbalance: Stringcontract: Stringaccount: Stringmsg: Stringtp.getBalance({
blockchain: 'eos',
account: 'itokenpocket',
contract: 'eosio.token',
symbol: 'EOS'
}).then(console.log)
> {
result: true,
data:{"symbol":"EOS","balance":"["142.2648 EOS"]","contract":"eosio.token","account":"itokenpocket"},
msg: 'success'
}
获取合约内table数据
tp.getTableRows(params)
params- Object:
blockchain: String - 'eos' | 'bos'json: Booleancode: Stringscope: Stringtable: Stringtable_key: Stirnglower_bound: Stringupper_bound: Stringlimit: NumberObject:
result: Booleandata: Object
rows: Arraymore: booleanmsg: Stringtp.getTableRows({
blockchain: 'eos',
json: true,
code: 'abcabcabcabc',
scope: 'abcabcabcabc',
table: 'table1',
lower_bound: '10',
limit: 20
}).then(console.log)
> {
result: true,
data:{
rows: [{a: 1, b: 'name' }, ...],
more: true
},
msg: 'success'
}
tp.getAccountInfo(params)
params- Object:
account: Stringblockchain: String - 'eos' | 'bos'Object:
result: Booleandata: Object- Standard account objectmsg: Stringtp.getEosAccountInfo({
account: 'itokenpocket',
blockchain: 'eos'
}).then(console.log)
> {
result: true,
data:{"account_name":"itokenpocket",..., "is_proxy":0}},
msg: 'success'
}
tp.getTransactionRecord(params)
params- Object:
blockchain: String - 'eos' | 'bos'account: Stringstart: Number - default: 0count: Number - default: 10sort: String - 'desc | asc' default: desctoken: String - optionalcontract: String - optionalObject:
result: Booleandata: Object- Standard account objectmsg: Stringtp.getEosTransactionRecord({
blockchain: 'eos',
start: 10,
count: 20,
account: 'itokenpocket',
token: 'EOS',
sort: 'desc',
contract: 'eosio.token'
}).then(console.log)
> {
result: true,
data: [{
"title": "",
"comment": "",
"hid": "4bd63a191a1e3e00f13fe6df55d0c08803800a5e7cd0d0b15c92d52b3c42285e",
"producer": "bp4",
"timestamp": 1531578890,
"action_index": 2,
"account": "eosio",
"name": "delegatebw",
"from": "tokenpocket1",
"to": "clementtes43",
"blockNum": 4390980,
"quantity": "0.2000000000 EOS",
"count": "0.2000000000",
"symbol": "EOS",
"memo": "",
"maximum_upply": "",
"ram_price": "",
"bytes": "",
"status": 1,
"data": "",
real_value:"0.2000000000"
}, ...],
msg: 'success'
}
tp.authSign(params)
params- Object:
blockchain: String - 'eos' | 'bos'from: String - account namepublicKey: Stringsigndata: StringObject:
result: Booleandata: Object
signature : Stringref: String - 'TokenPocket'signdata : Stringtimestamp: Stringwallet : String - eos account namemsg: Stringtp.authSign({
blockchain: 'bos',
from: 'itokenpocket',
publicKey: 'EOS13we3sbereewwwwww',
signdata: 'something to sign'
}).then(console.log)
> {
result: true,
data: {
signature: 'SIG_EBEFWA-AFEBEf-eeee-aaaaa-eeeeea23d',
timestamp: '1534735280',
ref: 'TokenPocket',
signdata: 'something to sign',
wallet: 'itokenpocket'
},
msg: 'success'
}
FAQs
tp js sdk for eos
The npm package tp-eosjs receives a total of 14 weekly downloads. As such, tp-eosjs popularity was classified as not popular.
We found that tp-eosjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.