generated from algorandfoundation/algokit-beaker-default-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrating to latest beta prereleases of utils, utils-debug and …
…generator
- Loading branch information
1 parent
42feefa
commit 60700af
Showing
11 changed files
with
122 additions
and
120 deletions.
There are no files selected for viewing
28 changes: 14 additions & 14 deletions
28
...lgokit/generators/create_contract/smart_contracts/{{ contract_name }}/deploy-config.ts.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
import * as algokit from '@algorandfoundation/algokit-utils' | ||
import { {{ contract_name.split('_')|map('capitalize')|join }}Client } from '../artifacts/{{ contract_name }}/{{ contract_name.split('_')|map('capitalize')|join }}Client' | ||
import { {{ contract_name.split('_')|map('capitalize')|join }}Factory } from '../artifacts/{{ contract_name }}/{{ contract_name.split('_')|map('capitalize')|join }}Client' | ||
|
||
// Below is a showcase of various deployment options you can use in TypeScript Client | ||
export async function deploy() { | ||
console.log('=== Deploying {{ contract_name.split('_')|map('capitalize')|join }} ===') | ||
|
||
const algorand = algokit.AlgorandClient.fromEnvironment() | ||
const deployer = await algorand.account.fromEnvironment('DEPLOYER') | ||
|
||
const appClient = algorand.client.getTypedAppClientByCreatorAndName({{ contract_name.split('_')|map('capitalize')|join }}Client, { | ||
sender: deployer, | ||
creatorAddress: deployer.addr, | ||
}) | ||
|
||
const app = await appClient.deploy({ | ||
onSchemaBreak: 'append', | ||
onUpdate: 'append', | ||
const factory = algorand.client.getTypedAppFactory({{ contract_name.split('_')|map('capitalize')|join }}Factory, { | ||
defaultSender: deployer.addr, | ||
}) | ||
|
||
const { appClient, result } = await factory.deploy({ onUpdate: 'append', onSchemaBreak: 'append' }) | ||
|
||
// If app was just created fund the app account | ||
if (['create', 'replace'].includes(app.operationPerformed)) { | ||
if (['create', 'replace'].includes(result.operationPerformed)) { | ||
await algorand.send.payment({ | ||
amount: algokit.algos(1), | ||
amount: (1).algo(), | ||
sender: deployer.addr, | ||
receiver: app.appAddress, | ||
}) | ||
} | ||
|
||
const method = 'hello' | ||
const response = await appClient.hello({ name: 'world' }) | ||
console.log(`Called ${method} on ${app.name} (${app.appId}) with name = world, received: ${response.return}`) | ||
const method = 'hello' | ||
const response = await appClient.send.hello({ | ||
args: { name: 'world' }, | ||
}) | ||
console.log( | ||
`Called ${method} on ${appClient.appClient.appName} (${appClient.appClient.appId}) with name = world, received: ${response.return}`, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 14 additions & 14 deletions
28
...roduction_python_smart_contract_typescript/smart_contracts/cool_contract/deploy-config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
import * as algokit from '@algorandfoundation/algokit-utils' | ||
import { CoolContractClient } from '../artifacts/cool_contract/CoolContractClient' | ||
import { CoolContractFactory } from '../artifacts/cool_contract/CoolContractClient' | ||
|
||
// Below is a showcase of various deployment options you can use in TypeScript Client | ||
export async function deploy() { | ||
console.log('=== Deploying CoolContract ===') | ||
|
||
const algorand = algokit.AlgorandClient.fromEnvironment() | ||
const deployer = await algorand.account.fromEnvironment('DEPLOYER') | ||
|
||
const appClient = algorand.client.getTypedAppClientByCreatorAndName(CoolContractClient, { | ||
sender: deployer, | ||
creatorAddress: deployer.addr, | ||
}) | ||
|
||
const app = await appClient.deploy({ | ||
onSchemaBreak: 'append', | ||
onUpdate: 'append', | ||
const factory = algorand.client.getTypedAppFactory(CoolContractFactory, { | ||
defaultSender: deployer.addr, | ||
}) | ||
|
||
const { appClient, result } = await factory.deploy({ onUpdate: 'append', onSchemaBreak: 'append' }) | ||
|
||
// If app was just created fund the app account | ||
if (['create', 'replace'].includes(app.operationPerformed)) { | ||
if (['create', 'replace'].includes(result.operationPerformed)) { | ||
await algorand.send.payment({ | ||
amount: algokit.algos(1), | ||
amount: (1).algo(), | ||
sender: deployer.addr, | ||
receiver: app.appAddress, | ||
}) | ||
} | ||
|
||
const method = 'hello' | ||
const response = await appClient.hello({ name: 'world' }) | ||
console.log(`Called ${method} on ${app.name} (${app.appId}) with name = world, received: ${response.return}`) | ||
const method = 'hello' | ||
const response = await appClient.send.hello({ | ||
args: { name: 'world' }, | ||
}) | ||
console.log( | ||
`Called ${method} on ${appClient.appClient.appName} (${appClient.appClient.appId}) with name = world, received: ${response.return}`, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 14 additions & 14 deletions
28
...}}{% endraw %}/{% if deployment_language == 'typescript' %}deploy-config.ts.j2{% endif %}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
import * as algokit from '@algorandfoundation/algokit-utils' | ||
import { {{ contract_name.split('_')|map('capitalize')|join }}Client } from '../artifacts/{{ contract_name }}/{{ contract_name.split('_')|map('capitalize')|join }}Client' | ||
import { {{ contract_name.split('_')|map('capitalize')|join }}Factory } from '../artifacts/{{ contract_name }}/{{ contract_name.split('_')|map('capitalize')|join }}Client' | ||
|
||
// Below is a showcase of various deployment options you can use in TypeScript Client | ||
export async function deploy() { | ||
console.log('=== Deploying {{ contract_name.split('_')|map('capitalize')|join }} ===') | ||
|
||
const algorand = algokit.AlgorandClient.fromEnvironment() | ||
const deployer = await algorand.account.fromEnvironment('DEPLOYER') | ||
|
||
const appClient = algorand.client.getTypedAppClientByCreatorAndName({{ contract_name.split('_')|map('capitalize')|join }}Client, { | ||
sender: deployer, | ||
creatorAddress: deployer.addr, | ||
}) | ||
|
||
const app = await appClient.deploy({ | ||
onSchemaBreak: 'append', | ||
onUpdate: 'append', | ||
const factory = algorand.client.getTypedAppFactory({{ contract_name.split('_')|map('capitalize')|join }}Factory, { | ||
defaultSender: deployer.addr, | ||
}) | ||
|
||
const { appClient, result } = await factory.deploy({ onUpdate: 'append', onSchemaBreak: 'append' }) | ||
|
||
// If app was just created fund the app account | ||
if (['create', 'replace'].includes(app.operationPerformed)) { | ||
if (['create', 'replace'].includes(result.operationPerformed)) { | ||
await algorand.send.payment({ | ||
amount: algokit.algos(1), | ||
amount: (1).algo(), | ||
sender: deployer.addr, | ||
receiver: app.appAddress, | ||
}) | ||
} | ||
|
||
const method = 'hello' | ||
const response = await appClient.hello({ name: 'world' }) | ||
console.log(`Called ${method} on ${app.name} (${app.appId}) with name = world, received: ${response.return}`) | ||
const method = 'hello' | ||
const response = await appClient.send.hello({ | ||
args: { name: 'world' }, | ||
}) | ||
console.log( | ||
`Called ${method} on ${appClient.appClient.appName} (${appClient.appClient.appId}) with name = world, received: ${response.return}`, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.