@ravnexchange/react 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/useRavnStatus.d.ts +4 -1
- package/dist/useRavnStatus.js +5 -3
- package/package.json +2 -2
package/dist/useRavnStatus.d.ts
CHANGED
|
@@ -6,11 +6,14 @@ export interface UseRavnStatusResult {
|
|
|
6
6
|
}
|
|
7
7
|
export declare function isPermanentError(err: unknown): boolean;
|
|
8
8
|
/**
|
|
9
|
-
* Polls
|
|
9
|
+
* Polls /v1/status until it reaches a terminal state (see isPollingTerminal: "unknown"
|
|
10
10
|
* counts as terminal, it means the venue has no live tracker and never will for this swap).
|
|
11
11
|
* Pass `params: null` to not poll at all (e.g. before execution has produced a ref).
|
|
12
|
+
* `txHash`: the fee payment a DEPOSIT's `fee.transaction` asked for (or a two-hop route's hop-1
|
|
13
|
+
* tx). Without it the swap's status still arrives, but its fee is never proven and nothing is owed.
|
|
12
14
|
*/
|
|
13
15
|
export declare function useRavnStatus(client: RavnClient, params: {
|
|
14
16
|
quoteToken: string;
|
|
15
17
|
ref: string;
|
|
18
|
+
txHash?: string;
|
|
16
19
|
} | null, intervalMs?: number): UseRavnStatusResult;
|
package/dist/useRavnStatus.js
CHANGED
|
@@ -13,9 +13,11 @@ function isPermanentError(err) {
|
|
|
13
13
|
return err instanceof sdk_1.RavnApiError && PERMANENT_ERROR_CODES.has(err.code);
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Polls
|
|
16
|
+
* Polls /v1/status until it reaches a terminal state (see isPollingTerminal: "unknown"
|
|
17
17
|
* counts as terminal, it means the venue has no live tracker and never will for this swap).
|
|
18
18
|
* Pass `params: null` to not poll at all (e.g. before execution has produced a ref).
|
|
19
|
+
* `txHash`: the fee payment a DEPOSIT's `fee.transaction` asked for (or a two-hop route's hop-1
|
|
20
|
+
* tx). Without it the swap's status still arrives, but its fee is never proven and nothing is owed.
|
|
19
21
|
*/
|
|
20
22
|
function useRavnStatus(client, params, intervalMs = 4000) {
|
|
21
23
|
const [status, setStatus] = (0, react_1.useState)(null);
|
|
@@ -31,7 +33,7 @@ function useRavnStatus(client, params, intervalMs = 4000) {
|
|
|
31
33
|
const poll = () => {
|
|
32
34
|
setIsLoading(true);
|
|
33
35
|
client
|
|
34
|
-
.getStatus(params.quoteToken, params.ref)
|
|
36
|
+
.getStatus(params.quoteToken, params.ref, params.txHash)
|
|
35
37
|
.then((s) => {
|
|
36
38
|
if (cancelled)
|
|
37
39
|
return;
|
|
@@ -64,6 +66,6 @@ function useRavnStatus(client, params, intervalMs = 4000) {
|
|
|
64
66
|
if (timer)
|
|
65
67
|
clearTimeout(timer);
|
|
66
68
|
};
|
|
67
|
-
}, [client, params?.quoteToken, params?.ref, intervalMs]);
|
|
69
|
+
}, [client, params?.quoteToken, params?.ref, params?.txHash, intervalMs]);
|
|
68
70
|
return { status, isLoading, error };
|
|
69
71
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ravnexchange/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "React hooks for @ravnexchange/sdk: quote/execute/status state management. Bring your own wallet.",
|
|
5
5
|
"keywords": ["ravn", "cross-chain", "swap", "swap-api", "dex-aggregator", "bitcoin", "native-btc", "solana", "evm", "crypto", "defi", "react", "react-hooks", "typescript"],
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"build": "tsc -p tsconfig.build.json"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@ravnexchange/sdk": "
|
|
17
|
+
"@ravnexchange/sdk": ">=0.1.13",
|
|
18
18
|
"react": ">=18"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|