Skip to content

Commit

Permalink
feat: add staking claim types
Browse files Browse the repository at this point in the history
  • Loading branch information
compojoom committed Sep 12, 2024
1 parent b7ec7fc commit d1355d9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/types/decoded-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export enum ConfirmationViewTypes {
COW_SWAP_TWAP_ORDER = 'COW_SWAP_TWAP_ORDER',
KILN_NATIVE_STAKING_DEPOSIT = 'KILN_NATIVE_STAKING_DEPOSIT',
KILN_NATIVE_STAKING_VALIDATORS_EXIT = 'KILN_NATIVE_STAKING_VALIDATORS_EXIT',
KILN_NATIVE_STAKING_WITHDRAW = 'KILN_NATIVE_STAKING_WITHDRAW',
}

export type DecodedDataRequest = {
Expand Down Expand Up @@ -106,9 +107,18 @@ export type NativeStakingValidatorsExitConfirmationView = {
tokenInfo: TokenInfo
} & DecodedDataResponse

export type NativeStakingWithdrawConfirmationView = {
/** @enum {string} */
type: ConfirmationViewTypes.KILN_NATIVE_STAKING_WITHDRAW
value: string
rewards: string
tokenInfo: TokenInfo
} & DecodedDataResponse

export type AnyStakingConfirmationView =
| NativeStakingDepositConfirmationView
| NativeStakingValidatorsExitConfirmationView
| NativeStakingWithdrawConfirmationView

/* Union */
export type AnyConfirmationView =
Expand All @@ -117,3 +127,4 @@ export type AnyConfirmationView =
| TwapOrderConfirmationView
| NativeStakingDepositConfirmationView
| NativeStakingValidatorsExitConfirmationView
| NativeStakingWithdrawConfirmationView
14 changes: 12 additions & 2 deletions src/types/transactions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import type { AddressEx, Page, TokenInfo } from './common'
import type { NativeStakingDepositConfirmationView, NativeStakingValidatorsExitConfirmationView } from './decoded-data'
import type {
NativeStakingDepositConfirmationView,
NativeStakingValidatorsExitConfirmationView,
NativeStakingWithdrawConfirmationView,
} from './decoded-data'
import type { RichDecodedInfo } from './human-description'

export type ParamValue = string | ParamValue[]
Expand Down Expand Up @@ -74,6 +78,7 @@ export enum TransactionInfoType {
SWAP_TRANSFER = 'SwapTransfer',
NATIVE_STAKING_DEPOSIT = 'NativeStakingDeposit',
NATIVE_STAKING_VALIDATORS_EXIT = 'NativeStakingValidatorsExit',
NATIVE_STAKING_WITHDRAW = 'NativeStakingWithdraw',
}

export enum ConflictType {
Expand Down Expand Up @@ -351,7 +356,12 @@ export type StakingTxExitInfo = {
humanDescription?: string
} & Omit<NativeStakingValidatorsExitConfirmationView, 'type'>

export type StakingTxInfo = StakingTxDepositInfo | StakingTxExitInfo
export type StakingTxWithdrawInfo = {
type: TransactionInfoType.NATIVE_STAKING_WITHDRAW
humanDescription?: string
} & Omit<NativeStakingWithdrawConfirmationView, 'type'>

export type StakingTxInfo = StakingTxDepositInfo | StakingTxExitInfo | StakingTxWithdrawInfo

export type TransactionInfo =
| Transfer
Expand Down

0 comments on commit d1355d9

Please sign in to comment.