@paulstinchcombe/gasless-nft-tx 0.2.3 โ†’ 0.2.5

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 CHANGED
@@ -8,6 +8,7 @@ A robust, production-ready TypeScript library that enables **gasless NFT transac
8
8
  - **๐Ÿฆ SimpleAccount Operations**: Deploy, mint, and manage NFTs through funded SimpleAccount
9
9
  - **๐Ÿš€ Auto-Deploy Everything**: Automatically deploys SimpleAccountFactory and SimpleAccount when needed
10
10
  - **๐ŸŽจ NFT Operations**: Deploy, mint, and buy NFTs without any gas fees
11
+ - **๐Ÿ” NFT Discovery**: Find ALL NFTs owned by any EOA across ALL contracts
11
12
  - **๐Ÿ”ง Flexible Deployment**: Deploy NFTs with SimpleAccount as owner from the start
12
13
  - **๐Ÿ“ฆ Batch Operations**: Execute multiple operations across different contracts
13
14
  - **๐Ÿ’ฐ Backend Minting**: Alternative backend-controlled minting for maximum reliability
@@ -22,10 +23,11 @@ A robust, production-ready TypeScript library that enables **gasless NFT transac
22
23
 
23
24
  - ๐Ÿ†• **SimpleAccount Owner Deployment**: Deploy NFTs with SimpleAccount as owner from the start - no ownership transfer needed!
24
25
  - ๐ŸŽฏ **Immediate Gasless Minting**: Mint NFTs immediately after deployment through SimpleAccount
26
+ - ๐Ÿ” **Comprehensive NFT Discovery**: Find ALL NFTs owned by any EOA across ALL contracts
25
27
  - ๐Ÿ”„ **Streamlined Workflow**: One-step deployment and minting process
26
28
  - ๐Ÿฆ **Funded SimpleAccount**: SimpleAccount pays its own gas for truly gasless user experience
27
29
  - ๐Ÿ”ง **Backend Minting**: Alternative approach for maximum reliability
28
- - ๐Ÿ“š **Comprehensive Guides**: [Gas Optimization](./docs/GAS_OPTIMIZATION_GUIDE.md), [SimpleAccount Owner Deployment](./docs/SIMPLEACCOUNT_OWNER_DEPLOYMENT.md)
30
+ - ๐Ÿ“š **Comprehensive Guides**: [Gas Optimization](./docs/GAS_OPTIMIZATION_GUIDE.md), [SimpleAccount Owner Deployment](./docs/SIMPLEACCOUNT_OWNER_DEPLOYMENT.md), [NFT Listing](./docs/NFT_LISTING_GUIDE.md)
29
31
 
30
32
  ## ๐Ÿš€ Installation
31
33
 
@@ -78,7 +80,38 @@ if (deployResult.success) {
78
80
  }
79
81
  ```
80
82
 
81
- ### 2. Backend Minting (Alternative)
83
+ ### 2. NFT Discovery (NEW!)
84
+
85
+ ```typescript
86
+ import { createNftListingOperations } from '@paulstinchcombe/gasless-nft-tx';
87
+
88
+ // Create NFT listing instance
89
+ const nftListing = createNftListingOperations({
90
+ rpcUrl: 'https://sepolia.base.org',
91
+ includeMetadata: true,
92
+ });
93
+
94
+ // Discover ALL NFTs owned by an address across ALL contracts
95
+ const result = await nftListing.discoverAllNftsForOwner('0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6');
96
+
97
+ if (result.success) {
98
+ console.log(`Found ${result.totalCount} NFTs across ALL contracts`);
99
+
100
+ // Group by contract
101
+ const byContract = result.tokens?.reduce((acc, token) => {
102
+ const contract = token.contractAddress;
103
+ if (!acc[contract]) acc[contract] = [];
104
+ acc[contract].push(token);
105
+ return acc;
106
+ }, {} as Record<string, typeof result.tokens>);
107
+
108
+ Object.entries(byContract || {}).forEach(([contract, tokens]) => {
109
+ console.log(`Contract ${contract}: ${tokens.length} tokens`);
110
+ });
111
+ }
112
+ ```
113
+
114
+ ### 3. Backend Minting (Alternative)
82
115
 
83
116
  ```typescript
84
117
  import { createBackendMintHandler } from '@paulstinchcombe/gasless-nft-tx';
