@openocean.finance/wallet 0.4.23 → 0.4.26

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.
@@ -73,10 +73,7 @@ var BitKeepWallet = /** @class */ (function (_super) {
73
73
  _this.icon = bitkeep_svg_1.default;
74
74
  _this.supportChains = [
75
75
  types_1.EnumChains.ETH,
76
- types_1.EnumChains.ROPSTEN,
77
- types_1.EnumChains.RINKEBY,
78
76
  types_1.EnumChains.BSC,
79
- types_1.EnumChains.BSCTEST,
80
77
  types_1.EnumChains.Polygon,
81
78
  types_1.EnumChains.OKEX,
82
79
  types_1.EnumChains.XDai,
@@ -85,11 +82,11 @@ var BitKeepWallet = /** @class */ (function (_super) {
85
82
  types_1.EnumChains.Avalanche,
86
83
  types_1.EnumChains.Arbitrum,
87
84
  types_1.EnumChains.Optimism,
88
- types_1.EnumChains.Boba,
89
- types_1.EnumChains.Moonriver,
90
- types_1.EnumChains.Aurora,
91
- types_1.EnumChains.Cronos,
92
- types_1.EnumChains.Harmony
85
+ // EnumChains.Boba,
86
+ // EnumChains.Moonriver,
87
+ // EnumChains.Aurora,
88
+ // EnumChains.Cronos,
89
+ // EnumChains.Harmony
93
90
  ];
94
91
  _this.type = types_1.EnumWalletType.Extension;
95
92
  _this.sdk = null;
@@ -90,10 +90,15 @@ var BscWallet = /** @class */ (function (_super) {
90
90
  // go2 download page
91
91
  throw new Error(types_1.EnumErrors.NotBinance);
92
92
  }
93
+ console.log('BinanceChain-1');
94
+ console.log(window.BinanceChain);
93
95
  this.sdk = new web3_1.default(window.BinanceChain);
96
+ console.log('BinanceChain-2');
97
+ console.log(this.sdk);
94
98
  return [4 /*yield*/, this.sdk.eth.requestAccounts()];
95
99
  case 1:
96
100
  account = (_a.sent())[0];
101
+ console.log('BinanceChain-3');
97
102
  return [4 /*yield*/, this.sdk.eth.getChainId()];
98
103
  case 2:
99
104
  currentChainId = _a.sent();
@@ -1,12 +1,11 @@
1
- import { EnumWalletName, EnumWalletType } from "../types";
1
+ import { EnumChains, EnumWalletName, EnumWalletType } from "../types";
2
2
  import BaseWallet from "./BaseWallet";
3
- import Web3 from "web3";
4
3
  declare class GnosisSafeWallet extends BaseWallet {
5
4
  name: EnumWalletName;
6
5
  icon: any;
7
- supportChains: never[];
6
+ supportChains: EnumChains[];
8
7
  type: EnumWalletType;
9
- sdk: Web3 | null;
8
+ sdk: any;
10
9
  /**
11
10
  * connect metamask and get wallet address
12
11
  * @param chainId specific chainId,throw error when not match
@@ -73,9 +73,8 @@ var GnosisSafeWallet = /** @class */ (function (_super) {
73
73
  var _this = _super !== null && _super.apply(this, arguments) || this;
74
74
  _this.name = types_1.EnumWalletName.GnosisSafeWallet;
75
75
  _this.icon = metamask_svg_1.default;
76
- _this.supportChains = [];
76
+ _this.supportChains = [types_1.EnumChains.RINKEBY];
77
77
  _this.type = types_1.EnumWalletType.Extension;
78
- _this.sdk = null;
79
78
  return _this;
80
79
  }
81
80
  /**
@@ -84,7 +83,7 @@ var GnosisSafeWallet = /** @class */ (function (_super) {
84
83
  */
85
84
  GnosisSafeWallet.prototype.requestConnect = function (chainId) {
86
85
  return __awaiter(this, void 0, void 0, function () {
87
- var opts, sdk, safe, provider, address, currentChainId;
86
+ var opts, sdk, safe, provider, currentChainId;
88
87
  return __generator(this, function (_a) {
89
88
  switch (_a.label) {
90
89
  case 0:
@@ -97,19 +96,15 @@ var GnosisSafeWallet = /** @class */ (function (_super) {
97
96
  case 1:
98
97
  safe = _a.sent();
99
98
  provider = new safe_apps_provider_1.SafeAppProvider(safe, sdk);
100
- this.sdk = new web3_1.default(provider);
101
- return [4 /*yield*/, this.sdk.eth.requestAccounts()];
102
- case 2:
103
- address = (_a.sent())[0];
104
- return [4 /*yield*/, this.sdk.eth.getChainId()];
105
- case 3:
106
- currentChainId = _a.sent();
99
+ this.sdk = new web3_1.default(provider).currentProvider.sdk;
100
+ console.log('sdk', this.sdk);
101
+ currentChainId = safe.chainId;
107
102
  if (chainId && currentChainId !== chainId) {
108
103
  throw new Error(types_1.EnumErrors.ChainIdNotMath);
109
104
  }
110
- this.address = address;
105
+ this.address = safe.safeAddress;
111
106
  this.chainId = currentChainId;
112
- return [2 /*return*/, address];
107
+ return [2 /*return*/, this.address];
113
108
  }
114
109
  });
115
110
  });
@@ -145,24 +145,23 @@ var WalletConnect = /** @class */ (function (_super) {
145
145
  return [4 /*yield*/, this.sdk.eth.getChainId()];
146
146
  case 2:
147
147
  currentChainId = _a.sent();
148
- if (!(chainId && currentChainId != chainId)) return [3 /*break*/, 6];
149
- if (!(!config || !config.isSecond)) return [3 /*break*/, 6];
150
- return [4 /*yield*/, provider.disconnect()];
151
- case 3:
152
- _a.sent();
153
- return [4 /*yield*/, new Promise(function (r) {
154
- setTimeout(r, 500);
155
- })];
156
- case 4:
157
- _a.sent();
158
- return [4 /*yield*/, this.requestConnect(chainId, __assign({ isSecond: true }, config))];
159
- case 5: return [2 /*return*/, _a.sent()];
160
- case 6:
148
+ // if (chainId && currentChainId != chainId) {
149
+ // if (!config || !config.isSecond) {
150
+ // await provider.disconnect()
151
+ // await new Promise(r => {
152
+ // setTimeout(r, 500);
153
+ // })
154
+ // return await this.requestConnect(chainId, {
155
+ // isSecond: true,
156
+ // ...config
157
+ // })
158
+ // }
159
+ // }
161
160
  if (chainId && currentChainId != chainId) {
162
161
  throw new Error(types_1.EnumErrors.ChainIdNotMath);
163
162
  }
164
163
  return [4 /*yield*/, this.sdk.eth.getAccounts()];
165
- case 7:
164
+ case 3:
166
165
  address = (_a.sent())[0];
167
166
  this.address = address;
168
167
  this.chainId = currentChainId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openocean.finance/wallet",
3
- "version": "0.4.23",
3
+ "version": "0.4.26",
4
4
  "description": "A multi-chain wallets manager",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {