1
- import { Account , Application , Bytes , bytes , gtxn , internal , Uint64 , uint64 } from '@algorandfoundation/algorand-typescript'
1
+ import type {
2
+ bytes ,
3
+ gtxn ,
4
+ internal ,
5
+ uint64 ,
6
+ Account as AccountType ,
7
+ Application as ApplicationType ,
8
+ } from '@algorandfoundation/algorand-typescript'
9
+ import { Bytes , Uint64 } from '@algorandfoundation/algorand-typescript'
2
10
import { lazyContext } from '../context-helpers/internal-context'
3
11
import { asMaybeUint64Cls , asUint64 } from '../util'
12
+ import { Account } from './reference'
4
13
5
14
const resolveAppIndex = ( appIdOrIndex : internal . primitives . StubUint64Compat ) : uint64 => {
6
15
const input = asUint64 ( appIdOrIndex )
@@ -11,52 +20,52 @@ const resolveAppIndex = (appIdOrIndex: internal.primitives.StubUint64Compat): ui
11
20
return txn . apps ( input ) . id
12
21
}
13
22
14
- export const getApp = ( app : Application | internal . primitives . StubUint64Compat ) : Application | undefined => {
23
+ export const getApp = ( app : ApplicationType | internal . primitives . StubUint64Compat ) : ApplicationType | undefined => {
15
24
try {
16
25
const appId = asMaybeUint64Cls ( app )
17
26
if ( appId !== undefined ) {
18
27
return lazyContext . ledger . getApplication ( resolveAppIndex ( appId ) )
19
28
}
20
- return app as Application
29
+ return app as ApplicationType
21
30
} catch {
22
31
return undefined
23
32
}
24
33
}
25
34
26
35
export const AppParams : internal . opTypes . AppParamsType = {
27
- appApprovalProgram ( a : Application | internal . primitives . StubUint64Compat ) : readonly [ bytes , boolean ] {
36
+ appApprovalProgram ( a : ApplicationType | internal . primitives . StubUint64Compat ) : readonly [ bytes , boolean ] {
28
37
const app = getApp ( a )
29
38
return app === undefined ? [ Bytes ( ) , false ] : [ app . approvalProgram , true ]
30
39
} ,
31
- appClearStateProgram ( a : Application | internal . primitives . StubUint64Compat ) : readonly [ bytes , boolean ] {
40
+ appClearStateProgram ( a : ApplicationType | internal . primitives . StubUint64Compat ) : readonly [ bytes , boolean ] {
32
41
const app = getApp ( a )
33
42
return app === undefined ? [ Bytes ( ) , false ] : [ app . clearStateProgram , true ]
34
43
} ,
35
- appGlobalNumUint ( a : Application | internal . primitives . StubUint64Compat ) : readonly [ uint64 , boolean ] {
44
+ appGlobalNumUint ( a : ApplicationType | internal . primitives . StubUint64Compat ) : readonly [ uint64 , boolean ] {
36
45
const app = getApp ( a )
37
46
return app === undefined ? [ Uint64 ( 0 ) , false ] : [ app . globalNumUint , true ]
38
47
} ,
39
- appGlobalNumByteSlice ( a : Application | internal . primitives . StubUint64Compat ) : readonly [ uint64 , boolean ] {
48
+ appGlobalNumByteSlice ( a : ApplicationType | internal . primitives . StubUint64Compat ) : readonly [ uint64 , boolean ] {
40
49
const app = getApp ( a )
41
50
return app === undefined ? [ Uint64 ( 0 ) , false ] : [ app . globalNumBytes , true ]
42
51
} ,
43
- appLocalNumUint ( a : Application | internal . primitives . StubUint64Compat ) : readonly [ uint64 , boolean ] {
52
+ appLocalNumUint ( a : ApplicationType | internal . primitives . StubUint64Compat ) : readonly [ uint64 , boolean ] {
44
53
const app = getApp ( a )
45
54
return app === undefined ? [ Uint64 ( 0 ) , false ] : [ app . localNumUint , true ]
46
55
} ,
47
- appLocalNumByteSlice ( a : Application | internal . primitives . StubUint64Compat ) : readonly [ uint64 , boolean ] {
56
+ appLocalNumByteSlice ( a : ApplicationType | internal . primitives . StubUint64Compat ) : readonly [ uint64 , boolean ] {
48
57
const app = getApp ( a )
49
58
return app === undefined ? [ Uint64 ( 0 ) , false ] : [ app . localNumBytes , true ]
50
59
} ,
51
- appExtraProgramPages ( a : Application | internal . primitives . StubUint64Compat ) : readonly [ uint64 , boolean ] {
60
+ appExtraProgramPages ( a : ApplicationType | internal . primitives . StubUint64Compat ) : readonly [ uint64 , boolean ] {
52
61
const app = getApp ( a )
53
62
return app === undefined ? [ Uint64 ( 0 ) , false ] : [ app . extraProgramPages , true ]
54
63
} ,
55
- appCreator ( a : Application | internal . primitives . StubUint64Compat ) : readonly [ Account , boolean ] {
64
+ appCreator ( a : ApplicationType | internal . primitives . StubUint64Compat ) : readonly [ AccountType , boolean ] {
56
65
const app = getApp ( a )
57
66
return app === undefined ? [ Account ( ) , false ] : [ app . creator , true ]
58
67
} ,
59
- appAddress ( a : Application | internal . primitives . StubUint64Compat ) : readonly [ Account , boolean ] {
68
+ appAddress ( a : ApplicationType | internal . primitives . StubUint64Compat ) : readonly [ AccountType , boolean ] {
60
69
const app = getApp ( a )
61
70
return app === undefined ? [ Account ( ) , false ] : [ app . address , true ]
62
71
} ,
0 commit comments