@koralabs/kora-labs-common 4.0.1 → 4.0.3

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.
@@ -4,3 +4,13 @@ export declare enum CardanoNetwork {
4
4
  PREVIEW = "PREVIEW",
5
5
  UNSET = "UNSET"
6
6
  }
7
+ export declare enum Cip67Label {
8
+ LBL_000 = "00000000",
9
+ LBL_001 = "00001070",
10
+ LBL_002 = "000020E0",
11
+ LBL_100 = "000643B0",
12
+ LBL_222 = "000de140",
13
+ LBL_444 = "001BC280"
14
+ }
15
+ export declare const IS_PRODUCTION: boolean;
16
+ export declare const IS_SERVER: boolean;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
+ var _a, _b;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CardanoNetwork = void 0;
4
+ exports.IS_SERVER = exports.IS_PRODUCTION = exports.Cip67Label = exports.CardanoNetwork = void 0;
4
5
  var CardanoNetwork;
5
6
  (function (CardanoNetwork) {
6
7
  CardanoNetwork["MAINNET"] = "MAINNET";
@@ -8,3 +9,14 @@ var CardanoNetwork;
8
9
  CardanoNetwork["PREVIEW"] = "PREVIEW";
9
10
  CardanoNetwork["UNSET"] = "UNSET";
10
11
  })(CardanoNetwork = exports.CardanoNetwork || (exports.CardanoNetwork = {}));
12
+ var Cip67Label;
13
+ (function (Cip67Label) {
14
+ Cip67Label["LBL_000"] = "00000000";
15
+ Cip67Label["LBL_001"] = "00001070";
16
+ Cip67Label["LBL_002"] = "000020E0";
17
+ Cip67Label["LBL_100"] = "000643B0";
18
+ Cip67Label["LBL_222"] = "000de140";
19
+ Cip67Label["LBL_444"] = "001BC280";
20
+ })(Cip67Label = exports.Cip67Label || (exports.Cip67Label = {}));
21
+ exports.IS_PRODUCTION = ((_a = process.env.NODE_ENV) === null || _a === void 0 ? void 0 : _a.trim()) === 'production' && ((_b = process.env.NETWORK) === null || _b === void 0 ? void 0 : _b.toLowerCase()) == 'mainnet';
22
+ exports.IS_SERVER = (typeof process !== 'undefined') && (typeof process.versions.node !== 'undefined');
@@ -9,6 +9,5 @@ export declare const REGEX_SPLIT_ON_CHARS: RegExp;
9
9
  export declare const REGEX_SPLIT_ON_NUMS: RegExp;
10
10
  export declare const REGEX_HANDLE: RegExp;
11
11
  export declare const REGEX_SUB_HANDLE: RegExp;
12
- export declare const isProduction: () => boolean;
13
12
  export declare const HANDLES_API_KEY: string;
14
13
  export declare const KORA_USER_AGENT: string;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  var _a, _b;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.KORA_USER_AGENT = exports.HANDLES_API_KEY = exports.isProduction = 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;
4
+ 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
+ const constants_1 = require("../constants");
5
6
  exports.RESPONSE_AVAILABLE = 'Yay! This handle is available.';
6
7
  exports.RESPONSE_UNAVAILABLE_PAID = 'Sorry! This Handle is pending mint or already minted.';
7
8
  exports.RESPONSE_UNAVAILABLE_ACTIVE_SESSION = 'Pending purchase. Try a different variation.';
@@ -13,10 +14,5 @@ exports.REGEX_SPLIT_ON_CHARS = /([0-9a-z]+)[@_.-]*/g;
13
14
  exports.REGEX_SPLIT_ON_NUMS = /([a-z]+)[0-9]*/g;
14
15
  exports.REGEX_HANDLE = new RegExp(/^[a-zA-Z0-9_.-]{1,15}$/);
15
16
  exports.REGEX_SUB_HANDLE = new RegExp(/(?:^[a-z0-9_.-]{1,15}$)|(?:^(?!.{29})[a-z0-9_.-]+@[a-z0-9_.-]{1,15}$)/g);
16
- const isProduction = () => {
17
- var _a;
18
- return ((_a = process.env.NODE_ENV) === null || _a === void 0 ? void 0 : _a.trim()) === 'production' && process.env.NETWORK == 'MAINNET';
19
- };
20
- exports.isProduction = isProduction;
21
- exports.HANDLES_API_KEY = (0, exports.isProduction)() ? (_a = process.env.HANDLES_API_KEY) !== null && _a !== void 0 ? _a : '' : '';
17
+ exports.HANDLES_API_KEY = constants_1.IS_PRODUCTION ? (_a = process.env.HANDLES_API_KEY) !== null && _a !== void 0 ? _a : '' : '';
22
18
  exports.KORA_USER_AGENT = (_b = process.env.KORA_USER_AGENT) !== null && _b !== void 0 ? _b : '';
