How to use the @zilliqa-js/core.RPCMethod.GetSmartContractState function in @zilliqa-js/core

To help you get started, we’ve selected a few @zilliqa-js/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Zilliqa / Zilliqa-JavaScript-Library / packages / zilliqa-js-blockchain / src / chain.ts View on Github external
getSmartContractState(addr: string): Promise> {
    const address = validation.isBech32(addr) ? fromBech32Address(addr) : addr;
    return this.provider.send(
      RPCMethod.GetSmartContractState,
      address.replace('0x', '').toLowerCase(),
    );
  }
github Zilliqa / Zilliqa-JavaScript-Library / packages / zilliqa-js-contract / src / contract.ts View on Github external
async getState(): Promise {
    if (this.status !== ContractStatus.Deployed) {
      return Promise.resolve([]);
    }

    if (!this.address) {
      throw new Error('Cannot get state of uninitialised contract');
    }

    const response = await this.provider.send(
      RPCMethod.GetSmartContractState,
      this.address.replace('0x', '').toLowerCase(),
    );

    return response.result;
  }