forked from kaspa-kcoin/kaspa-web3.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.ts
More file actions
45 lines (39 loc) · 1.44 KB
/
deploy.ts
File metadata and controls
45 lines (39 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { RpcClient, NetworkId, Resolver, kaspaToSompi } from '../../src';
import { Krc721RpcClient } from '../../src/krc721/rpc-client';
async function deployKrc721Collection() {
const privateKey = 'your-private-key-hex-here';
const networkId = NetworkId.Testnet10;
const rpcClient = new RpcClient({ resolver: new Resolver(), networkId });
const krc721client = new Krc721RpcClient({ networkId, rpcClient });
// Define the deployment options
const tick = 'TEST721';
const maxSupply = '1000'; // Maximum 1000 NFTs in this collection
const priorityFee = kaspaToSompi(1000); // 1000 KAS fee for deployment
// Optional metadata
const metadata = {
name: 'Test Collection',
description: 'A test NFT collection',
image: 'ipfs://QmYourCIDHere/collection.png',
attributes: [
{
traitType: 'category',
value: 'test'
}
]
};
try {
const deployOptions = {
tick,
max: maxSupply,
metadata,
royaltyFee: kaspaToSompi(0.1).toString(), // 0.1 KAS royalty per mint
royaltyTo: 'kaspatest:qrcln7p9ggre8wdmcvm85pqp083sqlrqwpayzrl4xwn4k42lcxlhx6e89pls9' // Royalty recipient
};
const transactionId = await krc721client.deploy(deployOptions, priorityFee, privateKey);
console.log(`Deploy successful! Transaction ID: ${transactionId}`);
} catch (error) {
console.error('Deploy failed:', error);
}
}
// Run with: bun run examples/krc721/deploy.ts
deployKrc721Collection();