Helper library to allow simple deployments of Universal Profiles, LSP7 Digital Assets, and LSP8 Identifiable Digital Assets on LUKSO.
For more information see the LUKSO Documentation.
This library deploys contracts via LSP23LinkedContractsFactory, which is deployed at the same address on all supported chains via the Nick Factory for deterministic addresses:
LSP23 Factory Address: 0x2300000A84D25dF63081feAa37ba6b62C4c89a30
| Network | Chain ID |
|---|---|
| LUKSO Mainnet | 42 |
| LUKSO Testnet | 4201 |
| Ethereum Mainnet | 1 |
| BASE | 8453 |
All base contract implementations (ERC725Account, KeyManager, UniversalReceiverDelegate, LSP7, LSP8) are also deployed at the same addresses across chains via the Nick Factory.
npm install @lukso/lsp-factory.js@lukso/lsp-factory.js v4 uses viem for blockchain interactions. You need a PublicClient (for reading) and a WalletClient (for signing transactions).
import { createPublicClient, createWalletClient, http } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { luksoTestnet } from 'viem/chains';
import { LSPFactory } from '@lukso/lsp-factory.js';
const account = privateKeyToAccount('0x...');
const publicClient = createPublicClient({
chain: luksoTestnet,
transport: http(),
});
const walletClient = createWalletClient({
account,
chain: luksoTestnet,
transport: http(),
});
const factory = new LSPFactory(publicClient, walletClient);Deploys a Universal Profile (LSP0) and KeyManager (LSP6) atomically via LSP23LinkedContractsFactory, then configures controller permissions and a Universal Receiver Delegate.
const contracts = await factory.UniversalProfile.deploy({
controllerAddresses: ['0x...'], // Addresses that will control the UP
});
console.log('UP Address:', contracts.LSP0ERC725Account.address);
console.log('KeyManager Address:', contracts.LSP6KeyManager.address);const contracts = await factory.UniversalProfile.deploy(
{
controllerAddresses: ['0x...'],
lsp3DataValue: '0x...', // Pre-encoded LSP3Profile data (VerifiableURI)
},
{
salt: '0x...', // bytes32 salt for deterministic address generation
}
);const contracts = await factory.UniversalProfile.deploy({
controllerAddresses: [
'0xFullPermissionsAddress', // Gets ALL_PERMISSIONS by default
{
address: '0xLimitedAddress',
permissions: '0x0000000000000000000000000000000000000000000000000000000000000010',
},
],
});Compute the UP and KeyManager addresses before deploying:
const { upAddress, keyManagerAddress } = await factory.UniversalProfile.computeAddress(
{ controllerAddresses: ['0x...'] },
{ salt: '0x...' } // Use the same salt you will deploy with
);Deploys an LSP7 Digital Asset (fungible token) as a minimal proxy:
const contracts = await factory.LSP7DigitalAsset.deploy({
name: 'My Token',
symbol: 'MTK',
controllerAddress: '0x...', // Owner of the token contract
tokenType: 0, // 0 = Token, 1 = NFT, 2 = Collection
isNFT: false, // Whether the token is non-divisible
});
console.log('LSP7 Address:', contracts.LSP7DigitalAsset.address);const contracts = await factory.LSP7DigitalAsset.deploy({
name: 'My Token',
symbol: 'MTK',
controllerAddress: '0x...',
tokenType: 0,
isNFT: false,
digitalAssetMetadata: {
verification: {
method: 'keccak256(utf8)',
data: '0x...',
},
url: 'ipfs://Qm...',
},
});Deploys an LSP8 Identifiable Digital Asset (NFT) as a minimal proxy:
const contracts = await factory.LSP8IdentifiableDigitalAsset.deploy({
name: 'My NFT Collection',
symbol: 'MNFT',
controllerAddress: '0x...',
tokenType: 1, // 0 = Token, 1 = NFT, 2 = Collection
tokenIdFormat: 1, // Token ID format (e.g., 1 = Number)
});
console.log('LSP8 Address:', contracts.LSP8IdentifiableDigitalAsset.address);All deploy methods accept an onDeployEvents callback for tracking deployment progress:
const contracts = await factory.UniversalProfile.deploy(
{ controllerAddresses: ['0x...'] },
{
onDeployEvents: {
next: (event) => {
console.log(event.status, event.contractName, event.functionName);
},
error: (error) => {
console.error('Deployment error:', error);
},
complete: (deployedContracts) => {
console.log('Deployment complete:', deployedContracts);
},
},
}
);npm installnpm run lint
npm run lint:fix # auto-fixnpm run buildnpm testPlease check CONTRIBUTING.
lsp-factory.js is Apache 2.0 licensed.