22// SPDX-License-Identifier: Apache-2.0
33
44import type { EcdsaSignature , Ed25519Signature , ExtrinsicEra , ExtrinsicSignature , Sr25519Signature } from '../../interfaces/extrinsics' ;
5- import type { Address , Balance , Call , Index } from '../../interfaces/runtime' ;
5+ import type { Address , AssetId , Balance , Call , Index } from '../../interfaces/runtime' ;
66import type { ExtrinsicPayloadValue , IExtrinsicSignature , IKeyringPair , Registry , SignatureOptions } from '../../types' ;
77import type { ExtrinsicSignatureOptions } from '../types' ;
88
99import { assert , isU8a , stringify , u8aConcat , u8aToHex } from '@polkadot/util' ;
1010
1111import { Compact } from '../../codec/Compact' ;
1212import { Enum } from '../../codec/Enum' ;
13+ import { Option } from '../../codec/Option' ;
1314import { Struct } from '../../codec/Struct' ;
1415import { EMPTY_U8A , IMMORTAL_ERA } from '../constants' ;
1516import { GenericExtrinsicPayloadV4 } from './ExtrinsicPayload' ;
@@ -114,12 +115,21 @@ export class GenericExtrinsicSignatureV4 extends Struct implements IExtrinsicSig
114115 return this . get ( 'tip' ) as Compact < Balance > ;
115116 }
116117
117- protected _injectSignature ( signer : Address , signature : ExtrinsicSignature , { era, nonce, tip } : GenericExtrinsicPayloadV4 ) : IExtrinsicSignature {
118+ /**
119+ * @description
120+ * The (optional) asset id for this signature for chains that support transaction fees in assets
121+ */
122+ public get assetId ( ) : Option < AssetId > {
123+ return this . get ( 'assetId' ) as Option < AssetId > ;
124+ }
125+
126+ protected _injectSignature ( signer : Address , signature : ExtrinsicSignature , { assetId, era, nonce, tip } : GenericExtrinsicPayloadV4 ) : IExtrinsicSignature {
118127 this . set ( 'era' , era ) ;
119128 this . set ( 'nonce' , nonce ) ;
120129 this . set ( 'signer' , signer ) ;
121130 this . set ( 'signature' , signature ) ;
122131 this . set ( 'tip' , tip ) ;
132+ this . set ( 'assetId' , assetId ) ;
123133
124134 return this ;
125135 }
@@ -138,8 +148,9 @@ export class GenericExtrinsicSignatureV4 extends Struct implements IExtrinsicSig
138148 /**
139149 * @description Creates a payload from the supplied options
140150 */
141- public createPayload ( method : Call , { blockHash, era, genesisHash, nonce, runtimeVersion : { specVersion, transactionVersion } , tip } : SignatureOptions ) : GenericExtrinsicPayloadV4 {
151+ public createPayload ( method : Call , { assetId , blockHash, era, genesisHash, nonce, runtimeVersion : { specVersion, transactionVersion } , tip } : SignatureOptions ) : GenericExtrinsicPayloadV4 {
142152 return new GenericExtrinsicPayloadV4 ( this . registry , {
153+ assetId,
143154 blockHash,
144155 era : era || IMMORTAL_ERA ,
145156 genesisHash,
0 commit comments