New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

apollo-link-ethereum-mutations-ethersjs

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-link-ethereum-mutations-ethersjs - npm Package Compare versions

Comparing version 0.0.37 to 0.0.38

107

dist/bundle.umd.js

@@ -9,67 +9,2 @@ (function (global, factory) {

var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
function enableEthereum() {
return __awaiter(this, void 0, void 0, function () {
var error_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!(window && window.ethereum)) return [3 /*break*/, 5];
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, window.ethereum.enable()];
case 2:
_a.sent();
return [3 /*break*/, 4];
case 3:
error_1 = _a.sent();
if (error_1 !== 'User rejected provider access') {
console.error(error_1);
}
return [3 /*break*/, 4];
case 4: return [3 /*break*/, 6];
case 5:
console.warn('Could not find `window` or `window.ethereum` (Browser is not an Ethereum-powered browser?)');
_a.label = 6;
case 6: return [2 /*return*/];
}
});
});
}
var __makeTemplateObject = (undefined && undefined.__makeTemplateObject) || function (cooked, raw) {

@@ -107,3 +42,3 @@ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }

};
var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {

@@ -116,3 +51,3 @@ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }

};
var __generator$1 = (undefined && undefined.__generator) || function (thisArg, body) {
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;

@@ -150,6 +85,6 @@ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;

context) {
return __awaiter$1(this, void 0, void 0, function () {
return __awaiter(this, void 0, void 0, function () {
var provider, abiMapping, cache, address, contractName, contractAddress, method, args, gasLimit, network, networkId, signer, abi, contract, methodFxn, data, query, txId, newArgs, newTx, id_1, readTx_1, estimatedGasLimit, error_1, defaultGasLimit, transactionData, selectedGasLimit, unsignedTransaction, from, error_2;
var _a;
return __generator$1(this, function (_b) {
return __generator(this, function (_b) {
switch (_b.label) {

@@ -161,10 +96,7 @@ case 0:

case 1:
_b.trys.push([1, 9, , 10]);
_b.trys.push([1, 8, , 9]);
address = void 0;
contractName = variables.contractName, contractAddress = variables.contractAddress, method = variables.method, args = variables.args, gasLimit = variables.gasLimit;
return [4 /*yield*/, enableEthereum()];
return [4 /*yield*/, provider.getNetwork()];
case 2:
_b.sent();
return [4 /*yield*/, provider.getNetwork()];
case 3:
network = _b.sent();

@@ -234,14 +166,14 @@ networkId = network.chainId;

estimatedGasLimit = void 0;
_b.label = 4;
_b.label = 3;
case 3:
_b.trys.push([3, 5, , 6]);
return [4 /*yield*/, (_a = contract.estimate)[method].apply(_a, args)];
case 4:
_b.trys.push([4, 6, , 7]);
return [4 /*yield*/, (_a = contract.estimate)[method].apply(_a, args)];
estimatedGasLimit = _b.sent();
return [3 /*break*/, 6];
case 5:
estimatedGasLimit = _b.sent();
return [3 /*break*/, 7];
case 6:
error_1 = _b.sent();
console.error(error_1);
return [3 /*break*/, 7];
case 7:
return [3 /*break*/, 6];
case 6:
defaultGasLimit = ethers.ethers.utils.bigNumberify(1000000);

@@ -256,3 +188,3 @@ transactionData = contract.interface.functions[method].encode(args);

return [4 /*yield*/, signer.getAddress()];
case 8:
case 7:
from = _b.sent();

@@ -262,5 +194,5 @@ debug("ContractName: " + contractName + "\n\nContractAddress: " + address + "\n\nContractMethod: " + method + "\n\nContractArgs: " + args + "\n\n\nFrom: " + from + "\n\n\nwith gasLimit " + selectedGasLimit.toString() + ":\n\n", unsignedTransaction);

.then(function (hash) {
return __awaiter$1(this, void 0, void 0, function () {
return __awaiter(this, void 0, void 0, function () {
var transaction, data, receipt, data_1;
return __generator$1(this, function (_a) {
return __generator(this, function (_a) {
switch (_a.label) {

@@ -308,7 +240,7 @@ case 0:

return [2 /*return*/, newTx];
case 9:
case 8:
error_2 = _b.sent();
console.error('sendTransaction: ', variables, error_2);
throw error_2;
case 10: return [2 /*return*/];
case 9: return [2 /*return*/];
}

@@ -327,3 +259,2 @@ });

exports.enableEthereum = enableEthereum;
exports.sendTransaction = sendTransaction;

@@ -330,0 +261,0 @@ exports.sendTransactionWithOptions = sendTransactionWithOptions;

@@ -1,4 +0,3 @@

export * from './enableEthereum';
export * from './sendTransaction';
export * from './sendTransactionWithOptions';
export * from './gql/index';

@@ -1,2 +0,1 @@

export * from './enableEthereum';
export * from './sendTransaction';

@@ -3,0 +2,0 @@ export * from './sendTransactionWithOptions';

30

lib/sendTransaction.js

@@ -48,3 +48,2 @@ var __assign = (this && this.__assign) || function () {

import { ethers } from 'ethers';
import { enableEthereum } from './enableEthereum';
import { allTransactionsQuery, transactionFragment } from './gql/index';

@@ -67,10 +66,7 @@ var nextTxId = 1;

case 1:
_b.trys.push([1, 9, , 10]);
_b.trys.push([1, 8, , 9]);
address = void 0;
contractName = variables.contractName, contractAddress = variables.contractAddress, method = variables.method, args = variables.args, gasLimit = variables.gasLimit;
return [4 /*yield*/, enableEthereum()];
return [4 /*yield*/, provider.getNetwork()];
case 2:
_b.sent();
return [4 /*yield*/, provider.getNetwork()];
case 3:
network = _b.sent();

@@ -140,14 +136,14 @@ networkId = network.chainId;

estimatedGasLimit = void 0;
_b.label = 4;
_b.label = 3;
case 3:
_b.trys.push([3, 5, , 6]);
return [4 /*yield*/, (_a = contract.estimate)[method].apply(_a, args)];
case 4:
_b.trys.push([4, 6, , 7]);
return [4 /*yield*/, (_a = contract.estimate)[method].apply(_a, args)];
estimatedGasLimit = _b.sent();
return [3 /*break*/, 6];
case 5:
estimatedGasLimit = _b.sent();
return [3 /*break*/, 7];
case 6:
error_1 = _b.sent();
console.error(error_1);
return [3 /*break*/, 7];
case 7:
return [3 /*break*/, 6];
case 6:
defaultGasLimit = ethers.utils.bigNumberify(1000000);

@@ -162,3 +158,3 @@ transactionData = contract.interface.functions[method].encode(args);

return [4 /*yield*/, signer.getAddress()];
case 8:
case 7:
from = _b.sent();

@@ -213,7 +209,7 @@ debug("ContractName: " + contractName + "\n\nContractAddress: " + address + "\n\nContractMethod: " + method + "\n\nContractArgs: " + args + "\n\n\nFrom: " + from + "\n\n\nwith gasLimit " + selectedGasLimit.toString() + ":\n\n", unsignedTransaction);

return [2 /*return*/, newTx];
case 9:
case 8:
error_2 = _b.sent();
console.error('sendTransaction: ', variables, error_2);
throw error_2;
case 10: return [2 /*return*/];
case 9: return [2 /*return*/];
}

@@ -220,0 +216,0 @@ });

{
"name": "apollo-link-ethereum-mutations-ethersjs",
"version": "0.0.37",
"version": "0.0.38",
"main": "./dist/bundle.umd.js",

@@ -34,3 +34,3 @@ "modules": "./lib/index.js",

},
"gitHead": "3a92623cd9fcde9389df2885b86006d216ba3b60"
"gitHead": "4162130f150da7ab3750df97c7e1e88043f05c29"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc