@@ -10,6 +10,7 @@ import type { Hex } from "../../../../utils/encoding/hex.js";
1010import { randomBytesHex } from "../../../../utils/random.js" ;
1111import type { PreparedSendCall } from "../../../eip5792/send-calls.js" ;
1212import type {
13+ GetCallsStatusRawResponse ,
1314 GetCallsStatusResponse ,
1415 WalletCallReceipt ,
1516} from "../../../eip5792/types.js" ;
@@ -108,3 +109,52 @@ export async function inAppWalletGetCallsStatus(args: {
108109 version : "2.0.0" ,
109110 } ;
110111}
112+
113+ /**
114+ * @internal
115+ */
116+ export async function inAppWalletGetCallsStatusRaw ( args : {
117+ chain : Chain ;
118+ client : ThirdwebClient ;
119+ id : string ;
120+ } ) : Promise < GetCallsStatusRawResponse > {
121+ const { chain, client, id } = args ;
122+
123+ const bundle = bundlesToTransactions . get ( id ) ;
124+ if ( ! bundle ) {
125+ throw new Error ( "Failed to get calls status, unknown bundle id" ) ;
126+ }
127+
128+ const request = getRpcClient ( { chain, client } ) ;
129+ let status = 200 ; // BATCH_STATE_CONFIRMED
130+ const receipts : GetCallsStatusRawResponse [ "receipts" ] = [ ] ;
131+
132+ for ( const hash of bundle ) {
133+ try {
134+ const receipt = await eth_getTransactionReceipt ( request , { hash } ) ;
135+ receipts . push ( {
136+ blockHash : receipt . blockHash ,
137+ blockNumber : `0x${ receipt . blockNumber . toString ( 16 ) } ` as `0x${string } `,
138+ gasUsed : `0x${ receipt . gasUsed . toString ( 16 ) } ` as `0x${string } `,
139+ logs : receipt . logs . map ( ( l ) => ( {
140+ address : l . address as `0x${string } `,
141+ data : l . data as `0x${string } `,
142+ topics : l . topics as `0x${string } `[ ] ,
143+ } ) ) ,
144+ status : receipt . status === "success" ? "0x1" : "0x0" ,
145+ transactionHash : receipt . transactionHash as `0x${string } `,
146+ } ) ;
147+ } catch {
148+ status = 100 ; // BATCH_STATE_PENDING
149+ }
150+ }
151+
152+ return {
153+ atomic : false ,
154+ chainId : `0x${ chain . id . toString ( 16 ) } ` as `0x${string } `,
155+ id : id as `0x${string } `,
156+ receipts,
157+ status,
158+ version : "2.0.0" ,
159+ } ;
160+ }
0 commit comments