diff --git a/examples/production/smart_contracts/hello_world/contract.algo.ts b/examples/production/smart_contracts/hello_world/contract.algo.ts index 1d0c613..5e2fcfe 100644 --- a/examples/production/smart_contracts/hello_world/contract.algo.ts +++ b/examples/production/smart_contracts/hello_world/contract.algo.ts @@ -2,10 +2,6 @@ import { Contract } from '@algorandfoundation/algorand-typescript' export class HelloWorld extends Contract { public hello(name: string): string { - return `${this.getHello()} ${name}` - } - - private getHello() { - return 'Hello' + return `Hello, ${name}` } } diff --git a/examples/production/smart_contracts/hello_world/contract.e2e.spec.ts b/examples/production/smart_contracts/hello_world/contract.e2e.spec.ts index 713e1af..981099c 100644 --- a/examples/production/smart_contracts/hello_world/contract.e2e.spec.ts +++ b/examples/production/smart_contracts/hello_world/contract.e2e.spec.ts @@ -14,14 +14,17 @@ describe('HelloWorld contract', () => { }) registerDebugEventHandlers() }) - beforeEach(localnet.beforeEach) + beforeEach(localnet.newScope) const deploy = async (account: Address) => { const factory = localnet.algorand.client.getTypedAppFactory(HelloWorldFactory, { defaultSender: account, }) - const { appClient } = await factory.deploy({ onUpdate: 'append', onSchemaBreak: 'append' }) + const { appClient } = await factory.deploy({ + onUpdate: 'append', + onSchemaBreak: 'append', + }) return { client: appClient } } @@ -31,7 +34,7 @@ describe('HelloWorld contract', () => { const result = await client.send.hello({ args: { name: 'World' } }) - expect(result.return).toBe('Hello World') + expect(result.return).toBe('Hello, World') }) test('simulate says hello with correct budget consumed', async () => { @@ -43,8 +46,8 @@ describe('HelloWorld contract', () => { .hello({ args: { name: 'Jane' } }) .simulate() - expect(result.returns[0]).toBe('Hello World') - expect(result.returns[1]).toBe('Hello Jane') + expect(result.returns[0]).toBe('Hello, World') + expect(result.returns[1]).toBe('Hello, Jane') expect(result.simulateResponse.txnGroups[0].appBudgetConsumed).toBeLessThan(100) }) }) diff --git a/examples/production/smart_contracts/hello_world/contract.spec.ts b/examples/production/smart_contracts/hello_world/contract.spec.ts index a7df973..664eb72 100644 --- a/examples/production/smart_contracts/hello_world/contract.spec.ts +++ b/examples/production/smart_contracts/hello_world/contract.spec.ts @@ -9,6 +9,6 @@ describe('HelloWorld contract', () => { const result = contract.hello('Sally') - expect(result).toBe('Hello Sally') + expect(result).toBe('Hello, Sally') }) }) diff --git a/examples/starter/smart_contracts/hello_world/contract.algo.ts b/examples/starter/smart_contracts/hello_world/contract.algo.ts index 1d0c613..3737e90 100644 --- a/examples/starter/smart_contracts/hello_world/contract.algo.ts +++ b/examples/starter/smart_contracts/hello_world/contract.algo.ts @@ -1,11 +1,7 @@ import { Contract } from '@algorandfoundation/algorand-typescript' export class HelloWorld extends Contract { - public hello(name: string): string { - return `${this.getHello()} ${name}` - } - - private getHello() { - return 'Hello' + hello(name: string): string { + return `Hello, ${name}` } } diff --git a/template_content/.algokit/generators/create_contract/smart_contracts/{% raw %}{{ contract_name }}{% endraw %}/contract.algo.ts.j2 b/template_content/.algokit/generators/create_contract/smart_contracts/{% raw %}{{ contract_name }}{% endraw %}/contract.algo.ts.j2 index df34e0e..344c1a1 100644 --- a/template_content/.algokit/generators/create_contract/smart_contracts/{% raw %}{{ contract_name }}{% endraw %}/contract.algo.ts.j2 +++ b/template_content/.algokit/generators/create_contract/smart_contracts/{% raw %}{{ contract_name }}{% endraw %}/contract.algo.ts.j2 @@ -1,11 +1,7 @@ import { Contract } from '@algorandfoundation/algorand-typescript' export class {{ contract_name.split('_')|map('capitalize')|join }} extends Contract { - public hello(name: string): string { - return `${this.getHello()} ${name}` - } - - private getHello() { - return 'Hello' + {% if preset_name != 'starter' %}public {% endif %}hello(name: string): string { + return `Hello, ${name}` } } diff --git a/template_content/.algokit/generators/create_contract/smart_contracts/{% raw %}{{ contract_name }}{% endraw %}/{% raw %}{% if include_tests %}contract.e2e.spec.ts{% endif %}.j2{% endraw %} b/template_content/.algokit/generators/create_contract/smart_contracts/{% raw %}{{ contract_name }}{% endraw %}/{% raw %}{% if include_tests %}contract.e2e.spec.ts{% endif %}.j2{% endraw %} index aedd3b0..146e270 100644 --- a/template_content/.algokit/generators/create_contract/smart_contracts/{% raw %}{{ contract_name }}{% endraw %}/{% raw %}{% if include_tests %}contract.e2e.spec.ts{% endif %}.j2{% endraw %} +++ b/template_content/.algokit/generators/create_contract/smart_contracts/{% raw %}{{ contract_name }}{% endraw %}/{% raw %}{% if include_tests %}contract.e2e.spec.ts{% endif %}.j2{% endraw %} @@ -12,7 +12,7 @@ describe('{{ contract_name.split('_')|map('capitalize')|join }} contract', () => // traceAll: true, }) }) - beforeEach(localnet.beforeEach) + beforeEach(localnet.newScope) const deploy = async (account: Address) => { const factory = localnet.algorand.client.getTypedAppFactory({{ contract_name.split('_')|map('capitalize')|join }}Factory, { diff --git a/template_content/.editorconfig b/template_content/.editorconfig deleted file mode 100644 index 0a71b07..0000000 --- a/template_content/.editorconfig +++ /dev/null @@ -1,7 +0,0 @@ -root=true - -[*] -indent_style = space -indent_size = 2 -end_of_line = lf -insert_final_newline = true diff --git a/template_content/.npmrc b/template_content/.npmrc deleted file mode 100644 index c42da84..0000000 --- a/template_content/.npmrc +++ /dev/null @@ -1 +0,0 @@ -engine-strict = true diff --git a/template_content/smart_contracts/{{ contract_name }}/contract.algo.ts.jinja b/template_content/smart_contracts/{{ contract_name }}/contract.algo.ts.jinja index df34e0e..344c1a1 100644 --- a/template_content/smart_contracts/{{ contract_name }}/contract.algo.ts.jinja +++ b/template_content/smart_contracts/{{ contract_name }}/contract.algo.ts.jinja @@ -1,11 +1,7 @@ import { Contract } from '@algorandfoundation/algorand-typescript' export class {{ contract_name.split('_')|map('capitalize')|join }} extends Contract { - public hello(name: string): string { - return `${this.getHello()} ${name}` - } - - private getHello() { - return 'Hello' + {% if preset_name != 'starter' %}public {% endif %}hello(name: string): string { + return `Hello, ${name}` } } diff --git a/template_content/smart_contracts/{{ contract_name }}/{% if use_vitest %}contract.e2e.spec.ts{% endif %}.jinja b/template_content/smart_contracts/{{ contract_name }}/{% if use_vitest %}contract.e2e.spec.ts{% endif %}.jinja index 630f72c..f70528c 100644 --- a/template_content/smart_contracts/{{ contract_name }}/{% if use_vitest %}contract.e2e.spec.ts{% endif %}.jinja +++ b/template_content/smart_contracts/{{ contract_name }}/{% if use_vitest %}contract.e2e.spec.ts{% endif %}.jinja @@ -14,14 +14,17 @@ describe('{{ contract_name.split('_')|map('capitalize')|join }} contract', () => }) registerDebugEventHandlers() }) - beforeEach(localnet.beforeEach) + beforeEach(localnet.newScope) const deploy = async (account: Address) => { const factory = localnet.algorand.client.getTypedAppFactory({{ contract_name.split('_')|map('capitalize')|join }}Factory, { defaultSender: account, }) - const { appClient } = await factory.deploy({ onUpdate: 'append', onSchemaBreak: 'append' }) + const { appClient } = await factory.deploy({ + onUpdate: 'append', + onSchemaBreak: 'append', + }) return { client: appClient } } @@ -31,7 +34,7 @@ describe('{{ contract_name.split('_')|map('capitalize')|join }} contract', () => const result = await client.send.hello({ args: { name: 'World' } }) - expect(result.return).toBe('Hello World') + expect(result.return).toBe('Hello, World') }) test('simulate says hello with correct budget consumed', async () => { @@ -43,8 +46,8 @@ describe('{{ contract_name.split('_')|map('capitalize')|join }} contract', () => .hello({ args: { name: 'Jane' } }) .simulate() - expect(result.returns[0]).toBe('Hello World') - expect(result.returns[1]).toBe('Hello Jane') + expect(result.returns[0]).toBe('Hello, World') + expect(result.returns[1]).toBe('Hello, Jane') expect(result.simulateResponse.txnGroups[0].appBudgetConsumed).toBeLessThan(100) }) }) diff --git a/template_content/smart_contracts/{{ contract_name }}/{% if use_vitest %}contract.spec.ts{% endif %}.jinja b/template_content/smart_contracts/{{ contract_name }}/{% if use_vitest %}contract.spec.ts{% endif %}.jinja index e7a7414..c368813 100644 --- a/template_content/smart_contracts/{{ contract_name }}/{% if use_vitest %}contract.spec.ts{% endif %}.jinja +++ b/template_content/smart_contracts/{{ contract_name }}/{% if use_vitest %}contract.spec.ts{% endif %}.jinja @@ -9,6 +9,6 @@ describe('{{ contract_name.split('_')|map('capitalize')|join }} contract', () => const result = contract.hello('Sally') - expect(result).toBe('Hello Sally') + expect(result).toBe('Hello, Sally') }) }) diff --git a/template_content/{% if not use_workspace %}.gitattributes{% endif %} b/template_content/{% if not use_workspace %}.gitattributes{% endif %} deleted file mode 100644 index 6313b56..0000000 --- a/template_content/{% if not use_workspace %}.gitattributes{% endif %} +++ /dev/null @@ -1 +0,0 @@ -* text=auto eol=lf diff --git a/examples/starter/.gitattributes b/template_content/{% if not use_workspace and preset_name != 'starter' %}.gitattributes{% endif %} similarity index 100% rename from examples/starter/.gitattributes rename to template_content/{% if not use_workspace and preset_name != 'starter' %}.gitattributes{% endif %} diff --git a/examples/starter/.editorconfig b/template_content/{% if preset_name != 'starter' %}.editorconfig{% endif %} similarity index 100% rename from examples/starter/.editorconfig rename to template_content/{% if preset_name != 'starter' %}.editorconfig{% endif %} diff --git a/examples/starter/.npmrc b/template_content/{% if preset_name != 'starter' %}.npmrc{% endif %} similarity index 100% rename from examples/starter/.npmrc rename to template_content/{% if preset_name != 'starter' %}.npmrc{% endif %}