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

[bug] Xverse ord_getInscriptions Internal JSON-RPC error (-32603) #165

Open
1 task done
astralarkitekt opened this issue Aug 19, 2024 · 5 comments
Open
1 task done
Assignees

Comments

@astralarkitekt
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

SATS-CONNECT Version

2.6.0

Current Behavior

ord_getInscriptions() call is returning an error code -32603 (Internal JSON RPC error)

In our Vue 3 app we use a Pinia Store for interacting with sats-connect.

We first call and get a success from:

const response = await Wallet.request('getAccounts', {
          purposes: [AddressPurpose.Ordinals],
          message: 'Please sign this message to verify ownership of your wallet and assets.'
        });

Then we attempt to fetch the inscriptions based on the provider ... in this case Xverse...

 const inscriptions = await Wallet.request('ord_getInscriptions', {
          offset,
          limit: 60
        });

This results in the following response from sats-connect:

{
    "status": "error",
    "error": {
        "code": -32603,
        "message": "Internal error."
    }
}

According to the Docs - this is an Internal JSON-RPC error.

This code worked a little over a week ago. I have made no changes to my application and now it does NOT work. All calls to xverse's ord_getInscriptions() with my wallet result in this error. This is consistent across various

Expected Behavior

I expect to receive a list of up to 60 inscriptions.

Steps To Reproduce

Install sats-connect.

Follow the above steps in the current behavior section.

Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)

No response

Anything else?

No response

@astralarkitekt astralarkitekt changed the title [bug] <title> [bug] ord_getInscriptions error Aug 19, 2024
@astralarkitekt astralarkitekt changed the title [bug] ord_getInscriptions error [bug] Xverse ord_getInscriptions error Aug 19, 2024
@astralarkitekt astralarkitekt changed the title [bug] Xverse ord_getInscriptions error [bug] Xverse ord_getInscriptions Internal JSON-RPC error (-32603) Aug 19, 2024
@aryzing
Copy link
Contributor

aryzing commented Aug 22, 2024

Thanks for reporting @astralarkitekt, to help debug the issue, could you please try using sats-connect 2.7.0 to see if that helps?

If that doesn't help, try clearing the service worker's storage:
clear-storage.webm

Let me know if / what worked for you

@danilomarcus
Copy link

danilomarcus commented Aug 29, 2024

Hello friends, I am facing the same issue:

This is the code I am using:

try {
        const response = await request("wallet_requestPermissions", undefined);
        console.log(response);

        let address = '0';
        let balance = [];
        let runes = [];
        let inscriptions = [];
        let accounts = [];

        if (response.status === 'success') {
            const info = await Wallet.request("getInfo", null);
            console.log(info);

            accounts = await Wallet.request('getAccounts',
                {
                    purposes: ['ordinals', 'payment', 'stacks'],
                    message: 'Welcome to My Page'
                }
            );
            console.log(accounts);

            if (accounts.status === 'success') {

                address = accounts.result[0].address;
                console.log('your wallet is: ' + address);

                // get all the wallets (0=ordinals, 1=payment, 2=stacks)
                accounts = accounts.result;

                balance = await Wallet.request("getBalance", undefined);
                if (balance.status === 'success') {
                    console.log(balance);
                    balance = balance.result;
                } else {
                    console.error(balance.error);
                    balance = [];
                }

                runes = await Wallet.request("runes_getBalance", null);
                if (runes.status === 'success') {
                    console.log(runes);
                    runes = runes.result;
                } else {
                    console.error(runes.error);
                    runes = [];
                }

                inscriptions = await Wallet.request('ord_getInscriptions',
                    {
                        page_size: 60,
                        page_number: 1
                    }
                );
                if (inscriptions.status === 'success') {
                    console.log(inscriptions);
                    inscriptions = inscriptions.result;
                } else {
                    console.error(inscriptions.error);
                    inscriptions = [];
                }

            }
        }
        else if (response.status === 'error') {
            console.log(response.error.message);
            return false;
        }
        return [address, balance, inscriptions];

    } catch (err) {
        console.log(err);
    }

The only method that does not work is: ord_getInscriptions

This is the error message:

    [
    {
        "kind": "schema",
        "type": "number",
        "expected": "number",
        "received": "undefined",
        "message": "Invalid type: Expected number but received undefined",
        "path": [
            {
                "type": "object",
                "origin": "value",
                "input": {
                    "jsonrpc": "2.0",
                    "method": "ord_getInscriptions",
                    "params": {
                        "page_size": 60,
                        "page_number": 1
                    },
                    "id": "dp9hicH0wWqvQt_JhQB_r"
                },
                "key": "params",
                "value": {
                    "page_size": 60,
                    "page_number": 1
                }
            },
            {
                "type": "object",
                "origin": "value",
                "input": {
                    "page_size": 60,
                    "page_number": 1
                },
                "key": "offset"
            }
        ]
    },
    {
        "kind": "schema",
        "type": "number",
        "expected": "number",
        "received": "undefined",
        "message": "Invalid type: Expected number but received undefined",
        "path": [
            {
                "type": "object",
                "origin": "value",
                "input": {
                    "jsonrpc": "2.0",
                    "method": "ord_getInscriptions",
                    "params": {
                        "page_size": 60,
                        "page_number": 1
                    },
                    "id": "dp9hicH0wWqvQt_JhQB_r"
                },
                "key": "params",
                "value": {
                    "page_size": 60,
                    "page_number": 1
                }
            },
            {
                "type": "object",
                "origin": "value",
                "input": {
                    "page_size": 60,
                    "page_number": 1
                },
                "key": "limit"
            }
        ]
    }
]

Thanks for your help

@aryzing
Copy link
Contributor

aryzing commented Aug 30, 2024

Thanks for reporting @danilomarcus. Not sure if this is the same or a different error for the same method. Seems the issue is with the offset property that has been marked as required yet not supplied with the request made to the wallet. Will confirm whether it should be required or not and make the necessary fixes

@aryzing
Copy link
Contributor

aryzing commented Aug 30, 2024

@danilomarcus seems the issue with the code you shared is here,

                inscriptions = await Wallet.request('ord_getInscriptions',
                    {
                        page_size: 60,
                        page_number: 1
                    }
                );

The expected arguments are limit and offset, and not the page* ones used above.

Are you using Typescript? There should be a type error on this line when attempting to use these unknown params. Let me know if you are using TS but not getting any type errors.

@danilomarcus
Copy link

limit and offset

It worked with this parameters: limit and offset

I was following this docs: https://docs.xverse.app/sats-connect/bitcoin-methods/ord_getinscriptions

But it does not mention this required options, or at least I didn't saw it

Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants