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

.setAccountId does not accept EVM address based account ID #14862

Open
a-ridley opened this issue Aug 15, 2024 · 1 comment
Open

.setAccountId does not accept EVM address based account ID #14862

a-ridley opened this issue Aug 15, 2024 · 1 comment
Labels
Bug An error that causes the feature to behave differently than what was expected based on design.

Comments

@a-ridley
Copy link

Description

Description copied from issue: hashgraph/hedera-sdk-js#2442

Variation 1 - EVM address as string:

const assocTx = await new TokenAssociateTransaction()
        .setAccountId('0x34fe5d75bd7ee95273ac9883c460d71edb0a2b6e')
        .setTokenIds([tokenId])
        .setNodeAccountIds([AccountId.fromString('0.0.5')])
        .freezeWith(client);

Variation 2 - account ID based on EVM address:

const assocTx = await new TokenAssociateTransaction()
        .setAccountId(AccountId.fromEvmAddress(0, 0,'0x34fe5d75bd7ee95273ac9883c460d71edb0a2b6e'))
        .setTokenIds([tokenId])
        .setNodeAccountIds([AccountId.fromString('0.0.5')])
        .freezeWith(client);

Variation 3 - Account ID in S.R.N format:

const assocTx = await new TokenAssociateTransaction()
        .setAccountId(AccountId.fromString('0.0.4654396'))
        .setTokenIds([tokenId])
        .setNodeAccountIds([AccountId.fromString('0.0.5')])
        .freezeWith(client);

This also occurs for TokenFreezeTransaction() as it was reported by a developer who is part of the Hello Future Hackathon.

Steps to reproduce

Steps to reproduce

  1. Create assocTx in each of the above variations.
  2. Sign an submit assocTx using the code below
  3. Observe that with variation 1 and 2, there is an error, but variation 3 works
  • Note that all 3 variations refer to the same account:https://hashscan.io/testnet/account/0.0.4654396
  • Note that this behaviour is inconsistent with other SDK methods, such as TransferTransaction, which do accept their own equivalents of variations 1 and 2.
    const assocTxId = assocTx.transactionId;
    logger.log('The token association transaction ID:', assocTxId.toString());

    await logger.logSectionWithWaitPrompt('Submitting token association transaction');
    const assocTxSigned = await assocTx.sign(account1Key);

    const assocTxSubmitted = await assocTxSigned.execute(client);

    const assocTxReceipt = await assocTxSubmitted.getReceipt(client);
    const assocTxStatus = assocTxReceipt.status;
    logger.log(
        'The token association transaction status is:',
        assocTxStatus.toString(),
    );

Additional context

Additional context

The error is INVALID_ACCOUNT_ID and the full output is copied below.
The error occurs when getReceipt is invoked.

ReceiptStatusError: receipt for transaction [email protected] contained error status INVALID_ACCOUNT_ID
at new ReceiptStatusError (file:///Users/user/code/hedera/hedera-tokens-cyoa-tutorial/node_modules/@hashgraph/sdk/src/ReceiptStatusError.js:37:9)
at TransactionReceiptQuery._mapStatusError (file:///Users/user/code/hedera/hedera-tokens-cyoa-tutorial/node_modules/@hashgraph/sdk/src/transaction/TransactionReceiptQuery.js:332:16)
at TransactionReceiptQuery.execute (file:///Users/user/code/hedera/hedera-tokens-cyoa-tutorial/node_modules/@hashgraph/sdk/src/Executable.js:725:32)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async TransactionResponse.getReceipt (file:///Users/user/code/hedera/hedera-tokens-cyoa-tutorial/node_modules/@hashgraph/sdk/src/transaction/TransactionResponse.js:81:25)
at async scriptTokenHts (file:///Users/user/code/hedera/hedera-tokens-cyoa-tutorial/tokenHts/script-tokenHts.js:126:28) {
status: Status { _code: 15 },
transactionId: TransactionId {
accountId: AccountId {
shard: [Long],
realm: [Long],
num: [Long],
aliasKey: null,
evmAddress: null,
_checksum: null
},
validStart: Timestamp { seconds: [Long], nanos: [Long] },
scheduled: false,
nonce: null
},
transactionReceipt: TransactionReceipt {
status: Status { _code: 15 },
accountId: null,
fileId: null,
contractId: null,
topicId: null,
tokenId: null,
scheduleId: null,
exchangeRate: ExchangeRate {
hbars: 30000,
cents: 143313,
expirationTime: 2024-08-05T09:00:00.000Z,
exchangeRateInCents: 4.7771
},
topicSequenceNumber: Long { low: 0, high: 0, unsigned: false },
topicRunningHash: Uint8Array(0) [],
totalSupply: Long { low: 0, high: 0, unsigned: false },
scheduledTransactionId: null,
serials: [],
duplicates: [],
children: []
}
}

Hedera network

testnet

Version

2.48.1

Operating system

macOS

@a-ridley a-ridley added the Bug An error that causes the feature to behave differently than what was expected based on design. label Aug 15, 2024
@a-ridley
Copy link
Author

@tinker-michaelj A hacker participating in our Hello Future Hackathon has raised this issue. If you get a chance to look at this issue that would be greatly appreciated! Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug An error that causes the feature to behave differently than what was expected based on design.
Projects
Status: Backlog
Development

No branches or pull requests

1 participant