@openocean.finance/wallet 0.4.25 → 0.4.28

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;
@@ -0,0 +1,15 @@
1
+ import { EnumChains, EnumWalletName, EnumWalletType } from "../types";
2
+ import BaseWallet from "./BaseWallet";
3
+ declare class BloctoWallet extends BaseWallet {
4
+ name: EnumWalletName;
5
+ icon: any;
6
+ supportChains: EnumChains[];
7
+ type: EnumWalletType;
8
+ sdk: any;
9
+ /**
10
+ * connect metamask and get wallet address
11
+ * @param chainId specific chainId,throw error when not match
12
+ */
13
+ requestConnect(chainId?: number): Promise<string>;
14
+ }
15
+ export default BloctoWallet;
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
30
+ }) : function(o, v) {
31
+ o["default"] = v;
32
+ });
33
+ var __importStar = (this && this.__importStar) || function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
41
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
42
+ return new (P || (P = Promise))(function (resolve, reject) {
43
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
44
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
45
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
46
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
47
+ });
48
+ };
49
+ var __generator = (this && this.__generator) || function (thisArg, body) {
50
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
51
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
52
+ function verb(n) { return function (v) { return step([n, v]); }; }
53
+ function step(op) {
54
+ if (f) throw new TypeError("Generator is already executing.");
55
+ while (_) try {
56
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
57
+ if (y = 0, t) op = [op[0] & 2, t.value];
58
+ switch (op[0]) {
59
+ case 0: case 1: t = op; break;
60
+ case 4: _.label++; return { value: op[1], done: false };
61
+ case 5: _.label++; y = op[1]; op = [0]; continue;
62
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
63
+ default:
64
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
65
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
66
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
67
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
68
+ if (t[2]) _.ops.pop();
69
+ _.trys.pop(); continue;
70
+ }
71
+ op = body.call(thisArg, _);
72
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
73
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
74
+ }
75
+ };
76
+ var __importDefault = (this && this.__importDefault) || function (mod) {
77
+ return (mod && mod.__esModule) ? mod : { "default": mod };
78
+ };
79
+ Object.defineProperty(exports, "__esModule", { value: true });
80
+ /**
81
+ * @name Sollet
82
+ * @author openocean
83
+ * @date 2021/4/21
84
+ * @desc
85
+ */
86
+ // @ts-ignore
87
+ var blocto_svg_1 = __importDefault(require("../assets/blocto.svg"));
88
+ var types_1 = require("../types");
89
+ var BaseWallet_1 = __importDefault(require("./BaseWallet"));
90
+ var fcl = __importStar(require("@onflow/fcl"));
91
+ var BloctoWallet = /** @class */ (function (_super) {
92
+ __extends(BloctoWallet, _super);
93
+ function BloctoWallet() {
94
+ var _this = _super !== null && _super.apply(this, arguments) || this;
95
+ _this.name = types_1.EnumWalletName.BloctoWallet;
96
+ _this.icon = blocto_svg_1.default;
97
+ _this.supportChains = [types_1.EnumChains.Flow];
98
+ _this.type = types_1.EnumWalletType.Extension;
99
+ _this.sdk = null;
100
+ return _this;
101
+ }
102
+ /**
103
+ * connect metamask and get wallet address
104
+ * @param chainId specific chainId,throw error when not match
105
+ */
106
+ BloctoWallet.prototype.requestConnect = function (chainId) {
107
+ return __awaiter(this, void 0, void 0, function () {
108
+ var _this = this;
109
+ return __generator(this, function (_a) {
110
+ return [2 /*return*/, new Promise(function (res) {
111
+ fcl.config()
112
+ .put("challenge.scope", "email") // request for Email
113
+ .put("accessNode.api", "https://rest-mainnet.onflow.org") // Flow mainnet
114
+ .put("discovery.wallet", "https://flow-wallet.blocto.app/authn") // Blocto wallet
115
+ .put("service.OpenID.scopes", "email!");
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
+ })];
133
+ });
134
+ });
135
+ };
136
+ return BloctoWallet;
137
+ }(BaseWallet_1.default));
138
+ exports.default = BloctoWallet;
@@ -105,7 +105,7 @@ var NearWallet = /** @class */ (function (_super) {
105
105
  }
106
106
  if (!account_id) return [3 /*break*/, 2];
107
107
  _a = near_api_js_1.WalletConnection.bind;
108
- return [4 /*yield*/, near_api_js_1.connect(this.config)];
108
+ return [4 /*yield*/, (0, near_api_js_1.connect)(this.config)];
109
109
  case 1:
110
110
  new (_a.apply(near_api_js_1.WalletConnection, [void 0, _b.sent(), 'openOcen']))();
111
111
  _b.label = 2;
@@ -123,7 +123,7 @@ var NearWallet = /** @class */ (function (_super) {
123
123
  var near, account, address;
124
124
  return __generator(this, function (_a) {
125
125
  switch (_a.label) {
126
- case 0: return [4 /*yield*/, near_api_js_1.connect(this.config)];
126
+ case 0: return [4 /*yield*/, (0, near_api_js_1.connect)(this.config)];
127
127
  case 1:
128
128
  near = _a.sent();
129
129
  this.sdk = new near_api_js_1.WalletConnection(near, 'openOcen');
@@ -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/lib/index.d.ts CHANGED
@@ -35,6 +35,7 @@ import CryptoCom from './Wallets/CryptoCom';
35
35
  import NearWallet from './Wallets/NearWallet';
36
36
  import BitKeepWallet from './Wallets/BitKeepWallet';
37
37
  import GnosisSafeWallet from './Wallets/GnosisSafeWallet';
38
+ import BloctoWallet from './Wallets/BloctoWallet';
38
39
  import { EnumChains } from "./types";
39
40
  export default WalletManager;
40
- export { WalletManager, MetaMask, BscWallet, Cyano, TronLink, EnumChains, Sollet, SolletIo, OntoMobile, WalletConnect, MathWallet, OntoWallet, SafePalWallet, ImTokenWallet, TokenPocket, TrustWallet, Coin98, Phantom, OKExWallet, TerraStation, CoinbaseWallet, CloverWallet, XDEFIWallet, SlopeWallet, SolflareWallet, MetaXWallet, KeplrWallet, BraveWallet, CryptoCom, NearWallet, BitKeepWallet, GnosisSafeWallet };
41
+ export { WalletManager, MetaMask, BscWallet, Cyano, TronLink, EnumChains, Sollet, SolletIo, OntoMobile, WalletConnect, MathWallet, OntoWallet, SafePalWallet, ImTokenWallet, TokenPocket, TrustWallet, Coin98, Phantom, OKExWallet, TerraStation, CoinbaseWallet, CloverWallet, XDEFIWallet, SlopeWallet, SolflareWallet, MetaXWallet, KeplrWallet, BraveWallet, CryptoCom, NearWallet, BitKeepWallet, GnosisSafeWallet, BloctoWallet };
package/lib/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.GnosisSafeWallet = exports.BitKeepWallet = exports.NearWallet = exports.CryptoCom = exports.BraveWallet = exports.KeplrWallet = exports.MetaXWallet = exports.SolflareWallet = exports.SlopeWallet = exports.XDEFIWallet = exports.CloverWallet = exports.CoinbaseWallet = exports.TerraStation = exports.OKExWallet = exports.Phantom = exports.Coin98 = exports.TrustWallet = exports.TokenPocket = exports.ImTokenWallet = exports.SafePalWallet = exports.OntoWallet = exports.MathWallet = exports.WalletConnect = exports.OntoMobile = exports.SolletIo = exports.Sollet = exports.EnumChains = exports.TronLink = exports.Cyano = exports.BscWallet = exports.MetaMask = exports.WalletManager = void 0;
6
+ exports.BloctoWallet = exports.GnosisSafeWallet = exports.BitKeepWallet = exports.NearWallet = exports.CryptoCom = exports.BraveWallet = exports.KeplrWallet = exports.MetaXWallet = exports.SolflareWallet = exports.SlopeWallet = exports.XDEFIWallet = exports.CloverWallet = exports.CoinbaseWallet = exports.TerraStation = exports.OKExWallet = exports.Phantom = exports.Coin98 = exports.TrustWallet = exports.TokenPocket = exports.ImTokenWallet = exports.SafePalWallet = exports.OntoWallet = exports.MathWallet = exports.WalletConnect = exports.OntoMobile = exports.SolletIo = exports.Sollet = exports.EnumChains = exports.TronLink = exports.Cyano = exports.BscWallet = exports.MetaMask = exports.WalletManager = void 0;
7
7
  /**
8
8
  * wallets-manager entry
9
9
  * @author openocean
@@ -72,6 +72,8 @@ var BitKeepWallet_1 = __importDefault(require("./Wallets/BitKeepWallet"));
72
72
  exports.BitKeepWallet = BitKeepWallet_1.default;
73
73
  var GnosisSafeWallet_1 = __importDefault(require("./Wallets/GnosisSafeWallet"));
74
74
  exports.GnosisSafeWallet = GnosisSafeWallet_1.default;
75
+ var BloctoWallet_1 = __importDefault(require("./Wallets/BloctoWallet"));
76
+ exports.BloctoWallet = BloctoWallet_1.default;
75
77
  var types_1 = require("./types");
76
78
  Object.defineProperty(exports, "EnumChains", { enumerable: true, get: function () { return types_1.EnumChains; } });
77
79
  var process = {};
package/lib/types.d.ts CHANGED
@@ -33,7 +33,8 @@ export declare enum EnumChains {
33
33
  Cronos = "cronos",
34
34
  Harmony = "harmony",
35
35
  Osmosis = "osmosis",
36
- Sifchain = "sifchain"
36
+ Sifchain = "sifchain",
37
+ Flow = "flow"
37
38
  }
38
39
  export declare enum EnumWalletType {
39
40
  Extension = "Extension",
@@ -72,7 +73,8 @@ export declare enum EnumWalletName {
72
73
  BraveWallet = "Brave Wallet",
73
74
  CryptoCom = "Crypto.com DeFi Wallet",
74
75
  BitKeepWallet = "BitKeep Wallet",
75
- GnosisSafeWallet = "GnosisSafe Wallet"
76
+ GnosisSafeWallet = "GnosisSafe Wallet",
77
+ BloctoWallet = "Blocto Wallet"
76
78
  }
77
79
  export declare enum EnumErrors {
78
80
  NotMetamask = "40001",
@@ -100,7 +102,8 @@ export declare enum EnumErrors {
100
102
  NoKeplr = "40024",
101
103
  NoBrave = "40025",
102
104
  NoCryptoCom = "40026",
103
- NoBitKeep = "40027"
105
+ NoBitKeep = "40027",
106
+ NoBlocto = "40028"
104
107
  }
105
108
  export interface ConnectResult {
106
109
  chain: EnumChains;
package/lib/types.js CHANGED
@@ -34,6 +34,7 @@ var EnumChains;
34
34
  EnumChains["Harmony"] = "harmony";
35
35
  EnumChains["Osmosis"] = "osmosis";
36
36
  EnumChains["Sifchain"] = "sifchain";
37
+ EnumChains["Flow"] = "flow";
37
38
  })(EnumChains = exports.EnumChains || (exports.EnumChains = {}));
38
39
  var EnumWalletType;
39
40
  (function (EnumWalletType) {
@@ -75,6 +76,7 @@ var EnumWalletName;
75
76
  EnumWalletName["CryptoCom"] = "Crypto.com DeFi Wallet";
76
77
  EnumWalletName["BitKeepWallet"] = "BitKeep Wallet";
77
78
  EnumWalletName["GnosisSafeWallet"] = "GnosisSafe Wallet";
79
+ EnumWalletName["BloctoWallet"] = "Blocto Wallet";
78
80
  })(EnumWalletName = exports.EnumWalletName || (exports.EnumWalletName = {}));
79
81
  var EnumErrors;
80
82
  (function (EnumErrors) {
@@ -104,4 +106,5 @@ var EnumErrors;
104
106
  EnumErrors["NoBrave"] = "40025";
105
107
  EnumErrors["NoCryptoCom"] = "40026";
106
108
  EnumErrors["NoBitKeep"] = "40027";
109
+ EnumErrors["NoBlocto"] = "40028";
107
110
  })(EnumErrors = exports.EnumErrors || (exports.EnumErrors = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openocean.finance/wallet",
3
- "version": "0.4.25",
3
+ "version": "0.4.28",
4
4
  "description": "A multi-chain wallets manager",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -44,6 +44,7 @@
44
44
  "@cosmjs/stargate": "^0.28.4",
45
45
  "@gnosis.pm/safe-apps-provider": "^0.11.3",
46
46
  "@gnosis.pm/safe-apps-sdk": "^7.5.0",
47
+ "@onflow/fcl": "^0.0.71",
47
48
  "@ont-dev/ontology-dapi": "^0.5.7",
48
49
  "@project-serum/sol-wallet-adapter": "0.2.0",
49
50
  "@solana/web3.js": "1.31.0",