Skip to content

Commit 1d4b436

Browse files
committed
chore: update execution to include fees
1 parent 73c6acc commit 1d4b436

File tree

5 files changed

+333
-297
lines changed

5 files changed

+333
-297
lines changed

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,23 @@
9393
]
9494
},
9595
"dependencies": {
96-
"@lifi/types": "10.0.0-beta.0",
96+
"@lifi/types": "10.0.0-beta.1",
9797
"@solana/wallet-adapter-base": "^0.9.23",
9898
"@solana/web3.js": "^1.87.6",
9999
"eth-rpc-errors": "^4.0.3",
100-
"viem": "^2.0.0-beta.15"
100+
"viem": "^2.0.0-beta.16"
101101
},
102102
"devDependencies": {
103103
"@commitlint/cli": "^18.4.3",
104104
"@commitlint/config-conventional": "^18.4.3",
105105
"@types/ws": "^8.5.10",
106-
"@typescript-eslint/eslint-plugin": "^6.14.0",
107-
"@typescript-eslint/parser": "^6.14.0",
106+
"@typescript-eslint/eslint-plugin": "^6.15.0",
107+
"@typescript-eslint/parser": "^6.15.0",
108108
"@vitest/coverage-v8": "^1.0.4",
109109
"bs58": "^5.0.0",
110-
"eslint": "^8.55.0",
110+
"eslint": "^8.56.0",
111111
"eslint-config-prettier": "^9.1.0",
112-
"eslint-plugin-jsdoc": "^46.9.0",
112+
"eslint-plugin-jsdoc": "^46.9.1",
113113
"eslint-plugin-prettier": "^5.0.1",
114114
"husky": "^8.0.3",
115115
"lint-staged": "^15.2.0",

src/core/EVM/EVMStepExecutor.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,11 +425,17 @@ export class EVMStepExecutor extends BaseStepExecutor {
425425
fromAmount: statusResponse.sending.amount,
426426
toAmount: statusReceiving?.amount,
427427
toToken: statusReceiving?.token,
428-
gasAmount: statusResponse.sending.gasAmount,
429-
gasAmountUSD: statusResponse.sending.gasAmountUSD,
430-
gasPrice: statusResponse.sending.gasPrice,
431-
gasToken: statusResponse.sending.gasToken,
432-
gasUsed: statusResponse.sending.gasUsed,
428+
gasCosts: [
429+
{
430+
amount: statusResponse.sending.gasAmount,
431+
amountUSD: statusResponse.sending.gasAmountUSD,
432+
token: statusResponse.sending.gasToken,
433+
estimate: statusResponse.sending.gasUsed,
434+
limit: statusResponse.sending.gasUsed,
435+
price: statusResponse.sending.gasPrice,
436+
type: 'SEND',
437+
},
438+
],
433439
})
434440
} catch (e: unknown) {
435441
const htmlMessage = await getTransactionFailedMessage(

src/core/Solana/SolanaStepExecutor.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,17 @@ export class SolanaStepExecutor extends BaseStepExecutor {
223223
fromAmount: statusResponse.sending.amount,
224224
toAmount: statusReceiving?.amount,
225225
toToken: statusReceiving?.token,
226-
gasAmount: statusResponse.sending.gasAmount,
227-
gasAmountUSD: statusResponse.sending.gasAmountUSD,
228-
gasPrice: statusResponse.sending.gasPrice,
229-
gasToken: statusResponse.sending.gasToken,
230-
gasUsed: statusResponse.sending.gasUsed,
226+
gasCosts: [
227+
{
228+
amount: statusResponse.sending.gasAmount,
229+
amountUSD: statusResponse.sending.gasAmountUSD,
230+
token: statusResponse.sending.gasToken,
231+
estimate: statusResponse.sending.gasUsed,
232+
limit: statusResponse.sending.gasUsed,
233+
price: statusResponse.sending.gasPrice,
234+
type: 'SEND',
235+
},
236+
],
231237
})
232238
} catch (e: unknown) {
233239
const htmlMessage = await getTransactionFailedMessage(

src/core/StatusManager.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,12 @@ import type {
44
Process,
55
ProcessType,
66
Status,
7-
Token,
87
} from '@lifi/types'
98
import { emptyExecution } from '@lifi/types'
109
import { executionState } from './executionState.js'
1110
import type { LiFiStepExtended } from './types.js'
1211
import { getProcessMessage } from './utils.js'
1312

14-
interface Receipt {
15-
fromAmount?: string
16-
toAmount?: string
17-
toToken?: Token
18-
gasPrice?: string
19-
gasUsed?: string
20-
gasToken?: Token
21-
gasAmount?: string
22-
gasAmountUSD?: string
23-
}
24-
2513
type OptionalParameters = Partial<
2614
Pick<
2715
Process,
@@ -74,22 +62,22 @@ export class StatusManager {
7462
* Updates the execution object of a Step.
7563
* @param step The current step in execution
7664
* @param status The status for the execution
77-
* @param receipt Optional. Information about received tokens
65+
* @param execution Optional. Information about received tokens
7866
* @returns The step with the updated execution object
7967
*/
8068
updateExecution(
8169
step: LiFiStepExtended,
8270
status: Status,
83-
receipt?: Receipt
71+
execution?: Partial<Execution>
8472
): LiFiStep {
8573
if (!step.execution) {
8674
throw Error("Can't update empty execution.")
8775
}
8876
step.execution.status = status
89-
if (receipt) {
77+
if (execution) {
9078
step.execution = {
9179
...step.execution,
92-
...receipt,
80+
...execution,
9381
}
9482
}
9583
this.updateStepInRoute(step)

0 commit comments

Comments
 (0)