diff options
Diffstat (limited to 'src/external/stellar-freighter-api/@stellar/freighter-api')
16 files changed, 185 insertions, 38 deletions
diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/addToken.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/addToken.d.ts new file mode 100644 index 0000000..ae96592 --- /dev/null +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/addToken.d.ts @@ -0,0 +1,9 @@ +import { FreighterApiError } from "@shared/api/types"; +export declare const addToken: (args: { + contractId: string; + networkPassphrase?: string; +}) => Promise<{ + contractId: string; +} & { + error?: FreighterApiError; +}>; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/getAddress.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/getAddress.d.ts new file mode 100644 index 0000000..c79ba8c --- /dev/null +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/getAddress.d.ts @@ -0,0 +1,6 @@ +import { FreighterApiError } from "@shared/api/types"; +export declare const getAddress: () => Promise<{ + address: string; +} & { + error?: FreighterApiError; +}>; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/getNetwork.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/getNetwork.d.ts index 6352aa0..ccd6ac3 100644 --- a/src/external/stellar-freighter-api/@stellar/freighter-api/src/getNetwork.d.ts +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/getNetwork.d.ts @@ -1 +1,7 @@ -export declare const getNetwork: () => Promise<string>; +import { FreighterApiError } from "@shared/api/types"; +export declare const getNetwork: () => Promise<{ + network: string; + networkPassphrase: string; +} & { + error?: FreighterApiError; +}>; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/getNetworkDetails.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/getNetworkDetails.d.ts index b161629..886d9ec 100644 --- a/src/external/stellar-freighter-api/@stellar/freighter-api/src/getNetworkDetails.d.ts +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/getNetworkDetails.d.ts @@ -1,6 +1,9 @@ +import { FreighterApiError } from "@shared/api/types"; export declare const getNetworkDetails: () => Promise<{ network: string; networkUrl: string; networkPassphrase: string; sorobanRpcUrl?: string; +} & { + error?: FreighterApiError; }>; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/getPublicKey.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/getPublicKey.d.ts deleted file mode 100644 index 80cf670..0000000 --- a/src/external/stellar-freighter-api/@stellar/freighter-api/src/getPublicKey.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const getPublicKey: () => Promise<string>; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/getUserInfo.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/getUserInfo.d.ts deleted file mode 100644 index 0a464a2..0000000 --- a/src/external/stellar-freighter-api/@stellar/freighter-api/src/getUserInfo.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare const getUserInfo: () => Promise<{ - publicKey: string; -}>; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/index.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/index.d.ts index 8c3e29a..88f234a 100644 --- a/src/external/stellar-freighter-api/@stellar/freighter-api/src/index.d.ts +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/index.d.ts @@ -1,40 +1,97 @@ -import { getPublicKey } from "./getPublicKey"; +import { getAddress } from "./getAddress"; +import { addToken } from "./addToken"; import { signTransaction } from "./signTransaction"; -import { signBlob } from "./signBlob"; +import { signMessage } from "./signMessage"; import { signAuthEntry } from "./signAuthEntry"; import { isConnected } from "./isConnected"; import { getNetwork } from "./getNetwork"; import { getNetworkDetails } from "./getNetworkDetails"; import { isAllowed } from "./isAllowed"; import { setAllowed } from "./setAllowed"; -import { getUserInfo } from "./getUserInfo"; +import { requestAccess } from "./requestAccess"; +import { WatchWalletChanges } from "./watchWalletChanges"; export declare const isBrowser: boolean; -export { getPublicKey, signTransaction, signBlob, signAuthEntry, isConnected, getNetwork, getNetworkDetails, isAllowed, setAllowed, getUserInfo, }; +export { getAddress, addToken, signTransaction, signMessage, signAuthEntry, isConnected, getNetwork, getNetworkDetails, isAllowed, setAllowed, requestAccess, WatchWalletChanges, }; declare const _default: { - getPublicKey: () => Promise<string>; + getAddress: () => Promise<{ + address: string; + } & { + error?: import("@shared/api/types").FreighterApiError; + }>; + addToken: (args: { + contractId: string; + networkPassphrase?: string; + }) => Promise<{ + contractId: string; + } & { + error?: import("@shared/api/types").FreighterApiError; + }>; signTransaction: (transactionXdr: string, opts?: { - network?: string | undefined; - networkPassphrase?: string | undefined; - accountToSign?: string | undefined; - } | undefined) => Promise<string>; - signBlob: (blob: string, opts?: { - accountToSign?: string | undefined; - } | undefined) => Promise<string>; + networkPassphrase?: string; + address?: string; + }) => Promise<{ + signedTxXdr: string; + signerAddress: string; + } & { + error?: import("@shared/api/types").FreighterApiError; + }>; + signMessage: (message: string, opts?: { + networkPassphrase?: string; + address?: string; + }) => Promise<({ + signedMessage: Buffer | null; + signerAddress: string; + } & { + error?: import("@shared/api/types").FreighterApiError; + }) | ({ + signedMessage: string; + signerAddress: string; + } & { + error?: import("@shared/api/types").FreighterApiError; + })>; signAuthEntry: (entryXdr: string, opts?: { - accountToSign?: string | undefined; - } | undefined) => Promise<string>; - isConnected: () => Promise<boolean>; - getNetwork: () => Promise<string>; + networkPassphrase?: string; + address?: string; + }) => Promise<{ + signedAuthEntry: Buffer | null; + signerAddress: string; + } & { + error?: import("@shared/api/types").FreighterApiError; + }>; + isConnected: () => Promise<{ + isConnected: boolean; + } & { + error?: import("@shared/api/types").FreighterApiError; + }>; + getNetwork: () => Promise<{ + network: string; + networkPassphrase: string; + } & { + error?: import("@shared/api/types").FreighterApiError; + }>; getNetworkDetails: () => Promise<{ network: string; networkUrl: string; networkPassphrase: string; - sorobanRpcUrl?: string | undefined; + sorobanRpcUrl?: string; + } & { + error?: import("@shared/api/types").FreighterApiError; + }>; + isAllowed: () => Promise<{ + isAllowed: boolean; + } & { + error?: import("@shared/api/types").FreighterApiError; + }>; + setAllowed: () => Promise<{ + isAllowed: boolean; + } & { + error?: import("@shared/api/types").FreighterApiError; }>; - isAllowed: () => Promise<boolean>; - setAllowed: () => Promise<boolean>; - getUserInfo: () => Promise<{ - publicKey: string; + requestAccess: () => Promise<{ + address: string; + } & { + error?: import("@shared/api/types").FreighterApiError; }>; + WatchWalletChanges: typeof WatchWalletChanges; }; export default _default; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/isAllowed.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/isAllowed.d.ts index 39eed0a..77f4c54 100644 --- a/src/external/stellar-freighter-api/@stellar/freighter-api/src/isAllowed.d.ts +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/isAllowed.d.ts @@ -1 +1,6 @@ -export declare const isAllowed: () => Promise<boolean>; +import { FreighterApiError } from "@shared/api/types"; +export declare const isAllowed: () => Promise<{ + isAllowed: boolean; +} & { + error?: FreighterApiError; +}>; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/isConnected.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/isConnected.d.ts index 8e4b262..c0357e1 100644 --- a/src/external/stellar-freighter-api/@stellar/freighter-api/src/isConnected.d.ts +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/isConnected.d.ts @@ -1 +1,6 @@ -export declare const isConnected: () => Promise<boolean>; +import { FreighterApiError } from "@shared/api/types"; +export declare const isConnected: () => Promise<{ + isConnected: boolean; +} & { + error?: FreighterApiError; +}>; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/requestAccess.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/requestAccess.d.ts new file mode 100644 index 0000000..11ca962 --- /dev/null +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/requestAccess.d.ts @@ -0,0 +1,6 @@ +import { FreighterApiError } from "@shared/api/types"; +export declare const requestAccess: () => Promise<{ + address: string; +} & { + error?: FreighterApiError; +}>; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/setAllowed.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/setAllowed.d.ts index 989cab6..296c8a7 100644 --- a/src/external/stellar-freighter-api/@stellar/freighter-api/src/setAllowed.d.ts +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/setAllowed.d.ts @@ -1 +1,6 @@ -export declare const setAllowed: () => Promise<boolean>; +import { FreighterApiError } from "@shared/api/types"; +export declare const setAllowed: () => Promise<{ + isAllowed: boolean; +} & { + error?: FreighterApiError; +}>; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/signAuthEntry.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/signAuthEntry.d.ts index ca8cc91..598d76d 100644 --- a/src/external/stellar-freighter-api/@stellar/freighter-api/src/signAuthEntry.d.ts +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/signAuthEntry.d.ts @@ -1,3 +1,10 @@ +import { FreighterApiError } from "@shared/api/types"; export declare const signAuthEntry: (entryXdr: string, opts?: { - accountToSign?: string | undefined; -} | undefined) => Promise<string>; + networkPassphrase?: string; + address?: string; +}) => Promise<{ + signedAuthEntry: Buffer | null; + signerAddress: string; +} & { + error?: FreighterApiError; +}>; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/signBlob.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/signBlob.d.ts deleted file mode 100644 index eab6a5a..0000000 --- a/src/external/stellar-freighter-api/@stellar/freighter-api/src/signBlob.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare const signBlob: (blob: string, opts?: { - accountToSign?: string | undefined; -} | undefined) => Promise<string>; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/signMessage.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/signMessage.d.ts new file mode 100644 index 0000000..e86ac7f --- /dev/null +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/signMessage.d.ts @@ -0,0 +1,19 @@ +import { Buffer } from "buffer"; +import { FreighterApiError } from "@shared/api/types"; +type SignMessageV3Response = { + signedMessage: Buffer | null; + signerAddress: string; +} & { + error?: FreighterApiError; +}; +type SignMessageV4Response = { + signedMessage: string; + signerAddress: string; +} & { + error?: FreighterApiError; +}; +export declare const signMessage: (message: string, opts?: { + networkPassphrase?: string; + address?: string; +}) => Promise<SignMessageV3Response | SignMessageV4Response>; +export {}; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/signTransaction.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/signTransaction.d.ts index 2605f0f..1c38f36 100644 --- a/src/external/stellar-freighter-api/@stellar/freighter-api/src/signTransaction.d.ts +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/signTransaction.d.ts @@ -1,5 +1,10 @@ +import { FreighterApiError } from "@shared/api/types"; export declare const signTransaction: (transactionXdr: string, opts?: { - network?: string | undefined; - networkPassphrase?: string | undefined; - accountToSign?: string | undefined; -} | undefined) => Promise<string>; + networkPassphrase?: string; + address?: string; +}) => Promise<{ + signedTxXdr: string; + signerAddress: string; +} & { + error?: FreighterApiError; +}>; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/watchWalletChanges.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/watchWalletChanges.d.ts new file mode 100644 index 0000000..79ff95e --- /dev/null +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/watchWalletChanges.d.ts @@ -0,0 +1,21 @@ +import { FreighterApiError } from "@shared/api/types"; +interface CallbackParams { + address: string; + network: string; + networkPassphrase: string; + error?: FreighterApiError; +} +export declare class WatchWalletChanges { + timeout: number; + currentAddress: string; + currentNetwork: string; + currentNetworkPassphrase: string; + isRunning: boolean; + constructor(timeout?: number); + watch(cb: (params: CallbackParams) => void): { + error?: FreighterApiError; + }; + fetchInfo: (cb: (params: CallbackParams) => void) => Promise<void>; + stop(): void; +} +export {}; |