Skip to content

Commit

Permalink
chore: code formatting only
Browse files Browse the repository at this point in the history
  • Loading branch information
jackson-dean committed Sep 21, 2023
1 parent 04393fa commit 172961b
Show file tree
Hide file tree
Showing 70 changed files with 18,389 additions and 1,365 deletions.
7 changes: 5 additions & 2 deletions src/app/account-select/account-select.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="section--accounts" *ngIf="hasUsers">
<div class="section--accounts__header margin-bottom--medium">
{{componentTitle}}
{{ componentTitle }}
</div>
<ul class="section--accounts__list container--scrollbar margin-bottom--small">
<li
Expand All @@ -18,7 +18,10 @@
{{ item.key | truncateAddressOrUsername }}
</div>
<div *ngIf="item.value.username">
<img class="avatar--rounded avatar--large margin-right--xsmall" [appAvatar]="item.key"/>
<img
class="avatar--rounded avatar--large margin-right--xsmall"
[appAvatar]="item.key"
/>
{{ item.value.username | truncateAddressOrUsername }}
</div>
</div>
Expand Down
5 changes: 2 additions & 3 deletions src/app/account-select/account-select.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ describe('AccountSelectComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AccountSelectComponent ]
})
.compileComponents();
declarations: [AccountSelectComponent],
}).compileComponents();
});

beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const routes: Routes = [
path: RouteNames.MESSAGING_GROUP,
component: MessagingGroupComponent,
pathMatch: 'full',
}
},
];

