@openocean.finance/wallet 0.4.24 → 0.4.25
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/lib/Wallets/BscWallet.js
CHANGED
|
@@ -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:
|
|
6
|
+
supportChains: EnumChains[];
|
|
8
7
|
type: EnumWalletType;
|
|
9
|
-
sdk:
|
|
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
|
/**
|
|
@@ -97,7 +96,8 @@ 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);
|
|
99
|
+
this.sdk = new web3_1.default(provider).currentProvider.sdk;
|
|
100
|
+
console.log('sdk', this.sdk);
|
|
101
101
|
currentChainId = safe.chainId;
|
|
102
102
|
if (chainId && currentChainId !== chainId) {
|
|
103
103
|
throw new Error(types_1.EnumErrors.ChainIdNotMath);
|
|
@@ -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 (
|
|
149
|
-
if (!
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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
|
|
164
|
+
case 3:
|
|
166
165
|
address = (_a.sent())[0];
|
|
167
166
|
this.address = address;
|
|
168
167
|
this.chainId = currentChainId;
|