Skip to content

Commit afbd96d

Browse files
committed
fix(ts-sdk-sui): type errors
Signed-off-by: Eric Hegnes <[email protected]>
1 parent de77b97 commit afbd96d

File tree

6 files changed

+355
-208
lines changed

6 files changed

+355
-208
lines changed

pnpm-lock.yaml

Lines changed: 338 additions & 191 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ts-sdk-sui/src/Sui.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,7 @@ export const readCoinMetadata = (tokenAddress: Address) =>
283283
const result = await client.getCoinMetadata({ coinType: tokenAddress })
284284
return result
285285
},
286-
catch: err =>
287-
new Error({
288-
cause: extractErrorDetails(err as ReadCoinError),
289-
}),
286+
catch: cause => new ReadCoinError({ cause }),
290287
})
291288
return metadata
292289
})

ts-sdk-sui/src/internal/sui.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { SuiClient, SuiClientOptions } from "@mysten/sui/client"
22
import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519"
33
import * as Utils from "@unionlabs/sdk/Utils"
44
import { Context, Effect, Layer, pipe } from "effect"
5-
import * as V from "viem"
65
import * as Sui from "../Sui.js"
76

87
/** @internal */

ts-sdk-sui/src/internal/zkgmClient.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { Match, ParseResult, pipe, Predicate } from "effect"
1414
import * as A from "effect/Array"
1515
import * as Effect from "effect/Effect"
1616
import * as Inspectable from "effect/Inspectable"
17+
import * as Option from "effect/Option"
1718
import * as S from "effect/Schema"
1819
import * as Stream from "effect/Stream"
1920
import * as Sui from "../Sui.js"
@@ -30,7 +31,10 @@ export const fromWallet = (
3031

3132
const encodeInstruction: (
3233
u: ZkgmInstruction.ZkgmInstruction,
33-
) => Effect.Effect<Ucs03.Ucs03, ParseResult.ParseError | Sui.ReadContractError> = pipe(
34+
) => Effect.Effect<
35+
Ucs03.Ucs03,
36+
ParseResult.ParseError | Sui.ReadContractError | Sui.ReadCoinError
37+
> = pipe(
3438
Match.type<ZkgmInstruction.ZkgmInstruction>(),
3539
Match.tagsExhaustive({
3640
Batch: (batch) =>
@@ -242,6 +246,7 @@ export class ClientResponseImpl extends IncomingMessageImpl<ClientError.Response
242246
implements ClientResponse.ZkgmClientResponse
243247
{
244248
readonly [ClientResponse.TypeId]: ClientResponse.TypeId
249+
readonly safeHash = Option.none()
245250

246251
constructor(
247252
readonly request: ClientRequest.ZkgmClientRequest,

ts-sdk/src/internal/sui.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,14 @@ export const walletClientLayer = <
3434
): Layer.Layer<Id, Sui.CreateWalletClientError> =>
3535
Layer.effect(
3636
tag,
37-
pipe(
38-
Effect.try({
39-
try: () => ({
40-
client: new SuiClient(options),
41-
signer,
42-
}),
43-
catch: (err) =>
44-
new Sui.CreateWalletClientError({
45-
cause: extractErrorDetails(err as Sui.CreateWalletClientErrorType),
46-
}),
37+
Effect.try({
38+
try: () => ({
39+
client: new SuiClient(options),
40+
signer,
4741
}),
48-
),
42+
catch: (err) =>
43+
new Sui.CreateWalletClientError({
44+
cause: extractErrorDetails(err as Sui.CreateWalletClientErrorType),
45+
}),
46+
}),
4947
)

tsconfig.build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{ "path": "sentinel2/tsconfig.build.json" },
66
{ "path": "ts-sdk-cosmos/tsconfig.build.json" },
77
{ "path": "ts-sdk-evm/tsconfig.build.json" },
8+
{ "path": "ts-sdk-sui/tsconfig.build.json" },
89
{ "path": "ts-sdk/tsconfig.build.json" }
910
]
1011
}

0 commit comments

Comments
 (0)