33// This software may be modified and distributed under the terms
44// of the Apache-2.0 license. See the LICENSE file for details.
55
6- import { AccountId , Address , Call , ExtrinsicEra , ExtrinsicStatus , Hash , Header , Index , RuntimeDispatchInfo } from '@polkadot/types/interfaces' ;
6+ import { Address , Call , ExtrinsicEra , ExtrinsicStatus , Hash , Header , Index , RuntimeDispatchInfo } from '@polkadot/types/interfaces' ;
77import { Callback , Codec , Constructor , IKeyringPair , Registry , SignatureOptions } from '@polkadot/types/types' ;
88import { ApiInterfaceRx , ApiTypes , SignerResult } from '../types' ;
9- import { SignerOptions , SubmittableExtrinsic , SubmittablePaymentResult , SubmittableResultImpl , SubmittableResultResult , SubmittableResultSubscription , SubmittableThis } from './types' ;
9+ import { AddressOrPair , SignerOptions , SubmittableExtrinsic , SubmittablePaymentResult , SubmittableResultImpl , SubmittableResultResult , SubmittableResultSubscription , SubmittableThis } from './types' ;
1010
1111import { Observable , combineLatest , of } from 'rxjs' ;
1212import { first , map , mapTo , mergeMap , switchMap , tap } from 'rxjs/operators' ;
@@ -50,7 +50,7 @@ export default function createClass <ApiType extends ApiTypes> ({ api, apiType,
5050 }
5151
5252 // calculate the payment info for this transaction (if signed and submitted)
53- public paymentInfo ( account : IKeyringPair | string | AccountId | Address , options ?: Partial < SignerOptions > ) : SubmittablePaymentResult < ApiType > {
53+ public paymentInfo ( account : AddressOrPair , options ?: Partial < SignerOptions > ) : SubmittablePaymentResult < ApiType > {
5454 const [ allOptions ] = this . _makeSignAndSendOptions ( options ) ;
5555 const address = isKeyringPair ( account ) ? account . address : account . toString ( ) ;
5656
@@ -82,24 +82,24 @@ export default function createClass <ApiType extends ApiTypes> ({ api, apiType,
8282 // signs a transaction, returning `this` to allow chaining. E.g.: `sign(...).send()`
8383 //
8484 // also supports signing through external signers
85- public signAsync ( account : IKeyringPair | string | AccountId | Address , optionsOrNonce : Partial < SignerOptions > ) : SubmittableThis < ApiType , this> {
85+ public signAsync ( account : AddressOrPair , optionsOrNonce : Partial < SignerOptions > ) : SubmittableThis < ApiType , this> {
8686 return this . _decorateMethod (
8787 ( ) : Observable < this> =>
8888 this . _signObservable ( account , optionsOrNonce ) . pipe ( mapTo ( this ) )
8989 ) ( ) ;
9090 }
9191
9292 // signAndSend with an immediate Hash result
93- public signAndSend ( account : IKeyringPair | string | AccountId | Address , options ?: Partial < SignerOptions > ) : SubmittableResultResult < ApiType > ;
93+ public signAndSend ( account : AddressOrPair , options ?: Partial < SignerOptions > ) : SubmittableResultResult < ApiType > ;
9494
9595 // signAndSend with a subscription, i.e. callback provided
96- public signAndSend ( account : IKeyringPair | string | AccountId | Address , statusCb : Callback < SubmittableResultImpl > ) : SubmittableResultSubscription < ApiType > ;
96+ public signAndSend ( account : AddressOrPair , statusCb : Callback < SubmittableResultImpl > ) : SubmittableResultSubscription < ApiType > ;
9797
9898 // signAndSend with options and a callback
99- public signAndSend ( account : IKeyringPair | string | AccountId | Address , options : Partial < SignerOptions > , statusCb ?: Callback < SubmittableResultImpl > ) : SubmittableResultSubscription < ApiType > ;
99+ public signAndSend ( account : AddressOrPair , options : Partial < SignerOptions > , statusCb ?: Callback < SubmittableResultImpl > ) : SubmittableResultSubscription < ApiType > ;
100100
101101 // signAndSend implementation for all 3 cases above
102- public signAndSend ( account : IKeyringPair | string | AccountId | Address , optionsOrStatus ?: Partial < SignerOptions > | Callback < SubmittableResultImpl > , optionalStatusCb ?: Callback < SubmittableResultImpl > ) : SubmittableResultResult < ApiType > | SubmittableResultSubscription < ApiType > {
102+ public signAndSend ( account : AddressOrPair , optionsOrStatus ?: Partial < SignerOptions > | Callback < SubmittableResultImpl > , optionalStatusCb ?: Callback < SubmittableResultImpl > ) : SubmittableResultResult < ApiType > | SubmittableResultSubscription < ApiType > {
103103 const [ options , statusCb ] = this . _makeSignAndSendOptions ( optionsOrStatus , optionalStatusCb ) ;
104104 const isSubscription = this . _api . hasSubscriptions && ( this . _ignoreStatusCb || ! ! statusCb ) ;
105105
@@ -144,7 +144,7 @@ export default function createClass <ApiType extends ApiTypes> ({ api, apiType,
144144 return [ options , statusCb ] ;
145145 }
146146
147- private _signObservable ( account : IKeyringPair | string | AccountId | Address , optionsOrNonce : Partial < SignerOptions > ) : Observable < number | undefined > {
147+ private _signObservable ( account : AddressOrPair , optionsOrNonce : Partial < SignerOptions > ) : Observable < number | undefined > {
148148 const address = isKeyringPair ( account ) ? account . address : account . toString ( ) ;
149149 const options = this . _optionsOrNonce ( optionsOrNonce ) ;
150150 let updateId : number | undefined ;
@@ -164,7 +164,7 @@ export default function createClass <ApiType extends ApiTypes> ({ api, apiType,
164164 ) ;
165165 }
166166
167- private async _signViaSigner ( address : | string | AccountId | Address , options : SignatureOptions , header : Header | null ) : Promise < number > {
167+ private async _signViaSigner ( address : Address | string | Uint8Array , options : SignatureOptions , header : Header | null ) : Promise < number > {
168168 const signer = options . signer || this . _api . signer ;
169169
170170 assert ( signer , 'No signer specified, either via api.setSigner or via sign options' ) ;
0 commit comments