Skip to content

Commit

Permalink
Fix internalTxHash chain id for signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromcunha committed May 15, 2024
1 parent 597371e commit 8e12ca9
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions packages/sdk/src/utils/executeSteps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export async function executeSteps(
[stepId: string]: {
gasLimit?: string
}
}
},
) {
const client = getClient()

Expand Down Expand Up @@ -102,7 +102,7 @@ export async function executeSteps(
}

incompleteStepItemIndex = step.items.findIndex(
(item) => item.status == 'incomplete'
(item) => item.status == 'incomplete',
)
if (incompleteStepItemIndex !== -1) {
incompleteStepIndex = i
Expand Down Expand Up @@ -132,7 +132,7 @@ export async function executeSteps(
if (!stepItems) {
client.log(
['Execute Steps: skipping step, no items in step'],
LogLevel.Verbose
LogLevel.Verbose,
)
return
}
Expand All @@ -143,12 +143,12 @@ export async function executeSteps(
if (!stepItem.data) {
client.log(
['Execute Steps: step item data is missing, begin polling'],
LogLevel.Verbose
LogLevel.Verbose,
)
json = (await pollUntilHasData(request, (json) => {
client.log(
['Execute Steps: step item data is missing, polling', json],
LogLevel.Verbose
LogLevel.Verbose,
)
const data = json as Execute
// An item is ready if:
Expand Down Expand Up @@ -182,7 +182,7 @@ export async function executeSteps(
}
client.log(
[`Execute Steps: Begin processing step items for: ${step.action}`],
LogLevel.Verbose
LogLevel.Verbose,
)

const promises = stepItems
Expand All @@ -204,7 +204,7 @@ export async function executeSteps(
[
'Execute Steps: Begin transaction step for, sending transaction',
],
LogLevel.Verbose
LogLevel.Verbose,
)

// if chainId is present in the tx data field then you should relay the tx on that chain
Expand All @@ -225,7 +225,7 @@ export async function executeSteps(
'Execute Steps: Transaction step, got transactions',
txHashes,
],
LogLevel.Verbose
LogLevel.Verbose,
)
stepItem.txHashes = txHashes
if (json) {
Expand All @@ -250,7 +250,7 @@ export async function executeSteps(
},
request,
undefined,
crossChainIntentChainId
crossChainIntentChainId,
)
} catch (e) {
throw e
Expand All @@ -265,12 +265,12 @@ export async function executeSteps(
const postData = stepData['post']
client.log(
['Execute Steps: Begin signature step'],
LogLevel.Verbose
LogLevel.Verbose,
)
if (signData) {
signature = await wallet.handleSignMessageStep(
stepItem as SignatureStepItem,
step
step,
)

if (signature) {
Expand All @@ -284,7 +284,7 @@ export async function executeSteps(
if (postData) {
client.log(['Execute Steps: Posting order'], LogLevel.Verbose)
const postOrderUrl = new URL(
`${request.baseURL}${postData.endpoint}`
`${request.baseURL}${postData.endpoint}`,
)
const headers = {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -325,7 +325,7 @@ export async function executeSteps(
`Execute Steps: New steps appended from ${postData.endpoint}`,
res.data.steps,
],
LogLevel.Verbose
LogLevel.Verbose,
)
break
}
Expand All @@ -352,7 +352,7 @@ export async function executeSteps(
`Execute Steps: Polling execute status to check if indexed`,
res,
],
LogLevel.Verbose
LogLevel.Verbose,
)
if (
res?.data?.status === 'success' &&
Expand All @@ -367,7 +367,7 @@ export async function executeSteps(
chainId:
res.data.destinationChainId ?? chain?.id,
}
}
},
)

if (res?.data?.inTxHashes) {
Expand All @@ -378,9 +378,9 @@ export async function executeSteps(
return {
txHash: hash,
chainId:
res.data.destinationChainId ?? chain?.id,
chain?.id ?? res.data.originChainId,
}
}
},
)
stepItem.internalTxHashes = chainInTxHashes
}
Expand All @@ -389,14 +389,14 @@ export async function executeSteps(
return true
} else if (res?.data?.status === 'failure') {
throw Error(
res?.data?.details || 'Transaction failed'
res?.data?.details || 'Transaction failed',
)
}
return false
},
maximumAttempts,
0,
pollingInterval
pollingInterval,
)
}

Expand Down Expand Up @@ -474,12 +474,12 @@ export async function executeSteps(
} catch (blockError) {
client.log(
['Execute Steps: Failed to get block number', blockError],
LogLevel.Error
LogLevel.Error,
)
}
client.log(
['Execute Steps: An error occurred', err, 'Block Number:', blockNumber],
LogLevel.Error
LogLevel.Error,
)

if (json) {
Expand Down

0 comments on commit 8e12ca9

Please sign in to comment.