Skip to content

Commit d7a6a4b

Browse files
committed
use lowercase for resourceEncoding options
1 parent 6b736b5 commit d7a6a4b

File tree

6 files changed

+30
-30
lines changed

6 files changed

+30
-30
lines changed

examples/precompiled/precompiled-apps.algo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class ReceivesTxns extends Contract {
102102
}
103103

104104
export class ReceivesReferenceTypes extends Contract {
105-
@abimethod({ resourceEncoding: 'Index' })
105+
@abimethod({ resourceEncoding: 'index' })
106106
receivesReferenceTypes(app: Application, acc: Account, asset: Asset) {
107107
log(app.address)
108108
log(acc.bytes)

src/impl/encoded-types/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ export const getArc4TypeName = (
9494
}
9595
const map: Record<string, string | ((t: TypeInfo) => string)> = {
9696
void: 'void',
97-
account: (_) => (resourceEncoding === 'Index' && direction === 'in' ? 'account' : 'address'),
98-
application: (_) => (resourceEncoding === 'Index' && direction === 'in' ? 'application' : 'uint64'),
99-
asset: (_) => (resourceEncoding === 'Index' && direction === 'in' ? 'asset' : 'uint64'),
97+
account: (_) => (resourceEncoding === 'index' && direction === 'in' ? 'account' : 'address'),
98+
application: (_) => (resourceEncoding === 'index' && direction === 'in' ? 'application' : 'uint64'),
99+
asset: (_) => (resourceEncoding === 'index' && direction === 'in' ? 'asset' : 'uint64'),
100100
boolean: 'bool',
101101
biguint: 'uint512',
102102
bytes: 'byte[]',

src/subcontexts/contract-context.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,21 @@ export const extractArraysFromArgs = (
106106
if (isTransaction(arg)) {
107107
transactions.push(arg)
108108
} else if (arg instanceof AccountCls) {
109-
if (resourceEncoding === 'Index') {
109+
if (resourceEncoding === 'index') {
110110
appArgs.push(getUint8Impl(accounts.length))
111111
accounts.push(arg as Account)
112112
} else {
113113
appArgs.push(getArc4Encoded(arg.bytes))
114114
}
115115
} else if (arg instanceof ApplicationCls) {
116-
if (resourceEncoding === 'Index') {
116+
if (resourceEncoding === 'index') {
117117
appArgs.push(getUint8Impl(apps.length))
118118
apps.push(arg as Application)
119119
} else {
120120
appArgs.push(getArc4Encoded(arg.id))
121121
}
122122
} else if (arg instanceof AssetCls) {
123-
if (resourceEncoding === 'Index') {
123+
if (resourceEncoding === 'index') {
124124
appArgs.push(getUint8Impl(assets.length))
125125
assets.push(arg as Asset)
126126
} else {

tests/artifacts/arc4-abi-method/contract.algo.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ export class SignaturesContract extends arc4.Contract {
4848
assert(pay.amount === 123)
4949
}
5050

51-
@arc4.abimethod({ resourceEncoding: 'Index' })
51+
@arc4.abimethod({ resourceEncoding: 'index' })
5252
withAsset(value: arc4.Str, asset: Asset, arr: UInt8Array) {
5353
assert(value.native)
5454
assert(arr.length)
5555
assert(asset.total === 123)
5656
assert(Txn.assets(0) === asset)
5757
}
5858

59-
@arc4.abimethod({ resourceEncoding: 'Index' })
59+
@arc4.abimethod({ resourceEncoding: 'index' })
6060
withApp(value: arc4.Str, app: Application, appId: arc4.Uint64, arr: UInt8Array) {
6161
assert(value.native)
6262
assert(arr.length)
@@ -69,7 +69,7 @@ export class SignaturesContract extends arc4.Contract {
6969
assert(Txn.applications(1) === app)
7070
}
7171

72-
@arc4.abimethod({ resourceEncoding: 'Index' })
72+
@arc4.abimethod({ resourceEncoding: 'index' })
7373
withAcc(value: arc4.Str, acc: Account, arr: UInt8Array) {
7474
assert(value.native)
7575
assert(arr.length)
@@ -78,7 +78,7 @@ export class SignaturesContract extends arc4.Contract {
7878
assert(Txn.accounts(1) === acc)
7979
}
8080

81-
@arc4.abimethod({ resourceEncoding: 'Index' })
81+
@arc4.abimethod({ resourceEncoding: 'index' })
8282
complexSig(struct1: MyStruct, txn: gtxn.PaymentTxn, acc: Account, five: UInt8Array): readonly [MyStructAlias, MyStruct] {
8383
assert(Txn.numAppArgs === 4)
8484

@@ -101,7 +101,7 @@ export class SignaturesContract extends arc4.Contract {
101101
return [clone(struct1.anotherStruct), clone(struct1)]
102102
}
103103

104-
@arc4.abimethod({ resourceEncoding: 'Index' })
104+
@arc4.abimethod({ resourceEncoding: 'index' })
105105
echoResourceByIndex(asset: Asset, app: Application, acc: Account) {
106106
const assetIdx = op.btoi(Txn.applicationArgs(1))
107107
assert(asset === Txn.assets(assetIdx), 'expected asset to be passed by Index')
@@ -112,7 +112,7 @@ export class SignaturesContract extends arc4.Contract {
112112
return [asset, app, acc] as const
113113
}
114114

115-
@arc4.abimethod({ resourceEncoding: 'Value' })
115+
@arc4.abimethod({ resourceEncoding: 'value' })
116116
echoResourceByValue(asset: Asset, app: Application, acc: Account): [Asset, Application, Account] {
117117
const assetId = op.btoi(Txn.applicationArgs(1))
118118
assert(asset === Asset(assetId), 'expected asset to be passed by Value')

tests/artifacts/resource-encoding/contract.algo.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import { abiCall, compileArc4 } from '@algorandfoundation/algorand-typescript/arc4'
1515

1616
class ByIndex extends Contract {
17-
@abimethod({ resourceEncoding: 'Index' })
17+
@abimethod({ resourceEncoding: 'index' })
1818
testExplicitIndex(account: Account) {
1919
return account.balance
2020
}
@@ -29,14 +29,14 @@ class ByIndex extends Contract {
2929
}
3030

3131
class ByValue extends Contract {
32-
@abimethod({ resourceEncoding: 'Value' })
32+
@abimethod({ resourceEncoding: 'value' })
3333
testExplicitValue(account: Account) {
3434
return account.balance
3535
}
3636
}
3737

3838
class EchoResource extends Contract {
39-
@abimethod({ resourceEncoding: 'Index' })
39+
@abimethod({ resourceEncoding: 'index' })
4040
echoResourceByIndex(asset: Asset, app: Application, acc: Account): [Asset, Application, Account] {
4141
const assetIdx = op.btoi(Txn.applicationArgs(1))
4242
assert(asset === Txn.assets(assetIdx), 'expected asset to be passed by Index')
@@ -47,7 +47,7 @@ class EchoResource extends Contract {
4747
return [asset, app, acc] as const
4848
}
4949

50-
@abimethod({ resourceEncoding: 'Value' })
50+
@abimethod({ resourceEncoding: 'value' })
5151
echoResourceByValue(asset: Asset, app: Application, acc: Account): [Asset, Application, Account] {
5252
const assetId = op.btoi(Txn.applicationArgs(1))
5353
assert(asset === Asset(assetId), 'expected asset to be passed by Value')

tests/artifacts/state-ops/contract.algo.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function get_1st_ref_index(): uint64 {
2424

2525
@contract({ name: 'StateAcctParamsGetContract', avmVersion: 11 })
2626
export class StateAcctParamsGetContract extends arc4.Contract {
27-
@arc4.abimethod({ resourceEncoding: 'Index' })
27+
@arc4.abimethod({ resourceEncoding: 'index' })
2828
public verify_acct_balance(a: Account): uint64 {
2929
const [value, funded] = op.AcctParams.acctBalance(a)
3030
const [value_index, funded_index] = op.AcctParams.acctBalance(get_1st_ref_index())
@@ -36,7 +36,7 @@ export class StateAcctParamsGetContract extends arc4.Contract {
3636
return value
3737
}
3838

39-
@arc4.abimethod({ resourceEncoding: 'Index' })
39+
@arc4.abimethod({ resourceEncoding: 'index' })
4040
public verify_acct_min_balance(a: Account): uint64 {
4141
const [value, funded] = op.AcctParams.acctMinBalance(a)
4242
const [value_index, funded_index] = op.AcctParams.acctMinBalance(get_1st_ref_index())
@@ -48,7 +48,7 @@ export class StateAcctParamsGetContract extends arc4.Contract {
4848
return value
4949
}
5050

51-
@arc4.abimethod({ resourceEncoding: 'Index' })
51+
@arc4.abimethod({ resourceEncoding: 'index' })
5252
public verify_acct_auth_addr(a: Account): Address {
5353
const [value, funded] = op.AcctParams.acctAuthAddr(a)
5454
const [value_index, funded_index] = op.AcctParams.acctAuthAddr(get_1st_ref_index())
@@ -57,7 +57,7 @@ export class StateAcctParamsGetContract extends arc4.Contract {
5757
return new Address(value)
5858
}
5959

60-
@arc4.abimethod({ resourceEncoding: 'Index' })
60+
@arc4.abimethod({ resourceEncoding: 'index' })
6161
public verify_acct_total_num_uint(a: Account): uint64 {
6262
const [value, funded] = op.AcctParams.acctTotalNumUint(a)
6363
const [value_index, funded_index] = op.AcctParams.acctTotalNumUint(get_1st_ref_index())
@@ -66,7 +66,7 @@ export class StateAcctParamsGetContract extends arc4.Contract {
6666
return value
6767
}
6868

69-
@arc4.abimethod({ resourceEncoding: 'Index' })
69+
@arc4.abimethod({ resourceEncoding: 'index' })
7070
public verify_acct_total_num_byte_slice(a: Account): uint64 {
7171
const [value, funded] = op.AcctParams.acctTotalNumByteSlice(a)
7272
const [value_index, funded_index] = op.AcctParams.acctTotalNumByteSlice(get_1st_ref_index())
@@ -75,7 +75,7 @@ export class StateAcctParamsGetContract extends arc4.Contract {
7575
return value
7676
}
7777

78-
@arc4.abimethod({ resourceEncoding: 'Index' })
78+
@arc4.abimethod({ resourceEncoding: 'index' })
7979
public verify_acct_total_extra_app_pages(a: Account): uint64 {
8080
const [value, funded] = op.AcctParams.acctTotalExtraAppPages(a)
8181
const [value_index, funded_index] = op.AcctParams.acctTotalExtraAppPages(get_1st_ref_index())
@@ -84,7 +84,7 @@ export class StateAcctParamsGetContract extends arc4.Contract {
8484
return value
8585
}
8686

87-
@arc4.abimethod({ resourceEncoding: 'Index' })
87+
@arc4.abimethod({ resourceEncoding: 'index' })
8888
public verify_acct_total_apps_created(a: Account): uint64 {
8989
const [value, funded] = op.AcctParams.acctTotalAppsCreated(a)
9090
const [value_index, funded_index] = op.AcctParams.acctTotalAppsCreated(get_1st_ref_index())
@@ -93,7 +93,7 @@ export class StateAcctParamsGetContract extends arc4.Contract {
9393
return value
9494
}
9595

96-
@arc4.abimethod({ resourceEncoding: 'Index' })
96+
@arc4.abimethod({ resourceEncoding: 'index' })
9797
public verify_acct_total_apps_opted_in(a: Account): uint64 {
9898
const [value, funded] = op.AcctParams.acctTotalAppsOptedIn(a)
9999
const [value_index, funded_index] = op.AcctParams.acctTotalAppsOptedIn(get_1st_ref_index())
@@ -102,7 +102,7 @@ export class StateAcctParamsGetContract extends arc4.Contract {
102102
return value
103103
}
104104

105-
@arc4.abimethod({ resourceEncoding: 'Index' })
105+
@arc4.abimethod({ resourceEncoding: 'index' })
106106
public verify_acct_total_assets_created(a: Account): uint64 {
107107
const [value, funded] = op.AcctParams.acctTotalAssetsCreated(a)
108108
const [value_index, funded_index] = op.AcctParams.acctTotalAssetsCreated(get_1st_ref_index())
@@ -111,7 +111,7 @@ export class StateAcctParamsGetContract extends arc4.Contract {
111111
return value
112112
}
113113

114-
@arc4.abimethod({ resourceEncoding: 'Index' })
114+
@arc4.abimethod({ resourceEncoding: 'index' })
115115
public verify_acct_total_assets(a: Account): uint64 {
116116
const [value, funded] = op.AcctParams.acctTotalAssets(a)
117117
const [value_index, funded_index] = op.AcctParams.acctTotalAssets(get_1st_ref_index())
@@ -120,7 +120,7 @@ export class StateAcctParamsGetContract extends arc4.Contract {
120120
return value
121121
}
122122

123-
@arc4.abimethod({ resourceEncoding: 'Index' })
123+
@arc4.abimethod({ resourceEncoding: 'index' })
124124
public verify_acct_total_boxes(a: Account): uint64 {
125125
const [value, funded] = op.AcctParams.acctTotalBoxes(a)
126126
const [value_index, funded_index] = op.AcctParams.acctTotalBoxes(get_1st_ref_index())
@@ -129,7 +129,7 @@ export class StateAcctParamsGetContract extends arc4.Contract {
129129
return value
130130
}
131131

132-
@arc4.abimethod({ resourceEncoding: 'Index' })
132+
@arc4.abimethod({ resourceEncoding: 'index' })
133133
public verify_acct_total_box_bytes(a: Account): uint64 {
134134
const [value, funded] = op.AcctParams.acctTotalBoxBytes(a)
135135
const [value_index, funded_index] = op.AcctParams.acctTotalBoxBytes(get_1st_ref_index())
@@ -138,7 +138,7 @@ export class StateAcctParamsGetContract extends arc4.Contract {
138138
return value
139139
}
140140

141-
@arc4.abimethod({ resourceEncoding: 'Index' })
141+
@arc4.abimethod({ resourceEncoding: 'index' })
142142
public verify_acct_incentive_eligible(a: Account): boolean {
143143
const [value, funded] = op.AcctParams.acctIncentiveEligible(a)
144144
const [value_index, funded_index] = op.AcctParams.acctIncentiveEligible(get_1st_ref_index())

0 commit comments

Comments
 (0)