1+ import { DEFAULT_EXTRINSIC_VERSION , type SignedExtensionDefLatest } from '@dedot/codecs' ;
12import * as $ from '@dedot/shape' ;
23import { SignerPayloadJSON , SignerPayloadRaw } from '@dedot/types' ;
34import { ensurePresence , HexString , u8aToHex } from '@dedot/utils' ;
4- import { ISignedExtension , SignedExtension } from './SignedExtension.js' ;
55import { FallbackSignedExtension , isEmptyStructOrTuple } from './FallbackSignedExtension.js' ;
6+ import { ISignedExtension , SignedExtension } from './SignedExtension.js' ;
67import { knownSignedExtensions } from './known/index.js' ;
7- import type { SignedExtensionDefLatest } from '@dedot/codecs' ;
88
99export class ExtraSignedExtension extends SignedExtension < any [ ] , any [ ] > {
1010 #signedExtensions?: ISignedExtension [ ] ;
@@ -23,13 +23,11 @@ export class ExtraSignedExtension extends SignedExtension<any[], any[]> {
2323 }
2424
2525 get $Data ( ) : $ . AnyShape {
26- const { extraTypeId } = this . registry . metadata . extrinsic ;
27-
28- return ensurePresence ( this . registry . findCodec ( extraTypeId ) ) ;
26+ return ensurePresence ( this . registry . createExtraCodec ( DEFAULT_EXTRINSIC_VERSION ) ) ;
2927 }
3028
3129 get $AdditionalSigned ( ) : $ . AnyShape {
32- const $AdditionalSignedCodecs = this . #signedExtensionDefs. map ( ( se ) => this . registry . findCodec ( se . additionalSigned ) ) ;
30+ const $AdditionalSignedCodecs = this . #signedExtensionDefs. map ( ( se ) => this . registry . findCodec ( se . implicit ) ) ;
3331
3432 return $ . Tuple ( ...$AdditionalSignedCodecs ) ;
3533 }
@@ -42,16 +40,16 @@ export class ExtraSignedExtension extends SignedExtension<any[], any[]> {
4240 }
4341
4442 get #signedExtensionDefs( ) {
45- return this . registry . metadata . extrinsic . signedExtensions ;
43+ return this . registry . metadata . extrinsic . transactionExtensions ;
4644 }
4745
4846 #getSignedExtensions( ) {
4947 return this . #signedExtensionDefs. map ( ( extDef ) => {
5048 const { signedExtensions : userSignedExtensions = { } } = this . client . options ;
5149
5250 const Extension =
53- userSignedExtensions [ extDef . ident as keyof typeof knownSignedExtensions ] ||
54- knownSignedExtensions [ extDef . ident as keyof typeof knownSignedExtensions ] ;
51+ userSignedExtensions [ extDef . identifier as keyof typeof knownSignedExtensions ] ||
52+ knownSignedExtensions [ extDef . identifier as keyof typeof knownSignedExtensions ] ;
5553
5654 if ( Extension ) {
5755 return new Extension ( this . client , {
@@ -65,12 +63,12 @@ export class ExtraSignedExtension extends SignedExtension<any[], any[]> {
6563 ...ensurePresence ( this . options ) ,
6664 def : extDef ,
6765 } ,
68- extDef . ident
66+ extDef . identifier ,
6967 ) ;
7068 }
7169
7270 // For extensions that require input but aren't implemented, throw an error
73- throw new Error ( `SignedExtension for ${ extDef . ident } requires input but is not implemented` ) ;
71+ throw new Error ( `SignedExtension for ${ extDef . identifier } requires input but is not implemented` ) ;
7472 } ) ;
7573 }
7674
@@ -80,10 +78,7 @@ export class ExtraSignedExtension extends SignedExtension<any[], any[]> {
8078 * @returns boolean
8179 */
8280 private isRequireNoExternalInputs ( extDef : SignedExtensionDefLatest ) : boolean {
83- return (
84- isEmptyStructOrTuple ( this . registry , extDef . typeId ) &&
85- isEmptyStructOrTuple ( this . registry , extDef . additionalSigned )
86- ) ;
81+ return isEmptyStructOrTuple ( this . registry , extDef . typeId ) && isEmptyStructOrTuple ( this . registry , extDef . implicit ) ;
8782 }
8883
8984 toPayload ( call : HexString = '0x' ) : SignerPayloadJSON {
0 commit comments