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