現象
NFTを発行すると以下のエラーが出る。
metaplex/umi/node_modules/@solana/web3.js/src/connection.ts:5922
throw new SendTransactionError(
^
SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x177c
at Connection.sendEncodedTransaction (metaplex/umi/node_modules/@solana/web3.js/src/connection.ts:5922:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Connection.sendRawTransaction (metaplex/umi/node_modules/@solana/web3.js/src/connection.ts:5881:20)
at async Object.sendTransaction (metaplex/umi/node_modules/@metaplex-foundation/umi-rpc-web3js/src/createWeb3JsRpc.ts:327:25)
at async TransactionBuilder.sendAndConfirm (metaplex/umi/node_modules/@metaplex-foundation/umi/src/TransactionBuilder.ts:359:23)
at async mintWithoutCollection (metaplex/umi/src/cNFT-mintWithoutCollection.ts:37:18) {
logs: [
'Program BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY invoke [1]',
'Program log: Instruction: MintV1',
'Program log: AnchorError occurred. Error Code: MetadataNameTooLong. Error Number: 6012. Error Message: Name in metadata is too long.',
'Program BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY consumed 22667 of 200000 compute units',
'Program BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY failed: custom program error: 0x177c'
]
}
該当箇所のソース
const result = await mintV1(umi, {
leafOwner: payerKeypair.publicKey,
merkleTree,
metadata: {
name: 'My Compressed NFT in a Collection',
uri: 'https://madlads.s3.us-west-2.amazonaws.com/json/4731.json',
sellerFeeBasisPoints: 500, // 5%
collection: none(),
creators: [
{ address: umi.identity.publicKey, verified: false, share: 100 },
],
},
}).sendAndConfirm(umi);
原因
Metadataの情報がバリデーションエラーになっている。ログメッセージにも以下のとおり出力されている。
Error Message: Name in metadata is too long.
今回は、Metadataのname(いわゆるNFTの名前)が規定文字数よりも超えていたためエラーになっていた。
対応
文字数を短くした(上限は上記の「詳しい解説」を参照)。
const result = await mintV1(umi, {
leafOwner: payerKeypair.publicKey,
merkleTree,
metadata: {
name: 'cNFT w/o Collection', // ← 短くした
uri: 'https://madlads.s3.us-west-2.amazonaws.com/json/4731.json',
sellerFeeBasisPoints: 500, // 5%
collection: none(),
creators: [
{ address: umi.identity.publicKey, verified: false, share: 100 },
],
},
}).sendAndConfirm(umi);