Skip to content

Commit

Permalink
Update functions rpc url (skip deploy)
Browse files Browse the repository at this point in the history
  • Loading branch information
shanejearley committed Oct 29, 2023
1 parent 6c55280 commit f38be56
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion services/functions/scripts/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
39 changes: 19 additions & 20 deletions services/functions/src/providers/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,25 @@ export async function fulfillRequestHandler(input: HandlerInput): Promise<void>

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)
}
Expand Down

0 comments on commit f38be56

Please sign in to comment.