Skip to content

Commit 94da115

Browse files
authored
chore: move template files from json to typescript (#208)
* chore: move template files from json to typescript * - remove collections/template * - move template examples inside src folder * - remove `defaults.json` file
1 parent fe59687 commit 94da115

File tree

13 files changed

+62
-154
lines changed

13 files changed

+62
-154
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,3 @@ broadcast/
2222
# Ignore all collections folders and their contents
2323
**/collections/*
2424

25-
# Allow example and template folders in all collections directories
26-
!**/collections/example/
27-
!**/collections/template/

cli-typescript/collections/template/erc1155_template.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

cli-typescript/collections/template/erc721_template.json

Lines changed: 0 additions & 26 deletions
This file was deleted.

cli-typescript/collections/template/wallet.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

cli-typescript/defaults.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

cli-typescript/collections/example/erc1155_example.json renamed to cli-typescript/src/templates/example/erc1155_example.json

File renamed without changes.

cli-typescript/collections/example/erc721_example.json renamed to cli-typescript/src/templates/example/erc721_example.json

File renamed without changes.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
export const ERC721_TEMPLATE = {
2+
name: '',
3+
symbol: '',
4+
chainId: 0,
5+
tokenStandard: 'ERC721',
6+
maxMintableSupply: 0,
7+
globalWalletLimit: 0,
8+
mintCurrency: '0x0000000000000000000000000000000000000000',
9+
fundReceiver: '0x0000000000000000000000000000000000000000',
10+
royaltyReceiver: '0x0000000000000000000000000000000000000000',
11+
royaltyFee: 0,
12+
mintable: true,
13+
cosigner: '0x0000000000000000000000000000000000000000',
14+
tokenUriSuffix: '.json',
15+
uri: '',
16+
useERC721C: false,
17+
stages: [
18+
{
19+
price: '',
20+
mintFee: '',
21+
walletLimit: 0,
22+
startTime: '2024-11-04T16:30:00Z',
23+
endTime: '2024-11-07T16:25:00Z',
24+
},
25+
],
26+
};
27+
28+
export const ERC1155_TEMPLATE = {
29+
name: '',
30+
symbol: '',
31+
chainId: 0,
32+
tokenStandard: 'ERC1155',
33+
maxMintableSupply: [0],
34+
globalWalletLimit: [0],
35+
mintCurrency: '0x0000000000000000000000000000000000000000',
36+
fundReceiver: '0x0000000000000000000000000000000000000000',
37+
royaltyReceiver: '0x0000000000000000000000000000000000000000',
38+
royaltyFee: 0,
39+
mintable: true,
40+
cosigner: '0x0000000000000000000000000000000000000000',
41+
uri: '',
42+
stages: [
43+
{
44+
price: [''],
45+
mintFee: [''],
46+
walletLimit: [0],
47+
startTime: '2024-11-04T16:30:00Z',
48+
endTime: '2024-11-07T16:25:00Z',
49+
},
50+
],
51+
};

cli-typescript/src/utils/cmdActions/newProjectAction.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { TOKEN_STANDARD } from '../constants';
22
import { showError, showText } from '../display';
3-
import { getProjectStore, getTemplateStore } from '../fileUtils';
3+
import { getProjectStore } from '../fileUtils';
44
import { getChainIdFromName } from '../getters';
5+
import { ERC1155_TEMPLATE, ERC721_TEMPLATE } from '../../templates';
56
import { createProjectSigner } from '../turnkey';
7+
import { Collection } from '../types';
68

79
const newProjectAction = async (
810
symbol: string,
@@ -21,8 +23,11 @@ const newProjectAction = async (
2123
process.exit(1);
2224
}
2325

24-
const templateStore = getTemplateStore(params.tokenStandard);
25-
projectStore.data = templateStore.data;
26+
projectStore.data = projectStore.data = (
27+
params.tokenStandard === TOKEN_STANDARD.ERC721
28+
? ERC721_TEMPLATE
29+
: ERC1155_TEMPLATE
30+
) as Collection;
2631

2732
if (projectStore.data) {
2833
projectStore.data.chainId = getChainIdFromName(params.chain);

cli-typescript/src/utils/createCommand.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
} from './cmdOptions';
1111
import { EvmPlatform } from './evmUtils';
1212
import deployAction from './cmdActions/deployAction';
13-
import { loadDefaults } from './loaders';
1413
import { setBaseDir } from './setters';
1514
import { showError } from './display';
1615
import {
@@ -40,16 +39,6 @@ const presets = async () => {
4039
console.log('Starting prestart tasks...');
4140

4241
setBaseDir();
43-
44-
// Load default configurations
45-
await loadDefaults();
46-
47-
// Check if the default configuration is complete
48-
if (process.env.DEFAULT_CONFIG_COMPLETE !== 'true') {
49-
throw new Error(
50-
'Configuration is incomplete. Please ensure all values are set in defaults.json.',
51-
);
52-
}
5342
} catch (error: any) {
5443
showError({ text: `An error occurred: ${error.message}` });
5544
process.exit(1);

0 commit comments

Comments
 (0)