
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
popup-js-sdk
Advanced tools
js sdk for popup DApp market.
popup-js-sdk provided to developers who need to develop DApps in the popup DApp market. It provides an interface method for querying accounts and executing smart contract methods.
npm install popup-js-sdk
import Popup from 'popup-js-sdk'
...
let popup = new Popup();
popup.setProvider(new popup.providers.HttpProvider('http://127.0.0.1:2345'));
- popup.local.* is for calling popup local methods. eg: popup.local.accountList is get all account list.
- popup.sero.* is for calling gero node rpc when execute smart contract. eg: popup.sero.call().
If you need to call gero other rpc interfaces directly, you can use sero-web3
npm install sero-web3
PK
is the address of the account, can be used as a tag for the account, not as a transfer from address.MainPKr
can be used as a common address,call
andexecute
smart contract.MainOldPKr
has Deprecated.Balance
is a map. key = currency ,value = Minimum unit amount.PkrBase58
is Dynamic collection address. Refresh every time a transaction occurs.
let accounts = popup.local.accountList();
Result:
[{
"PK": "kvaztfuz3ZS6sNcksQYZpdGC1rUwcuv1aPkuzkLdgeNSvq5FQiURuBsqghLCY3MkxZLNm7WQ9yV2ib2UWoRpJys",
"MainPKr": "fHBQfR5t9j3D4CsKQG78sQ3Qzdz9SS6m3XsgvgkNcpKjD1TMBEVmcJ4vhDUpkZrvPtE47DnzxRjz4Gk7xMaGZfxstnMeBjZF1dWeQaC3dxLrPPa4wQoGdXeJuihdTKwxf5K",
"MainOldPKr": "2QwcGasRUYwF3BdTDFh2gLAMYdayBRLqVhiKrBi7apqB1ftZmaUtLYN8AdTY87K3mGW2EZgh1tVCizzdy1HWM8fGBP9ZErPKawPUPexaVXqZqSa1uPbNXb5c755H1kCUn7c3",
"Balance": {
"SERO": 88999438296000000000
},
"UtxoNums": {
"SERO": 2
},
"PkrBase58": "TXSgCTk7vVRDkVxmiPiWBakQtcrf5FJKcyRvGmfHh1SXBUnzopi6fqohd8K4ZCyEmvkVwzdZC2AdotcZh2B3XcnXZHRkUxrZQ76u1tzf1CURjtbchDbs4ZNRjTB86nvBGWK"
}, {
"PK": "4xxrya2a8g6QLQuQBtdpyF49axHTnkUeDjomfk5zqG7eDZubPPubHMVkPqggZ9iE8Zy6WQVD7riRcX8TSfihs3nq",
"MainPKr": "22ogQ9vrpiPxBgTep59koxnNzRmHAY2zi94EKp3VAhjo4r7bzETxbgqTfgUqHuuFAe5on4iagFAhXVfaooLH5JMLEhKSmzucPvHftgefGVTzAfDJLs53Pw7YnP2rcSSStxoT",
"MainOldPKr": "Wubp9ZYJPdxLyyesrth4j3AsZVouNgt5NNgCBHiwqhUpN1ZhbmTLRWViUwxzvhpezKDgXi5ck7iXm3bjwLAHfRnSTC8FMhRTqPLvUs6vbXKXQ9VMpDefHLR4PDDLVotkbd9",
"Balance": {},
"UtxoNums": {},
"PkrBase58": "22ogQ9vrpiPxBgTep59koxnNzRmHAY2zi94EKp3VAhjo4r7bzETxbgqTfgUqHuuFAe5on4iagFAhXVfaooLH5JMLEhKSmzucPvHftgefGVTzAfDJLs53Pw7YnP2rcSSStxoT"
}]
let account = popup.local.accountDetail(`pk`);
Result:
{
"PK": "kvaztfuz3ZS6sNcksQYZpdGC1rUwcuv1aPkuzkLdgeNSvq5FQiURuBsqghLCY3MkxZLNm7WQ9yV2ib2UWoRpJys",
"MainPKr": "fHBQfR5t9j3D4CsKQG78sQ3Qzdz9SS6m3XsgvgkNcpKjD1TMBEVmcJ4vhDUpkZrvPtE47DnzxRjz4Gk7xMaGZfxstnMeBjZF1dWeQaC3dxLrPPa4wQoGdXeJuihdTKwxf5K",
"MainOldPKr": "2QwcGasRUYwF3BdTDFh2gLAMYdayBRLqVhiKrBi7apqB1ftZmaUtLYN8AdTY87K3mGW2EZgh1tVCizzdy1HWM8fGBP9ZErPKawPUPexaVXqZqSa1uPbNXb5c755H1kCUn7c3",
"Balance": {
"SERO": 88999438296000000000
},
"UtxoNums": {
"SERO": 2
},
"PkrBase58": "TXSgCTk7vVRDkVxmiPiWBakQtcrf5FJKcyRvGmfHh1SXBUnzopi6fqohd8K4ZCyEmvkVwzdZC2AdotcZh2B3XcnXZHRkUxrZQ76u1tzf1CURjtbchDbs4ZNRjTB86nvBGWK",
}
Here need install serojs to pack
and unpack
data.
npm install serojs
// you can use remix solidity complie to web3deploy to get abi. and deploy with gero to get contract address.
let contractAddress = "54ZJqe8orGqAucdFqcZRupMa1WFeL6e5raCUw7FcBit9G9GZ5JFHXhNEKkhBPWRDEf1kDRLbX3qiPqSJ5H5Kasit";
let contract = serojs.callContract(abi, contractAddress);
// execute contract methods
execute(method, args) {
let that = this;
try{
let packData = contract.packData(method, args);
let executeData = {
from: that.state.fromPKr,
to: contractAddress,
value: "0x0",//SERO
data: packData,
gas_price: "0x"+new BigNumber("1000000000").toString(16),
};
executeData["gas"] = popup.sero.estimateGas(executeData);
let res = popup.local.executeContract(executeData);
return res;
}catch (e) {
alert(e.message);
}
}
// call contract methods
call(method, args) {
let that = this;
try{
let packData = contract.packData(method, args);
let callParams = {
from: that.state.fromPKr,
to: contractAddress,
data: packData
}
console.log(callParams);
let callData = popup.sero.call(callParams, "latest");
if (callData !== "0x") {
let res = contract.unPackData(method, callData);
return res;
}
return "";
}catch (e) {
alert(e.message);
}
}
Please refer to the example directory
FAQs
popup js sdk for dapp developer
The npm package popup-js-sdk receives a total of 1 weekly downloads. As such, popup-js-sdk popularity was classified as not popular.
We found that popup-js-sdk 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
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.