Подготовить программы и user PDA к публичной версии 1.0

This commit is contained in:
AidarKC
2026-12-02 15:15:39 +03:00
parent ad4949d2ac
commit 0c85948556
10 changed files with 35 additions and 247 deletions
@@ -143,7 +143,7 @@ public final class SolanaUserPdaImportService {
if (!MAGIC.equals(new String(raw, 0, 5, StandardCharsets.UTF_8))) return null;
int major = u8(raw, 5);
int minor = u8(raw, 6);
if (major != 1 || (minor != 2 && minor != 3)) return null;
if (major != 1 || minor != 0) return null;
return parseUserPdaV12(raw);
}
@@ -254,18 +254,9 @@ public final class ShineUsersCodec {
int formatMajor = raw[5] & 0xFF;
int formatMinor = raw[6] & 0xFF;
if (formatMajor != 1) {
throw new IllegalArgumentException("Unsupported PDA format " + formatMajor + "." + formatMinor);
}
if (formatMinor == 2 || formatMinor == 3) {
if (formatMajor == 1 && formatMinor == 0) {
return parseUserPdaAccountV12(pdaAddress, slot, rawDataBase64, lastTxSignature, raw);
}
if (formatMinor == 0) {
// Временная read-only совместимость: legacy PDA 1.0 снова читается
// server-sync только для bootstrap старых server-записей. Новые записи
// и update по-прежнему работают только с текущим форматом 1.2.
return parseUserPdaAccountV10(pdaAddress, slot, rawDataBase64, lastTxSignature, raw);
}
throw new IllegalArgumentException("Unsupported PDA format " + formatMajor + "." + formatMinor);
}