@dynamic-labs/ethereum-aa 1.0.0-alpha.4 → 1.0.0-alpha.6

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 CHANGED
@@ -1,4 +1,24 @@
1
1
 
2
+ ## [1.0.0-alpha.6](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2023-11-29)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * transaction layout show alert ([#4024](https://github.com/dynamic-labs/DynamicAuth/issues/4024)) ([52057f5](https://github.com/dynamic-labs/DynamicAuth/commit/52057f54ebc32464b2486a2328cb6310caf85208)), closes [#4020](https://github.com/dynamic-labs/DynamicAuth/issues/4020)
8
+
9
+ ## [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)
10
+
11
+
12
+ ### Features
13
+
14
+ * gracefully handle uknown wallet ([#3997](https://github.com/dynamic-labs/DynamicAuth/issues/3997)) ([ce7ff6a](https://github.com/dynamic-labs/DynamicAuth/commit/ce7ff6a50a8e8947050734b61587c8cadd041dbe))
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * remove total on sponsored transactions ([#4019](https://github.com/dynamic-labs/DynamicAuth/issues/4019)) ([d976678](https://github.com/dynamic-labs/DynamicAuth/commit/d9766787b29665fbcd7983c5d61c31a4d97c8257))
20
+ * send balance align information ([#4020](https://github.com/dynamic-labs/DynamicAuth/issues/4020)) ([508dccf](https://github.com/dynamic-labs/DynamicAuth/commit/508dccfa2c6aeaed30616b6a41b30002cccb3b40))
21
+
2
22
  ## [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
23
 
4
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum-aa",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0-alpha.6",
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.4",
32
- "@dynamic-labs/types": "1.0.0-alpha.4",
33
- "@dynamic-labs/utils": "1.0.0-alpha.4",
34
- "@dynamic-labs/viem-utils": "1.0.0-alpha.4",
35
- "@dynamic-labs/wallet-book": "1.0.0-alpha.4",
36
- "@dynamic-labs/wallet-connector-core": "1.0.0-alpha.4"
31
+ "@dynamic-labs/logger": "1.0.0-alpha.6",
32
+ "@dynamic-labs/types": "1.0.0-alpha.6",
33
+ "@dynamic-labs/utils": "1.0.0-alpha.6",
34
+ "@dynamic-labs/viem-utils": "1.0.0-alpha.6",
35
+ "@dynamic-labs/wallet-book": "1.0.0-alpha.6",
36
+ "@dynamic-labs/wallet-connector-core": "1.0.0-alpha.6"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "viem": "^1.1.0"
@@ -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
- opts: {
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
- getProviderWithoutSponsorship() {
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
- return sdk.ECDSAProvider.init({
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
- ? yield this.getProviderWithoutSponsorship()
123
- : provider;
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.error(err);
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.error(err);
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 getProviderWithoutSponsorship;
39
+ private getProviderWithSponsorshipValidation;
39
40
  fetchPublicAddress(): Promise<string | undefined>;
40
41
  getConnectedAccounts(): Promise<string[]>;
41
42
  getNetwork(): Promise<number | undefined>;
@@ -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
- opts: {
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
- getProviderWithoutSponsorship() {
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
- return ECDSAProvider.init({
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
- ? yield this.getProviderWithoutSponsorship()
119
- : provider;
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.error(err);
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.error(err);
201
+ logger.debug(err);
192
202
  return false;
193
203
  }
194
204
  });