aboutsummaryrefslogtreecommitdiff
path: root/src/external/stellar-freighter-api/@shared/api
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2023-12-27 16:29:28 +0200
committerkaotisk <kaotisk@arching-kaos.org>2023-12-27 16:29:28 +0200
commit1904a913b84e01e902173e782ab45e0e3b4ccf8d (patch)
tree016cd489ec4b3c6b905a9d0d837bcafe8daeb8a6 /src/external/stellar-freighter-api/@shared/api
parent34b89f42c737955e510ba058a126b33cba6d2bb6 (diff)
downloadarching-kaos-web-ui-1904a913b84e01e902173e782ab45e0e3b4ccf8d.tar.gz
arching-kaos-web-ui-1904a913b84e01e902173e782ab45e0e3b4ccf8d.tar.bz2
arching-kaos-web-ui-1904a913b84e01e902173e782ab45e0e3b4ccf8d.zip
Use only local libraries
Diffstat (limited to 'src/external/stellar-freighter-api/@shared/api')
-rw-r--r--src/external/stellar-freighter-api/@shared/api/external.d.ts24
-rw-r--r--src/external/stellar-freighter-api/@shared/api/helpers/extensionMessaging.d.ts9
-rw-r--r--src/external/stellar-freighter-api/@shared/api/types.d.ts158
3 files changed, 191 insertions, 0 deletions
diff --git a/src/external/stellar-freighter-api/@shared/api/external.d.ts b/src/external/stellar-freighter-api/@shared/api/external.d.ts
new file mode 100644
index 0000000..9755ca4
--- /dev/null
+++ b/src/external/stellar-freighter-api/@shared/api/external.d.ts
@@ -0,0 +1,24 @@
+import { UserInfo } from "./types";
+export declare const requestPublicKey: () => Promise<string>;
+export declare const submitTransaction: (transactionXdr: string, opts?: string | {
+ network?: string | undefined;
+ accountToSign?: string | undefined;
+ networkPassphrase?: string | undefined;
+} | undefined, accountToSign?: string | undefined) => Promise<string>;
+export declare const submitBlob: (blob: string, opts?: {
+ accountToSign?: string | undefined;
+} | undefined) => Promise<string>;
+export declare const submitAuthEntry: (entryXdr: string, opts?: {
+ accountToSign?: string | undefined;
+} | undefined) => Promise<string>;
+export declare const requestNetwork: () => Promise<string>;
+export declare const requestNetworkDetails: () => Promise<{
+ network: string;
+ networkUrl: string;
+ networkPassphrase: string;
+ sorobanRpcUrl?: string | undefined;
+}>;
+export declare const requestConnectionStatus: () => Promise<boolean>;
+export declare const requestAllowedStatus: () => Promise<boolean>;
+export declare const setAllowedStatus: () => Promise<boolean>;
+export declare const requestUserInfo: () => Promise<UserInfo>;
diff --git a/src/external/stellar-freighter-api/@shared/api/helpers/extensionMessaging.d.ts b/src/external/stellar-freighter-api/@shared/api/helpers/extensionMessaging.d.ts
new file mode 100644
index 0000000..1aed2d8
--- /dev/null
+++ b/src/external/stellar-freighter-api/@shared/api/helpers/extensionMessaging.d.ts
@@ -0,0 +1,9 @@
+import { EXTERNAL_SERVICE_TYPES, SERVICE_TYPES } from "../../constants/services";
+import { Response } from "../types";
+interface Msg {
+ [key: string]: any;
+ type: EXTERNAL_SERVICE_TYPES | SERVICE_TYPES;
+}
+export declare const sendMessageToContentScript: (msg: Msg) => Promise<Response>;
+export declare const sendMessageToBackground: (msg: Msg) => Promise<Response>;
+export {};
diff --git a/src/external/stellar-freighter-api/@shared/api/types.d.ts b/src/external/stellar-freighter-api/@shared/api/types.d.ts
new file mode 100644
index 0000000..be44b6a
--- /dev/null
+++ b/src/external/stellar-freighter-api/@shared/api/types.d.ts
@@ -0,0 +1,158 @@
+import BigNumber from "bignumber.js";
+import { Horizon } from "stellar-sdk";
+import { Types } from "@stellar/wallet-sdk";
+import { SERVICE_TYPES, EXTERNAL_SERVICE_TYPES } from "../constants/services";
+import { APPLICATION_STATE } from "../constants/applicationState";
+import { WalletType } from "../constants/hardwareWallet";
+import { NetworkDetails } from "../constants/stellar";
+export declare enum ActionStatus {
+ IDLE = "IDLE",
+ PENDING = "PENDING",
+ SUCCESS = "SUCCESS",
+ ERROR = "ERROR"
+}
+export interface UserInfo {
+ publicKey: string;
+}
+export interface Response {
+ error: string;
+ messagedId: number;
+ applicationState: APPLICATION_STATE;
+ publicKey: string;
+ privateKey: string;
+ hasPrivateKey: boolean;
+ mnemonicPhrase: string;
+ isCorrectPhrase: boolean;
+ confirmedPassword: boolean;
+ password: string;
+ mnemonicPhraseToConfirm: string;
+ recoverMnemonic: string;
+ transaction: {
+ sign: (sourceKeys: {}) => void;
+ };
+ transactionXDR: string;
+ signedTransaction: string;
+ signedBlob: string;
+ signedAuthEntry: string;
+ source: string;
+ type: SERVICE_TYPES;
+ url: string;
+ isDataSharingAllowed: boolean;
+ isTestnet: boolean;
+ isMemoValidationEnabled: boolean;
+ isSafetyValidationEnabled: boolean;
+ isValidatingSafeAssetsEnabled: boolean;
+ isExperimentalModeEnabled: boolean;
+ networkDetails: NetworkDetails;
+ sorobanRpcUrl: string;
+ networksList: NetworkDetails[];
+ allAccounts: Array<Account>;
+ accountName: string;
+ assetCode: string;
+ assetCanonical: string;
+ iconUrl: string;
+ network: string;
+ networkIndex: number;
+ networkName: string;
+ recentAddresses: Array<string>;
+ hardwareWalletType: WalletType;
+ bipPath: string;
+ blockedDomains: BlockedDomains;
+ blockedAccounts: BlockedAccount[];
+ assetDomain: string;
+ contractId: string;
+ tokenId: string;
+ tokenIdList: string[];
+ isConnected: boolean;
+ isAllowed: boolean;
+ userInfo: UserInfo;
+ allowList: string[];
+}
+export interface BlockedDomains {
+ [key: string]: boolean;
+}
+export interface BlockedAccount {
+ address: string;
+ name: string;
+ domain: string | null;
+ tags: string[];
+}
+export interface ExternalRequestBase {
+ network: string;
+ networkPassphrase: string;
+ accountToSign: string;
+ type: EXTERNAL_SERVICE_TYPES;
+}
+export interface ExternalRequestTx extends ExternalRequestBase {
+ transactionXdr: string;
+}
+export interface ExternalRequestBlob extends ExternalRequestBase {
+ blob: string;
+}
+export interface ExternalRequestAuthEntry extends ExternalRequestBase {
+ entryXdr: string;
+}
+export declare type ExternalRequest = ExternalRequestTx | ExternalRequestBlob | ExternalRequestAuthEntry;
+export interface Account {
+ publicKey: string;
+ name: string;
+ imported: boolean;
+ hardwareWalletType?: WalletType;
+}
+export declare enum AccountType {
+ HW = "HW",
+ IMPORTED = "IMPORTED",
+ FREIGHTER = "FREIGHTER"
+}
+export interface Preferences {
+ isDataSharingAllowed: boolean;
+ isMemoValidationEnabled: boolean;
+ isSafetyValidationEnabled: boolean;
+ isValidatingSafeAssetsEnabled: boolean;
+ networksList: NetworkDetails[];
+ error: string;
+ isExperimentalModeEnabled: boolean;
+}
+export declare type Settings = {
+ allowList: string[];
+ networkDetails: NetworkDetails;
+ networksList: NetworkDetails[];
+ error: string;
+} & Preferences;
+export interface AssetIcons {
+ [code: string]: string;
+}
+export interface AssetDomains {
+ [code: string]: string;
+}
+export declare type Balances = Types.BalanceMap | null;
+export interface SorobanBalance {
+ contractId: string;
+ total: BigNumber;
+ name: string;
+ symbol: string;
+ decimals: number;
+}
+export declare type AssetType = Types.AssetBalance | Types.NativeBalance | SorobanBalance;
+export declare type TokenBalances = SorobanBalance[];
+export declare type HorizonOperation = any;
+export interface AccountBalancesInterface {
+ balances: Balances;
+ isFunded: boolean | null;
+ subentryCount: number;
+}
+export interface AccountHistoryInterface {
+ operations: Array<HorizonOperation> | [];
+}
+export interface ErrorMessage {
+ errorMessage: string;
+ response?: Horizon.ErrorResponseData.TransactionFailed;
+}
+declare global {
+ interface Window {
+ freighter: boolean;
+ freighterApi: {
+ [key: string]: any;
+ };
+ }
+}