This file contains hidden or 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
| loadFile$ = createEffect( | |
| () => | |
| this.actions$.pipe( | |
| ofType(IpfsUploadActions.load_image), | |
| withLatestFrom(this.store$.pipe(select(fromStore.getIpfsHash))), | |
| map(([action, ipfsHash]) => ipfsHash), | |
| exhaustMap((ipfsHash: string) => | |
| this.ipfsSrv.getFile(ipfsHash).pipe( | |
| map((image: Blob) => IpfsUploadActions.load_image_success({ image })), | |
| catchError((err: Error) => |
This file contains hidden or 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
| pragma solidity 0.5.11; | |
| import "./HitchensUnorderedKeySet.sol"; | |
| contract FleaMarket { | |
| using HitchensUnorderedKeySetLib for HitchensUnorderedKeySetLib.Set; | |
| HitchensUnorderedKeySetLib.Set widgetSet; | |
| struct WidgetStruct { | |
| address contractAddress; |
This file contains hidden or 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
| <mat-card> | |
| <mat-card-subtitle>SnackBar Message</mat-card-subtitle> | |
| <mat-card-content> | |
| <p [ngClass]="{ | |
| 'accent-color': data.color == 'accent', | |
| 'primary-color': data.color == 'primary', | |
| 'red-color': data.color == 'warn' | |
| }"> | |
| {{data.message}} | |
| </p> |
This file contains hidden or 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
| import { createAction, props } from '@ngrx/store'; | |
| import { SnackBarInterface } from '../../models'; | |
| export const open = createAction('[SnackBar] Open', props<{ payload: SnackBarInterface }>()); |
This file contains hidden or 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
| import { Injectable } from '@angular/core'; | |
| import { Actions, ofType, createEffect } from '@ngrx/effects'; | |
| import { tap, map } from 'rxjs/operators'; | |
| import { SnackBarActions } from '../actions'; | |
| import { MatSnackBar } from '@angular/material'; | |
| import { SnackBarComponent } from '../../components/snackbar/snack-bar.component'; | |
| @Injectable() | |
| export class SnackBarEffects { |
This file contains hidden or 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
| handleError$ = createEffect( | |
| () => | |
| this.actions$.pipe( | |
| ofType(ErrorActions.errorMessage), | |
| map(action => action.errorMsg), | |
| tap(errorMsg => console.error('Got error:', errorMsg)), | |
| map(errorMsg => { | |
| const msg: SnackBarInterface = { | |
| message: errorMsg, |
This file contains hidden or 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
| export const routes: Routes = [ | |
| { path: '', redirectTo: '/dashboard', pathMatch: 'full' }, | |
| { | |
| path: 'dashboard', | |
| component: DashboardComponent, | |
| }, | |
| { | |
| path: 'p2p-bazaar', | |
| loadChildren: () => import('./p2p-bazaar/p2p-bazaar.module').then(mod => mod.P2pBazaarModule), | |
| canActivate: [guards.EthInitGuard], |
This file contains hidden or 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
| import { Injectable } from '@angular/core'; | |
| import { Contract } from 'ethers'; | |
| import { Provider } from '../../../core/services/tokens'; | |
| import { P2pBazaarAnchorModule } from '../../p2p-bazaar.anchor.module'; | |
| import { environment } from 'src/environments/environment' | |
| const FLEA_MARKET_CONTRACT_ADDRESS = environment.fleaMarketContractAddress; | |
| const abi = [ | |
| 'event logNewPurchaseContract(address contractAddress)', | |
| 'function createPurchaseContract(bytes32 key, string title, string ipfsHash) payable returns(bool createResult)', |
This file contains hidden or 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
| import { FleaMarketContractToken } from './tokens/flea-market-contract-token'; | |
| import { Observable, from, of } from 'rxjs'; | |
| import { map, tap, switchMap } from 'rxjs/operators'; | |
| import { utils } from 'ethers'; | |
| @Injectable({ providedIn: P2pBazaarAnchorModule }) | |
| export class FleaMarketContractService { | |
| constructor( private contractToken: FleaMarketContractToken ) { | |
| } | |
| public createPurchaseContract(product: any): Observable<string> { |
This file contains hidden or 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
| export interface State extends EntityState<PurchaseWidgetModel> { | |
| loaded: boolean; | |
| selectedPurchaseContract: PurchaseContractModel; | |
| } | |
| export function sortByKey(a: PurchaseWidgetModel, b: PurchaseWidgetModel): number { | |
| return a.productKey.localeCompare(b.productKey); | |
| } | |
| // based on https://next.ngrx.io/guide/entity/adapter |