Socket
Socket
Sign inDemoInstall

@web3api/ethereum-plugin-js

Package Overview
Dependencies
97
Maintainers
2
Versions
83
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1-prealpha.71 to 0.0.1-prealpha.72

build/common/Connection.d.ts

58

build/index.d.ts

@@ -1,51 +0,11 @@

import { Query, Mutation } from "./w3";
import * as Types from "./w3";
import { Address, AccountIndex, EthereumSigner, EthereumProvider, Connection, ConnectionConfig, ConnectionConfigs } from "./Connection";
import { Client, Plugin, PluginPackageManifest, PluginFactory } from "@web3api/core-js";
export { Address, AccountIndex, EthereumSigner, EthereumProvider, ConnectionConfig, ConnectionConfigs, };
export interface EthereumConfig {
networks: ConnectionConfigs;
defaultNetwork?: string;
import * as Internal from "./w3-man";
import { EthereumConfig } from "./common/EthereumConfig";
import { PluginFactory } from "@web3api/core-js";
export { manifest, schema } from "./w3-man";
export interface EthereumPluginConfigs extends EthereumConfig, Record<string, unknown> {
}
export declare class EthereumPlugin extends Plugin {
private _connections;
private _defaultNetwork;
constructor(config: EthereumConfig);
static manifest(): PluginPackageManifest;
getModules(_client: Client): {
query: Query.Module;
mutation: Mutation.Module;
};
callContractMethod(input: Mutation.Input_callContractMethod): Promise<Types.TxResponse>;
callContractMethodAndWait(input: Mutation.Input_callContractMethodAndWait): Promise<Types.TxReceipt>;
sendTransaction(input: Mutation.Input_sendTransaction): Promise<Types.TxResponse>;
sendTransactionAndWait(input: Mutation.Input_sendTransactionAndWait): Promise<Types.TxReceipt>;
deployContract(input: Mutation.Input_deployContract): Promise<string>;
signMessage(input: Mutation.Input_signMessage): Promise<string>;
sendRPC(input: Mutation.Input_sendRPC): Promise<string>;
getNetwork(input: Query.Input_getNetwork): Promise<Types.Network>;
callContractView(input: Query.Input_callContractView): Promise<string>;
callContractStatic(input: Query.Input_callContractStatic): Promise<Types.StaticTxResult>;
getBalance(input: Query.Input_getBalance): Promise<string>;
encodeParams(input: Query.Input_encodeParams): string;
encodeFunction(input: Query.Input_encodeFunction): string;
solidityPack(input: Query.Input_solidityPack): string;
solidityKeccak256(input: Query.Input_solidityKeccak256): string;
soliditySha256(input: Query.Input_soliditySha256): string;
getSignerAddress(input: Query.Input_getSignerAddress): Promise<string>;
getSignerBalance(input: Query.Input_getSignerBalance): Promise<string>;
getSignerTransactionCount(input: Query.Input_getSignerTransactionCount): Promise<string>;
getGasPrice(input: Query.Input_getGasPrice): Promise<string>;
estimateTransactionGas(input: Query.Input_estimateTransactionGas): Promise<string>;
estimateContractCallGas(input: Query.Input_estimateContractCallGas): Promise<string>;
checkAddress(input: Query.Input_checkAddress): boolean;
toWei(input: Query.Input_toWei): string;
toEth(input: Query.Input_toEth): string;
waitForEvent(input: Query.Input_waitForEvent): Promise<Types.EventNotification>;
awaitTransaction(input: Query.Input_awaitTransaction): Promise<Types.TxReceipt>;
getConnection(connection?: Types.Connection | null): Promise<Connection>;
parseArgs(args?: string[] | null): unknown[];
private _callContractMethod;
export declare class EthereumPlugin extends Internal.EthereumPlugin {
constructor(config: EthereumPluginConfigs);
}
export declare const ethereumPlugin: PluginFactory<EthereumConfig>;
export declare const plugin: PluginFactory<EthereumConfig>;
export declare const ethereumPlugin: PluginFactory<EthereumPluginConfigs>;
export declare const plugin: PluginFactory<EthereumPluginConfigs>;
"use strict";
// TIP: All user-defined code lives in the module folders (./query, ./mutation)
var __extends = (this && this.__extends) || (function () {

@@ -34,597 +35,26 @@ var extendStatics = function (d, b) {

};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
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) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__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 };
}
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.plugin = exports.ethereumPlugin = exports.EthereumPlugin = void 0;
/* eslint-disable import/no-extraneous-dependencies */
var resolvers_1 = require("./resolvers");
var w3_1 = require("./w3");
var Connection_1 = require("./Connection");
var Mapping = __importStar(require("./mapping"));
var core_js_1 = require("@web3api/core-js");
var ethers_1 = require("ethers");
var utils_1 = require("ethers/lib/utils");
exports.plugin = exports.ethereumPlugin = exports.EthereumPlugin = exports.schema = exports.manifest = void 0;
var Internal = __importStar(require("./w3-man"));
var w3_man_1 = require("./w3-man");
Object.defineProperty(exports, "manifest", { enumerable: true, get: function () { return w3_man_1.manifest; } });
Object.defineProperty(exports, "schema", { enumerable: true, get: function () { return w3_man_1.schema; } });
var EthereumPlugin = /** @class */ (function (_super) {
__extends(EthereumPlugin, _super);
function EthereumPlugin(config) {
var _this = _super.call(this) || this;
_this._connections = Connection_1.Connection.fromConfigs(config.networks);
// Assign the default network (mainnet if not provided)
if (config.defaultNetwork) {
_this._defaultNetwork = config.defaultNetwork;
}
else {
_this._defaultNetwork = "mainnet";
}
// Create a connection for the default network if none exists
if (!_this._connections[_this._defaultNetwork]) {
_this._connections[_this._defaultNetwork] = Connection_1.Connection.fromNetwork(_this._defaultNetwork);
}
return _this;
return _super.call(this, {
query: config,
mutation: config,
}) || this;
}
EthereumPlugin.manifest = function () {
return w3_1.manifest;
};
EthereumPlugin.prototype.getModules = function (_client) {
return {
query: resolvers_1.query(this),
mutation: resolvers_1.mutation(this),
};
};
/// Mutation
EthereumPlugin.prototype.callContractMethod = function (input) {
return __awaiter(this, void 0, void 0, function () {
var res;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this._callContractMethod(input)];
case 1:
res = _a.sent();
return [2 /*return*/, Mapping.toTxResponse(res)];
}
});
});
};
EthereumPlugin.prototype.callContractMethodAndWait = function (input) {
return __awaiter(this, void 0, void 0, function () {
var response, res;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this._callContractMethod(input)];
case 1:
response = _a.sent();
return [4 /*yield*/, response.wait()];
case 2:
res = _a.sent();
return [2 /*return*/, Mapping.toTxReceipt(res)];
}
});
});
};
EthereumPlugin.prototype.sendTransaction = function (input) {
return __awaiter(this, void 0, void 0, function () {
var connection, signer, res;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _a.sent();
signer = connection.getSigner();
return [4 /*yield*/, signer.sendTransaction(Mapping.fromTxRequest(input.tx))];
case 2:
res = _a.sent();
return [2 /*return*/, Mapping.toTxResponse(res)];
}
});
});
};
EthereumPlugin.prototype.sendTransactionAndWait = function (input) {
return __awaiter(this, void 0, void 0, function () {
var connection, signer, response, receipt;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _a.sent();
signer = connection.getSigner();
return [4 /*yield*/, signer.sendTransaction(Mapping.fromTxRequest(input.tx))];
case 2:
response = _a.sent();
return [4 /*yield*/, response.wait()];
case 3:
receipt = _a.sent();
return [2 /*return*/, Mapping.toTxReceipt(receipt)];
}
});
});
};
EthereumPlugin.prototype.deployContract = function (input) {
return __awaiter(this, void 0, void 0, function () {
var connection, signer, factory, contract;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _a.sent();
signer = connection.getSigner();
factory = new ethers_1.ethers.ContractFactory(input.abi, input.bytecode, signer);
return [4 /*yield*/, factory.deploy.apply(factory, __spread(this.parseArgs(input.args)))];
case 2:
contract = _a.sent();
return [4 /*yield*/, contract.deployTransaction.wait()];
case 3:
_a.sent();
return [2 /*return*/, contract.address];
}
});
});
};
EthereumPlugin.prototype.signMessage = function (input) {
return __awaiter(this, void 0, void 0, function () {
var connection;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _a.sent();
return [4 /*yield*/, connection.getSigner().signMessage(input.message)];
case 2: return [2 /*return*/, _a.sent()];
}
});
});
};
EthereumPlugin.prototype.sendRPC = function (input) {
return __awaiter(this, void 0, void 0, function () {
var connection, provider, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _a.sent();
provider = connection.getProvider();
return [4 /*yield*/, provider.send(input.method, input.params)];
case 2:
response = _a.sent();
return [2 /*return*/, response.toString()];
}
});
});
};
/// Query
EthereumPlugin.prototype.getNetwork = function (input) {
return __awaiter(this, void 0, void 0, function () {
var connection, provider, network;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _a.sent();
provider = connection.getProvider();
return [4 /*yield*/, provider.getNetwork()];
case 2:
network = _a.sent();
return [2 /*return*/, {
name: network.name,
chainId: network.chainId.toString(),
ensAddress: network.ensAddress,
}];
}
});
});
};
EthereumPlugin.prototype.callContractView = function (input) {
return __awaiter(this, void 0, void 0, function () {
var connection, contract, funcs, res;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _a.sent();
contract = connection.getContract(input.address, [input.method], false);
funcs = Object.keys(contract.interface.functions);
return [4 /*yield*/, contract[funcs[0]].apply(contract, __spread(this.parseArgs(input.args)))];
case 2:
res = _a.sent();
return [2 /*return*/, res.toString()];
}
});
});
};
EthereumPlugin.prototype.callContractStatic = function (input) {
return __awaiter(this, void 0, void 0, function () {
var connection, contract, funcs, res, e_1;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _b.sent();
contract = connection.getContract(input.address, [input.method]);
funcs = Object.keys(contract.interface.functions);
_b.label = 2;
case 2:
_b.trys.push([2, 4, , 5]);
return [4 /*yield*/, (_a = contract.callStatic)[funcs[0]].apply(_a, __spread(this.parseArgs(input.args), [{
gasPrice: input.gasPrice
? ethers_1.ethers.BigNumber.from(input.gasPrice)
: undefined,
gasLimit: input.gasLimit
? ethers_1.ethers.BigNumber.from(input.gasLimit)
: undefined,
value: input.value ? ethers_1.ethers.BigNumber.from(input.value) : undefined,
}]))];
case 3:
res = _b.sent();
return [2 /*return*/, {
result: res.toString(),
error: false,
}];
case 4:
e_1 = _b.sent();
return [2 /*return*/, {
result: e_1.reason,
error: true,
}];
case 5: return [2 /*return*/];
}
});
});
};
EthereumPlugin.prototype.getBalance = function (input) {
return __awaiter(this, void 0, void 0, function () {
var connection;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _a.sent();
return [4 /*yield*/, connection
.getProvider()
.getBalance(input.address, input.blockTag || undefined)];
case 2: return [2 /*return*/, (_a.sent()).toString()];
}
});
});
};
EthereumPlugin.prototype.encodeParams = function (input) {
return utils_1.defaultAbiCoder.encode(input.types, this.parseArgs(input.values));
};
EthereumPlugin.prototype.encodeFunction = function (input) {
var functionInterface = ethers_1.ethers.Contract.getInterface([input.method]);
return functionInterface.encodeFunctionData(functionInterface.functions[Object.keys(functionInterface.functions)[0]], this.parseArgs(input.args));
};
EthereumPlugin.prototype.solidityPack = function (input) {
return ethers_1.ethers.utils.solidityPack(input.types, this.parseArgs(input.values));
};
EthereumPlugin.prototype.solidityKeccak256 = function (input) {
return ethers_1.ethers.utils.solidityKeccak256(input.types, this.parseArgs(input.values));
};
EthereumPlugin.prototype.soliditySha256 = function (input) {
return ethers_1.ethers.utils.soliditySha256(input.types, this.parseArgs(input.values));
};
EthereumPlugin.prototype.getSignerAddress = function (input) {
return __awaiter(this, void 0, void 0, function () {
var connection;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _a.sent();
return [4 /*yield*/, connection.getSigner().getAddress()];
case 2: return [2 /*return*/, _a.sent()];
}
});
});
};
EthereumPlugin.prototype.getSignerBalance = function (input) {
return __awaiter(this, void 0, void 0, function () {
var connection;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _a.sent();
return [4 /*yield*/, connection.getSigner().getBalance(input.blockTag || undefined)];
case 2: return [2 /*return*/, (_a.sent()).toString()];
}
});
});
};
EthereumPlugin.prototype.getSignerTransactionCount = function (input) {
return __awaiter(this, void 0, void 0, function () {
var connection;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _a.sent();
return [4 /*yield*/, connection
.getSigner()
.getTransactionCount(input.blockTag || undefined)];
case 2: return [2 /*return*/, (_a.sent()).toString()];
}
});
});
};
EthereumPlugin.prototype.getGasPrice = function (input) {
return __awaiter(this, void 0, void 0, function () {
var connection;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _a.sent();
return [4 /*yield*/, connection.getSigner().getGasPrice()];
case 2: return [2 /*return*/, (_a.sent()).toString()];
}
});
});
};
EthereumPlugin.prototype.estimateTransactionGas = function (input) {
return __awaiter(this, void 0, void 0, function () {
var connection;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _a.sent();
return [4 /*yield*/, connection.getSigner().estimateGas(Mapping.fromTxRequest(input.tx))];
case 2: return [2 /*return*/, (_a.sent()).toString()];
}
});
});
};
EthereumPlugin.prototype.estimateContractCallGas = function (input) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function () {
var connection, contract, funcs, gasPrice, gasLimit, value, gas;
var _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _e.sent();
contract = connection.getContract(input.address, [input.method]);
funcs = Object.keys(contract.interface.functions);
gasPrice = (_a = input.txOverrides) === null || _a === void 0 ? void 0 : _a.gasPrice;
gasLimit = (_b = input.txOverrides) === null || _b === void 0 ? void 0 : _b.gasLimit;
value = (_c = input.txOverrides) === null || _c === void 0 ? void 0 : _c.value;
return [4 /*yield*/, (_d = contract.estimateGas)[funcs[0]].apply(_d, __spread(this.parseArgs(input.args), [{
gasPrice: gasPrice ? ethers_1.ethers.BigNumber.from(gasPrice) : undefined,
gasLimit: gasLimit ? ethers_1.ethers.BigNumber.from(gasLimit) : undefined,
value: value ? ethers_1.ethers.BigNumber.from(value) : undefined,
}]))];
case 2:
gas = _e.sent();
return [2 /*return*/, gas.toString()];
}
});
});
};
EthereumPlugin.prototype.checkAddress = function (input) {
var address = input.address;
try {
// If the address is all upper-case, convert to lower case
if (address.indexOf("0X") > -1) {
address = address.toLowerCase();
}
var result = ethers_1.ethers.utils.getAddress(address);
if (!result) {
return false;
}
return true;
}
catch (error) {
return false;
}
};
EthereumPlugin.prototype.toWei = function (input) {
var weiAmount = ethers_1.ethers.utils.parseEther(input.eth);
return weiAmount.toString();
};
EthereumPlugin.prototype.toEth = function (input) {
var etherAmount = ethers_1.ethers.utils.formatEther(input.wei);
return etherAmount.toString();
};
EthereumPlugin.prototype.waitForEvent = function (input) {
return __awaiter(this, void 0, void 0, function () {
var connection, contract, events, filter;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _b.sent();
contract = connection.getContract(input.address, [input.event]);
events = Object.keys(contract.interface.events);
filter = (_a = contract.filters)[events[0]].apply(_a, __spread(this.parseArgs(input.args)));
return [2 /*return*/, Promise.race([
new Promise(function (resolve) {
contract.once(filter, function (data, address, log) {
resolve({
data: data,
address: address,
log: Mapping.toLog(log),
});
});
}),
new Promise(function (_, reject) {
setTimeout(function () {
reject("Waiting for event \"" + input.event + "\" on contract \"" + input.address + "\" timed out");
}, input.timeout || 60000);
}),
])];
}
});
});
};
EthereumPlugin.prototype.awaitTransaction = function (input) {
return __awaiter(this, void 0, void 0, function () {
var connection, provider, res;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _a.sent();
provider = connection.getProvider();
return [4 /*yield*/, provider.waitForTransaction(input.txHash, input.confirmations, input.timeout)];
case 2:
res = _a.sent();
return [2 /*return*/, Mapping.toTxReceipt(res)];
}
});
});
};
/// Utils
EthereumPlugin.prototype.getConnection = function (connection) {
return __awaiter(this, void 0, void 0, function () {
var networkNameOrChainId, node, result, networkStr, chainId, nodeConnection, nodeNetwork, establishedConnection;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!connection) {
return [2 /*return*/, this._connections[this._defaultNetwork]];
}
networkNameOrChainId = connection.networkNameOrChainId, node = connection.node;
// If a custom network is provided, either get an already
// established connection, or a create a new one
if (networkNameOrChainId) {
networkStr = networkNameOrChainId.toLowerCase();
if (this._connections[networkStr]) {
result = this._connections[networkStr];
}
else {
chainId = Number.parseInt(networkStr);
if (!isNaN(chainId)) {
result = Connection_1.Connection.fromNetwork(chainId);
}
else {
result = Connection_1.Connection.fromNetwork(networkStr);
}
}
}
else {
result = this._connections[this._defaultNetwork];
}
if (!node) return [3 /*break*/, 2];
nodeConnection = Connection_1.Connection.fromNode(node);
return [4 /*yield*/, nodeConnection.getProvider().getNetwork()];
case 1:
nodeNetwork = _a.sent();
establishedConnection = this._connections[nodeNetwork.chainId.toString()] ||
this._connections[nodeNetwork.name];
if (establishedConnection) {
try {
nodeConnection.setSigner(establishedConnection.getSigner());
}
catch (e) {
// It's okay if there isn't a signer available.
}
}
result = nodeConnection;
_a.label = 2;
case 2: return [2 /*return*/, result];
}
});
});
};
EthereumPlugin.prototype.parseArgs = function (args) {
if (!args) {
return [];
}
return args.map(function (arg) {
return (arg.startsWith("[") && arg.endsWith("]")) ||
(arg.startsWith("{") && arg.endsWith("}"))
? JSON.parse(arg)
: arg;
});
};
EthereumPlugin.prototype._callContractMethod = function (input) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function () {
var connection, contract, funcs, gasPrice, gasLimit, value;
return __generator(this, function (_d) {
switch (_d.label) {
case 0: return [4 /*yield*/, this.getConnection(input.connection)];
case 1:
connection = _d.sent();
contract = connection.getContract(input.address, [input.method]);
funcs = Object.keys(contract.interface.functions);
gasPrice = (_a = input.txOverrides) === null || _a === void 0 ? void 0 : _a.gasPrice;
gasLimit = (_b = input.txOverrides) === null || _b === void 0 ? void 0 : _b.gasLimit;
value = (_c = input.txOverrides) === null || _c === void 0 ? void 0 : _c.value;
return [4 /*yield*/, contract[funcs[0]].apply(contract, __spread(this.parseArgs(input.args), [{
gasPrice: gasPrice ? ethers_1.ethers.BigNumber.from(gasPrice) : undefined,
gasLimit: gasLimit ? ethers_1.ethers.BigNumber.from(gasLimit) : undefined,
value: value ? ethers_1.ethers.BigNumber.from(value) : undefined,
}]))];
case 2: return [2 /*return*/, _d.sent()];
}
});
});
};
return EthereumPlugin;
}(core_js_1.Plugin));
}(Internal.EthereumPlugin));
exports.EthereumPlugin = EthereumPlugin;
exports.ethereumPlugin = function (opts) {
return {
factory: function () { return new EthereumPlugin(opts); },
manifest: w3_1.manifest,
};
return Internal.ethereumPlugin({
query: opts,
mutation: opts,
});
};
exports.plugin = exports.ethereumPlugin;
//# sourceMappingURL=index.js.map
{
"format": "0.0.1-prealpha.1",
"format": "0.0.1-prealpha.2",
"language": "plugin/typescript",
"schema": "./schema.graphql"
"name": "Ethereum",
"modules": {
"query": {
"schema": "./src/query/schema.graphql",
"module": "./src/query/index.ts"
},
"mutation": {
"schema": "./src/mutation/schema.graphql",
"module": "./src/mutation/index.ts"
}
}
}
{
"name": "@web3api/ethereum-plugin-js",
"description": "Web3API Ethereum Javascript Plugin",
"version": "0.0.1-prealpha.71",
"version": "0.0.1-prealpha.72",
"license": "MIT",

@@ -12,7 +12,8 @@ "repository": {

"files": [
"build",
"schema.graphql"
"build"
],
"scripts": {
"build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json",
"build": "rimraf ./build ./**/w3 ./*/**/w3 && tsc --project tsconfig.build.json",
"build:migrate": "npx w3 plugin codegen",
"build:bak": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json",
"codegen": "node ../../../../dependencies/node_modules/@web3api/cli/bin/w3 plugin codegen",

@@ -27,3 +28,3 @@ "lint": "eslint --color -c ../../../../.eslintrc.js src/",

"@ethersproject/providers": "5.0.7",
"@web3api/core-js": "0.0.1-prealpha.71",
"@web3api/core-js": "0.0.1-prealpha.72",
"ethers": "5.0.7"

@@ -33,6 +34,6 @@ },

"@types/jest": "26.0.8",
"@web3api/client-js": "0.0.1-prealpha.71",
"@web3api/ens-plugin-js": "0.0.1-prealpha.71",
"@web3api/ipfs-plugin-js": "0.0.1-prealpha.71",
"@web3api/test-env-js": "0.0.1-prealpha.71",
"@web3api/client-js": "0.0.1-prealpha.72",
"@web3api/ens-plugin-js": "0.0.1-prealpha.72",
"@web3api/ipfs-plugin-js": "0.0.1-prealpha.72",
"@web3api/test-env-js": "0.0.1-prealpha.72",
"eth-ens-namehash": "2.0.8",

@@ -46,3 +47,3 @@ "jest": "26.6.3",

},
"gitHead": "daa694fd5d7e77c907307c38a40ca388ab23b5cc",
"gitHead": "5f7c91449b10e023aaa9f70981291001aae011cf",
"publishConfig": {

@@ -49,0 +50,0 @@ "access": "public"

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc