@okxweb3/coin-stellar
Version:
@okxweb3/coin-stellar is a Stellar SDK for building Web3 wallets and applications. It supports Stellar and PI blockchains, enabling private key management, address generation, transaction signing, trustline creation, and asset transfers
34 lines • 1.19 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Account = void 0;
const bignumber_1 = __importDefault(require("./util/bignumber"));
const strkey_1 = require("./strkey");
class Account {
constructor(accountId, sequence) {
if (strkey_1.StrKey.isValidMed25519PublicKey(accountId)) {
throw new Error('accountId is an M-address; use MuxedAccount instead');
}
if (!strkey_1.StrKey.isValidEd25519PublicKey(accountId)) {
throw new Error('accountId is invalid');
}
if (!(typeof sequence === 'string')) {
throw new Error('sequence must be of type string');
}
this._accountId = accountId;
this.sequence = new bignumber_1.default(sequence);
}
accountId() {
return this._accountId;
}
sequenceNumber() {
return this.sequence.toString();
}
incrementSequenceNumber() {
this.sequence = this.sequence.plus(1);
}
}
exports.Account = Account;
//# sourceMappingURL=account.js.map