@hyperbridge/core 1.1.1 → 1.2.1

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.
@@ -134,14 +134,15 @@ abstract contract HyperApp is IApp {
134
134
  * If the payer is not this contract, transfers fee tokens from the payer to this contract first.
135
135
  * @param request The POST request to dispatch containing destination, body, timeout, and fee parameters
136
136
  * @param payer The address that will pay the fee token. If different from this contract, must have approved this contract to spend the fee amount
137
+ * @return commitment The unique identifier for the dispatched request
137
138
  */
138
- function dispatchWithFeeToken(DispatchPost memory request, address payer) internal {
139
+ function dispatchWithFeeToken(DispatchPost memory request, address payer) internal returns (bytes32) {
139
140
  address hostAddr = host();
140
141
  address feeToken = IDispatcher(hostAddr).feeToken();
141
142
  uint256 fee = quote(request);
142
143
  if (payer != address(this)) IERC20(feeToken).safeTransferFrom(payer, address(this), fee);
143
- IERC20(feeToken).safeApprove(hostAddr, fee);
144
- IDispatcher(hostAddr).dispatch(request);
144
+ IERC20(feeToken).forceApprove(hostAddr, fee);
145
+ return IDispatcher(hostAddr).dispatch(request);
145
146
  }
146
147
 
147
148
  /**
@@ -150,14 +151,15 @@ abstract contract HyperApp is IApp {
150
151
  * If the payer is not this contract, transfers fee tokens from the payer to this contract first.
151
152
  * @param response The POST response to dispatch containing the original request, response data, timeout, and fee parameters
152
153
  * @param payer The address that will pay the fee token. If different from this contract, must have approved this contract to spend the fee amount
154
+ * @return commitment The unique identifier for the dispatched response
153
155
  */
154
- function dispatchWithFeeToken(DispatchPostResponse memory response, address payer) internal {
156
+ function dispatchWithFeeToken(DispatchPostResponse memory response, address payer) internal returns (bytes32) {
155
157
  address hostAddr = host();
156
158
  address feeToken = IDispatcher(hostAddr).feeToken();
157
159
  uint256 fee = quote(response);
158
160
  if (payer != address(this)) IERC20(feeToken).safeTransferFrom(payer, address(this), fee);
159
- IERC20(feeToken).safeApprove(hostAddr, fee);
160
- IDispatcher(hostAddr).dispatch(response);
161
+ IERC20(feeToken).forceApprove(hostAddr, fee);
162
+ return IDispatcher(hostAddr).dispatch(response);
161
163
  }
162
164
 
163
165
  /**
@@ -166,14 +168,15 @@ abstract contract HyperApp is IApp {
166
168
  * If the payer is not this contract, transfers fee tokens from the payer to this contract first.
167
169
  * @param request The GET request to dispatch containing destination, keys, height, timeout, and fee parameters
168
170
  * @param payer The address that will pay the fee token. If different from this contract, must have approved this contract to spend the fee amount
171
+ * @return commitment The unique identifier for the dispatched request
169
172
  */
170
- function dispatchWithFeeToken(DispatchGet memory request, address payer) internal {
173
+ function dispatchWithFeeToken(DispatchGet memory request, address payer) internal returns (bytes32) {
171
174
  address hostAddr = host();
172
175
  address feeToken = IDispatcher(hostAddr).feeToken();
173
176
  uint256 fee = quote(request);
174
177
  if (payer != address(this)) IERC20(feeToken).safeTransferFrom(payer, address(this), fee);
175
- IERC20(feeToken).safeApprove(hostAddr, fee);
176
- IDispatcher(hostAddr).dispatch(request);
178
+ IERC20(feeToken).forceApprove(hostAddr, fee);
179
+ return IDispatcher(hostAddr).dispatch(request);
177
180
  }
178
181
 
179
182
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperbridge/core",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "description": "Hyperbridge Solidity SDK for dispatching & receiving cross-chain messages",
5
5
  "author": "Polytope Labs <hello@polytope.technology>",
6
6
  "license": "Apache-2.0",
@@ -30,8 +30,8 @@
30
30
  "bridges"
31
31
  ],
32
32
  "dependencies": {
33
+ "@openzeppelin/contracts": "^5.4.0",
33
34
  "@polytope-labs/solidity-merkle-trees": "^0.3.3",
34
- "openzeppelin-solidity": "^4.8.1",
35
35
  "prettier": "^3.3.3",
36
36
  "prettier-plugin-solidity": "^1.3.1"
37
37
  },