feat(@wallet): cbridge integration

This commit is contained in:
Anthony Laibe 2022-12-12 10:31:41 +01:00 committed by Anthony Laibe
parent a7a69e1320
commit 2e65796a06
3 changed files with 12 additions and 2 deletions

View File

@ -61,6 +61,7 @@ type TransactionBridgeDto* = object
chainID*: int
simpleTx*: TransactionDataDto
hopTx*: TransactionDataDto
cbridgeTx*: TransactionDataDto
proc `%`*(x: TransactionBridgeDto): JsonNode =
result = newJobject()
@ -68,3 +69,4 @@ proc `%`*(x: TransactionBridgeDto): JsonNode =
result["chainID"] = %x.chainID
result["simpleTx"] = %x.simpleTx
result["hopTx"] = %x.hopTx
result["cbridgeTx"] = %x.cbridgeTx

View File

@ -315,6 +315,7 @@ QtObject:
for route in routes:
var simpleTx = TransactionDataDto()
var hopTx = TransactionDataDto()
var cbridgeTx = TransactionDataDto()
var txData = TransactionDataDto()
var gasFees: string = ""
@ -333,7 +334,7 @@ QtObject:
var path = TransactionBridgeDto(bridgeName: route.bridgeName, chainID: route.fromNetwork.chainId)
if(route.bridgeName == "Simple"):
path.simpleTx = txData
else:
elif(route.bridgeName == "Hop"):
hopTx = txData
hopTx.chainID = route.toNetwork.chainId.some
hopTx.symbol = tokenSymbol.some
@ -341,6 +342,13 @@ QtObject:
hopTx.amount = route.amountIn.some
hopTx.bonderFee = route.bonderFees.some
path.hopTx = hopTx
else:
cbridgeTx = txData
cbridgeTx.chainID = route.toNetwork.chainId.some
cbridgeTx.symbol = tokenSymbol.some
cbridgeTx.recipient = parseAddress(to_addr).some
cbridgeTx.amount = route.amountIn.some
path.cbridgeTx = cbridgeTx
paths.add(path)

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit 9137257638bb5b9f6d7e336d0a2a24d65838a2ac
Subproject commit 99ff0a18b0c9017a2b3ece03fd829f6616e4e436