@openocean.finance/wallet 0.4.27 → 0.4.29

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.
@@ -10,6 +10,6 @@ declare class BloctoWallet extends BaseWallet {
10
10
  * connect metamask and get wallet address
11
11
  * @param chainId specific chainId,throw error when not match
12
12
  */
13
- requestFlowConnect(chainId?: number): Promise<void>;
13
+ requestConnect(chainId?: number): Promise<string>;
14
14
  }
15
15
  export default BloctoWallet;
@@ -103,25 +103,33 @@ var BloctoWallet = /** @class */ (function (_super) {
103
103
  * connect metamask and get wallet address
104
104
  * @param chainId specific chainId,throw error when not match
105
105
  */
106
- BloctoWallet.prototype.requestFlowConnect = function (chainId) {
106
+ BloctoWallet.prototype.requestConnect = function (chainId) {
107
107
  return __awaiter(this, void 0, void 0, function () {
108
- var currentUser;
108
+ var _this = this;
109
109
  return __generator(this, function (_a) {
110
- switch (_a.label) {
111
- case 0:
110
+ return [2 /*return*/, new Promise(function (res) {
112
111
  fcl.config()
113
112
  .put("challenge.scope", "email") // request for Email
114
113
  .put("accessNode.api", "https://rest-mainnet.onflow.org") // Flow mainnet
115
114
  .put("discovery.wallet", "https://flow-wallet.blocto.app/authn") // Blocto wallet
116
115
  .put("service.OpenID.scopes", "email!");
117
- this.sdk = fcl;
118
- return [4 /*yield*/, fcl.currentUser.snapshot()];
119
- case 1:
120
- currentUser = _a.sent();
121
- this.address = currentUser;
122
- this.chainId = ''; // todo sollet chainId
123
- return [2 /*return*/];
124
- }
116
+ _this.sdk = fcl;
117
+ fcl
118
+ .currentUser()
119
+ .subscribe(function (user) {
120
+ console.log('currentUser', user);
121
+ var addr = (user || {}).addr;
122
+ if (!addr) {
123
+ fcl.authenticate();
124
+ }
125
+ else {
126
+ _this.address = addr;
127
+ res(addr);
128
+ }
129
+ });
130
+ _this.address = '';
131
+ _this.chainId = ''; // todo sollet chainId
132
+ })];
125
133
  });
126
134
  });
127
135
  };
@@ -86,10 +86,10 @@ var CoinbaseWallet = /** @class */ (function (_super) {
86
86
  return __generator(this, function (_a) {
87
87
  switch (_a.label) {
88
88
  case 0:
89
- if (!(window.ethereum && window.ethereum.isCoinbaseWallet)) {
89
+ if (!window.coinbaseWalletExtension) {
90
90
  throw new Error(types_1.EnumErrors.NoCoinbase);
91
91
  }
92
- this.sdk = new web3_1.default(window.ethereum);
92
+ this.sdk = new web3_1.default(window.coinbaseWalletExtension);
93
93
  return [4 /*yield*/, this.sdk.eth.requestAccounts()];
94
94
  case 1:
95
95
  address = (_a.sent())[0];
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>blocto</title>
4
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
5
+ <g id="blocto">
6
+ <circle id="Oval" fill="#FFFFFF" fill-rule="nonzero" cx="16" cy="16" r="16"></circle>
7
+ <path d="M9.11580196,6 C11.3644322,6.00590728 13.175772,6.88946273 14.5497456,8.65070421 C15.1806132,9.54713451 15.5466376,10.5443294 15.6478945,11.6422132 C15.6731519,13.8637684 15.6731519,16.0852858 15.6478945,18.306841 C15.5784839,18.4772434 15.4585585,18.5971688 15.2881561,18.6665794 C13.3064517,18.6918368 11.3247095,18.6918368 9.34300518,18.6665794 C9.22050478,18.61508 9.12583677,18.5330218 9.05900116,18.4204426 C8.9961416,14.3329052 8.98349396,10.2432473 9.02113396,6.15146881 C9.04620204,6.09527388 9.07778329,6.0447969 9.11580196,6 Z" id="Path" fill="#182A71"></path>
8
+ <path d="M17.0679146,11.604346 C19.5492009,11.7431293 21.4867142,12.8286685 22.8805303,14.8609255 C23.4098002,15.716535 23.7758624,16.6379576 23.9786791,17.6252313 C24.0039366,17.8271771 24.0039366,18.0291608 23.9786791,18.2311066 C23.905444,18.4684203 23.7476892,18.6136032 23.5053391,18.6665794 C22.3567132,18.6918368 21.2080495,18.6918368 20.0594236,18.6665794 C18.2515298,18.4237749 17.1849243,17.4076464 16.859645,15.6182696 C16.8343876,14.3560421 16.8343876,13.0937767 16.859645,11.8315493 C16.9111444,11.7360103 16.980555,11.6602759 17.0679146,11.604346 Z" id="Path" fill="#3485C4"></path>
9
+ <path d="M9.34300518,19.4428571 C14.101663,19.4365332 18.8603208,19.4428571 23.6189407,19.4617907 C23.8930993,19.533852 24.0193107,19.7105403 23.9976127,19.9919315 C23.6796418,22.5552761 22.4174144,24.4991511 20.2108924,25.8234808 C18.357823,26.8166239 16.413948,27.0438271 14.3793432,26.5050904 C11.470574,25.5276622 9.69713926,23.539634 9.05900116,20.541006 C9.03730325,20.3582588 9.01836965,20.1752466 9.00220035,19.9919315 C8.99663388,19.7311401 9.11023548,19.5481279 9.34300518,19.4428571 Z" id="Path" fill="#AFD8F7"></path>
10
+ </g>
11
+ </g>
12
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openocean.finance/wallet",
3
- "version": "0.4.27",
3
+ "version": "0.4.29",
4
4
  "description": "A multi-chain wallets manager",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {