@megaeth-labs/wallet-sdk 0.1.20 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,6 +33,8 @@
33
33
  - [Open Wallet UI](#open-wallet-ui)
34
34
  - [Deposit Funds](#deposit-funds)
35
35
  - [Event Handling](#event-handling)
36
+ - [Testing Locally](#testing-locally)
37
+ - [Publishing](#publishing)
36
38
 
37
39
  ## Install
38
40
 
@@ -268,10 +270,6 @@ import { parseEther } from 'viem';
268
270
  const result = await mega.grantPermissions({
269
271
  permissions: {
270
272
  expiry: 86400, // Expiry in seconds (24 hours)
271
- feeToken: {
272
- limit: parseEther('0.01').toString(), // Max fee allowed per transaction
273
- symbol: 'ETH', // Optional: Fee token symbol
274
- },
275
273
  permissions: {
276
274
  // Specific contract calls allowed
277
275
  calls: [
@@ -458,4 +456,18 @@ mega.events.on('statusChange', ({ status, address }) => {
458
456
  // Stop listening
459
457
  const unsubscribe = mega.events.on('statusChange', handler);
460
458
  unsubscribe(); // Call to remove listener
461
- ```
459
+ ```
460
+
461
+ ## Testing Locally
462
+ - Link locally: `pnpm link`
463
+ - Run build with watch: `pnpm dev`
464
+ - In another project run: `pnpm link @megaeth-labs/wallet-sdk`
465
+ - Restart the other project dev server to ensure the link is working
466
+
467
+ **Caution:** A pnpm workspace file will be created in the other project. Make sure to remove this file and run `pnpm i` before committing otherwise CI will fail.
468
+
469
+ ## Publishing
470
+ - Create a PR
471
+ - Merge to `main`
472
+ - When ready, open GitHub and click Run Workflow on the `Publish to npm` job
473
+ https://github.com/megaeth-labs/wallet-sdk/actions/workflows/publish.yml
package/dist/index.cjs CHANGED
@@ -56,14 +56,17 @@ var WALLET_URL = "https://account.megaeth.com";
56
56
  var LOCAL_WALLET_URL = "http://localhost:4000";
57
57
  var LOCAL_HTTPS_WALLET_URL = "https://wallet.local:4000";
58
58
  var STAGING_WALLET_URL = "https://account-git-staging-mega-eth.vercel.app";
59
+ var SANDBOX_WALLET_URL = "https://account-sandbox.megaeth.com";
59
60
 
60
61
  // src/helpers.ts
61
62
  var getWalletUrl = (config) => {
62
63
  let origin = WALLET_URL;
63
- if (config.devMode) {
64
+ if (config.devLocal) {
64
65
  origin = config.devHTTPS ? LOCAL_HTTPS_WALLET_URL : LOCAL_WALLET_URL;
65
66
  } else if (config.staging) {
66
67
  origin = STAGING_WALLET_URL;
68
+ } else if (config.devMode) {
69
+ origin = SANDBOX_WALLET_URL;
67
70
  }
68
71
  const params = [
69
72
  `network=${config.network}`,
package/dist/index.d.cts CHANGED
@@ -7,6 +7,7 @@ interface Config {
7
7
  logging?: LogLevel;
8
8
  devMode?: boolean;
9
9
  devHTTPS?: boolean;
10
+ devLocal?: boolean;
10
11
  staging?: boolean;
11
12
  debug?: boolean;
12
13
  sponsorUrl?: string;
@@ -17,6 +18,7 @@ type ConnectionStatus = {
17
18
  status: 'connected' | 'disconnected' | 'cancelled';
18
19
  address?: `0x${string}`;
19
20
  network: Network;
21
+ megaName?: string;
20
22
  };
21
23
  interface TransferRequest {
22
24
  amount: string;
@@ -127,7 +129,8 @@ interface RemoteAPI {
127
129
  interface Permission {
128
130
  id?: string;
129
131
  expiry: number;
130
- feeToken: {
132
+ /** @deprecated No longer used — the gas token is taken from the granted session permissions */
133
+ feeToken?: {
131
134
  limit: string;
132
135
  symbol?: string;
133
136
  };
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ interface Config {
7
7
  logging?: LogLevel;
8
8
  devMode?: boolean;
9
9
  devHTTPS?: boolean;
10
+ devLocal?: boolean;
10
11
  staging?: boolean;
11
12
  debug?: boolean;
12
13
  sponsorUrl?: string;
@@ -17,6 +18,7 @@ type ConnectionStatus = {
17
18
  status: 'connected' | 'disconnected' | 'cancelled';
18
19
  address?: `0x${string}`;
19
20
  network: Network;
21
+ megaName?: string;
20
22
  };
21
23
  interface TransferRequest {
22
24
  amount: string;
@@ -127,7 +129,8 @@ interface RemoteAPI {
127
129
  interface Permission {
128
130
  id?: string;
129
131
  expiry: number;
130
- feeToken: {
132
+ /** @deprecated No longer used — the gas token is taken from the granted session permissions */
133
+ feeToken?: {
131
134
  limit: string;
132
135
  symbol?: string;
133
136
  };
package/dist/index.js CHANGED
@@ -20,14 +20,17 @@ var WALLET_URL = "https://account.megaeth.com";
20
20
  var LOCAL_WALLET_URL = "http://localhost:4000";
21
21
  var LOCAL_HTTPS_WALLET_URL = "https://wallet.local:4000";
22
22
  var STAGING_WALLET_URL = "https://account-git-staging-mega-eth.vercel.app";
23
+ var SANDBOX_WALLET_URL = "https://account-sandbox.megaeth.com";
23
24
 
24
25
  // src/helpers.ts
25
26
  var getWalletUrl = (config) => {
26
27
  let origin = WALLET_URL;
27
- if (config.devMode) {
28
+ if (config.devLocal) {
28
29
  origin = config.devHTTPS ? LOCAL_HTTPS_WALLET_URL : LOCAL_WALLET_URL;
29
30
  } else if (config.staging) {
30
31
  origin = STAGING_WALLET_URL;
32
+ } else if (config.devMode) {
33
+ origin = SANDBOX_WALLET_URL;
31
34
  }
32
35
  const params = [
33
36
  `network=${config.network}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megaeth-labs/wallet-sdk",
3
- "version": "0.1.20",
3
+ "version": "0.1.23",
4
4
  "description": "MegaETH Wallet SDK for web applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -32,7 +32,7 @@
32
32
  "sideEffects": false,
33
33
  "publishConfig": {
34
34
  "registry": "https://registry.npmjs.org/",
35
- "access": "restricted"
35
+ "access": "public"
36
36
  },
37
37
  "dependencies": {
38
38
  "penpal": "7.0.6"