
Developers
GM Wallet SDK
The official SDK to connect a web dApp to the GM Wallet app and request signatures and transactions. Desktop shows a QR code; mobile opens the app directly.
Install
Quick start — connect
app.ts
import { createWalletSDK } from "@mammothlabs/gmwallet-sdk";
const sdk = createWalletSDK({
name: "My dApp", // shown in the wallet approval sheet
url: "https://mydapp.com", // your site origin (used for the verified-site check)
icons: "https://mydapp.com/icon.png",
isMainnet: true, // true = 체인 ID 8989
});
const res = await sdk.connect({ theme: "dark" });
if (res.success) {
console.log("connected:", sdk.getState().address);
} else {
console.error(res.error);
}Main methods
connect()
Connect the wallet. Waits until the user approves in the app (up to 5 minutes).
personal_sign()
Sign a message, e.g. for sign-in. No funds move.
eth_sendTransaction()
Send GMMT or call a contract. The app decodes the request and asks the user to approve.
eth_signTypedDataV4()
EIP-712 typed-data signature.
getState() · disconnect()
Connection state, address, last tx hash; disconnect.
Sign a message (sign-in)
const { address } = sdk.getState();
const res = await sdk.personal_sign(address!, "Sign in to My dApp\nNonce: 7f21c0a9", "Sign in");
if (res.success) {
const signature = sdk.getState().signHash; // verify on your server by recovering the address
}Send a transaction
value is a string in GMMT units: "1" means 1 GMMT, not wei.
// value is a string in GMMT units: "1" = 1 GMMT, "0.5" = 0.5 GMMT (not wei)
const res = await sdk.eth_sendTransaction(address!, "0xRecipient…", "0.5");
if (res.success) console.log("tx:", sdk.getState().tx);
// contract call: value "0" + rawData (ABI-encoded call)
await sdk.eth_sendTransaction(address!, tokenAddress, "0", encodedCallData);Typed data (EIP-712)
await sdk.eth_signTypedDataV4(address!, {
domain: { name: "My dApp", version: "1", chainId: "8989", verifyingContract: "0x…" },
primaryType: "Order",
types: {
EIP712Domain: [
{ name: "name", type: "string" },
{ name: "version", type: "string" },
{ name: "chainId", type: "uint256" },
{ name: "verifyingContract", type: "address" },
],
Order: [{ name: "amount", type: "uint256" }],
},
message: { amount: "1000000000000000000" },
});What users see
- The connect sheet shows your site name and URL, whether it is a verified site, and what the site can and cannot do.
- If you request an unlimited token approval, the app defaults to allowing only the user’s current balance.
- Permit-style signatures (EIP-2612) show a red warning. Request them only when you must.
- Every call returns { success, data, error } instead of throwing.