SHA256
Исправить клиентскую Solana-регистрацию после ухода от Anchor
This commit is contained in:
@@ -116,7 +116,6 @@ export function render({ navigate }) {
|
||||
const connection = new solana.Connection(String(state.entrySettings.solanaServer || ''), 'confirmed');
|
||||
const programPubkey = new solana.PublicKey(programId);
|
||||
|
||||
const discriminator = Uint8Array.from([13, 16, 103, 175, 121, 137, 166, 222]);
|
||||
const ix = new solana.TransactionInstruction({
|
||||
programId: programPubkey,
|
||||
keys: [
|
||||
@@ -124,7 +123,7 @@ export function render({ navigate }) {
|
||||
{ pubkey: economyPda, isSigner: false, isWritable: true },
|
||||
{ pubkey: solana.SystemProgram.programId, isSigner: false, isWritable: false },
|
||||
],
|
||||
data: discriminator,
|
||||
data: Uint8Array.from([1]),
|
||||
});
|
||||
|
||||
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash('confirmed');
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
SHINE_LOGIN_GUARD_PROGRAM_ID,
|
||||
} from '../solana-programs.js';
|
||||
|
||||
const CLASSIFY_LOGIN_DISCRIMINATOR = new Uint8Array([112, 97, 152, 32, 255, 73, 108, 86]);
|
||||
const CLASSIFY_LOGIN_INSTRUCTION_TAG = 1;
|
||||
const PRECHECK_SIM_PAYER = 'FUc28vNixp7F3nnkpGVt6nuJbgvJ4429v4B5wS52Df6P';
|
||||
|
||||
let solanaLibPromise = null;
|
||||
@@ -33,7 +33,7 @@ class BorshBuf {
|
||||
|
||||
function serializeClassifyLoginArgs(login) {
|
||||
const b = new BorshBuf();
|
||||
b.raw(CLASSIFY_LOGIN_DISCRIMINATOR);
|
||||
b.u8(CLASSIFY_LOGIN_INSTRUCTION_TAG);
|
||||
b.str(String(login || ''));
|
||||
return b.result();
|
||||
}
|
||||
@@ -78,7 +78,7 @@ export async function precheckLoginClassOnSolana({ login, solanaEndpoint }) {
|
||||
const payer = new solana.PublicKey(PRECHECK_SIM_PAYER);
|
||||
const ix = new solana.TransactionInstruction({
|
||||
programId: loginGuardProgram,
|
||||
keys: [{ pubkey: payer, isSigner: true, isWritable: false }],
|
||||
keys: [],
|
||||
data: serializeClassifyLoginArgs(String(login || '').toLowerCase()),
|
||||
});
|
||||
const { blockhash } = await connection.getLatestBlockhash('confirmed');
|
||||
|
||||
Reference in New Issue
Block a user