How to specify Metaplex NFT collection image in Phantom wallet - solana

I've created a Solana NFT through metaplex. 1 out of 1.
It's showing up in my Phantom wallet on mobile however it's different from the NFTs purchased on solanart.
On the NFT screen, it says "Collection NFT" and shows the actual image only if I tap into the collection (last one).
What should I do to make it look like the purchased ones?
Also somehow another unspecified and empty (no metadata) NFT is also there and I'm not sure what it is (third one in the list).
Quite new to this, so probably missing something simple...
Thank you!

regarding the "Collection NFT" - You have to manually add metadata to the NFT:
Upload a new JSON + PNG pair (e.g. with arloader, sol-nft.tools arkb). It should can look like any other NFT metadata but should contain the collection data that will be shown.
use cli-nft.ts create-metadata or metaboss to add the uri (from the step 1) to the collection nft mint
Update June 2022: There is now a way better method to updating single NFTs:
Search your collection adress (Open a NFT on solscan, look into the metadata tab. There is a "collection" value which is your collection address). Copy it.
go to https://sol-tools.tonyboyle.io/update-nft and connect your wallet
enter the collection address
Modify whatever you need
Regarding the third NFT in your list: It looks like that you did not verify the upload and therefore the data was not on chain when the token was minted. Have a look here: https://docs.metaplex.com/candy-machine-v2/verify-upload

Related

Remove NFT from a Collection

Say i have an NFT generated from CandyMachine. Candy Machine will automatically set a Collection to the NFTs. I want to remove a specific NFT from that collection. I don't want it to be transferred to other NFT collection. I just want to remove its collection attribute
is this possible?
Yes it is absolutely possible to remove a NFT from a collection.
You can use the unverify instruction for it. This will set the verified to false and with this basically remove it from collection. It will not remove the key string from metadata, but that should not be an issue since a NFT is only part of a collection if verified is true. To remove any traces in the metadata you could also use the set and verify instruction to set a different collection value.
Easiest method to do this is using metaboss:
metaboss collections unverify [FLAGS] [OPTIONS] --collection-mint <collection-mint> --nft-mint <nft-mint>
If you want to replace the collection use
metaboss collections set-and-verify [FLAGS] [OPTIONS] --collection-mint <collection-mint> --nft-mint <nft-mint> --update-authority-nft <update-authority-nft>

How to allow NFTs to show up in the NEAR Wallet

I've created an NFT contract and it seems as though none of the NFTs that I've minted show up in the collectibles tab. I was wondering what the criteria were for having NFTs in the wallet and how an arbitrary NFT contract could achieve this?
The way NFTs are displayed is that the wallet keeps track of a list of "likely" NFT contracts that you might own NFTs on. When you navigate to the collectibles tab, the wallet will then call the nft_tokens_for_owner enumeration method to display your NFTs. This means that in order to have your NFTs show up, you need two things:
Your contract should implement the nft_tokens_for_owner function as per the enumeration standard.
Your contract should be able to be flagged as a "likely" NFT contract.
Let's go through the first requirement. Your NFT contract should implement the nft_tokens_for_owner function and when called, it should return an object that contains a metadata field as per the metadata standard. An example response of the Token object that should be returned is shown below:
{
token_id: 'token-1',
owner_id: 'eth-denver-testing2.testnet',
metadata: {
title: 'My Non Fungible Team Token',
description: 'The Team Most Certainly Goes :)',
media: 'https://bafybeiftczwrtyr3k7a2k4vutd3amkwsmaqyhrdzlhvpt33dyjivufqusq.ipfs.dweb.link/goteam-gif.gif',
media_hash: null,
copies: null,
issued_at: null,
expires_at: null,
starts_at: null,
updated_at: null,
extra: null,
reference: null,
reference_hash: null
},
approved_account_ids: {},
royalty: {}
}
Your token object should contain some metadata which includes the media field. If your contract doesn't implement the nft_tokens_for_owner function properly, it will result in something that looks like the following, where the NEAR wallet has correctly flagged your contract but it doesn't know how to display your NFT. This is explained in the NFT zero to hero tutorial's minting section.
Let's now go through the second requirement. Up until late 2021, the NEAR wallet used a hacky solution to flag NFT contracts. Basically, it looked for any method starting with nft_ where the receiver_id parameter was your account. This code can be found here (please ping me if this code changes places). This was a hacky solution since there isn't any standard for minting NFTs and so people could mint NFTs by calling a function that didn't start with nft_ or where the receiver ID wasn't in the parameter and the NFT was simply minted to the predecessor.
After late 2021, we introduced a new standard for NEP-171 tokens known as the events standard. This dictated that your smart contract should emit an event whenever an NFT is minted, burnt, or transferred. This allowed NFT contracts to have one source of truth as to when things happened and the wallet didn't need to rely on hacky "guesses" as to what contracts were considered likely NFT contracts.
TLDR:
With this in mind, your contract should either implement the events standard (recommended) or your mint function should start with nft_ and have the receiver_id parameter set to your account in order for your contract to be flagged as likely (or both).
Secondly, your contract should correctly implement the nft_tokens_for_owner function which returns a token object containing metadata that has a valid media field.

