UNPKG

@creit.tech/stellar-wallets-kit

Version:
1 lines 3.61 kB
{"version":3,"file":"xbull.module.cjs","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":["ModuleType","xBullWalletConnect","parseError"],"mappings":";;;;;;AAI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