@wagmi/core 3.4.8 → 3.4.9

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.
@@ -1,2 +1,2 @@
1
- export const version = '3.4.8';
1
+ export const version = '3.4.9';
2
2
  //# sourceMappingURL=version.js.map
@@ -7,5 +7,6 @@ export * as nonce from './nonce.js';
7
7
  export * as policy from './policy.js';
8
8
  export * as reward from './reward.js';
9
9
  export * as token from './token.js';
10
+ export * as wallet from './wallet.js';
10
11
  export * as zone from './zone.js';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tempo/actions/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAElE,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tempo/actions/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAElE,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA"}
@@ -0,0 +1,113 @@
1
+ import type { Account, Address, BaseErrorType } from 'viem';
2
+ import { Actions } from 'viem/tempo';
3
+ import { type GetConnectorClientErrorType } from '../../actions/getConnectorClient.js';
4
+ import type { Config } from '../../createConfig.js';
5
+ import type { ChainIdParameter, ConnectorParameter } from '../../types/properties.js';
6
+ import type { UnionCompute } from '../../types/utils.js';
7
+ type AccountParameter = {
8
+ /**
9
+ * Account to use for the connector client. Use `null` to let the wallet infer
10
+ * the account.
11
+ */
12
+ account?: Account | Address | null | undefined;
13
+ };
14
+ /**
15
+ * Opens the wallet send flow with optional pre-filled send fields.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import { createConfig, http } from '@wagmi/core'
20
+ * import { tempo } from '@wagmi/core/chains'
21
+ * import { Actions } from '@wagmi/core/tempo'
22
+ *
23
+ * const config = createConfig({
24
+ * chains: [tempo],
25
+ * transports: {
26
+ * [tempo.id]: http(),
27
+ * },
28
+ * })
29
+ *
30
+ * const { receipt } = await Actions.wallet.send(config, {
31
+ * to: '0x...',
32
+ * token: '0x...',
33
+ * value: '1.5',
34
+ * })
35
+ * ```
36
+ *
37
+ * @param config - Config.
38
+ * @param parameters - Parameters.
39
+ * @returns The submitted send receipt and chain ID.
40
+ */
41
+ export declare function send<config extends Config>(config: config, parameters?: send.Parameters<config>): Promise<send.ReturnValue>;
42
+ export declare namespace send {
43
+ type Parameters<config extends Config> = UnionCompute<ChainIdParameter<config> & ConnectorParameter & AccountParameter & Actions.wallet.send.Parameters>;
44
+ type ReturnValue = Actions.wallet.send.ReturnValue;
45
+ type ErrorType = GetConnectorClientErrorType | BaseErrorType | Actions.wallet.send.ErrorType;
46
+ }
47
+ /**
48
+ * Opens the wallet swap flow with optional pre-filled swap fields.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * import { createConfig, http } from '@wagmi/core'
53
+ * import { tempo } from '@wagmi/core/chains'
54
+ * import { Actions } from '@wagmi/core/tempo'
55
+ *
56
+ * const config = createConfig({
57
+ * chains: [tempo],
58
+ * transports: {
59
+ * [tempo.id]: http(),
60
+ * },
61
+ * })
62
+ *
63
+ * const { receipt } = await Actions.wallet.swap(config, {
64
+ * amount: '1.5',
65
+ * token: '0x...',
66
+ * type: 'sell',
67
+ * })
68
+ * ```
69
+ *
70
+ * @param config - Config.
71
+ * @param parameters - Parameters.
72
+ * @returns The submitted swap receipt.
73
+ */
74
+ export declare function swap<config extends Config>(config: config, parameters?: swap.Parameters<config>): Promise<swap.ReturnValue>;
75
+ export declare namespace swap {
76
+ type Parameters<config extends Config> = UnionCompute<ChainIdParameter<config> & ConnectorParameter & AccountParameter & Actions.wallet.swap.Parameters>;
77
+ type ReturnValue = Actions.wallet.swap.ReturnValue;
78
+ type ErrorType = GetConnectorClientErrorType | BaseErrorType | Actions.wallet.swap.ErrorType;
79
+ }
80
+ /**
81
+ * Opens the wallet deposit flow with optional pre-filled deposit fields.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * import { createConfig, http } from '@wagmi/core'
86
+ * import { mainnet } from '@wagmi/core/chains'
87
+ * import { Actions } from '@wagmi/core/tempo'
88
+ *
89
+ * const config = createConfig({
90
+ * chains: [mainnet],
91
+ * transports: {
92
+ * [mainnet.id]: http(),
93
+ * },
94
+ * })
95
+ *
96
+ * const result = await Actions.wallet.deposit(config, {
97
+ * token: '0x...',
98
+ * value: '1.5',
99
+ * })
100
+ * ```
101
+ *
102
+ * @param config - Config.
103
+ * @param parameters - Parameters.
104
+ * @returns Receipts for onchain deposit operations, when applicable.
105
+ */
106
+ export declare function deposit<config extends Config>(config: config, parameters?: deposit.Parameters<config>): Promise<deposit.ReturnValue>;
107
+ export declare namespace deposit {
108
+ type Parameters<config extends Config> = UnionCompute<ChainIdParameter<config> & ConnectorParameter & AccountParameter & Omit<Actions.wallet.deposit.Parameters, 'chainId'>>;
109
+ type ReturnValue = Actions.wallet.deposit.ReturnValue;
110
+ type ErrorType = GetConnectorClientErrorType | BaseErrorType | Actions.wallet.deposit.ErrorType;
111
+ }
112
+ export {};
113
+ //# sourceMappingURL=wallet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../../../src/tempo/actions/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,qCAAqC,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,KAAK,gBAAgB,GAAG;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAA;CAC/C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,IAAI,CAAC,MAAM,SAAS,MAAM,EAC9C,MAAM,EAAE,MAAM,EACd,UAAU,GAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAM,GACvC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAW3B;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,KAAY,UAAU,CAAC,MAAM,SAAS,MAAM,IAAI,YAAY,CAC1D,gBAAgB,CAAC,MAAM,CAAC,GACtB,kBAAkB,GAClB,gBAAgB,GAChB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CACjC,CAAA;IAED,KAAY,WAAW,G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,KAAY,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAA;IAE5D,KAAY,SAAS,GACjB,2BAA2B,GAC3B,aAAa,GACb,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAA;CACrC"}
@@ -1,2 +1,2 @@
1
- export declare const version = "3.4.8";
1
+ export declare const version = "3.4.9";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wagmi/core",
3
3
  "description": "VanillaJS library for Ethereum",
