index.d.ts 2.0 KB

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