Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding originUserAddress for refunds [SLT-281] #3206

Merged
merged 3 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions packages/rest-api/src/controllers/bridgeController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ export const bridgeController = async (req, res) => {
return res.status(400).json({ errors: errors.array() })
}
try {
const { fromChain, toChain, amount, fromToken, toToken } = req.query
const {
fromChain,
toChain,
amount,
fromToken,
toToken,
originUserAddress,
} = req.query

const fromTokenInfo = tokenAddressToToken(fromChain.toString(), fromToken)
const toTokenInfo = tokenAddressToToken(toChain.toString(), toToken)
Expand All @@ -23,7 +30,10 @@ export const bridgeController = async (req, res) => {
Number(toChain),
fromToken,
toToken,
amountInWei
amountInWei,
originUserAddress
? { originUserAddress: originUserAddress.toString() }
: {}
)

const payload = resp.map((quote) => {
Expand Down
16 changes: 13 additions & 3 deletions packages/rest-api/src/controllers/bridgeTxInfoController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@ export const bridgeTxInfoController = async (req, res) => {
}

try {
const { fromChain, toChain, amount, destAddress, fromToken, toToken } =
req.query
const {
fromChain,
toChain,
amount,
destAddress,
fromToken,
toToken,
originUserAddress,
} = req.query

const fromTokenInfo = tokenAddressToToken(fromChain.toString(), fromToken)

Expand All @@ -23,7 +30,10 @@ export const bridgeTxInfoController = async (req, res) => {
Number(toChain),
fromToken,
toToken,
amountInWei
amountInWei,
originUserAddress
? { originUserAddress: originUserAddress.toString() }
: {}
)

const txInfoArray = await Promise.all(
Expand Down
6 changes: 6 additions & 0 deletions packages/rest-api/src/routes/bridgeRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ const router = express.Router()
* schema:
* type: number
* description: The amount of tokens to bridge
* - in: query
* name: originUserAddress
* required: false
* schema:
* type: string
* description: The address of the user on the origin chain
* responses:
* 200:
* description: Successful response
Expand Down
6 changes: 6 additions & 0 deletions packages/rest-api/src/routes/bridgeTxInfoRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ const router = express.Router()
* type: number
* description: The amount of tokens to bridge
* - in: query
* name: originUserAddress
* required: false
* schema:
* type: string
* description: The address of the user on the origin chain
* - in: query
abtestingalpha marked this conversation as resolved.
Show resolved Hide resolved
* name: destAddress
* required: true
* schema:
Expand Down
Loading