@renegade-fi/renegade-sdk 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.
@@ -43,7 +43,6 @@ const walletClient = createWalletClient({
43
43
  });
44
44
 
45
45
  // Create the external match client
46
- console.log("API KEY", API_KEY);
47
46
  const client = ExternalMatchClient.newArbitrumSepoliaClient(API_KEY, API_SECRET);
48
47
 
49
48
  // Example order for USDC/WETH pair
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@renegade-fi/renegade-sdk",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "A TypeScript client for interacting with the Renegade Darkpool API",
5
5
  "module": "index.ts",
6
6
  "type": "module",
@@ -1,4 +1,4 @@
1
- import { bytesToHex, concatBytes, hexToBytes, numberToBytes } from "viem/utils";
1
+ import { bytesToHex, concatBytes, hexToBytes, numberToBytes, numberToHex } from "viem/utils";
2
2
  import { FixedPoint } from "./fixedPoint";
3
3
  import {
4
4
  type ApiExternalAssetTransfer,
@@ -12,6 +12,8 @@ import {
12
12
  const BASE_AMOUNT_OFFSET = 4;
13
13
  /** The length of the base amount in the calldata */
14
14
  const BASE_AMOUNT_LENGTH = 32;
15
+ /** The address used to represent the native asset */
16
+ const NATIVE_ASSET_ADDR = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
15
17
 
16
18
  /**
17
19
  * The response type for requesting a malleable quote on an external order
@@ -84,11 +86,15 @@ export class MalleableExternalMatchResponse {
84
86
 
85
87
  const newCalldataBytes = concatBytes([prefix, baseAmountBytes, suffix]);
86
88
  const newCalladata = bytesToHex(newCalldataBytes);
89
+ const value = this.isNativeEthSell() ? baseAmount : 0n;
90
+ const valueHex = numberToHex(value);
91
+
87
92
  const newMatchBundle = {
88
93
  ...this.match_bundle,
89
94
  settlement_tx: {
90
95
  ...this.match_bundle.settlement_tx,
91
96
  data: newCalladata,
97
+ value: valueHex,
92
98
  },
93
99
  };
94
100
 
@@ -135,6 +141,17 @@ export class MalleableExternalMatchResponse {
135
141
  return this.computeSendAmount(baseAmount);
136
142
  }
137
143
 
144
+ /**
145
+ * Return whether the trade is a native ETH sell
146
+ */
147
+ public isNativeEthSell(): boolean {
148
+ const matchRes = this.match_bundle.match_result;
149
+ const isSell = matchRes.direction === OrderSide.SELL;
150
+ const isBaseEth = matchRes.base_mint.toLowerCase() === NATIVE_ASSET_ADDR.toLowerCase();
151
+
152
+ return isBaseEth && isSell;
153
+ }
154
+
138
155
  /**
139
156
  * Check a base amount is in the valid range
140
157
  */
package/src/version.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * SDK version information
3
3
  * This file is automatically updated during the build process
4
- * Last updated: 2025-05-08T00:25:05Z
4
+ * Last updated: 2025-05-10T01:06:48Z
5
5
  */
6
6
 
7
- export const VERSION = '0.1.4';
7
+ export const VERSION = '0.1.5';