|
@@ -2,11 +2,12 @@ import { Filter, FilterResult } from './pool-filters';
|
|
import { Connection, PublicKey } from '@solana/web3.js';
|
|
import { Connection, PublicKey } from '@solana/web3.js';
|
|
import { LiquidityPoolKeysV4 } from '@raydium-io/raydium-sdk';
|
|
import { LiquidityPoolKeysV4 } from '@raydium-io/raydium-sdk';
|
|
import { getPdaMetadataKey } from '@raydium-io/raydium-sdk';
|
|
import { getPdaMetadataKey } from '@raydium-io/raydium-sdk';
|
|
-import { getMetadataAccountDataSerializer, MetadataAccountData } from '@metaplex-foundation/mpl-token-metadata';
|
|
|
|
|
|
+import { getMetadataAccountDataSerializer, MetadataAccountData, MetadataAccountDataArgs } from '@metaplex-foundation/mpl-token-metadata';
|
|
|
|
+import { Serializer } from '@metaplex-foundation/umi/serializers';
|
|
import { logger } from '../helpers';
|
|
import { logger } from '../helpers';
|
|
|
|
|
|
export class MutableFilter implements Filter {
|
|
export class MutableFilter implements Filter {
|
|
- constructor(private readonly connection: Connection) {}
|
|
|
|
|
|
+ constructor(private readonly connection: Connection, private readonly metadataSerializer: Serializer<MetadataAccountDataArgs, MetadataAccountData>) {}
|
|
|
|
|
|
async execute(poolKeys: LiquidityPoolKeysV4): Promise<FilterResult> {
|
|
async execute(poolKeys: LiquidityPoolKeysV4): Promise<FilterResult> {
|
|
try {
|
|
try {
|
|
@@ -15,7 +16,7 @@ export class MutableFilter implements Filter {
|
|
if (!metadataAccount?.data) {
|
|
if (!metadataAccount?.data) {
|
|
return { ok: false, message: 'Mutable -> Failed to fetch account data' };
|
|
return { ok: false, message: 'Mutable -> Failed to fetch account data' };
|
|
}
|
|
}
|
|
- const deserialize = getMetadataAccountDataSerializer().deserialize(metadataAccount.data);
|
|
|
|
|
|
+ const deserialize = this.metadataSerializer.deserialize(metadataAccount.data);
|
|
const mutable = deserialize[0].isMutable;
|
|
const mutable = deserialize[0].isMutable;
|
|
|
|
|
|
return { ok: !mutable, message: !mutable ? undefined : "Mutable -> Creator can change metadata" };
|
|
return { ok: !mutable, message: !mutable ? undefined : "Mutable -> Creator can change metadata" };
|