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.13.1 to 0.15.0

66

dist/cjs/index.d.ts

@@ -1,67 +0,1 @@

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;
}
export { Account, AccountOwnershipProof, AccountData, AccountState, AccountStateChangeResult, AccountStateValidator, StorageProvider, AccountStateError, AccountStore, DefaultValidator };
//# sourceMappingURL=index.d.ts.map

3

dist/esm/index.d.ts

@@ -66,3 +66,6 @@ type Account = {

}
/**
* @module abstract-storage
*/
export { Account, AccountOwnershipProof, AccountData, AccountState, AccountStateChangeResult, AccountStateValidator, StorageProvider, AccountStateError, AccountStore, DefaultValidator };
//# sourceMappingURL=index.d.ts.map
{
"name": "@iqprotocol/abstract-storage",
"version": "0.13.1",
"version": "0.15.0",
"bugs": "https://github.com/iqlabsorg/iq-sdk-js/issues",

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

"license": "MIT",
"author": "IQ Labs (https://iqlabs.org)",
"author": "IQ Labs (https://iq.space)",
"main": "dist/cjs/index.js",

@@ -30,3 +30,3 @@ "module": "dist/esm/index.js",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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