@rarible/biconomy-middleware
Advanced tools
Comparing version 0.12.109 to 0.13.0
@@ -21,23 +21,23 @@ "use strict"; | ||
return (0, json_rpc_engine_1.createAsyncMiddleware)(function (req, res, next) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var tx, metadata, limits, contract, interfaceHelper, dataToSign, _a, _b, send, signature, _c, r, s, v, _d, err_1; | ||
var _e, _f; | ||
return tslib_1.__generator(this, function (_g) { | ||
switch (_g.label) { | ||
var _a, tx, metadata, limits, contract, interfaceHelper, dataToSign, _b, _c, send, signature, _d, r, s, v, _e, err_1; | ||
var _f, _g; | ||
return tslib_1.__generator(this, function (_h) { | ||
switch (_h.label) { | ||
case 0: | ||
if (!(req.method === "eth_sendTransaction" && req.params)) return [3 /*break*/, 10]; | ||
tx = req.params[0]; | ||
_a = tslib_1.__read(req.params, 1), tx = _a[0]; | ||
if (!(isTransactionParams(tx) && hasNullValue(tx))) return [3 /*break*/, 10]; | ||
_g.label = 1; | ||
_h.label = 1; | ||
case 1: | ||
_g.trys.push([1, 9, , 10]); | ||
_h.trys.push([1, 9, , 10]); | ||
return [4 /*yield*/, registry.getMetadata(tx.to, tx.data)]; | ||
case 2: | ||
metadata = _g.sent(); | ||
metadata = _h.sent(); | ||
if (!metadata) return [3 /*break*/, 8]; | ||
return [4 /*yield*/, biconomyState]; | ||
case 3: | ||
_g.sent(); | ||
_h.sent(); | ||
return [4 /*yield*/, limitsRegistry.checkLimits(tx.from)]; | ||
case 4: | ||
limits = _g.sent(); | ||
limits = _h.sent(); | ||
if (!limits.allowed) { | ||
@@ -48,26 +48,26 @@ return [2 /*return*/, next()]; | ||
interfaceHelper = new ethers_1.ethers.utils.Interface(methods_abi_1.MetaContractAbi); | ||
_a = [tslib_1.__assign({}, metadata)]; | ||
_e = {}; | ||
_b = [tslib_1.__assign({}, metadata)]; | ||
_f = {}; | ||
_b = parseInt; | ||
_g = {}; | ||
_c = parseInt; | ||
return [4 /*yield*/, contract.getNonce(tx.from)]; | ||
case 5: | ||
dataToSign = tslib_1.__assign.apply(void 0, _a.concat([(_e.message = (_f.nonce = _b.apply(void 0, [_g.sent()]), | ||
_f.from = tx.from, | ||
_f.functionSignature = tx.data, | ||
_f), _e)])); | ||
dataToSign = tslib_1.__assign.apply(void 0, _b.concat([(_f.message = (_g.nonce = _c.apply(void 0, [_h.sent()]), | ||
_g.from = tx.from, | ||
_g.functionSignature = tx.data, | ||
_g), _f)])); | ||
send = (function (method, params) { return (0, provider_request_1.providerRequest)(provider, method, params); }); | ||
return [4 /*yield*/, (0, sign_typed_data_1.signTypedData)(send, tx.from, dataToSign)]; | ||
case 6: | ||
signature = _g.sent(); | ||
_c = getSignatureParameters(signature), r = _c.r, s = _c.s, v = _c.v; | ||
signature = _h.sent(); | ||
_d = getSignatureParameters(signature), r = _d.r, s = _d.s, v = _d.v; | ||
tx.data = interfaceHelper.encodeFunctionData("executeMetaTransaction", [tx.from, tx.data, r, s, v]); | ||
_d = res; | ||
_e = res; | ||
return [4 /*yield*/, (0, provider_request_1.providerRequest)(biconomy, "eth_sendTransaction", [tx])]; | ||
case 7: | ||
_d.result = _g.sent(); | ||
_e.result = _h.sent(); | ||
return [2 /*return*/]; | ||
case 8: return [3 /*break*/, 10]; | ||
case 9: | ||
err_1 = _g.sent(); | ||
err_1 = _h.sent(); | ||
res.error = err_1; | ||
@@ -77,3 +77,3 @@ return [3 /*break*/, 10]; | ||
case 11: | ||
_g.sent(); | ||
_h.sent(); | ||
return [2 /*return*/]; | ||
@@ -80,0 +80,0 @@ } |
{ | ||
"name": "@rarible/biconomy-middleware", | ||
"version": "0.12.109", | ||
"version": "0.13.0", | ||
"description": "Middleware for biconomy integration", | ||
@@ -26,6 +26,8 @@ "keywords": [ | ||
"eth-json-rpc-middleware": "^7.0.1", | ||
"eth-sig-util": "^3.0.1", | ||
"json-rpc-engine": "^6.1.0" | ||
}, | ||
"devDependencies": { | ||
"@rarible/ethereum-sdk-test-common": "^0.12.109", | ||
"@rarible/ethereum-sdk-test-common": "^0.13.0", | ||
"@types/eth-sig-util": "^2.1.1", | ||
"@types/jest": "^27.0.2", | ||
@@ -36,4 +38,4 @@ "form-data": "^4.0.0", | ||
"node-fetch": "^2.6.7", | ||
"typescript": "^4.7.4", | ||
"web3": "^1.5.0" | ||
"typescript": "^4.8.4", | ||
"web3": "^1.8.1" | ||
}, | ||
@@ -48,3 +50,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "7b40f06e1b750834c293f0f5f1b69901b819bcf4" | ||
"gitHead": "5f98e48c7e83b7eced7add3ac174c20877179308" | ||
} |
Sorry, the diff of this file is not supported yet
103254
7
9
+ Addedeth-sig-util@^3.0.1
+ Addedeth-sig-util@3.0.1(transitive)
+ Addedtweetnacl@1.0.3(transitive)
+ Addedtweetnacl-util@0.15.1(transitive)