3.3.1 • Published 4 months ago

@lukso/lsp-factory.js v3.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Install

npm install @lukso/lsp-factory.js

Setup

import { LSPFactory } from '@lukso/lsp-factory.js';

const provider = 'https://rpc.testnet.lukso.network'; // RPC url used to connect to the network

const lspFactory = new LSPFactory(provider, {
  deployKey: '0x...'; // Private key of the account which will deploy UPs
  chainId: 2828, // Chain Id of the network you want to connect to
});

Usage

Deploying an ERC725Account (Universal Profile)

// Deploy LSP3 Account
const myContracts = await lspFactory.UniversalProfile.deploy({
  controllerAddresses: ['0x...'], // Address which will controll the UP
  lsp3Profile: {
    name: 'My Universal Profile',
    description: 'My cool Universal Profile',
    profileImage: [
      {
        width: 500,
        height: 500,
        verification: {
          method: 'keccak256(bytes)',
          data: '0xfdafad027ecfe57eb4ad047b938805d1dec209d6e9f960fc320d7b9b11cbed14',
        },
        url: 'ipfs://QmPLqMFHxiUgYAom3Zg4SiwoxDaFcZpHXpCmiDzxrtjSGp',
      },
    ],
    backgroundImage: [
      {
        width: 500,
        height: 500,
        verification: {
          method: 'keccak256(bytes)',
          data: '0xfdafad027ecfe57eb4ad047b938805d1dec209d6e9f960fc320d7b9b11cbed14',
        },
        url: 'ipfs://QmPLqMFHxiUgYAom3Zg4SiwoxDaFcZpHXpCmiDzxrtjSGp',
      },
    ],
    tags: ['Fashion', 'Design'],
    links: [{ title: 'My Website', url: 'www.my-website.com' }],
  },
});

const myUPAddress = myContracts.LSP0ERC725Account.address;

Using Deployment events

The onDeployEvents option can be used to for real-time frontend updates.

const profileDeploymentEvents = [];

const myContracts = await lspFactory.UniversalProfile.deploy(
  {
    controllerAddresses: ['0x...'], // Address which will controll the UP
  },
  {
    onDeployEvents: {
      next: (deploymentEvent: DeploymentEvent) => {
        profileDeploymentEvents.push(deploymentEvent);
      },
      error: (error) => {
        console.error(error);
      },
      complete: () => {
        console.log(profileDeploymentEvents);
      },
    },
  }
);

Contributing

Please check CONTRIBUTING.

License

lsp-factory.js is Apache 2.0 licensed.

3.3.1

4 months ago

3.2.1

6 months ago

3.2.0

6 months ago

3.1.1

8 months ago

3.1.0

8 months ago

3.0.0

9 months ago

2.5.0

1 year ago

2.5.1

1 year ago

2.4.0

2 years ago

2.3.2

2 years ago

2.3.1

2 years ago

2.3.3

2 years ago

2.3.0

2 years ago

2.2.0

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.1

3 years ago

1.0.2-alpha.8

3 years ago

1.0.2-alpha.9

3 years ago

1.0.2-alpha.7

3 years ago

1.1.2

3 years ago

1.0.2-alpha.6

3 years ago

1.0.2-alpha.5

3 years ago

1.0.2-alpha.4

3 years ago

1.1.0

3 years ago