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: puya debugger support; algokit v7 updates (#71)
* feat: migrating to latest beta prereleases of utils, utils-debug and generator * chore: disabling mypy in tests and artifacts folders for python generator cases * chore: pinning mypy to 1.11.0; to be resolved in separate pr * chore: temporary setting puya installation from puya debugging branch * chore: temporary setting per branch install of algokit-utils-py with puya debugging * docs: tweak to ensure debugging docs are included on starter presets too * chore: refresh puya installation * chore: update to the latest packages * chore: add support for utils v7 --------- Co-authored-by: Neil Campbell <[email protected]>
- Loading branch information
1 parent
60fddfb
commit 20eba3c
Showing
38 changed files
with
273 additions
and
236 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -44,6 +44,11 @@ jobs: | |
# set git user and email as test invoke git | ||
git config --global user.email "[email protected]" && git config --global user.name "github-actions" | ||
- name: Setup Node.js 20.x | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.x" | ||
|
||
- name: Run tests | ||
shell: bash | ||
run: | | ||
|
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
...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
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
...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
Oops, something went wrong.