@openocean.finance/wallet 1.7.8 → 1.8.0
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/TryWalletConnect/index.d.ts +2 -1
- package/lib/TryWalletConnect/index.js +34 -18
- package/lib/Wallets/Coin98.js +11 -11
- package/lib/Wallets/RabbyWallet.js +11 -6
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -1
- package/package.json +1 -1
|
@@ -18,4 +18,5 @@ interface ConnectObj {
|
|
|
18
18
|
localRpcUrl: any;
|
|
19
19
|
}
|
|
20
20
|
declare function tryWalletConnect(reqConnectWalletVo: ReqConnectWalletVo): Promise<ConnectObj>;
|
|
21
|
-
|
|
21
|
+
declare function getSidName(wallet: any): Promise<any>;
|
|
22
|
+
export { getSidName, tryWalletConnect, ReqConnectWalletVo };
|
|
@@ -39,7 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.tryWalletConnect = void 0;
|
|
42
|
+
exports.tryWalletConnect = exports.getSidName = void 0;
|
|
43
43
|
var axios = require('axios');
|
|
44
44
|
var NotoMobile_1 = require("./NotoMobile");
|
|
45
45
|
var web3_js_1 = require("@solana/web3.js");
|
|
@@ -329,7 +329,7 @@ function linkAddOrSwitch(wallet, chain) {
|
|
|
329
329
|
}
|
|
330
330
|
function tryWalletConnect(reqConnectWalletVo) {
|
|
331
331
|
return __awaiter(this, void 0, void 0, function () {
|
|
332
|
-
var chain, wallet, sdk, account, chainId, localProvider, localRpcUrl
|
|
332
|
+
var chain, wallet, sdk, account, chainId, localProvider, localRpcUrl;
|
|
333
333
|
return __generator(this, function (_a) {
|
|
334
334
|
switch (_a.label) {
|
|
335
335
|
case 0:
|
|
@@ -363,7 +363,7 @@ function tryWalletConnect(reqConnectWalletVo) {
|
|
|
363
363
|
case 5:
|
|
364
364
|
localProvider = '';
|
|
365
365
|
localRpcUrl = '';
|
|
366
|
-
if (!wallet) return [3 /*break*/,
|
|
366
|
+
if (!wallet) return [3 /*break*/, 7];
|
|
367
367
|
if (reqConnectWalletVo.localRpcUrl) {
|
|
368
368
|
localProvider = new web3_1.default(new web3_1.default.providers.HttpProvider(reqConnectWalletVo.localRpcUrl));
|
|
369
369
|
localRpcUrl = reqConnectWalletVo.localRpcUrl;
|
|
@@ -386,30 +386,46 @@ function tryWalletConnect(reqConnectWalletVo) {
|
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
|
|
390
|
-
if (!(wallet.chainId == 1 || wallet.chainId == 56 || wallet.chainId == 42161)) return [3 /*break*/, 9];
|
|
391
|
-
_a.label = 6;
|
|
389
|
+
return [4 /*yield*/, getSidName(wallet)];
|
|
392
390
|
case 6:
|
|
393
|
-
_a.
|
|
391
|
+
_a.sent();
|
|
392
|
+
_a.label = 7;
|
|
393
|
+
case 7: return [2 /*return*/, {
|
|
394
|
+
wallet: wallet,
|
|
395
|
+
chain: chain,
|
|
396
|
+
localProvider: localProvider,
|
|
397
|
+
localRpcUrl: localRpcUrl
|
|
398
|
+
}];
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
exports.tryWalletConnect = tryWalletConnect;
|
|
404
|
+
function getSidName(wallet) {
|
|
405
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
406
|
+
var sid, name_1, error_2;
|
|
407
|
+
return __generator(this, function (_a) {
|
|
408
|
+
switch (_a.label) {
|
|
409
|
+
case 0:
|
|
410
|
+
wallet.sidName = null;
|
|
411
|
+
if (!(wallet.chainId == 1 || wallet.chainId == 56 || wallet.chainId == 42161)) return [3 /*break*/, 4];
|
|
412
|
+
_a.label = 1;
|
|
413
|
+
case 1:
|
|
414
|
+
_a.trys.push([1, 3, , 4]);
|
|
394
415
|
sid = new SID({ provider: wallet.sdk.currentProvider, sidAddress: SIDfunctions.getSidAddress(wallet.chainId) });
|
|
395
416
|
return [4 /*yield*/, sid.getName(wallet.address)];
|
|
396
|
-
case
|
|
417
|
+
case 2:
|
|
397
418
|
name_1 = _a.sent();
|
|
398
419
|
if (name_1.name)
|
|
399
420
|
wallet.sidName = name_1.name;
|
|
400
|
-
return [3 /*break*/,
|
|
401
|
-
case
|
|
421
|
+
return [3 /*break*/, 4];
|
|
422
|
+
case 3:
|
|
402
423
|
error_2 = _a.sent();
|
|
403
424
|
console.error(error_2);
|
|
404
|
-
return [3 /*break*/,
|
|
405
|
-
case
|
|
406
|
-
wallet: wallet,
|
|
407
|
-
chain: chain,
|
|
408
|
-
localProvider: localProvider,
|
|
409
|
-
localRpcUrl: localRpcUrl
|
|
410
|
-
}];
|
|
425
|
+
return [3 /*break*/, 4];
|
|
426
|
+
case 4: return [2 /*return*/, wallet];
|
|
411
427
|
}
|
|
412
428
|
});
|
|
413
429
|
});
|
|
414
430
|
}
|
|
415
|
-
exports.
|
|
431
|
+
exports.getSidName = getSidName;
|
package/lib/Wallets/Coin98.js
CHANGED
|
@@ -76,18 +76,18 @@ var Coin98 = /** @class */ (function (_super) {
|
|
|
76
76
|
types_1.EnumChains.ETH,
|
|
77
77
|
types_1.EnumChains.BSC,
|
|
78
78
|
types_1.EnumChains.Polygon,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
// EnumChains.HECO,
|
|
80
|
+
// EnumChains.XDai,
|
|
81
|
+
// EnumChains.Fantom,
|
|
82
82
|
types_1.EnumChains.Avalanche,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
// EnumChains.Arbitrum,
|
|
84
|
+
// EnumChains.OKEX,
|
|
85
|
+
// EnumChains.Aurora,
|
|
86
|
+
// EnumChains.Scroll,
|
|
87
|
+
// EnumChains.Base,
|
|
88
|
+
// EnumChains.OpBNB,
|
|
89
|
+
// EnumChains.Mantle,
|
|
90
|
+
// EnumChains.Manta
|
|
91
91
|
];
|
|
92
92
|
_this.type = types_1.EnumWalletType.Extension;
|
|
93
93
|
_this.sdk = null;
|
|
@@ -62,6 +62,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
62
62
|
*/
|
|
63
63
|
// @ts-ignore
|
|
64
64
|
var rabby_svg_1 = __importDefault(require("../assets/rabby.svg"));
|
|
65
|
+
var helper_1 = require("../helper");
|
|
65
66
|
var types_1 = require("../types");
|
|
66
67
|
var BaseWallet_1 = __importDefault(require("./BaseWallet"));
|
|
67
68
|
var web3_1 = __importDefault(require("web3"));
|
|
@@ -94,19 +95,23 @@ var RabbyWallet = /** @class */ (function (_super) {
|
|
|
94
95
|
*/
|
|
95
96
|
RabbyWallet.prototype.requestConnect = function (chainId) {
|
|
96
97
|
return __awaiter(this, void 0, void 0, function () {
|
|
97
|
-
var address, currentChainId;
|
|
98
|
+
var result, address, currentChainId;
|
|
98
99
|
return __generator(this, function (_a) {
|
|
99
100
|
switch (_a.label) {
|
|
100
|
-
case 0:
|
|
101
|
-
|
|
101
|
+
case 0: return [4 /*yield*/, (0, helper_1.autoWalletCheck)(function () {
|
|
102
|
+
return window.rabby;
|
|
103
|
+
}, 3000)];
|
|
104
|
+
case 1:
|
|
105
|
+
result = _a.sent();
|
|
106
|
+
if (!result) {
|
|
102
107
|
throw new Error(types_1.EnumErrors.NoRabbyWallet);
|
|
103
108
|
}
|
|
104
|
-
this.sdk = new web3_1.default(
|
|
109
|
+
this.sdk = new web3_1.default(window.rabby);
|
|
105
110
|
return [4 /*yield*/, this.sdk.eth.requestAccounts()];
|
|
106
|
-
case
|
|
111
|
+
case 2:
|
|
107
112
|
address = (_a.sent())[0];
|
|
108
113
|
return [4 /*yield*/, this.sdk.eth.getChainId()];
|
|
109
|
-
case
|
|
114
|
+
case 3:
|
|
110
115
|
currentChainId = _a.sent();
|
|
111
116
|
if (chainId && currentChainId !== chainId) {
|
|
112
117
|
throw new Error(types_1.EnumErrors.ChainIdNotMath);
|
package/lib/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ import Risewallet from './Wallets/Risewallet';
|
|
|
46
46
|
import Fewcha from './Wallets/Fewcha';
|
|
47
47
|
import ZerionWallet from './Wallets/ZerionWallet';
|
|
48
48
|
import { EnumChains, EnumWalletName } from "./types";
|
|
49
|
-
import { tryWalletConnect, ReqConnectWalletVo } from "./TryWalletConnect";
|
|
49
|
+
import { getSidName, tryWalletConnect, ReqConnectWalletVo } from "./TryWalletConnect";
|
|
50
50
|
import { chainsObj, Chains, Chain } from "./Chains";
|
|
51
51
|
import { walletsObj, Wallets } from "./Wallets/index";
|
|
52
|
-
export { chainsObj, Chains, Chain, walletsObj, Wallets, ReqConnectWalletVo, tryWalletConnect, EnumChains, EnumWalletName, BaseWallet, MetaMask, BscWallet, Cyano, TronLink, Sollet, SolletIo, OntoMobile, WalletConnect, MathWallet, OntoWallet, SafePalWallet, TokenPocket, TrustWallet, Coin98, Phantom, TerraStation, CoinbaseWallet, CloverWallet, XDEFIWallet, SolflareWallet, OKXWallet, KeplrWallet, BraveWallet, CryptoCom, BitgetWallet, GnosisSafeWallet, PetraWallet, MartianWallet, PontemWallet, UnstoppableDomains, MyNearWallet, MeteorWallet, SenderWallet, LedgerWallet, LedgerEmbedWallet, PlenaWallet, Krystal, Risewallet, Fewcha, ZerionWallet, };
|
|
52
|
+
export { chainsObj, Chains, Chain, walletsObj, Wallets, ReqConnectWalletVo, tryWalletConnect, getSidName, EnumChains, EnumWalletName, BaseWallet, MetaMask, BscWallet, Cyano, TronLink, Sollet, SolletIo, OntoMobile, WalletConnect, MathWallet, OntoWallet, SafePalWallet, TokenPocket, TrustWallet, Coin98, Phantom, TerraStation, CoinbaseWallet, CloverWallet, XDEFIWallet, SolflareWallet, OKXWallet, KeplrWallet, BraveWallet, CryptoCom, BitgetWallet, GnosisSafeWallet, PetraWallet, MartianWallet, PontemWallet, UnstoppableDomains, MyNearWallet, MeteorWallet, SenderWallet, LedgerWallet, LedgerEmbedWallet, PlenaWallet, Krystal, Risewallet, Fewcha, ZerionWallet, };
|
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.ZerionWallet = 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.GnosisSafeWallet = exports.BitgetWallet = 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.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;
|
|
6
|
+
exports.ZerionWallet = 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.GnosisSafeWallet = exports.BitgetWallet = 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.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.getSidName = exports.tryWalletConnect = exports.Wallets = exports.walletsObj = exports.Chains = exports.chainsObj = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* wallets-manager entry
|
|
9
9
|
* @author openocean
|
|
@@ -100,6 +100,7 @@ var types_1 = require("./types");
|
|
|
100
100
|
Object.defineProperty(exports, "EnumChains", { enumerable: true, get: function () { return types_1.EnumChains; } });
|
|
101
101
|
Object.defineProperty(exports, "EnumWalletName", { enumerable: true, get: function () { return types_1.EnumWalletName; } });
|
|
102
102
|
var TryWalletConnect_1 = require("./TryWalletConnect");
|
|
103
|
+
Object.defineProperty(exports, "getSidName", { enumerable: true, get: function () { return TryWalletConnect_1.getSidName; } });
|
|
103
104
|
Object.defineProperty(exports, "tryWalletConnect", { enumerable: true, get: function () { return TryWalletConnect_1.tryWalletConnect; } });
|
|
104
105
|
var Chains_1 = require("./Chains");
|
|
105
106
|
Object.defineProperty(exports, "chainsObj", { enumerable: true, get: function () { return Chains_1.chainsObj; } });
|