@@ -21,6 +21,7 @@ import { SubmittableResult } from './Result';
2121interface SubmittableOptions < ApiType extends ApiTypes > {
2222 api : ApiInterfaceRx ;
2323 apiType : ApiTypes ;
24+ blockHash ?: Uint8Array ;
2425 decorateMethod : ApiBase < ApiType > [ '_decorateMethod' ] ;
2526}
2627
@@ -80,7 +81,7 @@ function optionsOrNonce (partialOptions: Partial<SignerOptions> = {}): Partial<S
8081 : partialOptions ;
8182}
8283
83- export function createClass < ApiType extends ApiTypes > ( { api, apiType, decorateMethod } : SubmittableOptions < ApiType > ) : Constructor < SubmittableExtrinsic < ApiType > > {
84+ export function createClass < ApiType extends ApiTypes > ( { api, apiType, blockHash , decorateMethod } : SubmittableOptions < ApiType > ) : Constructor < SubmittableExtrinsic < ApiType > > {
8485 // an instance of the base extrinsic for us to extend
8586 const ExtrinsicBase = api . registry . createClass ( 'Extrinsic' ) ;
8687
@@ -97,10 +98,10 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
9798
9899 // dry run an extrinsic
99100 public dryRun ( account : AddressOrPair , optionsOrHash ?: Partial < SignerOptions > | Uint8Array | string ) : SubmittableDryRunResult < ApiType > {
100- if ( isString ( optionsOrHash ) || isU8a ( optionsOrHash ) ) {
101+ if ( blockHash || isString ( optionsOrHash ) || isU8a ( optionsOrHash ) ) {
101102 // eslint-disable-next-line @typescript-eslint/no-unsafe-return
102103 return decorateMethod (
103- ( ) => api . rpc . system . dryRun ( this . toHex ( ) , optionsOrHash )
104+ ( ) => api . rpc . system . dryRun ( this . toHex ( ) , blockHash || optionsOrHash as string )
104105 ) ;
105106 }
106107
@@ -115,10 +116,10 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
115116
116117 // calculate the payment info for this transaction (if signed and submitted)
117118 public paymentInfo ( account : AddressOrPair , optionsOrHash ?: Partial < SignerOptions > | Uint8Array | string ) : SubmittablePaymentResult < ApiType > {
118- if ( isString ( optionsOrHash ) || isU8a ( optionsOrHash ) ) {
119+ if ( blockHash || isString ( optionsOrHash ) || isU8a ( optionsOrHash ) ) {
119120 // eslint-disable-next-line @typescript-eslint/no-unsafe-return
120121 return decorateMethod (
121- ( ) : Observable < RuntimeDispatchInfo > => api . rpc . payment . queryInfo ( this . toHex ( ) , optionsOrHash )
122+ ( ) : Observable < RuntimeDispatchInfo > => api . rpc . payment . queryInfo ( this . toHex ( ) , blockHash || optionsOrHash as string )
122123 ) ;
123124 }
124125
0 commit comments