@@ -202,18 +202,28 @@ export interface ISubHandleSettingsCreatorDefaults extends ICreatorDefaults {
202
202
  bg_image: string;
203
203
  }
204
204
  export interface ISubHandleSettings {
205
- enabled?: BoolInt;
206
- tierPricing?: [number, number][];
207
- enablePz?: BoolInt;
208
- creatorDefaults?: ISubHandleSettingsCreatorDefaults;
209
- }
210
- export interface IVirtualSubHandleSettings extends ISubHandleSettings {
211
- expires_in_days?: number;
205
+ public_minting_enabled?: BoolInt;
206
+ tier_pricing?: [number, number][];
207
+ pz_enabled?: BoolInt;
208
+ creator_defaults?: ISubHandleSettingsCreatorDefaults;
209
+ /**
210
+ * Used for virtual SubHandles. The slot which the virtual SubHandle expires
211
+ *
212
+ * 0 = never expires
213
+ */
214
+ expires_slot?: number;
215
+ }
216
+ export interface ISubHandleAdminSettings {
217
+ valid_contracts: HexString[];
218
+ admin_creds: HexString[];
219
+ base_price: number;
220
+ buy_down_prices: [number, number][];
212
221
  }
213
222
  export interface ISubHandleSettingsDatum {
214
223
  nft?: ISubHandleSettings;
215
- virtual?: IVirtualSubHandleSettings;
224
+ virtual?: ISubHandleSettings;
216
225
  buy_down_paid?: number;
226
+ buy_down_price?: number;
217
227
  }
218
228
  export interface IHandleFileContent {
219
229
  slot: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koralabs/kora-labs-common",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "description": "Kora Labs Common Utilities",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -42,8 +42,5 @@
42
42
  "boolean": "^3.2.0",
43
43
  "cbor": "^9.0.2",
44
44
  "pluralize": "^8.0.0"
45
- },
46
- "files": [
47
- "*"
48
- ]
45
+ }
49
46
  }
@@ -24,11 +24,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.getChallengeFromVerifier = exports.base64urlencode = exports.sha256 = exports.getRandomCodeVerifier = exports.dec2hex = exports.getNativeCrypto = void 0;
27
- const __1 = require("..");
27
+ const constants_1 = require("../../constants");
28
28
  // var verifier = await getRandomCodeVerifier(64);
29
29
  // var challenge = await getChallengeFromVerifier(verifier);
30
30
  const getNativeCrypto = async () => {
31
- if (__1.isServer) {
31
+ if (constants_1.IS_SERVER) {
32
32
  return await Promise.resolve().then(() => __importStar(require('crypto')));
33
33
  }
34
34
  return window.crypto;
package/utils/index.d.ts CHANGED
@@ -8,5 +8,4 @@ export declare const isNumeric: (n: string) => boolean;
8
8
  export declare const isNullEmptyOrUndefined: (value: any) => boolean;
9
9
  export declare const isAlphaNumeric: (str: string) => boolean;
10
10
  export { DefaultTextFormat as KeyType, encodeJsonToDatum, decodeCborToJson } from './cbor';
11
- export declare const isServer: boolean;
12
11
  export * from './crypto';
package/utils/index.js CHANGED
@@ -14,7 +14,7 @@ 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
- exports.isServer = exports.decodeCborToJson = exports.encodeJsonToDatum = exports.KeyType = exports.isAlphaNumeric = exports.isNullEmptyOrUndefined = exports.isNumeric = exports.asyncForEach = exports.awaitForEach = exports.chunk = exports.toADA = exports.toLovelace = exports.delay = void 0;
17
+ exports.decodeCborToJson = exports.encodeJsonToDatum = exports.KeyType = exports.isAlphaNumeric = exports.isNullEmptyOrUndefined = exports.isNumeric = exports.asyncForEach = exports.awaitForEach = exports.chunk = exports.toADA = exports.toLovelace = exports.delay = void 0;
18
18
  const delay = (ms) => {
19
19
  return new Promise((resolve) => setTimeout(resolve, ms));
20
20
  };
@@ -68,5 +68,4 @@ var cbor_1 = require("./cbor");
68
68
  Object.defineProperty(exports, "KeyType", { enumerable: true, get: function () { return cbor_1.DefaultTextFormat; } });
69
69
  Object.defineProperty(exports, "encodeJsonToDatum", { enumerable: true, get: function () { return cbor_1.encodeJsonToDatum; } });
70
70
  Object.defineProperty(exports, "decodeCborToJson", { enumerable: true, get: function () { return cbor_1.decodeCborToJson; } });
71
- exports.isServer = (typeof process !== 'undefined') && (typeof process.versions.node !== 'undefined');
72
71
  __exportStar(require("./crypto"), exports);