@koralabs/kora-labs-common 2.6.2 → 2.6.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.
Files changed (47) hide show
  1. package/package.json +9 -4
  2. package/lib/environment/index.d.ts +0 -23
  3. package/lib/environment/index.js +0 -118
  4. package/lib/handles/buildMetadata.d.ts +0 -6
  5. package/lib/handles/buildMetadata.js +0 -58
  6. package/lib/handles/buildMetadata.test.d.ts +0 -1
  7. package/lib/handles/buildMetadata.test.js +0 -75
  8. package/lib/handles/constants.d.ts +0 -11
  9. package/lib/handles/constants.js +0 -14
  10. package/lib/handles/interfaces.d.ts +0 -308
  11. package/lib/handles/interfaces.js +0 -62
  12. package/lib/handles/utils.d.ts +0 -2
  13. package/lib/handles/utils.js +0 -21
  14. package/lib/handles/validation.d.ts +0 -4
  15. package/lib/handles/validation.js +0 -24
  16. package/lib/handles/validation.test.d.ts +0 -1
  17. package/lib/handles/validation.test.js +0 -16
  18. package/lib/index.d.ts +0 -9
  19. package/lib/index.js +0 -33
  20. package/lib/logger/index.d.ts +0 -30
  21. package/lib/logger/index.js +0 -75
  22. package/lib/logger/index.test.d.ts +0 -1
  23. package/lib/logger/index.test.js +0 -30
  24. package/lib/protectedWords/index.d.ts +0 -33
  25. package/lib/protectedWords/index.js +0 -352
  26. package/lib/protectedWords/index.test.d.ts +0 -1
  27. package/lib/protectedWords/index.test.js +0 -315
  28. package/lib/protectedWords/protectedWords.d.ts +0 -2
  29. package/lib/protectedWords/protectedWords.js +0 -7936
  30. package/lib/utils/cbor/index.d.ts +0 -26
  31. package/lib/utils/cbor/index.js +0 -326
  32. package/lib/utils/cbor/index.test.d.ts +0 -1
  33. package/lib/utils/cbor/index.test.js +0 -523
  34. package/lib/utils/cbor/schema/designer.d.ts +0 -18
  35. package/lib/utils/cbor/schema/designer.js +0 -21
  36. package/lib/utils/cbor/schema/handleData.d.ts +0 -30
  37. package/lib/utils/cbor/schema/handleData.js +0 -33
  38. package/lib/utils/cbor/schema/portal.d.ts +0 -8
  39. package/lib/utils/cbor/schema/portal.js +0 -11
  40. package/lib/utils/cbor/schema/socials.d.ts +0 -6
  41. package/lib/utils/cbor/schema/socials.js +0 -9
  42. package/lib/utils/cbor/schema/subHandleSettings.d.ts +0 -43
  43. package/lib/utils/cbor/schema/subHandleSettings.js +0 -30
  44. package/lib/utils/crypto/index.d.ts +0 -159
  45. package/lib/utils/crypto/index.js +0 -74
  46. package/lib/utils/index.d.ts +0 -11
  47. package/lib/utils/index.js +0 -57
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@koralabs/kora-labs-common",
3
- "version": "2.6.2",
3
+ "version": "2.6.3",
4
4
  "description": "Kora Labs Common Utilities",
5
- "main": "lib/index.js",
6
- "types": "lib/index.d.ts",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
7
  "homepage": "https://github.com/koralabs/kora-labs-common",
