@dynamic-labs/ethereum-aa 2.0.0-alpha.3 → 2.0.0-alpha.31
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 +407 -0
- package/package.json +13 -10
- package/src/ZeroDevConnector.cjs +110 -68
- package/src/ZeroDevConnector.d.ts +287 -16
- package/src/ZeroDevConnector.js +112 -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,17 @@
|
|
|
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 ethereum = require('@dynamic-labs/ethereum');
|
|
13
|
+
var fetchChain = require('./utils/fetchChain.cjs');
|
|
11
14
|
var logger = require('./utils/logger.cjs');
|
|
12
15
|
|
|
13
16
|
class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
14
|
-
get key() {
|
|
15
|
-
return 'zerodev';
|
|
16
|
-
}
|
|
17
17
|
constructor(opts) {
|
|
18
18
|
var _a;
|
|
19
19
|
super(opts);
|
|
@@ -22,6 +22,14 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
22
22
|
this.isGasSponsorshipDisabled = false;
|
|
23
23
|
this.isEmbeddedWallet = true;
|
|
24
24
|
this.name = 'ZeroDev';
|
|
25
|
+
this.overrideKey = 'zerodev';
|
|
26
|
+
this.walletFallback = {
|
|
27
|
+
brand: {
|
|
28
|
+
alt: 'Smart Wallet',
|
|
29
|
+
spriteId: 'smartwallet',
|
|
30
|
+
},
|
|
31
|
+
name: 'ZeroDev',
|
|
32
|
+
};
|
|
25
33
|
const zeroDevProjectId = (_a = opts.apiProviders.zerodev) === null || _a === void 0 ? void 0 : _a.clientId;
|
|
26
34
|
if (!zeroDevProjectId) {
|
|
27
35
|
throw new Error('Missing ZeroDev project ID provided. Add your ZeroDev project id to your project configuration via the Dynamic Labs dashboard.');
|
|
@@ -34,28 +42,44 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
34
42
|
return this.eoaConnector;
|
|
35
43
|
}
|
|
36
44
|
getAccountAbstractionProvider() {
|
|
37
|
-
return this.
|
|
45
|
+
return this.kernelClient;
|
|
46
|
+
}
|
|
47
|
+
endSession() {
|
|
48
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
localStorage.removeItem(fetchChain.cachedChainIdKey);
|
|
50
|
+
});
|
|
38
51
|
}
|
|
39
52
|
setEoaConnector(connector) {
|
|
40
53
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
|
|
54
|
+
if (!connector) {
|
|
55
|
+
logger.logger.error('No EOA connector provided');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
this.kernelClientDeferredPromise = new utils.DeferredPromise();
|
|
42
59
|
this.eoaConnector = connector;
|
|
60
|
+
if (ethereum.isEthWalletConnector(this.eoaConnector) &&
|
|
61
|
+
!this.eoaConnector.getActiveAccount()) {
|
|
62
|
+
yield this.eoaConnector.getConnectedAccounts();
|
|
63
|
+
}
|
|
43
64
|
const signer = yield this.eoaConnector.getSigner();
|
|
44
|
-
if (!signer) {
|
|
65
|
+
if (!(signer === null || signer === void 0 ? void 0 : signer.account)) {
|
|
66
|
+
logger.logger.error('No signer account found');
|
|
45
67
|
return;
|
|
46
68
|
}
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
69
|
+
const kernelClient = yield presets.createEcdsaKernelAccountClient({
|
|
70
|
+
chain: yield fetchChain.fetchChain(this.projectId),
|
|
71
|
+
paymaster: 'NONE',
|
|
50
72
|
projectId: this.projectId,
|
|
73
|
+
provider: ZeroDevConnector.bundlerProvider,
|
|
74
|
+
signer: permissionless.walletClientToSmartAccountSigner(signer),
|
|
51
75
|
});
|
|
52
|
-
utils.wrapMethodWithCallback(
|
|
76
|
+
utils.wrapMethodWithCallback(kernelClient, 'sendUserOperation', (original, ...args) => {
|
|
53
77
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
54
78
|
return original(...args);
|
|
55
79
|
});
|
|
56
|
-
this.
|
|
80
|
+
this.kernelClient = kernelClient;
|
|
57
81
|
yield this.checkIsProjectChainEnabled();
|
|
58
|
-
this.
|
|
82
|
+
this.kernelClientDeferredPromise.resolve();
|
|
59
83
|
});
|
|
60
84
|
}
|
|
61
85
|
checkIsProjectChainEnabled() {
|
|
@@ -70,69 +94,67 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
70
94
|
}
|
|
71
95
|
});
|
|
72
96
|
}
|
|
73
|
-
|
|
97
|
+
getKernelClientWithSponsorshipValidation() {
|
|
74
98
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
if (this.
|
|
76
|
-
return this.
|
|
99
|
+
if (this.kernelClientWithSponsorship) {
|
|
100
|
+
return this.kernelClientWithSponsorship;
|
|
77
101
|
}
|
|
78
102
|
const { eoaConnector } = this;
|
|
79
103
|
if (!eoaConnector)
|
|
80
104
|
throw new utils.DynamicError('No EOA connector');
|
|
81
105
|
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),
|
|
106
|
+
this.kernelClientWithSponsorship = yield presets.createEcdsaKernelAccountClient({
|
|
107
|
+
chain: yield fetchChain.fetchChain(this.projectId),
|
|
108
|
+
paymaster: 'SPONSOR',
|
|
91
109
|
projectId: this.projectId,
|
|
110
|
+
provider: ZeroDevConnector.bundlerProvider,
|
|
111
|
+
signer: permissionless.walletClientToSmartAccountSigner(signer),
|
|
92
112
|
});
|
|
93
|
-
utils.wrapMethodWithCallback(this.
|
|
113
|
+
utils.wrapMethodWithCallback(this.kernelClientWithSponsorship, 'sendUserOperation', (original, ...args) => {
|
|
94
114
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
95
115
|
return original(...args);
|
|
96
116
|
});
|
|
97
|
-
return this.
|
|
117
|
+
return this.kernelClientWithSponsorship;
|
|
98
118
|
});
|
|
99
119
|
}
|
|
100
|
-
|
|
101
|
-
var _a, _b;
|
|
120
|
+
getAddress() {
|
|
121
|
+
var _a, _b, _c;
|
|
102
122
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
yield ((_a = this.
|
|
104
|
-
return (_b = this.
|
|
123
|
+
yield ((_a = this.kernelClientDeferredPromise) === null || _a === void 0 ? void 0 : _a.promise);
|
|
124
|
+
return (_c = (_b = this.kernelClient) === null || _b === void 0 ? void 0 : _b.account) === null || _c === void 0 ? void 0 : _c.address;
|
|
105
125
|
});
|
|
106
126
|
}
|
|
107
127
|
getConnectedAccounts() {
|
|
108
|
-
var _a;
|
|
128
|
+
var _a, _b, _c;
|
|
109
129
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
110
|
-
yield ((_a = this.
|
|
111
|
-
return this.
|
|
112
|
-
? [yield this.
|
|
130
|
+
yield ((_a = this.kernelClientDeferredPromise) === null || _a === void 0 ? void 0 : _a.promise);
|
|
131
|
+
return ((_c = (_b = this.kernelClient) === null || _b === void 0 ? void 0 : _b.account) === null || _c === void 0 ? void 0 : _c.address)
|
|
132
|
+
? [yield this.kernelClient.account.address]
|
|
113
133
|
: [];
|
|
114
134
|
});
|
|
115
135
|
}
|
|
116
136
|
getNetwork() {
|
|
117
|
-
var _a, _b;
|
|
137
|
+
var _a, _b, _c;
|
|
118
138
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
yield ((_a = this.
|
|
120
|
-
return (_b = this.
|
|
139
|
+
yield ((_a = this.kernelClientDeferredPromise) === null || _a === void 0 ? void 0 : _a.promise);
|
|
140
|
+
return (_c = (_b = this.kernelClient) === null || _b === void 0 ? void 0 : _b.chain) === null || _c === void 0 ? void 0 : _c.id;
|
|
121
141
|
});
|
|
122
142
|
}
|
|
123
143
|
getTransport(provider) {
|
|
124
144
|
const transport = viemUtils.confirmationTransport({
|
|
125
|
-
connector: this,
|
|
126
145
|
onPersonalSign: ({ message }) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
127
146
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
128
|
-
return provider.signMessage(
|
|
147
|
+
return provider.signMessage({
|
|
148
|
+
account: provider.account,
|
|
149
|
+
message,
|
|
150
|
+
});
|
|
129
151
|
}),
|
|
130
152
|
onSendTransaction: ({ transaction }) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
131
153
|
try {
|
|
132
154
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
133
155
|
const effectiveProvider = this.isGasSponsorshipDisabled
|
|
134
156
|
? provider
|
|
135
|
-
: yield this.
|
|
157
|
+
: yield this.getKernelClientWithSponsorshipValidation();
|
|
136
158
|
const response = yield effectiveProvider.sendTransaction(viemUtils.unFormatTransaction(transaction));
|
|
137
159
|
return response;
|
|
138
160
|
}
|
|
@@ -150,58 +172,69 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
150
172
|
onSignTypedData: ({ message }) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
151
173
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
152
174
|
const signTypedData = JSON.parse(message);
|
|
153
|
-
return provider.signTypedData(
|
|
175
|
+
return provider.signTypedData({
|
|
176
|
+
account: provider.account,
|
|
177
|
+
domain: signTypedData.domain,
|
|
178
|
+
message: signTypedData.message,
|
|
179
|
+
primaryType: signTypedData.primaryType,
|
|
180
|
+
types: signTypedData.types,
|
|
181
|
+
});
|
|
154
182
|
}),
|
|
155
|
-
provider: provider.
|
|
183
|
+
provider: provider.extend(viem.publicActions),
|
|
156
184
|
transport: viem.custom(provider),
|
|
185
|
+
walletConnector: this,
|
|
157
186
|
walletUiUtils: this._walletUiUtils,
|
|
158
187
|
});
|
|
159
188
|
return transport;
|
|
160
189
|
}
|
|
161
|
-
getWalletClient() {
|
|
162
|
-
|
|
190
|
+
getWalletClient(chainId) {
|
|
191
|
+
var _a;
|
|
192
|
+
const provider = this.kernelClient;
|
|
163
193
|
if (!provider)
|
|
164
194
|
throw new utils.DynamicError('No provider');
|
|
165
195
|
const transport = this.getTransport(provider);
|
|
196
|
+
const address = (_a = provider.account) === null || _a === void 0 ? void 0 : _a.address;
|
|
166
197
|
const walletClient = viem.createWalletClient({
|
|
198
|
+
account: address,
|
|
199
|
+
chain: chainId ? viemUtils.chainsMap[chainId] : provider.chain,
|
|
167
200
|
transport,
|
|
168
201
|
});
|
|
169
202
|
return walletClient;
|
|
170
203
|
}
|
|
171
204
|
getPublicClient() {
|
|
172
205
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
173
|
-
const provider = this.
|
|
206
|
+
const provider = this.kernelClient.extend(viem.publicActions);
|
|
174
207
|
if (!provider)
|
|
175
208
|
throw new utils.DynamicError('No provider');
|
|
176
|
-
return provider
|
|
209
|
+
return provider;
|
|
177
210
|
});
|
|
178
211
|
}
|
|
179
212
|
getSigner() {
|
|
180
213
|
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;
|
|
214
|
+
return this.getWalletClient();
|
|
191
215
|
});
|
|
192
216
|
}
|
|
193
217
|
canSponsorTransactionGas(transaction) {
|
|
194
|
-
var _a;
|
|
195
218
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
196
219
|
try {
|
|
220
|
+
yield this.getKernelClientWithSponsorshipValidation();
|
|
197
221
|
const userOperation = {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
222
|
+
callData: yield this.kernelClientWithSponsorship.account.encodeCallData({
|
|
223
|
+
data: transaction.data ? transaction.data : '0x',
|
|
224
|
+
to: transaction.to,
|
|
225
|
+
/**
|
|
226
|
+
* if value is undefined, it will be set to 0x0 so the sponsorship
|
|
227
|
+
* check does not fail
|
|
228
|
+
*/
|
|
229
|
+
value: transaction.value && viem.isHex(transaction.value)
|
|
230
|
+
? viem.fromHex(transaction.value, 'bigint')
|
|
231
|
+
: '0x0',
|
|
232
|
+
}),
|
|
203
233
|
};
|
|
204
|
-
const result = yield
|
|
234
|
+
const result = yield this.kernelClientWithSponsorship.prepareUserOperationRequest({
|
|
235
|
+
account: this.kernelClientWithSponsorship.account,
|
|
236
|
+
userOperation,
|
|
237
|
+
});
|
|
205
238
|
if (!result)
|
|
206
239
|
return false;
|
|
207
240
|
return result.paymasterAndData !== '0x';
|
|
@@ -216,12 +249,11 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
216
249
|
this.isGasSponsorshipDisabled = true;
|
|
217
250
|
}
|
|
218
251
|
getBalance() {
|
|
219
|
-
var _a;
|
|
220
252
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
221
|
-
const rpcClient =
|
|
253
|
+
const rpcClient = this.kernelClient.extend(viem.publicActions);
|
|
222
254
|
if (!rpcClient)
|
|
223
255
|
throw new utils.DynamicError('No RPC client');
|
|
224
|
-
const address = yield this.
|
|
256
|
+
const address = yield this.getAddress();
|
|
225
257
|
if (!address)
|
|
226
258
|
return;
|
|
227
259
|
return viem.formatEther(yield rpcClient.getBalance({ address: address }));
|
|
@@ -230,7 +262,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
230
262
|
signMessage(messageToSign) {
|
|
231
263
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
232
264
|
const client = yield this.getSigner();
|
|
233
|
-
const account = yield this.
|
|
265
|
+
const account = yield this.getAddress();
|
|
234
266
|
if (!account || !client)
|
|
235
267
|
return;
|
|
236
268
|
return client.signMessage({
|
|
@@ -239,6 +271,16 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
239
271
|
});
|
|
240
272
|
});
|
|
241
273
|
}
|
|
274
|
+
createUiTransaction(from) {
|
|
275
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
276
|
+
const walletClient = this.getWalletClient();
|
|
277
|
+
const publicClient = yield this.getPublicClient();
|
|
278
|
+
if (!publicClient || !walletClient) {
|
|
279
|
+
throw new utils.DynamicError('No public client available');
|
|
280
|
+
}
|
|
281
|
+
return viemUtils.createViemUiTransaction({ from, publicClient, walletClient });
|
|
282
|
+
});
|
|
283
|
+
}
|
|
242
284
|
}
|
|
243
285
|
|
|
244
286
|
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 {};
|