Skip to content

Commit

Permalink
implement itxn and itxn create op codes
Browse files Browse the repository at this point in the history
  • Loading branch information
boblat committed Sep 27, 2024
1 parent c118fc9 commit 11c535b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/algo-ts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/algo-ts/src/arc4/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class Contract extends BaseContract {
}

export type CreateOptions = 'allow' | 'disallow' | 'require'
export type OnCompleteActionStr = 'NoOp' | 'OptIn' | 'CloseOut' | 'UpdateApplication' | 'DeleteApplication'
export type OnCompleteActionStr = 'NoOp' | 'OptIn' | 'ClearState' | 'CloseOut' | 'UpdateApplication' | 'DeleteApplication'

export enum OnCompleteAction {
NoOp = Uint64(0),
Expand Down
18 changes: 8 additions & 10 deletions packages/algo-ts/src/itxn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface ApplicationInnerTxn extends txnTypes.ApplicationTxn {
[isItxn]?: true
}

interface CommonTransactionFields {
export interface CommonTransactionFields {
/**
* 32 byte address
*/
Expand All @@ -52,7 +52,7 @@ interface CommonTransactionFields {
rekeyTo?: Account | string
}

interface PaymentFields extends CommonTransactionFields {
export interface PaymentFields extends CommonTransactionFields {
/**
* The amount, in microALGO, to transfer
*
Expand All @@ -67,7 +67,7 @@ interface PaymentFields extends CommonTransactionFields {
*/
closeRemainderTo?: Account
}
interface KeyRegistrationFields extends CommonTransactionFields {
export interface KeyRegistrationFields extends CommonTransactionFields {
/**
* 32 byte address
*/
Expand Down Expand Up @@ -103,7 +103,7 @@ interface KeyRegistrationFields extends CommonTransactionFields {
*/
stateProofKey?: bytes
}
interface AssetTransferFields extends CommonTransactionFields {
export interface AssetTransferFields extends CommonTransactionFields {
/** The asset being transferred */
xferAsset: Asset
/** The amount of the asset being transferred */
Expand All @@ -115,8 +115,7 @@ interface AssetTransferFields extends CommonTransactionFields {
/** The address to close the asset to */
assetCloseTo?: Account
}

interface AssetConfigFields extends CommonTransactionFields {
export interface AssetConfigFields extends CommonTransactionFields {
configAsset?: Asset
manager?: Account
reserve?: Account
Expand All @@ -130,14 +129,12 @@ interface AssetConfigFields extends CommonTransactionFields {
url?: string | bytes
metadataHash?: bytes
}

interface AssetFreezeFields extends CommonTransactionFields {
export interface AssetFreezeFields extends CommonTransactionFields {
freezeAsset: Asset | uint64
freezeAccount?: Account | string
frozen?: boolean
}

interface ApplicationCallFields extends CommonTransactionFields {
export interface ApplicationCallFields extends CommonTransactionFields {
appId?: Application | uint64
approvalProgram?: bytes | readonly [...bytes[]]
clearStateProgram?: bytes | readonly [...bytes[]]
Expand All @@ -152,6 +149,7 @@ interface ApplicationCallFields extends CommonTransactionFields {
assets?: readonly [...Asset[]]
apps?: readonly [...Application[]]
}

type InnerTransaction<TFields, TTransaction> = {
submit(): TTransaction
set(p: Partial<TFields>): void
Expand Down
4 changes: 4 additions & 0 deletions packages/algo-ts/src/op.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import {
GlobalType,
GTxnType,
ItobType,
ITxnCreateType,
ITxnType,
JsonRefType,
Keccak256Type,
MulwType,
Expand Down Expand Up @@ -118,6 +120,8 @@ export const Global: GlobalType = createObjectProxy('Global')
export const GTxn: GTxnType = createObjectProxy('GTxn')
export const JsonRef: JsonRefType = createObjectProxy('JsonRef')
export const Txn: TxnType = createObjectProxy('Txn')
export const ITxn: ITxnType = createObjectProxy('ITxn')
export const ITxnCreate: ITxnCreateType = createObjectProxy('ITxnCreate')

export const AcctParams = createObjectProxy('AcctParams')
export const AppParams = createObjectProxy('AppParams')
Expand Down

0 comments on commit 11c535b

Please sign in to comment.