
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@lukso/lsp-smart-contracts
Advanced tools
The reference smart contract implementation for the LUKSO LSP standards
@lukso/lsp-smart-contracts
This is the "umbrella" package for the LSP smart contracts. It contains all the individual @lukso/lspN-contracts
packages (where N
is an LSP number) as dependencies.
npm install @lukso/lsp-smart-contracts
The JSON ABIs of the smart contracts can be imported as follow:
import LSP0ERC725Account from "@lukso/lsp-smart-contracts/artifacts/LSP0ERC725Account.json";
const myContract = new web3.eth.Contract(
LSP0ERC725Account.abi,
"",
defaultOptions
);
import "@lukso/lsp-smart-contracts/contracts/LSP0ERC725Account/LSP0ERC725Account.sol";
contract MyAccount is LSP0ERC725Account {
constructor(address _newOwner) LSP0ERC725Account(_newOwner) {}
}
The @lukso/lsp-smart-contracts
npm package contains useful constants such as interface IDs, and ERC725Y data keys related to the LSP Standards. You can import and access them as follows.
import {
INTERFACE_IDS,
ERC1271,
LSP8_TOKEN_ID_FORMAT,
LSP1_TYPE_IDS,
OPERATION_TYPES,
PERMISSIONS,
ALL_PERMISSIONS,
SupportedStandards,
ERC725YDataKeys,
INTERFACE_ID_LSP1DELEGATE,
LSP6DataKeys,
LSP25_VERSION,
LSPSupportedStandard,
ErrorSelectors,
EventSigHashes,
FunctionSelectors,
ContractsDocs,
StateVariables,
} from "@lukso/lsp-smart-contracts";
Note: we also export it as
@lukso/lsp-smart-contracts/constants
or@lukso/lsp-smart-contracts/constants.js
to keep it backward compatible.
It also includes constant values Array data keys to retrieve both the array length and for index access.
'LSP5ReceivedAssets[]': {
length: '0x6460ee3c0aac563ccbf76d6e1d07bada78e3a9514e6382b736ed3f478ab7b90b',
index: '0x6460ee3c0aac563ccbf76d6e1d07bada',
},
If you are trying to import the constants in a Hardhat project that uses Typescript, you will need to import the constants from the dist
folder directly, as shown in the code snippet:
import { INTERFACE_IDS } from "@lukso/lsp-smart-contracts/dist/constants.cjs.js";
// This will raise an error if you have ES Lint enabled,
// but will allow you to import the constants in a Hardhat + Typescript based project.
const LSP0InterfaceId = INTERFACE_IDS.LSP0ERC725Account;
See the issue related to Hardhat Typescript + ES Modules in the Hardhat docs for more infos.
The following additional typescript types are also available, including types for the JSON format of the LSP3 Profile and LSP4 Digital Asset metadata.
import {
LSP2ArrayKey,
LSPSupportedStandard,
LSP6PermissionName,
LSP3ProfileMetadataJSON,
LSP3ProfileMetadata,
LSP4DigitalAssetMetadataJSON,
LSP4DigitalAssetMetadata,
ImageMetadata,
LinkMetadata,
AssetMetadata,
} from "@lukso/lsp-smart-contracts";
You can also import the type-safe ABI of each LSP smart contracts from the /abi
path.
import {
lsp0Erc725AccountAbi,
lsp6KeyManagerAbi,
lsp7DigitalAssetAbi,
lsp8IdentifiableDigitalAssetAbi,
} from "@lukso/lsp-smart-contracts/abi";
FAQs
The reference smart contract implementation for the LUKSO LSP standards
We found that @lukso/lsp-smart-contracts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.