@ravnexchange/react 0.1.7 → 0.1.9

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.
@@ -1,13 +1,17 @@
1
- import type { ExecuteParams, ExecutionDTO, RavnClient } from "@ravnexchange/sdk";
1
+ import type { ExecuteParams, RavnClient } from "@ravnexchange/sdk";
2
+ /** Whatever the installed SDK's execute() answers: from sdk 0.4.0, an AuthorizeDTO too. */
3
+ type Execution = Awaited<ReturnType<RavnClient["execute"]>>;
2
4
  export interface UseRavnExecuteResult {
3
- execute: (params: ExecuteParams) => Promise<ExecutionDTO>;
4
- data: ExecutionDTO | null;
5
+ execute: (params: ExecuteParams) => Promise<Execution>;
6
+ data: Execution | null;
5
7
  isLoading: boolean;
6
8
  error: unknown;
7
9
  }
8
10
  /**
9
11
  * Thin state wrapper around client.execute(). Deliberately does NOT sign or send anything:
10
- * this package has no opinion on wallets. Branch on the returned executionType and hand it to
12
+ * this package has no opinion on wallets. Branch on the returned executionType (an AUTHORIZE:
13
+ * have the wallet sign it, then execute again with its authorization and the signature) and hand it to
11
14
  * whatever signer the integrator already has (wagmi, ethers, a hardware wallet, ...).
12
15
  */
13
16
  export declare function useRavnExecute(client: RavnClient): UseRavnExecuteResult;
17
+ export {};
@@ -4,7 +4,8 @@ exports.useRavnExecute = useRavnExecute;
4
4
  const react_1 = require("react");
5
5
  /**
6
6
  * Thin state wrapper around client.execute(). Deliberately does NOT sign or send anything:
7
- * this package has no opinion on wallets. Branch on the returned executionType and hand it to
7
+ * this package has no opinion on wallets. Branch on the returned executionType (an AUTHORIZE:
8
+ * have the wallet sign it, then execute again with its authorization and the signature) and hand it to
8
9
  * whatever signer the integrator already has (wagmi, ethers, a hardware wallet, ...).
9
10
  */
10
11
  function useRavnExecute(client) {
@@ -10,7 +10,7 @@ const polling_1 = require("./polling");
10
10
  // Codes the API itself defines as request-shaped, not transient: retrying with the exact same
11
11
  // arguments can never turn one of these into success. Anything else (RATE_LIMITED, INTERNAL, a
12
12
  // network failure) is worth retrying through.
13
- const PERMANENT_ERROR_CODES = new Set(["UNAUTHORIZED", "INVALID_REQUEST", "QUOTE_INVALID", "NOT_FOUND"]);
13
+ const PERMANENT_ERROR_CODES = new Set(["UNAUTHORIZED", "FORBIDDEN", "INVALID_REQUEST", "QUOTE_INVALID", "NOT_FOUND"]);
14
14
  function isPermanentError(err) {
15
15
  return err instanceof sdk_1.RavnApiError && PERMANENT_ERROR_CODES.has(err.code);
16
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ravnexchange/react",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
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",