Skip to content

Commit b2e74b0

Browse files
author
Enrique A.
committed
Merge branch 'main' of github.com:Creit-Tech/Stellar-Wallets-Kit
2 parents cf76789 + db4737a commit b2e74b0

5 files changed

Lines changed: 88 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ out the [documentation](https://stellarwalletskit.dev/) for more details.
6363
- Hana
6464
- Hot Wallet
6565
- Klever Wallet
66+
- OneKey Wallet
6667

6768
## Installation and usage
6869

docs/files/wallets/supported-wallets.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ These are the current supported wallets/modules:
1515
| xBull | xBullModule | /xbull | Yes |
1616
| HOT | HotWalletModule | /hotwallet | No |
1717
| Klever | KleverModule | /klever | Yes |
18+
| OneKey | OneKeyModule | /onekey | Yes |
1819

1920
## How to import a wallet's module?
2021

src/build_npm.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ await build({
5252
name: "./modules/lobstr",
5353
path: "./sdk/modules/lobstr.module.ts",
5454
},
55+
{
56+
name: "./modules/onekey",
57+
path: "./sdk/modules/onekey.module.ts",
58+
},
5559
{
5660
name: "./modules/rabet",
5761
path: "./sdk/modules/rabet.module.ts",

src/deno.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"./modules/klever": "./sdk/modules/klever.module.ts",
4646
"./modules/ledger": "./sdk/modules/ledger.module.ts",
4747
"./modules/lobstr": "./sdk/modules/lobstr.module.ts",
48+
"./modules/onekey": "./sdk/modules/onekey.module.ts",
4849
"./modules/rabet": "./sdk/modules/rabet.module.ts",
4950
"./modules/trezor": "./sdk/modules/trezor.module.ts",
5051
"./modules/wallet-connect": "./sdk/modules/wallet-connect.module.ts",
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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+
}

0 commit comments

Comments
 (0)