질문과 답변

InstructionFallbackNotFound. 오류 번호: 101. 오류 메시지: 대체 기능은 지원되지 않습니다.

텍스트 크기

Ademola가 언급한 것처럼 거래 데이터에 명령 판별자를 제공해야 합니다. 당신이 할 수 있는 일은 명령어 판별자를 가져온 다음 이를 데이터의 처음 8바이트에 추가하는 것입니다. Rust의 Fetch Instruction Discriminator pub fnighash(네임스페이스: &str, 이름: &str) -> [u8; 8] { let preimage = format!("{}:{}", 네임스페이스, 이름);

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

println!("{:?}",ighash("글로벌", "초기화"));

TypeScript의 Fetch Discriminator 명령어 함수 sithash(nameSpace: 문자열, ixName: 문자열): 버퍼 { 이름 = snakeCase(ixName); preimage = `${nameSpace}:${name}`; return Buffer.from(sha256.digest(preimage)).slice(0, 8); }

네임스페이스는 전역적이어야 합니다. 다음은 Typescript의 예입니다. // InstructionBuffer 작성 const ixBuffer = sadash('global','initialize');

const InstructionBuffer = Buffer.concat([ ixBuffer, // 네임스페이스+메소드_이름 OtherBuffer, // 명령어에 전달하려는 기타 데이터입니다. ])

// 명령어 작성 const transactionInstruction = 새로운 TransactionInstruction({ 프로그램 ID: 프로그램 주소, 데이터: 명령 버퍼, 키 : [ ... ] })

계속 탐색하기데이터 목록검색