@openocean.finance/wallet 0.4.32 → 0.4.33
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EnumChains, EnumWalletName, EnumWalletType } from "../types";
|
|
2
2
|
import BaseWallet from "./BaseWallet";
|
|
3
|
-
import Web3 from
|
|
3
|
+
import Web3 from "web3";
|
|
4
4
|
declare class MartianWallet extends BaseWallet {
|
|
5
5
|
name: EnumWalletName;
|
|
6
6
|
icon: any;
|
|
@@ -10,6 +10,6 @@ declare class MartianWallet extends BaseWallet {
|
|
|
10
10
|
/**
|
|
11
11
|
* connect metamask and get wallet address
|
|
12
12
|
*/
|
|
13
|
-
requestAptosConnect(): Promise<
|
|
13
|
+
requestAptosConnect(): Promise<string>;
|
|
14
14
|
}
|
|
15
15
|
export default MartianWallet;
|
|
@@ -61,7 +61,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
61
61
|
* @desc
|
|
62
62
|
*/
|
|
63
63
|
// @ts-ignore
|
|
64
|
-
var
|
|
64
|
+
var martian_svg_1 = __importDefault(require("../assets/martian.svg"));
|
|
65
65
|
var types_1 = require("../types");
|
|
66
66
|
var BaseWallet_1 = __importDefault(require("./BaseWallet"));
|
|
67
67
|
var MartianWallet = /** @class */ (function (_super) {
|
|
@@ -69,7 +69,7 @@ var MartianWallet = /** @class */ (function (_super) {
|
|
|
69
69
|
function MartianWallet() {
|
|
70
70
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
71
71
|
_this.name = types_1.EnumWalletName.MartianWallet;
|
|
72
|
-
_this.icon =
|
|
72
|
+
_this.icon = martian_svg_1.default;
|
|
73
73
|
_this.supportChains = [types_1.EnumChains.Aptos];
|
|
74
74
|
_this.type = types_1.EnumWalletType.Extension;
|
|
75
75
|
_this.sdk = null;
|
|
@@ -80,21 +80,33 @@ var MartianWallet = /** @class */ (function (_super) {
|
|
|
80
80
|
*/
|
|
81
81
|
MartianWallet.prototype.requestAptosConnect = function () {
|
|
82
82
|
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
-
var
|
|
83
|
+
var _this = this;
|
|
84
84
|
return __generator(this, function (_a) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
85
|
+
return [2 /*return*/, new Promise(function (res) { return __awaiter(_this, void 0, void 0, function () {
|
|
86
|
+
var _this = this;
|
|
87
|
+
return __generator(this, function (_a) {
|
|
88
|
+
setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
89
|
+
var address;
|
|
90
|
+
return __generator(this, function (_a) {
|
|
91
|
+
switch (_a.label) {
|
|
92
|
+
case 0:
|
|
93
|
+
if (!window.martian) {
|
|
94
|
+
throw new Error(types_1.EnumErrors.NoMartianWallet);
|
|
95
|
+
}
|
|
96
|
+
return [4 /*yield*/, window.martian.connect()];
|
|
97
|
+
case 1:
|
|
98
|
+
address = (_a.sent()).address;
|
|
99
|
+
this.sdk = window.martian;
|
|
100
|
+
this.address = address;
|
|
101
|
+
this.chainId = ""; // todo tron chainId
|
|
102
|
+
res(address);
|
|
103
|
+
return [2 /*return*/];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}); }, 1000);
|
|
107
|
+
return [2 /*return*/];
|
|
108
|
+
});
|
|
109
|
+
}); })];
|
|
98
110
|
});
|
|
99
111
|
});
|
|
100
112
|
};
|