hashgraph / hedera-wallet-connect

This package is a messaging relay between decentralized applications and wallets in Hedera network based on Wallet Connect relays.
Apache License 2.0
13 stars 22 forks source link

TokenUpdateNftsTransaction() returns TypeError #265

Open nadineloepfe opened 2 months ago

nadineloepfe commented 2 months ago

Describe the bug

I'm trying to run a TokenUpdateNftsTransaction() with WalletConnect and I'm running into this TypeError (see screenshot). This only happens when using the signer/provider from WalletConnect – when testing this step with const client = Client.forTestnet().setOperator(operatorId, operatorKey) then it is successful in updating the metadata. for ref - I've tried multiple versions of the syntax, all of them failing with the same error:

      const updateTransaction = new TokenUpdateNftsTransaction()
        .setTokenId(formattedTokenId)
        .setSerialNumbers([serialNumber])
        .setMetadata(new TextEncoder().encode(newMetadataUri))
        .freezeWith(hederaClient);

      const signedUpdateTx = await updateTransaction.sign(metadataKey);
      const txResult = await signedUpdateTx.executeWithSigner(signer);

as well as:

const updateTransaction = new TokenUpdateNftsTransaction()
      .setTokenId(tokenId) 
      .setSerialNumbers([serialNumber]) 
      .setMetadata(new TextEncoder().encode(newMetadataUri);) 

    await updateTransaction.freezeWithSigner(signer);
    const signedUpdateTx = await updateTransaction.sign(metadataKey);
    const txResult = await signedUpdateTx.executeWithSigner(signer);

it's always breaking at await signedUpdateTx.executeWithSigner(signer); I am suspecting this may be an issue with WalletConnect. Given this is a new transaction type it may be the wallet doesn’t support it yet.

To Reproduce Steps to reproduce the behavior:

  1. login with wallet connect
  2. specify inputs
  3. click update and check console

Example program to reproduce issue with one click (update-nft-metadata-e2e branch)

  1. Example Program if pre-minted token shall be used (update-nft-metadata branch)
  2. Gist

Expected behavior Metadata updating successfully

Screenshots

Screenshot 2024-09-10 at 23 12 25

Desktop (please complete the following information):

kantorcodes commented 2 weeks ago

@nadineloepfe

So the root of this issue was related to the Hedera SDK. Could you try with version [v2.53.0-beta.4](https://github.com/hashgraph/hedera-sdk-js/releases/tag/v2.53.0-beta.4) and see if that resolves your issue?

nadineloepfe commented 2 weeks ago

it unfortunately doesn't, @kantorcodes

output:

{
  "txError": {},
  "queryError": {
    "name": "Error",
    "message": "(BUG) Query.fromBytes() not implemented for type getByKey",
    "stack": "Error: (BUG) Query.fromBytes() not implemented for type getByKey\n    at Query.fromBytes (http://localhost:5173/node_modules/.vite/deps/chunk-5ICC4Y3K.js?v=c21a5bb8:67495:13)\n    at DAppSigner._tryExecuteQueryRequest (http://localhost:5173/node_modules/.vite/deps/@hashgraph_hedera-wallet-connect.js?v=157578fc:32323:27)\n    at DAppSigner.call (http://localhost:5173/node_modules/.vite/deps/@hashgraph_hedera-wallet-connect.js?v=157578fc:32342:36)\n    at async metadataUpdate (http://localhost:5173/main.js:226:22)\n    at async HTMLButtonElement.handleRunTest (http://localhost:5173/main.js:247:5)"
  }
}
kantorcodes commented 5 days ago

it unfortunately doesn't, @kantorcodes

output:

{
  "txError": {},
  "queryError": {
    "name": "Error",
    "message": "(BUG) Query.fromBytes() not implemented for type getByKey",
    "stack": "Error: (BUG) Query.fromBytes() not implemented for type getByKey\n    at Query.fromBytes (http://localhost:5173/node_modules/.vite/deps/chunk-5ICC4Y3K.js?v=c21a5bb8:67495:13)\n    at DAppSigner._tryExecuteQueryRequest (http://localhost:5173/node_modules/.vite/deps/@hashgraph_hedera-wallet-connect.js?v=157578fc:32323:27)\n    at DAppSigner.call (http://localhost:5173/node_modules/.vite/deps/@hashgraph_hedera-wallet-connect.js?v=157578fc:32342:36)\n    at async metadataUpdate (http://localhost:5173/main.js:226:22)\n    at async HTMLButtonElement.handleRunTest (http://localhost:5173/main.js:247:5)"
  }
}

Hi!

Could you confirm the full code snippet on your end as well as the packages you're using? You'll need the latest hashgraph SDK and canary release

   "@hashgraph/hedera-wallet-connect": "1.3.8-canary.25ba652.0",