2 |
3 |
4 |
10 |
11 |
12 |
13 |
14 |
15 |
FAQ's
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
What collections are listed on the marketplace?
27 |
Only the collections affiliated with Defydefi launchpad are listed on the marketplace.
28 |
29 |
30 |
31 |
Can I trade/list NFT to all contracts?
32 |
No, only a smart contract affiliated with Defydefi, like Bimp, is eligible.
33 |
34 |
35 |
36 |
What network is this running?
37 |
Binance Smart Chain Network
38 |
39 |
40 |
41 |
42 |
43 |
Can I trade the NFTs that were airdropped to me?
44 |
Yes, only if the NFT is affiliated with DefyDefi. NFTs earned outside our platform will not be recognized.
45 |
46 |
47 |
48 |
How can I view my nft?
49 |
Simply open your wallet's browser, head to NFTmoney.bimp.finance, connect your wallet, and your NFTs will be shown at the bottom panel. To claim, go to Wallet > NFTs > Add NFT > Paste the Address, and copy the NFT ID given on the browser.
50 |
51 |
52 |
53 |
How can I get NFT?
54 |
You can buy NFT at DefyDefi.io and Bimp.Finance, win it through lottery at app.defydefi.io, or get it for free by tuning in to our Social Media giveaways.
55 |
56 |
57 |
58 |
59 |
60 |
What currency is used in the marketplace?
61 |
ETH is used for trading.
62 |
63 |
64 |
65 |
How to start?
66 |
Setup your wallet by creating an account and changing the settings to Binance Smart Chain. Here's a tutorial on how to setup BSC on a MetaMask wallet: https://www.facebook.com/100558448943373/posts/121774333488451/ (Uploading right now sa YT 'yung tutorial)
67 |
68 |
69 |
70 |
How to partner with DefyDefi?
71 |
Contact us through email info@defydefi.com and attach the proposal, or join us at Telegram t.me/BimpFinance and look for an admin.
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
Note: Legit Defy staff will neither contact you first nor ask for money. Admins have "will not DM you first" on their names.
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/src/app/pages/main/nft-preview/nft-preview.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
14 |
15 |
16 |
{{ nft.name }}
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |

