Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@iqprotocol/abstract-storage

Package Overview
Dependencies
Maintainers
10
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iqprotocol/abstract-storage - npm Package Compare versions

Comparing version 0.15.0 to 0.15.1

69

dist/cjs/index.d.ts

@@ -0,1 +1,70 @@

type Account = {
id: string;
data: AccountData;
};
type AccountOwnershipProof = {
v: string;
sig: string;
};
type AccountData = Serializable & {
proof: AccountOwnershipProof;
};
type Serializable = boolean | number | string | null | readonly Serializable[] | {
[key: string]: Serializable | undefined;
};
type AccountState = {
serviceId: string;
accountId: string;
energyGapHalvingPeriod: number;
power: bigint;
lockedPower: bigint;
energyCap: bigint;
energy: bigint;
energyCalculatedAt: number;
};
type AccountStateChangeResult = {
successful: boolean;
currentState: AccountState;
};
interface AccountStateValidator {
validateAccount(account: Account): void;
validateAccountState(accountState: AccountState): void;
}
interface StorageProvider {
saveAccount(account: Account): Promise<Account>;
deleteAccount(id: string): Promise<boolean>;
getAccount(id: string): Promise<Account | null>;
initAccountState(accountState: AccountState): Promise<AccountState>;
changeAccountState(prevState: AccountState, newState: AccountState): Promise<AccountStateChangeResult>;
getAccountState(serviceId: string, accountId: string): Promise<AccountState | null>;
deleteAccountState(serviceId: string, accountId: string): Promise<boolean>;
}
declare class AccountStateError extends Error {
constructor(msg: string);
}
type AbstractStoreConfig = {
validator?: AccountStateValidator;
};
declare abstract class AccountStore implements StorageProvider {
private readonly validator;
protected constructor({ validator }: AbstractStoreConfig);
saveAccount(account: Account): Promise<Account>;
initAccountState(accountState: AccountState): Promise<AccountState>;
changeAccountState(prevState: AccountState, newState: AccountState): Promise<AccountStateChangeResult>;
abstract getAccount(id: string): Promise<Account | null>;
abstract deleteAccount(id: string): Promise<boolean>;
abstract getAccountState(serviceId: string, accountId: string): Promise<AccountState | null>;
abstract deleteAccountState(serviceId: string, accountId: string): Promise<boolean>;
protected abstract _saveAccount(account: Account): Promise<Account>;
protected abstract _initAccountState(accountState: AccountState): Promise<AccountState>;
protected abstract _changeAccountState(prevState: AccountState, newState: AccountState): Promise<AccountStateChangeResult>;
}
declare class DefaultValidator implements AccountStateValidator {
validateAccount(account: Account): void;
validateAccountState(accountState: AccountState): void;
}
/**
* @module abstract-storage
*/
export { Account, AccountOwnershipProof, AccountData, AccountState, AccountStateChangeResult, AccountStateValidator, StorageProvider, AccountStateError, AccountStore, DefaultValidator };
//# sourceMappingURL=index.d.ts.map

4

package.json
{
"name": "@iqprotocol/abstract-storage",
"version": "0.15.0",
"version": "0.15.1",
"bugs": "https://github.com/iqlabsorg/iq-sdk-js/issues",

@@ -29,3 +29,3 @@ "repository": {

"typedocMain": "src/index.ts",
"gitHead": "2b3b40d6c6e9e422befb995823c537cf839e962e"
"gitHead": "b698a0e32b2701b7add9ddf9580c121a92e42833"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc