@koralabs/kora-labs-common 6.0.2 → 6.1.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.
- package/constants/index.d.ts +1 -0
- package/constants/index.js +2 -1
- package/handles/interfaces/api.d.ts +1 -66
- package/handles/interfaces/handlesProvider.d.ts +8 -10
- package/handles/interfaces/index.d.ts +1 -2
- package/handles/interfaces/index.js +0 -1
- package/handles/policies.d.ts +15 -23
- package/handles/policies.js +9 -3
- package/package.json +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/utils/cbor/index.d.ts +1 -0
- package/utils/crypto/index.d.ts +8 -5
- package/utils/crypto/index.js +28 -15
- package/utils/index.d.ts +2 -1
- package/utils/index.js +5 -3
package/constants/index.d.ts
CHANGED
package/constants/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a, _b, _c;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.MINTED_OG_LIST = exports.TOU_URL = exports.AUTH_GRANT_DURATION = exports.IS_PRODUCTION = exports.NETWORK = exports.IS_SERVER = void 0;
|
|
4
|
+
exports.MINTED_OG_LIST = exports.TOU_URL = exports.AUTH_GRANT_DURATION = exports.IS_PRODUCTION = exports.NETWORK = exports.IS_LOCAL = exports.IS_SERVER = void 0;
|
|
5
5
|
const mintedOgList_1 = require("./mintedOgList");
|
|
6
6
|
exports.IS_SERVER = typeof process !== 'undefined' && typeof process.versions.node !== 'undefined';
|
|
7
|
+
exports.IS_LOCAL = exports.IS_SERVER ? process.env.IS_LOCAL === 'true' : window.location.host.includes('localhost');
|
|
7
8
|
exports.NETWORK = (_b = (_a = process.env.NETWORK) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : 'preview';
|
|
8
9
|
exports.IS_PRODUCTION = exports.IS_SERVER
|
|
9
10
|
? ((_c = process.env.NODE_ENV) === null || _c === void 0 ? void 0 : _c.trim()) === 'production' && exports.NETWORK == 'mainnet'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IPersonalizedHandle, ISubHandleSettings, IUTxO } from '.';
|
|
2
2
|
import { Sort } from '../../types';
|
|
3
3
|
export interface SubHandleSettings {
|
|
4
4
|
settings: ISubHandleSettings;
|
|
@@ -57,72 +57,7 @@ export interface IApiMetrics {
|
|
|
57
57
|
count?: number;
|
|
58
58
|
schemaVersion?: number;
|
|
59
59
|
}
|
|
60
|
-
export interface SaveMintingTxInput {
|
|
61
|
-
hex: string;
|
|
62
|
-
name: string;
|
|
63
|
-
adaAddress: string;
|
|
64
|
-
og_number: number;
|
|
65
|
-
image: string;
|
|
66
|
-
image_hash?: string;
|
|
67
|
-
slotNumber: number;
|
|
68
|
-
utxo: string;
|
|
69
|
-
lovelace: number;
|
|
70
|
-
svg_version?: string;
|
|
71
|
-
bg_image?: string;
|
|
72
|
-
pfp_image?: string;
|
|
73
|
-
datum?: string;
|
|
74
|
-
script?: {
|
|
75
|
-
type: string;
|
|
76
|
-
cbor: string;
|
|
77
|
-
};
|
|
78
|
-
last_update_address?: string;
|
|
79
|
-
personalization?: IPersonalization;
|
|
80
|
-
reference_token?: IReferenceToken;
|
|
81
|
-
resolved_addresses?: Record<string, string>;
|
|
82
|
-
amount?: number;
|
|
83
|
-
version?: number;
|
|
84
|
-
handle_type: HandleType;
|
|
85
|
-
sub_rarity?: string;
|
|
86
|
-
sub_length?: number;
|
|
87
|
-
sub_characters?: string;
|
|
88
|
-
sub_numeric_modifiers?: string;
|
|
89
|
-
virtual?: {
|
|
90
|
-
expires_time: number;
|
|
91
|
-
public_mint: boolean;
|
|
92
|
-
};
|
|
93
|
-
original_address?: string;
|
|
94
|
-
id_hash?: string;
|
|
95
|
-
pz_enabled?: boolean;
|
|
96
|
-
last_edited_time?: number;
|
|
97
|
-
}
|
|
98
|
-
export interface SaveWalletAddressMoveInput {
|
|
99
|
-
slotNumber: number;
|
|
100
|
-
name: string;
|
|
101
|
-
adaAddress: string;
|
|
102
|
-
utxo: string;
|
|
103
|
-
datum?: string;
|
|
104
|
-
script?: {
|
|
105
|
-
type: string;
|
|
106
|
-
cbor: string;
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
export interface SavePersonalizationInput {
|
|
110
|
-
slotNumber: number;
|
|
111
|
-
hex: string;
|
|
112
|
-
name: string;
|
|
113
|
-
personalization: IPersonalization;
|
|
114
|
-
reference_token: IReferenceToken;
|
|
115
|
-
personalizationDatum: IPzDatumConvertedUsingSchema | null;
|
|
116
|
-
metadata: IHandleMetadata | null;
|
|
117
|
-
}
|
|
118
|
-
export interface SaveSubHandleSettingsInput {
|
|
119
|
-
name: string;
|
|
120
|
-
settingsDatum?: string;
|
|
121
|
-
utxoDetails: IUTxO;
|
|
122
|
-
slotNumber: number;
|
|
123
|
-
}
|
|
124
60
|
export interface Holder {
|
|
125
|
-
address: string;
|
|
126
61
|
handles: Set<string>;
|
|
127
62
|
defaultHandle: string;
|
|
128
63
|
manuallySet: boolean;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { IApiMetrics, IndexNames, StoredHandle } from './api';
|
|
1
|
+
import { Holder, IApiMetrics, IndexNames, ISlotHistory, StoredHandle } from './api';
|
|
2
2
|
export interface IHandlesProvider {
|
|
3
3
|
initialize: () => Promise<IHandlesProvider>;
|
|
4
4
|
destroy: () => void;
|
|
5
5
|
rollBackToGenesis: () => void;
|
|
6
|
-
getStartingPoint: (save: (
|
|
7
|
-
handle: StoredHandle;
|
|
8
|
-
oldHandle?: StoredHandle;
|
|
9
|
-
saveHistory?: boolean;
|
|
10
|
-
}) => Promise<void>, failed: boolean) => Promise<{
|
|
6
|
+
getStartingPoint: (save: (handle: StoredHandle) => Promise<void>, failed: boolean) => Promise<{
|
|
11
7
|
slot: number;
|
|
12
8
|
id: string;
|
|
13
9
|
} | null>;
|
|
@@ -16,11 +12,13 @@ export interface IHandlesProvider {
|
|
|
16
12
|
getAllHandles: () => StoredHandle[];
|
|
17
13
|
setHandle: (key: string, value: StoredHandle) => void;
|
|
18
14
|
removeHandle: (handleName: string) => void;
|
|
19
|
-
getIndex: (index: IndexNames) =>
|
|
20
|
-
|
|
21
|
-
setValueOnIndex: (index: IndexNames, key: string | number, value:
|
|
22
|
-
removeValueFromIndex: (index: IndexNames, key: string | number, value: string) => void;
|
|
15
|
+
getIndex: (index: IndexNames) => Map<string | number, Set<string> | Holder | ISlotHistory | StoredHandle>;
|
|
16
|
+
getValueFromIndex: (index: IndexNames, key: string | number) => Set<string> | Holder | ISlotHistory | StoredHandle | undefined;
|
|
17
|
+
setValueOnIndex: (index: IndexNames, key: string | number, value: Set<string> | Holder | ISlotHistory | StoredHandle) => void;
|
|
23
18
|
removeKeyFromIndex: (index: IndexNames, key: string | number) => void;
|
|
19
|
+
getValuesFromIndexedSet: (index: IndexNames, key: string | number) => Set<string> | undefined;
|
|
20
|
+
addValueToIndexedSet: (index: IndexNames, key: string | number, value: string) => void;
|
|
21
|
+
removeValueFromIndexedSet: (index: IndexNames, key: string | number, value: string) => void;
|
|
24
22
|
getMetrics: () => IApiMetrics;
|
|
25
23
|
setMetrics: (metrics: IApiMetrics) => void;
|
|
26
24
|
count: () => number;
|
|
@@ -75,7 +75,6 @@ export declare enum ScriptType {
|
|
|
75
75
|
DEMI_MINT = "demi_mint",
|
|
76
76
|
DEMI_MINT_PROXY = "demi_mint_proxy",
|
|
77
77
|
DEMI_MINTING_DATA = "demi_minting_data",
|
|
78
|
-
DEMI_MINTING_DATA_PROXY = "demi_minting_data_proxy",
|
|
79
78
|
DEMI_ORDERS = "demi_orders"
|
|
80
79
|
}
|
|
81
80
|
export interface ScriptDetails {
|
|
@@ -145,7 +144,7 @@ export interface IHandle {
|
|
|
145
144
|
last_update_address?: string;
|
|
146
145
|
svg_version: string;
|
|
147
146
|
version: number;
|
|
148
|
-
policy
|
|
147
|
+
policy: string;
|
|
149
148
|
handle_type: HandleType;
|
|
150
149
|
virtual?: {
|
|
151
150
|
expires_time: number;
|
|
@@ -17,7 +17,6 @@ var ScriptType;
|
|
|
17
17
|
ScriptType["DEMI_MINT"] = "demi_mint";
|
|
18
18
|
ScriptType["DEMI_MINT_PROXY"] = "demi_mint_proxy";
|
|
19
19
|
ScriptType["DEMI_MINTING_DATA"] = "demi_minting_data";
|
|
20
|
-
ScriptType["DEMI_MINTING_DATA_PROXY"] = "demi_minting_data_proxy";
|
|
21
20
|
ScriptType["DEMI_ORDERS"] = "demi_orders";
|
|
22
21
|
})(ScriptType = exports.ScriptType || (exports.ScriptType = {}));
|
|
23
22
|
var HandleType;
|
package/handles/policies.d.ts
CHANGED
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
import { Network } from '../types';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
2
|
+
export interface PolicyIds {
|
|
3
|
+
[key: string]: {
|
|
4
|
+
firstMintingSlot: number;
|
|
5
|
+
lastMintingSlot: number | null;
|
|
6
|
+
sunsetSlot: number | null;
|
|
7
|
+
isDeMi?: boolean;
|
|
9
8
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
firstMintingSlot: number;
|
|
20
|
-
lastMintingSlot: null;
|
|
21
|
-
sunsetSlot: null;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
getActivePolicy(network: Network, atSlot?: number): string | undefined;
|
|
25
|
-
};
|
|
9
|
+
}
|
|
10
|
+
export interface HandlePolicies {
|
|
11
|
+
'preview': PolicyIds;
|
|
12
|
+
'preprod': PolicyIds;
|
|
13
|
+
'mainnet': PolicyIds;
|
|
14
|
+
getActivePolicy(network: Network, isDemi?: boolean, atSlot?: number): string | undefined;
|
|
15
|
+
contains(network: Network, policyId: string): boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const HANDLE_POLICIES: HandlePolicies;
|
package/handles/policies.js
CHANGED
|
@@ -3,12 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.HANDLE_POLICIES = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
exports.HANDLE_POLICIES = {
|
|
6
|
-
'preview': {
|
|
6
|
+
'preview': {
|
|
7
|
+
'f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a': { firstMintingSlot: 0, lastMintingSlot: null, sunsetSlot: null },
|
|
8
|
+
'6c32db33a422e0bc2cb535bb850b5a6e9a9572222056d6ddc9cbc26e': { firstMintingSlot: 0, lastMintingSlot: null, sunsetSlot: null, isDeMi: true }
|
|
9
|
+
},
|
|
7
10
|
'preprod': { 'f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a': { firstMintingSlot: 0, lastMintingSlot: null, sunsetSlot: null } },
|
|
8
11
|
'mainnet': { 'f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a': { firstMintingSlot: 0, lastMintingSlot: null, sunsetSlot: null } },
|
|
9
|
-
getActivePolicy(network, atSlot) {
|
|
12
|
+
getActivePolicy(network, isDeMi = false, atSlot) {
|
|
10
13
|
var _a;
|
|
11
14
|
const theSlot = atSlot ? atSlot : (0, utils_1.getSlotNumberFromDate)(new Date(Date.now()));
|
|
12
|
-
return (_a = Object.entries(this[network]).find(([, value]) => { var _a; return value.firstMintingSlot <= theSlot && ((_a = value.lastMintingSlot) !== null && _a !== void 0 ? _a : Number.POSITIVE_INFINITY) >= theSlot; })) === null || _a === void 0 ? void 0 : _a[0];
|
|
15
|
+
return (_a = Object.entries(this[network]).find(([, value]) => { var _a; return value.firstMintingSlot <= theSlot && ((_a = value.lastMintingSlot) !== null && _a !== void 0 ? _a : Number.POSITIVE_INFINITY) >= theSlot && value.isDeMi == isDeMi; })) === null || _a === void 0 ? void 0 : _a[0];
|
|
16
|
+
},
|
|
17
|
+
contains(network, policyId) {
|
|
18
|
+
return Object.keys(this[network]).includes(policyId);
|
|
13
19
|
}
|
|
14
20
|
};
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface KeyPair {
|
|
|
14
14
|
* Finally, use the decimal number and convert to CRC8. It should match the last 2 characters. https://crccalc.com/
|
|
15
15
|
*/
|
|
16
16
|
export declare enum AssetNameLabel {
|
|
17
|
+
NONE = "",
|
|
17
18
|
LBL_000 = "00000000",
|
|
18
19
|
LBL_001 = "00001070",
|
|
19
20
|
LBL_002 = "000020e0",
|
package/types/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __exportStar(require("./profile-header"), exports);
|
|
|
25
25
|
*/
|
|
26
26
|
var AssetNameLabel;
|
|
27
27
|
(function (AssetNameLabel) {
|
|
28
|
+
AssetNameLabel["NONE"] = "";
|
|
28
29
|
AssetNameLabel["LBL_000"] = "00000000";
|
|
29
30
|
AssetNameLabel["LBL_001"] = "00001070";
|
|
30
31
|
AssetNameLabel["LBL_002"] = "000020e0";
|
package/utils/cbor/index.d.ts
CHANGED
package/utils/crypto/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
1
3
|
import { AddressDetails, AddressType, AssetNameLabel } from '../../types';
|
|
2
4
|
export declare const getNativeCrypto: () => Promise<any>;
|
|
3
5
|
export declare function dec2hex(dec: number): string;
|
|
@@ -6,19 +8,20 @@ export declare const sha256: (plain: string) => Promise<ArrayBuffer>;
|
|
|
6
8
|
export declare function base64urlencode(a: ArrayBuffer): string;
|
|
7
9
|
export declare function getChallengeFromVerifier(verifier: string): Promise<string>;
|
|
8
10
|
export declare const decodeAddress: (address: string) => string | null;
|
|
9
|
-
export declare const parseAssetNameLabel: (assetName: string) => AssetNameLabel
|
|
11
|
+
export declare const parseAssetNameLabel: (assetName: string) => AssetNameLabel;
|
|
10
12
|
export declare const checkNameLabel: (assetName: string) => {
|
|
11
13
|
isCip67: boolean;
|
|
12
|
-
assetLabel:
|
|
13
|
-
|
|
14
|
+
assetLabel: AssetNameLabel;
|
|
15
|
+
name: string;
|
|
14
16
|
};
|
|
15
17
|
export declare const getPaymentAddressType: (headerByte: number) => AddressType;
|
|
16
18
|
export declare const buildPaymentAddressType: (address: string) => AddressType;
|
|
17
19
|
export declare const buildStakeKey: (address: string) => string | null;
|
|
18
20
|
export declare const getPaymentKeyHash: (address: string) => Promise<string | null>;
|
|
19
21
|
export declare const bech32FromHex: (hex: string, isTestnet?: boolean, type?: 'addr' | 'stake' | 'pool' | 'drep' | 'cc_hot' | 'cc_cold') => string;
|
|
20
|
-
export declare const
|
|
22
|
+
export declare const bech32AddressFromHashes: (paymentHash: string, paymentHashType?: 'key' | 'script', stakeHash?: string, stakeHashType?: 'key' | 'script', type?: 'addr' | 'stake', isTestnet?: boolean) => string;
|
|
23
|
+
export declare const buildHolderInfo: (addr: string) => AddressDetails;
|
|
21
24
|
export declare const checkKnownSmartContracts: (address: string, stake?: string | null) => string;
|
|
22
25
|
export declare const getDateStringFromSlot: (currentSlot: number) => Date;
|
|
23
26
|
export declare const getSlotNumberFromDate: (date: Date) => number;
|
|
24
|
-
export declare const blake2b: (input: string, outlen?: number) => string;
|
|
27
|
+
export declare const blake2b: (input: string | Buffer | Uint8Array, outlen?: number) => string;
|
package/utils/crypto/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.blake2b = exports.getSlotNumberFromDate = exports.getDateStringFromSlot = exports.checkKnownSmartContracts = exports.
|
|
29
|
+
exports.blake2b = exports.getSlotNumberFromDate = exports.getDateStringFromSlot = exports.checkKnownSmartContracts = exports.buildHolderInfo = exports.bech32AddressFromHashes = exports.bech32FromHex = exports.getPaymentKeyHash = exports.buildStakeKey = exports.buildPaymentAddressType = exports.getPaymentAddressType = exports.checkNameLabel = exports.parseAssetNameLabel = exports.decodeAddress = exports.getChallengeFromVerifier = exports.base64urlencode = exports.sha256 = exports.getRandomCodeVerifier = exports.dec2hex = exports.getNativeCrypto = void 0;
|
|
30
30
|
const bech32_1 = require("bech32");
|
|
31
31
|
const blakejs_1 = require("blakejs");
|
|
32
32
|
const bs58_1 = __importDefault(require("bs58"));
|
|
@@ -93,19 +93,15 @@ const decodeAddress = (address) => {
|
|
|
93
93
|
};
|
|
94
94
|
exports.decodeAddress = decodeAddress;
|
|
95
95
|
const parseAssetNameLabel = (assetName) => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return lbl;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return null;
|
|
96
|
+
const maybeAssetNameLabel = assetName.slice(0, 8);
|
|
97
|
+
return Object.values(types_1.AssetNameLabel).includes(maybeAssetNameLabel) ? maybeAssetNameLabel : types_1.AssetNameLabel.NONE;
|
|
102
98
|
};
|
|
103
99
|
exports.parseAssetNameLabel = parseAssetNameLabel;
|
|
104
100
|
const checkNameLabel = (assetName) => {
|
|
105
101
|
const assetNameString = typeof assetName === 'string' ? assetName : new TextDecoder().decode(assetName);
|
|
106
102
|
let isCip67 = false;
|
|
107
|
-
let assetLabel =
|
|
108
|
-
let
|
|
103
|
+
let assetLabel = types_1.AssetNameLabel.NONE;
|
|
104
|
+
let utf8Name = Buffer.from(assetName, 'hex').toString('utf8');
|
|
109
105
|
if (assetNameString.length >= 8) {
|
|
110
106
|
const maybeAssetLabel = assetNameString.slice(0, 8);
|
|
111
107
|
if (maybeAssetLabel.startsWith('0') && maybeAssetLabel.endsWith('0')) {
|
|
@@ -113,15 +109,15 @@ const checkNameLabel = (assetName) => {
|
|
|
113
109
|
const check = maybeAssetLabel.slice(5, 7);
|
|
114
110
|
if ((0, crc_1.crc8)(Buffer.from(label, 'hex')).toString(16).padStart(2, '0') == check) {
|
|
115
111
|
isCip67 = true;
|
|
116
|
-
assetLabel =
|
|
117
|
-
|
|
112
|
+
assetLabel = (0, exports.parseAssetNameLabel)(assetName);
|
|
113
|
+
utf8Name = Buffer.from(assetName.slice(8), 'hex').toString('utf8');
|
|
118
114
|
}
|
|
119
115
|
}
|
|
120
116
|
}
|
|
121
117
|
return {
|
|
122
118
|
isCip67,
|
|
123
119
|
assetLabel,
|
|
124
|
-
|
|
120
|
+
name: utf8Name
|
|
125
121
|
};
|
|
126
122
|
};
|
|
127
123
|
exports.checkNameLabel = checkNameLabel;
|
|
@@ -218,7 +214,24 @@ const bech32FromHex = (hex, isTestnet = !constants_1.IS_PRODUCTION, type = 'addr
|
|
|
218
214
|
return bech32_1.bech32.encode(prefix, words, bytes.length * 2 + prefix.length);
|
|
219
215
|
};
|
|
220
216
|
exports.bech32FromHex = bech32FromHex;
|
|
221
|
-
const
|
|
217
|
+
const bech32AddressFromHashes = (paymentHash, paymentHashType = 'key', stakeHash = '', stakeHashType = 'key', type = 'addr', isTestnet = !constants_1.IS_PRODUCTION) => {
|
|
218
|
+
let headerByte = 0;
|
|
219
|
+
if (!stakeHash) {
|
|
220
|
+
headerByte += 6;
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
if (stakeHashType == 'script') {
|
|
224
|
+
headerByte += 2;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (paymentHashType == 'script') {
|
|
228
|
+
headerByte += 1;
|
|
229
|
+
}
|
|
230
|
+
const hex = `${headerByte.toString(16)}${isTestnet ? 0 : 1}${paymentHash}${stakeHash}`;
|
|
231
|
+
return (0, exports.bech32FromHex)(hex, isTestnet, type);
|
|
232
|
+
};
|
|
233
|
+
exports.bech32AddressFromHashes = bech32AddressFromHashes;
|
|
234
|
+
const buildHolderInfo = (addr) => {
|
|
222
235
|
const addressType = (0, exports.buildPaymentAddressType)(addr);
|
|
223
236
|
let knownOwnerName = (0, exports.checkKnownSmartContracts)(addr);
|
|
224
237
|
let stakeKey = null;
|
|
@@ -232,7 +245,7 @@ const getAddressHolderDetails = (addr) => {
|
|
|
232
245
|
knownOwnerName
|
|
233
246
|
};
|
|
234
247
|
};
|
|
235
|
-
exports.
|
|
248
|
+
exports.buildHolderInfo = buildHolderInfo;
|
|
236
249
|
const checkKnownSmartContracts = (address, stake) => {
|
|
237
250
|
switch (address) {
|
|
238
251
|
case 'addr1w999n67e86jn6xal07pzxtrmqynspgx0fwmcmpua4wc6yzsxpljz3':
|
|
@@ -290,6 +303,6 @@ const getSlotNumberFromDate = (date) => {
|
|
|
290
303
|
};
|
|
291
304
|
exports.getSlotNumberFromDate = getSlotNumberFromDate;
|
|
292
305
|
const blake2b = (input, outlen = 32) => {
|
|
293
|
-
return (0, blakejs_1.blake2bHex)(input, undefined, outlen);
|
|
306
|
+
return (0, blakejs_1.blake2bHex)(typeof input == 'string' ? Buffer.from(input, 'hex') : input, undefined, outlen);
|
|
294
307
|
};
|
|
295
308
|
exports.blake2b = blake2b;
|
package/utils/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare const hasOwnProperty: (o: any, v: PropertyKey) => boolean;
|
|
|
17
17
|
export declare const isDate: (d: any) => boolean;
|
|
18
18
|
export declare const isEmptyObject: (o: any) => boolean;
|
|
19
19
|
export declare const makeObjectWithoutPrototype: () => any;
|
|
20
|
+
export declare const ExcludesFalse: <T>(n?: T | null | undefined) => n is T;
|
|
20
21
|
export declare const diff: (lhs: any, rhs: any) => any;
|
|
21
|
-
export { DefaultTextFormat as KeyType
|
|
22
|
+
export { decodeCborToJson, encodeJsonToDatum, DefaultTextFormat as KeyType } from './cbor';
|
|
22
23
|
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.
|
|
17
|
+
exports.KeyType = exports.encodeJsonToDatum = exports.decodeCborToJson = exports.diff = exports.ExcludesFalse = exports.makeObjectWithoutPrototype = exports.isEmptyObject = exports.isDate = exports.hasOwnProperty = exports.isObject = exports.isEmpty = exports.objectHasKeys = exports.getElapsedTime = exports.getSlotNumberFromDate = exports.getDateFromSlot = 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
|
};
|
|
@@ -108,6 +108,8 @@ const isEmptyObject = (o) => (0, exports.isObject)(o) && (0, exports.objectHasKe
|
|
|
108
108
|
exports.isEmptyObject = isEmptyObject;
|
|
109
109
|
const makeObjectWithoutPrototype = () => Object.create(null);
|
|
110
110
|
exports.makeObjectWithoutPrototype = makeObjectWithoutPrototype;
|
|
111
|
+
const ExcludesFalse = (n) => Boolean(n);
|
|
112
|
+
exports.ExcludesFalse = ExcludesFalse;
|
|
111
113
|
const diff = (lhs, rhs) => {
|
|
112
114
|
if (lhs === rhs)
|
|
113
115
|
return {}; // equal return no diff
|
|
@@ -144,7 +146,7 @@ const diff = (lhs, rhs) => {
|
|
|
144
146
|
};
|
|
145
147
|
exports.diff = diff;
|
|
146
148
|
var cbor_1 = require("./cbor");
|
|
147
|
-
Object.defineProperty(exports, "KeyType", { enumerable: true, get: function () { return cbor_1.DefaultTextFormat; } });
|
|
148
|
-
Object.defineProperty(exports, "encodeJsonToDatum", { enumerable: true, get: function () { return cbor_1.encodeJsonToDatum; } });
|
|
149
149
|
Object.defineProperty(exports, "decodeCborToJson", { enumerable: true, get: function () { return cbor_1.decodeCborToJson; } });
|
|
150
|
+
Object.defineProperty(exports, "encodeJsonToDatum", { enumerable: true, get: function () { return cbor_1.encodeJsonToDatum; } });
|
|
151
|
+
Object.defineProperty(exports, "KeyType", { enumerable: true, get: function () { return cbor_1.DefaultTextFormat; } });
|
|
150
152
|
__exportStar(require("./crypto"), exports);
|