Skip to content

Commit e0bc87b

Browse files
Merge pull request #37 from no-witness-labs/feat/upgrade-modules-7
feat: upgrade modules; add sdk directory
2 parents d5cc29a + 4d9daa7 commit e0bc87b

File tree

172 files changed

+2288
-312
lines changed

Some content is hidden

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

172 files changed

+2288
-312
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ docs/.next
1515

1616
# Ignore debug
1717
debug/
18+
CLAUDE.md

packages/evolution/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"typescript": "^5.9.2"
4646
},
4747
"dependencies": {
48+
"@effect/platform": "^0.90.6",
4849
"@effect/platform-node": "^0.96.0",
4950
"@noble/hashes": "^1.8.0",
5051
"@scure/base": "^1.2.6",

packages/evolution/src/AddressDetails.ts renamed to packages/evolution/src/core/AddressDetails.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Data, Effect as Eff, ParseResult, Schema } from "effect"
22

3-
import * as Address from "./Address.js"
3+
import * as AddressEras from "./AddressEras.js"
44
import * as Bytes from "./Bytes.js"
55
import * as Function from "./Function.js"
66
import * as NetworkId from "./NetworkId.js"
@@ -26,7 +26,7 @@ export class AddressDetails extends Schema.Class<AddressDetails>("AddressDetails
2626
Schema.Literal("RewardAccount"),
2727
Schema.Literal("ByronAddress")
2828
),
29-
address: Address.Address,
29+
address: AddressEras.AddressEras,
3030
bech32: Schema.String,
3131
hex: Bytes.HexSchema
3232
}) {}
@@ -36,8 +36,8 @@ export const FromBech32 = Schema.transformOrFail(Schema.String, AddressDetails,
3636
encode: (_, __, ___, toA) => ParseResult.succeed(toA.bech32),
3737
decode: (_, __, ___, fromA) =>
3838
Eff.gen(function* () {
39-
const address = yield* ParseResult.decode(Address.FromBech32)(fromA)
40-
const hex = yield* ParseResult.encode(Address.FromHex)(address)
39+
const address = yield* ParseResult.decode(AddressEras.FromBech32)(fromA)
40+
const hex = yield* ParseResult.encode(AddressEras.FromHex)(address)
4141
return new AddressDetails({
4242
networkId: address.networkId,
4343
type: address._tag,
@@ -53,8 +53,8 @@ export const FromHex = Schema.transformOrFail(Bytes.HexSchema, AddressDetails, {
5353
encode: (_, __, ___, toA) => ParseResult.succeed(toA.hex),
5454
decode: (_, __, ___, fromA) =>
5555
Eff.gen(function* () {
56-
const address = yield* ParseResult.decode(Address.FromHex)(fromA)
57-
const bech32 = yield* ParseResult.encode(Address.FromBech32)(address)
56+
const address = yield* ParseResult.decode(AddressEras.FromHex)(fromA)
57+
const bech32 = yield* ParseResult.encode(AddressEras.FromBech32)(address)
5858
return new AddressDetails({
5959
networkId: address.networkId,
6060
type: address._tag,
@@ -83,7 +83,7 @@ export const equals = (self: AddressDetails, that: AddressDetails): boolean => {
8383
return (
8484
self.networkId === that.networkId &&
8585
self.type === that.type &&
86-
Address.equals(self.address, that.address) &&
86+
AddressEras.equals(self.address, that.address) &&
8787
self.bech32 === that.bech32 &&
8888
self.hex === that.hex
8989
)
@@ -95,18 +95,18 @@ export const equals = (self: AddressDetails, that: AddressDetails): boolean => {
9595
* @since 2.0.0
9696
* @category arbitrary
9797
*/
98-
export const arbitrary = Address.arbitrary.map((address) => fromAddress(address))
98+
export const arbitrary = AddressEras.arbitrary.map((address) => fromAddress(address))
9999

100100
/**
101101
* Create AddressDetails from an Address.
102102
*
103103
* @since 2.0.0
104104
* @category constructors
105105
*/
106-
export const fromAddress = (address: Address.Address): AddressDetails => {
106+
export const fromAddress = (address: AddressEras.AddressEras): AddressDetails => {
107107
// Use schema encoding to get the serialized formats
108-
const bech32 = Eff.runSync(Schema.encode(Address.FromBech32)(address))
109-
const hex = Eff.runSync(Schema.encode(Address.FromHex)(address))
108+
const bech32 = Eff.runSync(Schema.encode(AddressEras.FromBech32)(address))
109+
const hex = Eff.runSync(Schema.encode(AddressEras.FromHex)(address))
110110
return new AddressDetails({
111111
networkId: address.networkId,
112112
type: address._tag,

packages/evolution/src/Address.ts renamed to packages/evolution/src/core/AddressEras.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,29 +62,31 @@ export class AddressError extends Data.TaggedError("AddressError")<{
6262
* @since 2.0.0
6363
* @category model
6464
*/
65-
export const Address = Schema.Union(
65+
export const AddressEras = Schema.Union(
6666
BaseAddress.BaseAddress,
6767
EnterpriseAddress.EnterpriseAddress,
6868
PointerAddress.PointerAddress,
6969
RewardAccount.RewardAccount,
7070
ByronAddress.ByronAddress
7171
)
7272

73+
export const isAddress = Schema.is(AddressEras)
74+
7375
/**
7476
* Type representing an address.
7577
*
7678
* @since 2.0.0
7779
* @category model
7880
*/
79-
export type Address = typeof Address.Type
81+
export type AddressEras = typeof AddressEras.Type
8082

8183
/**
8284
* Schema for encoding/decoding addresses as bytes.
8385
*
8486
* @since 2.0.0
8587
* @category schema
8688
*/
87-
export const FromBytes = Schema.transformOrFail(Schema.Uint8ArrayFromSelf, Address, {
89+
export const FromBytes = Schema.transformOrFail(Schema.Uint8ArrayFromSelf, AddressEras, {
8890
strict: true,
8991
encode: (_, __, ___, toA) => {
9092
switch (toA._tag) {
@@ -154,7 +156,7 @@ export const FromHex = Schema.compose(Bytes.FromHex, FromBytes)
154156
* @since 2.0.0
155157
* @category schema
156158
*/
157-
export const FromBech32 = Schema.transformOrFail(Schema.String, Address, {
159+
export const FromBech32 = Schema.transformOrFail(Schema.String, AddressEras, {
158160
strict: true,
159161
encode: (_, __, ast, toA) =>
160162
Eff.gen(function* () {
@@ -206,7 +208,7 @@ export const FromBech32 = Schema.transformOrFail(Schema.String, Address, {
206208
* @since 2.0.0
207209
* @category utils
208210
*/
209-
export const equals = (a: Address, b: Address): boolean => {
211+
export const equals = (a: AddressEras, b: AddressEras): boolean => {
210212
if (a._tag !== b._tag) {
211213
return false
212214
}

0 commit comments

Comments
 (0)