viem 2.9.17 → 2.9.18
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 +8 -0
- package/_cjs/chains/definitions/darwinia.js +29 -0
- package/_cjs/chains/definitions/darwinia.js.map +1 -0
- package/_cjs/chains/definitions/taikoHekla.js +21 -0
- package/_cjs/chains/definitions/taikoHekla.js.map +1 -0
- package/_cjs/chains/index.js +8 -4
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/clients/createClient.js +5 -1
- package/_cjs/clients/createClient.js.map +1 -1
- package/_cjs/clients/createPublicClient.js.map +1 -1
- package/_cjs/clients/createTestClient.js.map +1 -1
- package/_cjs/clients/createWalletClient.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js +9 -8
- package/_cjs/index.js.map +1 -1
- package/_esm/chains/definitions/darwinia.js +26 -0
- package/_esm/chains/definitions/darwinia.js.map +1 -0
- package/_esm/chains/definitions/taikoHekla.js +18 -0
- package/_esm/chains/definitions/taikoHekla.js.map +1 -0
- package/_esm/chains/index.js +2 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/clients/createClient.js +7 -0
- package/_esm/clients/createClient.js.map +1 -1
- package/_esm/clients/createPublicClient.js.map +1 -1
- package/_esm/clients/createTestClient.js.map +1 -1
- package/_esm/clients/createWalletClient.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_types/chains/definitions/darwinia.d.ts +34 -0
- package/_types/chains/definitions/darwinia.d.ts.map +1 -0
- package/_types/chains/definitions/taikoHekla.d.ts +35 -0
- package/_types/chains/definitions/taikoHekla.d.ts.map +1 -0
- package/_types/chains/index.d.ts +2 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/clients/createClient.d.ts +9 -3
- package/_types/clients/createClient.d.ts.map +1 -1
- package/_types/clients/createPublicClient.d.ts +6 -4
- package/_types/clients/createPublicClient.d.ts.map +1 -1
- package/_types/clients/createTestClient.d.ts +6 -6
- package/_types/clients/createTestClient.d.ts.map +1 -1
- package/_types/clients/createWalletClient.d.ts +4 -4
- package/_types/clients/createWalletClient.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +1 -1
- package/_types/index.d.ts.map +1 -1
- package/chains/definitions/darwinia.ts +26 -0
- package/chains/definitions/taikoHekla.ts +18 -0
- package/chains/index.ts +2 -0
- package/clients/createClient.ts +17 -5
- package/clients/createPublicClient.ts +18 -7
- package/clients/createTestClient.ts +30 -11
- package/clients/createWalletClient.ts +11 -5
- package/errors/version.ts +1 -1
- package/index.ts +1 -0
- package/package.json +1 -1
@@ -1,6 +1,8 @@
|
|
1
|
+
import type { Address } from 'abitype'
|
1
2
|
import type { ErrorType } from '../errors/utils.js'
|
3
|
+
import type { Account, ParseAccount } from '../types/account.js'
|
2
4
|
import type { Chain } from '../types/chain.js'
|
3
|
-
import type { PublicRpcSchema } from '../types/eip1193.js'
|
5
|
+
import type { PublicRpcSchema, RpcSchema } from '../types/eip1193.js'
|
4
6
|
import type { Prettify } from '../types/utils.js'
|
5
7
|
import {
|
6
8
|
type Client,
|
@@ -14,9 +16,11 @@ import type { Transport } from './transports/createTransport.js'
|
|
14
16
|
export type PublicClientConfig<
|
15
17
|
transport extends Transport = Transport,
|
16
18
|
chain extends Chain | undefined = Chain | undefined,
|
19
|
+
accountOrAddress extends Account | Address | undefined = undefined,
|
20
|
+
rpcSchema extends RpcSchema | undefined = undefined,
|
17
21
|
> = Prettify<
|
18
22
|
Pick<
|
19
|
-
ClientConfig<transport, chain>,
|
23
|
+
ClientConfig<transport, chain, accountOrAddress, rpcSchema>,
|
20
24
|
| 'batch'
|
21
25
|
| 'cacheTime'
|
22
26
|
| 'ccipRead'
|
@@ -24,6 +28,7 @@ export type PublicClientConfig<
|
|
24
28
|
| 'key'
|
25
29
|
| 'name'
|
26
30
|
| 'pollingInterval'
|
31
|
+
| 'rpcSchema'
|
27
32
|
| 'transport'
|
28
33
|
>
|
29
34
|
>
|
@@ -31,12 +36,16 @@ export type PublicClientConfig<
|
|
31
36
|
export type PublicClient<
|
32
37
|
transport extends Transport = Transport,
|
33
38
|
chain extends Chain | undefined = Chain | undefined,
|
39
|
+
accountOrAddress extends Account | undefined = undefined,
|
40
|
+
rpcSchema extends RpcSchema | undefined = undefined,
|
34
41
|
> = Prettify<
|
35
42
|
Client<
|
36
43
|
transport,
|
37
44
|
chain,
|
38
|
-
|
39
|
-
|
45
|
+
accountOrAddress,
|
46
|
+
rpcSchema extends RpcSchema
|
47
|
+
? [...PublicRpcSchema, ...rpcSchema]
|
48
|
+
: PublicRpcSchema,
|
40
49
|
PublicActions<transport, chain>
|
41
50
|
>
|
42
51
|
>
|
@@ -65,9 +74,11 @@ export type CreatePublicClientErrorType = CreateClientErrorType | ErrorType
|
|
65
74
|
export function createPublicClient<
|
66
75
|
transport extends Transport,
|
67
76
|
chain extends Chain | undefined = undefined,
|
77
|
+
accountOrAddress extends Account | Address | undefined = undefined,
|
78
|
+
rpcSchema extends RpcSchema | undefined = undefined,
|
68
79
|
>(
|
69
|
-
parameters: PublicClientConfig<transport, chain>,
|
70
|
-
): PublicClient<transport, chain> {
|
80
|
+
parameters: PublicClientConfig<transport, chain, accountOrAddress, rpcSchema>,
|
81
|
+
): PublicClient<transport, chain, ParseAccount<accountOrAddress>, rpcSchema> {
|
71
82
|
const { key = 'public', name = 'Public Client' } = parameters
|
72
83
|
const client = createClient({
|
73
84
|
...parameters,
|
@@ -75,5 +86,5 @@ export function createPublicClient<
|
|
75
86
|
name,
|
76
87
|
type: 'publicClient',
|
77
88
|
})
|
78
|
-
return client.extend(publicActions)
|
89
|
+
return client.extend(publicActions) as any
|
79
90
|
}
|
@@ -4,7 +4,7 @@ import type { Account } from '../accounts/types.js'
|
|
4
4
|
import type { ErrorType } from '../errors/utils.js'
|
5
5
|
import type { ParseAccount } from '../types/account.js'
|
6
6
|
import type { Chain } from '../types/chain.js'
|
7
|
-
import type { TestRpcSchema } from '../types/eip1193.js'
|
7
|
+
import type { RpcSchema, TestRpcSchema } from '../types/eip1193.js'
|
8
8
|
import type { Prettify } from '../types/utils.js'
|
9
9
|
import {
|
10
10
|
type Client,
|
@@ -25,15 +25,17 @@ export type TestClientConfig<
|
|
25
25
|
| Account
|
26
26
|
| Address
|
27
27
|
| undefined,
|
28
|
+
rpcSchema extends RpcSchema | undefined = undefined,
|
28
29
|
> = Prettify<
|
29
30
|
Pick<
|
30
|
-
ClientConfig<transport, chain, accountOrAddress>,
|
31
|
+
ClientConfig<transport, chain, accountOrAddress, rpcSchema>,
|
31
32
|
| 'account'
|
32
33
|
| 'cacheTime'
|
33
34
|
| 'chain'
|
34
35
|
| 'key'
|
35
36
|
| 'name'
|
36
37
|
| 'pollingInterval'
|
38
|
+
| 'rpcSchema'
|
37
39
|
| 'transport'
|
38
40
|
> & {
|
39
41
|
/** Mode of the test client. */
|
@@ -42,18 +44,21 @@ export type TestClientConfig<
|
|
42
44
|
>
|
43
45
|
|
44
46
|
export type TestClient<
|
45
|
-
|
47
|
+
mode extends TestClientMode = TestClientMode,
|
46
48
|
transport extends Transport = Transport,
|
47
49
|
chain extends Chain | undefined = Chain | undefined,
|
48
|
-
|
49
|
-
|
50
|
+
account extends Account | undefined = Account | undefined,
|
51
|
+
includeActions extends boolean = true,
|
52
|
+
rpcSchema extends RpcSchema | undefined = undefined,
|
50
53
|
> = Prettify<
|
51
|
-
{ mode:
|
54
|
+
{ mode: mode } & Client<
|
52
55
|
transport,
|
53
56
|
chain,
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
+
account,
|
58
|
+
rpcSchema extends RpcSchema
|
59
|
+
? [...TestRpcSchema<mode>, ...rpcSchema]
|
60
|
+
: TestRpcSchema<mode>,
|
61
|
+
includeActions extends true ? TestActions : Record<string, unknown>
|
57
62
|
>
|
58
63
|
>
|
59
64
|
|
@@ -87,9 +92,23 @@ export function createTestClient<
|
|
87
92
|
transport extends Transport,
|
88
93
|
chain extends Chain | undefined = undefined,
|
89
94
|
accountOrAddress extends Account | Address | undefined = undefined,
|
95
|
+
rpcSchema extends RpcSchema | undefined = undefined,
|
90
96
|
>(
|
91
|
-
parameters: TestClientConfig<
|
92
|
-
|
97
|
+
parameters: TestClientConfig<
|
98
|
+
mode,
|
99
|
+
transport,
|
100
|
+
chain,
|
101
|
+
accountOrAddress,
|
102
|
+
rpcSchema
|
103
|
+
>,
|
104
|
+
): TestClient<
|
105
|
+
mode,
|
106
|
+
transport,
|
107
|
+
chain,
|
108
|
+
ParseAccount<accountOrAddress>,
|
109
|
+
true,
|
110
|
+
rpcSchema
|
111
|
+
>
|
93
112
|
|
94
113
|
export function createTestClient(parameters: TestClientConfig): TestClient {
|
95
114
|
const { key = 'test', name = 'Test Client', mode } = parameters
|
@@ -4,7 +4,7 @@ import type { Account } from '../accounts/types.js'
|
|
4
4
|
import type { ErrorType } from '../errors/utils.js'
|
5
5
|
import type { ParseAccount } from '../types/account.js'
|
6
6
|
import type { Chain } from '../types/chain.js'
|
7
|
-
import type { WalletRpcSchema } from '../types/eip1193.js'
|
7
|
+
import type { RpcSchema, WalletRpcSchema } from '../types/eip1193.js'
|
8
8
|
import type { Prettify } from '../types/utils.js'
|
9
9
|
import {
|
10
10
|
type Client,
|
@@ -22,9 +22,10 @@ export type WalletClientConfig<
|
|
22
22
|
| Account
|
23
23
|
| Address
|
24
24
|
| undefined,
|
25
|
+
rpcSchema extends RpcSchema | undefined = undefined,
|
25
26
|
> = Prettify<
|
26
27
|
Pick<
|
27
|
-
ClientConfig<transport, chain, accountOrAddress>,
|
28
|
+
ClientConfig<transport, chain, accountOrAddress, rpcSchema>,
|
28
29
|
| 'account'
|
29
30
|
| 'cacheTime'
|
30
31
|
| 'ccipRead'
|
@@ -32,6 +33,7 @@ export type WalletClientConfig<
|
|
32
33
|
| 'key'
|
33
34
|
| 'name'
|
34
35
|
| 'pollingInterval'
|
36
|
+
| 'rpcSchema'
|
35
37
|
| 'transport'
|
36
38
|
>
|
37
39
|
>
|
@@ -40,12 +42,15 @@ export type WalletClient<
|
|
40
42
|
transport extends Transport = Transport,
|
41
43
|
chain extends Chain | undefined = Chain | undefined,
|
42
44
|
account extends Account | undefined = Account | undefined,
|
45
|
+
rpcSchema extends RpcSchema | undefined = undefined,
|
43
46
|
> = Prettify<
|
44
47
|
Client<
|
45
48
|
transport,
|
46
49
|
chain,
|
47
50
|
account,
|
48
|
-
|
51
|
+
rpcSchema extends RpcSchema
|
52
|
+
? [...WalletRpcSchema, ...rpcSchema]
|
53
|
+
: WalletRpcSchema,
|
49
54
|
WalletActions<chain, account>
|
50
55
|
>
|
51
56
|
>
|
@@ -92,9 +97,10 @@ export function createWalletClient<
|
|
92
97
|
transport extends Transport,
|
93
98
|
chain extends Chain | undefined = undefined,
|
94
99
|
accountOrAddress extends Account | Address | undefined = undefined,
|
100
|
+
rpcSchema extends RpcSchema | undefined = undefined,
|
95
101
|
>(
|
96
|
-
parameters: WalletClientConfig<transport, chain, accountOrAddress>,
|
97
|
-
): WalletClient<transport, chain, ParseAccount<accountOrAddress
|
102
|
+
parameters: WalletClientConfig<transport, chain, accountOrAddress, rpcSchema>,
|
103
|
+
): WalletClient<transport, chain, ParseAccount<accountOrAddress>, rpcSchema>
|
98
104
|
|
99
105
|
export function createWalletClient(
|
100
106
|
parameters: WalletClientConfig,
|
package/errors/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = '2.9.
|
1
|
+
export const version = '2.9.18'
|
package/index.ts
CHANGED