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.
- package/CHANGELOG.md +433 -0
- package/dist/viem/Actions/account.d.ts +40 -0
- package/dist/viem/Actions/account.d.ts.map +1 -0
- package/dist/viem/Actions/account.js +87 -0
- package/dist/viem/Actions/account.js.map +1 -0
- package/dist/viem/Actions/index.d.ts +1 -0
- package/dist/viem/Actions/index.d.ts.map +1 -1
- package/dist/viem/Actions/index.js +1 -0
- package/dist/viem/Actions/index.js.map +1 -1
- package/dist/viem/Decorator.d.ts +28 -0
- package/dist/viem/Decorator.d.ts.map +1 -1
- package/dist/viem/Decorator.js +2 -0
- package/dist/viem/Decorator.js.map +1 -1
- package/package.json +4 -3
- package/src/viem/Actions/account.test.ts +414 -0
- package/src/viem/Actions/account.ts +108 -0
- package/src/viem/Actions/index.ts +1 -0
- package/src/viem/Decorator.test.ts +1 -0
- package/src/viem/Decorator.ts +32 -0
package/src/viem/Decorator.ts
CHANGED
|
@@ -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) =>
|