Skip to content

Commit 09e3efc

Browse files
committed
Avoid using as for type setting
1 parent 25ff751 commit 09e3efc

3 files changed

Lines changed: 18 additions & 12 deletions

File tree

packages/wdk/src/sequence/handlers/devices.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@ export class DevicesHandler implements Handler {
2525
): Promise<SignerUnavailable | SignerReady> {
2626
const signer = await this.devices.get(address)
2727
if (!signer) {
28-
return {
28+
const status: SignerUnavailable = {
2929
address,
3030
handler: this,
3131
reason: 'not-local-key',
3232
status: 'unavailable',
33-
} as SignerUnavailable
33+
}
34+
return status
3435
}
3536

36-
return {
37+
const status: SignerReady = {
3738
address,
3839
handler: this,
3940
status: 'ready',
@@ -47,6 +48,7 @@ export class DevicesHandler implements Handler {
4748

4849
return true
4950
},
50-
} as SignerReady
51+
}
52+
return status
5153
}
5254
}

packages/wdk/src/sequence/handlers/passkeys.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,30 @@ export class PasskeysHandler implements Handler {
4141
address,
4242
this.extensions.passkeys,
4343
)
44-
return {
44+
const status: SignerUnavailable = {
4545
...base,
4646
status: 'unavailable',
4747
reason: 'unknown-error',
48-
} as SignerUnavailable
48+
}
49+
return status
4950
}
5051

5152
const passkey = imageHash && (await this.loadPasskey(request.envelope.wallet, imageHash))
5253
if (!passkey) {
5354
console.warn('PasskeySigner: status failed to load passkey', address, imageHash)
54-
return {
55+
const status: SignerUnavailable = {
5556
...base,
5657
status: 'unavailable',
5758
reason: 'unknown-error',
58-
} as SignerUnavailable
59+
}
60+
return status
5961
}
6062

61-
return {
63+
const status: SignerActionable = {
6264
...base,
6365
status: 'actionable',
6466
message: 'request-interaction-with-passkey',
67+
imageHash: imageHash,
6568
handle: async () => {
6669
const signature = await passkey.signSapient(
6770
request.envelope.wallet,
@@ -76,6 +79,7 @@ export class PasskeysHandler implements Handler {
7679
})
7780
return true
7881
},
79-
} as SignerActionable
82+
}
83+
return status
8084
}
8185
}

packages/wdk/src/sequence/types/signatureRequest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Envelope } from '@0xsequence/sequence-core'
22
import { Payload } from '@0xsequence/sequence-primitives'
3-
import { Address, Bytes } from 'ox'
3+
import { Address, Hex } from 'ox'
44
import { Handler } from '../handlers'
55

66
export type ActionToPayload = {
@@ -29,7 +29,7 @@ export type BaseSignatureRequest<A extends Action = Action> = {
2929

3030
export type SignerBase = {
3131
address: Address.Address
32-
imageHash?: Bytes.Bytes
32+
imageHash?: Hex.Hex
3333
}
3434

3535
export type SignerSigned = SignerBase & {

0 commit comments

Comments
 (0)