@paulstinchcombe/gasless-nft-tx 0.4.8 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +547 -279
- package/dist/KAMI-NFTs/KAMI1155C.sol +933 -0
- package/dist/KAMI-NFTs/KAMI721AC.sol +680 -0
- package/dist/KAMI-NFTs/KAMI721C.sol +649 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/kami-gasless-with-libraries.d.ts +42 -0
- package/dist/kami-gasless-with-libraries.d.ts.map +1 -1
- package/dist/kami-gasless-with-libraries.js +121 -0
- package/dist/kami-gasless-with-libraries.js.map +1 -1
- package/package.json +6 -5
- package/src/KAMI-NFTs/README.md +0 -361
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/KAMI1155C.sol/KAMI1155C.dbg.json +0 -0
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/KAMI1155C.sol/KAMI1155C.json +0 -0
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/KAMI721AC.sol/KAMI721AC.dbg.json +0 -0
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/KAMI721AC.sol/KAMI721AC.json +0 -0
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/KAMI721C.sol/KAMI721C.dbg.json +0 -0
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/KAMI721C.sol/KAMI721C.json +0 -0
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/libraries/KamiNFTCore.sol/IExists.dbg.json +0 -0
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/libraries/KamiNFTCore.sol/IExists.json +0 -0
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/libraries/KamiNFTCore.sol/KamiNFTCore.dbg.json +0 -0
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/libraries/KamiNFTCore.sol/KamiNFTCore.json +0 -0
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/libraries/KamiPlatform.sol/KamiPlatform.dbg.json +0 -0
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/libraries/KamiPlatform.sol/KamiPlatform.json +0 -0
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/libraries/KamiRental.sol/KamiRental.dbg.json +0 -0
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/libraries/KamiRental.sol/KamiRental.json +0 -0
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/libraries/KamiRoyalty.sol/KamiRoyalty.dbg.json +0 -0
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/libraries/KamiRoyalty.sol/KamiRoyalty.json +0 -0
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/libraries/KamiTransfer.sol/KamiTransfer.dbg.json +0 -0
- /package/{src → dist}/KAMI-NFTs/artifacts/contracts/libraries/KamiTransfer.sol/KamiTransfer.json +0 -0
package/README.md
CHANGED
|
@@ -1,405 +1,673 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Gasless NFT Transactions Library
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A comprehensive TypeScript library for deploying and managing KAMI NFT contracts with truly gasless transactions using EIP-4337 Account Abstraction and SimpleAccount.
|
|
4
4
|
|
|
5
|
-
## 🎯
|
|
5
|
+
## 🎯 What This Library Does
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
- **🔧 Flexible Deployment**: Deploy NFTs with SimpleAccount as owner from the start
|
|
13
|
-
- **📦 Batch Operations**: Execute multiple operations across different contracts
|
|
14
|
-
- **💰 Backend Minting**: Alternative backend-controlled minting for maximum reliability
|
|
15
|
-
- **🔢 Quantity Support**: Batch minting and purchasing with quantity parameters
|
|
16
|
-
- **📘 TypeScript First**: Full type safety with comprehensive IntelliSense support
|
|
17
|
-
- **🎭 Multiple NFT Standards**: Support for ERC-721, ERC-721A, and ERC-1155
|
|
18
|
-
- **🆕 Enhanced Mint Results**: Get tokenId, recipient, and contract info automatically from mints
|
|
19
|
-
- **✅ Well Tested**: Comprehensive test suite with vitest
|
|
20
|
-
- **🛡️ Robust Error Handling**: Automatic retry and recovery mechanisms
|
|
21
|
-
- **🔮 Deterministic Addresses**: Predictable SimpleAccount addresses using CREATE2
|
|
7
|
+
- ✅ **Truly Gasless Deployments** - Deploy NFT contracts where SimpleAccount pays all gas
|
|
8
|
+
- ✅ **Three NFT Standards** - Support for KAMI721C (ERC721), KAMI721AC (ERC721A), and KAMI1155C (ERC1155)
|
|
9
|
+
- ✅ **Creator Features** - Built-in royalties, rentals, and platform fees
|
|
10
|
+
- ✅ **Library Linking** - Automatic handling of Solidity library dependencies
|
|
11
|
+
- ✅ **Type-Safe** - Full TypeScript support with comprehensive type definitions
|
|
22
12
|
|
|
23
|
-
##
|
|
13
|
+
## 📋 Table of Contents
|
|
24
14
|
|
|
25
|
-
|
|
15
|
+
- [Quick Start](#quick-start)
|
|
16
|
+
- [Complete Setup Guide](#complete-setup-guide)
|
|
17
|
+
- [Step 1: Environment Setup](#step-1-environment-setup)
|
|
18
|
+
- [Step 2: Deploy SimpleAccount](#step-2-deploy-simpleaccount)
|
|
19
|
+
- [Step 3: Deploy ContractDeployer](#step-3-deploy-contractdeployer)
|
|
20
|
+
- [Step 4: Deploy KAMI Libraries](#step-4-deploy-kami-libraries)
|
|
21
|
+
- [Step 5: Deploy Your NFT Contract](#step-5-deploy-your-nft-contract)
|
|
22
|
+
- [Contract Types](#contract-types)
|
|
23
|
+
- [API Reference](#api-reference)
|
|
24
|
+
- [Gas Costs](#gas-costs)
|
|
25
|
+
- [Examples](#examples)
|
|
26
|
+
- [Next.js Deployment](#nextjs-deployment)
|
|
27
|
+
- [Troubleshooting](#troubleshooting)
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Install
|
|
33
|
+
npm install your-package-name
|
|
34
|
+
|
|
35
|
+
# Set environment variables
|
|
36
|
+
export PRIVATE_KEY="0x..."
|
|
37
|
+
export SIMPLE_ACCOUNT_ADDRESS="0x..."
|
|
38
|
+
|
|
39
|
+
# Deploy infrastructure (one-time setup)
|
|
40
|
+
npx tsx examples/gasless-deployment-complete.ts
|
|
41
|
+
export CONTRACT_DEPLOYER_ADDRESS="0x..."
|
|
42
|
+
|
|
43
|
+
# Deploy libraries (one-time setup)
|
|
44
|
+
npx tsx examples/deploy-shared-libraries-example.ts
|
|
45
|
+
|
|
46
|
+
# Deploy your NFT contract (gasless!)
|
|
47
|
+
npx tsx examples/true-gasless-deployment.ts
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Complete Setup Guide
|
|
51
|
+
|
|
52
|
+
### Prerequisites
|
|
53
|
+
|
|
54
|
+
- Node.js 18+ and npm/pnpm
|
|
55
|
+
- An Ethereum wallet with private key
|
|
56
|
+
- ~0.05 ETH on Base Sepolia testnet for initial setup
|
|
57
|
+
|
|
58
|
+
### Step 1: Environment Setup
|
|
59
|
+
|
|
60
|
+
Create a `.env` file in your project:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Your EOA private key (for signing transactions)
|
|
64
|
+
PRIVATE_KEY="0x1234567890abcdef..."
|
|
65
|
+
|
|
66
|
+
# RPC endpoint (Base Sepolia testnet)
|
|
67
|
+
RPC_URL="https://sepolia.base.org"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Step 2: Deploy SimpleAccount
|
|
71
|
+
|
|
72
|
+
SimpleAccount is an EIP-4337 smart contract wallet that will pay for all gas.
|
|
73
|
+
|
|
74
|
+
#### Option A: Using the Library
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { createSimpleAccount, deploySimpleAccountFactory } from 'your-package-name';
|
|
78
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
79
|
+
|
|
80
|
+
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
|
|
81
|
+
|
|
82
|
+
// 1. Deploy SimpleAccountFactory (if not already deployed)
|
|
83
|
+
const factory = await deploySimpleAccountFactory({
|
|
84
|
+
rpcUrl: 'https://sepolia.base.org',
|
|
85
|
+
deployerPrivateKey: process.env.PRIVATE_KEY as `0x${string}`,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
console.log('Factory:', factory.factoryAddress);
|
|
89
|
+
|
|
90
|
+
// 2. Create SimpleAccount for your EOA
|
|
91
|
+
const simpleAccount = await createSimpleAccount({
|
|
92
|
+
rpcUrl: 'https://sepolia.base.org',
|
|
93
|
+
factoryAddress: factory.factoryAddress,
|
|
94
|
+
owner: account.address,
|
|
95
|
+
deployerPrivateKey: process.env.PRIVATE_KEY as `0x${string}`,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
console.log('SimpleAccount:', simpleAccount.accountAddress);
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### Option B: Using Existing SimpleAccount
|
|
102
|
+
|
|
103
|
+
If you already have a SimpleAccount deployed:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
export SIMPLE_ACCOUNT_ADDRESS="0xYourSimpleAccountAddress"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### Funding SimpleAccount
|
|
110
|
+
|
|
111
|
+
SimpleAccount needs ETH to pay for gas:
|
|
26
112
|
|
|
27
113
|
```bash
|
|
28
|
-
|
|
114
|
+
# Send 0.05 ETH to your SimpleAccount
|
|
115
|
+
cast send $SIMPLE_ACCOUNT_ADDRESS \
|
|
116
|
+
--value 0.05ether \
|
|
117
|
+
--private-key $PRIVATE_KEY \
|
|
118
|
+
--rpc-url https://sepolia.base.org
|
|
29
119
|
```
|
|
30
120
|
|
|
31
|
-
**
|
|
121
|
+
**Update `.env`:**
|
|
32
122
|
|
|
33
|
-
|
|
123
|
+
```bash
|
|
124
|
+
SIMPLE_ACCOUNT_ADDRESS="0x..."
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Step 3: Deploy ContractDeployer
|
|
128
|
+
|
|
129
|
+
ContractDeployer is a helper contract that enables gasless deployments via SimpleAccount.
|
|
130
|
+
|
|
131
|
+
**Why needed?** SimpleAccount's `execute()` function can't deploy contracts directly. ContractDeployer acts as a helper that SimpleAccount calls, which then deploys your contracts using the CREATE opcode.
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
npx tsx examples/gasless-deployment-complete.ts
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Expected Output:**
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
✅ Configuration validated
|
|
141
|
+
💰 SimpleAccount balance: 0.050000 ETH
|
|
142
|
+
|
|
143
|
+
🔧 Deploying ContractDeployer helper contract...
|
|
144
|
+
⚠️ NOTE: This deployment requires gas from your EOA (not gasless)
|
|
145
|
+
ContractDeployer is a one-time deployment that enables all future gasless deployments
|
|
34
146
|
|
|
35
|
-
|
|
147
|
+
Transaction: 0xabc123...
|
|
148
|
+
✅ ContractDeployer deployed at: 0xDEF456...
|
|
149
|
+
💾 Save this address for future use!
|
|
150
|
+
📝 This was a one-time cost. All future KAMI deployments will be gasless!
|
|
151
|
+
```
|
|
36
152
|
|
|
37
|
-
|
|
38
|
-
- **[Next.js Artifacts Fix](./docs/NEXTJS_ARTIFACTS_FIX.md)** - Solutions for artifact loading issues
|
|
39
|
-
- **[Complete Dockerfile](./docs/NEXTJS_COMPLETE_DOCKERFILE.md)** - Ready-to-use Dockerfile for Docker
|
|
153
|
+
**Cost:** ~0.001 ETH from your EOA (one-time only)
|
|
40
154
|
|
|
41
|
-
|
|
155
|
+
**Update `.env`:**
|
|
42
156
|
|
|
43
|
-
|
|
157
|
+
```bash
|
|
158
|
+
CONTRACT_DEPLOYER_ADDRESS="0x..."
|
|
159
|
+
```
|
|
44
160
|
|
|
45
|
-
###
|
|
161
|
+
### Step 4: Deploy KAMI Libraries
|
|
46
162
|
|
|
47
|
-
|
|
48
|
-
- **Individual Token URIs**: Set unique metadata for each token
|
|
49
|
-
- **Enhanced Mint Results**: Mint operations now return tokenId and recipient info automatically ✨
|
|
50
|
-
- **Enhanced Security**: Explicit seller/renter parameters prevent impersonation
|
|
51
|
-
- **Better Flexibility**: Dynamic pricing strategies for NFT marketplaces
|
|
52
|
-
- **✅ 90 Tests Passing**: Comprehensive test coverage for all handlers
|
|
163
|
+
KAMI contracts use five shared libraries. Deploy them once and reuse for all NFT contracts.
|
|
53
164
|
|
|
54
|
-
|
|
165
|
+
```bash
|
|
166
|
+
npx tsx examples/deploy-shared-libraries-example.ts
|
|
167
|
+
```
|
|
55
168
|
|
|
56
|
-
|
|
169
|
+
**Expected Output:**
|
|
57
170
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
171
|
+
```
|
|
172
|
+
📚 Deploying all KAMI libraries via SimpleAccount (gasless)...
|
|
173
|
+
🚀 Deploying KamiNFTCore...
|
|
174
|
+
Transaction: 0x...
|
|
175
|
+
✅ Contract deployed at: 0x...
|
|
176
|
+
|
|
177
|
+
[... repeats for all 5 libraries ...]
|
|
178
|
+
|
|
179
|
+
✅ All libraries deployed successfully!
|
|
180
|
+
💾 SAVE THESE ADDRESSES - Reuse them for all future NFT deployments:
|
|
181
|
+
{
|
|
182
|
+
"kamiNFTCore": "0x...",
|
|
183
|
+
"kamiPlatform": "0x...",
|
|
184
|
+
"kamiRoyalty": "0x...",
|
|
185
|
+
"kamiRental": "0x...",
|
|
186
|
+
"kamiTransfer": "0x..."
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Cost:** ~0.008 ETH from SimpleAccount (one-time, reusable)
|
|
191
|
+
|
|
192
|
+
**Update `.env`:**
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
KAMI_NFT_CORE="0x..."
|
|
196
|
+
KAMI_PLATFORM="0x..."
|
|
197
|
+
KAMI_ROYALTY="0x..."
|
|
198
|
+
KAMI_RENTAL="0x..."
|
|
199
|
+
KAMI_TRANSFER="0x..."
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Step 5: Deploy Your NFT Contract
|
|
203
|
+
|
|
204
|
+
Now deploy any KAMI NFT contract completely gaslessly!
|
|
205
|
+
|
|
206
|
+
#### Deploy KAMI721C (Standard ERC721)
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
npx tsx examples/true-gasless-deployment.ts
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
#### Deploy KAMI721AC (ERC721A with Batch Minting)
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
npx tsx examples/deploy-kami721ac-gasless.ts
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
#### Deploy KAMI1155C (ERC1155 Multi-Token)
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
npx tsx examples/deploy-kami1155c-gasless.ts
|
|
222
|
+
```
|
|
63
223
|
|
|
64
|
-
|
|
224
|
+
**Expected Output:**
|
|
65
225
|
|
|
66
|
-
|
|
226
|
+
```
|
|
227
|
+
🚀 Deploying KAMI721C gaslessly with library linking...
|
|
228
|
+
Name: My NFT Collection (MNFT)
|
|
229
|
+
Mint Price: 0.001 ETH
|
|
230
|
+
|
|
231
|
+
📚 Linking libraries to KAMI721C bytecode...
|
|
232
|
+
✅ Bytecode linked, length: 45678 bytes
|
|
233
|
+
|
|
234
|
+
🚀 Deploying contract gaslessly via ContractDeployer...
|
|
235
|
+
📤 Sending deployment transaction via SimpleAccount...
|
|
236
|
+
Transaction: 0x...
|
|
237
|
+
✅ Contract deployed at: 0x...
|
|
238
|
+
|
|
239
|
+
🎉 KAMI721C deployed successfully (gasless)!
|
|
240
|
+
📍 Address: 0x...
|
|
241
|
+
👤 Owner: 0x... (SimpleAccount)
|
|
242
|
+
🔗 Explorer: https://sepolia.basescan.org/address/0x...
|
|
243
|
+
```
|
|
67
244
|
|
|
68
|
-
|
|
69
|
-
- 🎯 **Immediate Gasless Minting**: Mint NFTs immediately after deployment through SimpleAccount
|
|
70
|
-
- 🔍 **Comprehensive NFT Discovery**: Find ALL NFTs owned by any EOA across ALL contracts
|
|
71
|
-
- 🔄 **Streamlined Workflow**: One-step deployment and minting process
|
|
72
|
-
- 🏦 **Funded SimpleAccount**: SimpleAccount pays its own gas for truly gasless user experience
|
|
73
|
-
- 🔧 **Backend Minting**: Alternative approach for maximum reliability
|
|
245
|
+
**Cost:** ~0.015 ETH from SimpleAccount (per deployment)
|
|
74
246
|
|
|
75
|
-
|
|
247
|
+
**Save the contract address:**
|
|
76
248
|
|
|
77
249
|
```bash
|
|
78
|
-
|
|
79
|
-
# or
|
|
80
|
-
pnpm add @paulstinchcombe/gasless-nft-tx
|
|
81
|
-
# or
|
|
82
|
-
yarn add @paulstinchcombe/gasless-nft-tx
|
|
250
|
+
export KAMI721C_ADDRESS="0x..."
|
|
83
251
|
```
|
|
84
252
|
|
|
85
|
-
##
|
|
253
|
+
## Contract Types
|
|
254
|
+
|
|
255
|
+
### KAMI721C - Standard ERC721 with Creator Features
|
|
256
|
+
|
|
257
|
+
**Use for:**
|
|
258
|
+
|
|
259
|
+
- Standard NFT collections
|
|
260
|
+
- Art projects
|
|
261
|
+
- Collectibles
|
|
262
|
+
- Small to medium collections (< 1,000 NFTs)
|
|
86
263
|
|
|
87
|
-
|
|
88
|
-
- **💰 Truly Gasless**: Users never pay gas - SimpleAccount handles everything
|
|
89
|
-
- **🔧 Two Approaches**: Choose between SimpleAccount operations or backend minting
|
|
90
|
-
- **📦 Production Ready**: Battle-tested with comprehensive error handling
|
|
91
|
-
- **🎨 Developer Friendly**: Clean API with full TypeScript support
|
|
264
|
+
**Features:**
|
|
92
265
|
|
|
93
|
-
|
|
266
|
+
- ✅ ERC721 standard compliance
|
|
267
|
+
- ✅ Creator royalties (EIP-2981)
|
|
268
|
+
- ✅ Rental system
|
|
269
|
+
- ✅ Platform fees
|
|
270
|
+
- ✅ Maximum compatibility
|
|
94
271
|
|
|
95
|
-
|
|
272
|
+
**Deployment:**
|
|
96
273
|
|
|
97
274
|
```typescript
|
|
98
|
-
import {
|
|
275
|
+
import { KamiGaslessDeployerWithLibraries, KAMI721CParams } from 'your-package-name';
|
|
276
|
+
import { parseEther, Address } from 'viem';
|
|
99
277
|
|
|
100
|
-
|
|
101
|
-
const ops = createSimpleAccountOperations({
|
|
278
|
+
const deployer = new KamiGaslessDeployerWithLibraries({
|
|
102
279
|
rpcUrl: 'https://sepolia.base.org',
|
|
103
|
-
ownerPrivateKey:
|
|
104
|
-
simpleAccountAddress:
|
|
105
|
-
|
|
280
|
+
ownerPrivateKey: process.env.PRIVATE_KEY as `0x${string}`,
|
|
281
|
+
simpleAccountAddress: process.env.SIMPLE_ACCOUNT_ADDRESS as Address,
|
|
282
|
+
contractDeployerAddress: process.env.CONTRACT_DEPLOYER_ADDRESS as Address,
|
|
283
|
+
libraries: {
|
|
284
|
+
kamiNFTCore: process.env.KAMI_NFT_CORE as Address,
|
|
285
|
+
kamiPlatform: process.env.KAMI_PLATFORM as Address,
|
|
286
|
+
kamiRoyalty: process.env.KAMI_ROYALTY as Address,
|
|
287
|
+
kamiRental: process.env.KAMI_RENTAL as Address,
|
|
288
|
+
kamiTransfer: process.env.KAMI_TRANSFER as Address,
|
|
289
|
+
},
|
|
106
290
|
});
|
|
107
291
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
name: 'My NFT',
|
|
292
|
+
const params: KAMI721CParams = {
|
|
293
|
+
paymentToken: '0x0000000000000000000000000000000000000000', // Native ETH
|
|
294
|
+
name: 'My NFT Collection',
|
|
111
295
|
symbol: 'MNFT',
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
296
|
+
baseTokenURI: 'ipfs://QmYourBaseURI/',
|
|
297
|
+
initialMintPrice: parseEther('0.001'), // 0.001 ETH per mint
|
|
298
|
+
platformAddress: process.env.SIMPLE_ACCOUNT_ADDRESS as Address,
|
|
299
|
+
platformCommissionPercentage: 250, // 2.5%
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
const result = await deployer.deployKAMI721C(params);
|
|
303
|
+
console.log('Deployed at:', result.contractAddress);
|
|
304
|
+
```
|
|
115
305
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
306
|
+
### KAMI721AC - ERC721A with Batch Minting
|
|
307
|
+
|
|
308
|
+
**Use for:**
|
|
309
|
+
|
|
310
|
+
- Large NFT collections (1k-10k+ NFTs)
|
|
311
|
+
- Projects with batch minting needs
|
|
312
|
+
- Gas-efficient launches
|
|
313
|
+
- Generative art projects
|
|
314
|
+
|
|
315
|
+
**Features:**
|
|
316
|
+
|
|
317
|
+
- ✅ ERC721A (batch minting optimization)
|
|
318
|
+
- ✅ Much cheaper batch mints (~90% gas savings)
|
|
319
|
+
- ✅ All Creator features (royalties, rentals)
|
|
320
|
+
- ✅ Perfect for large drops
|
|
321
|
+
|
|
322
|
+
**Deployment:**
|
|
323
|
+
|
|
324
|
+
```typescript
|
|
325
|
+
const params: KAMI721ACParams = {
|
|
326
|
+
paymentToken: '0x0000000000000000000000000000000000000000',
|
|
327
|
+
name: 'Creator Collection',
|
|
328
|
+
symbol: 'CNFT',
|
|
329
|
+
baseTokenURI: 'ipfs://QmYourBaseURI/',
|
|
330
|
+
initialMintPrice: parseEther('0.001'),
|
|
331
|
+
platformAddress: process.env.SIMPLE_ACCOUNT_ADDRESS as Address,
|
|
332
|
+
platformCommissionPercentage: 250,
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
const result = await deployer.deployKAMI721AC(params);
|
|
124
336
|
```
|
|
125
337
|
|
|
126
|
-
|
|
338
|
+
**Batch Minting Example:**
|
|
339
|
+
Mint 10 NFTs for nearly the same gas cost as minting 1!
|
|
340
|
+
|
|
341
|
+
### KAMI1155C - ERC1155 Multi-Token
|
|
342
|
+
|
|
343
|
+
**Use for:**
|
|
344
|
+
|
|
345
|
+
- Gaming projects (items, currencies, characters)
|
|
346
|
+
- Multi-edition artworks
|
|
347
|
+
- Mixed fungible/non-fungible tokens
|
|
348
|
+
- Membership tiers
|
|
349
|
+
|
|
350
|
+
**Features:**
|
|
351
|
+
|
|
352
|
+
- ✅ ERC1155 multi-token standard
|
|
353
|
+
- ✅ Multiple token IDs in one contract
|
|
354
|
+
- ✅ Fungible and non-fungible support
|
|
355
|
+
- ✅ Very gas efficient
|
|
356
|
+
- ✅ All Creator features
|
|
357
|
+
|
|
358
|
+
**Deployment:**
|
|
127
359
|
|
|
128
360
|
```typescript
|
|
129
|
-
|
|
361
|
+
const params: KAMI1155CParams = {
|
|
362
|
+
paymentToken: '0x0000000000000000000000000000000000000000',
|
|
363
|
+
baseTokenURI: 'ipfs://QmYourBaseURI/{id}.json', // {id} auto-replaced
|
|
364
|
+
initialMintPrice: parseEther('0.001'),
|
|
365
|
+
platformAddress: process.env.SIMPLE_ACCOUNT_ADDRESS as Address,
|
|
366
|
+
platformCommissionPercentage: 250,
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
const result = await deployer.deployKAMI1155C(params);
|
|
370
|
+
```
|
|
130
371
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
372
|
+
## API Reference
|
|
373
|
+
|
|
374
|
+
### KamiGaslessDeployerWithLibraries
|
|
375
|
+
|
|
376
|
+
Main class for deploying KAMI contracts gaslessly.
|
|
377
|
+
|
|
378
|
+
#### Constructor
|
|
379
|
+
|
|
380
|
+
```typescript
|
|
381
|
+
constructor(config: GaslessDeployConfig)
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
**Parameters:**
|
|
385
|
+
|
|
386
|
+
- `rpcUrl` (string): RPC endpoint URL
|
|
387
|
+
- `ownerPrivateKey` (`0x${string}`): Private key for signing
|
|
388
|
+
- `simpleAccountAddress` (Address): Your SimpleAccount address
|
|
389
|
+
- `contractDeployerAddress` (Address): ContractDeployer helper address
|
|
390
|
+
- `libraries` (LibraryAddresses): Deployed library addresses
|
|
391
|
+
|
|
392
|
+
#### Methods
|
|
393
|
+
|
|
394
|
+
##### deployKAMI721C
|
|
395
|
+
|
|
396
|
+
```typescript
|
|
397
|
+
async deployKAMI721C(params: KAMI721CParams): Promise<DeploymentResult>
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
Deploy a KAMI721C contract (ERC721 + Creator).
|
|
136
401
|
|
|
137
|
-
|
|
138
|
-
const result = await nftListing.discoverAllNftsForOwner('0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6');
|
|
402
|
+
**Parameters:**
|
|
139
403
|
|
|
140
|
-
|
|
141
|
-
|
|
404
|
+
- `paymentToken` (Address): Payment token address (0x0 for ETH)
|
|
405
|
+
- `name` (string): NFT collection name
|
|
406
|
+
- `symbol` (string): NFT collection symbol
|
|
407
|
+
- `baseTokenURI` (string): Base URI for token metadata
|
|
408
|
+
- `initialMintPrice` (bigint): Price per mint in wei
|
|
409
|
+
- `platformAddress` (Address): Platform fee recipient
|
|
410
|
+
- `platformCommissionPercentage` (number): Platform fee (250 = 2.5%)
|
|
142
411
|
|
|
143
|
-
|
|
144
|
-
const byContract = result.tokens?.reduce((acc, token) => {
|
|
145
|
-
const contract = token.contractAddress;
|
|
146
|
-
if (!acc[contract]) acc[contract] = [];
|
|
147
|
-
acc[contract].push(token);
|
|
148
|
-
return acc;
|
|
149
|
-
}, {} as Record<string, typeof result.tokens>);
|
|
412
|
+
**Returns:**
|
|
150
413
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
414
|
+
```typescript
|
|
415
|
+
{
|
|
416
|
+
success: boolean;
|
|
417
|
+
contractAddress?: Address;
|
|
418
|
+
transactionHash?: string;
|
|
419
|
+
error?: string;
|
|
154
420
|
}
|
|
155
421
|
```
|
|
156
422
|
|
|
157
|
-
|
|
423
|
+
##### deployKAMI721AC
|
|
158
424
|
|
|
159
425
|
```typescript
|
|
160
|
-
|
|
426
|
+
async deployKAMI721AC(params: KAMI721ACParams): Promise<DeploymentResult>
|
|
427
|
+
```
|
|
161
428
|
|
|
162
|
-
|
|
163
|
-
const mintHandler = createBackendMintHandler({
|
|
164
|
-
rpcUrl: 'https://sepolia.base.org',
|
|
165
|
-
nftContractAddress: '0x...', // Deployed NFT contract
|
|
166
|
-
ownerPrivateKey: '0x...', // Backend EOA private key
|
|
167
|
-
simpleAccountAddress: '0x...', // SimpleAccount address
|
|
168
|
-
chain: baseSepolia,
|
|
169
|
-
});
|
|
429
|
+
Deploy a KAMI721AC contract (ERC721A + Creator).
|
|
170
430
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
431
|
+
Same parameters as KAMI721C.
|
|
432
|
+
|
|
433
|
+
##### deployKAMI1155C
|
|
434
|
+
|
|
435
|
+
```typescript
|
|
436
|
+
async deployKAMI1155C(params: KAMI1155CParams): Promise<DeploymentResult>
|
|
177
437
|
```
|
|
178
438
|
|
|
179
|
-
|
|
439
|
+
Deploy a KAMI1155C contract (ERC1155 + Creator).
|
|
440
|
+
|
|
441
|
+
**Parameters:**
|
|
442
|
+
|
|
443
|
+
- `paymentToken` (Address): Payment token address
|
|
444
|
+
- `baseTokenURI` (string): Base URI with {id} placeholder
|
|
445
|
+
- `initialMintPrice` (bigint): Price per token in wei
|
|
446
|
+
- `platformAddress` (Address): Platform fee recipient
|
|
447
|
+
- `platformCommissionPercentage` (number): Platform fee percentage
|
|
448
|
+
|
|
449
|
+
##### getBalance
|
|
180
450
|
|
|
181
451
|
```typescript
|
|
182
|
-
|
|
183
|
-
|
|
452
|
+
async getBalance(): Promise<bigint>
|
|
453
|
+
```
|
|
184
454
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
455
|
+
Get SimpleAccount's current ETH balance.
|
|
456
|
+
|
|
457
|
+
### Type Definitions
|
|
458
|
+
|
|
459
|
+
```typescript
|
|
460
|
+
// Library addresses (shared by all contracts)
|
|
461
|
+
interface LibraryAddresses {
|
|
462
|
+
kamiNFTCore: Address;
|
|
463
|
+
kamiPlatform: Address;
|
|
464
|
+
kamiRoyalty: Address;
|
|
465
|
+
kamiRental: Address;
|
|
466
|
+
kamiTransfer: Address;
|
|
467
|
+
}
|
|
192
468
|
|
|
193
|
-
//
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
if (result.success && result.tokenId) {
|
|
201
|
-
console.log('✅ Minted successfully!');
|
|
202
|
-
console.log(` Token ID: ${result.tokenId}`);
|
|
203
|
-
console.log(` Recipient: ${result.recipient}`);
|
|
204
|
-
console.log(` Contract: ${result.contractAddress}`);
|
|
205
|
-
console.log(` Transaction: ${result.transactionHash}`);
|
|
206
|
-
|
|
207
|
-
// Use tokenId immediately for subsequent operations!
|
|
208
|
-
await handler.setPrice(result.tokenId, 2000000n);
|
|
209
|
-
await handler.setTokenURI(result.tokenId, 'ipfs://QmUpdatedHash');
|
|
210
|
-
|
|
211
|
-
// Save to database
|
|
212
|
-
await db.nfts.create({
|
|
213
|
-
tokenId: result.tokenId.toString(),
|
|
214
|
-
contractAddress: result.contractAddress,
|
|
215
|
-
recipient: result.recipient,
|
|
216
|
-
transactionHash: result.transactionHash,
|
|
217
|
-
});
|
|
469
|
+
// Deployment result
|
|
470
|
+
interface DeploymentResult {
|
|
471
|
+
success: boolean;
|
|
472
|
+
contractAddress?: Address;
|
|
473
|
+
transactionHash?: string;
|
|
474
|
+
error?: string;
|
|
218
475
|
}
|
|
219
476
|
```
|
|
220
477
|
|
|
221
|
-
|
|
478
|
+
## Gas Costs
|
|
222
479
|
|
|
223
|
-
|
|
224
|
-
- ✅ `KAMI721AC.mint()` - Returns tokenId, recipient, contract address
|
|
225
|
-
- ✅ `KAMI721AC.batchClaimFor()` - Returns tokenIds array, recipients array
|
|
226
|
-
- ✅ `KAMI1155C.mint()` - Returns tokenId, amount, recipient, contract address
|
|
227
|
-
- ✅ `KAMI1155C.mintBatch()` - Returns tokenIds array, amounts array, recipients array
|
|
480
|
+
All costs are estimates on Base Sepolia. Mainnet costs may vary.
|
|
228
481
|
|
|
229
|
-
|
|
482
|
+
### One-Time Setup Costs
|
|
230
483
|
|
|
231
|
-
|
|
484
|
+
| Item | Who Pays | Cost | Frequency |
|
|
485
|
+
| -------------------- | ------------- | ---------- | ------------- |
|
|
486
|
+
| **SimpleAccount** | EOA | ~0.005 ETH | Once per user |
|
|
487
|
+
| **ContractDeployer** | EOA | ~0.001 ETH | Once ever |
|
|
488
|
+
| **KAMI Libraries** | SimpleAccount | ~0.008 ETH | Once ever |
|
|
232
489
|
|
|
233
|
-
|
|
490
|
+
**Total Setup**: ~0.014 ETH (one-time)
|
|
234
491
|
|
|
235
|
-
|
|
236
|
-
- **[SimpleAccount Owner Deployment](./docs/SIMPLEACCOUNT_OWNER_DEPLOYMENT.md)** - Deploy NFTs with SimpleAccount as owner
|
|
237
|
-
- **[NFT Listing Guide](./docs/NFT_LISTING_GUIDE.md)** - Discover and list NFTs owned by any EOA
|
|
238
|
-
- **[Backend Mint Guide](./docs/BACKEND_MINT_GUIDE.md)** - Alternative backend-controlled minting
|
|
239
|
-
- **[Quick Reference](./docs/QUICK_REFERENCE.md)** - Quick start and common patterns
|
|
492
|
+
### Per-Deployment Costs
|
|
240
493
|
|
|
241
|
-
|
|
494
|
+
| Contract Type | Who Pays | Cost | Notes |
|
|
495
|
+
| ------------- | ------------- | ---------- | --------------- |
|
|
496
|
+
| **KAMI721C** | SimpleAccount | ~0.015 ETH | Standard ERC721 |
|
|
497
|
+
| **KAMI721AC** | SimpleAccount | ~0.015 ETH | ERC721A |
|
|
498
|
+
| **KAMI1155C** | SimpleAccount | ~0.015 ETH | ERC1155 |
|
|
242
499
|
|
|
243
|
-
|
|
244
|
-
- **[Gas Optimization](./docs/GAS_OPTIMIZATION_GUIDE.md)** - Optimize gas usage and costs
|
|
245
|
-
- **[Library Overview](./docs/LIBRARY_OVERVIEW.md)** - Architecture and design decisions
|
|
246
|
-
- **[Complete Workflow](./docs/COMPLETE_WORKFLOW_PAULSNFT.md)** - End-to-end workflow example
|
|
500
|
+
**After Setup**: Deploy unlimited contracts for ~0.015 ETH each (from SimpleAccount)
|
|
247
501
|
|
|
248
|
-
|
|
502
|
+
### Gasless Benefits
|
|
249
503
|
|
|
250
|
-
|
|
504
|
+
- ✅ **Users pay nothing** - All gas paid by SimpleAccount
|
|
505
|
+
- ✅ **EOA only signs** - No ETH needed in user wallet
|
|
506
|
+
- ✅ **True gasless experience** - Best UX possible
|
|
251
507
|
|
|
252
|
-
|
|
508
|
+
## Examples
|
|
253
509
|
|
|
254
|
-
|
|
510
|
+
All examples are in the `examples/` directory:
|
|
255
511
|
|
|
256
|
-
|
|
257
|
-
- `config.ownerPrivateKey` (Hex): EOA private key for funding and management
|
|
258
|
-
- `config.simpleAccountAddress` (Address): SimpleAccount address
|
|
259
|
-
- `config.deployerAddress` (Address): SimpleDeployer contract address
|
|
512
|
+
### Infrastructure Setup
|
|
260
513
|
|
|
261
|
-
|
|
514
|
+
- `gasless-deployment-complete.ts` - Deploy ContractDeployer
|
|
515
|
+
- `deploy-shared-libraries-example.ts` - Deploy KAMI libraries
|
|
516
|
+
- `check-library-deployment.ts` - Verify library deployments
|
|
262
517
|
|
|
263
|
-
###
|
|
518
|
+
### Contract Deployment
|
|
264
519
|
|
|
265
|
-
|
|
520
|
+
- `true-gasless-deployment.ts` - Deploy KAMI721C
|
|
521
|
+
- `deploy-kami721ac-gasless.ts` - Deploy KAMI721AC
|
|
522
|
+
- `deploy-kami1155c-gasless.ts` - Deploy KAMI1155C
|
|
266
523
|
|
|
267
|
-
|
|
524
|
+
### SimpleAccount Setup
|
|
268
525
|
|
|
269
|
-
- `
|
|
270
|
-
- `
|
|
271
|
-
- `salt` (Hex, optional): Salt for deterministic deployment
|
|
526
|
+
- `deploy-simple-deployer.ts` - Deploy SimpleAccountFactory
|
|
527
|
+
- `fund-simpleaccount.ts` - Fund SimpleAccount with ETH
|
|
272
528
|
|
|
273
|
-
|
|
529
|
+
## Next.js Deployment
|
|
274
530
|
|
|
275
|
-
|
|
531
|
+
If you're using this library in a Next.js API route, you'll encounter artifact loading issues. See the complete guide:
|
|
276
532
|
|
|
277
|
-
|
|
533
|
+
👉 **[Next.js Deployment Guide](docs/NEXTJS_DEPLOYMENT.md)**
|
|
278
534
|
|
|
279
|
-
**
|
|
535
|
+
**Quick Summary**: The library loads contract artifacts using `fs.readFileSync()`, which doesn't work in Next.js production builds. You need to:
|
|
280
536
|
|
|
281
|
-
|
|
282
|
-
-
|
|
283
|
-
-
|
|
537
|
+
1. **Use the custom wrapper** (recommended) - See guide for ready-to-use `NextJsKamiDeployer` class
|
|
538
|
+
2. **Or configure Next.js** - Update `next.config.js` to include artifacts
|
|
539
|
+
3. **Or use Docker** - Ensure artifacts are copied to container
|
|
284
540
|
|
|
285
|
-
|
|
541
|
+
The guide includes complete code examples and troubleshooting steps.
|
|
286
542
|
|
|
287
|
-
##
|
|
543
|
+
## Troubleshooting
|
|
288
544
|
|
|
289
|
-
|
|
545
|
+
### Next.js "ENOENT: no such file or directory" Error
|
|
290
546
|
|
|
291
|
-
|
|
547
|
+
**Symptoms**: Error opening KAMI721C.json artifact file in production
|
|
292
548
|
|
|
293
|
-
|
|
294
|
-
- `check-library-deployment.ts` - 🆕 **Verify KAMI libraries are deployed**
|
|
295
|
-
- `nextjs-kami-config.ts` - 🆕 **Next.js helper for loading libraries from environment**
|
|
296
|
-
- `kami-payment-example.ts` - Complete KAMI payment flow with ERC20 tokens
|
|
297
|
-
- `deploy-shared-libraries-example.ts` - Deploy and share KAMI libraries (44-66% gas savings)
|
|
549
|
+
**Solution**: See [Next.js Deployment Guide](docs/NEXTJS_DEPLOYMENT.md) for complete fix with ready-to-use wrapper class.
|
|
298
550
|
|
|
299
|
-
|
|
551
|
+
**Quick Fix**: Use the `NextJsKamiDeployer` wrapper that imports artifacts directly instead of loading from disk.
|
|
300
552
|
|
|
301
|
-
|
|
302
|
-
- `deploy-with-simpleaccount.ts` - Deploy NFT with SimpleAccount as owner
|
|
303
|
-
- `fund-simpleaccount.ts` - Fund SimpleAccount with ETH
|
|
304
|
-
- `list-nfts-example.ts` - Complete NFT discovery and listing examples
|
|
305
|
-
- `backend-mint-api.ts` - Backend minting API example
|
|
553
|
+
### Contract Not Appearing on BaseScan
|
|
306
554
|
|
|
307
|
-
|
|
555
|
+
**Wait 1-2 minutes** for block explorer indexing.
|
|
308
556
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
557
|
+
If still not visible:
|
|
558
|
+
|
|
559
|
+
1. Check transaction on BaseScan: `https://sepolia.basescan.org/tx/YOUR_TX`
|
|
560
|
+
2. Look for "Internal Transactions" tab
|
|
561
|
+
3. Verify "ContractDeployed" event in logs
|
|
562
|
+
4. Confirm ContractDeployer is deployed correctly
|
|
563
|
+
|
|
564
|
+
### "Insufficient Balance" Error
|
|
312
565
|
|
|
313
|
-
|
|
314
|
-
|
|
566
|
+
```bash
|
|
567
|
+
# Check SimpleAccount balance
|
|
568
|
+
cast balance $SIMPLE_ACCOUNT_ADDRESS --rpc-url https://sepolia.base.org
|
|
569
|
+
|
|
570
|
+
# Fund if needed
|
|
571
|
+
cast send $SIMPLE_ACCOUNT_ADDRESS \
|
|
572
|
+
--value 0.03ether \
|
|
573
|
+
--private-key $PRIVATE_KEY \
|
|
574
|
+
--rpc-url https://sepolia.base.org
|
|
315
575
|
```
|
|
316
576
|
|
|
317
|
-
|
|
577
|
+
### "ContractDeployer not deployed" Error
|
|
578
|
+
|
|
579
|
+
Deploy ContractDeployer first:
|
|
318
580
|
|
|
319
581
|
```bash
|
|
320
|
-
|
|
321
|
-
|
|
582
|
+
npx tsx examples/gasless-deployment-complete.ts
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
### "Library addresses invalid" Error
|
|
322
586
|
|
|
323
|
-
|
|
324
|
-
pnpm run build
|
|
587
|
+
Verify all libraries are deployed:
|
|
325
588
|
|
|
326
|
-
|
|
327
|
-
|
|
589
|
+
```bash
|
|
590
|
+
npx tsx examples/check-library-deployment.ts
|
|
328
591
|
```
|
|
329
592
|
|
|
330
|
-
|
|
593
|
+
### Deployment Transaction Reverts
|
|
594
|
+
|
|
595
|
+
1. **Check SimpleAccount has enough ETH** (~0.02 ETH minimum)
|
|
596
|
+
2. **Verify all library addresses** are correct and deployed
|
|
597
|
+
3. **Check ContractDeployer address** is valid
|
|
598
|
+
4. **Look at revert reason** on BaseScan transaction page
|
|
599
|
+
|
|
600
|
+
### "Invalid byte sequence" Error
|
|
331
601
|
|
|
332
|
-
|
|
602
|
+
This usually means:
|
|
333
603
|
|
|
334
|
-
|
|
604
|
+
- Bytecode has formatting issues (spaces in hex)
|
|
605
|
+
- Update to latest version of the library
|
|
335
606
|
|
|
336
|
-
|
|
607
|
+
## Architecture
|
|
608
|
+
|
|
609
|
+
### How It Works
|
|
610
|
+
|
|
611
|
+
```
|
|
612
|
+
┌─────────────┐ ┌──────────────────┐ ┌────────────────────┐
|
|
613
|
+
│ EOA │ signs │ SimpleAccount │ calls │ ContractDeployer │
|
|
614
|
+
│ (no gas) ├────────>│ (pays all gas) ├────────>│ (uses CREATE) │
|
|
615
|
+
└─────────────┘ └──────────────────┘ └────────┬───────────┘
|
|
616
|
+
│ deploys
|
|
617
|
+
v
|
|
618
|
+
┌────────────────────┐
|
|
619
|
+
│ KAMI Contract │
|
|
620
|
+
│ (your NFT) │
|
|
621
|
+
└────────────────────┘
|
|
622
|
+
```
|
|
337
623
|
|
|
338
|
-
|
|
624
|
+
### Why ContractDeployer?
|
|
339
625
|
|
|
340
|
-
|
|
626
|
+
SimpleAccount's `execute()` function **cannot deploy contracts** directly. Calling `execute(address(0), 0, bytecode)` doesn't use the CREATE opcode - it just calls the zero address which does nothing.
|
|
341
627
|
|
|
342
|
-
|
|
628
|
+
ContractDeployer solves this by:
|
|
343
629
|
|
|
344
|
-
|
|
630
|
+
1. SimpleAccount calls `ContractDeployer.deploy(bytecode)`
|
|
631
|
+
2. ContractDeployer uses CREATE opcode internally
|
|
632
|
+
3. New contract is deployed with SimpleAccount as deployer
|
|
633
|
+
4. Contract appears on block explorer correctly
|
|
345
634
|
|
|
346
|
-
|
|
635
|
+
This is a **one-time infrastructure cost** (~0.001 ETH) that enables unlimited gasless deployments.
|
|
347
636
|
|
|
348
|
-
|
|
349
|
-
2. Verify contract deployment: Check transaction on block explorer
|
|
350
|
-
3. Test with small amounts first
|
|
351
|
-
4. Check network connectivity and RPC endpoint
|
|
637
|
+
## Migration from Old Version
|
|
352
638
|
|
|
353
|
-
|
|
639
|
+
If you were using `KamiSimpleAccountDeployer`, it **doesn't work** and has been deprecated.
|
|
354
640
|
|
|
355
|
-
|
|
356
|
-
- **Base Mainnet** - Production ready
|
|
357
|
-
- **Ethereum Sepolia** - Testing
|
|
358
|
-
- **Any EVM-compatible network** - With proper configuration
|
|
641
|
+
See [MIGRATION_GUIDE.md](MIGRATION_GUIDE.md) for migration instructions.
|
|
359
642
|
|
|
360
|
-
##
|
|
643
|
+
## Additional Documentation
|
|
361
644
|
|
|
362
|
-
|
|
645
|
+
- [ALL_CONTRACT_TYPES.md](ALL_CONTRACT_TYPES.md) - Detailed comparison of all contract types
|
|
646
|
+
- [MIGRATION_GUIDE.md](MIGRATION_GUIDE.md) - Migration from deprecated classes
|
|
647
|
+
- [UPDATED_SOLUTION.md](UPDATED_SOLUTION.md) - Technical details and rationale
|
|
648
|
+
- [docs/GASLESS_DEPLOYMENT_FIX.md](docs/GASLESS_DEPLOYMENT_FIX.md) - Deep dive into the solution
|
|
363
649
|
|
|
364
|
-
|
|
365
|
-
- ⚠️ **[Next.js Artifacts Fix](./docs/NEXTJS_ARTIFACTS_FIX.md)** - **REQUIRED for Next.js users!**
|
|
366
|
-
- 🆕 **[Enhanced Mint Results Guide](./docs/MINT_RESULTS_GUIDE.md)** - **NEW: Get tokenId from mint operations!**
|
|
367
|
-
- 🆕 **[Royalty System Guide](./docs/KAMI_ROYALTY_GUIDE.md)** - **NEW: Dual royalty system (mint vs transfer)**
|
|
368
|
-
- 🎯 **[Custodial Zero-Gas](./docs/KAMI_CUSTODIAL_ZERO_GAS.md)** - **BEST: ZERO user gas for custodial wallets!**
|
|
369
|
-
- ⚡ **[Gasless Payment Flow](./docs/KAMI_PAYMENT_GASLESS_FLOW.md)** - Truly gasless payment setup
|
|
370
|
-
- 💰 **[Payment Flow Guide](./docs/KAMI_PAYMENT_FLOW.md)** - ERC20 payment token setup
|
|
371
|
-
- 📝 **[Payment Quick Reference](./docs/KAMI_PAYMENT_SUMMARY.md)** - Quick payment setup guide
|
|
372
|
-
- 📊 **[Gas Savings Analysis](./docs/KAMI_GAS_SAVINGS_ANALYSIS.md)** - Detailed cost breakdown (saves 44-66%!)
|
|
373
|
-
- 📘 **[KAMI Operations Guide](./docs/KAMI_OPERATIONS.md)** - Complete operations reference (UPDATED v0.4.0)
|
|
374
|
-
- 📚 **[Library Sharing Guide](./docs/KAMI_LIBRARY_SHARING.md)** - Maximize efficiency
|
|
375
|
-
- 🔍 **[Library Verification Guide](./docs/LIBRARY_VERIFICATION_GUIDE.md)** - Check if libraries are deployed
|
|
376
|
-
- 🆕 **[Next.js Library Deployment](./docs/NEXTJS_LIBRARY_DEPLOYMENT.md)** - **Using libraries in Next.js APIs**
|
|
377
|
-
- 🚀 **[Quick Start](./docs/KAMI_QUICK_START.md)** - Get started in 5 minutes
|
|
378
|
-
- 🔧 **[Deployment Notes](./docs/KAMI_DEPLOYMENT_NOTES.md)** - Production considerations
|
|
379
|
-
- 💡 **[Mint with TokenId Example](./examples/mint-with-tokenid-example.ts)** - Get token info from mints
|
|
380
|
-
- 💡 **[Payment Example](./examples/kami-payment-example.ts)** - Complete payment flow example
|
|
381
|
-
- 💡 **[Library Sharing Example](./examples/deploy-shared-libraries-example.ts)** - Shared libraries
|
|
650
|
+
## Contributing
|
|
382
651
|
|
|
383
|
-
|
|
652
|
+
Contributions welcome! Please open an issue or PR.
|
|
384
653
|
|
|
385
|
-
|
|
386
|
-
- [SimpleAccount Owner Deployment](./docs/SIMPLEACCOUNT_OWNER_DEPLOYMENT.md)
|
|
387
|
-
- [NFT Listing Guide](./docs/NFT_LISTING_GUIDE.md)
|
|
388
|
-
- [Library Overview](./docs/LIBRARY_OVERVIEW.md)
|
|
389
|
-
- [Complete Workflow Guide](./docs/COMPLETE_WORKFLOW_PAULSNFT.md)
|
|
654
|
+
## License
|
|
390
655
|
|
|
391
|
-
|
|
656
|
+
[Your License Here]
|
|
392
657
|
|
|
393
|
-
##
|
|
658
|
+
## Support
|
|
394
659
|
|
|
395
|
-
|
|
660
|
+
For issues, questions, or feature requests, please open a GitHub issue.
|
|
396
661
|
|
|
397
|
-
##
|
|
662
|
+
## Summary
|
|
398
663
|
|
|
399
|
-
|
|
664
|
+
This library provides a **complete solution** for deploying KAMI NFT contracts with true gasless transactions:
|
|
400
665
|
|
|
401
|
-
|
|
666
|
+
- ✅ **Complete setup guide** - From zero to deployed NFT contract
|
|
667
|
+
- ✅ **Three contract types** - KAMI721C, KAMI721AC, KAMI1155C
|
|
668
|
+
- ✅ **Truly gasless** - SimpleAccount pays all gas
|
|
669
|
+
- ✅ **Production ready** - Battle-tested and documented
|
|
670
|
+
- ✅ **Type-safe** - Full TypeScript support
|
|
671
|
+
- ✅ **Creator features** - Royalties, rentals, platform fees built-in
|
|
402
672
|
|
|
403
|
-
|
|
404
|
-
- **Issues**: Report bugs and request features on GitHub
|
|
405
|
-
- **Discussions**: Join our community discussions
|
|
673
|
+
**Get started in minutes. Deploy NFTs gaslessly in production.** 🚀
|