File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { type ModuleInterface , ModuleType } from "../../types/mod.ts" ;
2+
3+ declare global {
4+ interface Window {
5+ bitkeep ?: any ;
6+ }
7+ }
8+
9+ export const BitgetWallet_ID = "bitgetWallet" ;
10+
11+ export class BitgetWalletModule implements ModuleInterface {
12+ moduleType : ModuleType = ModuleType . HOT_WALLET ;
13+ productId : string = BitgetWallet_ID ;
14+ productName : string = "Bitget Wallet" ;
15+ productUrl : string = "https://web3.bitget.com" ;
16+ productIcon : string =
17+ "https://raw.githubusercontent.com/bitgetwallet/download/refs/heads/main/logo/png/small-circle-logo180.png" ;
18+ provider : any ;
19+
20+ constructor ( ) {
21+ this . provider = window . bitkeep ?. stellar ;
22+ }
23+
24+ async isAvailable ( ) {
25+ return ! ! this . provider ;
26+ }
27+ async getAddress ( ) {
28+ const address = await this . provider . connect ( ) ;
29+ return { address } ;
30+ }
31+ async signMessage (
32+ message : string ,
33+ opts ?: {
34+ networkPassphrase ?: string ;
35+ address ?: string ;
36+ path ?: string ;
37+ }
38+ ) {
39+ const signatureHex = await this . provider . signMessage (
40+ message ,
41+ opts ?. address
42+ ) ;
43+
44+ return { signedMessage : signatureHex } ;
45+ }
46+
47+ async signTransaction (
48+ xdr : string ,
49+ opts ?: {
50+ networkPassphrase ?: string ;
51+ address ?: string ;
52+ path ?: string ;
53+ submit ?: boolean ;
54+ submitUrl ?: string ;
55+ }
56+ ) {
57+ const signedTxXdr = await this . provider . signTransaction ( xdr , opts ) ;
58+ return { signedTxXdr } ;
59+ }
60+
61+ async signAuthEntry (
62+ authEntry : string ,
63+ opts ?: {
64+ networkPassphrase ?: string ;
65+ address ?: string ;
66+ path ?: string ;
67+ }
68+ ) : Promise < {
69+ signedAuthEntry : string ;
70+ signerAddress ?: string ;
71+ } > {
72+ throw {
73+ code : - 3 ,
74+ message : `${ this . productName } does not support the "signAuthEntry" function` ,
75+ } ;
76+ }
77+
78+ async getNetwork ( ) {
79+ return this . provider . network ( ) ;
80+ }
81+ }
You can’t perform that action at this time.
0 commit comments