PHP WebShell
Текущая директория: /opt/BitGoJS/node_modules/@celo/wallet-local/lib
Просмотр файла: local-wallet.js
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.LocalWallet = void 0;
var address_1 = require("@celo/utils/lib/address");
var wallet_base_1 = require("@celo/wallet-base");
var local_signer_1 = require("./local-signer");
var LocalWallet = /** @class */ (function (_super) {
__extends(LocalWallet, _super);
function LocalWallet() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Register the private key as signer account
* @param privateKey account private key
*/
LocalWallet.prototype.addAccount = function (privateKey) {
// Prefix 0x here or else the signed transaction produces dramatically different signer!!!
privateKey = (0, address_1.normalizeAddressWith0x)(privateKey);
var accountAddress = (0, address_1.normalizeAddressWith0x)((0, address_1.privateKeyToAddress)(privateKey));
if (this.hasAccount(accountAddress)) {
return;
}
this.addSigner(accountAddress, new local_signer_1.LocalSigner(privateKey));
};
/**
* Remove the account
* @param address Adddress of the account to remove
*/
LocalWallet.prototype.removeAccount = function (address) {
this.removeSigner(address);
};
return LocalWallet;
}(wallet_base_1.WalletBase));
exports.LocalWallet = LocalWallet;
//# sourceMappingURL=local-wallet.js.mapВыполнить команду
Для локальной разработки. Не используйте в интернете!