Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calling getMessage() from submit topic message docs results in TypeError: not a function #1324

Closed
mgarbs opened this issue Nov 18, 2022 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@mgarbs
Copy link

mgarbs commented Nov 18, 2022

Description

Called getMessage() to get the message but a TypeError was thrown instead

Here are the docs submit-a-message#get-transaction-values

Steps to reproduce

  1. run this snippet
    console.log('Create submit message tx');
    const submitMsgTransaction = await new TopicMessageSubmitTransaction()
        .setTopicId(newTopicId)
        .setMessage('{"myNameIs": "json"}');

    
    const getMessage = submitMsgTransaction.getMessage(); // throws TypeError: submitMsgTransaction.getMessage is not a function

Additional context

image

Hedera network

testnet

Version

"@hashgraph/sdk": "^2.18.6"

Operating system

macOS

@mgarbs mgarbs added the bug Something isn't working label Nov 18, 2022
@mgarbs mgarbs changed the title getMessage() from docs about result in TypeError: submitMsgTransaction.getMessage is not a function calling getMessage() from submit topic message docs results in TypeError: not a function Nov 18, 2022
@ochikov ochikov self-assigned this Nov 18, 2022
@ochikov
Copy link
Contributor

ochikov commented Nov 18, 2022

Hello @mgarbs 👋

For all property getters, we provide native getters instead of getX methods

/**
     * @returns {?Uint8Array}
     */
    get message() {
        return this._message;
    }

Therefore, for your specific case, you should use submitMsgTransaction.message

We are going to fix that into the documentation as well.

@mgarbs
Copy link
Author

mgarbs commented Nov 18, 2022

Awe

Hello @mgarbs 👋

For all property getters, we provide native getters instead of getX methods

/**
     * @returns {?Uint8Array}
     */
    get message() {
        return this._message;
    }

Therefore, for your specific case, you should use submitMsgTransaction.message

We are going to fix that into the documentation as well.

Awesome! Thanks :)
Do you want me to close this when we merge the PR for the docs on this?

@ochikov
Copy link
Contributor

ochikov commented Nov 21, 2022

@mgarbs We are going to handle them. Thank you.

@ochikov
Copy link
Contributor

ochikov commented Nov 21, 2022

We've synced with the team and decided to deprecate .message and provide .getMessage(). It will be changed into the next release.

@ochikov ochikov closed this as completed Nov 23, 2022
@Petyo-Lukanov Petyo-Lukanov added this to the 2.19.0 milestone Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants