ui fixed
This commit is contained in:
@@ -20,7 +20,10 @@ export async function fetchEscrowsForWallet(
|
||||
|
||||
const walletBytes = walletAddress as never;
|
||||
|
||||
const [asSeller, asBuyer] = await Promise.all([
|
||||
// Option<Pubkey> for disputeResolver: 1-byte discriminant (1=Some) at offset 80, pubkey at offset 81
|
||||
const someVariantBase64 = btoa(String.fromCharCode(1)) as never;
|
||||
|
||||
const [asSeller, asBuyer, asResolver] = await Promise.all([
|
||||
rpc
|
||||
.getProgramAccounts(DESCRO_PROGRAM_ADDRESS, {
|
||||
filters: [
|
||||
@@ -39,12 +42,22 @@ export async function fetchEscrowsForWallet(
|
||||
encoding: "base64",
|
||||
})
|
||||
.send(),
|
||||
rpc
|
||||
.getProgramAccounts(DESCRO_PROGRAM_ADDRESS, {
|
||||
filters: [
|
||||
{ memcmp: { offset: 0n, bytes: discriminatorBase64, encoding: "base64" } },
|
||||
{ memcmp: { offset: 80n, bytes: someVariantBase64, encoding: "base64" } },
|
||||
{ memcmp: { offset: 81n, bytes: walletBytes, encoding: "base58" } },
|
||||
],
|
||||
encoding: "base64",
|
||||
})
|
||||
.send(),
|
||||
]);
|
||||
|
||||
const seen = new Set<string>();
|
||||
const results: EscrowAccountWithPda[] = [];
|
||||
|
||||
for (const item of [...asSeller, ...asBuyer]) {
|
||||
for (const item of [...asSeller, ...asBuyer, ...asResolver]) {
|
||||
const pda = item.pubkey;
|
||||
if (seen.has(pda)) continue;
|
||||
seen.add(pda);
|
||||
|
||||
Reference in New Issue
Block a user