Giter VIP home page Giter VIP logo

js-deprecated's Introduction

@metaplex/js Β· GitHub license npm version

🚨 Deprecated library

Please note that this library has been archived and is no longer being maintained. To integrate Metaplex's program with your JavaScript applications please use the new JS SDK:


Stability

Stability: 1 - Experimental

In Development - All interfaces are very likely to change very frequently. Please use caution when making use of this library. Bugs or behavior changes may surprise users when Experimental API modifications occur.

Documentation

Community

Join our Discussions

Contributing

Visit Contributing

Good First Issues

See the list of starter issues here

js-deprecated's People

Contributors

adamjeffries avatar aheckmann avatar austbot avatar b2kdaman avatar dkchv avatar etodanik avatar exromany avatar ilmoi avatar kespinola avatar kurpav avatar lexich avatar lorisleiva avatar m-sebastiian avatar olgkv avatar pleandre avatar semantic-release-bot avatar solberenson avatar tbiedukhin avatar thlorenz avatar vecheslav avatar zaxozhu avatar zkhalapyan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

js-deprecated's Issues

Error in actions.placeBid

There a bug when I call actions.placeBid function, it is "Bidder Pot Token Must be a new account". Then I read source code and everything is normal. Why did that happen?
image
(error)
image
(code)

cannot install at all

