-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from Concordium/delegation
Delegation
- Loading branch information
Showing
15 changed files
with
1,209 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule concordium-base
updated
75 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { | ||
ReduceStakePendingChange, | ||
RemovalPendingChange, | ||
StakePendingChange, | ||
StakePendingChangeV1, | ||
} from '.'; | ||
import { | ||
AccountInfo, | ||
AccountInfoBaker, | ||
AccountInfoBakerV1, | ||
AccountInfoDelegator, | ||
} from './types'; | ||
|
||
export const isDelegatorAccount = ( | ||
ai: AccountInfo | ||
): ai is AccountInfoDelegator => | ||
(ai as AccountInfoDelegator).accountDelegation !== undefined; | ||
|
||
export const isBakerAccount = (ai: AccountInfo): ai is AccountInfoBaker => | ||
(ai as AccountInfoBaker).accountBaker !== undefined; | ||
|
||
export const isBakerAccountV1 = (ai: AccountInfo): ai is AccountInfoBakerV1 => | ||
(ai as AccountInfoBakerV1).accountBaker?.bakerPoolInfo !== undefined; | ||
|
||
export const isStakePendingChangeV1 = ( | ||
spc: StakePendingChange | ||
): spc is StakePendingChangeV1 => | ||
(spc as StakePendingChangeV1).effectiveTime !== undefined; | ||
|
||
export const isReduceStakePendingChange = ( | ||
spc: ReduceStakePendingChange | RemovalPendingChange | ||
): spc is ReduceStakePendingChange => | ||
(spc as ReduceStakePendingChange).newStake !== undefined; | ||
|
||
export const isRemovalPendingChange = ( | ||
spc: ReduceStakePendingChange | RemovalPendingChange | ||
): spc is RemovalPendingChange => !isReduceStakePendingChange(spc); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { | ||
Authorizations, | ||
AuthorizationsV1, | ||
BlockSummary, | ||
BlockSummaryV1, | ||
ChainParameters, | ||
ChainParametersV1, | ||
Keys, | ||
KeysV1, | ||
UpdateQueues, | ||
UpdateQueuesV1, | ||
Updates, | ||
UpdatesV1, | ||
} from './types'; | ||
|
||
export const isAuthorizationsV1 = (a: Authorizations): a is AuthorizationsV1 => | ||
(a as AuthorizationsV1).timeParameters !== undefined; | ||
|
||
export const isChainParametersV1 = ( | ||
cp: ChainParameters | ||
): cp is ChainParametersV1 => | ||
(cp as ChainParametersV1).mintPerPayday !== undefined; | ||
|
||
export const isKeysV1 = (k: Keys): k is KeysV1 => | ||
isAuthorizationsV1(k.level2Keys); | ||
|
||
export const isUpdateQueuesV1 = (uq: UpdateQueues): uq is UpdateQueuesV1 => | ||
(uq as UpdateQueuesV1).timeParameters !== undefined; | ||
|
||
export const isUpdatesV1 = (u: Updates): u is UpdatesV1 => | ||
isUpdateQueuesV1(u.updateQueues); | ||
|
||
export const isBlockSummaryV1 = (bs: BlockSummary): bs is BlockSummaryV1 => | ||
(bs as BlockSummaryV1).protocolVersion !== undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { RewardStatus, RewardStatusV1 } from './types'; | ||
|
||
export const isRewardStatusV1 = (rs: RewardStatus): rs is RewardStatusV1 => | ||
(rs as RewardStatusV1).protocolVersion !== undefined; |
Oops, something went wrong.