@dynamic-labs/ethereum-aa 2.0.0-alpha.3 → 2.0.0-alpha.30
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 +394 -0
- package/package.json +12 -10
- package/src/ZeroDevConnector.cjs +100 -68
- package/src/ZeroDevConnector.d.ts +287 -16
- package/src/ZeroDevConnector.js +102 -70
- package/src/index.cjs +7 -0
- package/src/index.d.ts +4 -0
- package/src/index.js +7 -1
- package/src/utils/fetchChain.cjs +28 -0
- package/src/utils/fetchChain.d.ts +3 -0
- package/src/utils/fetchChain.js +23 -0
- package/src/utils/index.d.ts +3 -0
package/src/ZeroDevConnector.cjs
CHANGED
|
@@ -3,17 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../_virtual/_tslib.cjs');
|
|
6
|
-
var
|
|
6
|
+
var presets = require('@zerodev/presets');
|
|
7
7
|
var viem = require('viem');
|
|
8
|
+
var permissionless = require('permissionless');
|
|
8
9
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
10
|
var viemUtils = require('@dynamic-labs/viem-utils');
|
|
10
11
|
var utils = require('@dynamic-labs/utils');
|
|
12
|
+
var fetchChain = require('./utils/fetchChain.cjs');
|
|
11
13
|
var logger = require('./utils/logger.cjs');
|
|
12
14
|
|
|
13
15
|
class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
14
|
-
get key() {
|
|
15
|
-
return 'zerodev';
|
|
16
|
-
}
|
|
17
16
|
constructor(opts) {
|
|
18
17
|
var _a;
|
|
19
18
|
super(opts);
|
|
@@ -22,6 +21,14 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
22
21
|
this.isGasSponsorshipDisabled = false;
|
|
23
22
|
this.isEmbeddedWallet = true;
|
|
24
23
|
this.name = 'ZeroDev';
|
|
24
|
+
this.overrideKey = 'zerodev';
|
|
25
|
+
this.walletFallback = {
|
|
26
|
+
brand: {
|
|
27
|
+
alt: 'Smart Wallet',
|
|
28
|
+
spriteId: 'smartwallet',
|
|
29
|
+
},
|
|
30
|
+
name: 'ZeroDev',
|
|
31
|
+
};
|
|
25
32
|
const zeroDevProjectId = (_a = opts.apiProviders.zerodev) === null || _a === void 0 ? void 0 : _a.clientId;
|
|
26
33
|
if (!zeroDevProjectId) {
|
|
27
34
|
throw new Error('Missing ZeroDev project ID provided. Add your ZeroDev project id to your project configuration via the Dynamic Labs dashboard.');
|
|
@@ -34,28 +41,35 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
34
41
|
return this.eoaConnector;
|
|
35
42
|
}
|
|
36
43
|
getAccountAbstractionProvider() {
|
|
37
|
-
return this.
|
|
44
|
+
return this.kernelClient;
|
|
45
|
+
}
|
|
46
|
+
endSession() {
|
|
47
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
localStorage.removeItem(fetchChain.cachedChainIdKey);
|
|
49
|
+
});
|
|
38
50
|
}
|
|
39
51
|
setEoaConnector(connector) {
|
|
40
52
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
this.
|
|
53
|
+
this.kernelClientDeferredPromise = new utils.DeferredPromise();
|
|
42
54
|
this.eoaConnector = connector;
|
|
43
55
|
const signer = yield this.eoaConnector.getSigner();
|
|
44
|
-
if (!signer) {
|
|
56
|
+
if (!(signer === null || signer === void 0 ? void 0 : signer.account)) {
|
|
45
57
|
return;
|
|
46
58
|
}
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
59
|
+
const kernelClient = yield presets.createEcdsaKernelAccountClient({
|
|
60
|
+
chain: yield fetchChain.fetchChain(this.projectId),
|
|
61
|
+
paymaster: 'NONE',
|
|
50
62
|
projectId: this.projectId,
|
|
63
|
+
provider: ZeroDevConnector.bundlerProvider,
|
|
64
|
+
signer: permissionless.walletClientToSmartAccountSigner(signer),
|
|
51
65
|
});
|
|
52
|
-
utils.wrapMethodWithCallback(
|
|
66
|
+
utils.wrapMethodWithCallback(kernelClient, 'sendUserOperation', (original, ...args) => {
|
|
53
67
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
54
68
|
return original(...args);
|
|
55
69
|
});
|
|
56
|
-
this.
|
|
70
|
+
this.kernelClient = kernelClient;
|
|
57
71
|
yield this.checkIsProjectChainEnabled();
|
|
58
|
-
this.
|
|
72
|
+
this.kernelClientDeferredPromise.resolve();
|
|
59
73
|
});
|
|
60
74
|
}
|
|
61
75
|
checkIsProjectChainEnabled() {
|
|
@@ -70,69 +84,67 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
70
84
|
}
|
|
71
85
|
});
|
|
72
86
|
}
|
|
73
|
-
|
|
87
|
+
getKernelClientWithSponsorshipValidation() {
|
|
74
88
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
if (this.
|
|
76
|
-
return this.
|
|
89
|
+
if (this.kernelClientWithSponsorship) {
|
|
90
|
+
return this.kernelClientWithSponsorship;
|
|
77
91
|
}
|
|
78
92
|
const { eoaConnector } = this;
|
|
79
93
|
if (!eoaConnector)
|
|
80
94
|
throw new utils.DynamicError('No EOA connector');
|
|
81
95
|
const signer = yield eoaConnector.getSigner();
|
|
82
|
-
this.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
paymasterConfig: {
|
|
86
|
-
onlySendSponsoredTransaction: true,
|
|
87
|
-
policy: 'VERIFYING_PAYMASTER',
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
owner: sdk.convertWalletClientToAccountSigner(signer),
|
|
96
|
+
this.kernelClientWithSponsorship = yield presets.createEcdsaKernelAccountClient({
|
|
97
|
+
chain: yield fetchChain.fetchChain(this.projectId),
|
|
98
|
+
paymaster: 'SPONSOR',
|
|
91
99
|
projectId: this.projectId,
|
|
100
|
+
provider: ZeroDevConnector.bundlerProvider,
|
|
101
|
+
signer: permissionless.walletClientToSmartAccountSigner(signer),
|
|
92
102
|
});
|
|
93
|
-
utils.wrapMethodWithCallback(this.
|
|
103
|
+
utils.wrapMethodWithCallback(this.kernelClientWithSponsorship, 'sendUserOperation', (original, ...args) => {
|
|
94
104
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
95
105
|
return original(...args);
|
|
96
106
|
});
|
|
97
|
-
return this.
|
|
107
|
+
return this.kernelClientWithSponsorship;
|
|
98
108
|
});
|
|
99
109
|
}
|
|
100
|
-
|
|
101
|
-
var _a, _b;
|
|
110
|
+
getAddress() {
|
|
111
|
+
var _a, _b, _c;
|
|
102
112
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
yield ((_a = this.
|
|
104
|
-
return (_b = this.
|
|
113
|
+
yield ((_a = this.kernelClientDeferredPromise) === null || _a === void 0 ? void 0 : _a.promise);
|
|
114
|
+
return (_c = (_b = this.kernelClient) === null || _b === void 0 ? void 0 : _b.account) === null || _c === void 0 ? void 0 : _c.address;
|
|
105
115
|
});
|
|
106
116
|
}
|
|
107
117
|
getConnectedAccounts() {
|
|
108
|
-
var _a;
|
|
118
|
+
var _a, _b, _c;
|
|
109
119
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
110
|
-
yield ((_a = this.
|
|
111
|
-
return this.
|
|
112
|
-
? [yield this.
|
|
120
|
+
yield ((_a = this.kernelClientDeferredPromise) === null || _a === void 0 ? void 0 : _a.promise);
|
|
121
|
+
return ((_c = (_b = this.kernelClient) === null || _b === void 0 ? void 0 : _b.account) === null || _c === void 0 ? void 0 : _c.address)
|
|
122
|
+
? [yield this.kernelClient.account.address]
|
|
113
123
|
: [];
|
|
114
124
|
});
|
|
115
125
|
}
|
|
116
126
|
getNetwork() {
|
|
117
|
-
var _a, _b;
|
|
127
|
+
var _a, _b, _c;
|
|
118
128
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
yield ((_a = this.
|
|
120
|
-
return (_b = this.
|
|
129
|
+
yield ((_a = this.kernelClientDeferredPromise) === null || _a === void 0 ? void 0 : _a.promise);
|
|
130
|
+
return (_c = (_b = this.kernelClient) === null || _b === void 0 ? void 0 : _b.chain) === null || _c === void 0 ? void 0 : _c.id;
|
|
121
131
|
});
|
|
122
132
|
}
|
|
123
133
|
getTransport(provider) {
|
|
124
134
|
const transport = viemUtils.confirmationTransport({
|
|
125
|
-
connector: this,
|
|
126
135
|
onPersonalSign: ({ message }) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
127
136
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
128
|
-
return provider.signMessage(
|
|
137
|
+
return provider.signMessage({
|
|
138
|
+
account: provider.account,
|
|
139
|
+
message,
|
|
140
|
+
});
|
|
129
141
|
}),
|
|
130
142
|
onSendTransaction: ({ transaction }) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
131
143
|
try {
|
|
132
144
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
133
145
|
const effectiveProvider = this.isGasSponsorshipDisabled
|
|
134
146
|
? provider
|
|
135
|
-
: yield this.
|
|
147
|
+
: yield this.getKernelClientWithSponsorshipValidation();
|
|
136
148
|
const response = yield effectiveProvider.sendTransaction(viemUtils.unFormatTransaction(transaction));
|
|
137
149
|
return response;
|
|
138
150
|
}
|
|
@@ -150,58 +162,69 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
150
162
|
onSignTypedData: ({ message }) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
151
163
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
152
164
|
const signTypedData = JSON.parse(message);
|
|
153
|
-
return provider.signTypedData(
|
|
165
|
+
return provider.signTypedData({
|
|
166
|
+
account: provider.account,
|
|
167
|
+
domain: signTypedData.domain,
|
|
168
|
+
message: signTypedData.message,
|
|
169
|
+
primaryType: signTypedData.primaryType,
|
|
170
|
+
types: signTypedData.types,
|
|
171
|
+
});
|
|
154
172
|
}),
|
|
155
|
-
provider: provider.
|
|
173
|
+
provider: provider.extend(viem.publicActions),
|
|
156
174
|
transport: viem.custom(provider),
|
|
175
|
+
walletConnector: this,
|
|
157
176
|
walletUiUtils: this._walletUiUtils,
|
|
158
177
|
});
|
|
159
178
|
return transport;
|
|
160
179
|
}
|
|
161
|
-
getWalletClient() {
|
|
162
|
-
|
|
180
|
+
getWalletClient(chainId) {
|
|
181
|
+
var _a;
|
|
182
|
+
const provider = this.kernelClient;
|
|
163
183
|
if (!provider)
|
|
164
184
|
throw new utils.DynamicError('No provider');
|
|
165
185
|
const transport = this.getTransport(provider);
|
|
186
|
+
const address = (_a = provider.account) === null || _a === void 0 ? void 0 : _a.address;
|
|
166
187
|
const walletClient = viem.createWalletClient({
|
|
188
|
+
account: address,
|
|
189
|
+
chain: chainId ? viemUtils.chainsMap[chainId] : provider.chain,
|
|
167
190
|
transport,
|
|
168
191
|
});
|
|
169
192
|
return walletClient;
|
|
170
193
|
}
|
|
171
194
|
getPublicClient() {
|
|
172
195
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
173
|
-
const provider = this.
|
|
196
|
+
const provider = this.kernelClient.extend(viem.publicActions);
|
|
174
197
|
if (!provider)
|
|
175
198
|
throw new utils.DynamicError('No provider');
|
|
176
|
-
return provider
|
|
199
|
+
return provider;
|
|
177
200
|
});
|
|
178
201
|
}
|
|
179
202
|
getSigner() {
|
|
180
203
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
181
|
-
|
|
182
|
-
if (!provider)
|
|
183
|
-
throw new utils.DynamicError('No provider');
|
|
184
|
-
const transport = this.getTransport(provider);
|
|
185
|
-
const address = yield provider.getAddress();
|
|
186
|
-
const walletClient = viem.createWalletClient({
|
|
187
|
-
account: address,
|
|
188
|
-
transport,
|
|
189
|
-
});
|
|
190
|
-
return walletClient;
|
|
204
|
+
return this.getWalletClient();
|
|
191
205
|
});
|
|
192
206
|
}
|
|
193
207
|
canSponsorTransactionGas(transaction) {
|
|
194
|
-
var _a;
|
|
195
208
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
196
209
|
try {
|
|
210
|
+
yield this.getKernelClientWithSponsorshipValidation();
|
|
197
211
|
const userOperation = {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
212
|
+
callData: yield this.kernelClientWithSponsorship.account.encodeCallData({
|
|
213
|
+
data: transaction.data ? transaction.data : '0x',
|
|
214
|
+
to: transaction.to,
|
|
215
|
+
/**
|
|
216
|
+
* if value is undefined, it will be set to 0x0 so the sponsorship
|
|
217
|
+
* check does not fail
|
|
218
|
+
*/
|
|
219
|
+
value: transaction.value && viem.isHex(transaction.value)
|
|
220
|
+
? viem.fromHex(transaction.value, 'bigint')
|
|
221
|
+
: '0x0',
|
|
222
|
+
}),
|
|
203
223
|
};
|
|
204
|
-
const result = yield
|
|
224
|
+
const result = yield this.kernelClientWithSponsorship.prepareUserOperationRequest({
|
|
225
|
+
account: this.kernelClientWithSponsorship.account,
|
|
226
|
+
userOperation,
|
|
227
|
+
});
|
|
205
228
|
if (!result)
|
|
206
229
|
return false;
|
|
207
230
|
return result.paymasterAndData !== '0x';
|
|
@@ -216,12 +239,11 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
216
239
|
this.isGasSponsorshipDisabled = true;
|
|
217
240
|
}
|
|
218
241
|
getBalance() {
|
|
219
|
-
var _a;
|
|
220
242
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
221
|
-
const rpcClient =
|
|
243
|
+
const rpcClient = this.kernelClient.extend(viem.publicActions);
|
|
222
244
|
if (!rpcClient)
|
|
223
245
|
throw new utils.DynamicError('No RPC client');
|
|
224
|
-
const address = yield this.
|
|
246
|
+
const address = yield this.getAddress();
|
|
225
247
|
if (!address)
|
|
226
248
|
return;
|
|
227
249
|
return viem.formatEther(yield rpcClient.getBalance({ address: address }));
|
|
@@ -230,7 +252,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
230
252
|
signMessage(messageToSign) {
|
|
231
253
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
232
254
|
const client = yield this.getSigner();
|
|
233
|
-
const account = yield this.
|
|
255
|
+
const account = yield this.getAddress();
|
|
234
256
|
if (!account || !client)
|
|
235
257
|
return;
|
|
236
258
|
return client.signMessage({
|
|
@@ -239,6 +261,16 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
239
261
|
});
|
|
240
262
|
});
|
|
241
263
|
}
|
|
264
|
+
createUiTransaction(from) {
|
|
265
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
266
|
+
const walletClient = this.getWalletClient();
|
|
267
|
+
const publicClient = yield this.getPublicClient();
|
|
268
|
+
if (!publicClient || !walletClient) {
|
|
269
|
+
throw new utils.DynamicError('No public client available');
|
|
270
|
+
}
|
|
271
|
+
return viemUtils.createViemUiTransaction({ from, publicClient, walletClient });
|
|
272
|
+
});
|
|
273
|
+
}
|
|
242
274
|
}
|
|
243
275
|
|
|
244
276
|
exports.ZeroDevConnector = ZeroDevConnector;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Chain
|
|
1
|
+
import { KernelAccountClient } from '@zerodev/sdk';
|
|
2
|
+
import { type Provider as BundlerProvider } from '@zerodev/presets';
|
|
3
|
+
import { Account, PublicClient, Transport, WalletClient } from 'viem';
|
|
4
|
+
import { type Chain as ViemChain } from 'viem/chains';
|
|
5
|
+
import { Provider, ProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
6
|
+
import { Chain, IAccountAbstractionWalletConnector, ISendBalanceWalletConnector, WalletConnector, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
5
7
|
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
6
|
-
import { EvmNetwork, GenericNetwork, WalletUiUtils } from '@dynamic-labs/types';
|
|
8
|
+
import { EvmNetwork, GenericNetwork, IUITransaction, WalletUiUtils } from '@dynamic-labs/types';
|
|
7
9
|
type ZeroDevConnectorProps = {
|
|
8
10
|
apiProviders: {
|
|
9
11
|
[key in ProviderEnum]?: Provider;
|
|
@@ -11,42 +13,311 @@ type ZeroDevConnectorProps = {
|
|
|
11
13
|
evmNetworks: GenericNetwork[];
|
|
12
14
|
walletBook: WalletBookSchema;
|
|
13
15
|
walletUiUtils: WalletUiUtils<WalletConnector>;
|
|
16
|
+
bundlerProvider: BundlerProvider | undefined;
|
|
14
17
|
};
|
|
15
|
-
|
|
18
|
+
type IZeroDevConnector = IAccountAbstractionWalletConnector & ISendBalanceWalletConnector;
|
|
19
|
+
export declare class ZeroDevConnector extends WalletConnectorBase implements IZeroDevConnector {
|
|
16
20
|
projectId: string;
|
|
17
|
-
|
|
21
|
+
kernelClient: KernelAccountClient | undefined;
|
|
18
22
|
eoaConnector: WalletConnector | undefined;
|
|
19
|
-
private
|
|
23
|
+
private kernelClientWithSponsorship;
|
|
20
24
|
connectedChain: Chain;
|
|
21
25
|
supportedChains: Chain[];
|
|
22
26
|
evmNetworks: EvmNetwork[];
|
|
23
27
|
private isGasSponsorshipDisabled;
|
|
24
28
|
isEmbeddedWallet: boolean;
|
|
29
|
+
static bundlerProvider: BundlerProvider | undefined;
|
|
25
30
|
/**
|
|
26
31
|
* Deferred promise that resolves when the ZeroDev provider is set.
|
|
27
32
|
* This is used to make sure that the provider is set before any other method is called.
|
|
28
33
|
* This is needed because the provider is set asynchronously.
|
|
29
34
|
*/
|
|
30
|
-
private
|
|
35
|
+
private kernelClientDeferredPromise;
|
|
31
36
|
name: string;
|
|
32
|
-
|
|
37
|
+
overrideKey: string;
|
|
38
|
+
walletFallback: {
|
|
39
|
+
brand: {
|
|
40
|
+
alt: string;
|
|
41
|
+
spriteId: string;
|
|
42
|
+
};
|
|
43
|
+
name: string;
|
|
44
|
+
};
|
|
33
45
|
private _walletUiUtils;
|
|
34
46
|
constructor(opts: ZeroDevConnectorProps);
|
|
35
47
|
getEOAConnector(): WalletConnector | undefined;
|
|
36
|
-
getAccountAbstractionProvider():
|
|
48
|
+
getAccountAbstractionProvider(): KernelAccountClient | undefined;
|
|
49
|
+
endSession(): Promise<void>;
|
|
37
50
|
setEoaConnector(connector: WalletConnector): Promise<void>;
|
|
38
51
|
private checkIsProjectChainEnabled;
|
|
39
|
-
private
|
|
40
|
-
|
|
52
|
+
private getKernelClientWithSponsorshipValidation;
|
|
53
|
+
getAddress(): Promise<string | undefined>;
|
|
41
54
|
getConnectedAccounts(): Promise<string[]>;
|
|
42
55
|
getNetwork(): Promise<number | undefined>;
|
|
43
56
|
private getTransport;
|
|
44
|
-
getWalletClient(): WalletClient | undefined;
|
|
57
|
+
getWalletClient(chainId?: string): WalletClient<Transport, ViemChain> | undefined;
|
|
45
58
|
getPublicClient(): Promise<void | PublicClient | undefined>;
|
|
46
|
-
getSigner(): Promise<
|
|
47
|
-
|
|
59
|
+
getSigner(): Promise<{
|
|
60
|
+
account: Account | undefined;
|
|
61
|
+
batch?: {
|
|
62
|
+
multicall?: boolean | {
|
|
63
|
+
batchSize?: number | undefined;
|
|
64
|
+
wait?: number | undefined;
|
|
65
|
+
} | undefined;
|
|
66
|
+
} | undefined;
|
|
67
|
+
cacheTime: number;
|
|
68
|
+
chain: ViemChain;
|
|
69
|
+
key: string;
|
|
70
|
+
name: string;
|
|
71
|
+
pollingInterval: number;
|
|
72
|
+
request: import("viem").EIP1193RequestFn<import("viem").WalletRpcSchema>;
|
|
73
|
+
transport: import("viem").TransportConfig<string, import("viem").EIP1193RequestFn> & Record<string, any>;
|
|
74
|
+
type: string;
|
|
75
|
+
uid: string;
|
|
76
|
+
addChain: (args: import("viem").AddChainParameters) => Promise<void>;
|
|
77
|
+
deployContract: <const abi extends import("viem").Abi | readonly unknown[], chainOverride extends ViemChain | undefined>(args: import("viem").DeployContractParameters<abi, ViemChain, Account | undefined, chainOverride>) => Promise<`0x${string}`>;
|
|
78
|
+
getAddresses: () => Promise<import("viem").GetAddressesReturnType>;
|
|
79
|
+
getChainId: () => Promise<number>;
|
|
80
|
+
getPermissions: () => Promise<import("viem").GetPermissionsReturnType>;
|
|
81
|
+
prepareTransactionRequest: <TParameterType extends import("viem").PrepareTransactionRequestParameterType, TChainOverride extends ViemChain | undefined = undefined, TAccountOverride extends `0x${string}` | Account | undefined = undefined>(args: import("viem").PrepareTransactionRequestParameters<ViemChain, Account | undefined, TChainOverride, TAccountOverride, TParameterType>) => Promise<import("viem").PrepareTransactionRequestReturnType<ViemChain, Account | undefined, TChainOverride, TAccountOverride, TParameterType>>;
|
|
82
|
+
requestAddresses: () => Promise<import("viem").RequestAddressesReturnType>;
|
|
83
|
+
requestPermissions: (args: {
|
|
84
|
+
[x: string]: Record<string, any>;
|
|
85
|
+
eth_accounts: Record<string, any>;
|
|
86
|
+
}) => Promise<import("viem").RequestPermissionsReturnType>;
|
|
87
|
+
sendRawTransaction: (args: import("viem").SendRawTransactionParameters) => Promise<`0x${string}`>;
|
|
88
|
+
sendTransaction: <TChainOverride_1 extends ViemChain | undefined = undefined>(args: import("viem").SendTransactionParameters<ViemChain, Account | undefined, TChainOverride_1>) => Promise<`0x${string}`>;
|
|
89
|
+
signMessage: (args: import("viem").SignMessageParameters<Account | undefined>) => Promise<`0x${string}`>;
|
|
90
|
+
signTransaction: <TChainOverride_2 extends ViemChain | undefined>(args: import("viem").SignTransactionParameters<ViemChain, Account | undefined, TChainOverride_2>) => Promise<`0x${string}`>;
|
|
91
|
+
signTypedData: <const TTypedData extends {
|
|
92
|
+
[x: string]: readonly import("viem").TypedDataParameter[];
|
|
93
|
+
[x: `string[${string}]`]: undefined;
|
|
94
|
+
[x: `function[${string}]`]: undefined;
|
|
95
|
+
[x: `address[${string}]`]: undefined;
|
|
96
|
+
[x: `bool[${string}]`]: undefined;
|
|
97
|
+
[x: `bytes[${string}]`]: undefined;
|
|
98
|
+
[x: `bytes9[${string}]`]: undefined;
|
|
99
|
+
[x: `bytes1[${string}]`]: undefined;
|
|
100
|
+
[x: `bytes32[${string}]`]: undefined;
|
|
101
|
+
[x: `bytes31[${string}]`]: undefined;
|
|
102
|
+
[x: `bytes30[${string}]`]: undefined;
|
|
103
|
+
[x: `bytes29[${string}]`]: undefined;
|
|
104
|
+
[x: `bytes28[${string}]`]: undefined;
|
|
105
|
+
[x: `bytes27[${string}]`]: undefined;
|
|
106
|
+
[x: `bytes26[${string}]`]: undefined;
|
|
107
|
+
[x: `bytes25[${string}]`]: undefined;
|
|
108
|
+
[x: `bytes24[${string}]`]: undefined;
|
|
109
|
+
[x: `bytes23[${string}]`]: undefined;
|
|
110
|
+
[x: `bytes22[${string}]`]: undefined;
|
|
111
|
+
[x: `bytes21[${string}]`]: undefined;
|
|
112
|
+
[x: `bytes20[${string}]`]: undefined;
|
|
113
|
+
[x: `bytes19[${string}]`]: undefined;
|
|
114
|
+
[x: `bytes2[${string}]`]: undefined;
|
|
115
|
+
[x: `bytes18[${string}]`]: undefined;
|
|
116
|
+
[x: `bytes17[${string}]`]: undefined;
|
|
117
|
+
[x: `bytes16[${string}]`]: undefined;
|
|
118
|
+
[x: `bytes15[${string}]`]: undefined;
|
|
119
|
+
[x: `bytes14[${string}]`]: undefined;
|
|
120
|
+
[x: `bytes13[${string}]`]: undefined;
|
|
121
|
+
[x: `bytes12[${string}]`]: undefined;
|
|
122
|
+
[x: `bytes11[${string}]`]: undefined;
|
|
123
|
+
[x: `bytes10[${string}]`]: undefined;
|
|
124
|
+
[x: `bytes8[${string}]`]: undefined;
|
|
125
|
+
[x: `bytes7[${string}]`]: undefined;
|
|
126
|
+
[x: `bytes6[${string}]`]: undefined;
|
|
127
|
+
[x: `bytes5[${string}]`]: undefined;
|
|
128
|
+
[x: `bytes4[${string}]`]: undefined;
|
|
129
|
+
[x: `bytes3[${string}]`]: undefined;
|
|
130
|
+
[x: `int[${string}]`]: undefined;
|
|
131
|
+
[x: `int40[${string}]`]: undefined;
|
|
132
|
+
[x: `int32[${string}]`]: undefined;
|
|
133
|
+
[x: `int24[${string}]`]: undefined;
|
|
134
|
+
[x: `int16[${string}]`]: undefined;
|
|
135
|
+
[x: `int8[${string}]`]: undefined;
|
|
136
|
+
[x: `int48[${string}]`]: undefined;
|
|
137
|
+
[x: `int56[${string}]`]: undefined;
|
|
138
|
+
[x: `int64[${string}]`]: undefined;
|
|
139
|
+
[x: `int72[${string}]`]: undefined;
|
|
140
|
+
[x: `int80[${string}]`]: undefined;
|
|
141
|
+
[x: `int88[${string}]`]: undefined;
|
|
142
|
+
[x: `int96[${string}]`]: undefined;
|
|
143
|
+
[x: `int104[${string}]`]: undefined;
|
|
144
|
+
[x: `int112[${string}]`]: undefined;
|
|
145
|
+
[x: `int120[${string}]`]: undefined;
|
|
146
|
+
[x: `int128[${string}]`]: undefined;
|
|
147
|
+
[x: `int136[${string}]`]: undefined;
|
|
148
|
+
[x: `int144[${string}]`]: undefined;
|
|
149
|
+
[x: `int152[${string}]`]: undefined;
|
|
150
|
+
[x: `int160[${string}]`]: undefined;
|
|
151
|
+
[x: `int168[${string}]`]: undefined;
|
|
152
|
+
[x: `int176[${string}]`]: undefined;
|
|
153
|
+
[x: `int184[${string}]`]: undefined;
|
|
154
|
+
[x: `int192[${string}]`]: undefined;
|
|
155
|
+
[x: `int200[${string}]`]: undefined;
|
|
156
|
+
[x: `int208[${string}]`]: undefined;
|
|
157
|
+
[x: `int216[${string}]`]: undefined;
|
|
158
|
+
[x: `int224[${string}]`]: undefined;
|
|
159
|
+
[x: `int232[${string}]`]: undefined;
|
|
160
|
+
[x: `int240[${string}]`]: undefined;
|
|
161
|
+
[x: `int248[${string}]`]: undefined;
|
|
162
|
+
[x: `int256[${string}]`]: undefined;
|
|
163
|
+
[x: `uint[${string}]`]: undefined;
|
|
164
|
+
[x: `uint40[${string}]`]: undefined;
|
|
165
|
+
[x: `uint32[${string}]`]: undefined;
|
|
166
|
+
[x: `uint24[${string}]`]: undefined;
|
|
167
|
+
[x: `uint16[${string}]`]: undefined;
|
|
168
|
+
[x: `uint8[${string}]`]: undefined;
|
|
169
|
+
[x: `uint48[${string}]`]: undefined;
|
|
170
|
+
[x: `uint56[${string}]`]: undefined;
|
|
171
|
+
[x: `uint64[${string}]`]: undefined;
|
|
172
|
+
[x: `uint72[${string}]`]: undefined;
|
|
173
|
+
[x: `uint80[${string}]`]: undefined;
|
|
174
|
+
[x: `uint88[${string}]`]: undefined;
|
|
175
|
+
[x: `uint96[${string}]`]: undefined;
|
|
176
|
+
[x: `uint104[${string}]`]: undefined;
|
|
177
|
+
[x: `uint112[${string}]`]: undefined;
|
|
178
|
+
[x: `uint120[${string}]`]: undefined;
|
|
179
|
+
[x: `uint128[${string}]`]: undefined;
|
|
180
|
+
[x: `uint136[${string}]`]: undefined;
|
|
181
|
+
[x: `uint144[${string}]`]: undefined;
|
|
182
|
+
[x: `uint152[${string}]`]: undefined;
|
|
183
|
+
[x: `uint160[${string}]`]: undefined;
|
|
184
|
+
[x: `uint168[${string}]`]: undefined;
|
|
185
|
+
[x: `uint176[${string}]`]: undefined;
|
|
186
|
+
[x: `uint184[${string}]`]: undefined;
|
|
187
|
+
[x: `uint192[${string}]`]: undefined;
|
|
188
|
+
[x: `uint200[${string}]`]: undefined;
|
|
189
|
+
[x: `uint208[${string}]`]: undefined;
|
|
190
|
+
[x: `uint216[${string}]`]: undefined;
|
|
191
|
+
[x: `uint224[${string}]`]: undefined;
|
|
192
|
+
[x: `uint232[${string}]`]: undefined;
|
|
193
|
+
[x: `uint240[${string}]`]: undefined;
|
|
194
|
+
[x: `uint248[${string}]`]: undefined;
|
|
195
|
+
[x: `uint256[${string}]`]: undefined;
|
|
196
|
+
string?: undefined;
|
|
197
|
+
address?: undefined;
|
|
198
|
+
bool?: undefined;
|
|
199
|
+
bytes?: undefined;
|
|
200
|
+
bytes9?: undefined;
|
|
201
|
+
bytes1?: undefined;
|
|
202
|
+
bytes32?: undefined;
|
|
203
|
+
bytes31?: undefined;
|
|
204
|
+
bytes30?: undefined;
|
|
205
|
+
bytes29?: undefined;
|
|
206
|
+
bytes28?: undefined;
|
|
207
|
+
bytes27?: undefined;
|
|
208
|
+
bytes26?: undefined;
|
|
209
|
+
bytes25?: undefined;
|
|
210
|
+
bytes24?: undefined;
|
|
211
|
+
bytes23?: undefined;
|
|
212
|
+
bytes22?: undefined;
|
|
213
|
+
bytes21?: undefined;
|
|
214
|
+
bytes20?: undefined;
|
|
215
|
+
bytes19?: undefined;
|
|
216
|
+
bytes2?: undefined;
|
|
217
|
+
bytes18?: undefined;
|
|
218
|
+
bytes17?: undefined;
|
|
219
|
+
bytes16?: undefined;
|
|
220
|
+
bytes15?: undefined;
|
|
221
|
+
bytes14?: undefined;
|
|
222
|
+
bytes13?: undefined;
|
|
223
|
+
bytes12?: undefined;
|
|
224
|
+
bytes11?: undefined;
|
|
225
|
+
bytes10?: undefined;
|
|
226
|
+
bytes8?: undefined;
|
|
227
|
+
bytes7?: undefined;
|
|
228
|
+
bytes6?: undefined;
|
|
229
|
+
bytes5?: undefined;
|
|
230
|
+
bytes4?: undefined;
|
|
231
|
+
bytes3?: undefined;
|
|
232
|
+
int40?: undefined;
|
|
233
|
+
int32?: undefined;
|
|
234
|
+
int24?: undefined;
|
|
235
|
+
int16?: undefined;
|
|
236
|
+
int8?: undefined;
|
|
237
|
+
int48?: undefined;
|
|
238
|
+
int56?: undefined;
|
|
239
|
+
int64?: undefined;
|
|
240
|
+
int72?: undefined;
|
|
241
|
+
int80?: undefined;
|
|
242
|
+
int88?: undefined;
|
|
243
|
+
int96?: undefined;
|
|
244
|
+
int104?: undefined;
|
|
245
|
+
int112?: undefined;
|
|
246
|
+
int120?: undefined;
|
|
247
|
+
int128?: undefined;
|
|
248
|
+
int136?: undefined;
|
|
249
|
+
int144?: undefined;
|
|
250
|
+
int152?: undefined;
|
|
251
|
+
int160?: undefined;
|
|
252
|
+
int168?: undefined;
|
|
253
|
+
int176?: undefined;
|
|
254
|
+
int184?: undefined;
|
|
255
|
+
int192?: undefined;
|
|
256
|
+
int200?: undefined;
|
|
257
|
+
int208?: undefined;
|
|
258
|
+
int216?: undefined;
|
|
259
|
+
int224?: undefined;
|
|
260
|
+
int232?: undefined;
|
|
261
|
+
int240?: undefined;
|
|
262
|
+
int248?: undefined;
|
|
263
|
+
int256?: undefined;
|
|
264
|
+
uint40?: undefined;
|
|
265
|
+
uint32?: undefined;
|
|
266
|
+
uint24?: undefined;
|
|
267
|
+
uint16?: undefined;
|
|
268
|
+
uint8?: undefined;
|
|
269
|
+
uint48?: undefined;
|
|
270
|
+
uint56?: undefined;
|
|
271
|
+
uint64?: undefined;
|
|
272
|
+
uint72?: undefined;
|
|
273
|
+
uint80?: undefined;
|
|
274
|
+
uint88?: undefined;
|
|
275
|
+
uint96?: undefined;
|
|
276
|
+
uint104?: undefined;
|
|
277
|
+
uint112?: undefined;
|
|
278
|
+
uint120?: undefined;
|
|
279
|
+
uint128?: undefined;
|
|
280
|
+
uint136?: undefined;
|
|
281
|
+
uint144?: undefined;
|
|
282
|
+
uint152?: undefined;
|
|
283
|
+
uint160?: undefined;
|
|
284
|
+
uint168?: undefined;
|
|
285
|
+
uint176?: undefined;
|
|
286
|
+
uint184?: undefined;
|
|
287
|
+
uint192?: undefined;
|
|
288
|
+
uint200?: undefined;
|
|
289
|
+
uint208?: undefined;
|
|
290
|
+
uint216?: undefined;
|
|
291
|
+
uint224?: undefined;
|
|
292
|
+
uint232?: undefined;
|
|
293
|
+
uint240?: undefined;
|
|
294
|
+
uint248?: undefined;
|
|
295
|
+
uint256?: undefined;
|
|
296
|
+
} | {
|
|
297
|
+
[key: string]: unknown;
|
|
298
|
+
}, TPrimaryType extends string>(args: import("viem").SignTypedDataParameters<TTypedData, TPrimaryType, Account | undefined>) => Promise<`0x${string}`>;
|
|
299
|
+
switchChain: (args: import("viem").SwitchChainParameters) => Promise<void>;
|
|
300
|
+
watchAsset: (args: import("viem").WatchAssetParams) => Promise<boolean>;
|
|
301
|
+
writeContract: <const abi_1 extends import("viem").Abi | readonly unknown[], functionName extends import("viem").ContractFunctionName<abi_1, "nonpayable" | "payable">, args extends import("viem").ContractFunctionArgs<abi_1, "pure" | "view", functionName>, TChainOverride_3 extends ViemChain | undefined = undefined>(args: import("viem").WriteContractParameters<abi_1, functionName, args, ViemChain, Account | undefined, TChainOverride_3>) => Promise<`0x${string}`>;
|
|
302
|
+
extend: <const client extends {
|
|
303
|
+
[x: string]: unknown;
|
|
304
|
+
account?: undefined;
|
|
305
|
+
batch?: undefined;
|
|
306
|
+
cacheTime?: undefined;
|
|
307
|
+
chain?: undefined;
|
|
308
|
+
key?: undefined;
|
|
309
|
+
name?: undefined;
|
|
310
|
+
pollingInterval?: undefined;
|
|
311
|
+
request?: undefined;
|
|
312
|
+
transport?: undefined;
|
|
313
|
+
type?: undefined;
|
|
314
|
+
uid?: undefined;
|
|
315
|
+
} & Partial<Pick<import("viem").PublicActions<Transport, ViemChain, Account | undefined>, "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getChainId" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "prepareTransactionRequest" | "readContract" | "sendRawTransaction" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<import("viem").WalletActions<ViemChain, Account | undefined>, "sendTransaction" | "writeContract">>>(fn: (client: import("viem").Client<Transport, ViemChain, Account | undefined, import("viem").WalletRpcSchema, import("viem").WalletActions<ViemChain, Account | undefined>>) => client) => import("viem").Client<Transport, ViemChain, Account | undefined, import("viem").WalletRpcSchema, { [K in keyof client]: client[K]; } & import("viem").WalletActions<ViemChain, Account | undefined>>;
|
|
316
|
+
} | undefined>;
|
|
317
|
+
canSponsorTransactionGas(transaction: IUITransaction): Promise<boolean>;
|
|
48
318
|
disableGasSponsorshipOnce(): void;
|
|
49
319
|
getBalance(): Promise<string | undefined>;
|
|
50
320
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
321
|
+
createUiTransaction(from: string): Promise<IUITransaction>;
|
|
51
322
|
}
|
|
52
323
|
export {};
|