I get the following error (and we don't even use husky).
npm install @metaplex/js was executed from the root directory (the one with .git), so I don't think that this error refers to out .git even?

from gitbash (part of git for windows)

wooha@Asus-ROG-Strix MINGW64 /c/_work/_serious/Slothana/sloth-combiner (master)
$ npm install @metaplex/js
npm ERR! code 1
npm ERR! path C:_work\sloth-combiner\node_modules@metaplex\js
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c husky install
npm ERR! .git can't be found (see https://git.io/Jc3F9)

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\wooha\AppData\Local\npm-cache_logs\2021-10-16T21_48_50_048Z-debug.log

from WSL (Ubuntu)

npm install @metaplex/js
npm ERR! code 1
npm ERR! path /mnt/c/_work/sloth-combiner/node_modules/@metaplex/js
npm ERR! command failed
npm ERR! command sh -c husky install
npm ERR! .git can't be found (see https://git.io/Jc3F9)

npm ERR! A complete log of this run can be found in:
npm ERR! /home/wooha/.npm/_logs/2021-10-16T22_12_54_494Z-debug.log

Missing foreign keys on the Rust programs

Let's make a list of all missing foreign keys on the Rust program as requested by @adamjeffries

  • WhitelistedCreator should reference the parent Store account
  • An AuctionManager should be more obviously connected to the Metadata? (not 100% sure about the exact structure of this one, but makes sense to not have to query it implicitly via WhitelistedCreators but rather directly)

Question about InitAuctionManagerV2

Sorry, I have a question. I saw code t in metaplex-foundation/metaplex/js/packages/web/actions and it use "initAuctionManagerV2" function in createAuctionManager.ts. But javascript JDK don't have it, and I used the "InitAuctionManagerV2" class to create auction manager. Then it failed because of acceptPaymentAccount parameter. So in the future, will be createAuctionManager or initAuctionManager function added?

Thanks

Test - ignore me

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

yarn build is failing: [!] Error: Package subpath './package.json' is not defined by "exports"

Can't run yarn build

Steps to reproduce

  1. Clone repo
  2. Call yarn install
  3. Call yarn build

Notice that yarn fails:

➜  js git:(main) yarn build
Error loading `tslib` helper library.
[!] Error: Package subpath './package.json' is not defined by "exports" in /Users/zkhalapyan/Desktop/forks/js/node_modules/rollup-plugin-typescript2/node_modules/tslib/package.json
Error: Package subpath './package.json' is not defined by "exports" in /Users/zkhalapyan/Desktop/forks/js/node_modules/rollup-plugin-typescript2/node_modules/tslib/package.json
    at new NodeError (node:internal/errors:371:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:429:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:683:3)
    at resolveExports (node:internal/modules/cjs/loader:482:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/zkhalapyan/Desktop/forks/js/node_modules/rollup-plugin-typescript2/src/tslib.ts:11:23)

Here are my versions:

➜  wonka git:(main) βœ— tsc --version
Version 4.5.3
➜  wonka git:(main) βœ— node --version
v17.3.0
➜  wonka git:(main) βœ— npm --version
8.3.0
➜  wonka git:(main) βœ— yarn --version
1.22.17

Auto-generate API docs

  • automated API docs generation with tsdoc based tool like typedoc
  • auto publishing to a website
  • publishing auto updates docs.metaplex.com

help needed?

Hey
A.J. said you're gonna be building this soon.
I can see that you guys started working on this already - do you need any help? or early adopters?

cheers

buffer-layout typescript issue

We have an issue with one of our upstream dependencies:

node_modules/@solana/spl-token/lib/index.d.ts(3,24): error TS7016: Could not find a declaration file for module 'buffer-layout'. '/Users/danny/src/metaplexql/node_modules/buffer-layout/lib/Layout.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/buffer-layout` if it exists or add a new declaration (.d.ts) file containing `declare module 'buffer-layout';

It appears that @solana/spl-token depends on this package, and it currently has no TypeScript support:
pabigot/buffer-layout#30

Invalid owner

I am trying to set up the project and when getting the metadata I always got the following error.

Tried on different environments with the same result.

Happening in both v2.0.0, v2.0.1 versions.

Error: Invalid owner

    at ERROR_INVALID_OWNER (node_modules\@metaplex\js\api\src\errors.ts:17:10)
    at new Metadata (node_modules\@metaplex\js\api\src\programs\metadata\accounts\Metadata.ts:106:13)
    at Function.<anonymous> (sloth-combiner\node_modules\@metaplex\js\api\src\Account.ts:30:12)
    at Generator.next (<anonymous>)
    at fulfilled (sloth-combiner\node_modules\@metaplex\js\lib\index.cjs.js:101:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Transaction succeed but metadata doesn't change

I used @metaplex/js to update metadata of Metaplex NFT.
The transaction succeed but the metadata account doesn't change.
what's the matter?
This is my code.

import { programs } from '@metaplex/js';

export const updateMetadataV1 = async () => {
  let { metadata : {Metadata, UpdateMetadata, MetadataDataData, Creator} } = programs;
  let signer = loadWalletKey(keyfile);
  let nftMintAccount = new PublicKey("EC8gGdtVFDoTf3vEGbLvPp7SVWta2xQrs99iWMbaFrdE");
  let metadataAccount = await Metadata.getPDA(nftMintAccount);
  const metadat = await Metadata.load(solConnection, metadataAccount);
  let newUri = "https://arweave.net/my arweave address";
  if (metadat.data.data.creators != null) {
    const creators = metadat.data.data.creators.map(
      (el) =>
          new Creator({
              ...el,
          }),
    );
    let newMetadataData = new MetadataDataData({
      name: metadat.data.data.name,
      symbol: metadat.data.data.symbol,
      uri: newUri,
      creators: [...creators],
      sellerFeeBasisPoints: metadat.data.data.sellerFeeBasisPoints,
    })
    const updateTx = new UpdateMetadata(
      { feePayer: signer.publicKey },
      {
        metadata: metadataAccount,
        updateAuthority: signer.publicKey,
        metadataData: newMetadataData,
        newUpdateAuthority: signer.publicKey,
        primarySaleHappened: metadat.data.primarySaleHappened,
      },
    );
    let result = await sendAndConfirmTransaction(solConnection, updateTx, [signer]);
    console.log("result =", result);
  }
}

problem when init vault

Describe the bug
I was trying to follow the metaplex/ARCHITECTURE to go through the auction create process on the newest branch, at the step that init_vault I have find that a vault programId is required, so I assume I need to createVault first. I write a test just like js/test/actions/utility/createVault.test.ts under the test folder like this
The test Code

const {NETWORK} = require( '../utils.js');
const {NodeWallet, Connection, actions,} = require('@metaplex/js');
const {Keypair} = require("@solana/web3.js");
const run = async () => {
let secretKey = Uint8Array.from([201,162,79,172,165,174,192,100,11,66,227,92,30,6,251,238,150,68,135,102,144,122,253,15,132,30,8,197,103,68,15,43,122,217,96,105,28,50,43,80,22,229,175,115,94,1,165,67,120,112,94,166,157,208,59,94,88,241,130,111,81,228,15,1]);
let myKeypair = Keypair.fromSecretKey(secretKey);
let wallet = new NodeWallet(myKeypair);
const connection = new Connection(NETWORK);
const externalPriceAccountData = await actions.createExternalPriceAccount({ connection, wallet });
// creat
const vaultResponse = await actions.createVault({
connection,
wallet,
...externalPriceAccountData,
});

console.log("vaultResponse :" +JSON.stringify(vaultResponse));
};
run();

Expected behavior
I want it to return the vault I just create to continue the process how ever I got an error like this

Screenshots
Transaction simulation failed: Error processing Instruction 7: Program failed to complete
Program 11111111111111111111111111111111 invoke [1]
Program 11111111111111111111111111111111 success
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]
Program log: Instruction: InitializeMint
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2457 of 200000 compute units
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success
Program 11111111111111111111111111111111 invoke [1]
Program 11111111111111111111111111111111 success
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]
Program log: Instruction: InitializeAccount
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3394 of 200000 compute units
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success
Program 11111111111111111111111111111111 invoke [1]
Program 11111111111111111111111111111111 success
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]
Program log: Instruction: InitializeAccount
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3294 of 200000 compute units
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success
Program 11111111111111111111111111111111 invoke [1]
Program 11111111111111111111111111111111 success
Program vau1zxA2LbssAUEF7Gpw91zMM1LvXrvpzJtmZ58rPsn invoke [1]
Program log: Instruction: Init Vault
Program log: libstd rust_begin_panic
Program log: panicked at 'index out of bounds: the len is 0 but the index is 0', token-vault/program/src/utils.rs:255:9
Program vau1zxA2LbssAUEF7Gpw91zMM1LvXrvpzJtmZ58rPsn consumed 7621 of 200000 compute units
Program failed to complete: BPF program panicked
Program vau1zxA2LbssAUEF7Gpw91zMM1LvXrvpzJtmZ58rPsn failed: Program failed to complete
(node:11584) UnhandledPromiseRejectionWarning: Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 7: Program failed to complete
at Connection.sendEncodedTransaction (D:\solona\node_modules@solana\web3.js\lib\index.cjs.js:6634:13)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Connection.sendRawTransaction (D:\solona\node_modules@solana\web3.js\lib\index.cjs.js:6593:20)
(Use node --trace-warnings ... to show where the warning was created)
(node:11584) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:11584) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Desktop (please complete the following information):

  • OS: Windows 10
  • Nodejs :v14.17.6

