@hiero-ledger/sdk
Version:
142 lines (141 loc) • 4.42 kB
TypeScript
/**
* @typedef {import("../channel/Channel.js").default} Channel
* @typedef {import("../client/Client.js").default<*, *>} Client
*/
/**
* @typedef {object} FunctionParameters
* @property {ContractFunctionParameters} parameters
* @property {string} name
*/
/**
* A query that calls a function of a contract instance. It will consume the amount of gas
* specified, and return the result of the function call.
*
* This query will not update the state of the contract instance on the network, but will
* only retrieve information. To update the state, you must use ContractExecuteTransaction.
*
* @augments {Query<ContractFunctionResult>}
*/
export default class ContractCallQuery extends Query<ContractFunctionResult> {
/**
* @internal
* @param {HieroProto.proto.IQuery} query
* @returns {ContractCallQuery}
*/
static _fromProtobuf(query: HieroProto.proto.IQuery): ContractCallQuery;
/**
* @param {object} [props]
* @param {ContractId | string} [props.contractId]
* @param {number | Long} [props.gas]
* @param {FunctionParameters | Uint8Array} [props.functionParameters]
* @param {number | Long} [props.maxResultSize]
* @param {AccountId | string} [props.senderAccountId]
*/
constructor(props?: {
contractId?: string | ContractId | undefined;
gas?: number | Long | undefined;
functionParameters?: Uint8Array<ArrayBufferLike> | FunctionParameters | undefined;
maxResultSize?: number | Long | undefined;
senderAccountId?: string | AccountId | undefined;
});
/**
* @private
* @type {?ContractId}
*/
private _contractId;
/**
* @private
* @type {?Long}
*/
private _gas;
/**
* @private
* @type {?Uint8Array}
*/
private _functionParameters;
/**
* @private
* @type {?Long}
*/
private _maxResultSize;
/**
* @private
* @type {?AccountId}
*/
private _senderAccountId;
/**
* @returns {?ContractId}
*/
get contractId(): ContractId | null;
/**
* Set the contract ID for which the call is being requested.
*
* @param {ContractId | string} contractId
* @returns {ContractCallQuery}
*/
setContractId(contractId: ContractId | string): ContractCallQuery;
/**
* @returns {?Long}
*/
get gas(): Long | null;
/**
* @param {number | Long} gas
* @returns {ContractCallQuery}
*/
setGas(gas: number | Long): ContractCallQuery;
/**
* @returns {?AccountId}
*/
get senderAccountId(): AccountId | null;
/**
* @param {AccountId | string} senderAccountId
* @returns {ContractCallQuery}
*/
setSenderAccountId(senderAccountId: AccountId | string): ContractCallQuery;
/**
* @returns {?Uint8Array}
*/
get functionParameters(): Uint8Array | null;
/**
* @param {Uint8Array} params
* @returns {ContractCallQuery}
*/
setFunctionParameters(params: Uint8Array): ContractCallQuery;
/**
* @param {string} name
* @param {?ContractFunctionParameters} [params]
* @returns {ContractCallQuery}
*/
setFunction(name: string, params?: ContractFunctionParameters | null): ContractCallQuery;
/**
* @param {number | Long} size
* @returns {ContractCallQuery}
*/
setMaxResultSize(size: number | Long): ContractCallQuery;
/**
* @protected
* @override
* @param {HieroProto.proto.IResponse} response
* @returns {Promise<ContractFunctionResult>}
*/
protected override _mapResponse(response: HieroProto.proto.IResponse): Promise<ContractFunctionResult>;
/**
* @private
* @param {HieroProto.proto.IResponse} response
* @returns {ContractFunctionResult}
*/
private _mapResponseSync;
}
export type Channel = import("../channel/Channel.js").default;
export type Client = import("../client/Client.js").default<any, any>;
export type FunctionParameters = {
parameters: ContractFunctionParameters;
name: string;
};
import ContractFunctionResult from "./ContractFunctionResult.js";
import Query from "../query/Query.js";
import ContractId from "./ContractId.js";
import Long from "long";
import AccountId from "../account/AccountId.js";
import ContractFunctionParameters from "./ContractFunctionParameters.js";
import * as HieroProto from "@hashgraph/proto";