-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add confirming state to the Bridge (#151)
* Reduce the space between `value` and `symbol` * Add `selectMap` * Update progress title during deposit confirming state * Update progress status for withdraw confirming state * Allow mix casing in Progress title
- Loading branch information
1 parent
369cb39
commit b350cf7
Showing
8 changed files
with
87 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,16 @@ | ||
import { BRIDGE_RELAYER_URL } from "@/constants"; | ||
|
||
type RelayerStatus = "Successful" | "Failed" | "Confirming"; | ||
import { RelayerStatus } from "@/types"; | ||
|
||
// TODO: Needs test | ||
export default async function fetchDepositRelayerStatus( | ||
txHash: string | ||
): Promise<RelayerStatus> { | ||
const response = await fetch( | ||
const relayerResponse = await fetch( | ||
`${BRIDGE_RELAYER_URL}/transactions/${txHash}` | ||
).then((response) => { | ||
if (response.status !== 200) throw { code: `RELAYER_${response.status}` }; | ||
return response.json(); | ||
}); | ||
|
||
if (response.status === "Successful" || response.status === "Failed") | ||
return response.status; | ||
|
||
return "Confirming"; | ||
return relayerResponse.status; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* A utility that return value by key from a map | ||
* | ||
* @param {K} key | ||
* @param {Map<K, V>} map | ||
* @param {V} defaultValue | ||
* @return {V} | ||
*/ | ||
export default function selectMap<K, V>( | ||
key: K, | ||
map: Map<K, V>, | ||
defaultValue?: V | ||
): V { | ||
if (!map.has(key)) return defaultValue; | ||
return map.get(key); | ||
} |