Additional context
I install the metaplex store as well and find out the param on that one is almost the same but the creatVault work on the store, I wonder am I doing anything wrong.

Create TokenMetadata abstraction

TokenMetadata is complicated and badly designed in the JSSDK

I propose a class that abstracts the complexity of one chain ad off chain token metadata that will be easy to use

Zero Open Handlers in Test Suite

Issue

The test suite fails to mock RPC calls to Solana currently which results in open http handlers that slow down the test suite and prevent jest from exiting cleanly. This issue is tracking the progress of removing open handlers.

yarn test --detectOpenHandles
yarn run v1.19.2                                                                                                                                                                                                   
$ jest --detectOpenHandles                                                                                                                                                                                         
 PASS  test/metadata.test.ts (8.52 s)                                                                                                                                                                              
 PASS  test/metaplex.test.ts                                                                                                                                                                                       
 PASS  test/auction.test.ts                                                                                                                                                                                        
 PASS  test/storage.test.ts                                                                                                                                                                                        
 PASS  test/conversion.test.ts                                                                                                                                                                                     
 PASS  test/vault.test.ts                                                                                                                                                                                          
                                                                                                                                                                                                                   
Test Suites: 2 skipped, 6 passed, 6 of 8 total                                                                                                                                                                     
Tests:       7 skipped, 27 passed, 34 total                                                                                                                                                                        
Snapshots:   0 total                                                                                                                                                                                               
Time:        20.482 s                                                                                                                                                                                              
Ran all test suites.                                                                                                                                                                                               
                                                                                                                                                                                                                   
Jest has detected the following 7 open handles potentially keeping Jest from exiting:   

Support winning config types that are not "FullRightsTransfer"?

I'm trying to use the SDK to place and redeem bids on an instant sale auction where the safety deposit items winningConfigType is WinningConfigType.PrintingV2. However, because the redeemBid action does not handle different cases for winningConfigType (unlike the storefront), the SDK action attempts aRedeemFullRightsTransferBid transaction and fails with the error message "The prize you are attempting to claim needs to be claimed from a different endpoint than this one".

