bnb-chain / greenfield-js-sdk

JS SDK for Greenfield
https://docs.bnbchain.org/greenfield-js-sdk/
GNU General Public License v3.0
28 stars 16 forks source link

Weird behaviour for downloadFile #476

Closed AndrewChupin closed 9 months ago

AndrewChupin commented 9 months ago

I have store "open-store" with some files there, I can get info for such files, but when I'm trying to download it I get an error. Actually all operations with "authType" or "privateKey" is failing. I've changed private key, just for you to understand format.

Client info:

    const client = Client.create(
        "https://gnfd-testnet-fullnode-tendermint-us.bnbchain.org:443",
        "greenfield_5600-1",
    );

Code:

image

Error:

image
rrr523 commented 9 months ago

object.downloadFile is for use in the browser.

If you want to download file on Nodejs, you can use client.object.getObject.

ref: https://docs.bnbchain.org/greenfield-docs/docs/tutorials/dapp/js-file-management/overview/#41-download-object

AndrewChupin commented 9 months ago
Screenshot 2024-01-23 at 11 43 07

What should be the private key format??

I've tried with 0x, but it also isn't working. I used same format in ./gnfd-cmd and downloaded this file with same PK

AndrewChupin commented 9 months ago

Added 0x one more time and now it works, thanks