@near-lake/primitives
Version:
Near Protocol primitive datatypes utilized by near-lake-framework and QueryAPI
92 lines (91 loc) • 2.44 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StateChange = void 0;
/**
* This structure is almost an identical copy of the `StateChangeWithCauseView` from [near-primitives](https://github.com/near/nearcore/tree/master/core/primitives) with a propagated additional field `affectedAccountId`.
*/
class StateChange {
constructor(
/**
* Returns the `cause` of the `StateChange`.
*/
cause,
/**
* Returns the `value` of the `StateChange`.
*/
value) {
this.cause = cause;
this.value = value;
}
/**
* Returns the account id of the `StateChange`.
*/
get affectedAccountId() {
return this.value.accountId;
}
/**
* Returns the `StateChange` from the `StateChangeWithCauseView`. Created for backward compatibility.
*/
static fromStateChangeView(stateChangeView) {
let { cause, value } = stateChangeView;
return new StateChange(cause, value);
}
}
exports.StateChange = StateChange;
class AccountUpdateValue {
constructor(accountId, account) {
this.accountId = accountId;
this.account = account;
}
}
class AccountDeletionValue {
constructor(accountId) {
this.accountId = accountId;
}
}
class AccountKeyUpdateValue {
constructor(accountId, publicKey, accessKey) {
this.accountId = accountId;
this.publicKey = publicKey;
this.accessKey = accessKey;
}
}
class AccessKeyDeletionValue {
constructor(accountId, publicKey) {
this.accountId = accountId;
this.publicKey = publicKey;
}
}
class DataUpdateValue {
constructor(accountId, key, value) {
this.accountId = accountId;
this.key = key;
this.value = value;
}
}
class DataDeletionValue {
constructor(accountId, key) {
this.accountId = accountId;
this.key = key;
}
}
class ContractCodeUpdateValue {
constructor(accountId, code) {
this.accountId = accountId;
this.code = code;
}
}
class ContractCodeDeletionValue {
constructor(accountId) {
this.accountId = accountId;
}
}
class Account {
constructor(amount, locked, codeHash, storageUsage, storagePaidAt) {
this.amount = amount;
this.locked = locked;
this.codeHash = codeHash;
this.storageUsage = storageUsage;
this.storagePaidAt = storagePaidAt;
}
}