tempo.ts 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,6 +25,7 @@ describe('decorator', () => {
25
25
  "type",
26
26
  "uid",
27
27
  "extend",
28
+ "verifyHash",
28
29
  "amm",
29
30
  "dex",
30
31
  "faucet",
@@ -1,4 +1,7 @@
1
1
  import type { Account, Chain, Client, Transport } from 'viem'
2
+ import type { VerifyHashParameters, VerifyHashReturnType } from 'viem/actions'
3
+ import type { PartialBy } from '../internal/types.js'
4
+ import * as accountActions from './Actions/account.js'
2
5
  import * as ammActions from './Actions/amm.js'
3
6
  import * as dexActions from './Actions/dex.js'
4
7
  import * as faucetActions from './Actions/faucet.js'
@@ -11,6 +14,34 @@ export type Decorator<
11
14
  chain extends Chain | undefined = Chain | undefined,
12
15
  account extends Account | undefined = Account | undefined,
13
16
  > = {
17
+ /**
18
+ * Verifies that a signature is valid for a given hash and address.
19
+ * Supports Secp256k1, P256, WebCrypto P256, and WebAuthn signatures.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import { createClient, http } from 'viem'
24
+ * import { tempo } from 'tempo.ts/chains'
25
+ * import { tempoActions } from 'tempo.ts/viem'
26
+ *
27
+ * const client = createClient({
28
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
29
+ * transport: http(),
30
+ * }).extend(tempoActions())
31
+ *
32
+ * const valid = await client.verifyHash({
33
+ * address: '0x...',
34
+ * hash: '0x...',
35
+ * signature: '0x...',
36
+ * })
37
+ * ```
38
+ *
39
+ * @param parameters - Parameters.
40
+ * @returns Whether the signature is valid.
41
+ */
42
+ verifyHash: (
43
+ parameters: PartialBy<VerifyHashParameters, 'address'>,
44
+ ) => Promise<VerifyHashReturnType>
14
45
  amm: {
15
46
  /**
16
47
  * Gets the reserves for a liquidity pool.
@@ -2949,6 +2980,7 @@ export function decorator() {
2949
2980
  client: Client<transport, chain, account>,
2950
2981
  ): Decorator<chain, account> => {
2951
2982
  return {
2983
+ verifyHash: (parameters) => accountActions.verifyHash(client, parameters),
2952
2984
  amm: {
2953
2985
  getPool: (parameters) => ammActions.getPool(client, parameters),
2954
2986
  getLiquidityBalance: (parameters) =>