secretkeylabs / sats-connect

Sats connect is a simple javascript library that connects apps to Bitcoin wallets
https://www.npmjs.com/package/sats-connect
107 stars 40 forks source link

ord_getInscriptions is not supported #146

Closed denizhankara closed 3 months ago

denizhankara commented 3 months ago

Is there an existing issue for this?

SATS-CONNECT Version

2.5.0

Current Behavior

The ord_getInscriptions still says "not supported" in example app after updated version.

For the below component: ` import Wallet, { RpcErrorCode } from 'sats-connect';

const GetInscriptions = () => { const onClick = async () => { const response = await Wallet.request('ord_getInscriptions', { limit: 100, offset: 0, });

if (response.status === 'success') {
  console.log('inscriptions', response.result);
  alert('Success. See console for details.');
} else if (response.error.code === RpcErrorCode.USER_REJECTION) {
  alert('User cancelled the request');
} else {
  console.error(response.error);
  alert('Error getting inscriptions. See console for details.');
}

};

return (

Inscriptions

); };

export default GetInscriptions; `

The response from console is:

image

Expected Behavior

Expected behavior is a list of ordinal NFTs in the wallet.

Steps To Reproduce

1- Checkout the most recent sats-connect lib, commit hash: f34ca7e7d210afc1f1d9e306ad3db6486e7bdb9e https://github.com/secretkeylabs/sats-connect 2- Deploy example app on signet: https://github.com/secretkeylabs/sats-connect/tree/develop/example 3- Try ord_getInscriptions, results in "not supported" in Xverse wallet.

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

No response

Anything else?

No response

teebszet commented 3 months ago

hi @denizhankara, thanks for using sats-connect!

the user would also need to update their Xverse chrome extension to 0.38.1 for this sats-connect method to be supported.

what you're seeing should be the fallback for users who haven't updated yet, so your app would also need to handle that case.

please let us know if that resolves the issue

denizhankara commented 3 months ago

Hi @teebszet,

Thank you for your response. I updated my sats connect as well as wallet to 0.38.1. That resolved the "not supported" issue.

However, I now get "Access denied" error on the console when I try to use the getInscriptions.

teebszet commented 3 months ago

hi @denizhankara, with sats-connect v2.5.0 and Xverse chrome extension v0.38.1, we shipped a new concept of permissions management, which is best described here: https://docs.xverse.app/sats-connect/connecting-to-the-wallet/request-connection-permissions-and-retrieve-wallet-data

we welcome your feedback on convenience and ease of use, but for now to keep your integration work going, I would suggest that you migrate your Connect button to call the request('wallet_requestPermissions') method first as in this example:

https://github.com/secretkeylabs/sats-connect/blob/develop/example/src/App.tsx#L42-L60

the end result should be that your dapp's connect gives one popup to request to sign, but it would grant permissions for your dapp to retrieve addresses, balances, and inscriptions (via getAddress, getBalance, getInscriptions, etc.)

denizhankara commented 3 months ago

Thank you for the support! It is resolved now.

For future reference, migrating the Connect button to call the request('wallet_requestPermissions') method, as shown in the example below described by @teebszet, resolved the "Access Denied" error: https://github.com/secretkeylabs/sats-connect/blob/develop/example/src/App.tsx#L42-L60