@openocean.finance/wallet 1.6.4 → 1.6.6

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/Chains.js CHANGED
@@ -422,6 +422,17 @@ var chainObj = {
422
422
  "https://testrpc.x1.tech"
423
423
  ],
424
424
  compiler: 'EVM'
425
+ },
426
+ "blast": {
427
+ chainName: "Blast",
428
+ chainId: 168587773,
429
+ blockExplorerUrl: "https://testnet.blastscan.io/tx/",
430
+ nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18, address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" },
431
+ popularToken: [],
432
+ rpcUrls: [
433
+ "https://sepolia.blast.io"
434
+ ],
435
+ compiler: 'EVM'
425
436
  }
426
437
  };
427
438
  var Chains = /** @class */ (function () {
@@ -105,7 +105,8 @@ var MetaMask = /** @class */ (function (_super) {
105
105
  types_1.EnumChains.OpBNB,
106
106
  types_1.EnumChains.Mantle,
107
107
  types_1.EnumChains.Manta,
108
- types_1.EnumChains.X1
108
+ types_1.EnumChains.X1,
109
+ types_1.EnumChains.Blast
109
110
  ];
110
111
  _this.type = types_1.EnumWalletType.Extension;
111
112
  _this.sdk = null;
@@ -98,7 +98,8 @@ var TrustWallet = /** @class */ (function (_super) {
98
98
  types_1.EnumChains.Base,
99
99
  types_1.EnumChains.OpBNB,
100
100
  types_1.EnumChains.Mantle,
101
- types_1.EnumChains.Manta
101
+ types_1.EnumChains.Manta,
102
+ types_1.EnumChains.Blast
102
103
  ];
103
104
  _this.type = types_1.EnumWalletType.Extension;
104
105
  _this.sdk = null;
@@ -100,7 +100,8 @@ var WalletConnect = /** @class */ (function (_super) {
100
100
  types_1.EnumChains.OpBNB,
101
101
  types_1.EnumChains.Mantle,
102
102
  types_1.EnumChains.Manta,
103
- types_1.EnumChains.X1
103
+ types_1.EnumChains.X1,
104
+ types_1.EnumChains.Blast
104
105
  ];
105
106
  _this.type = types_1.EnumWalletType.WalletConnect;
106
107
  _this.sdk = null;
@@ -0,0 +1,17 @@
1
+ import { EnumChains, EnumWalletName, EnumWalletType } from "../types";
2
+ import BaseWallet from "./BaseWallet";
3
+ import Web3 from "web3";
4
+ declare class ZerionWallet extends BaseWallet {
5
+ name: EnumWalletName;
6
+ icon: any;
7
+ supportChains: EnumChains[];
8
+ type: EnumWalletType;
9
+ sdk: Web3 | null;
10
+ installUrl: string;
11
+ /**
12
+ * connect metamask and get wallet address
13
+ * @param chainId specific chainId,throw error when not match
14
+ */
15
+ requestConnect(chainId?: number): Promise<string>;
16
+ }
17
+ export default ZerionWallet;
@@ -0,0 +1,127 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
+ 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;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ var __importDefault = (this && this.__importDefault) || function (mod) {
54
+ return (mod && mod.__esModule) ? mod : { "default": mod };
55
+ };
56
+ Object.defineProperty(exports, "__esModule", { value: true });
57
+ /**
58
+ * @name ZerionWallet
59
+ * @author openocean
60
+ * @date 2024/2/20
61
+ * @desc
62
+ */
63
+ // @ts-ignore
64
+ var zerionWallet_png_1 = __importDefault(require("../assets/zerionWallet.png"));
65
+ var types_1 = require("../types");
66
+ var BaseWallet_1 = __importDefault(require("./BaseWallet"));
67
+ var web3_1 = __importDefault(require("web3"));
68
+ var ZerionWallet = /** @class */ (function (_super) {
69
+ __extends(ZerionWallet, _super);
70
+ function ZerionWallet() {
71
+ var _this = _super !== null && _super.apply(this, arguments) || this;
72
+ _this.name = types_1.EnumWalletName.ZerionWallet;
73
+ _this.icon = zerionWallet_png_1.default;
74
+ _this.supportChains = [
75
+ types_1.EnumChains.ETH,
76
+ types_1.EnumChains.BSC,
77
+ types_1.EnumChains.Polygon,
78
+ types_1.EnumChains.XDai,
79
+ types_1.EnumChains.Fantom,
80
+ types_1.EnumChains.Avalanche,
81
+ types_1.EnumChains.Arbitrum,
82
+ types_1.EnumChains.Optimism,
83
+ types_1.EnumChains.Aurora,
84
+ types_1.EnumChains.Celo,
85
+ types_1.EnumChains.ZKSYNC,
86
+ types_1.EnumChains.Linea,
87
+ types_1.EnumChains.Scroll,
88
+ types_1.EnumChains.Base,
89
+ ];
90
+ _this.type = types_1.EnumWalletType.Extension;
91
+ _this.sdk = null;
92
+ _this.installUrl = "https://chromewebstore.google.com/detail/zerion-wallet-for-web3-nf/klghhnkeealcohjjanjjdaeeggmfmlpl?hl=zh-CN&utm_source=ext_sidebar";
93
+ return _this;
94
+ }
95
+ /**
96
+ * connect metamask and get wallet address
97
+ * @param chainId specific chainId,throw error when not match
98
+ */
99
+ ZerionWallet.prototype.requestConnect = function (chainId) {
100
+ return __awaiter(this, void 0, void 0, function () {
101
+ var address, currentChainId;
102
+ return __generator(this, function (_a) {
103
+ switch (_a.label) {
104
+ case 0:
105
+ if (!(window.ethereum || !window.ethereum.isZerion)) {
106
+ throw new Error(types_1.EnumErrors.NotZerion);
107
+ }
108
+ this.sdk = new web3_1.default(window.ethereum);
109
+ return [4 /*yield*/, this.sdk.eth.requestAccounts()];
110
+ case 1:
111
+ address = (_a.sent())[0];
112
+ return [4 /*yield*/, this.sdk.eth.getChainId()];
113
+ case 2:
114
+ currentChainId = _a.sent();
115
+ if (chainId && currentChainId !== chainId) {
116
+ throw new Error(types_1.EnumErrors.ChainIdNotMath);
117
+ }
118
+ this.address = address;
119
+ this.chainId = currentChainId;
120
+ return [2 /*return*/, address];
121
+ }
122
+ });
123
+ });
124
+ };
125
+ return ZerionWallet;
126
+ }(BaseWallet_1.default));
127
+ exports.default = ZerionWallet;
@@ -52,6 +52,7 @@ var Risewallet_1 = __importDefault(require("./Risewallet"));
52
52
  var Fewcha_1 = __importDefault(require("./Fewcha"));
53
53
  var BlockWallet_1 = __importDefault(require("./BlockWallet"));
54
54
  var HaHaWallet_1 = __importDefault(require("./HaHaWallet"));
55
+ var ZerionWallet_1 = __importDefault(require("./ZerionWallet"));
55
56
  var WalletObj = {
56
57
  MetaMask: new MetaMask_1.default(),
57
58
  BscWallet: new BscWallet_1.default(),
@@ -99,8 +100,10 @@ var WalletObj = {
99
100
  Risewallet: new Risewallet_1.default(),
100
101
  Fewcha: new Fewcha_1.default(),
101
102
  BlockWallet: new BlockWallet_1.default(),
102
- HaHaWallet: new HaHaWallet_1.default()
103
+ HaHaWallet: new HaHaWallet_1.default(),
104
+ ZerionWallet: new ZerionWallet_1.default()
103
105
  };
106
+ alert('ZerionWallet');
104
107
  var Wallets = /** @class */ (function () {
105
108
  function Wallets() {
106
109
  this.walletObj = {};
Binary file
package/lib/index.d.ts CHANGED
@@ -47,8 +47,9 @@ import PlenaWallet from './Wallets/PlenaWallet';
47
47
  import Krystal from './Wallets/Krystal';
48
48
  import Risewallet from './Wallets/Risewallet';
49
49
  import Fewcha from './Wallets/Fewcha';
50
+ import ZerionWallet from './Wallets/ZerionWallet';
50
51
  import { EnumChains, EnumWalletName } from "./types";
51
52
  import { tryWalletConnect, ReqConnectWalletVo } from "./TryWalletConnect";
52
53
  import { chainsObj, Chains, Chain } from "./Chains";
53
54
  import { walletsObj, Wallets } from "./Wallets/index";
54
- export { chainsObj, Chains, Chain, walletsObj, Wallets, ReqConnectWalletVo, tryWalletConnect, EnumChains, EnumWalletName, BaseWallet, MetaMask, BscWallet, Cyano, TronLink, Sollet, SolletIo, OntoMobile, WalletConnect, MathWallet, OntoWallet, SafePalWallet, ImTokenWallet, TokenPocket, TrustWallet, Coin98, Phantom, TerraStation, CoinbaseWallet, CloverWallet, XDEFIWallet, SolflareWallet, OKXWallet, KeplrWallet, BraveWallet, CryptoCom, NearWallet, BitgetWallet, GnosisSafeWallet, BloctoWallet, PetraWallet, MartianWallet, PontemWallet, UnstoppableDomains, MyNearWallet, MeteorWallet, SenderWallet, LedgerWallet, LedgerEmbedWallet, PlenaWallet, Krystal, Risewallet, Fewcha, };
55
+ export { chainsObj, Chains, Chain, walletsObj, Wallets, ReqConnectWalletVo, tryWalletConnect, EnumChains, EnumWalletName, BaseWallet, MetaMask, BscWallet, Cyano, TronLink, Sollet, SolletIo, OntoMobile, WalletConnect, MathWallet, OntoWallet, SafePalWallet, ImTokenWallet, TokenPocket, TrustWallet, Coin98, Phantom, TerraStation, CoinbaseWallet, CloverWallet, XDEFIWallet, SolflareWallet, OKXWallet, KeplrWallet, BraveWallet, CryptoCom, NearWallet, BitgetWallet, GnosisSafeWallet, BloctoWallet, PetraWallet, MartianWallet, PontemWallet, UnstoppableDomains, MyNearWallet, MeteorWallet, SenderWallet, LedgerWallet, LedgerEmbedWallet, PlenaWallet, Krystal, Risewallet, Fewcha, ZerionWallet, };
package/lib/index.js CHANGED
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Fewcha = exports.Risewallet = exports.Krystal = exports.PlenaWallet = exports.LedgerEmbedWallet = exports.LedgerWallet = exports.SenderWallet = exports.MeteorWallet = exports.MyNearWallet = exports.UnstoppableDomains = exports.PontemWallet = exports.MartianWallet = exports.PetraWallet = exports.BloctoWallet = exports.GnosisSafeWallet = exports.BitgetWallet = exports.NearWallet = exports.CryptoCom = exports.BraveWallet = exports.KeplrWallet = exports.OKXWallet = exports.SolflareWallet = exports.XDEFIWallet = exports.CloverWallet = exports.CoinbaseWallet = exports.TerraStation = 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.TronLink = exports.Cyano = exports.BscWallet = exports.MetaMask = exports.BaseWallet = exports.EnumWalletName = exports.EnumChains = exports.tryWalletConnect = exports.Wallets = exports.walletsObj = exports.Chains = exports.chainsObj = void 0;
7
+ exports.ZerionWallet = void 0;
7
8
  /**
8
9
  * wallets-manager entry
9
10
  * @author openocean
@@ -97,6 +98,8 @@ var Risewallet_1 = __importDefault(require("./Wallets/Risewallet"));
97
98
  exports.Risewallet = Risewallet_1.default;
98
99
  var Fewcha_1 = __importDefault(require("./Wallets/Fewcha"));
99
100
  exports.Fewcha = Fewcha_1.default;
101
+ var ZerionWallet_1 = __importDefault(require("./Wallets/ZerionWallet"));
102
+ exports.ZerionWallet = ZerionWallet_1.default;
100
103
  var types_1 = require("./types");
101
104
  Object.defineProperty(exports, "EnumChains", { enumerable: true, get: function () { return types_1.EnumChains; } });
102
105
  Object.defineProperty(exports, "EnumWalletName", { enumerable: true, get: function () { return types_1.EnumWalletName; } });
package/lib/types.d.ts CHANGED
@@ -52,7 +52,8 @@ export declare enum EnumChains {
52
52
  OpBNB = "opbnb",
53
53
  Mantle = "mantle",
54
54
  Manta = "manta",
55
- X1 = "x1"
55
+ X1 = "x1",
56
+ Blast = "blast"
56
57
  }
57
58
  export declare enum EnumWalletType {
58
59
  Extension = "Extension",
@@ -109,7 +110,8 @@ export declare enum EnumWalletName {
109
110
  Risewallet = "Rise Wallet",
110
111
  Fewcha = "Fewcha",
111
112
  BlockWallet = "BlockWallet",
112
- HaHaWallet = "HaHa Wallet"
113
+ HaHaWallet = "HaHa Wallet",
114
+ ZerionWallet = "ZerionWallet"
113
115
  }
114
116
  export declare enum EnumErrors {
115
117
  NotMetamask = "40001",
@@ -155,7 +157,8 @@ export declare enum EnumErrors {
155
157
  NoBraavos = "40043",
156
158
  NoRisewallet = "40044",
157
159
  NoFewcha = "40045",
158
- NoBlockWallet = "40046"
160
+ NoBlockWallet = "40046",
161
+ NotZerion = "40047"
159
162
  }
160
163
  export interface ConnectResult {
161
164
  chain: EnumChains;
package/lib/types.js CHANGED
@@ -53,6 +53,7 @@ var EnumChains;
53
53
  EnumChains["Mantle"] = "mantle";
54
54
  EnumChains["Manta"] = "manta";
55
55
  EnumChains["X1"] = "x1";
56
+ EnumChains["Blast"] = "blast";
56
57
  })(EnumChains = exports.EnumChains || (exports.EnumChains = {}));
57
58
  var EnumWalletType;
58
59
  (function (EnumWalletType) {
@@ -112,6 +113,7 @@ var EnumWalletName;
112
113
  EnumWalletName["Fewcha"] = "Fewcha";
113
114
  EnumWalletName["BlockWallet"] = "BlockWallet";
114
115
  EnumWalletName["HaHaWallet"] = "HaHa Wallet";
116
+ EnumWalletName["ZerionWallet"] = "ZerionWallet";
115
117
  })(EnumWalletName = exports.EnumWalletName || (exports.EnumWalletName = {}));
116
118
  var EnumErrors;
117
119
  (function (EnumErrors) {
@@ -159,4 +161,5 @@ var EnumErrors;
159
161
  EnumErrors["NoRisewallet"] = "40044";
160
162
  EnumErrors["NoFewcha"] = "40045";
161
163
  EnumErrors["NoBlockWallet"] = "40046";
164
+ EnumErrors["NotZerion"] = "40047";
162
165
  })(EnumErrors = exports.EnumErrors || (exports.EnumErrors = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openocean.finance/wallet",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "description": "A multi-chain wallets manager",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {