Skip to content

Commit

Permalink
chore: regen artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
aorumbayev committed Dec 12, 2024
1 parent 026da71 commit f7644b8
Show file tree
Hide file tree
Showing 24 changed files with 1,181 additions and 931 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
git config --global user.email "[email protected]" && git config --global user.name "github-actions"
- name: Deploy to testnet
run: algokit deploy testnet --project-name 'production_python_react-contracts'
run: algokit project deploy testnet --project-name 'production_python_react-contracts'
env:
# This is the account that becomes the creator of the contract
DEPLOYER_MNEMONIC: ${{ secrets.DEPLOYER_MNEMONIC }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,26 @@
},
{
"path": "./projects/production_python_react-frontend"
},
{
"path": "."
},
{
"path": "projects/production_python_react-frontend"
},
{
"path": "projects/production_python_react-contracts"
},
{
"path": "."
}
],
"settings": {
"files.exclude": {
"projects/": true
},
"jest.disabledWorkspaceFolders": [
"ROOT",
"projects"
],
"jest.disabledWorkspaceFolders": ["ROOT", "projects"],
"dotenv.enableAutocloaking": false
},
"extensions": {
"recommendations": [
"joshx.workspace-terminals"
]
"recommendations": ["joshx.workspace-terminals"]
},

"tasks": {
"version": "2.0.0",
"tasks": [
{
"label": "Build artifacts (+ LocalNet)",
"command": "algokit",
"args": [
"project",
"run",
"build"
],
"args": ["project", "run", "build"],
"options": {
"cwd": "${workspaceFolder}"
},
Expand All @@ -58,10 +38,7 @@
{
"label": "Start AlgoKit LocalNet",
"command": "algokit",
"args": [
"localnet",
"start"
],
"args": ["localnet", "start"],
"type": "shell",
"options": {
"cwd": "${workspaceFolder}"
Expand All @@ -81,10 +58,7 @@
"name": "Deploy contracts",
"folder": "production_python_react-contracts"
},
{
"name": "Run dApp",
"folder": "production_python_react-frontend"
}
{ "name": "Run dApp", "folder": "production_python_react-frontend" }
],
"presentation": {
"hidden": false,
Expand All @@ -93,4 +67,4 @@
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: 1.4.2
_commit: 1.4.4
_src_path: gh:algorandfoundation/algokit-python-template
author_email: None
author_name: None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,9 @@ disallow_any_unimported = true
disallow_any_expr = true
disallow_any_decorated = true
disallow_any_explicit = true
untyped_calls_exclude = ["algosdk"]
# Remove if you prefer to use mypy's default behavior against
# untyped algosdk types
[[tool.mypy.overrides]]
module = "tests.*"
disallow_any_expr = false
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: 1.0.9
_commit: 1.0.11
_src_path: gh:algorandfoundation/algokit-react-frontend-template
author_email: None
author_name: None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { AlgorandClientInterface } from '@algorandfoundation/algokit-utils/types
import { ABIReturn, AppReturn, SendAppTransactionResult } from '@algorandfoundation/algokit-utils/types/app'
import { Arc56Contract, getArc56ReturnValue, getABIStructFromABITuple } from '@algorandfoundation/algokit-utils/types/app-arc56'
import {
AppClient,
AppClient as _AppClient,
AppClientMethodCallParams,
AppClientParams,
AppClientBareCallParams,
Expand All @@ -18,8 +18,8 @@ import {
ResolveAppClientByNetwork,
CloneAppClientParams,
} from '@algorandfoundation/algokit-utils/types/app-client'
import { AppFactory, AppFactoryAppClientParams, AppFactoryResolveAppClientByCreatorAndNameParams, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'
import { TransactionComposer, AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'
import { AppFactory as _AppFactory, AppFactoryAppClientParams, AppFactoryResolveAppClientByCreatorAndNameParams, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'
import { TransactionComposer, AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions, RawSimulateOptions, SkipSignaturesSimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'
import { SendParams, SendSingleTransactionResult, SendAtomicTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'
import { Address, encodeAddress, modelsv2, OnApplicationComplete, Transaction, TransactionSigner } from 'algosdk'
import SimulateResponse = modelsv2.SimulateResponse
Expand Down Expand Up @@ -175,15 +175,15 @@ export class HelloWorldFactory {
/**
* The underlying `AppFactory` for when you want to have more flexibility
*/
public readonly appFactory: AppFactory
public readonly appFactory: _AppFactory

/**
* Creates a new instance of `HelloWorldFactory`
*
* @param params The parameters to initialise the app factory with
*/
constructor(params: Omit<AppFactoryParams, 'appSpec'>) {
this.appFactory = new AppFactory({
this.appFactory = new _AppFactory({
...params,
appSpec: APP_SPEC,
})
Expand Down Expand Up @@ -277,10 +277,10 @@ export class HelloWorldFactory {
* Creates a new instance of the HelloWorld smart contract using a bare call.
*
* @param params The params for the bare (raw) call
* @returns The params for a create call
* @returns The transaction for a create call
*/
bare: (params?: Expand<AppClientBareCallParams & AppClientCompilationParams & CreateSchema & {onComplete?: OnApplicationComplete.NoOpOC}>) => {
return this.appFactory.params.bare.create(params)
return this.appFactory.createTransaction.bare.create(params)
},
},

Expand Down Expand Up @@ -316,22 +316,22 @@ export class HelloWorldClient {
/**
* The underlying `AppClient` for when you want to have more flexibility
*/
public readonly appClient: AppClient
public readonly appClient: _AppClient

/**
* Creates a new instance of `HelloWorldClient`
*
* @param appClient An `AppClient` instance which has been created with the HelloWorld app spec
*/
constructor(appClient: AppClient)
constructor(appClient: _AppClient)
/**
* Creates a new instance of `HelloWorldClient`
*
* @param params The parameters to initialise the app client with
*/
constructor(params: Omit<AppClientParams, 'appSpec'>)
constructor(appClientOrParams: AppClient | Omit<AppClientParams, 'appSpec'>) {
this.appClient = appClientOrParams instanceof AppClient ? appClientOrParams : new AppClient({
constructor(appClientOrParams: _AppClient | Omit<AppClientParams, 'appSpec'>) {
this.appClient = appClientOrParams instanceof _AppClient ? appClientOrParams : new _AppClient({
...appClientOrParams,
appSpec: APP_SPEC,
})
Expand All @@ -351,7 +351,7 @@ export class HelloWorldClient {
* @param params The parameters to create the app client
*/
public static async fromCreatorAndName(params: Omit<ResolveAppClientByCreatorAndName, 'appSpec'>): Promise<HelloWorldClient> {
return new HelloWorldClient(await AppClient.fromCreatorAndName({...params, appSpec: APP_SPEC}))
return new HelloWorldClient(await _AppClient.fromCreatorAndName({...params, appSpec: APP_SPEC}))
}

/**
Expand All @@ -364,7 +364,7 @@ export class HelloWorldClient {
static async fromNetwork(
params: Omit<ResolveAppClientByNetwork, 'appSpec'>
): Promise<HelloWorldClient> {
return new HelloWorldClient(await AppClient.fromNetwork({...params, appSpec: APP_SPEC}))
return new HelloWorldClient(await _AppClient.fromNetwork({...params, appSpec: APP_SPEC}))
}

/** The ID of the app instance this client is linked to. */
Expand Down Expand Up @@ -518,7 +518,7 @@ export class HelloWorldClient {
},
async simulate(options?: SimulateOptions) {
await promiseChain
const result = await composer.simulate(options)
const result = await (!options ? composer.simulate() : composer.simulate(options))
return {
...result,
returns: result.returns?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val) : val.returnValue)
Expand Down Expand Up @@ -567,7 +567,9 @@ export type HelloWorldComposer<TReturns extends [...any[]] = []> = {
/**
* Simulates the transaction group and returns the result
*/
simulate(options?: SimulateOptions): Promise<HelloWorldComposerResults<TReturns> & { simulateResponse: SimulateResponse }>
simulate(): Promise<HelloWorldComposerResults<TReturns> & { simulateResponse: SimulateResponse }>
simulate(options: SkipSignaturesSimulateOptions): Promise<HelloWorldComposerResults<TReturns> & { simulateResponse: SimulateResponse }>
simulate(options: RawSimulateOptions): Promise<HelloWorldComposerResults<TReturns> & { simulateResponse: SimulateResponse }>
/**
* Sends the transaction group to the network and returns the results
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ module.exports = {
themes: ['lofi'],
},
plugins: [require('daisyui')],
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,24 @@
},
{
"path": "./projects/production_tealscript_react-frontend"
},
{
"path": "."
},
{
"path": "projects/production_tealscript_react-frontend"
},
{
"path": "projects/production_tealscript_react-contracts"
},
{
"path": "."
}
],
"settings": {
"files.exclude": {
"projects/": true
},
"jest.disabledWorkspaceFolders": [
"ROOT",
"projects"
],
"jest.disabledWorkspaceFolders": ["ROOT", "projects"],
"dotenv.enableAutocloaking": false
},
"extensions": {
"recommendations": [
"joshx.workspace-terminals"
]
"recommendations": ["joshx.workspace-terminals"]
},

"tasks": {
"version": "2.0.0",
"tasks": []
},
"launch": {
"configurations": []
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { describe, test, expect, beforeAll, beforeEach } from '@jest/globals';
import { algorandFixture } from '@algorandfoundation/algokit-utils/testing';
import * as algokit from '@algorandfoundation/algokit-utils';
import { CalculatorClient } from '../contracts/clients/CalculatorClient';
import { Config } from '@algorandfoundation/algokit-utils';
import { CalculatorClient, CalculatorFactory } from '../contracts/clients/CalculatorClient';

const fixture = algorandFixture();
algokit.Config.configure({ populateAppCallResources: true });
Config.configure({ populateAppCallResources: true });

let appClient: CalculatorClient;

Expand All @@ -16,34 +16,31 @@ describe('Calculator', () => {
const { testAccount } = fixture.context;
const { algorand } = fixture;

appClient = new CalculatorClient(
{
sender: testAccount,
resolveBy: 'id',
id: 0,
},
algorand.client.algod
);
const factory = new CalculatorFactory({
algorand,
defaultSender: testAccount.addr,
});

await appClient.create.createApplication({});
const createResult = await factory.send.create.createApplication();
appClient = createResult.appClient;
});

test('sum', async () => {
const a = 13;
const b = 37;
const sum = await appClient.doMath({ a, b, operation: 'sum' });
expect(sum.return?.valueOf()).toBe(BigInt(a + b));
const sum = await appClient.send.doMath({ args: { a, b, operation: 'sum' } });
expect(sum.return).toBe(BigInt(a + b));
});

test('difference', async () => {
const a = 13;
const b = 37;
const diff = await appClient.doMath({ a, b, operation: 'difference' });
expect(diff.return?.valueOf()).toBe(BigInt(a >= b ? a - b : b - a));
const diff = await appClient.send.doMath({ args: { a, b, operation: 'difference' } });
expect(diff.return).toBe(BigInt(a >= b ? a - b : b - a));
});

test('hello', async () => {
const diff = await appClient.hello({ name: 'world!' });
expect(diff.return?.valueOf()).toBe('Hello, world!');
const hello = await appClient.send.hello({ args: { name: 'world!' } });
expect(hello.return).toBe('Hello, world!');
});
});
Loading

0 comments on commit f7644b8

Please sign in to comment.