UNPKG

@smartinvoicexyz/utils

Version:

Unified source for utility functions used across the Smart Invoice protocol.

44 lines (43 loc) 1.63 kB
import { KeyRestrictions, OldMetadata } from '@smartinvoicexyz/types'; import { Hex } from 'viem'; export declare const fetchFromIPFS: (cid: string | undefined) => Promise<OldMetadata>; interface handleDetailsPinProps { details: object; name?: string; token: string; } export declare const handleDetailsPin: ({ details, name, token, }: handleDetailsPinProps) => Promise<any>; export declare const fetchToken: (count?: number) => Promise<string | null>; /** * Converts IPFS CID version 0 (Base58) to a 32 bytes hex string and adds initial 0x. * @param cid - The 46 character long IPFS CID V0 string (starts with Qm). * @returns string */ export declare function convertIpfsCidV0ToByte32(cid: string): Hex; /** * Converts 32 byte hex string (initial 0x is removed) to Base58 IPFS content identifier version 0 address string (starts with Qm) * @param str - The 32 byte long hex string to encode to IPFS CID V0 (without initial 0x). * @returns string */ export declare function convertByte32ToIpfsCidV0(str: Hex): string; export declare const generateApiKey: (keyRestrictions: KeyRestrictions) => Promise<any>; export declare const keyRestrictions: () => { keyName: string; maxUses: number; permissions: { endpoints: { data: { pinList: boolean; userPinnedDataTotal: boolean; }; pinning: { pinFileToIPFS: boolean; pinJSONToIPFS: boolean; pinJobs: boolean; unpin: boolean; userPinPolicy: boolean; }; }; }; }; export {};