UNPKG

@creit.tech/stellar-wallets-kit

Version:
1 lines 3.64 kB
{"version":3,"file":"xbull.module.mjs","sources":["../../src/modules/xbull.module.ts"],"sourcesContent":["import { xBullWalletConnect } from '@creit.tech/xbull-wallet-connect';\nimport { ModuleInterface, ModuleType } from '../types';\nimport { parseError } from '../utils';\n\nexport const XBULL_ID = 'xbull';\n\nexport class xBullModule implements ModuleInterface {\n moduleType: ModuleType = ModuleType.HOT_WALLET;\n\n productId: string = XBULL_ID;\n productName: string = 'xBull';\n productUrl: string = 'https://xbull.app';\n productIcon: string = 'https://stellar.creit.tech/wallet-icons/xbull.png';\n\n async isAvailable(): Promise<boolean> {\n return true;\n }\n\n async getAddress(): Promise<{ address: string }> {\n try {\n const bridge: xBullWalletConnect = new xBullWalletConnect();\n const publicKey: string = await bridge.connect();\n bridge.closeConnections();\n return { address: publicKey };\n } catch (e: any) {\n throw parseError(e);\n }\n }\n\n async 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 try {\n const bridge: xBullWalletConnect = new xBullWalletConnect();\n\n const signedXdr: string = await bridge.sign({\n xdr,\n publicKey: opts?.address,\n network: opts?.networkPassphrase,\n });\n\n bridge.closeConnections();\n return { signedTxXdr: signedXdr, signerAddress: opts?.address };\n } catch (e: any) {\n throw parseError(e);\n }\n }\n\n async signAuthEntry(): Promise<{ signedAuthEntry: string; signerAddress?: string }> {\n throw {\n code: -3,\n message: 'xBull does not support the \"signAuthEntry\" function',\n };\n }\n\n async signMessage(): Promise<{ signedMessage: string; signerAddress?: string }> {\n throw {\n code: -3,\n message: 'xBull does not support the \"signMessage\" function',\n };\n }\n\n async getNetwork(): Promise<{ network: string; networkPassphrase: string }> {\n throw {\n code: -3,\n message: 'xBull does not support the \"getNetwork\" function',\n };\n }\n}\n"],"names":[],"mappings":";;;;AAIO,MAAM,QAAW,GAAA;AAEjB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