@@ -25,8 +25,8 @@ export class AddressStructureError extends Data.TaggedError("AddressStructureErr
2525 */
2626export class AddressStructure extends Schema . Class < AddressStructure > ( "AddressStructure" ) ( {
2727 networkId : NetworkId . NetworkId ,
28- paymentCredential : Credential . Credential ,
29- stakingCredential : Schema . optional ( Credential . Credential )
28+ paymentCredential : Credential . CredentialSchema ,
29+ stakingCredential : Schema . optional ( Credential . CredentialSchema )
3030} ) {
3131 toString ( ) : string {
3232 const staking = this . stakingCredential ? `, stakingCredential: ${ this . stakingCredential } ` : ""
@@ -47,7 +47,7 @@ export class AddressStructure extends Schema.Class<AddressStructure>("AddressStr
4747 */
4848export const FromBytes = Schema . transformOrFail (
4949 Schema . Union ( Bytes57 . BytesSchema , Bytes29 . BytesSchema ) ,
50- AddressStructure ,
50+ Schema . typeSchema ( AddressStructure ) ,
5151 {
5252 strict : true ,
5353 encode : ( _ , __ , ___ , toA ) =>
@@ -84,28 +84,28 @@ export const FromBytes = Schema.transformOrFail(
8484 if ( fromA . length === 57 ) {
8585 // BaseAddress (with staking credential)
8686 const isPaymentKey = ( addressTypeBits & 0b0001 ) === 0
87- const paymentCredential : Credential . Credential = isPaymentKey
87+ const paymentCredential : Credential . CredentialSchema = isPaymentKey
8888 ? new KeyHash . KeyHash ( { hash : fromA . slice ( 1 , 29 ) } )
8989 : new ScriptHash . ScriptHash ( { hash : fromA . slice ( 1 , 29 ) } )
9090
9191 const isStakeKey = ( addressTypeBits & 0b0010 ) === 0
92- const stakingCredential : Credential . Credential = isStakeKey
92+ const stakingCredential : Credential . CredentialSchema = isStakeKey
9393 ? new KeyHash . KeyHash ( { hash : fromA . slice ( 29 , 57 ) } )
9494 : new ScriptHash . ScriptHash ( { hash : fromA . slice ( 29 , 57 ) } )
9595
96- return yield * ParseResult . decode ( AddressStructure ) ( {
96+ return AddressStructure . make ( {
9797 networkId,
9898 paymentCredential,
9999 stakingCredential
100100 } )
101101 } else if ( fromA . length === 29 ) {
102102 // EnterpriseAddress (no staking credential)
103103 const isPaymentKey = ( addressTypeBits & 0b0001 ) === 0
104- const paymentCredential : Credential . Credential = isPaymentKey
104+ const paymentCredential : Credential . CredentialSchema = isPaymentKey
105105 ? new KeyHash . KeyHash ( { hash : fromA . slice ( 1 , 29 ) } )
106106 : new ScriptHash . ScriptHash ( { hash : fromA . slice ( 1 , 29 ) } )
107107
108- return yield * ParseResult . decode ( AddressStructure ) ( {
108+ return AddressStructure . make ( {
109109 networkId,
110110 paymentCredential,
111111 stakingCredential : undefined
@@ -135,7 +135,7 @@ export const FromHex = Schema.compose(Bytes.FromHex, FromBytes).annotations({
135135 * @since 1.0.0
136136 * @category Transformations
137137 */
138- export const FromBech32 = Schema . transformOrFail ( Schema . String , AddressStructure , {
138+ export const FromBech32 = Schema . transformOrFail ( Schema . String , Schema . typeSchema ( AddressStructure ) , {
139139 strict : true ,
140140 encode : ( _ , __ , ___ , toA ) =>
141141 Eff . gen ( function * ( ) {
0 commit comments