@NgModule({
Expand Down
19 changes: 8 additions & 11 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ export class AppComponent implements OnInit {
}
}

this.globalVars.redirectURI = params.get('redirect_uri') ?? stateParamsFromGoogle.redirect_uri ?? '';
this.globalVars.redirectURI =
params.get('redirect_uri') ?? stateParamsFromGoogle.redirect_uri ?? '';

const showSkip = params.get('showSkip');
this.globalVars.showSkip =
Expand All @@ -94,29 +95,25 @@ export class AppComponent implements OnInit {
params.get('transactionSpendingLimitResponse') ||
stateParamsFromGoogle.transactionSpendingLimitResponse;
if (transactionSpendingLimitResponse) {
this.globalVars.transactionSpendingLimitResponse = transactionSpendingLimitResponse;
this.globalVars.transactionSpendingLimitResponse =
transactionSpendingLimitResponse;
}

const derivedPublicKey =
params.get('derivedPublicKey') ||
stateParamsFromGoogle.derivedPublicKey;
params.get('derivedPublicKey') || stateParamsFromGoogle.derivedPublicKey;
if (derivedPublicKey) {
this.globalVars.derivedPublicKey = derivedPublicKey;
}

const deleteKey =
params.get('deleteKey') === 'true' ||
stateParamsFromGoogle.deleteKey;
params.get('deleteKey') === 'true' || stateParamsFromGoogle.deleteKey;
if (deleteKey) {
this.globalVars.deleteKey = true;
}

const expirationDays =
parseInt(
params.get('expirationDays') ||
'0',
10
) || stateParamsFromGoogle.expirationDays;
parseInt(params.get('expirationDays') || '0', 10) ||
stateParamsFromGoogle.expirationDays;
if (expirationDays) {
this.globalVars.expirationDays = expirationDays;
}
Expand Down
35 changes: 10 additions & 25 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import { MatFormFieldModule } from '@angular/material/form-field';
import { MatTooltipModule } from '@angular/material/tooltip';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgHcaptchaModule } from 'ng-hcaptcha';
import { CookieModule } from 'ngx-cookie';
import { SanitizePostBodyPipe } from 'src/lib/pipes/sanitize-and-auto-link-pipe';
import { SanitizeVideoUrlPipe } from 'src/lib/pipes/sanitize-video-url-pipe';
import { TruncateAddressOrUsernamePipe } from 'src/lib/pipes/truncate-deso-address.pipe';
import { environment } from '../environments/environment';
import { AccountSelectComponent } from './account-select/account-select.component';
import { AccountService } from './account.service';
import { AppRoutingModule } from './app-routing.module';
Expand Down Expand Up @@ -45,30 +47,14 @@ import { SharedSecretComponent } from './shared-secret/shared-secret.component';
import { SignUpGetStarterDESOComponent } from './sign-up-get-starter-deso/sign-up-get-starter-deso.component';
import { SignUpMetamaskComponent } from './sign-up-metamask/sign-up-metamask.component';
import { SignUpComponent } from './sign-up/sign-up.component';
import {
TransactionSpendingLimitAccessGroupMemberComponent
} from './transaction-spending-limit/transaction-spending-limit-access-group-member/transaction-spending-limit-access-group-member.component';
import {
TransactionSpendingLimitAccessGroupComponent
} from './transaction-spending-limit/transaction-spending-limit-access-group/transaction-spending-limit-access-group.component';
import {
TransactionSpendingLimitAssociationComponent
} from './transaction-spending-limit/transaction-spending-limit-association/transaction-spending-limit-association.component';
import {
TransactionSpendingLimitCoinComponent
} from './transaction-spending-limit/transaction-spending-limit-coin/transaction-spending-limit-coin.component';
import {
TransactionSpendingLimitDaoCoinLimitOrderComponent
} from './transaction-spending-limit/transaction-spending-limit-dao-coin-limit-order/transaction-spending-limit-dao-coin-limit-order.component';
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 { TransactionSpendingLimitAccessGroupMemberComponent } from './transaction-spending-limit/transaction-spending-limit-access-group-member/transaction-spending-limit-access-group-member.component';
import { TransactionSpendingLimitAccessGroupComponent } from './transaction-spending-limit/transaction-spending-limit-access-group/transaction-spending-limit-access-group.component';
import { TransactionSpendingLimitAssociationComponent } from './transaction-spending-limit/transaction-spending-limit-association/transaction-spending-limit-association.component';
import { TransactionSpendingLimitCoinComponent } from './transaction-spending-limit/transaction-spending-limit-coin/transaction-spending-limit-coin.component';
import { TransactionSpendingLimitDaoCoinLimitOrderComponent } from './transaction-spending-limit/transaction-spending-limit-dao-coin-limit-order/transaction-spending-limit-dao-coin-limit-order.component';
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 { NgHcaptchaModule } from 'ng-hcaptcha';
import {environment} from "../environments/environment";

@NgModule({
declarations: [
Expand Down Expand Up @@ -139,5 +125,4 @@ import {environment} from "../environments/environment";

bootstrap: [AppComponent],
})
export class AppModule {
}
export class AppModule {}
6 changes: 4 additions & 2 deletions src/app/approve/approve.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ <h3 class="text--neutral-white">Approve a transaction</h3>
<app-transaction-spending-limit
[transactionSpendingLimitResponse]="transactionSpendingLimitResponse"
></app-transaction-spending-limit>
<br/>
<br />
</div>
<div *ngIf="transactionDeSoSpent">
<p>Total Cost: <code>{{ transactionDeSoSpent }} $DESO</code></p>
<p>
Total Cost: <code>{{ transactionDeSoSpent }} $DESO</code>
</p>
</div>
<div class="margin-top--large">
<button
Expand Down
115 changes: 66 additions & 49 deletions src/app/approve/approve.component.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { CryptoService } from '../crypto.service';
import { IdentityService } from '../identity.service';
import { AccountService } from '../account.service';
import { GlobalVarsService } from '../global-vars.service';
import { SigningService } from '../signing.service';
import {
BackendAPIService,
TransactionSpendingLimitResponse,
User,
} from '../backend-api.service';
import bs58check from 'bs58check';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import {
Expand All @@ -34,9 +25,9 @@ import {
TransactionMetadataFollow,
TransactionMetadataLike,
TransactionMetadataMessagingGroup,
TransactionMetadataNewMessage,
TransactionMetadataNFTBid,
TransactionMetadataNFTTransfer,
TransactionMetadataNewMessage,
TransactionMetadataPrivateMessage,
TransactionMetadataSubmitPost,
TransactionMetadataSwapIdentity,
Expand All @@ -47,8 +38,17 @@ import {
TransactionMetadataUpdateProfile,
TransactionSpendingLimit,
} from '../../lib/deso/transaction';
import bs58check from 'bs58check';
import { ExtraData } from '../../types/identity';
import { AccountService } from '../account.service';
import {
BackendAPIService,
TransactionSpendingLimitResponse,
User,
} from '../backend-api.service';
import { CryptoService } from '../crypto.service';
import { GlobalVarsService } from '../global-vars.service';
import { IdentityService } from '../identity.service';
import { SigningService } from '../signing.service';

@Component({
selector: 'app-approve',
Expand Down Expand Up @@ -451,44 +451,61 @@ export class ApproveComponent implements OnInit {
}
break;
case TransactionMetadataCreateUserAssociation:
const createUserAssociationMetadata = this.transaction.metadata as TransactionMetadataCreateUserAssociation;
const targetPublicKey = this.base58KeyCheck(createUserAssociationMetadata.targetUserPublicKey);
const createUserAssociationMetadata = this.transaction
.metadata as TransactionMetadataCreateUserAssociation;
const targetPublicKey = this.base58KeyCheck(
createUserAssociationMetadata.targetUserPublicKey
);
publicKeys = [targetPublicKey];
let userAssociationAppDisplayName = 'the global';
if (!this.isZeroByteArray(createUserAssociationMetadata.appPublicKey)) {
const appPublicKey = this.base58KeyCheck(createUserAssociationMetadata.appPublicKey);
userAssociationAppDisplayName = appPublicKey + '\'s';
const appPublicKey = this.base58KeyCheck(
createUserAssociationMetadata.appPublicKey
);
userAssociationAppDisplayName = appPublicKey + "'s";
publicKeys.push(appPublicKey);
}
const userAssociationType = createUserAssociationMetadata.associationType.toString();
const userAssociationValue = createUserAssociationMetadata.associationValue.toString();
description = `create a ${userAssociationType} association on ${targetPublicKey} with value ` +
const userAssociationType =
createUserAssociationMetadata.associationType.toString();
const userAssociationValue =
createUserAssociationMetadata.associationValue.toString();
description =
`create a ${userAssociationType} association on ${targetPublicKey} with value ` +
`${userAssociationValue} in ${userAssociationAppDisplayName} app namespace`;
break;
case TransactionMetadataDeleteUserAssociation:
// TODO: do we want to fetch the association from the API and display more information?
const deleteUserAssociationMetadata = this.transaction.metadata as TransactionMetadataDeleteUserAssociation;
const deleteUserAssociationMetadata = this.transaction
.metadata as TransactionMetadataDeleteUserAssociation;
description = `delete user association with ID ${deleteUserAssociationMetadata.associationID.toString()}`;
break;
case TransactionMetadataCreatePostAssociation:
const createPostAssociationMetadata = this.transaction.metadata as TransactionMetadataCreateUserAssociation;
const createPostAssociationMetadata = this.transaction
.metadata as TransactionMetadataCreateUserAssociation;
// TODO: do we want to fetch the post so we can have more information?
const targetPostHash = createPostAssociationMetadata.targetUserPublicKey.toString('hex');
const targetPostHash =
createPostAssociationMetadata.targetUserPublicKey.toString('hex');
publicKeys = [];
let postAssociationAppDisplayName = 'the global';
if (!this.isZeroByteArray(createPostAssociationMetadata.appPublicKey)) {
const appPublicKey = this.base58KeyCheck(createPostAssociationMetadata.appPublicKey);
postAssociationAppDisplayName = appPublicKey + '\'s';
const appPublicKey = this.base58KeyCheck(
createPostAssociationMetadata.appPublicKey
);
postAssociationAppDisplayName = appPublicKey + "'s";
publicKeys.push(appPublicKey);
}
const postAssociationType = createPostAssociationMetadata.associationType.toString();
const postAssociationValue = createPostAssociationMetadata.associationValue.toString();
description = `create a ${postAssociationType} association on post ${targetPostHash} with value ` +
const postAssociationType =
createPostAssociationMetadata.associationType.toString();
const postAssociationValue =
createPostAssociationMetadata.associationValue.toString();
description =
`create a ${postAssociationType} association on post ${targetPostHash} with value ` +
`${postAssociationValue} in ${postAssociationAppDisplayName} app namespace`;
break;
case TransactionMetadataDeletePostAssociation:
// TODO: do we want to fetch the association from the API and display more information?
const deletePostAssociationMetadata = this.transaction.metadata as TransactionMetadataDeletePostAssociation;
const deletePostAssociationMetadata = this.transaction
.metadata as TransactionMetadataDeletePostAssociation;
description = `delete post association with ID ${deletePostAssociationMetadata.associationID.toString()}`;
break;
case TransactionMetadataAccessGroup:
Expand All @@ -503,14 +520,15 @@ export class ApproveComponent implements OnInit {
accessGroupOperation = 'update';
break;
default:
accessGroupOperation = 'take unknown action on'
accessGroupOperation = 'take unknown action on';
}
description = `${accessGroupOperation} access group with name "${accessGroupMetadata.accessGroupKeyName.toString()}"`;
break;
case TransactionMetadataAccessGroupMembers:
const accessGroupMembersMetadata = this.transaction
.metadata as TransactionMetadataAccessGroupMembers;
const numMembers = accessGroupMembersMetadata.accessGroupMembersList.length;
const numMembers =
accessGroupMembersMetadata.accessGroupMembersList.length;
const pluralSuffix = numMembers > 1 ? 's' : '';
let accessGroupMemberOperation: string;
switch (accessGroupMembersMetadata.accessGroupMemberOperationType) {
Expand All @@ -527,24 +545,21 @@ export class ApproveComponent implements OnInit {
accessGroupMemberOperation = `take unknown action on ${numMembers} member${pluralSuffix} of`;
}
publicKeys = [
this.base58KeyCheck(accessGroupMembersMetadata.accessGroupOwnerPublicKey),
...accessGroupMembersMetadata.accessGroupMembersList
.map(
(member) =>
this.base58KeyCheck(member.accessGroupMemberPublicKey)
)];
this.base58KeyCheck(
accessGroupMembersMetadata.accessGroupOwnerPublicKey
),
...accessGroupMembersMetadata.accessGroupMembersList.map((member) =>
this.base58KeyCheck(member.accessGroupMemberPublicKey)
),
];
description = `
${accessGroupMemberOperation} group with name ${accessGroupMembersMetadata.accessGroupKeyName.toString()}.\n
${accessGroupMembersMetadata.accessGroupMembersList.map((member) => {
return `${
this.base58KeyCheck(member.accessGroupMemberPublicKey)
} - key name: ${
member.accessGroupMemberKeyName.toString()
}, encrypted key:${
member.encryptedKey.toString()
}\n`
return `${this.base58KeyCheck(
member.accessGroupMemberPublicKey
)} - key name: ${member.accessGroupMemberKeyName.toString()}, encrypted key:${member.encryptedKey.toString()}\n`;
})}
`
`;
break;
case TransactionMetadataNewMessage:
const newMessageMetadata = this.transaction
Expand All @@ -554,15 +569,17 @@ export class ApproveComponent implements OnInit {
switch (newMessageMetadata.newMessageType) {
case 0:
messageType = 'dm';
recipient = this.base58KeyCheck(newMessageMetadata.recipientAccessGroupPublicKey);
recipient = this.base58KeyCheck(
newMessageMetadata.recipientAccessGroupPublicKey
);
publicKeys = [recipient];
break;
case 1:
messageType = 'message';
const groupOwnerPublicKey = this.base58KeyCheck(newMessageMetadata.recipientAccessGroupOwnerPublicKey);
recipient = `${groupOwnerPublicKey}'s group with name ${
newMessageMetadata.recipientAccessGroupKeyname.toString()
}`;
const groupOwnerPublicKey = this.base58KeyCheck(
newMessageMetadata.recipientAccessGroupOwnerPublicKey
);
recipient = `${groupOwnerPublicKey}'s group with name ${newMessageMetadata.recipientAccessGroupKeyname.toString()}`;
publicKeys = [groupOwnerPublicKey];
break;
default:
Expand Down
Loading

0 comments on commit 172961b

Please sign in to comment.