Pass auction data when adding project
This commit is contained in:
parent
b58d9e6c21
commit
dfeb281586
@ -38,7 +38,7 @@
|
|||||||
[registryConfig.fee]
|
[registryConfig.fee]
|
||||||
gas = ""
|
gas = ""
|
||||||
fees = ""
|
fees = ""
|
||||||
gasPrice = "1"
|
gasPrice = "1alnt"
|
||||||
|
|
||||||
[auction]
|
[auction]
|
||||||
commitFee = "1000"
|
commitFee = "1000"
|
||||||
|
@ -5,7 +5,7 @@ import { DateTime } from 'luxon';
|
|||||||
import { DeepPartial } from 'typeorm';
|
import { DeepPartial } from 'typeorm';
|
||||||
import { Octokit } from 'octokit';
|
import { Octokit } from 'octokit';
|
||||||
|
|
||||||
import { Registry as LaconicRegistry, parseGasAndFees } from '@cerc-io/registry-sdk';
|
import { Registry as LaconicRegistry, getGasPrice, parseGasAndFees } from '@cerc-io/registry-sdk';
|
||||||
import { Auction } from '@cerc-io/registry-sdk/dist/proto/cerc/auction/v1/auction';
|
import { Auction } from '@cerc-io/registry-sdk/dist/proto/cerc/auction/v1/auction';
|
||||||
|
|
||||||
import { RegistryConfig } from './config';
|
import { RegistryConfig } from './config';
|
||||||
@ -35,12 +35,13 @@ export class Registry {
|
|||||||
|
|
||||||
constructor (registryConfig: RegistryConfig) {
|
constructor (registryConfig: RegistryConfig) {
|
||||||
this.registryConfig = registryConfig;
|
this.registryConfig = registryConfig;
|
||||||
// const gasPrice = Util.getGasPrice(registryConfig.fee.gasPrice);
|
|
||||||
|
const gasPrice = getGasPrice(registryConfig.fee.gasPrice);
|
||||||
|
|
||||||
this.registry = new LaconicRegistry(
|
this.registry = new LaconicRegistry(
|
||||||
registryConfig.gqlEndpoint,
|
registryConfig.gqlEndpoint,
|
||||||
registryConfig.restEndpoint,
|
registryConfig.restEndpoint,
|
||||||
// Pass gasPrice
|
{ chainId: registryConfig.chainId, gasPrice }
|
||||||
{ chainId: registryConfig.chainId }
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,6 +219,7 @@ export class Registry {
|
|||||||
|
|
||||||
const config = await getConfig();
|
const config = await getConfig();
|
||||||
const auctionConfig = config.auction;
|
const auctionConfig = config.auction;
|
||||||
|
|
||||||
const fee = parseGasAndFees(this.registryConfig.fee.gas, this.registryConfig.fee.fees);
|
const fee = parseGasAndFees(this.registryConfig.fee.gas, this.registryConfig.fee.fees);
|
||||||
|
|
||||||
const auctionResult = await this.registry.createProviderAuction(
|
const auctionResult = await this.registry.createProviderAuction(
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { useForm, Controller, SubmitHandler } from 'react-hook-form';
|
import { useForm, Controller, SubmitHandler } from 'react-hook-form';
|
||||||
import { useLocation, useNavigate, useSearchParams } from 'react-router-dom';
|
import { useLocation, useNavigate, useSearchParams } from 'react-router-dom';
|
||||||
|
import { AuctionData } from 'gql-client';
|
||||||
|
|
||||||
import { Heading } from '../../shared/Heading';
|
import { Heading } from '../../shared/Heading';
|
||||||
import { Button } from '../../shared/Button';
|
import { Button } from '../../shared/Button';
|
||||||
@ -13,7 +14,7 @@ type ConfigureFormValues = {
|
|||||||
option: string;
|
option: string;
|
||||||
lrn?: string;
|
lrn?: string;
|
||||||
numProviders?: number;
|
numProviders?: number;
|
||||||
maxPrice?: number;
|
maxPrice?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const Configure = () => {
|
const Configure = () => {
|
||||||
@ -46,20 +47,23 @@ const Configure = () => {
|
|||||||
isPrivate
|
isPrivate
|
||||||
};
|
};
|
||||||
|
|
||||||
let configData: any;
|
let lrn: string | undefined;
|
||||||
|
let auctionData: AuctionData | undefined;
|
||||||
|
|
||||||
if (data.option === 'LRN') {
|
if (data.option === 'LRN') {
|
||||||
configData = data.lrn;
|
lrn = data.lrn;
|
||||||
} else if (data.option === 'Auction') {
|
} else if (data.option === 'Auction') {
|
||||||
configData = {
|
auctionData = {
|
||||||
numProviders: data.numProviders,
|
numProviders: Number(data.numProviders!),
|
||||||
maxPrice: data.maxPrice
|
maxPrice: (data.maxPrice!).toString()
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const { addProjectFromTemplate } = await client.addProjectFromTemplate(
|
const { addProjectFromTemplate } = await client.addProjectFromTemplate(
|
||||||
orgSlug,
|
orgSlug,
|
||||||
projectData,
|
projectData,
|
||||||
configData
|
lrn,
|
||||||
|
auctionData
|
||||||
);
|
);
|
||||||
|
|
||||||
navigate(`/${orgSlug}/projects/create/template/deploy?projectId=${addProjectFromTemplate.id}&templateId=${templateId}`);
|
navigate(`/${orgSlug}/projects/create/template/deploy?projectId=${addProjectFromTemplate.id}&templateId=${templateId}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user