Is this a currently known limitation with the SDK action or should I not be using WinningConfigType.PrintingV2 now?

find many NFTs by their symbol

Is your feature request related to a problem? Please describe.
I need to retrieve the NFT's in a collection. I think that I can do this using the symbol.

Here is what I unsuccesfuly tried:

  const symbol = "POP"
  const symbolBytes = bs58.encode(Buffer.from(symbol))
  const nfts = await programs.metadata.MetadataProgram.getProgramAccounts(
    connection,
    {
      filters: [
        {
          memcmp: {
            offset:
              1 + // key
              32 + // update auth
              32 + // mint
              4 + // name string length
              32 + // name
              4 + // uri string length
              200 + // uri
              4, // symbol string length
            bytes: symbolBytes,
          },
        },
      ],
    }
  )

It returns an empty list.

Describe the solution you'd like
Maybe we could enhance the findMany method to use the search by symbol.
I could contribute with a PR if I understand what my above issue is.

Describe alternatives you've considered
I did not found any other idea about how I can accomplish this task at the moment. Maybe there is a better idea ?

Additional context
I am building a NFT marketplace, that's why I need to retrieve a list of NFTs by collection.

Run CI in browsers too

Currently, CI uses jest running in the node test environment.

Describe the solution you'd like
Our tests should exercise our features in a browser environment as well to prove that this works as advertised.

npmjs.com package doesn't fit any tag, examples not working with package

Hello there,

I'm trying to do some first steps with the JS interface.

Using the package published to https://www.npmjs.com/package/@metaplex/js to run the examples does not work.

Since this is under heavy development I figured I should just checkout the repo at the version tagged on the npm package (0.0.1)
but turns out there are no tags.

$ cat package.json
{
  "dependencies": {
    "@metaplex/js": "^0.0.1"
  }
}
$ ls
index.js  index.ts  node_modules  package.json  yarn-error.log  yarn.lock
$Β cat index.ts
import metaplex from "@metaplex/js";

const conn = new metaplex.Connection("mainnet-beta");
const token_mint = 'dEJhLWciCBfbBJvjJXkJeZ8nP3kGs3M2EuMQP1NXQfJ';

const { Metadata } = metaplex;
const metadata = Metadata.load(conn, token_mint);
console.log(metadata);
$Β tsc index.ts
$Β node index.js
[removed]/minimal_non_working/index.js:4
var conn = new js_1["default"].Connection("mainnet-beta");
                               ^

TypeError: Cannot read property 'Connection' of undefined
    at Object.<anonymous> ([removed]/minimal_non_working/index.js:4:32)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47
$ npm -v
6.14.15
$ node -v
v14.17.6
$ yarn -v
1.22.11
$ yarn list
yarn list v1.22.11
warning package.json: No license field
warning No license field
β”œβ”€ @babel/[email protected]
β”‚  └─ regenerator-runtime@^0.13.4
β”œβ”€ @metaplex/[email protected]
β”‚  └─ @babel/runtime@^7.12.5
└─ [email protected]
Done in 0.07s.

Thanks

unable to install from npm

On OSX

With npm 7.21.0

⚑  ~/code/metaplex/test_semantic_release npm install @metaplex/js
npm WARN deprecated [email protected]: CircularJSON is in maintenance only, flatted is its successor.
npm ERR! code 127
npm ERR! path /Users/aaron/code/metaplex/test_semantic_release/node_modules/@metaplex/js
npm ERR! command failed
npm ERR! command sh -c husky install
npm ERR! sh: husky: command not found

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/aaron/.npm/_logs/2022-01-07T02_01_28_969Z-debug.log

With yarn 1.22.17

