Socket
Socket
Sign inDemoInstall

erc725.js

Package Overview
Dependencies
85
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    erc725.js

Library to interact with ERC725 smart contracts


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

ERC725.js

This library allows for interfacing with ERC725Y compliant contract on an EVM using the ERC725YJSONSchema.

For more information see Documentation.

This package is currently in early stages of development, use only for testing or experimentation purposes

Installation

npm

$ npm install erc725.js
import ERC725 from "erc725.js";
// Or alternately the named export in cases where it
// assists with integration into node modules or commonjs.
import { ERC725 } from "erc725.js";

Example Instantiation

let myERC725Address = "0x0c03fba782b07bcf810deb3b7f0595024a444f4e";
let myProvider = new Web3.providers.HttpProvider("https://rpc.l14.lukso.network");

// Part of LSP3-UniversalProfile Schema
// https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-3-UniversalProfile.md
const mySchema = [
  {
    name: "SupportedStandards:ERC725Account",
    key: "0xeafec4d89fa9619884b6b89135626455000000000000000000000000afdeb5d6",
    keyType: "Mapping",
    valueContent: "0xafdeb5d6",
    valueType: "bytes",
  },
  {
    name: "LSP3Profile",
    key: "0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5",
    keyType: "Singleton",
    valueContent: "JSONURL",
    valueType: "bytes",
  },
  {
    name: "LSP1UniversalReceiverDelegate",
    key: "0x0cfc51aec37c55a4d0b1a65c6255c4bf2fbdf6277f3cc0730c45b828b6db8b47",
    keyType: "Singleton",
    valueContent: "Address",
    valueType: "address",
  },
];

let myERC725 = new ERC725(schema[, address, provider, ipfsGateway])

Usage

await erc725.getOwner();
// > '0x28D25E70819140daF65b724158D00c373D1a18ee'

await erc725.getData("SupportedStandards:ERC725Account");
// > '0xafdeb5d6'

await erc725.getData("LSP3Profile");
/* >
{
    url: 'ipfs://QmXybv2LdJWscy1C6yRKUjvnaj6aqKktZX4g4xmz2nyYj2',
    hash: '0xb4f9d72e83bbe7e250ed9ec80332c493b7b3d73e0d72f7b2c7ab01c39216eb1a',
    hashFunction: 'keccak256(utf8)'
}
*/

await erc725.fetchData("LSP3Profile"); // downloads and verifies the linked JSON
/* > 
{
    LSP3Profile: {
        name: 'frozeman',
        description: 'The inventor of ERC725 and ERC20...',
        links: [
            { title: 'Twitter', url: 'https://twitter.com/feindura' },
            { title: 'lukso.network', url: 'https://lukso.network' }
        ],
        ...
    }
}
*/

Bundling for typescript

$ npm run build

This will build the library into /lib

Testing

$ npm test

Publishing

$npm run build-publish

Will build and then publish the package to npm.

Keywords

FAQs

Last updated on 20 May 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc