@koralabs/kora-labs-common 1.1.2 → 1.2.0

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,246 @@
1
+ export declare enum Rarity {
2
+ basic = "basic",
3
+ common = "common",
4
+ rare = "rare",
5
+ ultra_rare = "ultra_rare",
6
+ legendary = "legendary"
7
+ }
8
+ export type BoolInt = 0 | 1;
9
+ export type HexString = `0x${string}`;
10
+ export type HexStringOrEmpty = HexString | '';
11
+ /**
12
+ * The asset label is a string that is used to identify the asset type.
13
+ * First, remove the first and last 0.
14
+ * Next, use the first 4 characters as the hex and convert to decimal. https://www.rapidtables.com/convert/number/hex-to-decimal.html
15
+ * Finally, use the decimal number and convert to CRC8. It should match the last 2 characters. https://crccalc.com/
16
+ */
17
+ export declare enum AssetNameLabel {
18
+ LABEL_100 = "000643b0",
19
+ LABEL_222 = "000de140",
20
+ LABEL_333 = "0014df10",
21
+ LABEL_444 = "001bc280"
22
+ }
23
+ export interface KeyPair {
24
+ key: string;
25
+ value: any;
26
+ }
27
+ export interface SocialItem {
28
+ display: string;
29
+ url: string;
30
+ }
31
+ interface ISharedPzDesigner {
32
+ pfp_border_color?: HexStringOrEmpty;
33
+ qr_inner_eye?: string;
34
+ qr_outer_eye?: string;
35
+ qr_dot?: string;
36
+ qr_bg_color?: HexStringOrEmpty;
37
+ qr_image?: string;
38
+ pfp_zoom?: number;
39
+ pfp_offset?: number[];
40
+ font?: string;
41
+ font_color?: HexStringOrEmpty;
42
+ font_shadow_size?: number[];
43
+ text_ribbon_colors?: HexStringOrEmpty[];
44
+ text_ribbon_gradient?: string;
45
+ }
46
+ export interface IPersonalizationDesigner extends ISharedPzDesigner {
47
+ font_shadow_color?: HexStringOrEmpty;
48
+ bg_color?: HexStringOrEmpty;
49
+ bg_border_color?: HexStringOrEmpty;
50
+ qr_link?: string;
51
+ socials?: SocialItem[];
52
+ creator_defaults_enabled?: BoolInt;
53
+ }
54
+ export interface ICreatorDefaults extends ISharedPzDesigner {
55
+ bg_border_colors?: HexStringOrEmpty[];
56
+ pfp_border_colors?: HexStringOrEmpty[];
57
+ font_shadow_colors?: HexStringOrEmpty[];
58
+ require_pfp_collections?: HexStringOrEmpty[];
59
+ require_pfp_attributes?: string[];
60
+ require_pfp_displayed?: BoolInt;
61
+ price?: number;
62
+ force_creator_settings?: BoolInt;
63
+ custom_dollar_symbol?: BoolInt;
64
+ }
65
+ export interface IPersonalizationPortal {
66
+ type: string;
67
+ domain?: string | null;
68
+ custom_settings?: string[] | null;
69
+ }
70
+ export interface ScriptDetails {
71
+ handle: string;
72
+ handleHex: string;
73
+ refScriptUtxo?: string;
74
+ refScriptAddress?: string;
75
+ cbor?: string;
76
+ unoptimizedCbor?: string;
77
+ validatorHash: string;
78
+ latest?: boolean;
79
+ }
80
+ export interface IReferenceToken {
81
+ tx_id: string;
82
+ index: number;
83
+ lovelace: number;
84
+ datum: string;
85
+ address: string;
86
+ script?: ScriptDetails;
87
+ }
88
+ export interface IPersonalization {
89
+ portal?: IPersonalizationPortal;
90
+ designer?: IPersonalizationDesigner;
91
+ socials?: SocialItem[];
92
+ validated_by: string;
93
+ trial: boolean;
94
+ nsfw: boolean;
95
+ }
96
+ export interface IHandle {
97
+ hex: string;
98
+ name: string;
99
+ image: string;
100
+ image_hash: string;
101
+ standard_image: string;
102
+ standard_image_hash: string;
103
+ pfp_image?: string;
104
+ pfp_asset?: string;
105
+ bg_image?: string;
106
+ bg_asset?: string;
107
+ holder: string;
108
+ holder_type: string;
109
+ length: number;
110
+ og_number: number;
111
+ rarity: Rarity;
112
+ characters: string;
113
+ numeric_modifiers: string;
114
+ default_in_wallet: string;
115
+ resolved_addresses: {
116
+ ada: string;
117
+ eth?: string;
118
+ btc?: string;
119
+ };
120
+ created_slot_number: number;
121
+ updated_slot_number: number;
122
+ utxo: string;
123
+ has_datum: boolean;
124
+ datum?: string;
125
+ script?: {
126
+ type: string;
127
+ cbor: string;
128
+ };
129
+ svg_version: string;
130
+ version: number;
131
+ }
132
+ export interface ICip68Handle extends IHandle {
133
+ reference_token?: IReferenceToken;
134
+ }
135
+ export interface IPersonalizedHandle extends ICip68Handle {
136
+ personalization?: IPersonalization;
137
+ }
138
+ export interface IHandleStats {
139
+ percentage_complete: string;
140
+ current_memory_used: number;
141
+ ogmios_elapsed: string;
142
+ building_elapsed: string;
143
+ handle_count: number;
144
+ slot_date: Date;
145
+ memory_size: number;
146
+ current_slot: number;
147
+ current_block_hash: string;
148
+ schema_version: number;
149
+ }
150
+ export interface IHandleMetadata {
151
+ name: string;
152
+ image: string;
153
+ mediaType: string;
154
+ og: BoolInt;
155
+ og_number: number;
156
+ rarity: string;
157
+ length: number;
158
+ characters: string;
159
+ numeric_modifiers: string;
160
+ version: number;
161
+ }
162
+ export interface IPzDatum {
163
+ standard_image: string;
164
+ image_hash: HexStringOrEmpty;
165
+ standard_image_hash: HexStringOrEmpty;
166
+ bg_image?: string;
167
+ pfp_image?: string;
168
+ pfp_asset?: HexStringOrEmpty;
169
+ bg_asset?: HexStringOrEmpty;
170
+ portal: string;
171
+ designer: string;
172
+ socials: string;
173
+ vendor: string;
174
+ default: BoolInt;
175
+ last_update_address: HexStringOrEmpty;
176
+ validated_by: HexStringOrEmpty;
177
+ trial: BoolInt;
178
+ nsfw: BoolInt;
179
+ svg_version: string;
180
+ agreed_terms: string;
181
+ migrate_sig_required: BoolInt;
182
+ }
183
+ export interface IHandleFileContent {
184
+ slot: number;
185
+ hash: string;
186
+ schemaVersion?: number;
187
+ handles: Record<string, IPersonalizedHandle>;
188
+ }
189
+ export interface IHandleSvgOptions extends IPersonalizationDesigner {
190
+ pfp_image?: string;
191
+ pfp_asset?: string;
192
+ bg_image?: string;
193
+ bg_asset?: string;
194
+ og_number?: number;
195
+ }
196
+ export interface PzSettings {
197
+ treasury_fee: number;
198
+ treasury_cred: HexStringOrEmpty;
199
+ pz_min_fee: number;
200
+ pz_providers: {
201
+ [pubKeyHashBytes: HexString]: HexStringOrEmpty;
202
+ };
203
+ valid_contracts: HexStringOrEmpty[];
204
+ admin_creds: HexStringOrEmpty[];
205
+ settings_cred: HexStringOrEmpty;
206
+ }
207
+ export interface ApprovedPolicies {
208
+ [policyId: HexString]: {
209
+ [patternMatch: HexString]: [number, number, number?];
210
+ };
211
+ }
212
+ export declare enum OAuthSocial {
213
+ 'twitter' = 0,
214
+ 'facebook' = 1,
215
+ 'discord' = 2,
216
+ 'instagram' = 3,
217
+ 'tiktok' = 4,
218
+ 'youtube' = 5,
219
+ 'twitch' = 6,
220
+ 'linkedin' = 7,
221
+ 'snapchat' = 8,
222
+ 'telegram' = 9,
223
+ 'whatsapp' = 10,
224
+ 'medium' = 11,
225
+ 'github' = 12,
226
+ 'reddit' = 13,
227
+ 'pinterest' = 14,
228
+ 'pin' = 15,
229
+ 'spotify' = 16,
230
+ 'soundcloud' = 17,
231
+ 'paypal' = 18
232
+ }
233
+ export interface OAuthTokenMessage {
234
+ error?: string;
235
+ username?: string;
236
+ token?: string;
237
+ identifier?: string;
238
+ social: OAuthSocial;
239
+ }
240
+ export interface OAuthToken {
241
+ identifier: string;
242
+ username: string;
243
+ token: string;
244
+ social: OAuthSocial;
245
+ }
246
+ export {};
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OAuthSocial = exports.AssetNameLabel = exports.Rarity = void 0;
4
+ var Rarity;
5
+ (function (Rarity) {
6
+ Rarity["basic"] = "basic";
7
+ Rarity["common"] = "common";
8
+ Rarity["rare"] = "rare";
9
+ Rarity["ultra_rare"] = "ultra_rare";
10
+ Rarity["legendary"] = "legendary"; // - 1 character
11
+ })(Rarity = exports.Rarity || (exports.Rarity = {}));
12
+ /**
13
+ * The asset label is a string that is used to identify the asset type.
14
+ * First, remove the first and last 0.
15
+ * Next, use the first 4 characters as the hex and convert to decimal. https://www.rapidtables.com/convert/number/hex-to-decimal.html
16
+ * Finally, use the decimal number and convert to CRC8. It should match the last 2 characters. https://crccalc.com/
17
+ */
18
+ var AssetNameLabel;
19
+ (function (AssetNameLabel) {
20
+ AssetNameLabel["LABEL_100"] = "000643b0";
21
+ AssetNameLabel["LABEL_222"] = "000de140";
22
+ AssetNameLabel["LABEL_333"] = "0014df10";
23
+ AssetNameLabel["LABEL_444"] = "001bc280"; // 444
24
+ })(AssetNameLabel = exports.AssetNameLabel || (exports.AssetNameLabel = {}));
25
+ var OAuthSocial;
26
+ (function (OAuthSocial) {
27
+ OAuthSocial[OAuthSocial["twitter"] = 0] = "twitter";
28
+ OAuthSocial[OAuthSocial["facebook"] = 1] = "facebook";
29
+ OAuthSocial[OAuthSocial["discord"] = 2] = "discord";
30
+ OAuthSocial[OAuthSocial["instagram"] = 3] = "instagram";
31
+ OAuthSocial[OAuthSocial["tiktok"] = 4] = "tiktok";
32
+ OAuthSocial[OAuthSocial["youtube"] = 5] = "youtube";
33
+ OAuthSocial[OAuthSocial["twitch"] = 6] = "twitch";
34
+ OAuthSocial[OAuthSocial["linkedin"] = 7] = "linkedin";
35
+ OAuthSocial[OAuthSocial["snapchat"] = 8] = "snapchat";
36
+ OAuthSocial[OAuthSocial["telegram"] = 9] = "telegram";
37
+ OAuthSocial[OAuthSocial["whatsapp"] = 10] = "whatsapp";
38
+ OAuthSocial[OAuthSocial["medium"] = 11] = "medium";
39
+ OAuthSocial[OAuthSocial["github"] = 12] = "github";
40
+ OAuthSocial[OAuthSocial["reddit"] = 13] = "reddit";
41
+ OAuthSocial[OAuthSocial["pinterest"] = 14] = "pinterest";
42
+ OAuthSocial[OAuthSocial["pin"] = 15] = "pin";
43
+ OAuthSocial[OAuthSocial["spotify"] = 16] = "spotify";
44
+ OAuthSocial[OAuthSocial["soundcloud"] = 17] = "soundcloud";
45
+ OAuthSocial[OAuthSocial["paypal"] = 18] = "paypal";
46
+ })(OAuthSocial = exports.OAuthSocial || (exports.OAuthSocial = {}));
package/lib/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { Logger, LogCategory } from "./logger";
2
2
  export { Environment, ComputeEnvironment } from "./environment";
3
+ export * from "./handles/interfaces";
3
4
  export * from "./handles/constants";
4
5
  export { checkHandlePattern } from "./handles/validation";
package/lib/index.js CHANGED
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "LogCategory", { enumerable: true, get: function
21
21
  var environment_1 = require("./environment");
22
22
  Object.defineProperty(exports, "Environment", { enumerable: true, get: function () { return environment_1.Environment; } });
23
23
  Object.defineProperty(exports, "ComputeEnvironment", { enumerable: true, get: function () { return environment_1.ComputeEnvironment; } });
24
+ __exportStar(require("./handles/interfaces"), exports);
24
25
  __exportStar(require("./handles/constants"), exports);
25
26
  var validation_1 = require("./handles/validation");
26
27
  Object.defineProperty(exports, "checkHandlePattern", { enumerable: true, get: function () { return validation_1.checkHandlePattern; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koralabs/kora-labs-common",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "Kora Labs Common Utilities",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",