UNPKG

@creit.tech/stellar-wallets-kit

Version:
1 lines 7.07 kB
{"version":3,"file":"types.cjs","sources":["../src/types.ts"],"sourcesContent":["export interface IModalTheme {\n bgColor: string;\n textColor: string;\n solidTextColor: string;\n headerButtonColor: string;\n dividerColor: string;\n helpBgColor: string;\n notAvailableTextColor: string;\n notAvailableBgColor: string;\n notAvailableBorderColor: string;\n}\n\n/**\n * @deprecated - This type is deprecated, use `IModalTheme` instead\n */\nexport type ITheme = IModalTheme;\n\nexport interface IButtonTheme {\n bgColor: string;\n textColor: string;\n solidTextColor: string;\n dividerColor: string;\n buttonPadding: string;\n buttonBorderRadius: string;\n}\n\nexport enum WalletNetwork {\n PUBLIC = 'Public Global Stellar Network ; September 2015',\n TESTNET = 'Test SDF Network ; September 2015',\n FUTURENET = 'Test SDF Future Network ; October 2022',\n SANDBOX = 'Local Sandbox Stellar Network ; September 2022',\n STANDALONE = 'Standalone Network ; February 2017',\n}\n\nexport enum ModuleType {\n HW_WALLET = 'HW_WALLET',\n HOT_WALLET = 'HOT_WALLET',\n BRIDGE_WALLET = 'BRIDGE_WALLET',\n AIR_GAPED_WALLET = 'AIR_GAPED_WALLET',\n}\n\nexport interface ISupportedWallet {\n id: string;\n name: string;\n type: string;\n isAvailable: boolean;\n icon: string;\n url: string;\n}\n\n/**\n * The Kit Actions are the methods the kit use to interact with the Wallet/Service\n */\nexport interface KitActions {\n /**\n * Function used to request the public key from the active account or\n * specific path on a wallet.\n *\n * @param params\n * @param params.path - The path to tell the wallet which position to ask. This is commonly used in hardware wallets.\n *\n * @return Promise<{ address: string }>\n */\n getAddress(params?: { path?: string }): Promise<{ address: string }>;\n\n /**\n * A function to request a wallet to sign a built transaction in its XDR mode\n *\n * @param xdr - A Transaction or a FeeBumpTransaction\n * @param opts - Options compatible with https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0043.md#signtransaction\n * @param opts.networkPassphrase - The Stellar network to use when signing\n * @param opts.address - The public key of the account that should be used to sign\n * @param opts.path - This options is added for special cases like Hardware wallets\n *\n * @return Promise<{ signedTxXdr: string; signerAddress: string }>\n */\n signTransaction(\n xdr: string,\n opts?: {\n networkPassphrase?: string;\n address?: string;\n path?: string;\n submit?: boolean;\n submitUrl?: string;\n }\n ): Promise<{ signedTxXdr: string; signerAddress?: string }>;\n\n /**\n * A function to request a wallet to sign an AuthEntry XDR.\n *\n * @param authEntry - An XDR string version of `HashIdPreimageSorobanAuthorization`\n * @param opts - Options compatible with https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0043.md#signauthentry\n * @param opts.networkPassphrase - The Stellar network to use when signing\n * @param opts.address - The public key of the account that should be used to sign\n * @param opts.path - This options is added for special cases like Hardware wallets\n *\n * @return - Promise<{ signedAuthEntry: string; signerAddress: string }>\n */\n signAuthEntry(\n authEntry: string,\n opts?: {\n networkPassphrase?: string;\n address?: string;\n path?: string;\n }\n ): Promise<{ signedAuthEntry: string; signerAddress?: string }>;\n\n /**\n * A function to request a wallet to sign an AuthEntry XDR.\n *\n * @param message - An arbitrary string rather than a transaction or auth entry\n * @param opts - Options compatible with https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0043.md#signmessage\n * @param opts.networkPassphrase - The Stellar network to use when signing\n * @param opts.address - The public key of the account that should be used to sign\n * @param opts.path - This options is added for special cases like Hardware wallets\n *\n * @return - Promise<{ signedMessage: string; signerAddress: string }>\n */\n signMessage(\n message: string,\n opts?: {\n networkPassphrase?: string;\n address?: string;\n path?: string;\n }\n ): Promise<{ signedMessage: string; signerAddress?: string }>;\n\n /**\n * A function to request the current selected network in the wallet. This comes\n * handy when you are dealing with a wallet that doesn't allow you to specify which network to use (For example Lobstr and Rabet)\n *\n * @return - Promise<{ network: string; networkPassphrase: string }>\n */\n getNetwork(): Promise<{ network: string; networkPassphrase: string }>;\n\n /**\n * This method should be included if your wallet have some sort of async connection, for example WalletConnect\n * Once this method is called, the module should clear all connections\n */\n disconnect?(): Promise<void>;\n}\n\n/**\n * A module is a \"plugin\" we can use within the kit so is able to handle a\n * specific type of wallet/service. There are some modules that are already\n * in the kit but any wallet developer can create their own plugins\n */\nexport interface ModuleInterface extends KitActions {\n /**\n * The Module type is used for filtering purposes, define the correct one in\n * your module so we display it accordingly\n */\n moduleType: ModuleType;\n\n /**\n * This ID of the module, you should expose this ID as a constant variable\n * so developers can use it to show/filter this module if they need to.\n */\n productId: string;\n\n /**\n * This is the name the kit will show in the builtin Modal.\n */\n productName: string;\n\n /**\n * This is the URL where users can either download, buy and just know how to\n * get the product.\n */\n productUrl: string;\n\n /**\n * This icon will be displayed in the builtin Modal along with the product name.\n */\n productIcon: string;\n\n /**\n * This function should return true is the wallet is installed and/or available.\n * If for example this wallet/service doesn't need to be installed to be used,\n * return `true`.\n *\n * Important:\n * Your wallet/library needs to be able to answer this function in less than 500ms.\n * Otherwise, the kit will show it as unavailable\n *\n */\n isAvailable(): Promise<boolean>;\n}\n"],"names":["WalletNetwork","ModuleType"],"mappings":";;AA0BYA;AAAZ,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,QAAA,CAAA,GAAA,gDAAyD;AACzD,IAAA,aAAA,CAAA,SAAA,CAAA,GAAA,mCAA6C;AAC7C,IAAA,aAAA,CAAA,WAAA,CAAA,GAAA,wCAAoD;AACpD,IAAA,aAAA,CAAA,SAAA,CAAA,GAAA,gDAA0D;AAC1D,IAAA,aAAA,CAAA,YAAA,CAAA,GAAA,oCAAiD;AACnD,CAAC,EANWA,qBAAa,KAAbA,qBAAa,GAMxB,EAAA,CAAA,CAAA;AAEWC;AAAZ,CAAA,UAAY,UAAU,EAAA;AACpB,IAAA,UAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,UAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,UAAA,CAAA,eAAA,CAAA,GAAA,eAA+B;AAC/B,IAAA,UAAA,CAAA,kBAAA,CAAA,GAAA,kBAAqC;AACvC,CAAC,EALWA,kBAAU,KAAVA,kBAAU,GAKrB,EAAA,CAAA,CAAA;;"}