Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@hapi.one/core-cli
Advanced tools
Readme
HAPI Core contract built on Anchor for Solana. If you want to know more about HAPI Protocol, please visit the official site and our gitbook. If you want to propose any changes to this smart contract, please visit our governance forum. Suggestions for the client library enhancements are welcome.
To install everything you need to work with this project, you'll need to install dependencies as described in Anchor documentation.
The source code of hapi-core program is in ./programs/hapi-core
.
To build the hapi-core program, you need to execute this command:
anchor build
You'll get the following output:
./target/deploy/hapi_core.so
./target/idl/hapi_core.json
./target/types/hapi_core.ts
To test the program, you'll have to run this command:
anchor test
This command starts a local validator, sets up the program on chain and runs a suite of Jest tests against it.
To deploy the program, run this command:
anchor deploy \
--provider.cluster https://api.mainnet-beta.solana.com \
--provider.wallet ~/.config/solana/id.json
Where provider.cluster
is the target node API and provider.wallet
is the path to keypair you want to use to deploy the program.
The Javascript/Typescript client for this program is an NPM package that can be found here: @hapi.one/core-cli.
It's published by this command:
npm publish
Please view the test suite (./tests/hapi-core/**.spec.ts
) to see how can this client be used in NodeJS context.
import { Connection, PublicKey } from "@solana/web3.js";
import { Provider } from "@project-serum/anchor";
import { initHapiCore } from "@hapi.one/core-cli";
// Setup web3 Connection
const connection = new Connection("https://api.mainnet-beta.solana.com");
// Use Phantom wallet provider
const wallet = window.solana;
// Setup Anchor provider
const provider = new Provider(connection, wallet as any);
// hapi-core program ID is a well-known public key
const HAPI_PROGRAM_ID = new PublicKey(
"hapiAwBQLYRXrjGn6FLCgC8FpQd2yWbKMqS6AYZ48g6"
);
// Setup the client
const hapiCore = initHapiCore(HAPI_PROGRAM_ID, provider);
// HAPI community account is a well-known public key
const communityAccount = new PublicKey(
"31gQ11Qsd7dPcnkdCJ2ZGnY2ijRXsvFCPWagpcFxYwem"
);
// Use client to fetch community account data
const communityData = await hapiCore.account.community.fetch(communityAccount);
console.log(communityData);
// Find a PDA for a particular network
const [networkAccount] = await program.pda.findNetworkAddress(
communityAccount,
"solana"
);
// Encode address buffer
const addressEncoded = hapiCore.util.encodeAddress(
"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
"Solana"
);
// Find a PDA for an address, which we want to check
const [addressAccount] = await program.pda.findAddressAddress(
networkAccount,
addressEncoded
);
// Fetch address risk scoring data
const addressData = await hapiCore.account.address.fetch(addressAccount);
console.log(addressData);
FAQs
Client library for HAPI core contract
The npm package @hapi.one/core-cli receives a total of 0 weekly downloads. As such, @hapi.one/core-cli popularity was classified as not popular.
We found that @hapi.one/core-cli 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.