Skip to content

Commit b63d78a

Browse files
committed
refactor: use shorthand function syntax in object literals
1 parent 2b8d3fb commit b63d78a

File tree

5 files changed

+41
-50
lines changed

5 files changed

+41
-50
lines changed

src/impl/acct-params.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,51 +22,51 @@ export const minBalance = (a: Account | internal.primitives.StubUint64Compat): u
2222
}
2323

2424
export const AcctParams: internal.opTypes.AcctParamsType = {
25-
acctBalance: function (a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
25+
acctBalance(a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
2626
const acct = getAccount(a)
2727
return [acct.balance, acct.balance !== 0]
2828
},
29-
acctMinBalance: function (a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
29+
acctMinBalance(a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
3030
const acct = getAccount(a)
3131
return [acct.minBalance, acct.balance !== 0]
3232
},
33-
acctAuthAddr: function (a: Account | internal.primitives.StubUint64Compat): readonly [Account, boolean] {
33+
acctAuthAddr(a: Account | internal.primitives.StubUint64Compat): readonly [Account, boolean] {
3434
const acct = getAccount(a)
3535
return [acct.authAddress, acct.balance !== 0]
3636
},
37-
acctTotalNumUint: function (a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
37+
acctTotalNumUint(a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
3838
const acct = getAccount(a)
3939
return [acct.totalNumUint, acct.balance !== 0]
4040
},
41-
acctTotalNumByteSlice: function (a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
41+
acctTotalNumByteSlice(a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
4242
const acct = getAccount(a)
4343
return [acct.totalNumByteSlice, acct.balance !== 0]
4444
},
45-
acctTotalExtraAppPages: function (a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
45+
acctTotalExtraAppPages(a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
4646
const acct = getAccount(a)
4747
return [acct.totalExtraAppPages, acct.balance !== 0]
4848
},
49-
acctTotalAppsCreated: function (a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
49+
acctTotalAppsCreated(a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
5050
const acct = getAccount(a)
5151
return [acct.totalAppsCreated, acct.balance !== 0]
5252
},
53-
acctTotalAppsOptedIn: function (a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
53+
acctTotalAppsOptedIn(a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
5454
const acct = getAccount(a)
5555
return [acct.totalAppsOptedIn, acct.balance !== 0]
5656
},
57-
acctTotalAssetsCreated: function (a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
57+
acctTotalAssetsCreated(a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
5858
const acct = getAccount(a)
5959
return [acct.totalAssetsCreated, acct.balance !== 0]
6060
},
61-
acctTotalAssets: function (a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
61+
acctTotalAssets(a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
6262
const acct = getAccount(a)
6363
return [acct.totalAssets, acct.balance !== 0]
6464
},
65-
acctTotalBoxes: function (a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
65+
acctTotalBoxes(a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
6666
const acct = getAccount(a)
6767
return [acct.totalBoxes, acct.balance !== 0]
6868
},
69-
acctTotalBoxBytes: function (a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
69+
acctTotalBoxBytes(a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
7070
const acct = getAccount(a)
7171
return [acct.totalBoxBytes, acct.balance !== 0]
7272
},

src/impl/app-global.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,16 @@ import { asBytes } from '../util'
44
import { getApp } from './app-params'
55

66
export const AppGlobal: internal.opTypes.AppGlobalType = {
7-
delete: function (a: internal.primitives.StubBytesCompat): void {
7+
delete(a: internal.primitives.StubBytesCompat): void {
88
lazyContext.ledger.setGlobalState(lazyContext.activeApplication, a, undefined)
99
},
10-
getBytes: function (a: internal.primitives.StubBytesCompat): bytes {
10+
getBytes(a: internal.primitives.StubBytesCompat): bytes {
1111
return this.getExBytes(0, asBytes(a))[0]
1212
},
13-
getUint64: function (a: internal.primitives.StubBytesCompat): uint64 {
13+
getUint64(a: internal.primitives.StubBytesCompat): uint64 {
1414
return this.getExUint64(0, asBytes(a))[0]
1515
},
16-
getExBytes: function (
17-
a: Application | internal.primitives.StubUint64Compat,
18-
b: internal.primitives.StubBytesCompat,
19-
): readonly [bytes, boolean] {
16+
getExBytes(a: Application | internal.primitives.StubUint64Compat, b: internal.primitives.StubBytesCompat): readonly [bytes, boolean] {
2017
const app = getApp(a)
2118
if (app === undefined) {
2219
return [Bytes(), false]
@@ -27,10 +24,7 @@ export const AppGlobal: internal.opTypes.AppGlobalType = {
2724
}
2825
return [state!.value as bytes, exists]
2926
},
30-
getExUint64: function (
31-
a: Application | internal.primitives.StubUint64Compat,
32-
b: internal.primitives.StubBytesCompat,
33-
): readonly [uint64, boolean] {
27+
getExUint64(a: Application | internal.primitives.StubUint64Compat, b: internal.primitives.StubBytesCompat): readonly [uint64, boolean] {
3428
const app = getApp(a)
3529
if (app === undefined) {
3630
return [Uint64(0), false]
@@ -41,10 +35,7 @@ export const AppGlobal: internal.opTypes.AppGlobalType = {
4135
}
4236
return [state!.value as uint64, exists]
4337
},
44-
put: function (
45-
a: internal.primitives.StubBytesCompat,
46-
b: internal.primitives.StubUint64Compat | internal.primitives.StubBytesCompat,
47-
): void {
38+
put(a: internal.primitives.StubBytesCompat, b: internal.primitives.StubUint64Compat | internal.primitives.StubBytesCompat): void {
4839
lazyContext.ledger.setGlobalState(lazyContext.activeApplication, a, b)
4940
},
5041
}

src/impl/app-params.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,39 @@ export const getApp = (app: Application | internal.primitives.StubUint64Compat):
2424
}
2525

2626
export const AppParams: internal.opTypes.AppParamsType = {
27-
appApprovalProgram: function (a: Application | internal.primitives.StubUint64Compat): readonly [bytes, boolean] {
27+
appApprovalProgram(a: Application | internal.primitives.StubUint64Compat): readonly [bytes, boolean] {
2828
const app = getApp(a)
2929
return app === undefined ? [Bytes(), false] : [app.approvalProgram, true]
3030
},
31-
appClearStateProgram: function (a: Application | internal.primitives.StubUint64Compat): readonly [bytes, boolean] {
31+
appClearStateProgram(a: Application | internal.primitives.StubUint64Compat): readonly [bytes, boolean] {
3232
const app = getApp(a)
3333
return app === undefined ? [Bytes(), false] : [app.clearStateProgram, true]
3434
},
35-
appGlobalNumUint: function (a: Application | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
35+
appGlobalNumUint(a: Application | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
3636
const app = getApp(a)
3737
return app === undefined ? [Uint64(0), false] : [app.globalNumUint, true]
3838
},
39-
appGlobalNumByteSlice: function (a: Application | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
39+
appGlobalNumByteSlice(a: Application | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
4040
const app = getApp(a)
4141
return app === undefined ? [Uint64(0), false] : [app.globalNumBytes, true]
4242
},
43-
appLocalNumUint: function (a: Application | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
43+
appLocalNumUint(a: Application | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
4444
const app = getApp(a)
4545
return app === undefined ? [Uint64(0), false] : [app.localNumUint, true]
4646
},
47-
appLocalNumByteSlice: function (a: Application | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
47+
appLocalNumByteSlice(a: Application | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
4848
const app = getApp(a)
4949
return app === undefined ? [Uint64(0), false] : [app.localNumBytes, true]
5050
},
51-
appExtraProgramPages: function (a: Application | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
51+
appExtraProgramPages(a: Application | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
5252
const app = getApp(a)
5353
return app === undefined ? [Uint64(0), false] : [app.extraProgramPages, true]
5454
},
55-
appCreator: function (a: Application | internal.primitives.StubUint64Compat): readonly [Account, boolean] {
55+
appCreator(a: Application | internal.primitives.StubUint64Compat): readonly [Account, boolean] {
5656
const app = getApp(a)
5757
return app === undefined ? [Account(), false] : [app.creator, true]
5858
},
59-
appAddress: function (a: Application | internal.primitives.StubUint64Compat): readonly [Account, boolean] {
59+
appAddress(a: Application | internal.primitives.StubUint64Compat): readonly [Account, boolean] {
6060
const app = getApp(a)
6161
return app === undefined ? [Account(), false] : [app.address, true]
6262
},

src/impl/asset-holding.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ const getAssetHolding = (
2323
}
2424

2525
export const AssetHolding: internal.opTypes.AssetHoldingType = {
26-
assetBalance: function (
26+
assetBalance(
2727
a: Account | internal.primitives.StubUint64Compat,
2828
b: Asset | internal.primitives.StubUint64Compat,
2929
): readonly [uint64, boolean] {
3030
const holding = getAssetHolding(a, b)
3131
return holding === undefined ? [Uint64(0), false] : [holding.balance, true]
3232
},
33-
assetFrozen: function (
33+
assetFrozen(
3434
a: Account | internal.primitives.StubUint64Compat,
3535
b: Asset | internal.primitives.StubUint64Compat,
3636
): readonly [boolean, boolean] {

src/impl/asset-params.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,51 +24,51 @@ export const getAsset = (asset: Asset | internal.primitives.StubUint64Compat): A
2424
}
2525

2626
export const AssetParams: internal.opTypes.AssetParamsType = {
27-
assetTotal: function (a: Asset | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
27+
assetTotal(a: Asset | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
2828
const asset = getAsset(a)
2929
return asset === undefined ? [Uint64(0), false] : [asset.total, true]
3030
},
31-
assetDecimals: function (a: Asset | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
31+
assetDecimals(a: Asset | internal.primitives.StubUint64Compat): readonly [uint64, boolean] {
3232
const asset = getAsset(a)
3333
return asset === undefined ? [Uint64(0), false] : [asset.decimals, true]
3434
},
35-
assetDefaultFrozen: function (a: Asset | internal.primitives.StubUint64Compat): readonly [boolean, boolean] {
35+
assetDefaultFrozen(a: Asset | internal.primitives.StubUint64Compat): readonly [boolean, boolean] {
3636
const asset = getAsset(a)
3737
return asset === undefined ? [false, false] : [asset.defaultFrozen, true]
3838
},
39-
assetUnitName: function (a: Asset | internal.primitives.StubUint64Compat): readonly [bytes, boolean] {
39+
assetUnitName(a: Asset | internal.primitives.StubUint64Compat): readonly [bytes, boolean] {
4040
const asset = getAsset(a)
4141
return asset === undefined ? [Bytes(), false] : [asset.unitName, true]
4242
},
43-
assetName: function (a: Asset | internal.primitives.StubUint64Compat): readonly [bytes, boolean] {
43+
assetName(a: Asset | internal.primitives.StubUint64Compat): readonly [bytes, boolean] {
4444
const asset = getAsset(a)
4545
return asset === undefined ? [Bytes(), false] : [asset.name, true]
4646
},
47-
assetUrl: function (a: Asset | internal.primitives.StubUint64Compat): readonly [bytes, boolean] {
47+
assetUrl(a: Asset | internal.primitives.StubUint64Compat): readonly [bytes, boolean] {
4848
const asset = getAsset(a)
4949
return asset === undefined ? [Bytes(), false] : [asset.url, true]
5050
},
51-
assetMetadataHash: function (a: Asset | internal.primitives.StubUint64Compat): readonly [bytes, boolean] {
51+
assetMetadataHash(a: Asset | internal.primitives.StubUint64Compat): readonly [bytes, boolean] {
5252
const asset = getAsset(a)
5353
return asset === undefined ? [Bytes(), false] : [asset.metadataHash, true]
5454
},
55-
assetManager: function (a: Asset | internal.primitives.StubUint64Compat): readonly [Account, boolean] {
55+
assetManager(a: Asset | internal.primitives.StubUint64Compat): readonly [Account, boolean] {
5656
const asset = getAsset(a)
5757
return asset === undefined ? [Account(), false] : [asset.manager, true]
5858
},
59-
assetReserve: function (a: Asset | internal.primitives.StubUint64Compat): readonly [Account, boolean] {
59+
assetReserve(a: Asset | internal.primitives.StubUint64Compat): readonly [Account, boolean] {
6060
const asset = getAsset(a)
6161
return asset === undefined ? [Account(), false] : [asset.reserve, true]
6262
},
63-
assetFreeze: function (a: Asset | internal.primitives.StubUint64Compat): readonly [Account, boolean] {
63+
assetFreeze(a: Asset | internal.primitives.StubUint64Compat): readonly [Account, boolean] {
6464
const asset = getAsset(a)
6565
return asset === undefined ? [Account(), false] : [asset.freeze, true]
6666
},
67-
assetClawback: function (a: Asset | internal.primitives.StubUint64Compat): readonly [Account, boolean] {
67+
assetClawback(a: Asset | internal.primitives.StubUint64Compat): readonly [Account, boolean] {
6868
const asset = getAsset(a)
6969
return asset === undefined ? [Account(), false] : [asset.clawback, true]
7070
},
71-
assetCreator: function (a: Asset | internal.primitives.StubUint64Compat): readonly [Account, boolean] {
71+
assetCreator(a: Asset | internal.primitives.StubUint64Compat): readonly [Account, boolean] {
7272
const asset = getAsset(a)
7373
return asset === undefined ? [Account(), false] : [asset.creator, true]
7474
},

0 commit comments

Comments
 (0)