@erc725/erc725.js
Allows for interacting with ERC725Y compliant contracts on an EVM blockchain.
For more information see the Documentation.
Installation
npm install @erc725/erc725.js
import { ERC725 } from '@erc725/erc725.js';
import ERC725 from '@erc725/erc725.js';
If you install it on the backend side, you may need to also install isomorphic-fetch
.
Instantiation
You need to initialise the ERC725 object with a schema, a contract address, and an RPC URL.
const address = '0x0Dc07C77985fE31996Ed612F568eb441afe5768D';
const RPC_URL = 'https://rpc.testnet.lukso.network';
const config = {
ipfsGateway: 'https://YOUR-IPFS-GATEWAY/ipfs/',
gas: 20_000_000,
};
TypeScript
If you are using ES6 import
statements in Node.js, make sure your file has a .mjs
extension, or that your project is set up to support ES6 modules.
import { ERC725, ERC725JSONSchema } from '@erc725/erc725.js';
const schemas: ERC725JSONSchema[] = [
{
name: 'SupportedStandards:LSP3Profile',
key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347',
keyType: 'Mapping',
valueType: 'bytes',
valueContent: '0x5ef83ad9',
},
{
name: 'LSP3Profile',
key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5',
keyType: 'Singleton',
valueType: 'bytes',
valueContent: 'VerifiableURI',
},
{
name: 'LSP1UniversalReceiverDelegate',
key: '0x0cfc51aec37c55a4d0b1a65c6255c4bf2fbdf6277f3cc0730c45b828b6db8b47',
keyType: 'Singleton',
valueType: 'address',
valueContent: 'Address',
},
];
const erc725 = new ERC725(schemas, address, RPC_URL, config);
JavaScript
import { ERC725 } require('@erc725/erc725.js');
const schemas = [
{
name: 'SupportedStandards:LSP3Profile',
key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347',
keyType: 'Mapping',
valueType: 'bytes',
valueContent: '0x5ef83ad9',
},
{
name: 'LSP3Profile',
key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5',
keyType: 'Singleton',
valueType: 'bytes',
valueContent: 'VerifiableURI',
},
{
name: 'LSP1UniversalReceiverDelegate',
key: '0x0cfc51aec37c55a4d0b1a65c6255c4bf2fbdf6277f3cc0730c45b828b6db8b47',
keyType: 'Singleton',
valueType: 'address',
valueContent: 'Address',
},
];
const erc725 = new ERC725(schemas, address, RPC_URL, config);
Usage
await myErc725.getOwner();
await myErc725.getData();
await myErc725.fetchData();
For more information 👉 check the docs.
Contributing
Please check CONTRIBUTING.
License
erc725.js is Apache 2.0 licensed.