1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

update provider initialize and computeflow

This commit is contained in:
Bogdan Fazakas 2022-01-19 23:43:24 +02:00
parent 555bdf583d
commit f21f606b49
2 changed files with 9 additions and 2 deletions

View File

@ -231,7 +231,8 @@ export class Provider {
providerUri: string,
getMethod: any,
userCustomParameters?: UserCustomParameters,
computeEnv?: string
computeEnv?: string,
validUntil?: string
): Promise<ProviderInitialize> {
const providerEndpoints = await this.getEndpoints(providerUri)
const serviceEndpoints = await this.getServiceEndpoints(
@ -250,6 +251,7 @@ export class Provider {
if (userCustomParameters)
initializeUrl += '&userdata=' + encodeURI(JSON.stringify(userCustomParameters))
if (computeEnv) initializeUrl += '&computeEnv=' + encodeURI(computeEnv)
if (validUntil) initializeUrl += '&validUntil=' + validUntil
try {
const response = await getMethod('GET', initializeUrl)
const results: ProviderInitialize = await response.json()

View File

@ -279,6 +279,10 @@ describe('Simple compute tests', async () => {
providerAlgoFees
)
assert(txidAlgo, 'Failed to order algo')
const providerValidUntil = new Date()
providerValidUntil.setHours(providerValidUntil.getHours() + 1)
// initialize provider orders for asset
const initializeData = await ProviderInstance.initialize(
resolvedDDOAsset.id,
@ -288,7 +292,8 @@ describe('Simple compute tests', async () => {
providerUrl,
crossFetchGeneric,
null,
'env1'
'env1',
providerValidUntil.toString()
)
const providerDatasetFees: ProviderFees = {
providerFeeAddress: initializeData.providerFee.providerFeeAddress,