@koralabs/kora-labs-common 6.1.3 → 6.1.5

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.
@@ -93,6 +93,7 @@ export interface IGetAllQueryParams extends IHandleSearchParams {
93
93
  page?: string;
94
94
  sort?: Sort;
95
95
  slot_number?: string;
96
+ minting_type?: 'nft' | 'virtual';
96
97
  type?: 'bech32stake' | 'holder' | 'stakekeyhash' | 'assetname' | 'handlehex' | 'paymentkeyhash' | 'bech32address' | 'hexaddress';
97
98
  }
98
99
  export type ISearchBody = string[];
@@ -3,7 +3,7 @@ export interface IHandlesProvider {
3
3
  initialize: () => Promise<IHandlesProvider>;
4
4
  destroy: () => void;
5
5
  rollBackToGenesis: () => void;
6
- getStartingPoint: (save: (handle: StoredHandle) => Promise<void>, failed: boolean) => Promise<{
6
+ getStartingPoint: (save: (handle: StoredHandle) => void, failed: boolean) => Promise<{
7
7
  slot: number;
8
8
  id: string;
9
9
  } | null>;
@@ -13,6 +13,7 @@ export interface IHandlesProvider {
13
13
  setHandle: (key: string, value: StoredHandle) => void;
14
14
  removeHandle: (handleName: string) => void;
15
15
  getIndex: (index: IndexNames) => Map<string | number, Set<string> | Holder | ISlotHistory | StoredHandle>;
16
+ getKeysFromIndex: (index: IndexNames) => (string | number)[];
16
17
  getValueFromIndex: (index: IndexNames, key: string | number) => Set<string> | Holder | ISlotHistory | StoredHandle | undefined;
17
18
  setValueOnIndex: (index: IndexNames, key: string | number, value: Set<string> | Holder | ISlotHistory | StoredHandle) => void;
18
19
  removeKeyFromIndex: (index: IndexNames, key: string | number) => void;
@@ -8,7 +8,6 @@ export declare class HandleSearchModel implements IHandleSearchInput {
8
8
  holder_address?: string;
9
9
  personalized?: boolean;
10
10
  handle_type?: string;
11
- public_subhandles?: boolean;
12
11
  og?: 'true' | 'false';
13
12
  handles?: string[];
14
13
  constructor(input?: IHandleSearchInput);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koralabs/kora-labs-common",
3
- "version": "6.1.3",
3
+ "version": "6.1.5",
4
4
  "description": "Kora Labs Common Utilities",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -59,4 +59,4 @@ export declare const decodeCborToJson: ({ cborString, schema, defaultKeyType, fo
59
59
  schema?: any;
60
60
  defaultKeyType?: DefaultTextFormat | undefined;
61
61
  forJson?: boolean | undefined;
62
- }) => Promise<any>;
62
+ }) => any;
@@ -377,14 +377,14 @@ const decodeObject = ({ val, constr = null, schema = {}, defaultKeyType = Defaul
377
377
  return val;
378
378
  }
379
379
  };
380
- const decodeCborToJson = async ({ cborString, schema, defaultKeyType, forJson }) => {
381
- const decoded = await cbor.decodeAll(Buffer.from(cborString, 'hex'), {
380
+ const decodeCborToJson = ({ cborString, schema, defaultKeyType, forJson }) => {
381
+ const decoded = cbor.decodeAllSync(Buffer.from(cborString, 'hex'), {
382
382
  tags: {
383
383
  121: (val) => ({ [`constructor_0`]: val }),
384
384
  122: (val) => ({ [`constructor_1`]: val }),
385
385
  123: (val) => ({ [`constructor_2`]: val }),
386
386
  124: (val) => ({ [`constructor_3`]: val }),
387
- 125: (val) => ({ [`constructor_3`]: val })
387
+ 125: (val) => ({ [`constructor_4`]: val })
388
388
  }
389
389
  });
390
390
  let [data] = decoded;
@@ -17,7 +17,7 @@ export declare const checkNameLabel: (assetName: string) => {
17
17
  export declare const getPaymentAddressType: (headerByte: number) => AddressType;
18
18
  export declare const buildPaymentAddressType: (address: string) => AddressType;
19
19
  export declare const buildStakeKey: (address: string) => string | null;
20
- export declare const getPaymentKeyHash: (address: string) => Promise<string | null>;
20
+ export declare const getPaymentKeyHash: (address: string) => string | null;
21
21
  export declare const bech32FromHex: (hex: string, isTestnet?: boolean, type?: 'addr' | 'stake' | 'pool' | 'drep' | 'cc_hot' | 'cc_cold') => string;
22
22
  export declare const bech32AddressFromHashes: (paymentHash: string, paymentHashType?: 'key' | 'script', stakeHash?: string, stakeHashType?: 'key' | 'script', type?: 'addr' | 'stake', isTestnet?: boolean) => string;
23
23
  export declare const buildHolderInfo: (addr: string) => AddressDetails;
@@ -183,14 +183,14 @@ const buildStakeKey = (address) => {
183
183
  }
184
184
  };
185
185
  exports.buildStakeKey = buildStakeKey;
186
- const getPaymentKeyHash = async (address) => {
186
+ const getPaymentKeyHash = (address) => {
187
187
  try {
188
188
  const decoded = (0, exports.decodeAddress)(address);
189
189
  if (!decoded) {
190
190
  try {
191
191
  // Try Byron addresses
192
- const jsonAddress = await (0, cbor_1.decodeCborToJson)({ cborString: Buffer.from(bs58_1.default.decode(address)).toString('hex') });
193
- const innerAddress = await (0, cbor_1.decodeCborToJson)({ cborString: jsonAddress[0].value.toString('hex') });
192
+ const jsonAddress = (0, cbor_1.decodeCborToJson)({ cborString: Buffer.from(bs58_1.default.decode(address)).toString('hex') });
193
+ const innerAddress = (0, cbor_1.decodeCborToJson)({ cborString: jsonAddress[0].value.toString('hex') });
194
194
  return innerAddress[0].toString('hex').slice(2);
195
195
  }
196
196
  catch (_a) {