3

Given an ata, I need to fetch all signatures and then all transaction. With the solana spl-token lib I used the below:

    const proceedsAddress = getProceedsAddress(program.programId, pubkey);
    const signatures = await connection.getSignaturesForAddress(
     proceedsAddress
    );

    const transactions = await connection.getParsedTransactions(
      signatures.map((item) => item.signature),
      'finalized',
    );

However, it doesn't look like the UMI rpc property has the above used methods. Is there a way to access those methods using the UMI libraries?

1 Answer 1

3

Unfortunately, Umi doesn't currently support these methods in its RpcInterface but, for now, you have the following options:

Option 1: Use the catch-all umi.rpc.call method by passing the name of the RPC method as the first parameter and its parameters as an array in the second argument.

await umi.rpc.call("getSignaturesForAddress", [proceedsAddress]);

Option 2: Access the underlying connection object. Since right now, there's only one implementation of the RpcInterface and it uses the Connection class under the hood, you can access it via umi.rpc.connection. You'll have to tell TypeScript to trust you like so:

const { connection } = umi.rpc as { connection: Connection };
await connection.getSignaturesForAddress(proceedsAddress);
1
  • In option 1, the signature call worked but getParsedTransactions did not. Extracting connection from the umi.rpc and calling getParseTransactions did the trick. Thank you
    – Hyetigran
    Jan 18 at 4:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.