From 003934e2aa02715cefb1db2c6389c7bd2cebc802 Mon Sep 17 00:00:00 2001 From: "Rob Moore (MakerX)" Date: Wed, 28 Aug 2024 00:30:32 +0800 Subject: [PATCH] Renamed AlgokitComposer to AlgoKitComposer --- src/transaction/legacy-bridge.ts | 6 +++--- src/types/account-manager.ts | 4 ++-- src/types/algorand-client.ts | 8 ++++---- src/types/asset-manager.ts | 4 ++-- src/types/composer.ts | 24 ++++++++++++------------ src/types/kmd-account-manager.ts | 4 ++-- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/transaction/legacy-bridge.ts b/src/transaction/legacy-bridge.ts index 6a240bdf..2c4332cd 100644 --- a/src/transaction/legacy-bridge.ts +++ b/src/transaction/legacy-bridge.ts @@ -1,6 +1,6 @@ import algosdk from 'algosdk' import { AlgorandClient, SendSingleTransactionResult } from '../types/algorand-client' -import AlgokitComposer, { CommonTransactionParams, ExecuteParams } from '../types/composer' +import AlgoKitComposer, { CommonTransactionParams, ExecuteParams } from '../types/composer' import { SendTransactionFrom, SendTransactionParams, SendTransactionResult } from '../types/transaction' import { getSenderTransactionSigner, getTransactionParams } from './transaction' import Algodv2 = algosdk.Algodv2 @@ -40,11 +40,11 @@ export async function legacySendTransactionBridgeComposer (params: T) => AlgokitComposer, + compose: (c: AlgoKitComposer) => (params: T) => AlgoKitComposer, sendParams?: SendTransactionParams, suggestedParams?: algosdk.SuggestedParams, ): Promise { - const composer = new AlgokitComposer({ + const composer = new AlgoKitComposer({ algod, getSigner: (address) => getSenderTransactionSigner(from), getSuggestedParams: async () => await getTransactionParams(suggestedParams, algod), diff --git a/src/types/account-manager.ts b/src/types/account-manager.ts index e9bc73a1..ef502d81 100644 --- a/src/types/account-manager.ts +++ b/src/types/account-manager.ts @@ -5,7 +5,7 @@ import { AccountInformation, DISPENSER_ACCOUNT, MultisigAccount, SigningAccount, import { SendSingleTransactionResult } from './algorand-client' import { AlgoAmount } from './amount' import { ClientManager } from './client-manager' -import AlgokitComposer, { CommonTransactionParams, ExecuteParams } from './composer' +import AlgoKitComposer, { CommonTransactionParams, ExecuteParams } from './composer' import { TestNetDispenserApiClient } from './dispenser-client' import { KmdAccountManager } from './kmd-account-manager' import LogicSigAccount = algosdk.LogicSigAccount @@ -58,7 +58,7 @@ export class AccountManager { } private _getComposer(getSuggestedParams?: () => Promise) { - return new AlgokitComposer({ + return new AlgoKitComposer({ algod: this._clientManager.algod, getSigner: this.getSigner.bind(this), getSuggestedParams: getSuggestedParams ?? (() => this._clientManager.algod.getTransactionParams().do()), diff --git a/src/types/algorand-client.ts b/src/types/algorand-client.ts index 627d3687..bc707b4b 100644 --- a/src/types/algorand-client.ts +++ b/src/types/algorand-client.ts @@ -4,7 +4,7 @@ import { MultisigAccount, SigningAccount, TransactionSignerAccount } from './acc import { AccountManager } from './account-manager' import { AssetManager } from './asset-manager' import { AlgoSdkClients, ClientManager } from './client-manager' -import AlgokitComposer, { AssetCreateParams, AssetOptOutParams, ExecuteParams, MethodCallParams } from './composer' +import AlgoKitComposer, { AssetCreateParams, AssetOptOutParams, ExecuteParams, MethodCallParams } from './composer' import { AlgoConfig } from './network-client' import { ConfirmedTransactionResult, SendAtomicTransactionComposerResults } from './transaction' import Transaction = algosdk.Transaction @@ -142,7 +142,7 @@ export class AlgorandClient { /** Start a new `AlgokitComposer` transaction group */ public newGroup() { - return new AlgokitComposer({ + return new AlgoKitComposer({ algod: this.client.algod, getSigner: (addr: string) => this.account.getSigner(addr), getSuggestedParams: () => this.getSuggestedParams(), @@ -151,7 +151,7 @@ export class AlgorandClient { } private _send( - c: (c: AlgokitComposer) => (params: T) => AlgokitComposer, + c: (c: AlgoKitComposer) => (params: T) => AlgoKitComposer, log?: { preLog?: (params: T, transaction: Transaction) => string postLog?: (params: T, result: SendSingleTransactionResult) => string @@ -589,7 +589,7 @@ export class AlgorandClient { }), } - private _transaction(c: (c: AlgokitComposer) => (params: T) => AlgokitComposer): (params: T) => Promise { + private _transaction(c: (c: AlgoKitComposer) => (params: T) => AlgoKitComposer): (params: T) => Promise { return async (params: T) => { const composer = this.newGroup() const result = await c(composer).apply(composer, [params]).build() diff --git a/src/types/asset-manager.ts b/src/types/asset-manager.ts index 8b2b15e1..a41825ad 100644 --- a/src/types/asset-manager.ts +++ b/src/types/asset-manager.ts @@ -4,7 +4,7 @@ import { chunkArray } from '../util' import { AccountAssetInformation, TransactionSignerAccount } from './account' import { AccountManager } from './account-manager' import { ClientManager } from './client-manager' -import AlgokitComposer, { CommonTransactionParams, ExecuteParams, MAX_TRANSACTION_GROUP_SIZE } from './composer' +import AlgoKitComposer, { CommonTransactionParams, ExecuteParams, MAX_TRANSACTION_GROUP_SIZE } from './composer' import AssetModel = algosdk.modelsv2.Asset /** Individual result from performing a bulk opt-in or bulk opt-out for an account against a series of assets. */ @@ -155,7 +155,7 @@ export class AssetManager { } private _getComposer(getSuggestedParams?: () => Promise) { - return new AlgokitComposer({ + return new AlgoKitComposer({ algod: this._clientManager.algod, getSigner: this._accountManager.getSigner.bind(this._accountManager), getSuggestedParams: getSuggestedParams ?? (() => this._clientManager.algod.getTransactionParams().do()), diff --git a/src/types/composer.ts b/src/types/composer.ts index c247759b..c24e1eba 100644 --- a/src/types/composer.ts +++ b/src/types/composer.ts @@ -399,7 +399,7 @@ export type AlgoKitComposerParams = { } /** AlgoKit Composer helps you compose and execute transactions as a transaction group. */ -export default class AlgokitComposer { +export default class AlgoKitComposer { /** The ATC used to compose the group */ private atc = new algosdk.AtomicTransactionComposer() @@ -442,7 +442,7 @@ export default class AlgokitComposer { * @param params The payment transaction parameters * @returns The composer so you can chain method calls */ - addPayment(params: PaymentParams): AlgokitComposer { + addPayment(params: PaymentParams): AlgoKitComposer { this.txns.push({ ...params, type: 'pay' }) return this @@ -453,7 +453,7 @@ export default class AlgokitComposer { * @param params The asset create transaction parameters * @returns The composer so you can chain method calls */ - addAssetCreate(params: AssetCreateParams): AlgokitComposer { + addAssetCreate(params: AssetCreateParams): AlgoKitComposer { this.txns.push({ ...params, type: 'assetCreate' }) return this @@ -464,7 +464,7 @@ export default class AlgokitComposer { * @param params The asset config transaction parameters * @returns The composer so you can chain method calls */ - addAssetConfig(params: AssetConfigParams): AlgokitComposer { + addAssetConfig(params: AssetConfigParams): AlgoKitComposer { this.txns.push({ ...params, type: 'assetConfig' }) return this @@ -475,7 +475,7 @@ export default class AlgokitComposer { * @param params The asset freeze transaction parameters * @returns The composer so you can chain method calls */ - addAssetFreeze(params: AssetFreezeParams): AlgokitComposer { + addAssetFreeze(params: AssetFreezeParams): AlgoKitComposer { this.txns.push({ ...params, type: 'assetFreeze' }) return this @@ -486,7 +486,7 @@ export default class AlgokitComposer { * @param params The asset destroy transaction parameters * @returns The composer so you can chain method calls */ - addAssetDestroy(params: AssetDestroyParams): AlgokitComposer { + addAssetDestroy(params: AssetDestroyParams): AlgoKitComposer { this.txns.push({ ...params, type: 'assetDestroy' }) return this @@ -497,7 +497,7 @@ export default class AlgokitComposer { * @param params The asset transfer transaction parameters * @returns The composer so you can chain method calls */ - addAssetTransfer(params: AssetTransferParams): AlgokitComposer { + addAssetTransfer(params: AssetTransferParams): AlgoKitComposer { this.txns.push({ ...params, type: 'assetTransfer' }) return this @@ -508,7 +508,7 @@ export default class AlgokitComposer { * @param params The asset opt-in transaction parameters * @returns The composer so you can chain method calls */ - addAssetOptIn(params: AssetOptInParams): AlgokitComposer { + addAssetOptIn(params: AssetOptInParams): AlgoKitComposer { this.txns.push({ ...params, type: 'assetOptIn' }) return this @@ -519,7 +519,7 @@ export default class AlgokitComposer { * @param params The asset opt-out transaction parameters * @returns The composer so you can chain method calls */ - addAssetOptOut(params: AssetOptOutParams): AlgokitComposer { + addAssetOptOut(params: AssetOptOutParams): AlgoKitComposer { this.txns.push({ ...params, type: 'assetOptOut' }) return this @@ -532,7 +532,7 @@ export default class AlgokitComposer { * @param params The application call transaction parameters * @returns The composer so you can chain method calls */ - addAppCall(params: AppCallParams): AlgokitComposer { + addAppCall(params: AppCallParams): AlgoKitComposer { this.txns.push({ ...params, type: 'appCall' }) return this @@ -555,7 +555,7 @@ export default class AlgokitComposer { * @param params The online key registration transaction parameters * @returns The composer so you can chain method calls */ - addOnlineKeyRegistration(params: OnlineKeyRegistrationParams): AlgokitComposer { + addOnlineKeyRegistration(params: OnlineKeyRegistrationParams): AlgoKitComposer { this.txns.push({ ...params, type: 'keyReg' }) return this @@ -566,7 +566,7 @@ export default class AlgokitComposer { * @param atc The `AtomicTransactionComposer` to build transactions from and add to the group * @returns The composer so you can chain method calls */ - addAtc(atc: algosdk.AtomicTransactionComposer): AlgokitComposer { + addAtc(atc: algosdk.AtomicTransactionComposer): AlgoKitComposer { this.txns.push({ atc, type: 'atc' }) return this } diff --git a/src/types/kmd-account-manager.ts b/src/types/kmd-account-manager.ts index bb8f6875..7cc876d3 100644 --- a/src/types/kmd-account-manager.ts +++ b/src/types/kmd-account-manager.ts @@ -3,7 +3,7 @@ import { Config } from '../config' import { SigningAccount, TransactionSignerAccount } from './account' import { AlgoAmount } from './amount' import { ClientManager } from './client-manager' -import AlgokitComposer from './composer' +import AlgoKitComposer from './composer' /** Provides abstractions over a [KMD](https://github.com/algorand/go-algorand/blob/master/daemon/kmd/README.md) instance * that makes it easier to get and manage accounts using KMD. */ @@ -161,7 +161,7 @@ export class KmdAccountManager { // Fund the account from the dispenser const dispenser = await this.getLocalNetDispenserAccount() - await new AlgokitComposer({ + await new AlgoKitComposer({ algod: this._clientManager.algod, getSigner: () => dispenser.signer, getSuggestedParams: () => this._clientManager.algod.getTransactionParams().do(),