27 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
Descriptions
38 |
39 |
40 |
41 |
42 | -
43 | Creator
44 |
48 |
49 |
50 |
51 |
52 |
57 |
58 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/src/app/_components/header/header.component.css:
--------------------------------------------------------------------------------
1 | ::ng-deep .avatar-content {
2 | margin-left: -12px !important;
3 | border-radius: 8px !important;
4 | align-items: center !important;
5 | width: 40px !important;
6 | height: 40px !important;
7 | }
8 | ::ng-deep .avatar-container {
9 | width: auto !important;
10 | height: auto !important;
11 | }
12 | ::ng-deep .header__profile-btn p {
13 | margin-left: 10px !important;
14 | }
15 |
16 | .search input:focus {
17 | outline: none;
18 | border-color: #66b1ee;
19 | -webkit-box-shadow: 0 0 2px rgba(85, 168, 236, 0.9);
20 | -moz-box-shadow: 0 0 2px rgba(85, 168, 236, 0.9);
21 | -ms-box-shadow: 0 0 2px rgba(85, 168, 236, 0.9);
22 | -o-box-shadow: 0 0 2px rgba(85, 168, 236, 0.9);
23 | box-shadow: 0 0 2px rgba(85, 168, 236, 0.9);
24 | }
25 |
26 | .search input:focus+.results {
27 | display: block
28 | }
29 |
30 | .search .results {
31 | display: none;
32 | position: absolute;
33 | top: 62px;
34 | left: 0;
35 | right: 0;
36 | z-index: 10;
37 | padding: 0;
38 | margin: 0;
39 | border-width: 1px;
40 | border-style: solid;
41 | border-color: #cbcfe2 #c8cee7 #c4c7d7;
42 | border-radius: 3px;
43 | background-color: #fdfdfd;
44 | background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fdfdfd), color-stop(100%, #eceef4));
45 | }
46 |
47 | .search .results li {
48 | display: block
49 | }
50 |
51 | .search .results li:first-child {
52 | margin-top: -1px
53 | }
54 |
55 | .search .results li:first-child:before,
56 | .search .results li:first-child:after {
57 | display: block;
58 | content: '';
59 | width: 0;
60 | height: 0;
61 | position: absolute;
62 | left: 50%;
63 | margin-left: -5px;
64 | border: 5px outset transparent;
65 | }
66 |
67 | .search .results li:first-child:before {
68 | border-bottom: 5px solid #c4c7d7;
69 | top: -11px;
70 | }
71 |
72 | .search .results li:first-child:after {
73 | border-bottom: 5px solid #fdfdfd;
74 | top: -10px;
75 | }
76 |
77 | .search .results li:first-child:hover:before,
78 | .search .results li:first-child:hover:after {
79 | display: none
80 | }
81 |
82 | .search .results li:last-child {
83 | margin-bottom: -1px
84 | }
85 |
86 | .search .results a {
87 | display: block;
88 | position: relative;
89 | margin: 0 -1px;
90 | padding: 6px 40px 6px 10px;
91 | color: #808394;
92 | font-size: 14px;
93 | font-weight: bolder;
94 | color: black;
95 | border: 1px solid transparent;
96 | border-radius: 3px;
97 | }
98 |
99 | .search .results a span {
100 | font-weight: 200;
101 | font-size: 12px;
102 | color: #807676;
103 | }
104 |
105 | .search .results a:before {
106 | content: '';
107 | width: 18px;
108 | height: 18px;
109 | position: absolute;
110 | top: 50%;
111 | right: 10px;
112 | margin-top: -9px;
113 | background: url("https://cssdeck.com/uploads/media/items/7/7BNkBjd.png") 0 0 no-repeat;
114 | }
115 |
116 | .search .results a:hover {
117 | text-decoration: none;
118 | color: #fff;
119 | text-shadow: 0 -1px rgba(0, 0, 0, 0.3);
120 | border-color: #2380dd #2179d5 #1a60aa;
121 | background-color: #338cdf;
122 | }
123 | .search .results a:hover span {
124 | color: white;
125 | }
126 |
127 | :-moz-placeholder {
128 | color: #a7aabc;
129 | font-weight: 200;
130 | }
131 |
132 | ::-webkit-input-placeholder {
133 | color: #a7aabc;
134 | font-weight: 200;
135 | }
136 |
137 | .lt-ie9 .search input {
138 | line-height: 26px
139 | }
--------------------------------------------------------------------------------
/src/app/_components/header/header.component.ts:
--------------------------------------------------------------------------------
1 | import { environment } from 'src/environments/environment';
2 | import { Component, Injectable, OnInit } from '@angular/core';
3 | import { UtilityService, AuthenticationService, ConnectService, NftService } from '../../_services';
4 | import { Router } from '@angular/router';
5 | import { FormBuilder, FormGroup, Validators } from '@angular/forms';
6 | declare var $: any;
7 | declare let window:any;
8 |
9 | @Injectable({
10 | providedIn: 'root',
11 | })
12 | @Component({
13 | selector: 'app-header',
14 | templateUrl: './header.component.html',
15 | styleUrls: ['./header.component.css'],
16 | })
17 | export class HeaderComponent implements OnInit {
18 | constructor(
19 | private utility: UtilityService,
20 | private authService: AuthenticationService,
21 | private router: Router,
22 | private formBuilder: FormBuilder,
23 | private nftService: NftService,
24 | private connectService: ConnectService,
25 | ) {}
26 |
27 | userName: string;
28 | userPic: string =
29 | JSON.parse(localStorage.getItem('user')) &&
30 | JSON.parse(localStorage.getItem('user'))['profile_pic']
31 | ? environment.IMG_BASE_URL +
32 | JSON.parse(localStorage.getItem('user'))['profile_pic']
33 | : '/assets/img/avatars/avatar.jpg';
34 | userRole: string;
35 | searchTerm: string;
36 | balance: any = 0;
37 | walletAddres: any = '';
38 | searchForm: FormGroup;
39 | searchResults: any = [];
40 |
41 | async ngOnInit() {
42 | console.log(localStorage.getItem('user'));
43 | this.searchForm = this.formBuilder.group({
44 | search: [Validators.required],
45 | });
46 | this.userName = JSON.parse(localStorage.getItem('user'))
47 | ? JSON.parse(localStorage.getItem('user')) ['name']
48 | : '';
49 | this.userRole = JSON.parse(localStorage.getItem('user'))
50 | ? JSON.parse(localStorage.getItem('user'))['role']
51 | : '';
52 |
53 | this.walletAddres = await this.connectService.getAddress();
54 | }
55 | async connectToWallet(){
56 | $('#connect_to_wallet').modal('hide');
57 | this.walletAddres = await this.connectService.getAddress();
58 | };
59 | async ngAfterViewInit() {
60 | // this.walletAddres = await this.connectService.getAddress();
61 | }
62 | connectWallet() {
63 | $('#connect_to_wallet').modal('show');
64 | }
65 |
66 | logoutAction() {
67 | this.authService.logout().subscribe(
68 | (res) => {
69 | this.utility.stopLoader();
70 | this.utility.showSuccessAlert('Success', 'Logout Successfully');
71 | window.location.reload();
72 | },
73 | (error) => {
74 | localStorage.removeItem('user');
75 | this.utility.stopLoader();
76 | this.utility.showErrorAlert('Error', error);
77 | window.location.reload();
78 | }
79 | );
80 | }
81 |
82 | search() {
83 | if (this.searchTerm !== '') {
84 | this.router.navigate(['search', this.searchTerm]);
85 | }
86 | }
87 |
88 | redirect(id) {
89 | console.log(id);
90 |
91 | this.router.navigate(['/marketplace', id]);
92 | }
93 |
94 | setSearchValue(text) {
95 | this.searchTerm = text;
96 | if (text !== '') {
97 | this.searchResult();
98 | } else {
99 | this.searchResults = [];
100 | }
101 | }
102 |
103 | searchResult() {
104 | this.nftService.searchNft(this.searchTerm).subscribe(
105 | (res) => {
106 | this.searchResults = [];
107 | this.searchResults = res;
108 | },
109 | (error) => {
110 | this.utility.showErrorAlert('Error', error);
111 | }
112 | );
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/src/assets/css/bootstrap-reboot.min.css:
--------------------------------------------------------------------------------
1 | /*!
2 | * Bootstrap Reboot v4.5.1 (https://getbootstrap.com/)
3 | * Copyright 2011-2020 The Bootstrap Authors
4 | * Copyright 2011-2020 Twitter, Inc.
5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
6 | * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
7 | */*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus:not(:focus-visible){outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([class]){color:inherit;text-decoration:none}a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}
8 | /*# sourceMappingURL=bootstrap-reboot.min.css.map */
--------------------------------------------------------------------------------
/src/app/pages/main/search-result/search-result.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms';
3 | import { NftService, UtilityService } from '../../../_services';
4 | import { Router, ActivatedRoute } from '@angular/router';
5 | import { environment } from 'src/environments/environment';
6 | @Component({
7 | templateUrl: './search-result.component.html',
8 | styleUrls: ['./search-result.component.css'],
9 | })
10 | export class SearchResultComponent implements OnInit {
11 | constructor(
12 | private nftService: NftService,
13 | private utility: UtilityService,
14 | private formBuilder: FormBuilder,
15 | private activatedRoute: ActivatedRoute
16 | ) {
17 | this.utility.updatePageSEO(
18 | 'NFT Marketplace | Buy and Sell your NFT, and NFT Money. NFT Collections, Crypto artworks.',
19 | 'Buy, Sell and trade your NFTs and NFT Money Secured with blockchain.'
20 | );
21 | this.activatedRoute.params.subscribe((p) => this.getAllNfts());
22 | }
23 |
24 | activeTab = 'grid';
25 | nfts: any = [];
26 | currentDate = new Date();
27 | filteredNfts: any = [];
28 | collectionList: any = [];
29 | selectedCollection: any = [];
30 | filterForm: FormGroup;
31 | imgBaseUrl = environment.IMG_BASE_URL;
32 | p: number = 1;
33 |
34 | ngOnInit(): void {
35 | this.filterForm = this.formBuilder.group({
36 | filterItems: [[]],
37 | sort: ['new'],
38 | });
39 | }
40 |
41 | ngOnChanges(): void {
42 | this.getAllNfts();
43 | }
44 |
45 | getAllNfts() {
46 | var self = this;
47 | this.utility.startLoader();
48 | this.nftService
49 | .searchNft(this.activatedRoute.snapshot.paramMap.get('term'))
50 | .subscribe(
51 | (res) => {
52 | this.utility.stopLoader();
53 | this.nfts = res;
54 | this.filteredNfts = res;
55 | this.getFilterList();
56 | },
57 | (error) => {
58 | this.utility.stopLoader();
59 | this.utility.showErrorAlert('Error', error);
60 | }
61 | );
62 | }
63 |
64 | getFilterList() {
65 | this.nfts.forEach((element) => {
66 | if (!this.collectionList[element.currentOwner.id]) {
67 | this.collectionList[element.currentOwner.id] =
68 | element.currentOwner.name;
69 | }
70 | });
71 | }
72 |
73 | onChangeCategory(event, item: any) {
74 | // Use appropriate model type instead of any
75 | if (this.selectedCollection.indexOf(item) > -1) {
76 | const index = this.selectedCollection.indexOf(item);
77 | if (index > -1) {
78 | this.selectedCollection.splice(index, 1);
79 | }
80 | } else {
81 | this.selectedCollection.push(item);
82 | }
83 | }
84 |
85 | applyFilter() {
86 | this.getFilteredItems();
87 | }
88 |
89 | async getFilteredItems() {
90 | var self = this;
91 | if (this.selectedCollection.length > 0) {
92 | self.filteredNfts = self.nfts.filter((element) => {
93 | return self.selectedCollection.indexOf(element.currentOwner.id) > -1;
94 | });
95 | } else {
96 | self.filteredNfts = self.nfts;
97 | }
98 |
99 | if (this.filterForm.value.sort === 'new') {
100 | self.filteredNfts.sort((a, b) => (a.createdAt < b.createdAt ? 1 : -1));
101 | } else if (this.filterForm.value.sort === 'old') {
102 | self.filteredNfts.sort((a, b) => (a.createdAt > b.createdAt ? 1 : -1));
103 | } else if (this.filterForm.value.sort === 'high') {
104 | self.filteredNfts.sort((a, b) => (a.price < b.price ? 1 : -1));
105 | } else if (this.filterForm.value.sort === 'low') {
106 | await self.filteredNfts.sort((a, b) => (a.price > b.price ? 1 : -1));
107 | }
108 | }
109 |
110 | convertDate(date) {
111 | return new Date(date);
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "tslint:recommended",
3 | "rulesDirectory": [
4 | "codelyzer"
5 | ],
6 | "rules": {
7 | "align": {
8 | "options": [
9 | "parameters",
10 | "statements"
11 | ]
12 | },
13 | "array-type": false,
14 | "arrow-return-shorthand": true,
15 | "curly": true,
16 | "deprecation": {
17 | "severity": "warning"
18 | },
19 | "eofline": true,
20 | "import-blacklist": [
21 | true,
22 | "rxjs/Rx"
23 | ],
24 | "import-spacing": true,
25 | "indent": {
26 | "options": [
27 | "spaces"
28 | ]
29 | },
30 | "max-classes-per-file": false,
31 | "max-line-length": [
32 | true,
33 | 140
34 | ],
35 | "member-ordering": [
36 | true,
37 | {
38 | "order": [
39 | "static-field",
40 | "instance-field",
41 | "static-method",
42 | "instance-method"
43 | ]
44 | }
45 | ],
46 | "no-console": [
47 | true,
48 | "debug",
49 | "info",
50 | "time",
51 | "timeEnd",
52 | "trace"
53 | ],
54 | "no-empty": false,
55 | "no-inferrable-types": [
56 | true,
57 | "ignore-params"
58 | ],
59 | "no-non-null-assertion": true,
60 | "no-redundant-jsdoc": true,
61 | "no-switch-case-fall-through": true,
62 | "no-var-requires": false,
63 | "object-literal-key-quotes": [
64 | true,
65 | "as-needed"
66 | ],
67 | "quotemark": [
68 | true,
69 | "single"
70 | ],
71 | "semicolon": {
72 | "options": [
73 | "always"
74 | ]
75 | },
76 | "space-before-function-paren": {
77 | "options": {
78 | "anonymous": "never",
79 | "asyncArrow": "always",
80 | "constructor": "never",
81 | "method": "never",
82 | "named": "never"
83 | }
84 | },
85 | "typedef": [
86 | true,
87 | "call-signature"
88 | ],
89 | "typedef-whitespace": {
90 | "options": [
91 | {
92 | "call-signature": "nospace",
93 | "index-signature": "nospace",
94 | "parameter": "nospace",
95 | "property-declaration": "nospace",
96 | "variable-declaration": "nospace"
97 | },
98 | {
99 | "call-signature": "onespace",
100 | "index-signature": "onespace",
101 | "parameter": "onespace",
102 | "property-declaration": "onespace",
103 | "variable-declaration": "onespace"
104 | }
105 | ]
106 | },
107 | "variable-name": {
108 | "options": [
109 | "ban-keywords",
110 | "check-format",
111 | "allow-pascal-case"
112 | ]
113 | },
114 | "whitespace": {
115 | "options": [
116 | "check-branch",
117 | "check-decl",
118 | "check-operator",
119 | "check-separator",
120 | "check-type",
121 | "check-typecast"
122 | ]
123 | },
124 | "component-class-suffix": true,
125 | "contextual-lifecycle": true,
126 | "directive-class-suffix": true,
127 | "no-conflicting-lifecycle": true,
128 | "no-host-metadata-property": true,
129 | "no-input-rename": true,
130 | "no-inputs-metadata-property": true,
131 | "no-output-native": true,
132 | "no-output-on-prefix": true,
133 | "no-output-rename": true,
134 | "no-outputs-metadata-property": true,
135 | "template-banana-in-box": true,
136 | "template-no-negated-async": true,
137 | "use-lifecycle-interface": true,
138 | "use-pipe-transform-interface": true,
139 | "directive-selector": [
140 | true,
141 | "attribute",
142 | "app",
143 | "camelCase"
144 | ],
145 | "component-selector": [
146 | true,
147 | "element",
148 | "app",
149 | "kebab-case"
150 | ]
151 | }
152 | }
153 |
--------------------------------------------------------------------------------
/src/app/pages/main/create-nft/create-nft.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import {
3 | UtilityService,
4 | NftService,
5 | ConnectService,
6 | } from '../../../_services';
7 | import { Router } from '@angular/router';
8 | import { FormBuilder, FormGroup, Validators } from '@angular/forms';
9 | const IpfsHttpClient = require('ipfs-http-client');
10 | const ipfs = new IpfsHttpClient({
11 | host: 'ipfs.infura.io',
12 | port: 5001,
13 | protocol: 'https',
14 | });
15 | import Swal from 'sweetalert2';
16 |
17 | @Component({
18 | templateUrl: './create-nft.component.html',
19 | styleUrls: ['./create-nft.component.css'],
20 | })
21 | export class CreateNftComponent implements OnInit {
22 | constructor(
23 | private utility: UtilityService,
24 | private formBuilder: FormBuilder,
25 | private router: Router,
26 | private nftService: NftService,
27 | private connectService: ConnectService
28 | ) {}
29 |
30 | createForm: FormGroup;
31 |
32 | ngOnInit(): void {
33 | // intialize form
34 | this.createForm = this.formBuilder.group({
35 | name: [null, [Validators.required]],
36 | description: [null, [Validators.required]],
37 | image: [null, [Validators.required]],
38 | price: [null, [Validators.required]],
39 | category: [null, [Validators.required]],
40 | link: [null],
41 | });
42 | }
43 |
44 | get getCreateForm() {
45 | return this.createForm.controls;
46 | }
47 |
48 | convertDataURIToBinary(dataURI) {
49 | var base64Index = dataURI.indexOf(';base64,') + ';base64,'.length;
50 | var base64 = dataURI.substring(base64Index);
51 | var raw = window.atob(base64);
52 | var rawLength = raw.length;
53 | var array = new Uint8Array(new ArrayBuffer(rawLength));
54 |
55 | for (let i = 0; i < rawLength; i++) {
56 | array[i] = raw.charCodeAt(i);
57 | }
58 | return array;
59 | }
60 |
61 | upload() {
62 | const file = (
(
63 | document.getElementById('sign__file-upload')
64 | )).files[0];
65 | console.log(file);
66 |
67 | if (file.size <= 102400000){
68 | var self = this;
69 | const reader = new FileReader();
70 | let byteArray;
71 |
72 | reader.addEventListener(
73 | 'loadend',
74 | async function () {
75 | // convert image file to base64 string
76 |
77 | byteArray = self.convertDataURIToBinary(reader.result);
78 | self.utility.startLoader('Uploading document....');
79 | var result = await ipfs.add(byteArray);
80 | self.utility.startLoader(
81 | 'Document uploaded sucessfully. Please wait...'
82 | );
83 | self.utility.startLoader(
84 | 'Data encryption in progress. Please wait...'
85 | );
86 | var fianalJSON = self.createForm.value;
87 | fianalJSON[
88 | 'image'
89 | ] = `https://gateway.ipfs.io/ipfs/${result['path']}`;
90 | fianalJSON['status'] = `AVAILABLE`;
91 | fianalJSON['fileType'] = file.type;
92 | fianalJSON['currentOwnerWalletAddress'] = self.connectService.account;
93 | self.utility.startLoader('Almost finished. Please wait...');
94 | self.createNFT(fianalJSON);
95 | },
96 | false
97 | );
98 | if (file) {
99 | reader.readAsDataURL(file);
100 | }
101 | } else {
102 | this.utility.showErrorAlert('Error', 'File size must be less than 100Mb');
103 | }
104 |
105 |
106 |
107 | }
108 |
109 | createNFT(data) {
110 | var self = this;
111 | this.utility.startLoader();
112 | this.nftService.createNft(data).subscribe(
113 | (res) => {
114 | this.utility.stopLoader();
115 | Swal.fire({
116 | icon: 'success',
117 | title: 'Congratulations!',
118 | text: 'You have minted NFT successfully.',
119 | }).then((result) => {
120 | this.router.navigate(['/manage-profile']);
121 | });
122 | },
123 | (error) => {
124 | this.utility.stopLoader();
125 | this.utility.showErrorAlert('Error', error);
126 | }
127 | );
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/src/app/pages/main/marketplace/marketplace.component.ts:
--------------------------------------------------------------------------------
1 | import { environment } from 'src/environments/environment';
2 | import { Component, OnInit } from '@angular/core';
3 | import { FormBuilder, FormGroup, Validators } from '@angular/forms';
4 | import { NftService, UtilityService } from '../../../_services';
5 | @Component({
6 | templateUrl: './marketplace.component.html',
7 | styleUrls: ['./marketplace.component.css'],
8 | })
9 | export class MarketplaceComponent implements OnInit {
10 | constructor(
11 | private nftService: NftService,
12 | private utility: UtilityService,
13 | private formBuilder: FormBuilder
14 | ) {
15 | this.utility.updatePageSEO(
16 | 'NFT Marketplace | Buy and Sell your NFT, and NFT Money. NFT Collections, Crypto artworks.',
17 | 'Buy, Sell and trade your NFTs and NFT Money Secured with blockchain.'
18 | );
19 | }
20 |
21 | activeTab = 'grid';
22 | nfts: any = [];
23 | baseImageUrl = environment.IMG_BASE_URL;
24 | currentDate = new Date();
25 | filteredNfts: any = [];
26 | collectionList: any = [];
27 | selectedCollection: any = [];
28 | selectedCategory: any = [];
29 | filterForm: FormGroup;
30 | p: number = 1;
31 | categoryList = ['Image', 'Video'];
32 |
33 | ngOnInit(): void {
34 | this.filterForm = this.formBuilder.group({
35 | filterItems: [[]],
36 | sort: ['new'],
37 | });
38 | this.getAllNfts();
39 | }
40 |
41 | getAllNfts() {
42 | var self = this;
43 | this.utility.startLoader();
44 | this.nftService.getNfts().subscribe(
45 | (res) => {
46 | this.utility.stopLoader();
47 | this.nfts = res;
48 | this.filteredNfts = res;
49 | this.getFilterList();
50 | },
51 | (error) => {
52 | this.utility.stopLoader();
53 | this.utility.showErrorAlert('Error', error);
54 | }
55 | );
56 | }
57 |
58 | getFilterList() {
59 | this.nfts.forEach((element) => {
60 | if (!this.collectionList[element.currentOwner.id]) {
61 | this.collectionList[element.currentOwner.id] =
62 | element.currentOwner.name;
63 | }
64 | });
65 | }
66 |
67 | onChangeArtist(event, item: any) {
68 | // Use appropriate model type instead of any
69 | if (this.selectedCollection.indexOf(item) > -1) {
70 | const index = this.selectedCollection.indexOf(item);
71 | if (index > -1) {
72 | this.selectedCollection.splice(index, 1);
73 | }
74 | } else {
75 | this.selectedCollection.push(item);
76 | }
77 | }
78 |
79 | onChangeCategory(event, item: any) {
80 | // Use appropriate model type instead of any
81 | if (this.selectedCategory.indexOf(item) > -1) {
82 | const index = this.selectedCategory.indexOf(item);
83 | if (index > -1) {
84 | this.selectedCategory.splice(index, 1);
85 | }
86 | } else {
87 | this.selectedCategory.push(item);
88 | }
89 | }
90 |
91 | applyFilter() {
92 | this.getFilteredItems();
93 | }
94 |
95 | async getFilteredItems() {
96 | var self = this;
97 | if (this.selectedCollection.length > 0) {
98 | self.filteredNfts = self.nfts.filter((element) => {
99 | return self.selectedCollection.indexOf(element.currentOwner.id) > -1;
100 | });
101 | } else {
102 | self.filteredNfts = self.nfts;
103 | }
104 |
105 | if (this.selectedCategory.length > 0) {
106 | self.filteredNfts = self.filteredNfts.filter((element) => {
107 | return self.selectedCategory.indexOf(element.category) > -1;
108 | });
109 | }
110 |
111 | if (this.filterForm.value.sort === 'new') {
112 | self.filteredNfts.sort((a, b) => (a.createdAt < b.createdAt ? 1 : -1));
113 | } else if (this.filterForm.value.sort === 'old') {
114 | self.filteredNfts.sort((a, b) => (a.createdAt > b.createdAt ? 1 : -1));
115 | } else if (this.filterForm.value.sort === 'high') {
116 | self.filteredNfts.sort((a, b) => (a.price < b.price ? 1 : -1));
117 | } else if (this.filterForm.value.sort === 'low') {
118 | await self.filteredNfts.sort((a, b) => (a.price > b.price ? 1 : -1));
119 | }
120 | }
121 |
122 | convertDate(date) {
123 | return new Date(date);
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "cli": {
4 | "analytics": "35254c2d-8c84-49e3-ae12-64100162cc98"
5 | },
6 | "version": 1,
7 | "newProjectRoot": "projects",
8 | "projects": {
9 | "nft-web-app": {
10 | "projectType": "application",
11 | "schematics": {},
12 | "root": "",
13 | "sourceRoot": "src",
14 | "prefix": "app",
15 | "architect": {
16 | "build": {
17 | "builder": "@angular-devkit/build-angular:browser",
18 | "options": {
19 | "outputPath": "dist/nft-web-app",
20 | "index": "src/index.html",
21 | "main": "src/main.ts",
22 | "polyfills": "src/polyfills.ts",
23 | "tsConfig": "tsconfig.app.json",
24 | "aot": true,
25 | "assets": [
26 | "src/favicon.ico",
27 | "src/assets"
28 | ],
29 | "styles": [
30 | "src/styles.css",
31 | "node_modules/ngx-toastr/toastr.css"
32 | ],
33 | "scripts": [
34 | ]
35 | },
36 | "configurations": {
37 | "production": {
38 | "fileReplacements": [
39 | {
40 | "replace": "src/environments/environment.ts",
41 | "with": "src/environments/environment.prod.ts"
42 | }
43 | ],
44 | "optimization": true,
45 | "outputHashing": "all",
46 | "sourceMap": false,
47 | "namedChunks": false,
48 | "extractLicenses": true,
49 | "vendorChunk": false,
50 | "buildOptimizer": true,
51 | "budgets": [
52 | {
53 | "type": "initial",
54 | "maximumWarning": "2mb",
55 | "maximumError": "5mb"
56 | },
57 | {
58 | "type": "anyComponentStyle",
59 | "maximumWarning": "6kb",
60 | "maximumError": "10kb"
61 | }
62 | ]
63 | }
64 | }
65 | },
66 | "serve": {
67 | "builder": "@angular-devkit/build-angular:dev-server",
68 | "options": {
69 | "browserTarget": "nft-web-app:build"
70 | },
71 | "configurations": {
72 | "production": {
73 | "browserTarget": "nft-web-app:build:production"
74 | }
75 | }
76 | },
77 | "extract-i18n": {
78 | "builder": "@angular-devkit/build-angular:extract-i18n",
79 | "options": {
80 | "browserTarget": "nft-web-app:build"
81 | }
82 | },
83 | "test": {
84 | "builder": "@angular-devkit/build-angular:karma",
85 | "options": {
86 | "main": "src/test.ts",
87 | "polyfills": "src/polyfills.ts",
88 | "tsConfig": "tsconfig.spec.json",
89 | "karmaConfig": "karma.conf.js",
90 | "assets": [
91 | "src/favicon.ico",
92 | "src/assets"
93 | ],
94 | "styles": [
95 | "src/styles.css"
96 | ],
97 | "scripts": []
98 | }
99 | },
100 | "lint": {
101 | "builder": "@angular-devkit/build-angular:tslint",
102 | "options": {
103 | "tsConfig": [
104 | "tsconfig.app.json",
105 | "tsconfig.spec.json",
106 | "e2e/tsconfig.json"
107 | ],
108 | "exclude": [
109 | "**/node_modules/**"
110 | ]
111 | }
112 | },
113 | "e2e": {
114 | "builder": "@angular-devkit/build-angular:protractor",
115 | "options": {
116 | "protractorConfig": "e2e/protractor.conf.js",
117 | "devServerTarget": "nft-web-app:serve"
118 | },
119 | "configurations": {
120 | "production": {
121 | "devServerTarget": "nft-web-app:serve:production"
122 | }
123 | }
124 | }
125 | }
126 | }
127 | },
128 | "defaultProject": "nft-web-app"
129 | }
--------------------------------------------------------------------------------
/src/app/pages/main/create-nft/create-nft.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | - Home
7 | - Create collectible item
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
Create collectible item
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/src/app/_services/authentication.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { HttpClient, HttpHeaders } from '@angular/common/http';
3 | import { Observable } from 'rxjs';
4 | import { map } from 'rxjs/operators';
5 | import { environment } from '../../environments/environment';
6 |
7 | @Injectable()
8 | export class AuthenticationService {
9 | public token: string;
10 | public refresh_token: string;
11 | public headers: HttpHeaders;
12 | public readonly apiUrl = environment.API_BASE_URL;
13 |
14 | constructor(public http: HttpClient) {
15 | // set token if saved in local storage
16 | var currentUser = JSON.parse(localStorage.getItem('user'));
17 | this.token = currentUser && currentUser.token;
18 | this.refresh_token = currentUser && currentUser.refresh_token;
19 | }
20 |
21 | isLoggedIn() {
22 | if (localStorage.getItem('user')) {
23 | return true;
24 | }
25 | return false;
26 | }
27 |
28 | login(email: string, password: string): Observable {
29 | return this.http
30 | .post(this.apiUrl + 'auth/login', {
31 | email: email,
32 | password: password
33 | })
34 | .pipe(
35 | map((response: Response) => {
36 | this.token = response['tokens']['access']['token'];
37 | this.refresh_token = response['tokens']['refresh']['token'];
38 | let expiresIn = response['tokens']['access']['expires'];
39 | if (
40 | (this.token && (response['user']['role'] === 'user') ||
41 | response['user']['role'] === 'artist')
42 | ) {
43 | // store expiresIn and jwt token in local storage to keep user logged in between page refreshes
44 | localStorage.setItem(
45 | 'user',
46 | JSON.stringify({
47 | expires_in: expiresIn,
48 | token: this.token,
49 | refresh_token: this.refresh_token,
50 | email: response['user']['email'],
51 | name: response['user']['name'],
52 | role: response['user']['role'],
53 | profile_pic: response['user']['profile_pic'],
54 | email_verified_at: response['user']['email_verified_at'],
55 | id: response['user']['id'],
56 | })
57 | );
58 | }
59 | return response;
60 | })
61 | );
62 | }
63 |
64 | register(username: string, email: string, password: string, role: string): Observable {
65 | return this.http
66 | .post(this.apiUrl + 'auth/register', {
67 | email: email,
68 | name: username,
69 | password: password,
70 | role: role,
71 | })
72 | .pipe(
73 | map((response: Response) => {
74 | // register successful if there's a jwt token in the response
75 | return response;
76 | })
77 | );
78 | }
79 |
80 | logout(): Observable {
81 | // clear token remove user from local storage to log user out
82 | console.log(this.refresh_token);
83 | return this.http
84 | .post(this.apiUrl + 'auth/logout', { refreshToken: this.refresh_token })
85 | .pipe(
86 | map((response: Response) => {
87 | console.log(response);
88 | this.token = null;
89 | this.refresh_token = null;
90 | localStorage.removeItem('user');
91 | return response;
92 | })
93 | );
94 | }
95 |
96 | sendPasswordResetEmail(email: string): Observable {
97 | return this.http
98 | .post(this.apiUrl + 'auth/forgot-password', { email: email })
99 | .pipe(
100 | map((response: Response) => {
101 | return response;
102 | })
103 | );
104 | }
105 |
106 | resetPassword(
107 | newPassword: string,
108 | token: string
109 | ): Observable {
110 | return this.http
111 | .post(`${this.apiUrl}auth/reset-password?token=${token}`, {
112 | password: newPassword,
113 | })
114 | .pipe(
115 | map((response: Response) => {
116 | return response;
117 | })
118 | );
119 | }
120 |
121 | emailVerifcation(
122 | token: string
123 | ): Observable {
124 | return this.http
125 | .get(`${this.apiUrl}auth/email-verification/${token}`)
126 | .pipe(
127 | map((response: Response) => {
128 | return response;
129 | })
130 | );
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/src/app/_components/footer/footer.component.html:
--------------------------------------------------------------------------------
1 |
2 |
54 |
--------------------------------------------------------------------------------