@@ -106,11 +139,13 @@ const mintResult = await mintHandler.mintNft({
106
139
 
107
140
  - **[SimpleAccount Guide](./docs/SIMPLE_ACCOUNT_GUIDE.md)** - Complete guide to SimpleAccount operations
108
141
  - **[SimpleAccount Owner Deployment](./docs/SIMPLEACCOUNT_OWNER_DEPLOYMENT.md)** - Deploy NFTs with SimpleAccount as owner
142
+ - **[NFT Listing Guide](./docs/NFT_LISTING_GUIDE.md)** - Discover and list NFTs owned by any EOA
109
143
  - **[Backend Mint Guide](./docs/BACKEND_MINT_GUIDE.md)** - Alternative backend-controlled minting
110
144
  - **[Quick Reference](./docs/QUICK_REFERENCE.md)** - Quick start and common patterns
111
145
 
112
146
  ### Advanced Topics
113
147
 
148
+ - **[EIP-7702 vs SimpleAccount Comparison](./docs/EIP7702_VS_SIMPLEACCOUNT_COMPARISON.md)** - Detailed comparison of approaches
114
149
  - **[Gas Optimization](./docs/GAS_OPTIMIZATION_GUIDE.md)** - Optimize gas usage and costs
115
150
  - **[Library Overview](./docs/LIBRARY_OVERVIEW.md)** - Architecture and design decisions
116
151
  - **[Complete Workflow](./docs/COMPLETE_WORKFLOW_PAULSNFT.md)** - End-to-end workflow example
@@ -161,6 +196,7 @@ Check the `examples/` directory for complete working examples:
161
196
  - `test-simpleaccount-operations.ts` - Basic SimpleAccount operations
162
197
  - `deploy-with-simpleaccount.ts` - Deploy NFT with SimpleAccount as owner
163
198
  - `fund-simpleaccount.ts` - Fund SimpleAccount with ETH
199
+ - `list-nfts-example.ts` - Complete NFT discovery and listing examples
164
200
  - `backend-mint-api.ts` - Backend minting API example
165
201
 
166
202
  ## ๐Ÿงช Testing
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Backend-Controlled Minting
3
+ *
4
+ * Two approaches for backend minting:
5
+ * 1. EOA Minting - When EOA owns the NFT contract
6
+ * 2. SimpleAccount Minting - When SimpleAccount owns the NFT contract
7
+ */
8
+ import { Address, Hex } from 'viem';
9
+ import { base, baseSepolia } from 'viem/chains';
10
+ export interface EoaMintConfig {
11
+ rpcUrl: string;
12
+ nftContractAddress: Address;
13
+ ownerPrivateKey: Hex;
14
+ chain?: typeof base | typeof baseSepolia;
15
+ }
16
+ export interface SimpleAccountMintConfig {
17
+ rpcUrl: string;
18
+ nftContractAddress: Address;
19
+ simpleAccountAddress: Address;
20
+ ownerPrivateKey: Hex;
21
+ chain?: typeof base | typeof baseSepolia;
22
+ }
23
+ export interface MintRequest {
24
+ recipientAddress: Address;
25
+ quantity?: number;
26
+ }
27
+ export interface MintResult {
28
+ success: boolean;
29
+ transactionHash?: Hex;
30
+ tokenId?: bigint;
31
+ error?: string;
32
+ }
33
+ /**
34
+ * EOA Mint Handler
35
+ * Use when the EOA owns the NFT contract
36
+ */
37
+ export declare class EoaMintHandler {
38
+ private publicClient;
39
+ private walletClient;
40
+ private config;
41
+ private account;
42
+ constructor(config: EoaMintConfig);
43
+ /**
44
+ * Mint NFT directly from EOA
45
+ */
46
+ mintNft(request: MintRequest): Promise<MintResult>;
47
+ /**
48
+ * Check if we can mint
49
+ */
50
+ canMint(): Promise<{
51
+ canMint: boolean;
52
+ reason?: string;
53
+ }>;
54
+ }
55
+ /**
56
+ * SimpleAccount Mint Handler
57
+ * Use when the SimpleAccount owns the NFT contract
58
+ */
59
+ export declare class SimpleAccountMintHandler {
60
+ private publicClient;
61
+ private walletClient;
62
+ private config;
63
+ private account;
64
+ constructor(config: SimpleAccountMintConfig);
65
+ /**
66
+ * Mint NFT through SimpleAccount
67
+ */
68
+ mintNft(request: MintRequest): Promise<MintResult>;
69
+ /**
70
+ * Check if we can mint
71
+ */
72
+ canMint(): Promise<{
73
+ canMint: boolean;
74
+ reason?: string;
75
+ }>;
76
+ }
77
+ export declare function createEoaMintHandler(config: EoaMintConfig): EoaMintHandler;
78
+ export declare function createSimpleAccountMintHandler(config: SimpleAccountMintConfig): SimpleAccountMintHandler;
79
+ export interface BackendMintConfig {
80
+ rpcUrl: string;
81
+ nftContractAddress: Address;
82
+ ownerPrivateKey: Hex;
83
+ simpleAccountAddress?: Address;
84
+ chain?: typeof base | typeof baseSepolia;
85
+ }
86
+ export declare class BackendMintHandler {
87
+ private eoaHandler?;
88
+ private simpleAccountHandler?;
89
+ constructor(config: BackendMintConfig);
90
+ mintNft(request: MintRequest): Promise<MintResult>;
91
+ canMint(): Promise<{
92
+ canMint: boolean;
93
+ reason?: string;
94
+ }>;
95
+ }
96
+ export declare function createBackendMintHandler(config: BackendMintConfig): BackendMintHandler;
97
+ //# sourceMappingURL=backend-mint-clean.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend-mint-clean.d.ts","sourceRoot":"","sources":["../src/backend-mint-clean.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAgD,OAAO,EAAE,GAAG,EAAsB,MAAM,MAAM,CAAC;AAEtG,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,GAAG,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,IAAI,GAAG,OAAO,WAAW,CAAC;CACzC;AAED,MAAM,WAAW,uBAAuB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,OAAO,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,eAAe,EAAE,GAAG,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,IAAI,GAAG,OAAO,WAAW,CAAC;CACzC;AAED,MAAM,WAAW,WAAW;IAC3B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,GAAG,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,qBAAa,cAAc;IAC1B,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,OAAO,CAAM;gBAET,MAAM,EAAE,aAAa;IAgBjC;;OAEG;IACG,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAoEx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,iBAAiB,GAAG,kBAAkB,CAEtF"}
@@ -0,0 +1,416 @@
1
+ "use strict";
2
+ /**
3
+ * Backend-Controlled Minting
4
+ *
5
+ * Two approaches for backend minting:
6
+ * 1. EOA Minting - When EOA owns the NFT contract
7
+ * 2. SimpleAccount Minting - When SimpleAccount owns the NFT contract
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.BackendMintHandler = exports.SimpleAccountMintHandler = exports.EoaMintHandler = void 0;
11
+ exports.createEoaMintHandler = createEoaMintHandler;
12
+ exports.createSimpleAccountMintHandler = createSimpleAccountMintHandler;
13
+ exports.createBackendMintHandler = createBackendMintHandler;
14
+ const viem_1 = require("viem");
15
+ const accounts_1 = require("viem/accounts");
16
+ const chains_1 = require("viem/chains");
17
+ /**
18
+ * EOA Mint Handler
19
+ * Use when the EOA owns the NFT contract
20
+ */
21
+ class EoaMintHandler {
22
+ publicClient;
23
+ walletClient;
24
+ config;
25
+ account;
26
+ constructor(config) {
27
+ this.config = config;
28
+ this.account = (0, accounts_1.privateKeyToAccount)(config.ownerPrivateKey);
29
+ this.publicClient = (0, viem_1.createPublicClient)({
30
+ transport: (0, viem_1.http)(config.rpcUrl),
31
+ chain: config.chain || chains_1.baseSepolia,
32
+ });
33
+ this.walletClient = (0, viem_1.createWalletClient)({
34
+ account: this.account,
35
+ transport: (0, viem_1.http)(config.rpcUrl),
36
+ chain: config.chain || chains_1.baseSepolia,
37
+ });
38
+ }
39
+ /**
40
+ * Mint NFT directly from EOA
41
+ */
42
+ async mintNft(request) {
43
+ try {
44
+ console.log(`๐ŸŽจ EOA minting NFT for ${request.recipientAddress}...`);
45
+ // Check if we can mint
46
+ const canMint = await this.canMint();
47
+ if (!canMint.canMint) {
48
+ return {
49
+ success: false,
50
+ error: canMint.reason || 'Cannot mint',
51
+ };
52
+ }
53
+ // Encode mint function
54
+ const mintCalldata = (0, viem_1.encodeFunctionData)({
55
+ abi: [
56
+ {
57
+ type: 'function',
58
+ name: 'mint',
59
+ inputs: [
60
+ { name: 'to', type: 'address' },
61
+ { name: 'tokenId', type: 'uint256' },
62
+ ],
63
+ outputs: [],
64
+ },
65
+ ],
66
+ functionName: 'mint',
67
+ args: [request.recipientAddress, 0n], // tokenId ignored by auto-increment contracts
68
+ });
69
+ // Send transaction
70
+ const txHash = await this.walletClient.sendTransaction({
71
+ account: this.account,
72
+ to: this.config.nftContractAddress,
73
+ data: mintCalldata,
74
+ gas: 300000n,
75
+ });
76
+ console.log(` Transaction: ${txHash}`);
77
+ // Wait for confirmation
78
+ const receipt = await this.publicClient.waitForTransactionReceipt({
79
+ hash: txHash,
80
+ });
81
+ if (receipt.status !== 'success') {
82
+ return {
83
+ success: false,
84
+ error: `Transaction failed: ${txHash}`,
85
+ };
86
+ }
87
+ console.log(`โœ… NFT minted successfully!`);
88
+ return {
89
+ success: true,
90
+ transactionHash: txHash,
91
+ tokenId: 0n, // Would need to get actual tokenId from events
92
+ };
93
+ }
94
+ catch (error) {
95
+ console.error('โŒ EOA mint failed:', error);
96
+ return {
97
+ success: false,
98
+ error: error.message || 'Unknown error',
99
+ };
100
+ }
101
+ }
102
+ /**
103
+ * Check if we can mint
104
+ */
105
+ async canMint() {
106
+ try {
107
+ // Check if contract exists
108
+ const code = await this.publicClient.getBytecode({
109
+ address: this.config.nftContractAddress,
110
+ });
111
+ if (!code || code === '0x') {
112
+ return { canMint: false, reason: 'NFT contract not found' };
113
+ }
114
+ // Check if EOA is the owner
115
+ const owner = await this.publicClient.readContract({
116
+ address: this.config.nftContractAddress,
117
+ abi: [
118
+ {
119
+ type: 'function',
120
+ name: 'owner',
121
+ inputs: [],
122
+ outputs: [{ type: 'address' }],
123
+ stateMutability: 'view',
124
+ },
125
+ ],
126
+ functionName: 'owner',
127
+ });
128
+ if (owner.toLowerCase() !== this.account.address.toLowerCase()) {
129
+ return {
130
+ canMint: false,
131
+ reason: `EOA is not the owner. Owner: ${owner}, EOA: ${this.account.address}`,
132
+ };
133
+ }
134
+ // Check supply limits
135
+ try {
136
+ const totalSupply = await this.publicClient.readContract({
137
+ address: this.config.nftContractAddress,
138
+ abi: [
139
+ {
140
+ type: 'function',
141
+ name: 'totalSupply',
142
+ inputs: [],
143
+ outputs: [{ type: 'uint256' }],
144
+ stateMutability: 'view',
145
+ },
146
+ ],
147
+ functionName: 'totalSupply',
148
+ });
149
+ const maxSupply = await this.publicClient.readContract({
150
+ address: this.config.nftContractAddress,
151
+ abi: [
152
+ {
153
+ type: 'function',
154
+ name: 'maxSupply',
155
+ inputs: [],
156
+ outputs: [{ type: 'uint256' }],
157
+ stateMutability: 'view',
158
+ },
159
+ ],
160
+ functionName: 'maxSupply',
161
+ });
162
+ if (totalSupply >= maxSupply) {
163
+ return {
164
+ canMint: false,
165
+ reason: `Max supply reached: ${totalSupply}/${maxSupply}`,
166
+ };
167
+ }
168
+ }
169
+ catch (error) {
170
+ // Contract might not have totalSupply/maxSupply functions
171
+ console.log(' Could not check supply limits');
172
+ }
173
+ return { canMint: true };
174
+ }
175
+ catch (error) {
176
+ return { canMint: false, reason: error.message };
177
+ }
178
+ }
179
+ }
180
+ exports.EoaMintHandler = EoaMintHandler;
181
+ /**
182
+ * SimpleAccount Mint Handler
183
+ * Use when the SimpleAccount owns the NFT contract
184
+ */
185
+ class SimpleAccountMintHandler {
186
+ publicClient;
187
+ walletClient;
188
+ config;
189
+ account;
190
+ constructor(config) {
191
+ this.config = config;
192
+ this.account = (0, accounts_1.privateKeyToAccount)(config.ownerPrivateKey);
193
+ this.publicClient = (0, viem_1.createPublicClient)({
194
+ transport: (0, viem_1.http)(config.rpcUrl),
195
+ chain: config.chain || chains_1.baseSepolia,
196
+ });
197
+ this.walletClient = (0, viem_1.createWalletClient)({
198
+ account: this.account,
199
+ transport: (0, viem_1.http)(config.rpcUrl),
200
+ chain: config.chain || chains_1.baseSepolia,
201
+ });
202
+ }
203
+ /**
204
+ * Mint NFT through SimpleAccount
205
+ */
206
+ async mintNft(request) {
207
+ try {
208
+ console.log(`๐ŸŽจ SimpleAccount minting NFT for ${request.recipientAddress}...`);
209
+ // Check if we can mint
210
+ const canMint = await this.canMint();
211
+ if (!canMint.canMint) {
212
+ return {
213
+ success: false,
214
+ error: canMint.reason || 'Cannot mint',
215
+ };
216
+ }
217
+ // Create mint calldata
218
+ const mintCalldata = (0, viem_1.encodeFunctionData)({
219
+ abi: [
220
+ {
221
+ type: 'function',
222
+ name: 'mint',
223
+ inputs: [
224
+ { name: 'to', type: 'address' },
225
+ { name: 'tokenId', type: 'uint256' },
226
+ ],
227
+ outputs: [],
228
+ },
229
+ ],
230
+ functionName: 'mint',
231
+ args: [request.recipientAddress, 0n],
232
+ });
233
+ // Call SimpleAccount.execute(nftAddress, 0, mintCalldata)
234
+ const txHash = await this.walletClient.sendTransaction({
235
+ account: this.account,
236
+ to: this.config.simpleAccountAddress,
237
+ data: (0, viem_1.encodeFunctionData)({
238
+ abi: [
239
+ {
240
+ type: 'function',
241
+ name: 'execute',
242
+ inputs: [
243
+ { name: 'dest', type: 'address' },
244
+ { name: 'value', type: 'uint256' },
245
+ { name: 'func', type: 'bytes' },
246
+ ],
247
+ outputs: [],
248
+ },
249
+ ],
250
+ functionName: 'execute',
251
+ args: [this.config.nftContractAddress, 0n, mintCalldata],
252
+ }),
253
+ gas: 300000n,
254
+ });
255
+ console.log(` Transaction: ${txHash}`);
256
+ // Wait for confirmation
257
+ const receipt = await this.publicClient.waitForTransactionReceipt({
258
+ hash: txHash,
259
+ });
260
+ if (receipt.status !== 'success') {
261
+ return {
262
+ success: false,
263
+ error: `Transaction failed: ${txHash}`,
264
+ };
265
+ }
266
+ console.log(`โœ… NFT minted successfully through SimpleAccount!`);
267
+ return {
268
+ success: true,
269
+ transactionHash: txHash,
270
+ tokenId: 0n,
271
+ };
272
+ }
273
+ catch (error) {
274
+ console.error('โŒ SimpleAccount mint failed:', error);
275
+ return {
276
+ success: false,
277
+ error: error.message || 'Unknown error',
278
+ };
279
+ }
280
+ }
281
+ /**
282
+ * Check if we can mint
283
+ */
284
+ async canMint() {
285
+ try {
286
+ // Check if contract exists
287
+ const code = await this.publicClient.getBytecode({
288
+ address: this.config.nftContractAddress,
289
+ });
290
+ if (!code || code === '0x') {
291
+ return { canMint: false, reason: 'NFT contract not found' };
292
+ }
293
+ // Check if SimpleAccount is the owner
294
+ const owner = await this.publicClient.readContract({
295
+ address: this.config.nftContractAddress,
296
+ abi: [
297
+ {
298
+ type: 'function',
299
+ name: 'owner',
300
+ inputs: [],
301
+ outputs: [{ type: 'address' }],
302
+ stateMutability: 'view',
303
+ },
304
+ ],
305
+ functionName: 'owner',
306
+ });
307
+ if (owner.toLowerCase() !== this.config.simpleAccountAddress.toLowerCase()) {
308
+ return {
309
+ canMint: false,
310
+ reason: `SimpleAccount is not the owner. Owner: ${owner}, SimpleAccount: ${this.config.simpleAccountAddress}`,
311
+ };
312
+ }
313
+ // Check supply limits
314
+ try {
315
+ const totalSupply = await this.publicClient.readContract({
316
+ address: this.config.nftContractAddress,
317
+ abi: [
318
+ {
319
+ type: 'function',
320
+ name: 'totalSupply',
321
+ inputs: [],
322
+ outputs: [{ type: 'uint256' }],
323
+ stateMutability: 'view',
324
+ },
325
+ ],
326
+ functionName: 'totalSupply',
327
+ });
328
+ const maxSupply = await this.publicClient.readContract({
329
+ address: this.config.nftContractAddress,
330
+ abi: [
331
+ {
332
+ type: 'function',
333
+ name: 'maxSupply',
334
+ inputs: [],
335
+ outputs: [{ type: 'uint256' }],
336
+ stateMutability: 'view',
337
+ },
338
+ ],
339
+ functionName: 'maxSupply',
340
+ });
341
+ if (totalSupply >= maxSupply) {
342
+ return {
343
+ canMint: false,
344
+ reason: `Max supply reached: ${totalSupply}/${maxSupply}`,
345
+ };
346
+ }
347
+ }
348
+ catch (error) {
349
+ // Contract might not have totalSupply/maxSupply functions
350
+ console.log(' Could not check supply limits');
351
+ }
352
+ return { canMint: true };
353
+ }
354
+ catch (error) {
355
+ return { canMint: false, reason: error.message };
356
+ }
357
+ }
358
+ }
359
+ exports.SimpleAccountMintHandler = SimpleAccountMintHandler;
360
+ // Helper functions
361
+ function createEoaMintHandler(config) {
362
+ return new EoaMintHandler(config);
363
+ }
364
+ function createSimpleAccountMintHandler(config) {
365
+ return new SimpleAccountMintHandler(config);
366
+ }
367
+ class BackendMintHandler {
368
+ eoaHandler;
369
+ simpleAccountHandler;
370
+ constructor(config) {
371
+ if (config.simpleAccountAddress) {
372
+ this.simpleAccountHandler = new SimpleAccountMintHandler({
373
+ rpcUrl: config.rpcUrl,
374
+ nftContractAddress: config.nftContractAddress,
375
+ simpleAccountAddress: config.simpleAccountAddress,
376
+ ownerPrivateKey: config.ownerPrivateKey,
377
+ chain: config.chain,
378
+ });
379
+ }
380
+ else {
381
+ this.eoaHandler = new EoaMintHandler({
382
+ rpcUrl: config.rpcUrl,
383
+ nftContractAddress: config.nftContractAddress,
384
+ ownerPrivateKey: config.ownerPrivateKey,
385
+ chain: config.chain,
386
+ });
387
+ }
388
+ }
389
+ async mintNft(request) {
390
+ if (this.simpleAccountHandler) {
391
+ return this.simpleAccountHandler.mintNft(request);
392
+ }
393
+ else if (this.eoaHandler) {
394
+ return this.eoaHandler.mintNft(request);
395
+ }
396
+ else {
397
+ throw new Error('No handler configured');
398
+ }
399
+ }
400
+ async canMint() {
401
+ if (this.simpleAccountHandler) {
402
+ return this.simpleAccountHandler.canMint();
403
+ }
404
+ else if (this.eoaHandler) {
405
+ return this.eoaHandler.canMint();
406
+ }
407
+ else {
408
+ throw new Error('No handler configured');
409
+ }
410
+ }
411
+ }
412
+ exports.BackendMintHandler = BackendMintHandler;
413
+ function createBackendMintHandler(config) {
414
+ return new BackendMintHandler(config);
415
+ }
416
+ //# sourceMappingURL=backend-mint-clean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend-mint-clean.js","sourceRoot":"","sources":["../src/backend-mint-clean.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AA2ZH,oDAEC;AAED,wEAEC;AAuDD,4DAEC;AAxdD,+BAAsG;A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