Inconsistency between DAS API Documentation and Actual Implementation
Opened this issue · 3 comments
Description
There is a significant discrepancy between the documented Digital Asset Standard (DAS) API methods and the actual implementation in the @metaplex-foundation/umi
package. The documentation suggests the existence of methods like getAsset
, getAssetProof
, and getAssetsByOwner
on the umi.rpc
object, but these methods are not present in the actual RpcInterface
.
Steps to Reproduce
- Install the latest version of
@metaplex-foundation/umi
and@metaplex-foundation/digital-asset-standard-api
. - Register the DAS API as per the documentation:
import { dasApi } from '@metaplex-foundation/digital-asset-standard-api'; umi.use(dasApi());
- Attempt to use the DAS API methods as documented:
const rpcAsset = await umi.rpc.getAsset(assetId); const rpcAssetProof = await umi.rpc.getAssetProof(assetId); const rpcAssetList = await umi.rpc.getAssetsByOwner({ owner: ownerAddress });
Expected Behavior
The umi.rpc
object should contain the methods getAsset
, getAssetProof
, and getAssetsByOwner
as described in the documentation.
Actual Behavior
TypeScript throws errors indicating that these methods do not exist on the RpcInterface
.
Environment
- Node.js version: 18.20.4
- TypeScript version: 5.5.4
- @metaplex-foundation/umi version: 0.9.2
- @metaplex-foundation/digital-asset-standard-api version: 1.0.4
Additional Context
The documentation at (Fetching Compressed NFTs)[https://developers.metaplex.com/bubblegum/fetch-cnfts] suggests these methods should be available after registering the DAS API plugin. However, the actual implementation does not match this documentation, leading to confusion and implementation difficulties.
Possible Solutions
- Update the
RpcInterface
to include these DAS API methods. - Update the documentation to accurately reflect the current implementation and provide clear instructions on how to use the DAS API methods if they are implemented differently.
- If these methods are intended to be used differently, provide clear examples in the documentation.
Hey!
I have seen a similar behaviour today which was caused by specific tsconfig settings.
E.g. this tsconfig is working totally fine:
{
"compilerOptions": {
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"module": "commonjs", /* Specify what module code is generated. */
"rootDir": "./src", /* Specify the root folder within your source files. */
"outDir": "./dist", /* Specify an output folder for all emitted files. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
"strict": true, /* Enable all strict type-checking options. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}
are you able to share yours? I am currently looking to find out which specific settings are causing it to mitigate it.
Thank you!
{
"compilerOptions": {
"outDir": "dist",
"target": "es2022",
"moduleResolution": "Bundler",
"module": "ES2022",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": false,
"strict": true,
"skipLibCheck": true
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
}
Hi @MarkSackerberg I am having the same issue as @codewithmide too, this is my tsconfig.json
file , maybe it has something to so with ESmodules?
also these are my dependencies
"devDependencies": {
"@digitak/esrun": "^3.2.24",
"@types/bn.js": "^5.1.6",
"@types/chai": "^4.3.3",
"@types/mocha": "^9.1.1",
"@types/node": "^20.5.7",
"chai": "^4.3.6",
"esrun": "^3.2.26",
"mocha": "^10.0.0",
"prettier": "^3.0.3",
"ts-mocha": "^10.0.0",
"typescript": "^5.2.2"
},
"dependencies": {
"@coral-xyz/anchor": "^0.30.1",
"@metaplex-foundation/mpl-bubblegum": "^4.2.0",
"@metaplex-foundation/mpl-token-metadata": "3.2.1",
"@metaplex-foundation/umi": "^0.9.2",
"@metaplex-foundation/umi-bundle-defaults": "^0.9.2",
"@metaplex-foundation/umi-uploader-irys": "^0.10.0-beta.0",
"@solana-developers/helpers": "^2.5.5",
"@solana/spl-account-compression": "^0.2.1",
"@solana/spl-token": "^0.4.8",
"@solana/web3.js": "^1.95.3",
"bn.js": "^5.2.1",
"bs58": "^6.0.0",
"dotenv": "^16.4.5",
"node-fetch": "^3.3.2"
}