4
- "version": "3.4.8",
4
+ "version": "3.4.9",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -8,4 +8,5 @@ export * as nonce from './nonce.js'
8
8
  export * as policy from './policy.js'
9
9
  export * as reward from './reward.js'
10
10
  export * as token from './token.js'
11
+ export * as wallet from './wallet.js'
11
12
  export * as zone from './zone.js'
@@ -0,0 +1,196 @@
1
+ import type { Account, Address, BaseErrorType } from 'viem'
2
+ import { Actions } from 'viem/tempo'
3
+ import {
4
+ type GetConnectorClientErrorType,
5
+ getConnectorClient,
6
+ } from '../../actions/getConnectorClient.js'
7
+ import type { Config } from '../../createConfig.js'
8
+ import type {
9
+ ChainIdParameter,
10
+ ConnectorParameter,
11
+ } from '../../types/properties.js'
12
+ import type { UnionCompute } from '../../types/utils.js'
13
+
14
+ type AccountParameter = {
15
+ /**
16
+ * Account to use for the connector client. Use `null` to let the wallet infer
17
+ * the account.
18
+ */
19
+ account?: Account | Address | null | undefined
20
+ }
21
+
22
+ /**
23
+ * Opens the wallet send flow with optional pre-filled send fields.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * import { createConfig, http } from '@wagmi/core'
28
+ * import { tempo } from '@wagmi/core/chains'
29
+ * import { Actions } from '@wagmi/core/tempo'
30
+ *
31
+ * const config = createConfig({
32
+ * chains: [tempo],
33
+ * transports: {
34
+ * [tempo.id]: http(),
35
+ * },
36
+ * })
37
+ *
38
+ * const { receipt } = await Actions.wallet.send(config, {
39
+ * to: '0x...',
40
+ * token: '0x...',
41
+ * value: '1.5',
42
+ * })
43
+ * ```
44
+ *
45
+ * @param config - Config.
46
+ * @param parameters - Parameters.
47
+ * @returns The submitted send receipt and chain ID.
48
+ */
49
+ export async function send<config extends Config>(
50
+ config: config,
51
+ parameters: send.Parameters<config> = {},
52
+ ): Promise<send.ReturnValue> {
53
+ const { account, chainId, connector, ...rest } = parameters
54
+
55
+ const client = await getConnectorClient(config, {
56
+ account,
57
+ assertChainId: false,
58
+ chainId,
59
+ connector,
60
+ })
61
+
62
+ return Actions.wallet.send(client, rest)
63
+ }
64
+
65
+ export declare namespace send {
66
+ export type Parameters<config extends Config> = UnionCompute<
67
+ ChainIdParameter<config> &
68
+ ConnectorParameter &
69
+ AccountParameter &
70
+ Actions.wallet.send.Parameters
71
+ >
72
+
73
+ export type ReturnValue = Actions.wallet.send.ReturnValue
74
+
75
+ export type ErrorType =
76
+ | GetConnectorClientErrorType
77
+ | BaseErrorType
78
+ | Actions.wallet.send.ErrorType
79
+ }
80
+
81
+ /**
82
+ * Opens the wallet swap flow with optional pre-filled swap fields.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * import { createConfig, http } from '@wagmi/core'
87
+ * import { tempo } from '@wagmi/core/chains'
88
+ * import { Actions } from '@wagmi/core/tempo'
89
+ *
90
+ * const config = createConfig({
91
+ * chains: [tempo],
92
+ * transports: {
93
+ * [tempo.id]: http(),
94
+ * },
95
+ * })
96
+ *
97
+ * const { receipt } = await Actions.wallet.swap(config, {
98
+ * amount: '1.5',
99
+ * token: '0x...',
100
+ * type: 'sell',
101
+ * })
102
+ * ```
103
+ *
104
+ * @param config - Config.
105
+ * @param parameters - Parameters.
106
+ * @returns The submitted swap receipt.
107
+ */
108
+ export async function swap<config extends Config>(
109
+ config: config,
110
+ parameters: swap.Parameters<config> = {},
111
+ ): Promise<swap.ReturnValue> {
112
+ const { account, chainId, connector, ...rest } = parameters
113
+
114
+ const client = await getConnectorClient(config, {
115
+ account,
116
+ assertChainId: false,
117
+ chainId,
118
+ connector,
119
+ })
120
+
121
+ return Actions.wallet.swap(client, rest)
122
+ }
123
+
124
+ export declare namespace swap {
125
+ export type Parameters<config extends Config> = UnionCompute<
126
+ ChainIdParameter<config> &
127
+ ConnectorParameter &
128
+ AccountParameter &
129
+ Actions.wallet.swap.Parameters
130
+ >
131
+
132
+ export type ReturnValue = Actions.wallet.swap.ReturnValue
133
+
134
+ export type ErrorType =
135
+ | GetConnectorClientErrorType
136
+ | BaseErrorType
137
+ | Actions.wallet.swap.ErrorType
138
+ }
139
+
140
+ /**
141
+ * Opens the wallet deposit flow with optional pre-filled deposit fields.
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * import { createConfig, http } from '@wagmi/core'
146
+ * import { mainnet } from '@wagmi/core/chains'
147
+ * import { Actions } from '@wagmi/core/tempo'
148
+ *
149
+ * const config = createConfig({
150
+ * chains: [mainnet],
151
+ * transports: {
152
+ * [mainnet.id]: http(),
153
+ * },
154
+ * })
155
+ *
156
+ * const result = await Actions.wallet.deposit(config, {
157
+ * token: '0x...',
158
+ * value: '1.5',
159
+ * })
160
+ * ```
161
+ *
162
+ * @param config - Config.
163
+ * @param parameters - Parameters.
164
+ * @returns Receipts for onchain deposit operations, when applicable.
165
+ */
166
+ export async function deposit<config extends Config>(
167
+ config: config,
168
+ parameters: deposit.Parameters<config> = {},
169
+ ): Promise<deposit.ReturnValue> {
170
+ const { account, chainId, connector, ...rest } = parameters
171
+
172
+ const client = await getConnectorClient(config, {
173
+ account,
174
+ assertChainId: false,
175
+ chainId,
176
+ connector,
177
+ })
178
+
179
+ return Actions.wallet.deposit(client, { ...rest, chainId })
180
+ }
181
+
182
+ export declare namespace deposit {
183
+ export type Parameters<config extends Config> = UnionCompute<
184
+ ChainIdParameter<config> &
185
+ ConnectorParameter &
186
+ AccountParameter &
187
+ Omit<Actions.wallet.deposit.Parameters, 'chainId'>
188
+ >
189
+
190
+ export type ReturnValue = Actions.wallet.deposit.ReturnValue
191
+
192
+ export type ErrorType =
193
+ | GetConnectorClientErrorType
194
+ | BaseErrorType
195
+ | Actions.wallet.deposit.ErrorType
196
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '3.4.8'
1
+ export const version = '3.4.9'