diff --git a/src/blockchain/index.ts b/src/blockchain/index.ts index f1a4bc26..8bdc5cd8 100644 --- a/src/blockchain/index.ts +++ b/src/blockchain/index.ts @@ -70,6 +70,10 @@ export class Blockchain { return this.#head } + get pendingExtrinsics(): HexString[] { + return this.#txpool.pendingExtrinsics + } + async getBlockAt(number?: number): Promise { if (number === undefined) { return this.head diff --git a/src/blockchain/txpool.ts b/src/blockchain/txpool.ts index a777d517..cdfaf49b 100644 --- a/src/blockchain/txpool.ts +++ b/src/blockchain/txpool.ts @@ -39,6 +39,10 @@ export class TxPool { this.#inherentProvider = inherentProvider } + get pendingExtrinsics(): HexString[] { + return this.#pool + } + submitExtrinsic(extrinsic: HexString) { this.#pool.push(extrinsic) diff --git a/src/rpc/substrate/author.ts b/src/rpc/substrate/author.ts index c8765cc7..57db6eab 100644 --- a/src/rpc/substrate/author.ts +++ b/src/rpc/substrate/author.ts @@ -43,7 +43,9 @@ const handlers: Handlers = { author_unwatchExtrinsic: async (_context, [subid], { unsubscribe }) => { unsubscribe(subid) }, - author_pendingExtrinsics: async (_context) => [], + author_pendingExtrinsics: async (context) => { + return context.chain.pendingExtrinsics + }, } export default handlers