@koralabs/kora-labs-common 5.1.0 → 5.1.2
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/interfaces/api.d.ts +3 -4
- package/handles/utils.js +26 -1
- package/package.json +1 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { HandleType, IHandleMetadata, IPersonalization, IPersonalizedHandle, IPzDatumConvertedUsingSchema, IReferenceToken, ISubHandleSettings, IUTxO } from '.';
|
|
2
|
-
import { HexString } from '../..';
|
|
3
2
|
export interface SubHandleSettings {
|
|
4
3
|
settings: ISubHandleSettings;
|
|
5
4
|
utxo: IUTxO;
|
|
@@ -7,7 +6,7 @@ export interface SubHandleSettings {
|
|
|
7
6
|
export interface StoredHandle extends IPersonalizedHandle {
|
|
8
7
|
amount: number;
|
|
9
8
|
default?: boolean;
|
|
10
|
-
id_hash?:
|
|
9
|
+
id_hash?: string;
|
|
11
10
|
pz_enabled?: boolean;
|
|
12
11
|
resolved_addresses: {
|
|
13
12
|
ada: string;
|
|
@@ -32,7 +31,7 @@ export interface StoredHandle extends IPersonalizedHandle {
|
|
|
32
31
|
export interface IDrep {
|
|
33
32
|
type: 'drep' | 'cc_hot' | 'cc_cold';
|
|
34
33
|
cred: 'key' | 'script';
|
|
35
|
-
hex:
|
|
34
|
+
hex: string;
|
|
36
35
|
cip_105: string;
|
|
37
36
|
cip_129: string;
|
|
38
37
|
}
|
|
@@ -89,7 +88,7 @@ export interface SaveMintingTxInput {
|
|
|
89
88
|
public_mint: boolean;
|
|
90
89
|
};
|
|
91
90
|
original_address?: string;
|
|
92
|
-
id_hash?:
|
|
91
|
+
id_hash?: string;
|
|
93
92
|
pz_enabled?: boolean;
|
|
94
93
|
last_edited_time?: number;
|
|
95
94
|
}
|
package/handles/utils.js
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.buildDrep = exports.checkHandlePattern = exports.buildMetadata = exports.buildNumericModifiers = exports.buildCharacters = exports.getRarity = void 0;
|
|
27
|
+
const crypto = __importStar(require("crypto"));
|
|
4
28
|
const utils_1 = require("../utils");
|
|
5
29
|
const constants_1 = require("./constants");
|
|
6
30
|
const interfaces_1 = require("./interfaces");
|
|
@@ -101,7 +125,8 @@ const buildDrep = (address, id_hash) => {
|
|
|
101
125
|
if (!id_hash)
|
|
102
126
|
return undefined;
|
|
103
127
|
const decoded = (_a = (0, utils_1.decodeAddress)(address)) === null || _a === void 0 ? void 0 : _a.slice(1);
|
|
104
|
-
|
|
128
|
+
const hashed = crypto.createHash('md5').update(Buffer.from(decoded, 'hex')).digest('hex');
|
|
129
|
+
if (!id_hash.startsWith(hashed))
|
|
105
130
|
return undefined;
|
|
106
131
|
const typeByte = id_hash.slice(16, 1);
|
|
107
132
|
const typeByteDec = parseInt(typeByte, 16);
|