
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
This is the AELF JavaScript API which connects to the Generic JSON RPC spec.
You need to run a local or remote AELF node to use this library.
Please read the ./docs for more.
Get the demos in ./demos
npm install aelf-sdk
yarn add aelf-sdk
Five modules.
Aelf, Aelf.wallet, Aelf.pbjs, Aelf.pbUtils, Aelf.version
import Aelf from 'aelf-sdk';
// host, timeout, user, password, headers
const aelf = new Aelf(
new Aelf.providers.HttpProvider(
host, // https://127.0.0.1:8000/chain
timeout, // 300
user, // username
password, // passowrd
// header
[{
name: 'x-csrf-token',
value: document.cookie.match(/csrfToken=[^;]*/)[0].replace('csrfToken=', '')
}]
)
);
If you want to use the WebAPI of AElf.
const aelf = new Aelf(
new Aelf.providers.HttpProvider(
host, // https://127.0.0.1:8000/chain
timeout, // 300
user, // username
password, // passowrd
// header
[{
name: 'Accept',
value: 'text/plain;v=1.0'
}]
)
);
init contract and call methods
// contractAddress = xxx; wallet = xxx;
// We use token contract for example.
aelf.chain.contractAtAsync(contractAddress, wallet, (err, result) => {
const contractoktMethods = result;
// contractMethods.methodName(param01, ..., paramN, callback);
// contractMethods.methodName.call(param01, ..., paramN, callback);
contractoktMethods.Transfer({
symbol: 'ELF',
to: '58h3RwTfaE8RDpRNMAMiMv8jUjanCeYHBzKuQfHbrfSFTCn',
amount: '1000'
}, (err, result) => {
});
// will not send transaction when use .call
contractMethods.GetBalance.call({
symbol: 'ELF',
owner: '58h3RwTfaE8RDpRNMAMiMv8jUjanCeYHBzKuQfHbrfSFTCn'
}, (err, result) => {
});
});
Additionally you can set a provider using aelf.setProvider()
import Aelf from 'aelf-sdk';
const aelf = new Aelf(new Aelf.providers.HttpProvider('https://127.0.0.1:8000/chain'));
aelf.setProvider(new Aelf.providers.HttpProvider('https://127.0.0.1:8010/chain'));
base on bip39.
import Aelf from 'aelf-sdk';
Aelf.wallet.createNewWallet();
// wallet.AESDecrypto wallet.AESEncrypto wallet.bip39
// wallet.createNewWallet wallet.getWalletByMnemonic wallet.getWalletByPrivateKey
// wallet.sign wallet.signTransaction
almost the same as protobufjs
Sometimes we have to deal with some protobuf data.
Some basic format methods of aelf.
For more information, please see the code in ./lib/aelf/proto.js. It is simple and easy to understand.
// methods.
getRepForAddress
getAddressFromRep
getAddressObjectFromRep
getRepForHash
getHashFromHex
getHashObjectFromHex
getTransaction
getMsigTransaction
getAuthorization
getReviewer
encodeTransaction
getProposal
encodeProposal
getApproval
encodeApproval
getSideChainInfo
getBalance
encodeSideChainInfo
Transaction
Hash
Address
Authorization
Proposal
ProposalStatus
SideChainInfo
SideChainStatus
ResourceTypeBalancePair
import Aelf from 'aelf-sdk';
Aelf.version // eg. 2.1.10
All contributions have to go into the dev-2.0 branch
Please follow the code style of the other files, we use 4 spaces as tabs.
npm
node ./node_modules/protobufjs/bin/pbjs -t json ./lib/aelf/proto/abi.proto > ./lib/aelf/proto/abi.proto.json
FAQs
aelf-sdk js library
The npm package aelf-sdk receives a total of 421 weekly downloads. As such, aelf-sdk popularity was classified as not popular.
We found that aelf-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.