8
8
  "repository": {
9
9
  "type": "git",
@@ -12,16 +12,21 @@
12
12
  "contributors": [
13
13
  {
14
14
  "name": "BigIrishLion"
15
+ },
16
+ {
17
+ "name": "papag00se"
15
18
  }
16
19
  ],
17
20
  "scripts": {
18
21
  "test": "node --experimental-vm-modules node_modules/.bin/jest",
19
22
  "build": "tsc",
20
- "npm:publish": "yarn build && yarn publish"
23
+ "npm:publish": "yarn build && cp package.json ./lib/package.json && (cd ./lib && npm publish)"
21
24
  },
22
25
  "author": "",
23
26
  "license": "ISC",
24
27
  "devDependencies": {
28
+ "@aws-sdk/client-dynamodb": "^3.549.0",
29
+ "@aws-sdk/lib-dynamodb": "^3.549.0",
25
30
  "@types/jest": "^28.1.1",
26
31
  "@types/node": "^18.11.17",
27
32
  "@types/pluralize": "^0.0.29",
@@ -1,23 +0,0 @@
1
- import { CardanoNetwork } from "../logger";
2
- export declare enum ComputeEnvironment {
3
- AWS_LAMBDA = "aws_lambda",
4
- AWS_FARGATE = "aws_fargate",
5
- AWS_EC2 = "aws_ec2",
6
- AWS_OTHER = "aws_other",
7
- OTHER = "other"
8
- }
9
- export declare class Environment {
10
- static getComputeEnvironment(): Promise<ComputeEnvironment>;
11
- static getCardanoNetwork(): CardanoNetwork;
12
- static getIpAddress(): Promise<{
13
- private: string | null;
14
- public: string | null;
15
- } | null>;
16
- static getEc2InstanceName(): Promise<string | null>;
17
- static getEcsTaskMetaData(): Promise<{
18
- Networks: [{
19
- IPv4Addresses: [string];
20
- }];
21
- } | null>;
22
- static getPotentialApplicationName(): Promise<string | null>;
23
- }
@@ -1,118 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Environment = exports.ComputeEnvironment = void 0;
4
- const logger_1 = require("../logger");
5
- var ComputeEnvironment;
6
- (function (ComputeEnvironment) {
7
- ComputeEnvironment["AWS_LAMBDA"] = "aws_lambda";
8
- ComputeEnvironment["AWS_FARGATE"] = "aws_fargate";
9
- ComputeEnvironment["AWS_EC2"] = "aws_ec2";
10
- ComputeEnvironment["AWS_OTHER"] = "aws_other";
11
- ComputeEnvironment["OTHER"] = "other";
12
- })(ComputeEnvironment = exports.ComputeEnvironment || (exports.ComputeEnvironment = {}));
13
- class Environment {
14
- static async getComputeEnvironment() {
15
- if (process.env.AWS_LAMBDA_FUNCTION_NAME || process.env.AWS_EXECUTION_ENV) {
16
- return ComputeEnvironment.AWS_LAMBDA;
17
- }
18
- if (process.env.ECS_CLUSTER) {
19
- return ComputeEnvironment.AWS_FARGATE;
20
- }
21
- if (await Environment.getEc2InstanceName()) {
22
- return ComputeEnvironment.AWS_EC2;
23
- }
24
- if (process.env.AWS_DEFAULT_REGION || process.env.AWS_REGION) {
25
- return ComputeEnvironment.AWS_OTHER;
26
- }
27
- return ComputeEnvironment.OTHER;
28
- }
29
- static getCardanoNetwork() {
30
- try {
31
- if (process.env.NETWORK) {
32
- return logger_1.CardanoNetwork[process.env.NETWORK.toUpperCase()];
33
- }
34
- else {
35
- return logger_1.CardanoNetwork.UNSET;
36
- }
37
- }
38
- catch (_a) {
39
- return logger_1.CardanoNetwork.UNSET;
40
- }
41
- }
42
- static async getIpAddress() {
43
- var _a, _b;
44
- let prv;
45
- let pub;
46
- if (await Environment.getComputeEnvironment() == ComputeEnvironment.AWS_EC2) {
47
- try {
48
- const response = await fetch('http://169.254.169.254/latest/meta-data/local-ipv4');
49
- prv = await response.text();
50
- }
51
- catch (_c) {
52
- }
53
- try {
54
- const response = await fetch('http://169.254.169.254/latest/meta-data/public-ipv4');
55
- pub = await response.text();
56
- }
57
- catch (_d) {
58
- }
59
- if (prv || pub) {
60
- return { private: prv !== null && prv !== void 0 ? prv : null, public: pub !== null && pub !== void 0 ? pub : null };
61
- }
62
- }
63
- if (await Environment.getComputeEnvironment() == ComputeEnvironment.AWS_EC2) {
64
- const metadata = await Environment.getEcsTaskMetaData();
65
- return { private: (_b = (_a = metadata === null || metadata === void 0 ? void 0 : metadata.Networks[0]) === null || _a === void 0 ? void 0 : _a.IPv4Addresses[0]) !== null && _b !== void 0 ? _b : null, public: null };
66
- }
67
- return null;
68
- }
69
- static async getEc2InstanceName() {
70
- try {
71
- const response = await fetch('http://169.254.169.254/latest/meta-data/tags/instance/Name');
72
- return response.text();
73
- }
74
- catch (err) {
75
- }
76
- try {
77
- const response = await fetch('http://169.254.169.254/latest/meta-data/instance-id');
78
- return response.text();
79
- }
80
- catch (err) {
81
- }
82
- return null;
83
- }
84
- static async getEcsTaskMetaData() {
85
- try {
86
- const response = await fetch('http://169.254.170.2/v2/metadata');
87
- return await response.json();
88
- }
89
- catch (err) {
90
- return null;
91
- }
92
- }
93
- static async getPotentialApplicationName() {
94
- var _a, _b;
95
- if (process.env.APPLICATION_NAME) {
96
- return process.env.APPLICATION_NAME;
97
- }
98
- if (await Environment.getComputeEnvironment() == ComputeEnvironment.AWS_LAMBDA) {
99
- return (_a = process.env.AWS_LAMBDA_FUNCTION_NAME) !== null && _a !== void 0 ? _a : null;
100
- }
101
- if (await Environment.getComputeEnvironment() == ComputeEnvironment.AWS_FARGATE) {
102
- return (_b = process.env.ECS_CLUSTER) !== null && _b !== void 0 ? _b : null;
103
- }
104
- if (await Environment.getComputeEnvironment() == ComputeEnvironment.AWS_EC2) {
105
- const ec2_name = await Environment.getEc2InstanceName();
106
- if (ec2_name) {
107
- return ec2_name;
108
- }
109
- }
110
- try {
111
- return process.cwd();
112
- }
113
- catch (_c) {
114
- return null;
115
- }
116
- }
117
- }
118
- exports.Environment = Environment;
@@ -1,6 +0,0 @@
1
- import { IHandleMetadata } from './interfaces';
2
- export declare const buildMetadata: ({ handleName, cid, ogNumber }: {
3
- handleName: string;
4
- cid: string;
5
- ogNumber?: number | undefined;
6
- }) => IHandleMetadata;
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildMetadata = void 0;
4
- const interfaces_1 = require("./interfaces");
5
- const utils_1 = require("./utils");
6
- const buildCharacters = (name) => {
7
- const characters = [];
8
- if (/[a-z]+/.test(name)) {
9
- characters.push('letters');
10
- }
11
- if (/[0-9]+/.test(name)) {
12
- characters.push('numbers');
13
- }
14
- if (/[_\-.]+/.test(name)) {
15
- characters.push('special');
16
- }
17
- return characters.join(',');
18
- };
19
- const buildNumericModifiers = (name) => {
20
- const modifiers = [];
21
- if (/^-?[0-9]\d*(\.\d+)?$/.test(name)) {
22
- if (name.startsWith('-')) {
23
- modifiers.push('negative');
24
- }
25
- if (name.includes('.')) {
26
- modifiers.push('decimal');
27
- }
28
- }
29
- return modifiers.join(',');
30
- };
31
- const buildMetadata = ({ handleName, cid, ogNumber }) => {
32
- const isSubHandle = handleName.includes('@');
33
- const [subHandleName, rootHandleName] = handleName.split('@');
34
- let metadata = {
35
- name: `$${handleName}`,
36
- image: `ipfs://${cid}`,
37
- mediaType: 'image/jpeg',
38
- og: isSubHandle ? 0 : ogNumber ? 1 : 0,
39
- og_number: isSubHandle ? 0 : ogNumber !== null && ogNumber !== void 0 ? ogNumber : 0,
40
- rarity: (0, utils_1.getRarity)(rootHandleName !== null && rootHandleName !== void 0 ? rootHandleName : handleName),
41
- length: handleName.length,
42
- characters: buildCharacters(rootHandleName !== null && rootHandleName !== void 0 ? rootHandleName : handleName),
43
- numeric_modifiers: buildNumericModifiers(rootHandleName !== null && rootHandleName !== void 0 ? rootHandleName : handleName),
44
- handle_type: isSubHandle ? interfaces_1.HandleType.NFT_SUBHANDLE : interfaces_1.HandleType.HANDLE,
45
- version: 1
46
- };
47
- if (isSubHandle) {
48
- metadata = {
49
- ...metadata,
50
- sub_rarity: (0, utils_1.getRarity)(subHandleName),
51
- sub_length: subHandleName.length,
52
- sub_characters: buildCharacters(subHandleName),
53
- sub_numeric_modifiers: buildNumericModifiers(subHandleName)
54
- };
55
- }
56
- return metadata;
57
- };
58
- exports.buildMetadata = buildMetadata;
@@ -1 +0,0 @@
1
- export {};
@@ -1,75 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const buildMetadata_1 = require("./buildMetadata");
4
- const interfaces_1 = require("./interfaces");
5
- describe('buildMetadata', () => {
6
- it('should build metadata', () => {
7
- const input = {
8
- handleName: 'test',
9
- cid: 'cid123',
10
- ogNumber: 1
11
- };
12
- const metadata = (0, buildMetadata_1.buildMetadata)(input);
13
- expect(metadata).toEqual({
14
- characters: 'letters',
15
- handle_type: interfaces_1.HandleType.HANDLE,
16
- image: `ipfs://${input.cid}`,
17
- length: 4,
18
- mediaType: 'image/jpeg',
19
- name: '$' + input.handleName,
20
- numeric_modifiers: '',
21
- og: input.ogNumber ? 1 : 0,
22
- og_number: input.ogNumber,
23
- rarity: 'common',
24
- version: 1
25
- });
26
- });
27
- it('should build metadata for nft sub handle', () => {
28
- const input = {
29
- handleName: 'sub@handle',
30
- cid: 'cid111'
31
- };
32
- const metadata = (0, buildMetadata_1.buildMetadata)(input);
33
- expect(metadata).toEqual({
34
- characters: 'letters',
35
- handle_type: interfaces_1.HandleType.NFT_SUBHANDLE,
36
- image: `ipfs://${input.cid}`,
37
- length: 10,
38
- mediaType: 'image/jpeg',
39
- name: '$' + input.handleName,
40
- numeric_modifiers: '',
41
- og: 0,
42
- og_number: 0,
43
- rarity: 'common',
44
- version: 1,
45
- sub_characters: 'letters',
46
- sub_length: 3,
47
- sub_numeric_modifiers: '',
48
- sub_rarity: interfaces_1.Rarity.rare
49
- });
50
- });
51
- it('should build metadata for nft sub handle with numbers', () => {
52
- const input = {
53
- handleName: '...@-123',
54
- cid: 'cid222'
55
- };
56
- const metadata = (0, buildMetadata_1.buildMetadata)(input);
57
- expect(metadata).toEqual({
58
- characters: 'numbers,special',
59
- handle_type: interfaces_1.HandleType.NFT_SUBHANDLE,
60
- image: `ipfs://${input.cid}`,
61
- length: 8,
62
- mediaType: 'image/jpeg',
63
- name: '$' + input.handleName,
64
- numeric_modifiers: 'negative',
65
- og: 0,
66
- og_number: 0,
67
- rarity: 'common',
68
- version: 1,
69
- sub_characters: 'special',
70
- sub_length: 3,
71
- sub_numeric_modifiers: '',
72
- sub_rarity: interfaces_1.Rarity.rare
73
- });
74
- });
75
- });
@@ -1,11 +0,0 @@
1
- export declare const RESPONSE_AVAILABLE = "Yay! This handle is available.";
2
- export declare const RESPONSE_UNAVAILABLE_PAID = "Sorry! This Handle is pending mint or already minted.";
3
- export declare const RESPONSE_UNAVAILABLE_ACTIVE_SESSION = "Pending purchase. Try a different variation.";
4
- export declare const RESPONSE_UNAVAILABLE_RESERVED = "This Handle has a private reservation. Private reservations will be contacted separately.";
5
- export declare const RESPONSE_UNAVAILABLE_LEGENDARY = "Legendary handles are not available to mint.";
6
- export declare const RESPONSE_INVALID_HANDLE_FORMAT = "Invalid handle. Only a-z, 0-9, dash (-), underscore (_), and period (.) are allowed.";
7
- export declare const RESPONSE_NOT_ALLOWED = "Sorry, that handle is not allowed.";
8
- export declare const REGEX_SPLIT_ON_CHARS: RegExp;
9
- export declare const REGEX_SPLIT_ON_NUMS: RegExp;
10
- export declare const REGEX_HANDLE: RegExp;
11
- export declare const REGEX_SUB_HANDLE: RegExp;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- 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.RESPONSE_AVAILABLE = 'Yay! This handle is available.';
5
- exports.RESPONSE_UNAVAILABLE_PAID = 'Sorry! This Handle is pending mint or already minted.';
6
- exports.RESPONSE_UNAVAILABLE_ACTIVE_SESSION = 'Pending purchase. Try a different variation.';
7
- exports.RESPONSE_UNAVAILABLE_RESERVED = 'This Handle has a private reservation. Private reservations will be contacted separately.';
8
- exports.RESPONSE_UNAVAILABLE_LEGENDARY = 'Legendary handles are not available to mint.';
9
- exports.RESPONSE_INVALID_HANDLE_FORMAT = 'Invalid handle. Only a-z, 0-9, dash (-), underscore (_), and period (.) are allowed.';
10
- exports.RESPONSE_NOT_ALLOWED = 'Sorry, that handle is not allowed.';
11
- exports.REGEX_SPLIT_ON_CHARS = /([0-9a-z]+)[@_.-]*/g;
12
- exports.REGEX_SPLIT_ON_NUMS = /([a-z]+)[0-9]*/g;
13
- exports.REGEX_HANDLE = new RegExp(/^[a-zA-Z0-9_.-]{1,15}$/);
14
- exports.REGEX_SUB_HANDLE = new RegExp(/(?:^[a-z0-9_.-]{1,15}$)|(?:^(?!.{29})[a-z0-9_.-]+@[a-z0-9_.-]{1,15}$)/g);
@@ -1,308 +0,0 @@
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_000 = "00000000",
19
- LABEL_001 = "00001070",
20
- LABEL_100 = "000643b0",
21
- LABEL_222 = "000de140",
22
- LABEL_333 = "0014df10",
23
- LABEL_444 = "001bc280"
24
- }
25
- export interface KeyPair {
26
- key: string;
27
- value: any;
28
- }
29
- export interface SocialItem {
30
- display: string;
31
- url: string;
32
- }
33
- interface ISharedPzDesigner {
34
- pfp_border_color?: HexStringOrEmpty;
35
- qr_inner_eye?: string;
36
- qr_outer_eye?: string;
37
- qr_dot?: string;
38
- qr_bg_color?: HexStringOrEmpty;
39
- qr_image?: string;
40
- pfp_zoom?: number;
41
- pfp_offset?: number[];
42
- font?: string;
43
- font_color?: HexStringOrEmpty;
44
- font_shadow_size?: number[];
45
- text_ribbon_colors?: HexStringOrEmpty[];
46
- text_ribbon_gradient?: string;
47
- socials_color?: HexStringOrEmpty;
48
- circuit_color?: HexStringOrEmpty;
49
- }
50
- export interface IPersonalizationDesigner extends ISharedPzDesigner {
51
- font_shadow_color?: HexStringOrEmpty;
52
- bg_color?: HexStringOrEmpty;
53
- bg_border_color?: HexStringOrEmpty;
54
- qr_link?: string;
55
- socials?: SocialItem[];
56
- creator_defaults_enabled?: BoolInt;
57
- }
58
- export interface ICreatorDefaults extends ISharedPzDesigner {
59
- bg_border_colors?: HexStringOrEmpty[];
60
- pfp_border_colors?: HexStringOrEmpty[];
61
- font_shadow_colors?: HexStringOrEmpty[];
62
- require_asset_collections?: HexStringOrEmpty[];
63
- require_asset_attributes?: string[];
64
- require_asset_displayed?: BoolInt;
65
- price?: number;
66
- force_creator_settings?: BoolInt;
67
- custom_dollar_symbol?: BoolInt;
68
- circuit_colors?: HexStringOrEmpty[];
69
- }
70
- export interface IPersonalizationPortal {
71
- type: string;
72
- domain?: string | null;
73
- custom_settings?: string[] | null;
74
- }
75
- export interface ScriptDetails {
76
- handle: string;
77
- handleHex: string;
78
- refScriptUtxo?: string;
79
- refScriptAddress?: string;
80
- cbor?: string;
81
- unoptimizedCbor?: string;
82
- validatorHash: string;
83
- latest?: boolean;
84
- }
85
- export interface IReferenceToken {
86
- tx_id: string;
87
- index: number;
88
- lovelace: number;
89
- datum: string;
90
- address: string;
91
- script?: ScriptDetails;
92
- }
93
- export interface IPersonalization {
94
- portal?: IPersonalizationPortal;
95
- designer?: IPersonalizationDesigner;
96
- socials?: SocialItem[];
97
- validated_by: string;
98
- trial: boolean;
99
- nsfw: boolean;
100
- }
101
- export interface IHandle {
102
- hex: string;
103
- name: string;
104
- image: string;
105
- image_hash: string;
106
- standard_image: string;
107
- standard_image_hash: string;
108
- pfp_image?: string;
109
- pfp_asset?: string;
110
- bg_image?: string;
111
- bg_asset?: string;
112
- holder: string;
113
- holder_type: string;
114
- length: number;
115
- og_number: number;
116
- rarity: Rarity;
117
- characters: string;
118
- numeric_modifiers: string;
119
- default_in_wallet: string;
120
- resolved_addresses: {
121
- [key: string]: string;
122
- };
123
- created_slot_number: number;
124
- updated_slot_number: number;
125
- utxo: string;
126
- has_datum: boolean;
127
- datum?: string;
128
- script?: {
129
- type: string;
130
- cbor: string;
131
- };
132
- last_update_address?: string;
133
- svg_version: string;
134
- version: number;
135
- }
136
- export interface ICip68Handle extends IHandle {
137
- reference_token?: IReferenceToken;
138
- }
139
- export interface IPersonalizedHandle extends ICip68Handle {
140
- personalization?: IPersonalization;
141
- }
142
- export interface IHandleStats {
143
- percentage_complete: string;
144
- current_memory_used: number;
145
- ogmios_elapsed: string;
146
- building_elapsed: string;
147
- handle_count: number;
148
- slot_date: Date;
149
- memory_size: number;
150
- current_slot: number;
151
- current_block_hash: string;
152
- schema_version: number;
153
- }
154
- export declare enum HandleType {
155
- VIRTUAL_SUBHANDLE = "virtual_subhandle",
156
- NFT_SUBHANDLE = "nft_subhandle",
157
- HANDLE = "handle"
158
- }
159
- export interface IHandleMetadata {
160
- name: string;
161
- image: string;
162
- mediaType: string;
163
- og: BoolInt;
164
- og_number: number;
165
- rarity: string;
166
- length: number;
167
- characters: string;
168
- numeric_modifiers: string;
169
- version: number;
170
- sub_rarity?: string;
171
- sub_length?: number;
172
- sub_characters?: string;
173
- sub_numeric_modifiers?: string;
174
- handle_type: HandleType;
175
- }
176
- export interface IPzDatum {
177
- standard_image: string;
178
- image_hash: HexStringOrEmpty;
179
- standard_image_hash: HexStringOrEmpty;
180
- bg_image?: string;
181
- pfp_image?: string;
182
- pfp_asset?: HexStringOrEmpty;
183
- bg_asset?: HexStringOrEmpty;
184
- portal?: string;
185
- designer?: string;
186
- socials?: string;
187
- vendor?: string;
188
- default: BoolInt;
189
- last_update_address: HexStringOrEmpty;
190
- validated_by: HexStringOrEmpty;
191
- trial: BoolInt;
192
- nsfw: BoolInt;
193
- svg_version: string;
194
- agreed_terms: string;
195
- migrate_sig_required: BoolInt;
196
- resolved_addresses?: {
197
- [key: string]: string;
198
- };
199
- }
200
- export interface ISubHandleSettingsCreatorDefaults extends ICreatorDefaults {
201
- bg_image: string;
202
- }
203
- export interface ISubHandleSettings {
204
- enabled?: BoolInt;
205
- tierPricing?: [number, number][];
206
- enablePz?: BoolInt;
207
- creatorDefaults?: ISubHandleSettingsCreatorDefaults;
208
- }
209
- export interface IVirtualSubHandleSettings extends ISubHandleSettings {
210
- expires_in_days?: number;
211
- }
212
- export interface ISubHandleSettingsDatum {
213
- nft?: ISubHandleSettings;
214
- virtual?: IVirtualSubHandleSettings;
215
- }
216
- export interface IHandleFileContent {
217
- slot: number;
218
- hash: string;
219
- schemaVersion?: number;
220
- handles: Record<string, IPersonalizedHandle>;
221
- }
222
- export interface IHandleSvgOptions extends IPersonalizationDesigner {
223
- pfp_image?: string;
224
- pfp_asset?: string;
225
- bg_image?: string;
226
- bg_asset?: string;
227
- og_number?: number;
228
- }
229
- export interface PzSettings {
230
- treasury_fee: number;
231
- treasury_cred: HexStringOrEmpty;
232
- pz_min_fee: number;
233
- pz_providers: {
234
- [pubKeyHashBytes: HexString]: HexStringOrEmpty;
235
- };
236
- valid_contracts: HexStringOrEmpty[];
237
- admin_creds: HexStringOrEmpty[];
238
- settings_cred: HexStringOrEmpty;
239
- }
240
- export interface ApprovedPolicies {
241
- [policyId: HexString]: {
242
- [patternMatch: HexString]: [number, number, number?];
243
- };
244
- }
245
- export declare enum OAuthSocial {
246
- 'twitter' = 0,
247
- 'facebook' = 1,
248
- 'discord' = 2,
249
- 'instagram' = 3,
250
- 'tiktok' = 4,
251
- 'youtube' = 5,
252
- 'twitch' = 6,
253
- 'linkedin' = 7,
254
- 'snapchat' = 8,
255
- 'telegram' = 9,
256
- 'whatsapp' = 10,
257
- 'medium' = 11,
258
- 'github' = 12,
259
- 'reddit' = 13,
260
- 'pinterest' = 14,
261
- 'pin' = 15,
262
- 'spotify' = 16,
263
- 'soundcloud' = 17,
264
- 'paypal' = 18
265
- }
266
- export interface OAuthToken {
267
- identifier: string;
268
- username: string;
269
- token: string;
270
- refresh_token: string;
271
- expiredAt: string;
272
- social: OAuthSocial;
273
- }
274
- export interface OAuthTokenMessage extends Partial<OAuthToken> {
275
- error?: string;
276
- }
277
- export interface ProtectedWord {
278
- word: string;
279
- algorithms: ('modifier' | 'badword' | 'suggestive' | 'hatespeech' | 'vulnerable')[];
280
- modType?: ('modifier' | 'suggestive' | 'hatespeech')[];
281
- canBePositive?: boolean;
282
- position?: 'exact' | 'any' | 'beginswith';
283
- exceptions?: string[];
284
- }
285
- export declare enum AvailabilityResponseCode {
286
- AVAILABLE = 200,
287
- ALREADY_CLAIMED = 403,
288
- NOT_AVAILABLE_FOR_LEGAL_REASONS = 451,
289
- NOT_ACCEPTABLE = 406,
290
- LOCKED = 423
291
- }
292
- export interface AvailabilityResponse {
293
- available: boolean;
294
- cost?: number | 'n/a';
295
- handle: string;
296
- message?: string;
297
- type?: 'notallowed' | 'invalid' | 'pending' | 'private';
298
- link?: string;
299
- reason?: string;
300
- duration?: number;
301
- code: AvailabilityResponseCode;
302
- ogNumber?: number;
303
- }
304
- export interface ReservedOrProtected {
305
- reserved?: string[];
306
- protected: ProtectedWord[];
307
- }
308
- export {};