
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
aelf-contract-viewer
Advanced tools
A React component to view and interact with Aelf smart contracts
The aelf-contract-viewer is a React component that provides an easy interface to view and interact with smart contracts on the Aelf blockchain. You can use this component to input contract details and view available read and write methods. This tool is useful for developers building applications around Aelf smart contracts, allowing easy testing and interaction with deployed contracts.
You can install the package using npm:
npm install aelf-contract-viewer
import React from "react";
import { ContractView } from "aelf-contract-viewer";
const App = () => {
return (
<div>
<ContractView
address="your_smart_contract_address"
rpcUrl="rpc_url" // i.e = https://explorer-test-side02.aelf.io/chain
contractName="Smart Contract Name"
/>
</div>
);
};
export default App;
Prop | Type | Default | Description |
---|---|---|---|
wallet | IWalletInfo | undefined | Optional wallet info. If not provided, a new wallet is generated. |
headerTitle | string | "Aelf Contract View" | Title for the contract view header. |
headerShown | boolean | true | Whether the header should be shown or not. |
address | string | undefined | Address of the contract. If not provided, a default contract address is fetched from the Aelf blockchain. |
contractName | string | "Contract" | The name of the contract to be displayed. |
rpcUrl | string | "https://explorer-test-side02.aelf.io/chain" | The RPC URL to connect to the Aelf blockchain. |
The above example demonstrates how to use the ContractView
component. You only need to pass in the contract's address, RPC URL, and optionally the contract name.
The ContractView
component displays the available read and write methods from the given smart contract. Once loaded, the methods are grouped as follows:
If you want to specify your own wallet, you can pass the wallet
prop. If you don’t provide a wallet, the component will create a new wallet for you and interact with the blockchain using that.
import React from "react";
import { ContractView } from "aelf-contract-viewer";
import AElf from "aelf-sdk";
const App = () => {
const wallet = AElf.wallet.getWalletByPrivateKey("YOUR_PRIVATE_KEY");
return (
<div>
<ContractView
wallet={wallet}
address="your_smart_contract_address"
rpcUrl="rpc_url" // i.e = https://explorer-test-side02.aelf.io/chain
contractName="Smart Contract Name"
/>
</div>
);
}
export default App;
We welcome contributions to this project. If you find any bugs or want to add new features, feel free to submit a pull request or open an issue on the GitHub repository.
FAQs
A React component to view and interact with Aelf smart contracts
We found that aelf-contract-viewer 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.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.