@0xsquid/sdk
Advanced tools
Comparing version 2.8.13 to 2.8.19
@@ -55,3 +55,3 @@ "use strict"; | ||
executeRoute({ data, params, }) { | ||
var _a, _b, _c; | ||
var _a, _b, _c, _d, _e; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -87,3 +87,9 @@ yield this.validateBalance({ data, params }); | ||
const gasPrice = (_c = route.transactionRequest) === null || _c === void 0 ? void 0 : _c.gasPrice; | ||
return signer.sign(signerAddress, msgs, (0, stargate_1.calculateFee)(Math.trunc(estimatedGas * gasMultiplier), stargate_1.GasPrice.fromString(gasPrice)), ""); | ||
let memo = ""; | ||
if ((_d = data.route.transactionRequest) === null || _d === void 0 ? void 0 : _d.requestId) { | ||
memo = JSON.stringify({ | ||
squidRequestId: (_e = data.route.transactionRequest) === null || _e === void 0 ? void 0 : _e.requestId, | ||
}); | ||
} | ||
return signer.sign(signerAddress, msgs, (0, stargate_1.calculateFee)(Math.trunc(estimatedGas * gasMultiplier), stargate_1.GasPrice.fromString(gasPrice)), memo); | ||
}); | ||
@@ -90,0 +96,0 @@ } |
@@ -193,3 +193,3 @@ "use strict"; | ||
populateRouteParams(tokensChains, params, signer) { | ||
const { fromChain, toChain, fromToken, toToken } = params; | ||
const { fromChain, toChain, fromToken, toToken, preHook } = params; | ||
const _fromChain = tokensChains.getChainData(fromChain); | ||
@@ -203,3 +203,6 @@ const _toChain = tokensChains.getChainData(toChain); | ||
if (!fromIsNative) { | ||
fromTokenContract = ethersAdapter.contract(_fromToken.address, erc20_json_1.default, signer || fromProvider); | ||
// case preHook, we need to check balance / allowance instead of fromToken | ||
// to avoid changing the entire approach, we only inject the address on the contract instance for on chain validation | ||
// need to be considered that fundToken is unknown and we probably do not support | ||
fromTokenContract = ethersAdapter.contract(preHook ? preHook.fundToken : _fromToken.address, erc20_json_1.default, signer || fromProvider); | ||
} | ||
@@ -206,0 +209,0 @@ return Object.assign(Object.assign({}, params), { fromChain: _fromChain, toChain: _toChain, fromToken: _fromToken, toToken: _toToken, fromTokenContract, |
{ | ||
"name": "@0xsquid/sdk", | ||
"version": "2.8.13", | ||
"version": "2.8.19", | ||
"description": "🛠 An SDK for building applications on top of 0xsquid", | ||
@@ -45,3 +45,3 @@ "repository": { | ||
"devDependencies": { | ||
"@0xsquid/squid-types": "0.1.78", | ||
"@0xsquid/squid-types": "0.1.80", | ||
"@babel/core": "^7.18.10", | ||
@@ -48,0 +48,0 @@ "@babel/preset-env": "^7.18.10", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
357859
5717