index.d.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { ContentItem } from './content-item';
  2. import { Storage } from './storage';
  3. import { UploadItemParameters } from './upload-item-parameters';
  4. import { IWebClient } from './webclient';
  5. export declare class BankClient {
  6. private urlBase;
  7. private ipfsUrlBase;
  8. private storage;
  9. private webClient;
  10. static parseBankLink(bankLink: string): {
  11. host: string | undefined;
  12. address: string;
  13. topic: string;
  14. };
  15. private privateKey;
  16. private wsUrlBase;
  17. private bootstrapPromise;
  18. private bootstrapResult;
  19. constructor(urlBase: string, ipfsUrlBase: string, storage: Storage, webClient: IWebClient);
  20. getPub(): Promise<string>;
  21. bootstrap(): any;
  22. getNonce(): Promise<number>;
  23. getBalance(): Promise<number>;
  24. upload(params: UploadItemParameters): Promise<any>;
  25. uploadSlimJSON(item: any): Promise<any>;
  26. uploadSlimText(item: string): Promise<any>;
  27. appendPrivate(dontLogToAll: boolean, peerAddr: string, topic: string, hash?: string, replaceHash?: string, deleteHash?: string): Promise<void>;
  28. retrievePrivate(peerAddr: string, topic: string): Promise<string>;
  29. subscribePrivate(peerAddr: string, topic: string, connectCallback: () => void, messageCallback: (data: any) => void): Promise<void>;
  30. getOrCreateContact(peerId: string, contactAddr: string): Promise<any>;
  31. getAllContacts(peerId: string): Promise<any[]>;
  32. getContactById(peerId: string, contactId: string): Promise<any>;
  33. updateContact(peerId: string, contactId: string, newProperties: any): Promise<any>;
  34. getContentItemByHash(hash: string): Promise<ContentItem>;
  35. getItemsForCommaList(commaList: string): Promise<any[]>;
  36. parseItemHash(itemHash: string): {
  37. type: string;
  38. timestamp: string | null;
  39. hash: string;
  40. };
  41. private connectWebsocket;
  42. private getPriv;
  43. private makePlaintextPayload;
  44. }