Skip to content

Commit a9fef80

Browse files
committed
feat: upgrade modules
1 parent aecf79e commit a9fef80

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+486
-618
lines changed

packages/evolution/src/core/AddressDetails.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class AddressDetails extends Schema.Class<AddressDetails>("AddressDetails
3131
hex: Bytes.HexSchema
3232
}) {}
3333

34-
export const FromBech32 = Schema.transformOrFail(Schema.String, AddressDetails, {
34+
export const FromBech32 = Schema.transformOrFail(Schema.String, Schema.typeSchema(AddressDetails), {
3535
strict: true,
3636
encode: (_, __, ___, toA) => ParseResult.succeed(toA.bech32),
3737
decode: (_, __, ___, fromA) =>
@@ -48,7 +48,7 @@ export const FromBech32 = Schema.transformOrFail(Schema.String, AddressDetails,
4848
})
4949
})
5050

51-
export const FromHex = Schema.transformOrFail(Bytes.HexSchema, AddressDetails, {
51+
export const FromHex = Schema.transformOrFail(Bytes.HexSchema, Schema.typeSchema(AddressDetails), {
5252
strict: true,
5353
encode: (_, __, ___, toA) => ParseResult.succeed(toA.hex),
5454
decode: (_, __, ___, fromA) =>

packages/evolution/src/core/AddressEras.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export type AddressEras = typeof AddressEras.Type
8686
* @since 2.0.0
8787
* @category schema
8888
*/
89-
export const FromBytes = Schema.transformOrFail(Schema.Uint8ArrayFromSelf, AddressEras, {
89+
export const FromBytes = Schema.transformOrFail(Schema.Uint8ArrayFromSelf, Schema.typeSchema(AddressEras), {
9090
strict: true,
9191
encode: (_, __, ___, toA) => {
9292
switch (toA._tag) {
@@ -156,7 +156,7 @@ export const FromHex = Schema.compose(Bytes.FromHex, FromBytes)
156156
* @since 2.0.0
157157
* @category schema
158158
*/
159-
export const FromBech32 = Schema.transformOrFail(Schema.String, AddressEras, {
159+
export const FromBech32 = Schema.transformOrFail(Schema.String, Schema.typeSchema(AddressEras), {
160160
strict: true,
161161
encode: (_, __, ast, toA) =>
162162
Eff.gen(function* () {

packages/evolution/src/core/AddressStructure.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class AddressStructure extends Schema.Class<AddressStructure>("AddressStr
4747
*/
4848
export const FromBytes = Schema.transformOrFail(
4949
Schema.Union(Bytes57.BytesSchema, Bytes29.BytesSchema),
50-
AddressStructure,
50+
Schema.typeSchema(AddressStructure),
5151
{
5252
strict: true,
5353
encode: (_, __, ___, toA) =>
@@ -93,7 +93,7 @@ export const FromBytes = Schema.transformOrFail(
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
@@ -105,7 +105,7 @@ export const FromBytes = Schema.transformOrFail(
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* () {

packages/evolution/src/core/Anchor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class AnchorError extends Data.TaggedError("AnchorError")<{
2828
*/
2929
export class Anchor extends Schema.Class<Anchor>("Anchor")({
3030
anchorUrl: Url.Url,
31-
anchorDataHash: Bytes32.BytesSchema
31+
anchorDataHash: Bytes32.BytesFromHex
3232
}) {}
3333

3434
export const CDDLSchema = Schema.Tuple(

packages/evolution/src/core/AssetName.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,16 @@ export class AssetNameError extends Data.TaggedError("AssetNameError")<{
2222
* @category model
2323
*/
2424
export class AssetName extends Schema.TaggedClass<AssetName>()("AssetName", {
25-
bytes: Bytes32.VariableBytes
26-
}) {
27-
toJSON(): string {
28-
return toHex(this)
29-
}
30-
toString(): string {
31-
return toHex(this)
32-
}
33-
}
25+
bytes: Bytes32.VariableBytesFromHex
26+
}) {}
3427

3528
/**
3629
* Schema for encoding/decoding AssetName as bytes.
3730
*
3831
* @since 2.0.0
3932
* @category schemas
4033
*/
41-
export const FromBytes = Schema.transform(Bytes32.VariableBytes, AssetName, {
34+
export const FromBytes = Schema.transform(Schema.typeSchema(Bytes32.VariableBytesFromHex), Schema.typeSchema(AssetName), {
4235
strict: true,
4336
decode: (bytes) => new AssetName({ bytes }, { disableValidation: true }),
4437
encode: (assetName) => assetName.bytes

packages/evolution/src/core/AuxiliaryDataHash.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ export class AuxiliaryDataHashError extends Data.TaggedError("AuxiliaryDataHashE
3131
* @category model
3232
*/
3333
export class AuxiliaryDataHash extends Schema.TaggedClass<AuxiliaryDataHash>()("AuxiliaryDataHash", {
34-
bytes: Bytes32.BytesSchema
34+
bytes: Bytes32.BytesFromHex
3535
}) {}
3636

37-
export const FromBytes = Schema.transform(Bytes32.BytesSchema, AuxiliaryDataHash, {
37+
export const FromBytes = Schema.transform(Schema.typeSchema(Bytes32.BytesFromHex), Schema.typeSchema(AuxiliaryDataHash), {
3838
strict: true,
3939
decode: (bytes) => new AuxiliaryDataHash({ bytes }, { disableValidation: true }),
4040
encode: (a) => a.bytes
@@ -43,7 +43,7 @@ export const FromBytes = Schema.transform(Bytes32.BytesSchema, AuxiliaryDataHash
4343
})
4444

4545
export const FromHex = Schema.compose(
46-
Bytes32.FromHex, // string -> Bytes32
46+
Bytes32.BytesFromHex, // string -> Bytes32
4747
FromBytes // Bytes32 -> AuxiliaryDataHash
4848
).annotations({
4949
identifier: "AuxiliaryDataHash.FromHex"

packages/evolution/src/core/BaseAddress.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class BaseAddress extends Schema.TaggedClass<BaseAddress>("BaseAddress")(
3333
}
3434
}
3535

36-
export const FromBytes = Schema.transformOrFail(Bytes57.BytesSchema, BaseAddress, {
36+
export const FromBytes = Schema.transformOrFail(Bytes57.BytesSchema, Schema.typeSchema(BaseAddress), {
3737
strict: true,
3838
encode: (_, __, ___, toA) =>
3939
Eff.gen(function* () {
@@ -72,8 +72,7 @@ export const FromBytes = Schema.transformOrFail(Bytes57.BytesSchema, BaseAddress
7272
: new ScriptHash.ScriptHash({
7373
hash: fromA.slice(29, 57)
7474
})
75-
return yield* ParseResult.decode(BaseAddress)({
76-
_tag: "BaseAddress",
75+
return BaseAddress.make({
7776
networkId,
7877
paymentCredential,
7978
stakeCredential

packages/evolution/src/core/Bip32PublicKey.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class Bip32PublicKeyError extends Data.TaggedError("Bip32PublicKeyError")
2929
* @category schemas
3030
*/
3131
export class Bip32PublicKey extends Schema.TaggedClass<Bip32PublicKey>()("Bip32PublicKey", {
32-
bytes: Bytes64.BytesSchema
32+
bytes: Bytes64.BytesFromHex
3333
}) {
3434
toJSON(): string {
3535
return toHex(this)
@@ -46,7 +46,7 @@ export class Bip32PublicKey extends Schema.TaggedClass<Bip32PublicKey>()("Bip32P
4646
* @since 2.0.0
4747
* @category schemas
4848
*/
49-
export const FromBytes = Schema.transform(Bytes64.BytesSchema, Bip32PublicKey, {
49+
export const FromBytes = Schema.transform(Schema.typeSchema(Bytes64.BytesFromHex), Schema.typeSchema(Bip32PublicKey), {
5050
strict: true,
5151
decode: (bytes) => new Bip32PublicKey({ bytes }, { disableValidation: true }),
5252
encode: (bip32PublicKey) => bip32PublicKey.bytes
@@ -61,7 +61,7 @@ export const FromBytes = Schema.transform(Bytes64.BytesSchema, Bip32PublicKey, {
6161
* @category schemas
6262
*/
6363
export const FromHex = Schema.compose(
64-
Bytes64.FromHex, // string -> Bytes64
64+
Bytes64.BytesFromHex, // string -> Bytes64
6565
FromBytes // Bytes64 -> Bip32PublicKey
6666
).annotations({
6767
identifier: "Bip32PublicKey.FromHex"

packages/evolution/src/core/BlockBodyHash.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class BlockBodyHashError extends Data.TaggedError("BlockBodyHashError")<{
2323
* @category model
2424
*/
2525
export class BlockBodyHash extends Schema.TaggedClass<BlockBodyHash>()("BlockBodyHash", {
26-
bytes: Bytes32.BytesSchema
26+
bytes: Bytes32.BytesFromHex
2727
}) {}
2828

2929
/**
@@ -32,7 +32,7 @@ export class BlockBodyHash extends Schema.TaggedClass<BlockBodyHash>()("BlockBod
3232
* @since 2.0.0
3333
* @category schemas
3434
*/
35-
export const FromBytes = Schema.transform(Bytes32.BytesSchema, BlockBodyHash, {
35+
export const FromBytes = Schema.transform(Schema.typeSchema(Bytes32.BytesFromHex), Schema.typeSchema(BlockBodyHash), {
3636
strict: true,
3737
decode: (bytes) => new BlockBodyHash({ bytes }, { disableValidation: true }),
3838
encode: (bbh) => bbh.bytes
@@ -47,7 +47,7 @@ export const FromBytes = Schema.transform(Bytes32.BytesSchema, BlockBodyHash, {
4747
* @category schemas
4848
*/
4949
export const FromHex = Schema.compose(
50-
Bytes32.FromHex, // string -> Bytes32
50+
Bytes32.BytesFromHex, // string -> Bytes32
5151
FromBytes // Bytes32 -> BlockBodyHash
5252
).annotations({
5353
identifier: "BlockBodyHash.FromHex"

packages/evolution/src/core/BlockHeaderHash.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class BlockHeaderHashError extends Data.TaggedError("BlockHeaderHashError
2323
* @category model
2424
*/
2525
export class BlockHeaderHash extends Schema.TaggedClass<BlockHeaderHash>()("BlockHeaderHash", {
26-
bytes: Bytes32.BytesSchema
26+
bytes: Bytes32.BytesFromHex
2727
}) {}
2828

2929
/**
@@ -32,7 +32,7 @@ export class BlockHeaderHash extends Schema.TaggedClass<BlockHeaderHash>()("Bloc
3232
* @since 2.0.0
3333
* @category schemas
3434
*/
35-
export const FromBytes = Schema.transform(Bytes32.BytesSchema, BlockHeaderHash, {
35+
export const FromBytes = Schema.transform(Schema.typeSchema(Bytes32.BytesFromHex), Schema.typeSchema(BlockHeaderHash), {
3636
strict: true,
3737
decode: (bytes) => new BlockHeaderHash({ bytes }, { disableValidation: true }),
3838
encode: (bhh) => bhh.bytes
@@ -47,7 +47,7 @@ export const FromBytes = Schema.transform(Bytes32.BytesSchema, BlockHeaderHash,
4747
* @category schemas
4848
*/
4949
export const FromHex = Schema.compose(
50-
Bytes32.FromHex, // string -> Bytes32
50+
Bytes32.BytesFromHex, // string -> Bytes32
5151
FromBytes // Bytes32 -> BlockHeaderHash
5252
).annotations({
5353
identifier: "BlockHeaderHash.FromHex"

0 commit comments

Comments
 (0)