What view function can I call to determine if a user owns an nft minted on paras

I know from the zero to hero nft tutorial if I know the contract account id that minted it I should be able to call:
near view example-nft.testnet nft_tokens_for_owner '{"account_id": "'$NEARID'"}'
But what is the account id for a nft that was minted using paras? Do I need to search through a list of all paras tokens or is there a way to simply check for a single collection?
I'm thinking about making a fan game for an nft I like only accessible to users with that nft.
Currently reading these docs, but if anyone wants to answer might speed things up for me.
https://docs.paras.id/getting-started
If you want to see which NFTs a user owns on Paras, you can call the view-function from the near-cli like this:
export NEAR_ENV=mainnet # make sure you switch from testnet to mainnet
near view x.paras.near nft_tokens_for_owner '{"account_id": "'$NEARID'"}'
Paras.id also has a method called nft_tokens_by_series (found it on their GitHub repo), which takes one (string) argument, token_series_id. You can use the near-cli to get all NFTs for your series, and then see if the user owns one of your tokens.
near view x.paras.near nft_tokens_by_series '{"token_series_id": "id"}' # try id 49585 to get my own Mirror Crystals series
You can find the token_series_id in the URL when you inspect the details of an NFT on Paras.id (e.g. my own series https://paras.id/token/x.paras.near::49585/49585:2).
You can also do something similar with the near-api-js if you need to call the API from a browser or a Node.js application.
I'm not sure of understand completely your question, but you can list all the stores of any account with a simple "http get" call:
https://helper.mainnet.near.org/account/jeph.near/likelynfts
*Just change my account below for the user account.
And then knowing that the user has (or not) paras NFT you can make the next "http post":
To: https://rpc.mainnet.near.org/
Body:
{
"method": "query",
"params": {
"request_type": "call_function",
"account_id": "x.paras.near",
"method_name": "nft_tokens_for_owner",
"args_base64": "eyJhY2NvdW50X2lkIjoiamVwaC5uZWFyIn0=",
"finality": "optimistic"
},
"id": 158,
"jsonrpc": "2.0"
}
*Below "args_base64" are: {"account_id":"jeph.near"} , again, change my account and encode to base64.
It will return the info from all the NFTs that the user has from Paras.
The first get is not 100% necessary, but better be sure the user has or not NFTs from Paras, and then make the post.

Thunderbird - Get the user email address

I am developing a Mozilla Thunderbird plug-in and need to get the user's email address.
Question: How do I retrieve this address?
I will use it inside a JavaScript.
You should first keep in mind that a user can have multiple e-mail addresses (from multiple accounts or even multiple identities for one account), and you have to decide in which one you are interested.
Note: there may exist an easier way then described below, e.g. a helper function in the existing Thunderbird Code. You could try to search comm-central for it
You somehow have to get the nsIMsgIdentity for the identity you are interested in. It has an email property, with the e-mail adress as a string.
One way to get all Identities should be via the allIdentities of nsIMsgAccountManager (didn't test it).
Use the follwing code to get the nsIMsgAccountManager:
Components.utils.import("resource:///modules/mailServices.js");
let accountManager = MailServices.accounts
If you have an nsIArray of nsIMsgIdentity, you can use the following code to loop over them:
for (let identity in fixIterator(identities, Components.interfaces.nsIMsgIdentity)) {
}
References which could be useful:
Overview of some interesting interfaces:
https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Account_interfaces
Some account example Code:
https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Account_examples

How to implement isRePin() function

I'm using the Pinterest API to fetch pins from a specific board, and I want to know which Pins created by the board owner and which pins are Re Pins. For some reason I couldn't find how to do that via the API.
What am I missing?
Add the 'creator' to the 'fields' in the request. It will return the first and last name, ID, and profile URL of the pin's creator. The ID would be interesting to compare with the ID of your board owner. I am not sure if the creator ever changes, but it is worth looking into.

Resources