@lukso/lsp-factory.js
Deprecated: The development of this library is currently put on hold, please use the LSP-smart-contracts directly
Helper library to allow simple deployments of UniversalProfiles and LSP7 and LSP8 Digital Assets.
For more information see Documentation.
npm install @lukso/lsp-factory.js
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
});
// 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;
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);
},
},
}
);
Please check CONTRIBUTING.
lsp-factory.js is Apache 2.0 licensed.