@openocean.finance/wallet 1.10.5 → 1.10.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/package.json +7 -7
- package/lib/Wallets/Reown.d.ts +0 -17
- package/lib/Wallets/Reown.js +0 -185
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openocean.finance/wallet",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.6",
|
|
4
4
|
"description": "A multi-chain wallets manager",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -56,22 +56,22 @@
|
|
|
56
56
|
"@onflow/fcl": "^0.0.71",
|
|
57
57
|
"@ont-dev/ontology-dapi": "^0.5.7",
|
|
58
58
|
"@project-serum/sol-wallet-adapter": "0.2.0",
|
|
59
|
-
"@reown/appkit": "
|
|
60
|
-
"@reown/appkit-adapter-wagmi": "
|
|
59
|
+
"@reown/appkit": "1.3.2",
|
|
60
|
+
"@reown/appkit-adapter-wagmi": "1.3.2",
|
|
61
61
|
"@siddomains/sidjs": "^0.1.22",
|
|
62
62
|
"@solana/web3.js": "^1.91.0",
|
|
63
63
|
"@terra-money/terra.js": "3.1.10",
|
|
64
64
|
"@uauth/js": "^2.4.0",
|
|
65
|
-
"@walletconnect/ethereum-provider": "
|
|
66
|
-
"@walletconnect/modal": "
|
|
65
|
+
"@walletconnect/ethereum-provider": "2.17.1",
|
|
66
|
+
"@walletconnect/modal": "2.6.2",
|
|
67
67
|
"buffer": "^6.0.3",
|
|
68
68
|
"fs": "^0.0.1-security",
|
|
69
69
|
"near-api-js": "^0.44.2",
|
|
70
70
|
"osmojs": "^13.0.0-rc.7-i-alpha",
|
|
71
71
|
"path-browserify": "^1.0.1",
|
|
72
72
|
"starknet": "^4.22.0",
|
|
73
|
-
"viem": "
|
|
74
|
-
"wagmi": "
|
|
73
|
+
"viem": "2.21.44",
|
|
74
|
+
"wagmi": "2.12.30",
|
|
75
75
|
"web3": "^1.7.4",
|
|
76
76
|
"web3-ledgerhq-frame-connector": "^1.1.0"
|
|
77
77
|
},
|
package/lib/Wallets/Reown.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { EnumChains, EnumWalletName, EnumWalletType } from "../types";
|
|
2
|
-
import BaseWallet from "./BaseWallet";
|
|
3
|
-
declare class WalletConnect extends BaseWallet {
|
|
4
|
-
name: EnumWalletName;
|
|
5
|
-
icon: any;
|
|
6
|
-
supportChains: EnumChains[];
|
|
7
|
-
type: EnumWalletType;
|
|
8
|
-
sdk: any;
|
|
9
|
-
infuraId?: string;
|
|
10
|
-
/**
|
|
11
|
-
* connect metamask and get wallet address
|
|
12
|
-
* @param chainId specific chainId,throw error when not match
|
|
13
|
-
* @param config
|
|
14
|
-
*/
|
|
15
|
-
requestConnect(chainId?: number, config?: any): Promise<any>;
|
|
16
|
-
}
|
|
17
|
-
export default WalletConnect;
|
package/lib/Wallets/Reown.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
28
|
-
return g.next = verb(0), g["throw"] = verb(1), g["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 WalletConnect
|
|
59
|
-
* @author openocean
|
|
60
|
-
* @date 2021/4/21
|
|
61
|
-
* @desc
|
|
62
|
-
*/
|
|
63
|
-
// @ts-ignore
|
|
64
|
-
var walletconnect_svg_1 = __importDefault(require("../assets/walletconnect.svg"));
|
|
65
|
-
var types_1 = require("../types");
|
|
66
|
-
var BaseWallet_1 = __importDefault(require("./BaseWallet"));
|
|
67
|
-
var web3_1 = __importDefault(require("web3"));
|
|
68
|
-
var ethereum_provider_1 = require("@walletconnect/ethereum-provider");
|
|
69
|
-
var WalletConnect = /** @class */ (function (_super) {
|
|
70
|
-
__extends(WalletConnect, _super);
|
|
71
|
-
function WalletConnect() {
|
|
72
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
73
|
-
_this.name = types_1.EnumWalletName.WalletConnect;
|
|
74
|
-
_this.icon = walletconnect_svg_1.default;
|
|
75
|
-
_this.supportChains = [
|
|
76
|
-
types_1.EnumChains.ETH,
|
|
77
|
-
types_1.EnumChains.BSC,
|
|
78
|
-
types_1.EnumChains.Polygon,
|
|
79
|
-
types_1.EnumChains.OKEX,
|
|
80
|
-
types_1.EnumChains.XDai,
|
|
81
|
-
types_1.EnumChains.HECO,
|
|
82
|
-
types_1.EnumChains.Fantom,
|
|
83
|
-
types_1.EnumChains.Avalanche,
|
|
84
|
-
types_1.EnumChains.Arbitrum,
|
|
85
|
-
types_1.EnumChains.Optimism,
|
|
86
|
-
types_1.EnumChains.Boba,
|
|
87
|
-
types_1.EnumChains.Moonriver,
|
|
88
|
-
types_1.EnumChains.Aurora,
|
|
89
|
-
types_1.EnumChains.Cronos,
|
|
90
|
-
types_1.EnumChains.Harmony,
|
|
91
|
-
types_1.EnumChains.Metis,
|
|
92
|
-
types_1.EnumChains.Kava,
|
|
93
|
-
types_1.EnumChains.Celo,
|
|
94
|
-
types_1.EnumChains.Klaytn,
|
|
95
|
-
types_1.EnumChains.ZKSYNC,
|
|
96
|
-
types_1.EnumChains.Linea,
|
|
97
|
-
types_1.EnumChains.LineaTest,
|
|
98
|
-
types_1.EnumChains.PolygonzkEVM,
|
|
99
|
-
types_1.EnumChains.Telos,
|
|
100
|
-
types_1.EnumChains.OpBNB,
|
|
101
|
-
types_1.EnumChains.Mantle,
|
|
102
|
-
types_1.EnumChains.Manta,
|
|
103
|
-
types_1.EnumChains.X1,
|
|
104
|
-
types_1.EnumChains.Base,
|
|
105
|
-
types_1.EnumChains.Blast,
|
|
106
|
-
types_1.EnumChains.Mode,
|
|
107
|
-
types_1.EnumChains.PulseChain,
|
|
108
|
-
types_1.EnumChains.MerlinChain,
|
|
109
|
-
types_1.EnumChains.Rootstock,
|
|
110
|
-
types_1.EnumChains.Sei,
|
|
111
|
-
types_1.EnumChains.ArbitrumSepolia,
|
|
112
|
-
types_1.EnumChains.Gravity,
|
|
113
|
-
types_1.EnumChains.ApeChain,
|
|
114
|
-
];
|
|
115
|
-
_this.type = types_1.EnumWalletType.WalletConnect;
|
|
116
|
-
_this.sdk = null;
|
|
117
|
-
return _this;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* connect metamask and get wallet address
|
|
121
|
-
* @param chainId specific chainId,throw error when not match
|
|
122
|
-
* @param config
|
|
123
|
-
*/
|
|
124
|
-
WalletConnect.prototype.requestConnect = function () {
|
|
125
|
-
return __awaiter(this, arguments, void 0, function (chainId, config) {
|
|
126
|
-
var rpcMap, provider, currentChainId, address;
|
|
127
|
-
if (chainId === void 0) { chainId = 1; }
|
|
128
|
-
return __generator(this, function (_a) {
|
|
129
|
-
switch (_a.label) {
|
|
130
|
-
case 0:
|
|
131
|
-
rpcMap = {};
|
|
132
|
-
this.supportChains.forEach(function (i) {
|
|
133
|
-
var chain = config.chainsObj.chainObj[i];
|
|
134
|
-
rpcMap[chain.chainId] = chain.rpcUrls[0];
|
|
135
|
-
});
|
|
136
|
-
console.log('chainId', chainId);
|
|
137
|
-
console.log(rpcMap);
|
|
138
|
-
console.log(config.chainsObj.chainIds);
|
|
139
|
-
return [4 /*yield*/, ethereum_provider_1.EthereumProvider.init({
|
|
140
|
-
projectId: config && config.projectId ? config.projectId : 'c1ca7adc83e89c7e7848440702f28f38', // required
|
|
141
|
-
chains: [chainId],
|
|
142
|
-
optionalChains: config.chainsObj.chainIds,
|
|
143
|
-
rpcMap: rpcMap,
|
|
144
|
-
optionalMethods: [
|
|
145
|
-
'wallet_addEthereumChain',
|
|
146
|
-
'wallet_switchEthereumChain',
|
|
147
|
-
"eth_signTypedData",
|
|
148
|
-
"eth_signTypedData_v4",
|
|
149
|
-
"eth_sign"
|
|
150
|
-
],
|
|
151
|
-
showQrModal: true, // requires @walletconnect/modal
|
|
152
|
-
qrModalOptions: {
|
|
153
|
-
themeVariables: {
|
|
154
|
-
"--wcm-z-index": "9999",
|
|
155
|
-
},
|
|
156
|
-
// themeMode: 'light'
|
|
157
|
-
}
|
|
158
|
-
})];
|
|
159
|
-
case 1:
|
|
160
|
-
provider = _a.sent();
|
|
161
|
-
console.log('provider', provider);
|
|
162
|
-
return [4 /*yield*/, provider.enable()];
|
|
163
|
-
case 2:
|
|
164
|
-
_a.sent();
|
|
165
|
-
console.log('provider', provider);
|
|
166
|
-
this.sdk = new web3_1.default(provider);
|
|
167
|
-
return [4 /*yield*/, this.sdk.eth.getChainId()];
|
|
168
|
-
case 3:
|
|
169
|
-
currentChainId = _a.sent();
|
|
170
|
-
if (chainId && currentChainId != chainId) {
|
|
171
|
-
throw new Error(types_1.EnumErrors.ChainIdNotMath);
|
|
172
|
-
}
|
|
173
|
-
return [4 /*yield*/, this.sdk.eth.getAccounts()];
|
|
174
|
-
case 4:
|
|
175
|
-
address = (_a.sent())[0];
|
|
176
|
-
this.address = address;
|
|
177
|
-
this.chainId = currentChainId;
|
|
178
|
-
return [2 /*return*/, address];
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
};
|
|
183
|
-
return WalletConnect;
|
|
184
|
-
}(BaseWallet_1.default));
|
|
185
|
-
exports.default = WalletConnect;
|