ప్రశ్నలు మరియు సమాధానాలు

InstructionFallbackNotFound. లోపు సంఖ్య: 101. లోపు సందేశం: ఫాల్‌బ్యాక్ ఫంక్షన్‌లు మద్దతు లేవు

వచన పరిమాణం

మీరు Ademola చెప్పినట్లుగా మీ లావాదేవీ డేటాకు ఇన్స్ట్రక్షన్ డిస్క్రిమినేటర్ను అందించాలి. మీరు చేయగలిగేది ఏమిటంటే ఇన్స్ట్రక్షన్ డిస్క్రిమినేటర్ను fetch చేసి, ఆపై దానిని మీ డేటాలో మొదటి 8 బైట్లలో append చేయడం. Rust లో Instruction Discriminator Fetch చేయండి pub fn sighash(namespace: &str, name: &str) -> [u8; 8] { let preimage = format!("{}:{}", namespace, name);

let mut sighash = [0u8; 8]; sighash.copy_from_slice( &anchor_client::anchor_lang::solana_program::hash::hash(preimage.as_bytes()).to_bytes() [..8], ); sighash }

println!("{:?}", sighash("global", "initialize"));

Typescript లో Discriminator Instruction Fetch చేయండి function sighash(nameSpace: string, ixName: string): Buffer { let name = snakeCase(ixName); let preimage = `${nameSpace}:${name}`; return Buffer.from(sha256.digest(preimage)).slice(0, 8); }

namespace global గా ఉండాలి Typescript లో ఇక్కడ ఒక ఉదాహరణ ఉంది // Craft the InstructionBuffer const ixBuffer = sighash('global','initialize');

const instructionBuffer = Buffer.concat([ ixBuffer, // namespace+method_name OtherBuffer, // Other Data that you want to pass to the instruction. ])

// Craft the Instruction const transactionInstruction = new TransactionInstruction({ programId: programAddress, data: instructionBuffer, keys : [ ... ] })

అన్వేషణ కొనసాగించండిడేటా కేటలాగ్వెతకండి