Обновить lazy-import Solana PDA под новый формат

This commit is contained in:
AidarKC
2026-06-04 14:33:42 +04:00
parent 59e4156bb9
commit a9510a6d36
3 changed files with 32 additions and 14 deletions
@@ -25,7 +25,6 @@ public final class SolanaUserPdaImportService {
private static final Logger log = LoggerFactory.getLogger(SolanaUserPdaImportService.class);
private static final ObjectMapper MAPPER = new ObjectMapper();
private static final HttpClient HTTP = HttpClient.newHttpClient();
private static final int USER_PDA_SPACE = 768;
private static final String MAGIC = "SHiNE";
private SolanaUserPdaImportService() {}
@@ -72,14 +71,13 @@ public final class SolanaUserPdaImportService {
{
"encoding":"base64",
"filters":[
{"dataSize":%d},
{"memcmp":{"offset":61,"bytes":"%s"}},
{"memcmp":{"offset":62,"bytes":"%s"}}
]
}
]
}
""".formatted(SolanaProgramsConfig.SHINE_USERS_PROGRAM_ID, USER_PDA_SPACE, lenB58, loginB58);
""".formatted(SolanaProgramsConfig.SHINE_USERS_PROGRAM_ID, lenB58, loginB58);
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create(SolanaProgramsConfig.SOLANA_RPC_URL))
@@ -171,14 +169,20 @@ public final class SolanaUserPdaImportService {
return null;
}
}
} else if (blockType == 4) {
c += 1 + 32;
int addrLen = u8(raw, c++);
c += addrLen;
int syncCount = u8(raw, c++);
for (int j = 0; j < syncCount; j++) {
int n = u8(raw, c++);
c += n;
} else if (blockType == 30) {
int isServer = u8(raw, c++);
if (isServer == 1) {
c += 1; // address_format_type
c += 1; // address_format_version
int addrLen = u8(raw, c++);
c += addrLen;
int syncCount = u8(raw, c++);
for (int j = 0; j < syncCount; j++) {
int n = u8(raw, c++);
c += n;
}
} else if (isServer != 0) {
return null;
}
} else if (blockType == 40) {
int accessCount = u8(raw, c++);
@@ -264,4 +268,3 @@ public final class SolanaUserPdaImportService {
long paidLimitBytes
) {}
}