diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 23933e92..3e88bb5f 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -60,6 +60,8 @@ import { TransactionSpendingLimitDaoCoinLimitOrderComponent } from './transactio import { TransactionSpendingLimitNftComponent } from './transaction-spending-limit/transaction-spending-limit-nft/transaction-spending-limit-nft.component'; import { TransactionSpendingLimitSectionComponent } from './transaction-spending-limit/transaction-spending-limit-section/transaction-spending-limit-section.component'; import { TransactionSpendingLimitComponent } from './transaction-spending-limit/transaction-spending-limit.component'; +import { TransactionSpendingLimitStakeComponent } from './transaction-spending-limit/transaction-spending-limit-stake/transaction-spending-limit-stake.component'; +import { TransactionSpendingLimitLockupComponent } from './transaction-spending-limit/transaction-spending-limit-lockup/transaction-spending-limit-lockup.component'; @NgModule({ declarations: [ @@ -107,6 +109,8 @@ import { TransactionSpendingLimitComponent } from './transaction-spending-limit/ RecoverySecretComponent, BackupSeedDialogComponent, RemoveAccountDialogComponent, + TransactionSpendingLimitStakeComponent, + TransactionSpendingLimitLockupComponent, ], imports: [ BrowserModule, diff --git a/src/app/backend-api.service.ts b/src/app/backend-api.service.ts index 28ebd385..929e401a 100644 --- a/src/app/backend-api.service.ts +++ b/src/app/backend-api.service.ts @@ -147,7 +147,8 @@ export type LimitOperationString = | NFTLimitOperationString | AssociationOperationString | AccessGroupOperationString - | AccessGroupMemberOperationString; + | AccessGroupMemberOperationString + | LockupLimitOperationString; export type CreatorCoinOperationLimitMap = CoinOperationLimitMap; export type DAOCoinOperationLimitMap = @@ -236,6 +237,42 @@ export type AccessGroupMemberLimitMapItem = { OpCount: number; }; +export type StakeLimitMapItem = { + ValidatorPublicKeyBase58Check: string; + StakeLimit: string; // Hex string +}; + +export type UnstakeLimitMapItem = { + ValidatorPublicKeyBase58Check: string; + UnstakeLimit: string; // Hex string +}; + +export type UnlockStakeLimitMapItem = { + ValidatorPublicKeyBase58Check: string; + OpCount: number; +}; + +export enum LockupLimitScopeType { + ANY = 'AnyCoins', + SCOPED = 'ScopedCoins', +} + +export enum LockupLimitOperationString { + ANY = 'Any', + COIN_LOCKUP = 'CoinLockup', + UPDATE_COIN_LOCKUP_YIELD_CURVE = 'UpdateCoinLockupYieldCurve', + UPDATE_COIN_LOCKUP_TRANSFER_RESTRICTIONS = 'UpdateCoinLockupTransferRestrictions', + COIN_LOCKUP_TRANSFER = 'CoinLockupTransferOperationString', + COIN_UNLOCK = 'CoinLockupUnlock', +} + +export type LockupLimitMapItem = { + ProfilePublicKeyBase58Check: string; + ScopeType: LockupLimitScopeType; + Operation: LockupLimitOperationString; + OpCount: number; +}; + export interface TransactionSpendingLimitResponse { GlobalDESOLimit: number; // TODO: make enum for transaction type string @@ -247,6 +284,10 @@ export interface TransactionSpendingLimitResponse { AssociationLimitMap?: AssociationLimitMapItem[]; AccessGroupLimitMap?: AccessGroupLimitMapItem[]; AccessGroupMemberLimitMap?: AccessGroupMemberLimitMapItem[]; + StakeLimitMap?: StakeLimitMapItem[]; + UnstakeLimitMap?: UnstakeLimitMapItem[]; + UnlockStakeLimitMap?: UnlockStakeLimitMapItem[]; + LockupLimitMap?: LockupLimitMapItem[]; IsUnlimited?: boolean; DerivedKeyMemo?: string; } diff --git a/src/app/transaction-spending-limit/transaction-spending-limit-lockup/transaction-spending-limit-lockup.component.html b/src/app/transaction-spending-limit/transaction-spending-limit-lockup/transaction-spending-limit-lockup.component.html new file mode 100644 index 00000000..528cc23c --- /dev/null +++ b/src/app/transaction-spending-limit/transaction-spending-limit-lockup/transaction-spending-limit-lockup.component.html @@ -0,0 +1,29 @@ +
+
+ + {{ + appUser?.ProfileEntryResponse?.Username || + lockupLimitMapItem?.ProfilePublicKeyBase58Check || + (lockupLimitMapItem?.ScopeType === LockupLimitScopeType.ANY + ? 'Any Profile' + : 'DESO') | truncateAddressOrUsername + }} +
+
+ + {{ getOperationString() }} + +
+
+ + {{ globalVars.formatTxCountLimit(lockupLimitMapItem?.OpCount) }} + +
+
diff --git a/src/app/transaction-spending-limit/transaction-spending-limit-lockup/transaction-spending-limit-lockup.component.scss b/src/app/transaction-spending-limit/transaction-spending-limit-lockup/transaction-spending-limit-lockup.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/transaction-spending-limit/transaction-spending-limit-lockup/transaction-spending-limit-lockup.component.ts b/src/app/transaction-spending-limit/transaction-spending-limit-lockup/transaction-spending-limit-lockup.component.ts new file mode 100644 index 00000000..ab3f12b2 --- /dev/null +++ b/src/app/transaction-spending-limit/transaction-spending-limit-lockup/transaction-spending-limit-lockup.component.ts @@ -0,0 +1,44 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { GlobalVarsService } from 'src/app/global-vars.service'; +import { + LockupLimitMapItem, + LockupLimitOperationString, + LockupLimitScopeType, + User, +} from '../../backend-api.service'; +import { TransactionSpendingLimitComponent } from '../transaction-spending-limit.component'; + +@Component({ + selector: 'app-transaction-spending-limit-lockup', + templateUrl: './transaction-spending-limit-lockup.component.html', + styleUrls: ['./transaction-spending-limit-lockup.component.scss'], +}) +export class TransactionSpendingLimitLockupComponent implements OnInit { + @Input() lockupLimitMapItem: LockupLimitMapItem | undefined; + @Input() appUser: User | undefined; + TransactionSpendingLimitComponent = TransactionSpendingLimitComponent; + LockupLimitScopeType = LockupLimitScopeType; + + constructor(public globalVars: GlobalVarsService) {} + + ngOnInit(): void {} + + getOperationString(): string { + switch (this.lockupLimitMapItem?.Operation) { + case LockupLimitOperationString.ANY: + return 'Any'; + case LockupLimitOperationString.COIN_LOCKUP: + return 'Lockup'; + case LockupLimitOperationString.COIN_LOCKUP_TRANSFER: + return 'Transfer'; + case LockupLimitOperationString.UPDATE_COIN_LOCKUP_YIELD_CURVE: + return 'Update lockup yield curve'; + case LockupLimitOperationString.UPDATE_COIN_LOCKUP_TRANSFER_RESTRICTIONS: + return 'Update transfer restriction'; + case LockupLimitOperationString.COIN_UNLOCK: + return 'Unlock coins'; + default: + return ''; + } + } +} diff --git a/src/app/transaction-spending-limit/transaction-spending-limit-section/transaction-spending-limit-section.component.html b/src/app/transaction-spending-limit/transaction-spending-limit-section/transaction-spending-limit-section.component.html index ac6436d2..d0e8ec70 100644 --- a/src/app/transaction-spending-limit/transaction-spending-limit-section/transaction-spending-limit-section.component.html +++ b/src/app/transaction-spending-limit/transaction-spending-limit-section/transaction-spending-limit-section.component.html @@ -220,6 +220,135 @@ > + +
+
Validator
+
Amount
+
+
+ +
+
+ +
+
+ +
+
Validator
+
Amount
+
+
+ +
+
+ +
+
+ +
+
Validator
+
Txn Limit
+
+
+ +
+
+ +
+
+ +
+
Profile
+
Operation
+
Txn Limit
+
+
+ +
+
+ +
+
diff --git a/src/app/transaction-spending-limit/transaction-spending-limit-section/transaction-spending-limit-section.component.ts b/src/app/transaction-spending-limit/transaction-spending-limit-section/transaction-spending-limit-section.component.ts index 712de2fa..7895e00b 100644 --- a/src/app/transaction-spending-limit/transaction-spending-limit-section/transaction-spending-limit-section.component.ts +++ b/src/app/transaction-spending-limit/transaction-spending-limit-section/transaction-spending-limit-section.component.ts @@ -9,9 +9,15 @@ import { DAOCoinLimitOrderLimitItem, DAOCoinLimitOrderLimitMap, DAOCoinOperationLimitMap, + LockupLimitMapItem, + LockupLimitOperationString, + LockupLimitScopeType, NFTLimitOperationString, NFTOperationLimitMap, OperationToCountMap, + StakeLimitMapItem, + UnlockStakeLimitMapItem, + UnstakeLimitMapItem, User, } from '../../backend-api.service'; import { GlobalVarsService } from '../../global-vars.service'; @@ -31,7 +37,11 @@ export class TransactionSpendingLimitSectionComponent implements OnInit { | DAOCoinLimitOrderLimitMap | AssociationLimitMapItem[] | AccessGroupLimitMapItem[] - | AccessGroupMemberLimitMapItem[] = {}; + | AccessGroupMemberLimitMapItem[] + | StakeLimitMapItem[] + | UnstakeLimitMapItem[] + | UnlockStakeLimitMapItem[] + | LockupLimitMapItem[] = {}; @Input() sectionTitle: string = ''; @Input() userMap: { [k: string]: User } = {}; @@ -44,6 +54,12 @@ export class TransactionSpendingLimitSectionComponent implements OnInit { | OperationToCountMap | undefined; anyNFTItem: OperationToCountMap | undefined; + anyLockupLimitItems: LockupLimitMapItem[] = []; + anyValidatorItem: + | StakeLimitMapItem + | UnstakeLimitMapItem + | UnlockStakeLimitMapItem + | undefined; coinLimitMap: CreatorCoinOperationLimitMap | DAOCoinOperationLimitMap = {}; txnLimitMap: { [k: string]: number } = {}; @@ -53,6 +69,10 @@ export class TransactionSpendingLimitSectionComponent implements OnInit { associationLimitMap: AssociationLimitMapItem[] = []; accessGroupLimitMap: AccessGroupLimitMapItem[] = []; accessGroupMemberLimitMap: AccessGroupMemberLimitMapItem[] = []; + stakeLimitMap: StakeLimitMapItem[] = []; + unstakeLimitMap: UnstakeLimitMapItem[] = []; + unlockStakeLimitMap: UnlockStakeLimitMapItem[] = []; + lockupLimitMap: LockupLimitMapItem[] = []; constructor(public globalVars: GlobalVarsService) {} @@ -113,6 +133,47 @@ export class TransactionSpendingLimitSectionComponent implements OnInit { case TransactionSpendingLimitComponent.AccessGroupMemberSection: this.accessGroupMemberLimitMap = this .sectionMap as AccessGroupMemberLimitMapItem[]; + break; + case TransactionSpendingLimitComponent.StakeSection: + this.stakeLimitMap = this.sectionMap as StakeLimitMapItem[]; + this.anyValidatorItem = this.stakeLimitMap.find( + (item) => item.ValidatorPublicKeyBase58Check === '' + ); + this.stakeLimitMap = this.stakeLimitMap.filter( + (item) => item.ValidatorPublicKeyBase58Check !== '' + ); + break; + case TransactionSpendingLimitComponent.UnstakeSection: + this.unstakeLimitMap = this.sectionMap as UnstakeLimitMapItem[]; + this.anyValidatorItem = this.unstakeLimitMap.find( + (item) => item.ValidatorPublicKeyBase58Check === '' + ); + this.unstakeLimitMap = this.unstakeLimitMap.filter( + (item) => item.ValidatorPublicKeyBase58Check !== '' + ); + break; + case TransactionSpendingLimitComponent.UnlockStakeSection: + this.unlockStakeLimitMap = this.sectionMap as UnlockStakeLimitMapItem[]; + this.anyValidatorItem = this.unlockStakeLimitMap.find( + (item) => item.ValidatorPublicKeyBase58Check === '' + ); + this.unlockStakeLimitMap = this.unlockStakeLimitMap.filter( + (item) => item.ValidatorPublicKeyBase58Check !== '' + ); + break; + case TransactionSpendingLimitComponent.LockupSection: + this.lockupLimitMap = this.sectionMap as LockupLimitMapItem[]; + this.anyLockupLimitItems = this.lockupLimitMap.filter( + (item) => + item.ProfilePublicKeyBase58Check === '' && + item.ScopeType === LockupLimitScopeType.ANY + ); + this.lockupLimitMap = this.lockupLimitMap.filter( + (item) => + item.ProfilePublicKeyBase58Check !== '' || + item.ScopeType !== LockupLimitScopeType.ANY + ); + break; } this.showAll = this.getSectionMapLength() <= this.defaultNumShown; @@ -136,6 +197,12 @@ export class TransactionSpendingLimitSectionComponent implements OnInit { return 'Access Group'; case TransactionSpendingLimitComponent.AccessGroupMemberSection: return 'Access Group Member'; + case TransactionSpendingLimitComponent.StakeSection: + case TransactionSpendingLimitComponent.UnstakeSection: + case TransactionSpendingLimitComponent.UnlockStakeSection: + return 'Validator'; + case TransactionSpendingLimitComponent.LockupSection: + return 'Lockup'; default: return ''; } @@ -148,18 +215,33 @@ export class TransactionSpendingLimitSectionComponent implements OnInit { return !!this.anyCreatorItem; case TransactionSpendingLimitComponent.NFTLimitsSection: return !!this.anyNFTItem; + case TransactionSpendingLimitComponent.StakeSection: + case TransactionSpendingLimitComponent.UnstakeSection: + case TransactionSpendingLimitComponent.UnlockStakeSection: + return !!this.anyValidatorItem; + case TransactionSpendingLimitComponent.LockupSection: + return !!this.anyLockupLimitItems.length; } return false; } sectionSummary(): string { - const operationsStr = - this.sectionTitle !== - TransactionSpendingLimitComponent.TransactionLimitsSection && - this.sectionTitle !== - TransactionSpendingLimitComponent.DAOCoinLimitOrderLimitSection - ? 'operations on ' - : ''; + let operationsStr = 'operations on '; + switch (this.sectionTitle) { + case TransactionSpendingLimitComponent.TransactionLimitsSection: + case TransactionSpendingLimitComponent.DAOCoinLimitOrderLimitSection: + operationsStr = ''; + break; + case TransactionSpendingLimitComponent.StakeSection: + operationsStr = 'stake operations on '; + break; + case TransactionSpendingLimitComponent.UnstakeSection: + operationsStr = 'unstake operations on '; + break; + case TransactionSpendingLimitComponent.UnlockStakeSection: + operationsStr = 'unlock stake operations on '; + break; + } const keyLen = this.getSectionMapLength(); const sectionItemType = this.sectionItemType(); return `This app can execute the following ${operationsStr}${keyLen} specific ${sectionItemType}${ @@ -181,6 +263,14 @@ export class TransactionSpendingLimitSectionComponent implements OnInit { return this.accessGroupLimitMap.length; case TransactionSpendingLimitComponent.AccessGroupMemberSection: return this.accessGroupMemberLimitMap.length; + case TransactionSpendingLimitComponent.StakeSection: + return this.stakeLimitMap.length; + case TransactionSpendingLimitComponent.UnstakeSection: + return this.unstakeLimitMap.length; + case TransactionSpendingLimitComponent.UnlockStakeSection: + return this.unlockStakeLimitMap.length; + case TransactionSpendingLimitComponent.LockupSection: + return this.lockupLimitMap.length; default: return this.globalVars.ObjectKeyLength(this.sectionMap); } diff --git a/src/app/transaction-spending-limit/transaction-spending-limit-stake/transaction-spending-limit-stake.component.html b/src/app/transaction-spending-limit/transaction-spending-limit-stake/transaction-spending-limit-stake.component.html new file mode 100644 index 00000000..a2ac5c52 --- /dev/null +++ b/src/app/transaction-spending-limit/transaction-spending-limit-stake/transaction-spending-limit-stake.component.html @@ -0,0 +1,20 @@ +
+
+ + {{ + appUser?.ProfileEntryResponse?.Username || + stakeLimitMapItem?.ValidatorPublicKeyBase58Check || + 'Any Validator' | truncateAddressOrUsername + }} +
+ + {{ getOpCountString() }} + +
diff --git a/src/app/transaction-spending-limit/transaction-spending-limit-stake/transaction-spending-limit-stake.component.scss b/src/app/transaction-spending-limit/transaction-spending-limit-stake/transaction-spending-limit-stake.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/transaction-spending-limit/transaction-spending-limit-stake/transaction-spending-limit-stake.component.ts b/src/app/transaction-spending-limit/transaction-spending-limit-stake/transaction-spending-limit-stake.component.ts new file mode 100644 index 00000000..23927a3b --- /dev/null +++ b/src/app/transaction-spending-limit/transaction-spending-limit-stake/transaction-spending-limit-stake.component.ts @@ -0,0 +1,71 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { GlobalVarsService } from 'src/app/global-vars.service'; +import { + StakeLimitMapItem, + UnlockStakeLimitMapItem, + UnstakeLimitMapItem, + User, +} from '../../backend-api.service'; +import { TransactionSpendingLimitComponent } from '../transaction-spending-limit.component'; + +@Component({ + selector: 'app-transaction-spending-limit-stake', + templateUrl: './transaction-spending-limit-stake.component.html', + styleUrls: ['./transaction-spending-limit-stake.component.scss'], +}) +export class TransactionSpendingLimitStakeComponent implements OnInit { + @Input() stakeLimitMapItem: + | StakeLimitMapItem + | UnstakeLimitMapItem + | UnlockStakeLimitMapItem + | undefined; + @Input() operationName: string = ''; + @Input() appUser: User | undefined; + TransactionSpendingLimitComponent = TransactionSpendingLimitComponent; + + constructor(public globalVars: GlobalVarsService) {} + + ngOnInit(): void {} + + getOpCountString(): string { + switch (this.operationName) { + case 'Stake': + return ( + this.hexNanosToUnitString( + (this.stakeLimitMapItem as StakeLimitMapItem)?.StakeLimit as string + ) + ' DESO' + ); + case 'Unstake': + return ( + this.hexNanosToUnitString( + (this.stakeLimitMapItem as UnstakeLimitMapItem) + ?.UnstakeLimit as string + ) + ' DESO' + ); + case 'Unlock Stake': + return ( + this.stakeLimitMapItem as UnlockStakeLimitMapItem + )?.OpCount.toString(); + default: + return ''; + } + } + + hexNanosToUnitString(baseUnits: string): string { + return this.nanosToUnitString(parseInt(baseUnits, 16)); + } + + nanosToUnitString(baseUnits: number): string { + return this.toFixedLengthDecimalString(baseUnits / 1e9); + } + + toFixedLengthDecimalString(num: number): string { + // Change nanos into a formatted string of units. This combination of toFixed and regex removes trailing zeros. + // If we do a regular toString(), some numbers can be represented in E notation which doesn't look as good. + const formattedNum = num.toFixed(9).replace(/^(\d*\.\d*?[1-9]?)0+$/, '$1'); + // Integers may have a trailing decimal place, so if we end with a decimal place, we slice off the last character. + return formattedNum.endsWith('.') + ? formattedNum.slice(0, formattedNum.length - 1) + : formattedNum; + } +} diff --git a/src/app/transaction-spending-limit/transaction-spending-limit.component.html b/src/app/transaction-spending-limit/transaction-spending-limit.component.html index fcb2e54f..b9cb58c8 100644 --- a/src/app/transaction-spending-limit/transaction-spending-limit.component.html +++ b/src/app/transaction-spending-limit/transaction-spending-limit.component.html @@ -134,5 +134,29 @@ [userMap]="userMap" *ngIf="transactionSpendingLimitResponse.AccessGroupMemberLimitMap" > + + + + diff --git a/src/app/transaction-spending-limit/transaction-spending-limit.component.ts b/src/app/transaction-spending-limit/transaction-spending-limit.component.ts index 8b0df624..6c03ee57 100644 --- a/src/app/transaction-spending-limit/transaction-spending-limit.component.ts +++ b/src/app/transaction-spending-limit/transaction-spending-limit.component.ts @@ -7,7 +7,11 @@ import { CoinLimitOperationString, CoinOperationLimitMap, DAOCoinLimitOrderLimitMap, + LockupLimitMapItem, + StakeLimitMapItem, TransactionSpendingLimitResponse, + UnlockStakeLimitMapItem, + UnstakeLimitMapItem, User, } from '../backend-api.service'; import { GlobalVarsService } from '../global-vars.service'; @@ -35,6 +39,10 @@ export class TransactionSpendingLimitComponent implements OnInit { static AssociationSection = 'Associations'; static AccessGroupSection = 'Access Groups'; static AccessGroupMemberSection = 'Access Group Members'; + static StakeSection = 'Stake'; + static UnstakeSection = 'Unstake'; + static UnlockStakeSection = 'Unlock Stake'; + static LockupSection = 'Lockup'; TransactionSpendingLimitComponent = TransactionSpendingLimitComponent; @@ -48,32 +56,35 @@ export class TransactionSpendingLimitComponent implements OnInit { ...new Set( this.getPublicKeysFromCoinOperationLimitMap( this.transactionSpendingLimitResponse?.CreatorCoinOperationLimitMap - ) - .concat( - this.getPublicKeysFromCoinOperationLimitMap( - this.transactionSpendingLimitResponse?.DAOCoinOperationLimitMap - ) - ) - .concat( - this.getPublicKeysFromDAOCoinLimitOrderLimitMap( - this.transactionSpendingLimitResponse?.DAOCoinLimitOrderLimitMap - ) - ) - .concat( - this.getPublicKeysFromAssociationLimitMap( - this.transactionSpendingLimitResponse?.AssociationLimitMap - ) - ) - .concat( - this.getPublicKeysFromAccessGroupLimitMap( - this.transactionSpendingLimitResponse?.AccessGroupLimitMap - ) - ) - .concat( - this.getPublicKeysFromAccessGroupLimitMap( - this.transactionSpendingLimitResponse?.AccessGroupMemberLimitMap - ) + ).concat( + this.getPublicKeysFromCoinOperationLimitMap( + this.transactionSpendingLimitResponse?.DAOCoinOperationLimitMap + ), + this.getPublicKeysFromDAOCoinLimitOrderLimitMap( + this.transactionSpendingLimitResponse?.DAOCoinLimitOrderLimitMap + ), + this.getPublicKeysFromAssociationLimitMap( + this.transactionSpendingLimitResponse?.AssociationLimitMap + ), + this.getPublicKeysFromAccessGroupLimitMap( + this.transactionSpendingLimitResponse?.AccessGroupLimitMap + ), + this.getPublicKeysFromAccessGroupLimitMap( + this.transactionSpendingLimitResponse?.AccessGroupMemberLimitMap + ), + this.getPublicKeysFromStakeLimitMap( + this.transactionSpendingLimitResponse?.StakeLimitMap + ), + this.getPublicKeysFromStakeLimitMap( + this.transactionSpendingLimitResponse?.UnstakeLimitMap + ), + this.getPublicKeysFromStakeLimitMap( + this.transactionSpendingLimitResponse?.UnlockStakeLimitMap + ), + this.getPublicKeysFromLockupLimitMap( + this.transactionSpendingLimitResponse?.LockupLimitMap ) + ) ), ]; @@ -134,8 +145,41 @@ export class TransactionSpendingLimitComponent implements OnInit { return []; } let allPublicKeys = new Set(); - accessGroupLimitMap.forEach((item) => - allPublicKeys.add(item.AccessGroupOwnerPublicKeyBase58Check) + accessGroupLimitMap.forEach( + (item: AccessGroupLimitMapItem | AccessGroupMemberLimitMapItem) => + allPublicKeys.add(item.AccessGroupOwnerPublicKeyBase58Check) + ); + return Array.from(allPublicKeys); + } + + getPublicKeysFromStakeLimitMap( + stakeLimitMap: + | StakeLimitMapItem[] + | UnstakeLimitMapItem[] + | UnlockStakeLimitMapItem[] + | undefined + ): string[] { + if (!stakeLimitMap) { + return []; + } + let allPublicKeys = new Set(); + stakeLimitMap.forEach( + ( + item: StakeLimitMapItem | UnstakeLimitMapItem | UnlockStakeLimitMapItem + ) => allPublicKeys.add(item.ValidatorPublicKeyBase58Check) + ); + return Array.from(allPublicKeys); + } + + getPublicKeysFromLockupLimitMap( + lockupLimitMap: LockupLimitMapItem[] | undefined + ): string[] { + if (!lockupLimitMap) { + return []; + } + let allPublicKeys = new Set(); + lockupLimitMap.forEach((item: LockupLimitMapItem) => + allPublicKeys.add(item.ProfilePublicKeyBase58Check) ); return Array.from(allPublicKeys); } diff --git a/src/lib/deso/transaction.ts b/src/lib/deso/transaction.ts index b202fa6b..85052bc6 100644 --- a/src/lib/deso/transaction.ts +++ b/src/lib/deso/transaction.ts @@ -418,6 +418,7 @@ export class TransactionDAOCoinLimitOrderLimitMapItem extends BinaryRecord { value: number = 0; } +// TODO: does this need to be updated? Where is it really used? export class TransactionSpendingLimit extends BinaryRecord { @Transcode(Uvarint64) globalDESOLimit: number = 0; diff --git a/src/lib/pipes/truncate-deso-address.pipe.ts b/src/lib/pipes/truncate-deso-address.pipe.ts index 7c009648..ad5bfccc 100644 --- a/src/lib/pipes/truncate-deso-address.pipe.ts +++ b/src/lib/pipes/truncate-deso-address.pipe.ts @@ -6,7 +6,7 @@ import { Pipe, PipeTransform } from '@angular/core'; export class TruncateAddressOrUsernamePipe implements PipeTransform { transform(key: string | undefined) { if (!key) return ''; - if (key.length <= 12) { + if (key.length <= 15) { return key; } return `${key.substring(0, 7)}...${key.substring(