⚑  ~/code/metaplex/test_semantic_release yarn add @metaplex/js
yarn add v1.22.13
warning ../../package.json: No license field
info No lockfile found.
[1/4] πŸ”  Resolving packages...
warning @metaplex/js > @solana/web3.js > rpc-websockets > [email protected]: CircularJSON is in maintenance only, flatted is its successor.
[2/4] 🚚  Fetching packages...
[3/4] πŸ”—  Linking dependencies...
warning " > @metaplex/[email protected]" has unmet peer dependency "@metaplex-foundation/mpl-auction@^0.0.2".
warning " > @metaplex/[email protected]" has unmet peer dependency "@metaplex-foundation/mpl-core@^0.0.2".
warning " > @metaplex/[email protected]" has unmet peer dependency "@metaplex-foundation/mpl-metaplex@^0.0.5".
warning " > @metaplex/[email protected]" has unmet peer dependency "@metaplex-foundation/mpl-token-metadata@^0.0.2".
warning " > @metaplex/[email protected]" has unmet peer dependency "@metaplex-foundation/mpl-token-vault@^0.0.2".
warning " > @metaplex/[email protected]" has unmet peer dependency "@solana/spl-token@^0.1.8".
warning " > @metaplex/[email protected]" has unmet peer dependency "@solana/web3.js@^1.30.2".
[4/4] πŸ”¨  Building fresh packages...
[-/4] β ‚ waiting...
[2/4] β ‚ utf-8-validate
[3/4] β ‚ secp256k1
error /Users/aaron/code/metaplex/test_semantic_release/node_modules/@metaplex/js: Command failed.
Exit code: 127
Command: husky install
Arguments:
Directory: /Users/aaron/code/metaplex/test_semantic_release/node_modules/@metaplex/js

Minor type question

I noticed a minor typing inconsistency while documenting the project.

@solana/web3.js exports a type alias named TransactionSignature:

  /**
   * Transaction signature as base-58 encoded string
   */
  export type TransactionSignature = string;

In the following action (sendTransaction) we implicitly use that type alias because we return the output of connection.sendRawTransaction:
https://github.com/metaplex-foundation/js/blob/main/src/actions/transactions.ts#L29

On the other hand, in other actions we return Promise<string>:
https://github.com/metaplex-foundation/js/blob/main/src/actions/createMetadata.ts#L20

