@ethersproject/abi
Advanced tools
Comparing version 5.0.0-beta.138 to 5.0.0-beta.139
@@ -1,1 +0,1 @@ | ||
export declare const version = "abi/5.0.0-beta.138"; | ||
export declare const version = "abi/5.0.0-beta.139"; |
@@ -1,1 +0,1 @@ | ||
export const version = "abi/5.0.0-beta.138"; | ||
export const version = "abi/5.0.0-beta.139"; |
@@ -55,6 +55,9 @@ import { BigNumber, BigNumberish } from "@ethersproject/bignumber"; | ||
getEventTopic(eventFragment: EventFragment | string): string; | ||
_decodeParams(params: Array<ParamType>, data: BytesLike): Array<any>; | ||
_encodeParams(params: Array<ParamType>, values: Array<any>): string; | ||
encodeDeploy(values?: Array<any>): string; | ||
decodeFunctionData(functionFragment: FunctionFragment | string, data: BytesLike): Array<any>; | ||
encodeFunctionData(functionFragment: FunctionFragment | string, values?: Array<any>): string; | ||
decodeFunctionResult(functionFragment: FunctionFragment | string, data: BytesLike): Array<any>; | ||
encodeFunctionResult(functionFragment: FunctionFragment | string, values?: Array<any>): string; | ||
encodeFilterTopics(eventFragment: EventFragment, values: Array<any>): Array<string | Array<string>>; | ||
@@ -61,0 +64,0 @@ decodeEventLog(eventFragment: EventFragment | string, data: BytesLike, topics?: Array<string>): Array<any>; |
@@ -132,2 +132,5 @@ "use strict"; | ||
} | ||
_decodeParams(params, data) { | ||
return this._abiCoder.decode(params, data); | ||
} | ||
_encodeParams(params, values) { | ||
@@ -139,2 +142,12 @@ return this._abiCoder.encode(params, values); | ||
} | ||
decodeFunctionData(functionFragment, data) { | ||
if (typeof (functionFragment) === "string") { | ||
functionFragment = this.getFunction(functionFragment); | ||
} | ||
const bytes = arrayify(data); | ||
if (hexlify(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) { | ||
logger.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, "data", hexlify(bytes)); | ||
} | ||
return this._decodeParams(functionFragment.inputs, bytes.slice(4)); | ||
} | ||
encodeFunctionData(functionFragment, values) { | ||
@@ -177,2 +190,8 @@ if (typeof (functionFragment) === "string") { | ||
} | ||
encodeFunctionResult(functionFragment, values) { | ||
if (typeof (functionFragment) === "string") { | ||
functionFragment = this.getFunction(functionFragment); | ||
} | ||
return hexlify(this._abiCoder.encode(functionFragment.outputs, values || [])); | ||
} | ||
encodeFilterTopics(eventFragment, values) { | ||
@@ -179,0 +198,0 @@ if (typeof (eventFragment) === "string") { |
@@ -1,1 +0,1 @@ | ||
export declare const version = "abi/5.0.0-beta.138"; | ||
export declare const version = "abi/5.0.0-beta.139"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = "abi/5.0.0-beta.138"; | ||
exports.version = "abi/5.0.0-beta.139"; |
@@ -55,6 +55,9 @@ import { BigNumber, BigNumberish } from "@ethersproject/bignumber"; | ||
getEventTopic(eventFragment: EventFragment | string): string; | ||
_decodeParams(params: Array<ParamType>, data: BytesLike): Array<any>; | ||
_encodeParams(params: Array<ParamType>, values: Array<any>): string; | ||
encodeDeploy(values?: Array<any>): string; | ||
decodeFunctionData(functionFragment: FunctionFragment | string, data: BytesLike): Array<any>; | ||
encodeFunctionData(functionFragment: FunctionFragment | string, values?: Array<any>): string; | ||
decodeFunctionResult(functionFragment: FunctionFragment | string, data: BytesLike): Array<any>; | ||
encodeFunctionResult(functionFragment: FunctionFragment | string, values?: Array<any>): string; | ||
encodeFilterTopics(eventFragment: EventFragment, values: Array<any>): Array<string | Array<string>>; | ||
@@ -61,0 +64,0 @@ decodeEventLog(eventFragment: EventFragment | string, data: BytesLike, topics?: Array<string>): Array<any>; |
@@ -170,2 +170,5 @@ "use strict"; | ||
}; | ||
Interface.prototype._decodeParams = function (params, data) { | ||
return this._abiCoder.decode(params, data); | ||
}; | ||
Interface.prototype._encodeParams = function (params, values) { | ||
@@ -177,2 +180,12 @@ return this._abiCoder.encode(params, values); | ||
}; | ||
Interface.prototype.decodeFunctionData = function (functionFragment, data) { | ||
if (typeof (functionFragment) === "string") { | ||
functionFragment = this.getFunction(functionFragment); | ||
} | ||
var bytes = bytes_1.arrayify(data); | ||
if (bytes_1.hexlify(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) { | ||
logger.throwArgumentError("data signature does not match function " + functionFragment.name + ".", "data", bytes_1.hexlify(bytes)); | ||
} | ||
return this._decodeParams(functionFragment.inputs, bytes.slice(4)); | ||
}; | ||
Interface.prototype.encodeFunctionData = function (functionFragment, values) { | ||
@@ -215,2 +228,8 @@ if (typeof (functionFragment) === "string") { | ||
}; | ||
Interface.prototype.encodeFunctionResult = function (functionFragment, values) { | ||
if (typeof (functionFragment) === "string") { | ||
functionFragment = this.getFunction(functionFragment); | ||
} | ||
return bytes_1.hexlify(this._abiCoder.encode(functionFragment.outputs, values || [])); | ||
}; | ||
Interface.prototype.encodeFilterTopics = function (eventFragment, values) { | ||
@@ -217,0 +236,0 @@ var _this = this; |
{ | ||
"name": "@ethersproject/abi", | ||
"version": "5.0.0-beta.138", | ||
"version": "5.0.0-beta.139", | ||
"description": "Utilities and Classes for parsing, formatting and managing Ethereum ABIs.", | ||
@@ -36,3 +36,3 @@ "main": "./lib/index.js", | ||
"ethereum": "donations.ethers.eth", | ||
"tarballHash": "0x5e1963373faf7c7d4b96c86bdec37c60fd1f5d6eb5665e7c3840be2208b3a255" | ||
"tarballHash": "0x2ed1e7e7e83efe63222323ff3578c5860d0cb8f9c4ab067c0051c3140ae89c83" | ||
} |
Sorry, the diff of this file is not supported yet
285189
4891