@koralabs/kora-labs-common 6.3.9 → 6.4.1

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.
@@ -0,0 +1,19 @@
1
+ export declare class UTxO {
2
+ id: string;
3
+ tx_id: string;
4
+ index: number;
5
+ slot: number;
6
+ address: string;
7
+ lovelace: number;
8
+ datum?: string;
9
+ script?: {
10
+ type: string;
11
+ cbor: string;
12
+ };
13
+ constructor(utxo: UTxOWithTxInfo);
14
+ }
15
+ export interface UTxOWithTxInfo extends UTxO {
16
+ handles: [string, string[]][];
17
+ mint: [string, string[]][];
18
+ metadata: any;
19
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UTxO = void 0;
4
+ class UTxO {
5
+ constructor(utxo) {
6
+ this.id = utxo.id;
7
+ this.tx_id = utxo.tx_id;
8
+ this.index = utxo.index;
9
+ this.slot = utxo.slot;
10
+ this.address = utxo.address;
11
+ this.lovelace = utxo.lovelace;
12
+ this.datum = utxo.datum;
13
+ this.script = utxo.script;
14
+ }
15
+ }
16
+ exports.UTxO = UTxO;
@@ -2,6 +2,8 @@ export * from './api';
2
2
  export * from './constants';
3
3
  export * from './interfaces';
4
4
  export * from './interfaces/api';
5
+ export * from './interfaces/ScriptDetails';
5
6
  export * from './models';
6
7
  export * from './policies';
7
8
  export * from './utils';
9
+ export * from './UTxO';
package/handles/index.js CHANGED
@@ -18,6 +18,8 @@ __exportStar(require("./api"), exports);
18
18
  __exportStar(require("./constants"), exports);
19
19
  __exportStar(require("./interfaces"), exports);
20
20
  __exportStar(require("./interfaces/api"), exports);
21
+ __exportStar(require("./interfaces/ScriptDetails"), exports);
21
22
  __exportStar(require("./models"), exports);
22
23
  __exportStar(require("./policies"), exports);
23
24
  __exportStar(require("./utils"), exports);
25
+ __exportStar(require("./UTxO"), exports);
@@ -0,0 +1,29 @@
1
+ export declare enum ScriptType {
2
+ PZ_CONTRACT = "pz_contract",
3
+ SUB_HANDLE_SETTINGS = "sub_handle_settings",
4
+ MARKETPLACE_CONTRACT = "marketplace_contract",
5
+ DEMI_MINT_PROXY = "demi_mint_proxy",
6
+ DEMI_MINT = "demi_mint",
7
+ DEMI_MINTING_DATA = "demi_minting_data",
8
+ DEMI_ORDERS = "demi_orders",
9
+ HAL_MINT_PROXY = "hal_mint_proxy",
10
+ HAL_MINT = "hal_mint",
11
+ HAL_MINTING_DATA = "hal_minting_data",
12
+ HAL_ORDERS_SPEND = "hal_orders_spend",
13
+ HAL_REF_SPEND_PROXY = "hal_ref_spend_proxy",
14
+ HAL_REF_SPEND = "hal_ref_spend",
15
+ HAL_ROYALTY_SPEND = "hal_royalty_spend"
16
+ }
17
+ export interface ScriptDetails {
18
+ handle: string;
19
+ handleHex: string;
20
+ refScriptUtxo?: string;
21
+ refScriptAddress?: string;
22
+ datumCbor?: string;
23
+ cbor?: string;
24
+ unoptimizedCbor?: string;
25
+ validatorHash: string;
26
+ latest?: boolean;
27
+ type: ScriptType;
28
+ txBuildVersion?: number;
29
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ScriptType = void 0;
4
+ var ScriptType;
5
+ (function (ScriptType) {
6
+ ScriptType["PZ_CONTRACT"] = "pz_contract";
7
+ ScriptType["SUB_HANDLE_SETTINGS"] = "sub_handle_settings";
8
+ ScriptType["MARKETPLACE_CONTRACT"] = "marketplace_contract";
9
+ // De-Mi
10
+ ScriptType["DEMI_MINT_PROXY"] = "demi_mint_proxy";
11
+ ScriptType["DEMI_MINT"] = "demi_mint";
12
+ ScriptType["DEMI_MINTING_DATA"] = "demi_minting_data";
13
+ ScriptType["DEMI_ORDERS"] = "demi_orders";
14
+ // H.A.L. mint
15
+ ScriptType["HAL_MINT_PROXY"] = "hal_mint_proxy";
16
+ ScriptType["HAL_MINT"] = "hal_mint";
17
+ ScriptType["HAL_MINTING_DATA"] = "hal_minting_data";
18
+ ScriptType["HAL_ORDERS_SPEND"] = "hal_orders_spend";
19
+ ScriptType["HAL_REF_SPEND_PROXY"] = "hal_ref_spend_proxy";
20
+ ScriptType["HAL_REF_SPEND"] = "hal_ref_spend";
21
+ ScriptType["HAL_ROYALTY_SPEND"] = "hal_royalty_spend";
22
+ })(ScriptType = exports.ScriptType || (exports.ScriptType = {}));
@@ -1,6 +1,7 @@
1
- import { HandleType, IPersonalizedHandle, ISubHandleSettings, IUTxO, Rarity } from '.';
1
+ import { HandleType, IPersonalizedHandle, ISubHandleSettings, MintingData, Rarity } from '.';
2
2
  import { IMarketplaceListing } from '../../marketplace/interfaces';
3
3
  import { Sort } from '../../types';
4
+ import { UTxO, UTxOWithTxInfo } from '../UTxO';
4
5
  export interface SortAndLimitOptions {
5
6
  start?: number;
6
7
  end?: number;
@@ -16,7 +17,7 @@ export interface IApiStore {
16
17
  destroy: () => void;
17
18
  rollBackToGenesis: () => void;
18
19
  pipeline: (commands: CallableFunction) => ApiIndexType | ApiIndexType[] | void;
19
- getStartingPoint: (save: (handle: StoredHandle) => void, failed: boolean) => Promise<{
20
+ getStartingPoint: (updateHandleIndexes: (utxo: UTxOWithTxInfo) => void, failed: boolean) => Promise<{
20
21
  slot: number;
21
22
  id: string;
22
23
  } | null>;
@@ -34,12 +35,14 @@ export interface IApiStore {
34
35
  getMetrics: () => IApiMetrics;
35
36
  setMetrics: (metrics: IApiMetrics) => void;
36
37
  count: () => number;
37
- getSchemaVersion: () => number;
38
+ getIndexSchemaVersion: () => number;
39
+ getUTxOSchemaVersion: () => number;
38
40
  }
39
41
  export interface SubHandleSettings extends ISubHandleSettings {
40
- utxo: IUTxO;
42
+ utxo?: UTxO;
43
+ utxo_id?: string;
41
44
  }
42
- export type ApiIndexType = Set<string> | Holder | ISlotHistory | StoredHandle | IMarketplaceListing | string;
45
+ export type ApiIndexType = Set<string> | Holder | ISlotHistory | StoredHandle | IMarketplaceListing | string | UTxOWithTxInfo | MintingData;
43
46
  export interface StoredHandle extends IPersonalizedHandle {
44
47
  amount: number;
45
48
  default?: boolean;
@@ -60,16 +63,16 @@ export interface IDrep {
60
63
  cip_105: string;
61
64
  cip_129: string;
62
65
  }
63
- export interface HandleHistory {
64
- old: Partial<StoredHandle> | null;
65
- new?: Partial<StoredHandle> | null;
66
+ export interface HandleUTxOHistory {
67
+ old: UTxOWithTxInfo | null;
68
+ new?: UTxOWithTxInfo | null;
66
69
  }
67
70
  export interface ListingHistory {
68
71
  old: Partial<IMarketplaceListing> | null;
69
72
  new?: Partial<IMarketplaceListing> | null;
70
73
  }
71
74
  export interface ISlotHistory {
72
- [handleHex: string]: HandleHistory | ListingHistory;
75
+ [handleHex: string]: HandleUTxOHistory | ListingHistory;
73
76
  }
74
77
  export interface IApiMetrics {
75
78
  firstSlot?: number;
@@ -82,7 +85,8 @@ export interface IApiMetrics {
82
85
  networkSync?: number;
83
86
  handleCount?: number;
84
87
  holderCount?: number;
85
- schemaVersion?: number;
88
+ utxoSchemaVersion?: number;
89
+ indexSchemaVersion?: number;
86
90
  startTimestamp?: number;
87
91
  }
88
92
  export interface DefaultHandleInfo {
@@ -157,9 +161,11 @@ export declare enum IndexNames {
157
161
  PERSONALIZED = "personalized",
158
162
  RARITY = "rarity",
159
163
  SLOT = "slot",
160
- SLOT_HISTORY = "slothistory",
161
164
  SUBHANDLE = "subhandle",
162
- HANDLE_TYPE = "handle_type"
165
+ HANDLE_TYPE = "handle_type",
166
+ UTXO_SLOT = "utxo_slot",
167
+ UTXO = "utxo",
168
+ MINT = "mint"
163
169
  }
164
170
  export type CharacterAttribute = 'letters' | 'numbers' | 'special' | 'letters,numbers' | 'numbers,special' | 'letters,special' | 'letters,numbers,special';
165
171
  export type NumericModifiersAttribute = 'negative' | 'decimal' | 'negative,decimal' | '';
@@ -16,7 +16,9 @@ var IndexNames;
16
16
  IndexNames["PERSONALIZED"] = "personalized";
17
17
  IndexNames["RARITY"] = "rarity";
18
18
  IndexNames["SLOT"] = "slot";
19
- IndexNames["SLOT_HISTORY"] = "slothistory";
20
19
  IndexNames["SUBHANDLE"] = "subhandle";
21
20
  IndexNames["HANDLE_TYPE"] = "handle_type";
21
+ IndexNames["UTXO_SLOT"] = "utxo_slot";
22
+ IndexNames["UTXO"] = "utxo";
23
+ IndexNames["MINT"] = "mint";
22
24
  })(IndexNames = exports.IndexNames || (exports.IndexNames = {}));
@@ -1,5 +1,5 @@
1
1
  import { BoolInt, FeaturedItemType, HexString, HexStringOrEmpty } from '../../types';
2
- import { ISlotHistory, StoredHandle } from './api';
2
+ import { UTxO, UTxOWithTxInfo } from '../UTxO';
3
3
  export declare enum Rarity {
4
4
  basic = "basic",
5
5
  common = "common",
@@ -68,45 +68,6 @@ export interface IPersonalizationPortal {
68
68
  gallery_setting?: string | null;
69
69
  text_setting?: string | null;
70
70
  }
71
- export declare enum ScriptType {
72
- PZ_CONTRACT = "pz_contract",
73
- SUB_HANDLE_SETTINGS = "sub_handle_settings",
74
- MARKETPLACE_CONTRACT = "marketplace_contract",
75
- DEMI_MINT_PROXY = "demi_mint_proxy",
76
- DEMI_MINT = "demi_mint",
77
- DEMI_MINTING_DATA = "demi_minting_data",
78
- DEMI_ORDERS = "demi_orders",
79
- HAL_MINT_PROXY = "hal_mint_proxy",
80
- HAL_MINT = "hal_mint",
81
- HAL_MINTING_DATA = "hal_minting_data",
82
- HAL_ORDERS_SPEND = "hal_orders_spend",
83
- HAL_REF_SPEND_PROXY = "hal_ref_spend_proxy",
84
- HAL_REF_SPEND = "hal_ref_spend",
85
- HAL_ROYALTY_SPEND = "hal_royalty_spend"
86
- }
87
- export interface ScriptDetails {
88
- handle: string;
89
- handleHex: string;
90
- refScriptUtxo?: string;
91
- refScriptAddress?: string;
92
- datumCbor?: string;
93
- cbor?: string;
94
- unoptimizedCbor?: string;
95
- validatorHash: string;
96
- latest?: boolean;
97
- type: ScriptType;
98
- txBuildVersion?: number;
99
- }
100
- export interface IUTxO {
101
- tx_id: string;
102
- index: number;
103
- lovelace: number;
104
- datum?: string;
105
- address: string;
106
- script?: ScriptDetails;
107
- }
108
- export interface IReferenceToken extends IUTxO {
109
- }
110
71
  export interface IPersonalization {
111
72
  portal?: IPersonalizationPortal;
112
73
  designer?: IPersonalizationDesigner;
@@ -162,7 +123,8 @@ export interface IHandle {
162
123
  pz_enabled?: boolean;
163
124
  }
164
125
  export interface ICip68Handle extends IHandle {
165
- reference_token?: IReferenceToken;
126
+ reference_token?: UTxO;
127
+ reference_utxo?: string;
166
128
  }
167
129
  export interface IPersonalizedHandle extends ICip68Handle {
168
130
  personalization?: IPersonalization;
@@ -339,12 +301,19 @@ export type ISubHandleSettingsDatumStruct = [
339
301
  BoolInt,
340
302
  string
341
303
  ];
304
+ export interface MintingData {
305
+ created_slot: number;
306
+ metadata: any;
307
+ txHash: string;
308
+ }
342
309
  export interface IHandleFileContent {
343
310
  slot: number;
344
311
  hash: string;
345
- schemaVersion?: number;
346
- handles: StoredHandle[];
347
- history: [number, ISlotHistory][];
312
+ utxoSchemaVersion?: number;
313
+ utxos: UTxOWithTxInfo[];
314
+ mintingData: {
315
+ [handle: string]: MintingData;
316
+ };
348
317
  }
349
318
  export interface IHandleSvgOptions extends IPersonalizationDesigner {
350
319
  pfp_image?: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AvailabilityResponseCode = exports.OAuthSocial = exports.SubHandleType = exports.HandleType = exports.ScriptType = exports.Rarity = void 0;
3
+ exports.AvailabilityResponseCode = exports.OAuthSocial = exports.SubHandleType = exports.HandleType = exports.Rarity = void 0;
4
4
  var Rarity;
5
5
  (function (Rarity) {
6
6
  Rarity["basic"] = "basic";
@@ -9,25 +9,6 @@ var Rarity;
9
9
  Rarity["ultra_rare"] = "ultra_rare";
10
10
  Rarity["legendary"] = "legendary"; // - 1 character
11
11
  })(Rarity = exports.Rarity || (exports.Rarity = {}));
12
- var ScriptType;
13
- (function (ScriptType) {
14
- ScriptType["PZ_CONTRACT"] = "pz_contract";
15
- ScriptType["SUB_HANDLE_SETTINGS"] = "sub_handle_settings";
16
- ScriptType["MARKETPLACE_CONTRACT"] = "marketplace_contract";
17
- // De-Mi
18
- ScriptType["DEMI_MINT_PROXY"] = "demi_mint_proxy";
19
- ScriptType["DEMI_MINT"] = "demi_mint";
20
- ScriptType["DEMI_MINTING_DATA"] = "demi_minting_data";
21
- ScriptType["DEMI_ORDERS"] = "demi_orders";
22
- // H.A.L. mint
23
- ScriptType["HAL_MINT_PROXY"] = "hal_mint_proxy";
24
- ScriptType["HAL_MINT"] = "hal_mint";
25
- ScriptType["HAL_MINTING_DATA"] = "hal_minting_data";
26
- ScriptType["HAL_ORDERS_SPEND"] = "hal_orders_spend";
27
- ScriptType["HAL_REF_SPEND_PROXY"] = "hal_ref_spend_proxy";
28
- ScriptType["HAL_REF_SPEND"] = "hal_ref_spend";
29
- ScriptType["HAL_ROYALTY_SPEND"] = "hal_royalty_spend";
30
- })(ScriptType = exports.ScriptType || (exports.ScriptType = {}));
31
12
  var HandleType;
32
13
  (function (HandleType) {
33
14
  HandleType["VIRTUAL_SUBHANDLE"] = "virtual_subhandle";
@@ -1,3 +1,3 @@
1
- export * from './handleSearch.model';
2
1
  export * from './handlePagination.model';
2
+ export * from './handleSearch.model';
3
3
  export * from './holderPagination.model';
@@ -14,6 +14,6 @@ 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("./handleSearch.model"), exports);
18
17
  __exportStar(require("./handlePagination.model"), exports);
18
+ __exportStar(require("./handleSearch.model"), exports);
19
19
  __exportStar(require("./holderPagination.model"), exports);
@@ -1,4 +1,4 @@
1
- import { IUTxO } from '../handles';
1
+ import { UTxO } from '../handles/UTxO';
2
2
  import { AssetNameLabel } from '../types';
3
3
  export type NftAttributes = {
4
4
  name: string;
@@ -16,7 +16,7 @@ export interface IMarketplaceListing {
16
16
  asset_label?: AssetNameLabel;
17
17
  policy_id: string;
18
18
  nft_attributes?: NftAttributes;
19
- utxo: IUTxO;
19
+ utxo: UTxO;
20
20
  holder: string;
21
21
  price: number;
22
22
  payouts: IPayout[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koralabs/kora-labs-common",
3
- "version": "6.3.9",
3
+ "version": "6.4.1",
4
4
  "description": "Kora Labs Common Utilities",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/utils/index.js CHANGED
@@ -49,7 +49,7 @@ const asyncForEach = async (array, callback, delayInMilliseconds = 0) => {
49
49
  };
50
50
  exports.asyncForEach = asyncForEach;
51
51
  const isNumeric = (n) => {
52
- return !isNaN(parseFloat(n)) && isFinite(parseFloat(n));
52
+ return !isNaN(parseFloat(n)) && isFinite(Number(n));
53
53
  };
54
54
  exports.isNumeric = isNumeric;
55
55
  const isNullEmptyOrUndefined = (value) => {