Skip to content

Commit 2f877f9

Browse files
committed
feat: add MetaMask wallet module
Adds a MetaMask module for the Stellar Wallets Kit using the MetaMask Multichain API. Supports connect, signTransaction, signAuthEntry, and signMessage via stellar:pubnet and stellar:testnet CAIP-2 scopes. Also adds MetaMask to defaultModules and sep43Modules.
1 parent a5b29ec commit 2f877f9

4 files changed

Lines changed: 34 additions & 54 deletions

File tree

src/deno.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
"@twind/preset-tailwind": "npm:@twind/preset-tailwind@1.1.4",
3030
"@walletconnect/sign-client": "npm:@walletconnect/sign-client@2.23.0",
3131
"@walletconnect/types": "npm:@walletconnect/types@2.23.9",
32+
"@metamask/multichain-api-client": "npm:@metamask/multichain-api-client@^0.11.0",
33+
"@metamask/connect-stellar": "npm:@metamask/connect-stellar@^0.2.0",
3234
"htm": "npm:htm@3.1.1",
3335
"preact": "npm:preact@^10.29.0"
3436
},
@@ -51,6 +53,7 @@
5153
"./modules/trezor": "./sdk/modules/trezor.module.ts",
5254
"./modules/wallet-connect": "./sdk/modules/wallet-connect.module.ts",
5355
"./modules/xbull": "./sdk/modules/xbull.module.ts",
56+
"./modules/metamask": "./sdk/modules/metamask.module.ts",
5457
"./modules/utils": "./sdk/modules/utils.ts"
5558
},
5659
"fmt": {

src/deno.lock

Lines changed: 27 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/sdk/modules/metamask.module.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { MetaMaskModule, METAMASK_ID } from "@metamask/connect-stellar";

src/sdk/modules/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { RabetModule } from "./rabet.module.ts";
66
import { xBullModule } from "./xbull.module.ts";
77
import { HanaModule } from "./hana.module.ts";
88
import { KleverModule } from "./klever.module.ts";
9+
import { MetaMaskModule } from "./metamask.module.ts";
910
import { OneKeyModule } from "./onekey.module.ts";
1011
import { BitgetModule } from "./bitget.module.ts";
1112

@@ -29,6 +30,7 @@ export function defaultModules(opts?: {
2930
new KleverModule(),
3031
new OneKeyModule(),
3132
new BitgetModule(),
33+
new MetaMaskModule(),
3234
];
3335
return opts?.filterBy ? modules.filter(opts.filterBy) : modules;
3436
}
@@ -41,6 +43,6 @@ export function defaultModules(opts?: {
4143
* If your module requires some extra polyfill or configuration then the user of the kit needs to include it manually.
4244
*/
4345
export function sep43Modules(opts?: { filterBy: (module: ModuleInterface) => boolean }): ModuleInterface[] {
44-
const modules: ModuleInterface[] = [new FreighterModule()];
46+
const modules: ModuleInterface[] = [new FreighterModule(), new MetaMaskModule()];
4547
return opts?.filterBy ? modules.filter(opts.filterBy) : modules;
4648
}

0 commit comments

Comments
 (0)