|
|
|
@ -2,7 +2,8 @@
|
|
|
|
|
|
|
|
|
|
import {Zone} from "@/zone"; |
|
|
|
|
import {Collection} from "@/collection"; |
|
|
|
|
import {parse_zone, Message} from "@/utils"; |
|
|
|
|
import type {Message} from "@/utils"; |
|
|
|
|
import {call_api} from "@/api"; |
|
|
|
|
|
|
|
|
|
let ex_collection = () => new Collection("example.ton", "Example collection"); |
|
|
|
|
|
|
|
|
@ -14,8 +15,9 @@ export class Result {
|
|
|
|
|
collection_required: Collection | null; |
|
|
|
|
condition_fulfilled: boolean | null = null; |
|
|
|
|
buy_msg: Message | null = null; |
|
|
|
|
content_msg: Message | null = null; |
|
|
|
|
|
|
|
|
|
constructor(domain: string, buy_price?: number, auction_price?: number, owner?: string, collection_required: Collection | null = null, condition_fulfilled: boolean | null = null, buy_msg: Message | null = null) { |
|
|
|
|
constructor(domain: string, buy_price?: number, auction_price?: number, owner?: string, collection_required: Collection | null = null, condition_fulfilled: boolean | null = null, buy_msg: Message | null = null, content_msg: Message | null = null) { |
|
|
|
|
this.domain = domain; |
|
|
|
|
this.buy_price = buy_price; |
|
|
|
|
this.auction_price = auction_price; |
|
|
|
@ -23,6 +25,20 @@ export class Result {
|
|
|
|
|
this.collection_required = collection_required; |
|
|
|
|
this.condition_fulfilled = condition_fulfilled; |
|
|
|
|
this.buy_msg = buy_msg; |
|
|
|
|
this.content_msg = content_msg; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static fromBackend(data: any): Result { |
|
|
|
|
let domain = data.domain; |
|
|
|
|
let buy_price = data.buy_price; |
|
|
|
|
let auction_price = data.auction_price; |
|
|
|
|
let owner = data.owner; |
|
|
|
|
let collection_required = data.collection_required; |
|
|
|
|
let condition_fulfilled = data.condition_fulfilled; |
|
|
|
|
let buy_msg = data.buy_msg; |
|
|
|
|
let content_msg = data.content_msg; |
|
|
|
|
|
|
|
|
|
return new Result(domain, buy_price, auction_price, owner, collection_required, condition_fulfilled, buy_msg, content_msg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getRouteParams(): any { |
|
|
|
@ -51,19 +67,19 @@ const sleep = (milliseconds: number) => {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export async function get_search_results(query: string) { |
|
|
|
|
// return await call_api('find/' + query);
|
|
|
|
|
await sleep(200); |
|
|
|
|
return Result.fromBackend(await call_api('find/' + query)); |
|
|
|
|
/*await sleep(200); |
|
|
|
|
return [ |
|
|
|
|
new Result(query + '.ton', 5, 3), |
|
|
|
|
new Result(query + '.ton', 1), |
|
|
|
|
new Result(query + '.ton', undefined, 2), |
|
|
|
|
new Result(query + '.ton', undefined, undefined, '123') |
|
|
|
|
]; |
|
|
|
|
];*/ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export async function get_domain_result(domain: string, address?: string) { |
|
|
|
|
// return await call_api('get/' + domain);
|
|
|
|
|
await sleep(100); |
|
|
|
|
return Result.fromBackend(await call_api('get/' + domain)); |
|
|
|
|
/*await sleep(100); |
|
|
|
|
if (domain === 'test.ton') { |
|
|
|
|
return new Result(domain); |
|
|
|
|
} |
|
|
|
@ -82,16 +98,17 @@ export async function get_domain_result(domain: string, address?: string) {
|
|
|
|
|
return new Result(domain, 5, 3, undefined, exc); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return new Result(domain, 5, 3); |
|
|
|
|
return new Result(domain, 5, 3);*/ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export async function get_zones() { |
|
|
|
|
// return await call_api('zones');
|
|
|
|
|
await sleep(10); |
|
|
|
|
let zones_back = await call_api('zones'); |
|
|
|
|
return zones_back.map((zone: any) => new Zone(zone.zone, zone.price_buy_1, zone.price_buy_2, zone.collection_required, zone.price_auction_1, zone.price_auction_2, zone.min_length, zone.length_1, zone.length_2, zone.address)); |
|
|
|
|
/*await sleep(10); |
|
|
|
|
return [ |
|
|
|
|
new Zone("example.ton", 3, 5, ex_collection()), |
|
|
|
|
new Zone("agorata.ton", 3, 5), |
|
|
|
|
new Zone("testtesttest.ton", 1, 1, ex_collection())]; |
|
|
|
|
new Zone("testtesttest.ton", 1, 1, ex_collection())];*/ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export class TonLink { |
|
|
|
|