Skip to content

Commit 65e6a9c

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 bd1c771 commit 65e6a9c

4 files changed

Lines changed: 34 additions & 53 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
},
@@ -53,6 +55,7 @@
5355
"./modules/wallet-connect": "./sdk/modules/wallet-connect.module.ts",
5456
"./modules/xbull": "./sdk/modules/xbull.module.ts",
5557
"./modules/cactuslink": "./sdk/modules/cactuslink.module.ts",
58+
"./modules/metamask": "./sdk/modules/metamask.module.ts",
5659
"./modules/utils": "./sdk/modules/utils.ts"
5760
},
5861
"fmt": {

src/deno.lock

Lines changed: 27 additions & 52 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
import { FordefiModule } from "./fordefi.module.ts";
@@ -33,6 +34,7 @@ export function defaultModules(opts?: {
3334
new OneKeyModule(),
3435
new BitgetModule(),
3536
new CactusLinkModule(),
37+
new MetaMaskModule(),
3638
];
3739
return opts?.filterBy ? modules.filter(opts.filterBy) : modules;
3840
}
@@ -45,6 +47,6 @@ export function defaultModules(opts?: {
4547
* If your module requires some extra polyfill or configuration then the user of the kit needs to include it manually.
4648
*/
4749
export function sep43Modules(opts?: { filterBy: (module: ModuleInterface) => boolean }): ModuleInterface[] {
48-
const modules: ModuleInterface[] = [new FreighterModule()];
50+
const modules: ModuleInterface[] = [new FreighterModule(), new MetaMaskModule()];
4951
return opts?.filterBy ? modules.filter(opts.filterBy) : modules;
5052
}

0 commit comments

Comments
 (0)