|
|
@ -2,6 +2,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
import {Zone} from "@/zone"; |
|
|
|
import {Zone} from "@/zone"; |
|
|
|
import {Collection} from "@/collection"; |
|
|
|
import {Collection} from "@/collection"; |
|
|
|
|
|
|
|
import {parse_zone} from "@/utils"; |
|
|
|
|
|
|
|
|
|
|
|
let ex_collection = () => new Collection("example.ton", "Example collection"); |
|
|
|
let ex_collection = () => new Collection("example.ton", "Example collection"); |
|
|
|
|
|
|
|
|
|
|
@ -11,13 +12,15 @@ export class Result { |
|
|
|
auction_price?: number; |
|
|
|
auction_price?: number; |
|
|
|
owner?: string; |
|
|
|
owner?: string; |
|
|
|
collection_required: Collection | null; |
|
|
|
collection_required: Collection | null; |
|
|
|
|
|
|
|
condition_fullfilled: boolean | null = null; |
|
|
|
|
|
|
|
|
|
|
|
constructor(domain: string, buy_price?: number, auction_price?: number, owner?: string, collection_required: Collection | null = null) { |
|
|
|
constructor(domain: string, buy_price?: number, auction_price?: number, owner?: string, collection_required: Collection | null = null, condition_fullfilled: boolean | null = null) { |
|
|
|
this.domain = domain; |
|
|
|
this.domain = domain; |
|
|
|
this.buy_price = buy_price; |
|
|
|
this.buy_price = buy_price; |
|
|
|
this.auction_price = auction_price; |
|
|
|
this.auction_price = auction_price; |
|
|
|
this.owner = owner; |
|
|
|
this.owner = owner; |
|
|
|
this.collection_required = collection_required; |
|
|
|
this.collection_required = collection_required; |
|
|
|
|
|
|
|
this.condition_fullfilled = condition_fullfilled; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getRouteParams(): any { |
|
|
|
getRouteParams(): any { |
|
|
@ -29,11 +32,11 @@ export class Result { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
canAuction(): boolean { |
|
|
|
canAuction(): boolean { |
|
|
|
return this.auction_price !== undefined && this.auction_price !== null; |
|
|
|
return this.auction_price !== undefined && this.auction_price !== null && this.owner === undefined; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
canBuy(): boolean { |
|
|
|
canBuy(): boolean { |
|
|
|
return this.buy_price !== undefined && this.buy_price !== null; |
|
|
|
return this.buy_price !== undefined && this.buy_price !== null && this.owner === undefined; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
zone(): string { |
|
|
|
zone(): string { |
|
|
@ -56,26 +59,27 @@ export async function get_search_results(query: string) { |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function parse_zone(domain: string) { |
|
|
|
export async function get_domain_result(domain: string, address?: string) { |
|
|
|
// extract the zone from the domain (e.g. example.ton from 123.example.ton)
|
|
|
|
|
|
|
|
return domain.split('.').slice(1).join('.'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export async function get_domain_result(domain: string) { |
|
|
|
|
|
|
|
// return await call_api('get/' + domain);
|
|
|
|
// return await call_api('get/' + domain);
|
|
|
|
await sleep(100); |
|
|
|
await sleep(100); |
|
|
|
if (domain === 'test.ton') { |
|
|
|
if (domain === 'test.ton') { |
|
|
|
return new Result(domain); |
|
|
|
return new Result(domain); |
|
|
|
} |
|
|
|
} |
|
|
|
// if (domain.split('.')[0] === 'owned') {
|
|
|
|
|
|
|
|
// return new Result(domain, 5, 3, '123');
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
console.log(domain); |
|
|
|
|
|
|
|
console.log(domain.split('.')) |
|
|
|
|
|
|
|
let exc = ex_collection(); |
|
|
|
let exc = ex_collection(); |
|
|
|
|
|
|
|
if (domain.startsWith('owned')) { |
|
|
|
|
|
|
|
return new Result(domain, 5, 3, '123'); |
|
|
|
|
|
|
|
} |
|
|
|
if (parse_zone(domain) === 'example.ton') { |
|
|
|
if (parse_zone(domain) === 'example.ton') { |
|
|
|
return new Result(domain, 5, 3, undefined, exc); |
|
|
|
return new Result(domain, 5, 3, undefined, exc); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (parse_zone(domain) === 'testtesttest.ton') { |
|
|
|
|
|
|
|
console.log(address) |
|
|
|
|
|
|
|
if (address !== undefined && address !== '') { |
|
|
|
|
|
|
|
return new Result(domain, 5, 3, undefined, exc, false); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return new Result(domain, 5, 3, undefined, exc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return new Result(domain, 5, 3); |
|
|
|
return new Result(domain, 5, 3); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -85,7 +89,7 @@ export async function get_zones() { |
|
|
|
return [ |
|
|
|
return [ |
|
|
|
new Zone("example.ton", 3, 5, ex_collection()), |
|
|
|
new Zone("example.ton", 3, 5, ex_collection()), |
|
|
|
new Zone("agorata.ton", 3, 5), |
|
|
|
new Zone("agorata.ton", 3, 5), |
|
|
|
new Zone("testtesttest.ton", 1, 1)]; |
|
|
|
new Zone("testtesttest.ton", 1, 1, ex_collection())]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export class TonLink { |
|
|
|
export class TonLink { |
|
|
|