@openocean.finance/wallet 1.10.1 → 1.10.2

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.
@@ -69,6 +69,7 @@ var appkit_1 = require("@reown/appkit");
69
69
  var appkit_adapter_wagmi_1 = require("@reown/appkit-adapter-wagmi");
70
70
  var helper_1 = require("../helper");
71
71
  var chains_1 = require("viem/chains");
72
+ var helper_2 = require("../helper");
72
73
  var WalletConnect = /** @class */ (function (_super) {
73
74
  __extends(WalletConnect, _super);
74
75
  function WalletConnect() {
@@ -135,6 +136,7 @@ var WalletConnect = /** @class */ (function (_super) {
135
136
  };
136
137
  var defaultNetwork = networks.find(function (item) { return item.id == chainId; });
137
138
  this.modal = (0, appkit_1.createAppKit)({
139
+ showWallets: true,
138
140
  adapters: [wagmiAdapter],
139
141
  defaultNetwork: defaultNetwork,
140
142
  networks: networks,
@@ -142,7 +144,8 @@ var WalletConnect = /** @class */ (function (_super) {
142
144
  projectId: projectId,
143
145
  features: {
144
146
  swaps: false,
145
- analytics: true // Optional - defaults to your Cloud configuration
147
+ socials: false,
148
+ email: false,
146
149
  },
147
150
  enableWalletConnect: true,
148
151
  debug: false,
@@ -151,8 +154,8 @@ var WalletConnect = /** @class */ (function (_super) {
151
154
  },
152
155
  excludeWalletIds: [
153
156
  'a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393'
154
- ]
155
- // allWallets: 'SHOW',
157
+ ],
158
+ allWallets: 'HIDE',
156
159
  });
157
160
  this.modal.subscribeEvents(function (event) {
158
161
  console.log(event.data);
@@ -174,54 +177,63 @@ var WalletConnect = /** @class */ (function (_super) {
174
177
  return __generator(this, function (_a) {
175
178
  switch (_a.label) {
176
179
  case 0:
177
- if (!this.modal) {
178
- this.init(chainId, config);
179
- }
180
- if (!this.modal) return [3 /*break*/, 4];
180
+ if (!!this.modal) return [3 /*break*/, 2];
181
+ this.init(chainId, config);
182
+ return [4 /*yield*/, (0, helper_2.sleep)(5000)];
183
+ case 1:
184
+ _a.sent();
185
+ _a.label = 2;
186
+ case 2:
187
+ if (!this.modal) return [3 /*break*/, 6];
181
188
  provider_1 = this.modal.getWalletProvider();
182
189
  isConnected = this.modal.getIsConnectedState();
183
- if (!(provider_1 && isConnected)) return [3 /*break*/, 4];
190
+ if (!(provider_1 && isConnected)) return [3 /*break*/, 6];
184
191
  this.sdk = new web3_1.default(provider_1);
185
192
  return [4 /*yield*/, this.sdk.eth.getChainId()];
186
- case 1:
193
+ case 3:
187
194
  currentChainId_1 = _a.sent();
188
- if (!(chainId && currentChainId_1 != chainId)) return [3 /*break*/, 2];
195
+ if (!(chainId && currentChainId_1 != chainId)) return [3 /*break*/, 4];
189
196
  throw new Error(types_1.EnumErrors.ChainIdNotMath);
190
- case 2: return [4 /*yield*/, this.sdk.eth.getAccounts()];
191
- case 3:
197
+ case 4: return [4 /*yield*/, this.sdk.eth.getAccounts()];
198
+ case 5:
192
199
  address_1 = (_a.sent())[0];
193
200
  this.address = address_1;
194
201
  this.chainId = currentChainId_1;
195
202
  return [2 /*return*/, address_1];
196
- case 4: return [4 /*yield*/, this.modal.open({
203
+ case 6: return [4 /*yield*/, this.modal.open({
197
204
  view: 'Connect' //'Account' | 'Connect' | 'Networks' | 'ApproveTransaction' | 'OnRampProviders';
198
205
  })];
199
- case 5:
206
+ case 7:
200
207
  _a.sent();
201
208
  return [4 /*yield*/, (0, helper_1.autoWalletCheck)(function () {
202
209
  // const { name, icon } = this.modal.getWalletInfo()
203
210
  var _a = _this.modal.getState(), open = _a.open, selectedNetworkId = _a.selectedNetworkId;
204
211
  return !open;
205
212
  }, 1000 * 60 * 6, 60 * 3)];
206
- case 6:
213
+ case 8:
207
214
  _a.sent();
208
215
  provider = this.modal.getWalletProvider();
209
216
  if (!provider) {
210
217
  this.modal.close();
211
218
  throw new Error('Cancel connect');
212
219
  }
220
+ console.log('fk01');
213
221
  this.sdk = new web3_1.default(provider);
214
222
  return [4 /*yield*/, this.sdk.eth.getChainId()];
215
- case 7:
223
+ case 9:
216
224
  currentChainId = _a.sent();
225
+ console.log('fk02');
217
226
  if (chainId && currentChainId != chainId) {
218
227
  throw new Error(types_1.EnumErrors.ChainIdNotMath);
219
228
  }
229
+ console.log('fk03');
220
230
  return [4 /*yield*/, this.sdk.eth.getAccounts()];
221
- case 8:
231
+ case 10:
222
232
  address = (_a.sent())[0];
223
233
  this.address = address;
224
234
  this.chainId = currentChainId;
235
+ console.log('fk04');
236
+ console.log(address, currentChainId);
225
237
  return [2 /*return*/, address];
226
238
  }
227
239
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openocean.finance/wallet",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "description": "A multi-chain wallets manager",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -60,7 +60,7 @@
60
60
  "@reown/appkit-adapter-wagmi": "^1.3.0",
61
61
  "@siddomains/sidjs": "^0.1.22",
62
62
  "@solana/web3.js": "^1.91.0",
63
- "@terra-money/terra.js": "3.0.8",
63
+ "@terra-money/terra.js": "3.1.10",
64
64
  "@uauth/js": "^2.4.0",
65
65
  "@walletconnect/ethereum-provider": "^2.17.1",
66
66
  "@walletconnect/modal": "^2.6.2",