@koralabs/kora-labs-common 5.1.28 → 5.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/handles/constants.d.ts +0 -2
- package/handles/constants.js +1 -3
- package/handles/index.d.ts +4 -4
- package/handles/index.js +4 -4
- package/handles/interfaces/api.d.ts +5 -22
- package/handles/interfaces/api.js +0 -17
- package/handles/interfaces/handlesRepository.d.ts +63 -0
- package/handles/interfaces/index.d.ts +4 -8
- package/handles/interfaces/index.js +0 -4
- package/logger/index.js +1 -15
- package/package.json +1 -1
- package/handles/interfaces/handlesProvider.d.ts +0 -28
- /package/handles/interfaces/{handlesProvider.js → handlesRepository.js} +0 -0
package/handles/constants.d.ts
CHANGED
|
@@ -20,5 +20,3 @@ export declare enum ERROR_TEXT {
|
|
|
20
20
|
HANDLE_PAGE_AND_SLOT_NUMBER_INVALID = "'page' and 'slot_number' can't be used together"
|
|
21
21
|
}
|
|
22
22
|
export declare const HANDLES_PER_PAGE_MAX = 1000;
|
|
23
|
-
export declare const EMPTY = "|empty|";
|
|
24
|
-
export declare const TWELVE_HOURS_IN_SLOTS = 43200;
|
package/handles/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a, _b;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.HANDLES_PER_PAGE_MAX = exports.ERROR_TEXT = exports.KORA_USER_AGENT = exports.HANDLES_API_KEY = exports.REGEX_SUB_HANDLE = exports.REGEX_HANDLE = exports.REGEX_SPLIT_ON_NUMS = exports.REGEX_SPLIT_ON_CHARS = exports.RESPONSE_NOT_ALLOWED = exports.RESPONSE_INVALID_HANDLE_FORMAT = exports.RESPONSE_UNAVAILABLE_LEGENDARY = exports.RESPONSE_UNAVAILABLE_RESERVED = exports.RESPONSE_UNAVAILABLE_ACTIVE_SESSION = exports.RESPONSE_UNAVAILABLE_PAID = exports.RESPONSE_AVAILABLE = void 0;
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
exports.RESPONSE_AVAILABLE = 'Yay! This handle is available.';
|
|
7
7
|
exports.RESPONSE_UNAVAILABLE_PAID = 'Sorry! This Handle is pending mint or already minted.';
|
|
@@ -26,5 +26,3 @@ var ERROR_TEXT;
|
|
|
26
26
|
ERROR_TEXT["HANDLE_PAGE_AND_SLOT_NUMBER_INVALID"] = "'page' and 'slot_number' can't be used together";
|
|
27
27
|
})(ERROR_TEXT = exports.ERROR_TEXT || (exports.ERROR_TEXT = {}));
|
|
28
28
|
exports.HANDLES_PER_PAGE_MAX = 1000;
|
|
29
|
-
exports.EMPTY = '|empty|';
|
|
30
|
-
exports.TWELVE_HOURS_IN_SLOTS = 43200; // value comes from the securityParam here: https://cips.cardano.org/cips/cip9/#nonupdatableparameters then converted to slots
|
package/handles/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './api';
|
|
2
|
-
export * from './constants';
|
|
3
1
|
export * from './interfaces';
|
|
4
2
|
export * from './interfaces/api';
|
|
5
|
-
export * from './interfaces/
|
|
6
|
-
export * from './
|
|
3
|
+
export * from './interfaces/handlesRepository';
|
|
4
|
+
export * from './constants';
|
|
5
|
+
export * from './api';
|
|
7
6
|
export * from './policies';
|
|
8
7
|
export * from './utils';
|
|
8
|
+
export * from './models';
|
package/handles/index.js
CHANGED
|
@@ -14,11 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./api"), exports);
|
|
18
|
-
__exportStar(require("./constants"), exports);
|
|
19
17
|
__exportStar(require("./interfaces"), exports);
|
|
20
18
|
__exportStar(require("./interfaces/api"), exports);
|
|
21
|
-
__exportStar(require("./interfaces/
|
|
22
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./interfaces/handlesRepository"), exports);
|
|
20
|
+
__exportStar(require("./constants"), exports);
|
|
21
|
+
__exportStar(require("./api"), exports);
|
|
23
22
|
__exportStar(require("./policies"), exports);
|
|
24
23
|
__exportStar(require("./utils"), exports);
|
|
24
|
+
__exportStar(require("./models"), exports);
|
|
@@ -40,10 +40,10 @@ export interface HandleHistory {
|
|
|
40
40
|
old: Partial<StoredHandle> | null;
|
|
41
41
|
new?: Partial<StoredHandle> | null;
|
|
42
42
|
}
|
|
43
|
-
export interface
|
|
43
|
+
export interface ISlotHistoryIndex {
|
|
44
44
|
[handleHex: string]: HandleHistory;
|
|
45
45
|
}
|
|
46
|
-
export interface
|
|
46
|
+
export interface IHandleStoreMetrics {
|
|
47
47
|
firstSlot?: number;
|
|
48
48
|
lastSlot?: number;
|
|
49
49
|
currentSlot?: number;
|
|
@@ -54,8 +54,6 @@ export interface IApiMetrics {
|
|
|
54
54
|
tipBlockHash?: string;
|
|
55
55
|
memorySize?: number;
|
|
56
56
|
networkSync?: number;
|
|
57
|
-
count?: number;
|
|
58
|
-
schemaVersion?: number;
|
|
59
57
|
}
|
|
60
58
|
export interface SaveMintingTxInput {
|
|
61
59
|
hex: string;
|
|
@@ -114,6 +112,7 @@ export interface SavePersonalizationInput {
|
|
|
114
112
|
hex: string;
|
|
115
113
|
name: string;
|
|
116
114
|
personalization: IPersonalization;
|
|
115
|
+
policy: string;
|
|
117
116
|
reference_token: IReferenceToken;
|
|
118
117
|
personalizationDatum: IPzDatumConvertedUsingSchema | null;
|
|
119
118
|
metadata: IHandleMetadata | null;
|
|
@@ -124,15 +123,14 @@ export interface SaveSubHandleSettingsInput {
|
|
|
124
123
|
utxoDetails: IUTxO;
|
|
125
124
|
slotNumber: number;
|
|
126
125
|
}
|
|
127
|
-
export interface
|
|
128
|
-
address: string;
|
|
126
|
+
export interface HolderAddressIndex {
|
|
129
127
|
handles: Set<string>;
|
|
130
128
|
defaultHandle: string;
|
|
131
129
|
manuallySet: boolean;
|
|
132
130
|
type: string;
|
|
133
131
|
knownOwnerName: string;
|
|
134
132
|
}
|
|
135
|
-
export interface
|
|
133
|
+
export interface HolderAddressDetails {
|
|
136
134
|
total_handles: number;
|
|
137
135
|
address: string;
|
|
138
136
|
type: string;
|
|
@@ -171,18 +169,3 @@ export interface IGetHolderAddressDetailsRequest {
|
|
|
171
169
|
export type INormalizedQueryParams = {
|
|
172
170
|
[key: string]: string;
|
|
173
171
|
};
|
|
174
|
-
export declare enum IndexNames {
|
|
175
|
-
ADDRESS = "address",
|
|
176
|
-
CHARACTER = "characters",
|
|
177
|
-
HANDLE = "handle",
|
|
178
|
-
HASH_OF_STAKE_KEY_HASH = "hashofstakekeyhash",
|
|
179
|
-
HOLDER = "holder",
|
|
180
|
-
LENGTH = "length",
|
|
181
|
-
NUMERIC_MODIFIER = "numericmodifiers",
|
|
182
|
-
OG = "og",
|
|
183
|
-
PAYMENT_KEY_HASH = "paymentkeyhashes",
|
|
184
|
-
RARITY = "rarity",
|
|
185
|
-
SLOT_HISTORY = "slothistory",
|
|
186
|
-
SUBHANDLE = "subhandle",
|
|
187
|
-
STAKE_KEY_HASH = "stakekeyhash"
|
|
188
|
-
}
|
|
@@ -1,19 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IndexNames = void 0;
|
|
4
|
-
var IndexNames;
|
|
5
|
-
(function (IndexNames) {
|
|
6
|
-
IndexNames["ADDRESS"] = "address";
|
|
7
|
-
IndexNames["CHARACTER"] = "characters";
|
|
8
|
-
IndexNames["HANDLE"] = "handle";
|
|
9
|
-
IndexNames["HASH_OF_STAKE_KEY_HASH"] = "hashofstakekeyhash";
|
|
10
|
-
IndexNames["HOLDER"] = "holder";
|
|
11
|
-
IndexNames["LENGTH"] = "length";
|
|
12
|
-
IndexNames["NUMERIC_MODIFIER"] = "numericmodifiers";
|
|
13
|
-
IndexNames["OG"] = "og";
|
|
14
|
-
IndexNames["PAYMENT_KEY_HASH"] = "paymentkeyhashes";
|
|
15
|
-
IndexNames["RARITY"] = "rarity";
|
|
16
|
-
IndexNames["SLOT_HISTORY"] = "slothistory";
|
|
17
|
-
IndexNames["SUBHANDLE"] = "subhandle";
|
|
18
|
-
IndexNames["STAKE_KEY_HASH"] = "stakekeyhash";
|
|
19
|
-
})(IndexNames = exports.IndexNames || (exports.IndexNames = {}));
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { IHandleFileContent, IHandleStats, IUTxO } from '..';
|
|
2
|
+
import { HandlePaginationModel } from '../models/handlePagination.model';
|
|
3
|
+
import { HandleSearchModel } from '../models/handleSearch.model';
|
|
4
|
+
import { HolderPaginationModel } from '../models/holderPagination.model';
|
|
5
|
+
import { HolderAddressDetails, IHandleStoreMetrics, SaveMintingTxInput, SavePersonalizationInput, SaveSubHandleSettingsInput, SaveWalletAddressMoveInput, StoredHandle } from './api';
|
|
6
|
+
export interface IHandlesRepository {
|
|
7
|
+
initialize: () => IHandlesRepository;
|
|
8
|
+
getAll: (params: {
|
|
9
|
+
pagination: HandlePaginationModel;
|
|
10
|
+
search: HandleSearchModel;
|
|
11
|
+
}) => Promise<{
|
|
12
|
+
searchTotal: number;
|
|
13
|
+
handles: StoredHandle[];
|
|
14
|
+
}>;
|
|
15
|
+
getHandlesByPaymentKeyHashes: (hashes: string[]) => string[];
|
|
16
|
+
getHandlesByAddresses: (addresses: string[]) => string[];
|
|
17
|
+
getHandlesByHolderAddresses: (addresses: string[]) => string[];
|
|
18
|
+
getHandlesByStakeKeyHashes: (hashes: string[]) => string[];
|
|
19
|
+
getAllHandleNames: (search: HandleSearchModel, sort: string) => Promise<string[]>;
|
|
20
|
+
getHandleByName: (handleName: string) => Promise<StoredHandle | null>;
|
|
21
|
+
getHandleByHex: (handleHex: string) => Promise<StoredHandle | null>;
|
|
22
|
+
getHolderAddressDetails: (key: string) => Promise<HolderAddressDetails>;
|
|
23
|
+
getAllHolders: (params: {
|
|
24
|
+
pagination: HolderPaginationModel;
|
|
25
|
+
}) => Promise<HolderAddressDetails[]>;
|
|
26
|
+
getHandleStats: () => IHandleStats;
|
|
27
|
+
getTotalHandlesStats: () => {
|
|
28
|
+
total_handles: number;
|
|
29
|
+
total_holders: number;
|
|
30
|
+
};
|
|
31
|
+
currentHttpStatus: () => number;
|
|
32
|
+
getHandleDatumByName: (handleName: string) => Promise<string | null>;
|
|
33
|
+
getSubHandleSettings: (handleName: string) => Promise<{
|
|
34
|
+
settings?: string;
|
|
35
|
+
utxo: IUTxO;
|
|
36
|
+
} | null>;
|
|
37
|
+
getSubHandles: (handleName: string) => Promise<StoredHandle[]>;
|
|
38
|
+
getTimeMetrics: () => {
|
|
39
|
+
elapsedOgmiosExec: number;
|
|
40
|
+
elapsedBuildingExec: number;
|
|
41
|
+
};
|
|
42
|
+
setMetrics: (metrics: IHandleStoreMetrics) => void;
|
|
43
|
+
getMetrics: () => IHandleStats;
|
|
44
|
+
getFilesContent(): Promise<IHandleFileContent[] | null>;
|
|
45
|
+
prepareHandlesStorage: (fileContent: IHandleFileContent) => Promise<void>;
|
|
46
|
+
rollBackToGenesis: () => Promise<void>;
|
|
47
|
+
isCaughtUp: () => boolean;
|
|
48
|
+
burnHandle: (handleName: string, slotNumber: number) => Promise<void>;
|
|
49
|
+
rewindChangesToSlot: ({ slot, hash, lastSlot }: {
|
|
50
|
+
slot: number;
|
|
51
|
+
hash: string;
|
|
52
|
+
lastSlot: number;
|
|
53
|
+
}) => Promise<{
|
|
54
|
+
name: string;
|
|
55
|
+
action: string;
|
|
56
|
+
handle: Partial<StoredHandle> | undefined;
|
|
57
|
+
}[]>;
|
|
58
|
+
savePersonalizationChange: ({ name, hex, personalization, reference_token, personalizationDatum, slotNumber, metadata }: SavePersonalizationInput) => Promise<void>;
|
|
59
|
+
saveSubHandleSettingsChange: ({ name, settingsDatum, utxoDetails, slotNumber }: SaveSubHandleSettingsInput) => Promise<void>;
|
|
60
|
+
saveMintedHandle: (input: SaveMintingTxInput) => Promise<void>;
|
|
61
|
+
saveHandleUpdate: ({ name, adaAddress, utxo, slotNumber, datum, script }: SaveWalletAddressMoveInput) => Promise<void>;
|
|
62
|
+
destroy: () => void;
|
|
63
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BoolInt, FeaturedItemType, HexString, HexStringOrEmpty } from '../../types';
|
|
2
|
-
import {
|
|
2
|
+
import { ISlotHistoryIndex, StoredHandle } from './api';
|
|
3
3
|
export declare enum Rarity {
|
|
4
4
|
basic = "basic",
|
|
5
5
|
common = "common",
|
|
@@ -71,11 +71,7 @@ export interface IPersonalizationPortal {
|
|
|
71
71
|
export declare enum ScriptType {
|
|
72
72
|
PZ_CONTRACT = "pz_contract",
|
|
73
73
|
SUB_HANDLE_SETTINGS = "sub_handle_settings",
|
|
74
|
-
MARKETPLACE_CONTRACT = "marketplace_contract"
|
|
75
|
-
DEMI_MINT = "demi_mint",
|
|
76
|
-
DEMI_MINT_PROXY = "demi_mint_proxy",
|
|
77
|
-
DEMI_MINTING_DATA = "demi_minting_data",
|
|
78
|
-
DEMI_ORDERS = "demi_orders"
|
|
74
|
+
MARKETPLACE_CONTRACT = "marketplace_contract"
|
|
79
75
|
}
|
|
80
76
|
export interface ScriptDetails {
|
|
81
77
|
handle: string;
|
|
@@ -159,7 +155,7 @@ export interface ICip68Handle extends IHandle {
|
|
|
159
155
|
export interface IPersonalizedHandle extends ICip68Handle {
|
|
160
156
|
personalization?: IPersonalization;
|
|
161
157
|
}
|
|
162
|
-
export interface
|
|
158
|
+
export interface IHandleStats {
|
|
163
159
|
percentage_complete: string;
|
|
164
160
|
current_memory_used: number;
|
|
165
161
|
ogmios_elapsed: string;
|
|
@@ -348,7 +344,7 @@ export interface IHandleFileContent {
|
|
|
348
344
|
hash: string;
|
|
349
345
|
schemaVersion?: number;
|
|
350
346
|
handles: Record<string, StoredHandle>;
|
|
351
|
-
history: [number,
|
|
347
|
+
history: [number, ISlotHistoryIndex][];
|
|
352
348
|
}
|
|
353
349
|
export interface IHandleSvgOptions extends IPersonalizationDesigner {
|
|
354
350
|
pfp_image?: string;
|
|
@@ -14,10 +14,6 @@ var ScriptType;
|
|
|
14
14
|
ScriptType["PZ_CONTRACT"] = "pz_contract";
|
|
15
15
|
ScriptType["SUB_HANDLE_SETTINGS"] = "sub_handle_settings";
|
|
16
16
|
ScriptType["MARKETPLACE_CONTRACT"] = "marketplace_contract";
|
|
17
|
-
ScriptType["DEMI_MINT"] = "demi_mint";
|
|
18
|
-
ScriptType["DEMI_MINT_PROXY"] = "demi_mint_proxy";
|
|
19
|
-
ScriptType["DEMI_MINTING_DATA"] = "demi_minting_data";
|
|
20
|
-
ScriptType["DEMI_ORDERS"] = "demi_orders";
|
|
21
17
|
})(ScriptType = exports.ScriptType || (exports.ScriptType = {}));
|
|
22
18
|
var HandleType;
|
|
23
19
|
(function (HandleType) {
|
package/logger/index.js
CHANGED
|
@@ -59,22 +59,8 @@ class Logger {
|
|
|
59
59
|
const log_milliseconds = milliseconds != undefined && milliseconds != null ? `, "milliseconds": ${milliseconds}` : '';
|
|
60
60
|
const log_count = count != undefined && count != null ? `, "count": ${count}` : '';
|
|
61
61
|
const log_dimensions = dimensions && Object.keys(dimensions).length ? `, "dimensions": ${JSON.stringify(dimensions)}` : '';
|
|
62
|
-
let logFunc = console.log;
|
|
63
|
-
switch (category) {
|
|
64
|
-
case LogCategory.DEBUG:
|
|
65
|
-
logFunc = console.debug;
|
|
66
|
-
break;
|
|
67
|
-
case LogCategory.WARN:
|
|
68
|
-
logFunc = console.warn;
|
|
69
|
-
break;
|
|
70
|
-
case LogCategory.ERROR:
|
|
71
|
-
case LogCategory.FATAL:
|
|
72
|
-
case LogCategory.NOTIFY:
|
|
73
|
-
logFunc = console.error;
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
62
|
// PLEASE KEEP THIS ALL ON ONE LINE SO LOGS AREN'T BROKEN UP
|
|
77
|
-
|
|
63
|
+
console.log(`{"network": "${Logger.network}", "application": "${Logger.application}", "category": "${category !== null && category !== void 0 ? category : LogCategory.INFO}", "message": "${message}"${log_event}, "timestamp": "${now}"${log_milliseconds}${log_count}${log_dimensions} }`);
|
|
78
64
|
// PLEASE KEEP THIS ALL ON ONE LINE SO LOGS AREN'T BROKEN UP
|
|
79
65
|
}
|
|
80
66
|
}
|
package/package.json
CHANGED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { IApiMetrics, IndexNames, StoredHandle } from './api';
|
|
2
|
-
export interface IHandlesProvider {
|
|
3
|
-
initialize: () => Promise<IHandlesProvider>;
|
|
4
|
-
destroy: () => void;
|
|
5
|
-
rollBackToGenesis: () => void;
|
|
6
|
-
getStartingPoint: (save: ({ handle, oldHandle, saveHistory }: {
|
|
7
|
-
handle: StoredHandle;
|
|
8
|
-
oldHandle?: StoredHandle;
|
|
9
|
-
saveHistory?: boolean;
|
|
10
|
-
}) => Promise<void>, failed: boolean) => Promise<{
|
|
11
|
-
slot: number;
|
|
12
|
-
id: string;
|
|
13
|
-
} | null>;
|
|
14
|
-
getHandle: (key: string) => StoredHandle | null;
|
|
15
|
-
getHandleByHex: (hex: string) => StoredHandle | null;
|
|
16
|
-
getAllHandles: () => StoredHandle[];
|
|
17
|
-
setHandle: (key: string, value: StoredHandle) => void;
|
|
18
|
-
removeHandle: (handleName: string) => void;
|
|
19
|
-
getIndex: (index: IndexNames) => any;
|
|
20
|
-
getValuesFromIndex: (index: IndexNames, key: string | number) => any;
|
|
21
|
-
setValueOnIndex: (index: IndexNames, key: string | number, value: any) => void;
|
|
22
|
-
removeValueFromIndex: (index: IndexNames, key: string | number, value: string) => void;
|
|
23
|
-
removeKeyFromIndex: (index: IndexNames, key: string | number) => void;
|
|
24
|
-
getMetrics: () => IApiMetrics;
|
|
25
|
-
setMetrics: (metrics: IApiMetrics) => void;
|
|
26
|
-
count: () => number;
|
|
27
|
-
getSchemaVersion: () => number;
|
|
28
|
-
}
|
|
File without changes
|