Skip to content

Commit 2439795

Browse files
author
lukaw3d
committed
Use KnownRuntimeTxMethod more
1 parent df7fa04 commit 2439795

File tree

3 files changed

+6
-25
lines changed

3 files changed

+6
-25
lines changed

src/app/components/RuntimeTransactionMethod/index.tsx

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const getRuntimeTxMethodOptions = (t: TFunction, layer: Layer) => {
9696
}
9797

9898
export const getRuntimeRoflUpdatesMethodOptions = (t: TFunction) => {
99-
const options = ['rofl.Create', 'rofl.Remove', 'rofl.Update'] as const
99+
const options = ['rofl.Create', 'rofl.Remove', 'rofl.Update'] satisfies KnownRuntimeTxMethod[]
100100

101101
return options.map(
102102
(method): RuntimeTxMethodFilterOption => ({
@@ -112,27 +112,7 @@ export const getRuntimeRoflUpdatesMethodOptions = (t: TFunction) => {
112112
* May be undefined if the transaction was malformed.
113113
*
114114
* In theory, this could be any string as the runtimes evolve.
115-
* In practice, the nexus currently expects only the following methods:
116-
* - "accounts.Transfer"
117-
* - "consensus.Deposit"
118-
* - "consensus.Withdraw"
119-
* - "consensus.Delegate"
120-
* - "consensus.Undelegate"
121-
* - "evm.Create"
122-
* - "evm.Call"
123-
* - "rofl.Create"
124-
* - "rofl.Update"
125-
* - "rofl.Remove"
126-
* - "rofl.Register"
127-
* - "roflmarket.ProviderCreate"
128-
* - "roflmarket.ProviderUpdate"
129-
* - "roflmarket.ProviderUpdateOffers"
130-
* - "roflmarket.ProviderRemove"
131-
* - "roflmarket.InstanceCreate"
132-
* - "roflmarket.InstanceTopUp"
133-
* - "roflmarket.InstanceCancel"
134-
* - "roflmarket.InstanceExecuteCmds"
135-
* - "roflmarket.InstanceChangeAdmin"
115+
* In practice, the nexus currently expects only KnownRuntimeTxMethod.
136116
*/
137117
const getRuntimeTransactionIcon = (method: KnownRuntimeTxMethod, label: string, truncate?: boolean) => {
138118
const props = {

src/app/utils/transaction.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { consensusDecimals } from '../../config'
2-
import { ConsensusTxMethod, Transaction } from '../../oasis-nexus/api'
2+
import { ConsensusTxMethod, KnownRuntimeTxMethod, Transaction } from '../../oasis-nexus/api'
33
import { fromBaseUnits } from './number-utils'
44

55
export const getConsensusTransactionToAddress = (transaction: Transaction) => {
@@ -33,7 +33,7 @@ export const getConsensusTransactionAmount = (transaction: Transaction) => {
3333
}
3434
}
3535
export const isRoflTransaction = (method: string | undefined): boolean => {
36-
const roflMethods = [
36+
const roflMethods: string[] = [
3737
'rofl.Create',
3838
'rofl.Update',
3939
'rofl.Remove',
@@ -47,6 +47,6 @@ export const isRoflTransaction = (method: string | undefined): boolean => {
4747
'roflmarket.InstanceCancel',
4848
'roflmarket.InstanceExecuteCmds',
4949
'roflmarket.InstanceChangeAdmin',
50-
]
50+
] satisfies KnownRuntimeTxMethod[]
5151
return method ? roflMethods.includes(method) : false
5252
}

src/oasis-nexus/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ declare module './generated/api' {
160160
}
161161
}
162162

163+
/** From docs for {@link generated.RuntimeTransaction.method} */
163164
export const knownRuntimeTxMethods = [
164165
'accounts.Transfer',
165166
'evm.Call',

0 commit comments

Comments
 (0)