diff --git a/services/functions/scripts/dev.ts b/services/functions/scripts/dev.ts index 2e44f10cf..aa2b4aff2 100644 --- a/services/functions/scripts/dev.ts +++ b/services/functions/scripts/dev.ts @@ -16,7 +16,7 @@ void async function() { const networkKey = process.env.NETWORK?.toUpperCase() || process.env.FORK?.toUpperCase() || 'TESTNET' if (process.env.NETWORK) { - process.env.ETHEREUM_RPC_URL = ETHEREUM_RPC_URL[networkKey] + process.env.ETHEREUM_RPC_URL = process.env.ETHEREUM_RPC_URL || ETHEREUM_RPC_URL[networkKey] process.env.FUNCTIONS_BILLING_REGISTRY_ADDRESS = ETHEREUM_CONTRACTS[networkKey]?.FUNCTIONS_BILLING_REGISTRY_ADDRESS process.env.FUNCTIONS_ORACLE_ADDRESS = ETHEREUM_CONTRACTS[networkKey]?.FUNCTIONS_ORACLE_ADDRESS } diff --git a/services/functions/src/providers/handlers.ts b/services/functions/src/providers/handlers.ts index 34efa0f6f..a5cbb9f59 100644 --- a/services/functions/src/providers/handlers.ts +++ b/services/functions/src/providers/handlers.ts @@ -26,26 +26,25 @@ export async function fulfillRequestHandler(input: HandlerInput): Promise const { result, resultLog, success } = await simulateRequest(currentRequestConfig) if (success) { - console.log('RES', JSON.stringify({ requestId, result })) - // const signer = config.wallet.connect(provider) - // const dummySigners = Array(31).fill(signer.address) - // const fulfillAndBill = await functionsBillingRegistry.connect(signer).fulfillAndBill( - // requestId, - // result, - // '0x', - // signer.address, - // dummySigners, - // 4, - // 100_000, - // 500_000, - // { - // gasLimit: 500_000, - // } - // ) - // await fulfillAndBill.wait() - // if (process.env.USE_LOGS === 'true') { - // updateExecutionLog('execution.log', resultLog) - // } + const signer = config.wallet.connect(provider) + const dummySigners = Array(31).fill(signer.address) + const fulfillAndBill = await functionsBillingRegistry.connect(signer).fulfillAndBill( + requestId, + result, + '0x', + signer.address, + dummySigners, + 4, + 100_000, + 500_000, + { + gasLimit: 500_000, + } + ) + await fulfillAndBill.wait() + if (process.env.USE_LOGS === 'true') { + updateExecutionLog('execution.log', resultLog) + } } else { throw new Error(resultLog) }