It's a very minor issue, and I see three easy outcomes:

  1. We reexport / use TransactionSignature everywhere (the only pro: documentation will look a tiny bit cleaner, we wouldn't have to specify the return string is in fact a transaction signature verbosely everywhere)
  2. We don't care :)

Let me know - I can refactor the cases where we return Promise<string> if needed.

Suggestion: Decouple minting from storage and potentially throw out concept of storage from core SDK

We were discussing it with @m-sebastiyan
The minting process is not layered enough in my opinion and depends too much on uploadFile4. I realize that it's an attempt at better UX, but it sacrifices good DX in return.

My suggestions are:

  1. Make the minting helper / process only care about pre-uploaded URL's. We don't care where (it could be IPFS, S3, Media Network CDN, Arweave and many more in the future).
  2. Either have ArweaveStorage as a completely separate helper, much simplified (it shouldn't mutate any JSON's IMHO, make it a simple 2 step process - upload images, then upload JSON). Or preferably just don't have this complexity in core and merely document the uploadFile4 (or any future version of it) REST-ful parameters and let the SDK client user decide if they wanna use it.

I think that the core SDK should be as skinny as possible and any attempt to introduce storage module awareness here will hurt that principle.

Metadata load example not working

Describe the bug
As mentioned in #41 there is a change in the exports so the first example in getting-started is not working with v4.10.1.

To Reproduce
Try the example code with the version of Metaplex v4.10.1.

import { Connection, programs } from '@metaplex/js';

const connection = new Connection('devnet');
const tokenPublicKey = 'Gz3vYbpsB2agTsAwedtvtTkQ1CG9vsioqLW3r9ecNpvZ';

const run = async () => {
  try {
    const ownedMetadata = await programs.metadata.Metadata.load(connection, tokenPublicKey); // <<<<< line in question!
    console.log(ownedMetadata);
  } catch {
    console.log('Failed to fetch metadata');
  }
};

run();

Expected behavior
The docs should be clear on what to import and how to load the Metadata.
If the code below is OK, I could update the docs.

To avoid the confusion in the future, it would be good to have a version indication in the docs but that should be tracked in a separate issue (e.g. add a version dropdown like in the Atlassian docs, see top right dropdown)

Working code with v4.10.1

import { Connection } from "@metaplex/js";
import { Metadata } from "@metaplex-foundation/mpl-token-metadata";

const connection = new Connection("devnet");
const tokenPublicKey = "Gz3vYbpsB2agTsAwedtvtTkQ1CG9vsioqLW3r9ecNpvZ";
const run = async () => {
  try {
    const ownedMetadata = await Metadata.load(connection, tokenPublicKey);
    console.log(ownedMetadata);
  } catch (ex) {
    console.log("Failed to fetch metadata", ex);
  }
};

run();

Additional context
Codesandbox for the above code can be found here

Codesandbox with metaplex/js v4.1.0

The automated release is failing 🚨

🚨 The automated release from the main branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two Factor Authentication for your account, set its level to "Authorization only" in your account settings. semantic-release cannot publish with the default "
Authorization and writes" level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Utility modules don't export in actions/index.ts

Describe the bug
Utility modules don't export

Desciption:
I try to call createExternalPriceAccount function but it can't found. I realize that all modules of utility folder are not exported in file index.ts (actions). So it is a bug ?

Thanks

Feature request: Add support for creating auctions

First of all I really like this package, but I noticed that there is no action for creating auctions. Is it possible to add actions for creating different type of auctions? I think it would be really useful for devs building custom marketplaces.

EditionData Parent field incorrect

When Metadata is loaded for an Edition and then the EditionData is deserialized the parent field is incorrect.

According to the docs and Rust code the definition of the Edition data is:

pub struct Edition {
    pub key: Key,

    /// Points at MasterEdition struct
    pub parent: Pubkey,

    /// Starting at 0 for master record, this is incremented for each edition minted.
    pub edition: u64,
}

But the value of parent seems to be returned is the same as the UpdateAuthority of the Edition rather than anything relating to the MasterEdition as it should be.
Tested using the following code and using the tokenPublicKey in the metaplex-js example.

const tokenPublicKey = 'Gz3vYbpsB2agTsAwedtvtTkQ1CG9vsioqLW3r9ecNpvZ';
const metadata = await Metadata.load(connection, tokenPublicKey);
const editionInfoData = EditionData.deserialize(metadata.info.data)

This returns 56bMjFLPSvZztdBk7D9g3LYTZNw3ApN6HKwyrQRCrLbL as the parent field. This is the same as the UpdateAuthority on the Edition.
This is the explorer page for that account: https://explorer.solana.com/address/56bMjFLPSvZztdBk7D9g3LYTZNw3ApN6HKwyrQRCrLbL?cluster=devnet
So its obviously not the MasterEdition.

I've also tried this with my own Edition which was minted from a MasterEdition using current master of the metaplex storefront code. I get my own wallet address back in the parent field.

Am I doing something wrong in the way I'm trying to load this data?

Fix CI

CI has been broken for a long time and is blocking PRs.

Can't resolve dependencies

I have an existing app that I'm migrating to use metaplex and I'm excited to find this js sdk. Unfortunately, I have not been able to get it to build with my app as I'm getting a lot of Can't resolve '<package_name>' in ' errors.

This is happening with many of the metaplex/js dependencies and only with the metaplex/js dependencies. All of errors go away if I remove the metaplex/js package from my app.

I was only able to get the build to go through by setting resolve.fallback as follows in webpack:

fallback: {
      fs: false,
      crypto: false,
      path: false,
      os: false,
      zlib: false,
      stream: false,
      http: false,
      https: false,
      net: false,
      tls: false,
      url: false,
      events: false,
      ws: false,
}

Though this was able to get webpack to build, I then started getting runtime errors.

I'm running metaplex/js v4.3.0, webpack v5.42.0, and node v16.13.0

npm installation fails due to husky

Attempting to install with npm i @metaplex/js fails with 4.11.1:

npm ERR! code 1
npm ERR! path /Users/...
npm ERR! command failed
npm ERR! command sh -c husky install
npm ERR! .git can't be found (see https://git.io/Jc3F9)

npm ERR! A complete log of this run can be found in:
...

There are several issues open about this problem with husky. None of the solutions worked. I was able to install @metaplex/js without any issue when installing the previous version with npm i @metaplex/[email protected]. Some change was made in the latest version that broke the installation of husky.

Cannot find name 'Optinal'

Describe the bug
A Typescript Error.

To Reproduce
Just installed the package.

Error

node_modules/@metaplex/js/lib/actions/shared/approve.d.ts:9:48 - error TS2304: Cannot find name 'Optional'.

9 export declare function createApproveTxs(args: Optional<CreateApproveParams, 'authority'>): {
                                                 ~~~~~~~~

Notes
I quickly fixed it by adding the declaration of Optional in the @metaplex/js/lib/actions/shared/approve.d.ts file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.