dingojs
Version:
A simple but feature filled interface between Filecoin's Lotus client and JS.
54 lines • 2.09 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = __importDefault(require("./core"));
const network_1 = require("./network");
/** @internal */
class DWallet extends core_1.default {
constructor(rpc, tokenStr) {
super(rpc, tokenStr);
}
balance(walAddress) {
return network_1.postJson('Filecoin.WalletBalance', this.bundle, [walAddress]);
}
list() {
return this.postSimpleJson('Filecoin.WalletList');
}
makeNew() {
return network_1.postJson('Filecoin.WalletNew', this.bundle, ['bls']);
}
defaultAddress() {
return this.postSimpleJson('Filecoin.WalletDefaultAddress');
}
delete(walAddress) {
return network_1.postJson('Filecoin.WalletDelete', this.bundle, [walAddress]);
}
export(walAddress) {
return network_1.postJson('Filecoin.WalletExport', this.bundle, [walAddress]);
}
has(walAddress) {
return network_1.postJson('Filecoin.WalletHas', this.bundle, [walAddress]);
}
import(privateKey) {
return network_1.postJson('Filecoin.WalletImport', this.bundle, [{ Type: "bls", PrivateKey: privateKey }]);
}
setDefault(walAddress) {
return network_1.postJson('Filecoin.WalletSetDefault', this.bundle, [walAddress]);
}
sign(walAddress, data) {
return network_1.postJson('Filecoin.WalletSign', this.bundle, [walAddress, data]);
}
signMessage(walAddress, message) {
return network_1.postJson('Filecoin.WalletSignMessage', this.bundle, [walAddress, message]);
}
validateAddress(walAddress) {
return network_1.postJson('Filecoin.WalletValidateAddress', this.bundle, [walAddress]);
}
verify(walAddress, signature, data) {
return network_1.postJson('Filecoin.WalletBalance', this.bundle, [walAddress, signature, { Type: 2, Data: data }]);
}
}
exports.default = DWallet;
//# sourceMappingURL=wallet.js.map