diff --git a/docs/index.html b/docs/index.html index ac9f5550f8..b1657f236f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4167,7 +4167,7 @@

Sets the internal clock time to the given timestamp.

Warning: This will allow you to move backwards in time, which may cause -new blocks to appear to be mined before old blocks. This is will result in +new blocks to appear to be mined before old blocks. This will result in an invalid state.

diff --git a/docs/typedoc/api.json b/docs/typedoc/api.json index 2eaff9bb10..ed6127db34 100644 --- a/docs/typedoc/api.json +++ b/docs/typedoc/api.json @@ -7194,7 +7194,7 @@ "flags": {}, "comment": { "shortText": "Sets the internal clock time to the given timestamp.", - "text": "Warning: This will allow you to move *backwards* in time, which may cause\nnew blocks to appear to be mined before old blocks. This is will result in\nan invalid state.\n", + "text": "Warning: This will allow you to move *backwards* in time, which may cause\nnew blocks to appear to be mined before old blocks. This will result in\nan invalid state.\n", "returns": "The amount of *seconds* between the given timestamp and now.", "tags": [ { diff --git a/docs/typedoc/classes/default.html b/docs/typedoc/classes/default.html index 9855413092..87acfdccae 100644 --- a/docs/typedoc/classes/default.html +++ b/docs/typedoc/classes/default.html @@ -1,4 +1,4 @@ -default | @ganache/ethereum
Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • default

Implements

  • Api

Indexable

[index: string]: (...args: any) => Promise<any>
    • (...args: any): Promise<any>
    • Parameters

      • Rest ...args: any

      Returns Promise<any>

Index

Constructors

Properties

Methods

Constructors

constructor

  • new default(options: EthereumInternalOptions, wallet: default, blockchain: default): default

Properties

Private Readonly #blockchain

#blockchain: default

Private Readonly #filters

#filters: Map<string, Filter> = ...

Private Readonly #getId

#getId: () => Quantity = ...

Type declaration

    • (): Quantity
    • Returns Quantity

Private Readonly #options

#options: EthereumInternalOptions

Private Readonly #subscriptions

#subscriptions: Map<string, UnsubscribeFn> = ...

Private Readonly #wallet

#wallet: default

Methods

bzz_hive

  • bzz_hive(): Promise<any[]>

Returns default

Properties

Private Readonly #blockchain

#blockchain: default

Private Readonly #filters

#filters: Map<string, Filter> = ...

Private Readonly #getId

#getId: () => Quantity = ...

Type declaration

    • (): Quantity
    • Returns Quantity

Private Readonly #options

#options: EthereumInternalOptions

Private Readonly #subscriptions

#subscriptions: Map<string, UnsubscribeFn> = ...

Private Readonly #wallet

#wallet: default

Methods

bzz_hive

  • bzz_hive(): Promise<any[]>
  • Returns the kademlia table in a readable table format.

    example
    console.log(await provider.send("bzz_hive"));
     

    Returns Promise<any[]>

    Returns the kademlia table in a readable table format.

    -

bzz_info

  • bzz_info(): Promise<any[]>

bzz_info

  • bzz_info(): Promise<any[]>
  • Returns details about the swarm node.

    example
    console.log(await provider.send("bzz_info"));
     

    Returns Promise<any[]>

    Returns details about the swarm node.

    -

db_getHex

  • db_getHex(dbName: string, key: string): Promise<string>

db_getHex

  • db_getHex(dbName: string, key: string): Promise<string>
  • Returns binary data from the local database.

    example
    console.log(await provider.send("db_getHex", ["testDb", "testKey"] ));
     
    @@ -29,7 +29,7 @@
  • key: string

    Key name.

  • Returns Promise<string>

    The previously stored data.

    -

    db_getString

    • db_getString(dbName: string, key: string): Promise<string>

    db_getString

    • db_getString(dbName: string, key: string): Promise<string>
    • Returns string from the local database.

      example
      console.log(await provider.send("db_getString", ["testDb", "testKey"] ));
       
      @@ -38,7 +38,7 @@
  • key: string

    Key name.

  • Returns Promise<string>

    The previously stored string.

    -

    db_putHex

    • db_putHex(dbName: string, key: string, data: string): Promise<boolean>

    db_putHex

    • db_putHex(dbName: string, key: string, data: string): Promise<boolean>
    • Stores binary data in the local database.

      example
      console.log(await provider.send("db_putHex", ["testDb", "testKey", "0x0"] ));
       
      @@ -49,7 +49,7 @@
  • data: string

    Data to store.

  • Returns Promise<boolean>

    true if the value was stored, otherwise false.

    -

    db_putString

    db_putString

    Returns Promise<boolean>

    returns true if the value was stored, otherwise false.

    -

    debug_storageRangeAt

    debug_storageRangeAt

    Returns Promise<StorageRangeResult>

    Returns a storage object with the keys being keccak-256 hashes of the storage keys, and the values being the raw, unhashed key and value for that specific storage slot. Also returns a next key which is the keccak-256 hash of the next key in storage for continuous downloading.

    -

    debug_traceTransaction

    debug_traceTransaction

    -

    eth_accounts

    eth_accounts

    eth_blockNumber

    eth_blockNumber

    eth_call

    eth_call

    Returns Promise<Data>

    The return value of executed contract.

    -

    eth_chainId

    eth_chainId

    eth_coinbase

    eth_coinbase

    eth_estimateGas

    eth_estimateGas

    Returns Promise<Quantity>

    The amount of gas used.

    -

    eth_gasPrice

    eth_gasPrice

    eth_getBalance

    eth_getBalance

    Returns Promise<Quantity>

    Integer of the account balance in wei.

    -

    eth_getBlockByHash

    eth_getBlockByHash

    -

    eth_getBlockByNumber

    eth_getBlockByNumber

    -

    eth_getBlockTransactionCountByHash

    eth_getBlockTransactionCountByHash

    eth_getBlockTransactionCountByNumber

    eth_getBlockTransactionCountByNumber

    eth_getCode

    eth_getCode

    Returns Promise<Data>

    The code from the given address.

    -

    eth_getCompilers

    eth_getCompilers

    eth_getFilterChanges

    eth_getFilterChanges

    -

    eth_getFilterLogs

    eth_getFilterLogs

    eth_getLogs

    eth_getLogs

    eth_getStorageAt

    eth_getStorageAt

    Returns Promise<Data>

    The value in storage at the requested position.

    -

    eth_getTransactionByBlockHashAndIndex

    eth_getTransactionByBlockHashAndIndex

    -

    eth_getTransactionByBlockNumberAndIndex

    eth_getTransactionByBlockNumberAndIndex

    -

    eth_getTransactionByHash

    eth_getTransactionByHash

    -

    eth_getTransactionCount

    eth_getTransactionCount

    Returns Promise<Quantity>

    Number of transactions sent from this address.

    -

    eth_getTransactionReceipt

    eth_getTransactionReceipt

    eth_getUncleByBlockHashAndIndex

    • eth_getUncleByBlockHashAndIndex(hash: string, index: string): Promise<{ baseFeePerGas?: Quantity; difficulty: Quantity; extraData: Data; gasLimit: Quantity; gasUsed: Quantity; hash: Data; logsBloom: Data; miner: Data; mixHash: Data; nonce: Data; number: Quantity; parentHash: Data; receiptsRoot: Data; sha3Uncles: Data; size: Quantity; stateRoot: Data; timestamp: Quantity; totalDifficulty: Quantity; transactions: (Data | LegacyTransactionJSON | EIP2930AccessListTransactionJSON | EIP1559FeeMarketTransactionJSON)[]; transactionsRoot: Data; uncles: string[] }>

    eth_getUncleByBlockHashAndIndex

    • eth_getUncleByBlockHashAndIndex(hash: string, index: string): Promise<{ baseFeePerGas?: Quantity; difficulty: Quantity; extraData: Data; gasLimit: Quantity; gasUsed: Quantity; hash: Data; logsBloom: Data; miner: Data; mixHash: Data; nonce: Data; number: Quantity; parentHash: Data; receiptsRoot: Data; sha3Uncles: Data; size: Quantity; stateRoot: Data; timestamp: Quantity; totalDifficulty: Quantity; transactions: (Data | LegacyTransactionJSON | EIP2930AccessListTransactionJSON | EIP1559FeeMarketTransactionJSON)[]; transactionsRoot: Data; uncles: string[] }>
    • Returns information about a uncle of a block by hash and uncle index position.

      example
      const blockHash = await provider.send("eth_getBlockByNumber", ["latest"] );
      const block = await provider.send("eth_getUncleByBlockHashAndIndex", [blockHash, "0x0"] );
      console.log(block);
      @@ -464,7 +464,7 @@
    • transactions: Array - Array of transaction objects or 32 Bytes transaction hashes depending on the last parameter.
    • uncles: Array - Array of uncle hashes.
    -

    eth_getUncleByBlockNumberAndIndex

    • eth_getUncleByBlockNumberAndIndex(blockNumber: string, uncleIndex: string): Promise<{ baseFeePerGas?: Quantity; difficulty: Quantity; extraData: Data; gasLimit: Quantity; gasUsed: Quantity; hash: Data; logsBloom: Data; miner: Data; mixHash: Data; nonce: Data; number: Quantity; parentHash: Data; receiptsRoot: Data; sha3Uncles: Data; size: Quantity; stateRoot: Data; timestamp: Quantity; totalDifficulty: Quantity; transactions: (Data | LegacyTransactionJSON | EIP2930AccessListTransactionJSON | EIP1559FeeMarketTransactionJSON)[]; transactionsRoot: Data; uncles: string[] }>

    eth_getUncleByBlockNumberAndIndex

    • eth_getUncleByBlockNumberAndIndex(blockNumber: string, uncleIndex: string): Promise<{ baseFeePerGas?: Quantity; difficulty: Quantity; extraData: Data; gasLimit: Quantity; gasUsed: Quantity; hash: Data; logsBloom: Data; miner: Data; mixHash: Data; nonce: Data; number: Quantity; parentHash: Data; receiptsRoot: Data; sha3Uncles: Data; size: Quantity; stateRoot: Data; timestamp: Quantity; totalDifficulty: Quantity; transactions: (Data | LegacyTransactionJSON | EIP2930AccessListTransactionJSON | EIP1559FeeMarketTransactionJSON)[]; transactionsRoot: Data; uncles: string[] }>
    • Returns information about a uncle of a block by hash and uncle index position.

      example
      const block = await provider.send("eth_getUncleByBlockNumberAndIndex", ["latest", "0x0"] );
      console.log(block);
      @@ -495,21 +495,21 @@
    • transactions: Array - Array of transaction objects or 32 Bytes transaction hashes depending on the last parameter.
    • uncles: Array - Array of uncle hashes.
    -

    eth_getUncleCountByBlockHash

    • eth_getUncleCountByBlockHash(hash: string): Promise<Quantity>

    eth_getUncleCountByBlockHash

    • eth_getUncleCountByBlockHash(hash: string): Promise<Quantity>
    • Returns the number of uncles in a block from a block matching the given block hash.

      example
      const blockHash = await provider.send("eth_getBlockByNumber", ["latest"] );
      const uncleCount = await provider.send("eth_getUncleCountByBlockHash", [blockHash] );
      console.log(uncleCount);

      Parameters

      • hash: string

        Hash of a block.

      Returns Promise<Quantity>

      The number of uncles in a block.

      -

    eth_getUncleCountByBlockNumber

    • eth_getUncleCountByBlockNumber(blockNumber: string): Promise<Quantity>

    eth_getUncleCountByBlockNumber

    • eth_getUncleCountByBlockNumber(blockNumber: string): Promise<Quantity>
    • Returns the number of uncles in a block from a block matching the given block hash.

      example
      const uncleCount = await provider.send("eth_getUncleCountByBlockNumber", ["latest"] );
      console.log(uncleCount);

      Parameters

      • blockNumber: string

        A block number, or the string "earliest", "latest" or "pending".

      Returns Promise<Quantity>

      The number of uncles in a block.

      -

    eth_getWork

    • eth_getWork(filterId: string): Promise<[] | [string, string, string]>

    eth_getWork

    • eth_getWork(filterId: string): Promise<[] | [string, string, string]>
    • Returns: An Array with the following elements 1: DATA, 32 Bytes - current block header pow-hash 2: DATA, 32 Bytes - the seed hash used for the DAG. @@ -519,28 +519,28 @@

      Parameters

      • filterId: string

        A filter id.

      Returns Promise<[] | [string, string, string]>

      The hash of the current block, the seedHash, and the boundary condition to be met ("target").

      -

    eth_hashrate

    • eth_hashrate(): Promise<Quantity>

    eth_hashrate

    • eth_hashrate(): Promise<Quantity>
    • Returns the number of hashes per second that the node is mining with.

      example
      const hashrate = await provider.request({ method: "eth_hashrate", params: [] });
      console.log(hashrate);

      Returns Promise<Quantity>

      Number of hashes per second.

      -

    eth_maxPriorityFeePerGas

    • eth_maxPriorityFeePerGas(): Promise<Quantity>

    eth_maxPriorityFeePerGas

    • eth_maxPriorityFeePerGas(): Promise<Quantity>
    • Returns a maxPriorityFeePerGas value suitable for quick transaction inclusion.

      example
      const suggestedTip = await provider.request({ method: "eth_maxPriorityFeePerGas", params: [] });
      console.log(suggestedTip);

      Returns Promise<Quantity>

      The maxPriorityFeePerGas in wei.

      -

    eth_mining

    • eth_mining(): Promise<boolean>

    eth_mining

    • eth_mining(): Promise<boolean>
    • Returns true if client is actively mining new blocks.

      example
      const isMining = await provider.request({ method: "eth_mining", params: [] });
      console.log(isMining);

      Returns Promise<boolean>

      returns true if the client is mining, otherwise false.

      -

    eth_newBlockFilter

    • eth_newBlockFilter(): Promise<Quantity>

    eth_newBlockFilter

    • eth_newBlockFilter(): Promise<Quantity>
    • Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call eth_getFilterChanges.

      example
      const filterId = await provider.request({ method: "eth_newBlockFilter", params: [] });
      console.log(filterId);

      Returns Promise<Quantity>

      A filter id.

      -

    eth_newFilter

    • eth_newFilter(filter?: RangeFilterArgs): Promise<Quantity>

    eth_newFilter

    • eth_newFilter(filter?: RangeFilterArgs): Promise<Quantity>
    • Creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call eth_getFilterChanges.

      @@ -579,25 +579,25 @@

      A note on specifying topic filters:

      Parameters

      • Optional filter: RangeFilterArgs

        The filter options as seen in source.

      Returns Promise<Quantity>

      A filter id.

      -

    eth_newPendingTransactionFilter

    • eth_newPendingTransactionFilter(): Promise<Quantity>

    eth_newPendingTransactionFilter

    • eth_newPendingTransactionFilter(): Promise<Quantity>
    • Creates a filter in the node, to notify when new pending transactions arrive. To check if the state has changed, call eth_getFilterChanges.

      example
      const filterId = await provider.request({ method: "eth_newPendingTransactionFilter", params: [] });
      console.log(filterId);

      Returns Promise<Quantity>

      A filter id.

      -

    eth_protocolVersion

    • eth_protocolVersion(): Promise<Data>

    eth_protocolVersion

    • eth_protocolVersion(): Promise<Data>
    • Returns the current ethereum protocol version.

      example
      const version = await provider.request({ method: "eth_protocolVersion", params: [] });
      console.log(version);

      Returns Promise<Data>

      The current ethereum protocol version.

      -

    eth_sendRawTransaction

    • eth_sendRawTransaction(transaction: string): Promise<Data>

    eth_sendRawTransaction

    • eth_sendRawTransaction(transaction: string): Promise<Data>
    • Creates new message call transaction or a contract creation for signed transactions.

      example
      const [from, to] = await provider.request({ method: "eth_accounts", params: [] });
      const signedTx = await provider.request({ method: "eth_signTransaction", params: [{ from, to, gas: "0x5b8d80" }] });
      const txHash = await provider.send("eth_sendRawTransaction", [signedTx] );
      console.log(txHash);

      Parameters

      • transaction: string

        The signed transaction data.

      Returns Promise<Data>

      The transaction hash.

      -

    eth_sendTransaction

    • eth_sendTransaction(transaction: TypedRpcTransaction): Promise<Data>

    eth_sendTransaction

    • eth_sendTransaction(transaction: TypedRpcTransaction): Promise<Data>
    • Creates new message call transaction or a contract creation, if the data field contains code.

      Transaction call object:

        @@ -613,7 +613,7 @@

        A note on specifying topic filters:

      Parameters

      • transaction: TypedRpcTransaction

        The transaction call object as seen in source.

      Returns Promise<Data>

      The transaction hash.

      -

    eth_sign

    • eth_sign(address: string, message: string): Promise<string>

    eth_sign

    • eth_sign(address: string, message: string): Promise<string>
    • The sign method calculates an Ethereum specific signature with: sign(keccak256("\x19Ethereum Signed Message:\n" + message.length + message))).

      By adding a prefix to the message makes the calculated signature @@ -632,7 +632,7 @@

      A note on specifying topic filters:

      in big-endian format. Bytes 0...64 contain the r parameter, bytes 64...128 the s parameter, and the last byte the v parameter. Note that the v parameter includes the chain id as specified in EIP-155.

      -

    eth_signTransaction

    • eth_signTransaction(transaction: TypedRpcTransaction): Promise<string>

    eth_signTransaction

    • eth_signTransaction(transaction: TypedRpcTransaction): Promise<string>
    • Signs a transaction that can be submitted to the network at a later time using eth_sendRawTransaction.

      Transaction call object:

        @@ -648,7 +648,7 @@

        A note on specifying topic filters:

      Parameters

      • transaction: TypedRpcTransaction

        The transaction call object as seen in source.

      Returns Promise<string>

      The raw, signed transaction.

      -

    eth_signTypedData

    • eth_signTypedData(address: string, typedData: TypedMessage<MessageTypes>): Promise<string>

    eth_signTypedData

    • eth_signTypedData(address: string, typedData: TypedMessage<MessageTypes>): Promise<string>
    • Identical to eth_signTypedData_v4.

      eip

      712

      example
      const [account] = await provider.request({ method: "eth_accounts", params: [] });
      const typedData = {
      types: {
      EIP712Domain: [
      { name: 'name', type: 'string' },
      { name: 'version', type: 'string' },
      { name: 'chainId', type: 'uint256' },
      { name: 'verifyingContract', type: 'address' },
      ],
      Person: [
      { name: 'name', type: 'string' },
      { name: 'wallet', type: 'address' }
      ],
      Mail: [
      { name: 'from', type: 'Person' },
      { name: 'to', type: 'Person' },
      { name: 'contents', type: 'string' }
      ],
      },
      primaryType: 'Mail',
      domain: {
      name: 'Ether Mail',
      version: '1',
      chainId: 1,
      verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
      },
      message: {
      from: {
      name: 'Cow',
      wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
      },
      to: {
      name: 'Bob',
      wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
      },
      contents: 'Hello, Bob!',
      },
      };
      const signature = await provider.request({ method: "eth_signTypedData", params: [account, typedData] });
      console.log(signature); @@ -663,7 +663,7 @@

      A note on specifying topic filters:

      in big-endian format. Bytes 0...64 contain the r parameter, bytes 64...128 the s parameter, and the last byte the v parameter. Note that the v parameter includes the chain id as specified in EIP-155.

      -

    eth_signTypedData_v4

    • eth_signTypedData_v4(address: string, typedData: TypedMessage<MessageTypes>): Promise<string>

    eth_signTypedData_v4

    • eth_signTypedData_v4(address: string, typedData: TypedMessage<MessageTypes>): Promise<string>
    • eip

      712

      example
      const [account] = await provider.request({ method: "eth_accounts", params: [] });
      const typedData = {
      types: {
      EIP712Domain: [
      { name: 'name', type: 'string' },
      { name: 'version', type: 'string' },
      { name: 'chainId', type: 'uint256' },
      { name: 'verifyingContract', type: 'address' },
      ],
      Person: [
      { name: 'name', type: 'string' },
      { name: 'wallet', type: 'address' }
      ],
      Mail: [
      { name: 'from', type: 'Person' },
      { name: 'to', type: 'Person' },
      { name: 'contents', type: 'string' }
      ],
      },
      primaryType: 'Mail',
      domain: {
      name: 'Ether Mail',
      version: '1',
      chainId: 1,
      verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
      },
      message: {
      from: {
      name: 'Cow',
      wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
      },
      to: {
      name: 'Bob',
      wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
      },
      contents: 'Hello, Bob!',
      },
      };
      const signature = await provider.request({ method: "eth_signTypedData_v4", params: [account, typedData] });
      console.log(signature);

      Parameters

      • address: string
        @@ -676,7 +676,7 @@

        A note on specifying topic filters:

        in big-endian format. Bytes 0...64 contain the r parameter, bytes 64...128 the s parameter, and the last byte the v parameter. Note that the v parameter includes the chain id as specified in EIP-155.

        -

    eth_submitHashrate

    • eth_submitHashrate(hashRate: string, clientID: string): Promise<boolean>

    eth_submitHashrate

    • eth_submitHashrate(hashRate: string, clientID: string): Promise<boolean>
    • Used for submitting mining hashrate.

      example
      const hashRate = "0x0000000000000000000000000000000000000000000000000000000000000001";
      const clientId = "0xb2222a74119abd18dbcb7d1f661c6578b7bbeb4984c50e66ed538347f606b971";
      const result = await provider.request({ method: "eth_submitHashrate", params: [hashRate, clientId] });
      console.log(result);
      @@ -685,7 +685,7 @@

      A note on specifying topic filters:

    • clientID: string

      A random hexadecimal(32 bytes) ID identifying the client.

    Returns Promise<boolean>

    true if submitting went through succesfully and false otherwise.

    -

    eth_submitWork

    • eth_submitWork(nonce: string, powHash: string, digest: string): Promise<boolean>

    eth_submitWork

    • eth_submitWork(nonce: string, powHash: string, digest: string): Promise<boolean>
    • Used for submitting a proof-of-work solution.

      example
      const nonce = "0xe0df4bd14ab39a71";
      const powHash = "0x0000000000000000000000000000000000000000000000000000000000000001";
      const digest = "0xb2222a74119abd18dbcb7d1f661c6578b7bbeb4984c50e66ed538347f606b971";
      const result = await provider.request({ method: "eth_submitWork", params: [nonce, powHash, digest] });
      console.log(result);
      @@ -696,7 +696,7 @@

      A note on specifying topic filters:

    • digest: string

      The mix digest (256 bits).

    Returns Promise<boolean>

    true if the provided solution is valid, otherwise false.

    -

    eth_subscribe

    • eth_subscribe(subscriptionName: SubscriptionName): PromiEvent<Quantity>
    • eth_subscribe(subscriptionName: "logs", options: BaseFilterArgs): PromiEvent<Quantity>

    eth_subscribe

    • eth_subscribe(subscriptionName: SubscriptionName): PromiEvent<Quantity>
    • eth_subscribe(subscriptionName: "logs", options: BaseFilterArgs): PromiEvent<Quantity>
    • Starts a subscription to a particular event. For every event that matches the subscription a JSON-RPC notification with event details and subscription ID will be sent to a client.

      @@ -705,7 +705,7 @@

      A note on specifying topic filters:

      Parameters

      • subscriptionName: SubscriptionName

        Name for the subscription.

      Returns PromiEvent<Quantity>

      A subscription id.

      -
    • +
    • Starts a subscription to a particular event. For every event that matches the subscription a JSON-RPC notification with event details and subscription ID will be sent to a client.

      @@ -721,7 +721,7 @@

      A note on specifying topic filters:

    • topics, only logs which match the specified topics

    Returns PromiEvent<Quantity>

    A subscription id.

    -

    eth_syncing

    • eth_syncing(): Promise<boolean>

    eth_syncing

    • eth_syncing(): Promise<boolean>
    • Returns an object containing data about the sync status or false when not syncing.

      example
      const result = await provider.request({ method: "eth_syncing", params: [] });
      console.log(result);
      @@ -732,7 +732,7 @@

      A note on specifying topic filters:

    • currentBlock: {bigint} The current block, same as eth_blockNumber.
    • highestBlock: {bigint} The estimated highest block.
    -

    eth_uninstallFilter

    • eth_uninstallFilter(filterId: string): Promise<boolean>

    eth_uninstallFilter

    • eth_uninstallFilter(filterId: string): Promise<boolean>
    • Uninstalls a filter with given id. Should always be called when watch is no longer needed.

      example
      const filterId = await provider.request({ method: "eth_newFilter", params: [] });
      const result = await provider.request({ method: "eth_uninstallFilter", params: [filterId] });
      console.log(result); @@ -741,7 +741,7 @@

      A note on specifying topic filters:

      The filter id.

    Returns Promise<boolean>

    true if the filter was successfully uninstalled, otherwise false.

    -

    eth_unsubscribe

    • eth_unsubscribe(subscriptionId: string): Promise<boolean>

    eth_unsubscribe

    • eth_unsubscribe(subscriptionId: string): Promise<boolean>
    • Cancel a subscription to a particular event. Returns a boolean indicating if the subscription was successfully cancelled.

      example
      const subscriptionId = await provider.request({ method: "eth_subscribe", params: ["newHeads"] });
      const result = await provider.request({ method: "eth_unsubscribe", params: [subscriptionId] });
      console.log(result); @@ -749,7 +749,7 @@

      A note on specifying topic filters:

      Parameters

      • subscriptionId: string

        The ID of the subscription to unsubscribe to.

      Returns Promise<boolean>

      true if subscription was cancelled successfully, otherwise false.

      -

    evm_addAccount

    • evm_addAccount(address: string, passphrase: string): Promise<boolean>

    evm_addAccount

    • evm_addAccount(address: string, passphrase: string): Promise<boolean>
    • Adds any arbitrary account to the personal namespace.

      Note: accounts already known to the personal namespace and accounts returned by eth_accounts cannot be re-added using this method.

      @@ -764,14 +764,14 @@

      A note on specifying topic filters:

      that require a password.

    Returns Promise<boolean>

    true if the account was successfully added. false if the account is already in the personal namespace.

    -

    evm_increaseTime

    • evm_increaseTime(seconds: string | number): Promise<number>

    evm_increaseTime

    • evm_increaseTime(seconds: string | number): Promise<number>
    • Jump forward in time by the given amount of time, in seconds.

      example
      const seconds = 10;
      const timeAdjustment = await provider.send("evm_increaseTime", [seconds] );
      console.log(timeAdjustment);

      Parameters

      • seconds: string | number

        Number of seconds to jump forward in time by. Must be greater than or equal to 0.

      Returns Promise<number>

      Returns the total time adjustment, in seconds.

      -

    evm_mine

    • evm_mine(timestamp: number): Promise<"0x0">
    • evm_mine(options: { blocks?: number; timestamp?: number }): Promise<"0x0">

    evm_mine

    • evm_mine(timestamp: number): Promise<"0x0">
    • evm_mine(options: { blocks?: number; timestamp?: number }): Promise<"0x0">
    • Force a single block to be mined.

      Mines a block independent of whether or not mining is started or stopped. Will mine an empty block if there are no available transactions to mine.

      @@ -784,7 +784,7 @@

      A note on specifying topic filters:

      number of blocks, regardless of any other blocks mined or reverted during it's operation. This behavior is subject to change!

    Returns Promise<"0x0">

    The string "0x0". May return additional meta-data in the future.

    -
  • Parameters

    • options: { blocks?: number; timestamp?: number }
      • Optional blocks?: number
      • Optional timestamp?: number

    Returns Promise<"0x0">

  • evm_removeAccount

    • evm_removeAccount(address: string, passphrase: string): Promise<boolean>
    • +
    • Parameters

      • options: { blocks?: number; timestamp?: number }
        • Optional blocks?: number
        • Optional timestamp?: number

      Returns Promise<"0x0">

    evm_removeAccount

    • evm_removeAccount(address: string, passphrase: string): Promise<boolean>
    • Removes an account from the personal namespace.

      Note: accounts not known to the personal namespace cannot be removed using this method.

      @@ -797,7 +797,7 @@

      A note on specifying topic filters:

      The passphrase used to decrypt the account's private key.

    Returns Promise<boolean>

    true if the account was successfully removed. false if the account was not in the personal namespace.

    -

    evm_revert

    • evm_revert(snapshotId: string): Promise<boolean>

    evm_revert

    • evm_revert(snapshotId: string): Promise<boolean>
    • Revert the state of the blockchain to a previous snapshot. Takes a single parameter, which is the snapshot id to revert to. This deletes the given snapshot, as well as any snapshots taken after (e.g.: reverting to id 0x1 @@ -807,7 +807,7 @@

      A note on specifying topic filters:

      Parameters

      • snapshotId: string

        The snapshot id to revert.

      Returns Promise<boolean>

      true if a snapshot was reverted, otherwise false.

      -

    evm_setAccountNonce

    • evm_setAccountNonce(address: string, nonce: string): Promise<boolean>

    evm_setAccountNonce

    • evm_setAccountNonce(address: string, nonce: string): Promise<boolean>
    • Sets the given account's nonce to the specified value. Mines a new block before returning.

      Warning: this will result in an invalid state tree.

      @@ -818,17 +818,17 @@

      A note on specifying topic filters:

    • nonce: string

      The nonce value to be set.

    Returns Promise<boolean>

    true if it worked, otherwise false.

    -

    evm_setTime

    • evm_setTime(time: string | number | Date): Promise<number>

    evm_setTime

    • evm_setTime(time: string | number | Date): Promise<number>
    • Sets the internal clock time to the given timestamp.

      Warning: This will allow you to move backwards in time, which may cause -new blocks to appear to be mined before old blocks. This is will result in +new blocks to appear to be mined before old blocks. This will result in an invalid state.

      example
      const currentDate = Date.now();
      setTimeout(async () => {
      const time = await provider.send("evm_setTime", [currentDate] );
      console.log(time); // should be about two seconds ago
      }, 1000);

      Parameters

      • time: string | number | Date

        JavaScript timestamp (millisecond precision).

      Returns Promise<number>

      The amount of seconds between the given timestamp and now.

      -

    evm_snapshot

    • evm_snapshot(): Promise<Quantity>

    evm_snapshot

    • evm_snapshot(): Promise<Quantity>
    • Snapshot the state of the blockchain at the current block. Takes no parameters. Returns the id of the snapshot that was created. A snapshot can only be reverted once. After a successful evm_revert, the same snapshot @@ -837,21 +837,21 @@

      A note on specifying topic filters:

      example
      const provider = ganache.provider();
      const [from, to] = await provider.send("eth_accounts");
      const startingBalance = BigInt(await provider.send("eth_getBalance", [from] ));

      // take a snapshot
      const snapshotId = await provider.send("evm_snapshot");

      // send value to another account (over-simplified example)
      await provider.send("eth_subscribe", ["newHeads"] );
      await provider.send("eth_sendTransaction", [{from, to, value: "0xffff"}] );
      await provider.once("message"); // Note: `await provider.once` is non-standard

      // ensure balance has updated
      const newBalance = await provider.send("eth_getBalance", [from] );
      assert(BigInt(newBalance) < startingBalance);

      // revert the snapshot
      const isReverted = await provider.send("evm_revert", [snapshotId] );
      assert(isReverted);

      // ensure balance has reverted
      const endingBalance = await provider.send("eth_getBalance", [from] );
      const isBalanceReverted = assert.strictEqual(BigInt(endingBalance), startingBalance);
      console.log({isBalanceReverted: isBalanceReverted});

      Returns Promise<Quantity>

      The hex-encoded identifier for this snapshot.

      -

    miner_setEtherbase

    • miner_setEtherbase(address: string): Promise<boolean>

    miner_setEtherbase

    • miner_setEtherbase(address: string): Promise<boolean>
    • Sets the etherbase, where mining rewards will go.

      example
      const [account] = await provider.request({ method: "eth_accounts", params: [] });
      console.log(await provider.send("miner_setEtherbase", [account] ));

      Parameters

      • address: string

        The address where the mining rewards will go.

      Returns Promise<boolean>

      true.

      -

    miner_setExtra

    • miner_setExtra(extra: string): Promise<boolean>

    miner_setExtra

    • miner_setExtra(extra: string): Promise<boolean>
    • Set the extraData block header field a miner can include.

      example
      console.log(await provider.send("miner_setExtra", ["0x0"] ));
       

      Parameters

      • extra: string

        The extraData to include.

      Returns Promise<boolean>

      If successfully set returns true, otherwise returns an error.

      -

    miner_setGasPrice

    • miner_setGasPrice(number: string): Promise<boolean>

    miner_setGasPrice

    • miner_setGasPrice(number: string): Promise<boolean>
    • Sets the default accepted gas price when mining transactions. Any transactions that don't specify a gas price will use this amount. Transactions that are below this limit are excluded from the mining process.

      @@ -860,7 +860,7 @@

      A note on specifying topic filters:

      Parameters

      • number: string

        Default accepted gas price.

      Returns Promise<boolean>

      true.

      -

    miner_start

    • miner_start(threads?: number): Promise<boolean>

    miner_start

    • miner_start(threads?: number): Promise<boolean>
    • Resume the CPU mining process with the given number of threads.

      Note: threads is ignored.

      example
      await provider.send("miner_stop");
      // check that eth_mining returns false
      console.log(await provider.send("eth_mining"));
      await provider.send("miner_start");
      // check that eth_mining returns true
      console.log(await provider.send("eth_mining")); @@ -868,28 +868,28 @@

      A note on specifying topic filters:

      Parameters

      • threads: number = 1

        Number of threads to resume the CPU mining process with.

      Returns Promise<boolean>

      true.

      -

    miner_stop

    • miner_stop(): Promise<boolean>

    miner_stop

    • miner_stop(): Promise<boolean>
    • Stop the CPU mining operation.

      example
      // check that eth_mining returns true
      console.log(await provider.send("eth_mining"));
      await provider.send("miner_stop");
      // check that eth_mining returns false
      console.log(await provider.send("eth_mining"));

      Returns Promise<boolean>

      true.

      -

    net_listening

    • net_listening(): Promise<boolean>

    net_listening

    • net_listening(): Promise<boolean>
    • Returns true if client is actively listening for network connections.

      example
      console.log(await provider.send("net_listening"));
       

      Returns Promise<boolean>

      true when listening, otherwise false.

      -

    net_peerCount

    • net_peerCount(): Promise<Quantity>

    net_peerCount

    • net_peerCount(): Promise<Quantity>
    • Returns number of peers currently connected to the client.

      example
      console.log(await provider.send("net_peerCount"));
       

      Returns Promise<Quantity>

      Number of connected peers.

      -

    net_version

    • net_version(): Promise<string>

    net_version

    • net_version(): Promise<string>
    • Returns the current network id.

      example
      console.log(await provider.send("net_version"));
       

      Returns Promise<string>

      The current network id. This value should NOT be JSON-RPC Quantity/Data encoded.

      -

    personal_importRawKey

    • personal_importRawKey(rawKey: string, passphrase: string): Promise<Address>

    personal_importRawKey

    • personal_importRawKey(rawKey: string, passphrase: string): Promise<Address>
    • Imports the given unencrypted private key (hex string) into the key store, encrypting it with the passphrase.

      example
      const rawKey = "0x0123456789012345678901234567890123456789012345678901234567890123";
      const passphrase = "passphrase";

      const address = await provider.send("personal_importRawKey",[rawKey, passphrase] );
      console.log(address);
      @@ -898,20 +898,20 @@

      A note on specifying topic filters:

    • passphrase: string

      The passphrase to encrypt with.

    Returns Promise<Address>

    Returns the address of the new account.

    -

    personal_listAccounts

    • personal_listAccounts(): Promise<string[]>

    personal_listAccounts

    • personal_listAccounts(): Promise<string[]>
    • Returns all the Ethereum account addresses of all keys that have been added.

      example
      console.log(await provider.send("personal_listAccounts"));
       

      Returns Promise<string[]>

      The Ethereum account addresses of all keys that have been added.

      -

    personal_lockAccount

    • personal_lockAccount(address: string): Promise<boolean>

    personal_lockAccount

    • personal_lockAccount(address: string): Promise<boolean>
    • Locks the account. The account can no longer be used to send transactions.

      example
      const [account] = await provider.send("personal_listAccounts");
      const isLocked = await provider.send("personal_lockAccount", [account] );
      console.log(isLocked);

      Parameters

      • address: string

        The account address to be locked.

      Returns Promise<boolean>

      Returns true if the account was locked, otherwise false.

      -

    personal_newAccount

    • personal_newAccount(passphrase: string): Promise<Address>

    personal_newAccount

    • personal_newAccount(passphrase: string): Promise<Address>
    • Generates a new account with private key. Returns the address of the new account.

      example
      const passphrase = "passphrase";
      const address = await provider.send("personal_newAccount", [passphrase] );
      console.log(address); @@ -919,7 +919,7 @@

      A note on specifying topic filters:

      Parameters

      • passphrase: string

        The passphrase to encrypt the private key with.

      Returns Promise<Address>

      The new account's address.

      -

    personal_sendTransaction

    • personal_sendTransaction(transaction: TypedRpcTransaction, passphrase: string): Promise<Data>

    personal_sendTransaction

    • personal_sendTransaction(transaction: TypedRpcTransaction, passphrase: string): Promise<Data>
    • Validate the given passphrase and submit transaction.

      The transaction is the same argument as for eth_sendTransaction and contains the from address. If the passphrase can be used to decrypt the @@ -940,7 +940,7 @@

      A note on specifying topic filters:

      Parameters

      • transaction: TypedRpcTransaction
      • passphrase: string

        The passphrase to decrpyt the private key belonging to tx.from.

      Returns Promise<Data>

      The transaction hash or if unsuccessful an error.

      -

    personal_signTransaction

    • personal_signTransaction(transaction: TypedRpcTransaction, passphrase: string): Promise<string>

    personal_signTransaction

    • personal_signTransaction(transaction: TypedRpcTransaction, passphrase: string): Promise<string>
    • Validates the given passphrase and signs a transaction that can be submitted to the network at a later time using eth_sendRawTransaction.

      The transaction is the same argument as for eth_signTransaction and @@ -961,7 +961,7 @@

      A note on specifying topic filters:

      Parameters

      • transaction: TypedRpcTransaction

        The transaction call object as seen in source.

      • passphrase: string

      Returns Promise<string>

      The raw, signed transaction.

      -

    personal_unlockAccount

    • personal_unlockAccount(address: string, passphrase: string, duration?: number): Promise<boolean>

    personal_unlockAccount

    • personal_unlockAccount(address: string, passphrase: string, duration?: number): Promise<boolean>
    • Unlocks the account for use.

      The unencrypted key will be held in memory until the unlock duration expires. The unlock duration defaults to 300 seconds. An explicit duration @@ -978,40 +978,40 @@

      A note on specifying topic filters:

      (default: 300) Duration in seconds how long the account should remain unlocked for. Set to 0 to disable automatic locking.

    Returns Promise<boolean>

    true if it worked. Throws an error or returns false if it did not.

    -

    rpc_modules

    • rpc_modules(): Promise<{ eth: "1.0"; evm: "1.0"; net: "1.0"; personal: "1.0"; rpc: "1.0"; web3: "1.0" }>

    rpc_modules

    • rpc_modules(): Promise<{ eth: "1.0"; evm: "1.0"; net: "1.0"; personal: "1.0"; rpc: "1.0"; web3: "1.0" }>
    • Returns object of RPC modules.

      example
      console.log(await provider.send("rpc_modules"));
       

      Returns Promise<{ eth: "1.0"; evm: "1.0"; net: "1.0"; personal: "1.0"; rpc: "1.0"; web3: "1.0" }>

      RPC modules.

      -

    shh_addToGroup

    • shh_addToGroup(address: string): Promise<boolean>

    shh_addToGroup

    • shh_addToGroup(address: string): Promise<boolean>
    • Adds a whisper identity to the group.

      example
      console.log(await provider.send("shh_addToGroup", ["0x0"] ));
       

      Parameters

      • address: string

        The identity address to add to a group.

      Returns Promise<boolean>

      true if the identity was successfully added to the group, otherwise false.

      -

    shh_getFilterChanges

    • shh_getFilterChanges(id: string): Promise<any[]>

    shh_getFilterChanges

    • shh_getFilterChanges(id: string): Promise<any[]>
    • Polling method for whisper filters. Returns new messages since the last call of this method.

      example
      console.log(await provider.send("shh_getFilterChanges", ["0x0"] ));
       

      Parameters

      • id: string

        The filter id. Ex: "0x7"

      Returns Promise<any[]>

    shh_getMessages

    • shh_getMessages(id: string): Promise<boolean>

    shh_getMessages

    • shh_getMessages(id: string): Promise<boolean>
    • Get all messages matching a filter. Unlike shh_getFilterChanges this returns all messages.

      example
      console.log(await provider.send("shh_getMessages", ["0x0"] ));
       

      Parameters

      • id: string

        The filter id. Ex: "0x7"

      Returns Promise<boolean>

      See: shh_getFilterChanges.

      -

    shh_hasIdentity

    • shh_hasIdentity(address: string): Promise<boolean>

    shh_hasIdentity

    • shh_hasIdentity(address: string): Promise<boolean>
    • Checks if the client hold the private keys for a given identity.

      example
      console.log(await provider.send("shh_hasIdentity", ["0x0"] ));
       

      Parameters

      • address: string

        The identity address to check.

      Returns Promise<boolean>

      Returns true if the client holds the private key for that identity, otherwise false.

      -

    shh_newFilter

    • shh_newFilter(to: string, topics: string[]): Promise<boolean>

    shh_newFilter

    • shh_newFilter(to: string, topics: string[]): Promise<boolean>
    • Creates filter to notify, when client receives whisper message matching the filter options.

      example
      console.log(await provider.send("shh_newFilter", ["0x0", []] ));
       
      @@ -1021,17 +1021,17 @@

      A note on specifying topic filters:

    • topics: string[]

      Array of topics which the incoming message's topics should match.

    Returns Promise<boolean>

    Returns true if the identity was successfully added to the group, otherwise false.

    -

    shh_newGroup

    • shh_newGroup(): Promise<string>

    shh_newGroup

    • shh_newGroup(): Promise<string>
    • Creates a new group.

      Returns Promise<string>

      The address of the new group.

      -

    shh_newIdentity

    • shh_newIdentity(): Promise<string>

    shh_newIdentity

    • shh_newIdentity(): Promise<string>
    • Creates new whisper identity in the client.

      example
      console.log(await provider.send("shh_newIdentity"));
       

      Returns Promise<string>

      • The address of the new identity.
      -

    shh_post

    • shh_post(postData: any): Promise<boolean>

    shh_post

    • shh_post(postData: any): Promise<boolean>
    • Creates a whisper message and injects it into the network for distribution.

      example
      console.log(await provider.send("shh_post", [{}] ));
       
      @@ -1040,7 +1040,7 @@

      A note on specifying topic filters:

    Returns Promise<boolean>

    Returns true if the message was sent, otherwise false.

    -

    shh_uninstallFilter

    • shh_uninstallFilter(id: string): Promise<boolean>

    shh_uninstallFilter

    • shh_uninstallFilter(id: string): Promise<boolean>
    • Uninstalls a filter with given id. Should always be called when watch is no longer needed. Additionally filters timeout when they aren't requested with shh_getFilterChanges for a period of time.

      example
      console.log(await provider.send("shh_uninstallFilter", ["0x0"] ));
      @@ -1048,17 +1048,17 @@ 

      A note on specifying topic filters:

      Parameters

      • id: string

        The filter id. Ex: "0x7"

      Returns Promise<boolean>

      true if the filter was successfully uninstalled, otherwise false.

      -

    shh_version

    • shh_version(): Promise<string>

    shh_version

    • shh_version(): Promise<string>
    • Returns the current whisper protocol version.

      example
      console.log(await provider.send("shh_version"));
       

      Returns Promise<string>

      The current whisper protocol version.

      -

    web3_clientVersion

    • web3_clientVersion(): Promise<string>

    web3_clientVersion

    • web3_clientVersion(): Promise<string>
    • Returns the current client version.

      example
      console.log(await provider.send("web3_clientVersion"));
       

      Returns Promise<string>

      The current client version.

      -

    web3_sha3

    • web3_sha3(data: string): Promise<Data>

    web3_sha3

    • web3_sha3(data: string): Promise<Data>
    • Returns Keccak-256 (not the standardized SHA3-256) of the given data.

      example
      const data = "hello trufflers";
      const sha3 = await provider.send("web3_sha3", [data] );
      console.log(sha3);
      diff --git a/src/chains/ethereum/ethereum/src/api.ts b/src/chains/ethereum/ethereum/src/api.ts index 0ba5c4f5fc..924056f573 100644 --- a/src/chains/ethereum/ethereum/src/api.ts +++ b/src/chains/ethereum/ethereum/src/api.ts @@ -406,7 +406,7 @@ export default class EthereumApi implements Api { * Sets the internal clock time to the given timestamp. * * Warning: This will allow you to move *backwards* in time, which may cause - * new blocks to appear to be mined before old blocks. This is will result in + * new blocks to appear to be mined before old blocks. This will result in * an invalid state. * * @param time - JavaScript timestamp (millisecond precision).