@dynamic-labs/ethereum-aa 1.0.0-alpha.4 → 1.0.0-alpha.5
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 +13 -0
- package/package.json +7 -7
- package/src/ZeroDevConnector.cjs +22 -12
- package/src/ZeroDevConnector.d.ts +2 -1
- package/src/ZeroDevConnector.js +22 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
|
|
2
|
+
## [1.0.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2023-11-29)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* gracefully handle uknown wallet ([#3997](https://github.com/dynamic-labs/DynamicAuth/issues/3997)) ([ce7ff6a](https://github.com/dynamic-labs/DynamicAuth/commit/ce7ff6a50a8e8947050734b61587c8cadd041dbe))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* remove total on sponsored transactions ([#4019](https://github.com/dynamic-labs/DynamicAuth/issues/4019)) ([d976678](https://github.com/dynamic-labs/DynamicAuth/commit/d9766787b29665fbcd7983c5d61c31a4d97c8257))
|
|
13
|
+
* send balance align information ([#4020](https://github.com/dynamic-labs/DynamicAuth/issues/4020)) ([508dccf](https://github.com/dynamic-labs/DynamicAuth/commit/508dccfa2c6aeaed30616b6a41b30002cccb3b40))
|
|
14
|
+
|
|
2
15
|
## [1.0.0-alpha.4](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2023-11-28)
|
|
3
16
|
|
|
4
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ethereum-aa",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@zerodev/sdk": "^4.1.5",
|
|
30
30
|
"@dynamic-labs/sdk-api": "0.0.311",
|
|
31
|
-
"@dynamic-labs/logger": "1.0.0-alpha.
|
|
32
|
-
"@dynamic-labs/types": "1.0.0-alpha.
|
|
33
|
-
"@dynamic-labs/utils": "1.0.0-alpha.
|
|
34
|
-
"@dynamic-labs/viem-utils": "1.0.0-alpha.
|
|
35
|
-
"@dynamic-labs/wallet-book": "1.0.0-alpha.
|
|
36
|
-
"@dynamic-labs/wallet-connector-core": "1.0.0-alpha.
|
|
31
|
+
"@dynamic-labs/logger": "1.0.0-alpha.5",
|
|
32
|
+
"@dynamic-labs/types": "1.0.0-alpha.5",
|
|
33
|
+
"@dynamic-labs/utils": "1.0.0-alpha.5",
|
|
34
|
+
"@dynamic-labs/viem-utils": "1.0.0-alpha.5",
|
|
35
|
+
"@dynamic-labs/wallet-book": "1.0.0-alpha.5",
|
|
36
|
+
"@dynamic-labs/wallet-connector-core": "1.0.0-alpha.5"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"viem": "^1.1.0"
|
package/src/ZeroDevConnector.cjs
CHANGED
|
@@ -43,12 +43,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
43
43
|
this.eoaConnector = connector;
|
|
44
44
|
const signer = yield this.eoaConnector.getSigner();
|
|
45
45
|
const zeroDevProvider = yield sdk.ECDSAProvider.init({
|
|
46
|
-
|
|
47
|
-
paymasterConfig: {
|
|
48
|
-
onlySendSponsoredTransaction: true,
|
|
49
|
-
policy: 'VERIFYING_PAYMASTER',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
46
|
+
bundlerProvider: 'STACKUP',
|
|
52
47
|
owner: sdk.convertWalletClientToAccountSigner(signer),
|
|
53
48
|
projectId: this.projectId,
|
|
54
49
|
});
|
|
@@ -73,16 +68,31 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
73
68
|
}
|
|
74
69
|
});
|
|
75
70
|
}
|
|
76
|
-
|
|
71
|
+
getProviderWithSponsorshipValidation() {
|
|
77
72
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
if (this.providerWithSponsorship) {
|
|
74
|
+
return this.providerWithSponsorship;
|
|
75
|
+
}
|
|
78
76
|
const { eoaConnector } = this;
|
|
79
77
|
if (!eoaConnector)
|
|
80
78
|
throw new utils.DynamicError('No EOA connector');
|
|
81
79
|
const signer = yield eoaConnector.getSigner();
|
|
82
|
-
|
|
80
|
+
this.providerWithSponsorship = yield sdk.ECDSAProvider.init({
|
|
81
|
+
bundlerProvider: 'STACKUP',
|
|
82
|
+
opts: {
|
|
83
|
+
paymasterConfig: {
|
|
84
|
+
onlySendSponsoredTransaction: true,
|
|
85
|
+
policy: 'VERIFYING_PAYMASTER',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
83
88
|
owner: sdk.convertWalletClientToAccountSigner(signer),
|
|
84
89
|
projectId: this.projectId,
|
|
85
90
|
});
|
|
91
|
+
utils.wrapMethodWithCallback(this.providerWithSponsorship, 'sendUserOperation', (original, ...args) => {
|
|
92
|
+
this._walletUiUtils.disabledConfirmationOnce();
|
|
93
|
+
return original(...args);
|
|
94
|
+
});
|
|
95
|
+
return this.providerWithSponsorship;
|
|
86
96
|
});
|
|
87
97
|
}
|
|
88
98
|
fetchPublicAddress() {
|
|
@@ -119,13 +129,13 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
119
129
|
try {
|
|
120
130
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
121
131
|
const effectiveProvider = this.isGasSponsorshipDisabled
|
|
122
|
-
?
|
|
123
|
-
:
|
|
132
|
+
? provider
|
|
133
|
+
: yield this.getProviderWithSponsorshipValidation();
|
|
124
134
|
const response = yield effectiveProvider.sendTransaction(viemUtils.unFormatTransaction(transaction));
|
|
125
135
|
return response;
|
|
126
136
|
}
|
|
127
137
|
catch (err) {
|
|
128
|
-
logger.logger.
|
|
138
|
+
logger.logger.debug(err);
|
|
129
139
|
if (isGasNotSponsoredError.isGasNotSponsoredError(err)) {
|
|
130
140
|
throw new utils.TransactionGasCannotBeSponsoredError();
|
|
131
141
|
}
|
|
@@ -192,7 +202,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
192
202
|
return result.paymasterAndData !== '0x';
|
|
193
203
|
}
|
|
194
204
|
catch (err) {
|
|
195
|
-
logger.logger.
|
|
205
|
+
logger.logger.debug(err);
|
|
196
206
|
return false;
|
|
197
207
|
}
|
|
198
208
|
});
|
|
@@ -16,6 +16,7 @@ export declare class ZeroDevConnector extends WalletConnectorBase implements IAc
|
|
|
16
16
|
projectId: string;
|
|
17
17
|
zeroDevProvider: ECDSAProvider | undefined;
|
|
18
18
|
eoaConnector: WalletConnector | undefined;
|
|
19
|
+
private providerWithSponsorship;
|
|
19
20
|
connectedChain: Chain;
|
|
20
21
|
supportedChains: Chain[];
|
|
21
22
|
evmNetworks: EvmNetwork[];
|
|
@@ -35,7 +36,7 @@ export declare class ZeroDevConnector extends WalletConnectorBase implements IAc
|
|
|
35
36
|
getAccountAbstractionProvider(): ECDSAProvider | undefined;
|
|
36
37
|
setEoaConnector(connector: WalletConnector): Promise<void>;
|
|
37
38
|
private checkIsProjectChainEnabled;
|
|
38
|
-
private
|
|
39
|
+
private getProviderWithSponsorshipValidation;
|
|
39
40
|
fetchPublicAddress(): Promise<string | undefined>;
|
|
40
41
|
getConnectedAccounts(): Promise<string[]>;
|
|
41
42
|
getNetwork(): Promise<number | undefined>;
|
package/src/ZeroDevConnector.js
CHANGED
|
@@ -39,12 +39,7 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
39
39
|
this.eoaConnector = connector;
|
|
40
40
|
const signer = yield this.eoaConnector.getSigner();
|
|
41
41
|
const zeroDevProvider = yield ECDSAProvider.init({
|
|
42
|
-
|
|
43
|
-
paymasterConfig: {
|
|
44
|
-
onlySendSponsoredTransaction: true,
|
|
45
|
-
policy: 'VERIFYING_PAYMASTER',
|
|
46
|
-
},
|
|
47
|
-
},
|
|
42
|
+
bundlerProvider: 'STACKUP',
|
|
48
43
|
owner: convertWalletClientToAccountSigner(signer),
|
|
49
44
|
projectId: this.projectId,
|
|
50
45
|
});
|
|
@@ -69,16 +64,31 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
69
64
|
}
|
|
70
65
|
});
|
|
71
66
|
}
|
|
72
|
-
|
|
67
|
+
getProviderWithSponsorshipValidation() {
|
|
73
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
if (this.providerWithSponsorship) {
|
|
70
|
+
return this.providerWithSponsorship;
|
|
71
|
+
}
|
|
74
72
|
const { eoaConnector } = this;
|
|
75
73
|
if (!eoaConnector)
|
|
76
74
|
throw new DynamicError('No EOA connector');
|
|
77
75
|
const signer = yield eoaConnector.getSigner();
|
|
78
|
-
|
|
76
|
+
this.providerWithSponsorship = yield ECDSAProvider.init({
|
|
77
|
+
bundlerProvider: 'STACKUP',
|
|
78
|
+
opts: {
|
|
79
|
+
paymasterConfig: {
|
|
80
|
+
onlySendSponsoredTransaction: true,
|
|
81
|
+
policy: 'VERIFYING_PAYMASTER',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
79
84
|
owner: convertWalletClientToAccountSigner(signer),
|
|
80
85
|
projectId: this.projectId,
|
|
81
86
|
});
|
|
87
|
+
wrapMethodWithCallback(this.providerWithSponsorship, 'sendUserOperation', (original, ...args) => {
|
|
88
|
+
this._walletUiUtils.disabledConfirmationOnce();
|
|
89
|
+
return original(...args);
|
|
90
|
+
});
|
|
91
|
+
return this.providerWithSponsorship;
|
|
82
92
|
});
|
|
83
93
|
}
|
|
84
94
|
fetchPublicAddress() {
|
|
@@ -115,13 +125,13 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
115
125
|
try {
|
|
116
126
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
117
127
|
const effectiveProvider = this.isGasSponsorshipDisabled
|
|
118
|
-
?
|
|
119
|
-
:
|
|
128
|
+
? provider
|
|
129
|
+
: yield this.getProviderWithSponsorshipValidation();
|
|
120
130
|
const response = yield effectiveProvider.sendTransaction(unFormatTransaction(transaction));
|
|
121
131
|
return response;
|
|
122
132
|
}
|
|
123
133
|
catch (err) {
|
|
124
|
-
logger.
|
|
134
|
+
logger.debug(err);
|
|
125
135
|
if (isGasNotSponsoredError(err)) {
|
|
126
136
|
throw new TransactionGasCannotBeSponsoredError();
|
|
127
137
|
}
|
|
@@ -188,7 +198,7 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
188
198
|
return result.paymasterAndData !== '0x';
|
|
189
199
|
}
|
|
190
200
|
catch (err) {
|
|
191
|
-
logger.
|
|
201
|
+
logger.debug(err);
|
|
192
202
|
return false;
|
|
193
203
|
}
|
|
194
204
|
});
|