Skip to content

Commit

Permalink
fix problem with docker build flow
Browse files Browse the repository at this point in the history
  • Loading branch information
bogos committed Feb 8, 2022
1 parent 2938973 commit 4e7d524
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as JSONRPC from '@chainlink/json-rpc-adapter/src/adapter'
import * as JSONRPC from '@chainlink/json-rpc-adapter'
import { Config, ExecuteWithConfig } from '@chainlink/types'
import { Validator, Requester } from '@chainlink/ea-bootstrap'

Expand All @@ -20,7 +20,8 @@ export const execute: ExecuteWithConfig<Config> = async (request, context, confi
? DEFAULT_FIELD
: validator.validated.data.resultPath || DEFAULT_FIELD

const response = await JSONRPC.execute(
const _execute: ExecuteWithConfig<Config> = JSONRPC.makeExecute()
const response = await _execute(
{
...request,
data: { ...request.data, method: NAME },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as JSONRPC from '@chainlink/json-rpc-adapter/src/adapter'
import * as JSONRPC from '@chainlink/json-rpc-adapter'
import { Config, ExecuteWithConfig, AdapterRequest, AdapterContext } from '@chainlink/types'
import { Validator, Requester, Logger } from '@chainlink/ea-bootstrap'

Expand Down Expand Up @@ -48,9 +48,11 @@ const scanWithRetries = async (
}

const deadline = Date.now() + config.api.timeout
const _execute: ExecuteWithConfig<Config> = JSONRPC.makeExecute()

while (Date.now() + 1000 <= deadline) {
try {
return await JSONRPC.execute(requestData, context, config)
return await _execute(requestData, context, config)
} catch (e) {
if (e.cause?.response?.data?.error?.code === -8) {
Logger.debug('scan is already in progress, waiting 1s...')
Expand All @@ -70,7 +72,7 @@ const scanWithRetries = async (
config.api.timeout = 1000 // We expect this action to be quick, and we do not want to hold up the request on this
Logger.debug('timeout reached, aborting scan in progress')
try {
await JSONRPC.execute(requestData, context, config)
await _execute(requestData, context, config)
} catch (e) {
Logger.error(`failed to abort scan in progress: ${e.message}`)
}
Expand Down
8 changes: 4 additions & 4 deletions packages/composites/bob/src/endpoint/format.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as JSONRPC from '@chainlink/json-rpc-adapter/src/adapter'
import { ExecuteWithConfig } from '@chainlink/types'
import * as JSONRPC from '@chainlink/json-rpc-adapter'
import { Config, ExecuteWithConfig } from '@chainlink/types'
import { Validator, Requester } from '@chainlink/ea-bootstrap'
import { DEFAULT_RPC_URL, ExtendedConfig } from '../config'
import { ethers } from 'ethers'
Expand Down Expand Up @@ -49,8 +49,8 @@ export const execute: ExecuteWithConfig<ExtendedConfig> = async (request, contex
const blockNumber = validator.validated.data.blockNumber

const block = await provider.getBlock(blockNumber)

const response = await JSONRPC.execute(
const _execute: ExecuteWithConfig<Config> = JSONRPC.makeExecute()
const response = await _execute(
{
...request,
data: { ...request.data, method: 'eth_getBlockByHash', params: [block.hash, false] },
Expand Down
4 changes: 2 additions & 2 deletions packages/composites/proof-of-reserves/src/reduce.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as reduce from '@chainlink/reduce-adapter/src/endpoint/reduce'
import * as reduce from '@chainlink/reduce-adapter'
import { AdapterContext, AdapterResponse } from '@chainlink/types'
import { callAdapter } from './adapter'
import { Indexer } from './balance'
Expand Down Expand Up @@ -47,5 +47,5 @@ export const runReduceAdapter = async (
valuePath: 'balance',
},
}
return callAdapter(reduce.execute, context, next, '_onReduce')
return callAdapter(reduce.makeExecute(), context, next, '_onReduce')
}
4 changes: 2 additions & 2 deletions packages/sources/lotus/src/endpoint/balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const execute: ExecuteWithConfig<Config> = async (request, context, confi

const jsonRpcConfig = JSONRPC.makeConfig()
jsonRpcConfig.api.headers['Authorization'] = `Bearer ${config.apiKey}`
const _execute = JSONRPC.makeExecute(jsonRpcConfig)
const _execute: ExecuteWithConfig<Config> = JSONRPC.makeExecute(jsonRpcConfig)

if (!Array.isArray(addresses) || addresses.length === 0) {
throw new AdapterError({
Expand All @@ -50,7 +50,7 @@ export const execute: ExecuteWithConfig<Config> = async (request, context, confi
requestId: requestId + 1,
},
}
const result = await _execute(requestData, context)
const result = await _execute(requestData, context, jsonRpcConfig)
return {
address,
result: result.data.result,
Expand Down

0 comments on commit 4e7d524

Please sign in to comment.