@megaeth-labs/wallet-sdk 0.1.16-beta.1 → 0.1.16

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
@@ -182,23 +182,6 @@ if (result.status === 'approved') {
182
182
  }
183
183
  ```
184
184
 
185
- ### Call Contract Method (Large Payload)
186
- If you are calling a contract method with a large payload (e.g. deploying a contract via a factory), you can override the default max gas spending limit.
187
-
188
- ```typescript
189
- const result = await mega.callContract({
190
- address: '0xContractAddress',
191
- abi: contractABI,
192
- functionName: 'deplosy',
193
- args: [],
194
- maxGasAllowance: parseEther('0.0005')
195
- });
196
-
197
- if (result.status === 'approved') {
198
- console.log('Transaction hash:', result.receipt.hash);
199
- }
200
- ```
201
-
202
185
  ### Silent Contract Call (Session Keys)
203
186
  Execute a contract method silently using session key permissions (no user approval required).
204
187
 
package/dist/index.cjs CHANGED
@@ -56,16 +56,28 @@ var WALLET_URL = "https://account.megaeth.com";
56
56
  var LOCAL_WALLET_URL = "http://localhost:4000";
57
57
 
58
58
  // src/helpers.ts
59
+ var param = (key, value) => value !== void 0 && value !== "" ? `${key}=${encodeURIComponent(String(value))}` : void 0;
59
60
  var getWalletUrl = (config) => {
60
- const origin = config.devMode ? LOCAL_WALLET_URL : WALLET_URL;
61
- const params = [
62
- `network=${config.network}`,
63
- ...config.sponsorUrl ? [`sponsorUrl=${config.sponsorUrl}`] : [],
64
- ...config.sponsorMode ? [`sponsorMode=${config.sponsorMode}`] : [],
65
- ...config.sponsorToken ? [`sponsorToken=${config.sponsorToken}`] : [],
66
- ...config.debug ? [`debug=${config.debug}`] : [],
67
- ...config.logging ? [`logging=${config.logging}`] : []
61
+ const origin = (() => {
62
+ if (config.devMode) {
63
+ if (config.walletOriginUrl) return config.walletOriginUrl;
64
+ return LOCAL_WALLET_URL;
65
+ }
66
+ return WALLET_URL;
67
+ })();
68
+ const rawParams = [
69
+ param("network", config.network),
70
+ param("sponsorUrl", config.sponsorUrl),
71
+ param("sponsorMode", config.sponsorMode),
72
+ param("sponsorToken", config.sponsorToken),
73
+ param("debug", config.debug),
74
+ param("logging", config.logging)
68
75
  ];
76
+ if (config.devMode) {
77
+ rawParams.push(param("apiUrl", config.apiUrl));
78
+ rawParams.push(param("relayerUrl", config.relayerUrl));
79
+ }
80
+ const params = rawParams.filter((value) => Boolean(value));
69
81
  return {
70
82
  origin,
71
83
  uiUrl: `${origin}?${params.join("&")}`
package/dist/index.d.cts CHANGED
@@ -7,6 +7,9 @@ interface Config {
7
7
  logging?: LogLevel;
8
8
  devMode?: boolean;
9
9
  debug?: boolean;
10
+ walletOriginUrl?: string;
11
+ apiUrl?: string;
12
+ relayerUrl?: string;
10
13
  sponsorUrl?: string;
11
14
  sponsorMode?: SponsorMode;
12
15
  sponsorToken?: SponsorToken;
@@ -34,7 +37,6 @@ interface CallContractRequest {
34
37
  silentUIApproveFallback?: boolean;
35
38
  value?: bigint | string;
36
39
  sponsor?: boolean;
37
- maxGasAllowance?: bigint;
38
40
  }
39
41
  interface GetFromContractRequest {
40
42
  address: `0x${string}`;
package/dist/index.d.ts CHANGED
@@ -7,6 +7,9 @@ interface Config {
7
7
  logging?: LogLevel;
8
8
  devMode?: boolean;
9
9
  debug?: boolean;
10
+ walletOriginUrl?: string;
11
+ apiUrl?: string;
12
+ relayerUrl?: string;
10
13
  sponsorUrl?: string;
11
14
  sponsorMode?: SponsorMode;
12
15
  sponsorToken?: SponsorToken;
@@ -34,7 +37,6 @@ interface CallContractRequest {
34
37
  silentUIApproveFallback?: boolean;
35
38
  value?: bigint | string;
36
39
  sponsor?: boolean;
37
- maxGasAllowance?: bigint;
38
40
  }
39
41
  interface GetFromContractRequest {
40
42
  address: `0x${string}`;
package/dist/index.js CHANGED
@@ -20,16 +20,28 @@ var WALLET_URL = "https://account.megaeth.com";
20
20
  var LOCAL_WALLET_URL = "http://localhost:4000";
21
21
 
22
22
  // src/helpers.ts
23
+ var param = (key, value) => value !== void 0 && value !== "" ? `${key}=${encodeURIComponent(String(value))}` : void 0;
23
24
  var getWalletUrl = (config) => {
24
- const origin = config.devMode ? LOCAL_WALLET_URL : WALLET_URL;
25
- const params = [
26
- `network=${config.network}`,
27
- ...config.sponsorUrl ? [`sponsorUrl=${config.sponsorUrl}`] : [],
28
- ...config.sponsorMode ? [`sponsorMode=${config.sponsorMode}`] : [],
29
- ...config.sponsorToken ? [`sponsorToken=${config.sponsorToken}`] : [],
30
- ...config.debug ? [`debug=${config.debug}`] : [],
31
- ...config.logging ? [`logging=${config.logging}`] : []
25
+ const origin = (() => {
26
+ if (config.devMode) {
27
+ if (config.walletOriginUrl) return config.walletOriginUrl;
28
+ return LOCAL_WALLET_URL;
29
+ }
30
+ return WALLET_URL;
31
+ })();
32
+ const rawParams = [
33
+ param("network", config.network),
34
+ param("sponsorUrl", config.sponsorUrl),
35
+ param("sponsorMode", config.sponsorMode),
36
+ param("sponsorToken", config.sponsorToken),
37
+ param("debug", config.debug),
38
+ param("logging", config.logging)
32
39
  ];
40
+ if (config.devMode) {
41
+ rawParams.push(param("apiUrl", config.apiUrl));
42
+ rawParams.push(param("relayerUrl", config.relayerUrl));
43
+ }
44
+ const params = rawParams.filter((value) => Boolean(value));
33
45
  return {
34
46
  origin,
35
47
  uiUrl: `${origin}?${params.join("&")}`
package/package.json CHANGED
@@ -1,68 +1,70 @@
1
1
  {
2
- "name": "@megaeth-labs/wallet-sdk",
3
- "version": "0.1.16-beta.1",
4
- "description": "MegaETH Wallet SDK for web applications",
5
- "type": "module",
6
- "main": "./dist/index.cjs",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js",
13
- "require": "./dist/index.cjs"
2
+ "name": "@megaeth-labs/wallet-sdk",
3
+ "version": "0.1.16",
4
+ "description": "MegaETH Wallet SDK for web applications",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean",
21
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
22
+ "dev:link": "pnpm build && pnpm link --global",
23
+ "test": "vitest",
24
+ "test:ui": "vitest --ui",
25
+ "test:coverage": "vitest --coverage",
26
+ "lint": "biome lint ./src",
27
+ "format": "biome format --write ./src",
28
+ "check": "biome check ./src",
29
+ "typecheck": "tsc --noEmit",
30
+ "prepare": "husky"
31
+ },
32
+ "keywords": [
33
+ "megaeth",
34
+ "wallet",
35
+ "sdk",
36
+ "web3"
37
+ ],
38
+ "author": "",
39
+ "license": "MIT",
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "git+https://github.com/megaeth-labs/wallet-sdk.git"
43
+ },
44
+ "sideEffects": false,
45
+ "publishConfig": {
46
+ "registry": "https://registry.npmjs.org/",
47
+ "access": "restricted"
48
+ },
49
+ "packageManager": "pnpm@10.29.2",
50
+ "dependencies": {
51
+ "penpal": "7.0.6"
52
+ },
53
+ "devDependencies": {
54
+ "@biomejs/biome": "2.4.6",
55
+ "@types/node": "25.3.5",
56
+ "@vitest/coverage-v8": "4.0.18",
57
+ "@vitest/ui": "4.0.18",
58
+ "husky": "^9.1.7",
59
+ "jsdom": "28.1.0",
60
+ "lint-staged": "^16.4.0",
61
+ "tsup": "8.5.1",
62
+ "typescript": "5.9.3",
63
+ "vitest": "4.0.18"
64
+ },
65
+ "lint-staged": {
66
+ "src/**/*.{ts,js,json}": [
67
+ "pnpm format"
68
+ ]
14
69
  }
15
- },
16
- "files": [
17
- "dist"
18
- ],
19
- "keywords": [
20
- "megaeth",
21
- "wallet",
22
- "sdk",
23
- "web3"
24
- ],
25
- "author": "",
26
- "license": "MIT",
27
- "repository": {
28
- "type": "git",
29
- "url": "git+https://github.com/megaeth-labs/wallet-sdk.git"
30
- },
31
- "sideEffects": false,
32
- "publishConfig": {
33
- "registry": "https://registry.npmjs.org/",
34
- "access": "restricted"
35
- },
36
- "dependencies": {
37
- "penpal": "7.0.6"
38
- },
39
- "devDependencies": {
40
- "@biomejs/biome": "2.4.6",
41
- "@types/node": "25.3.5",
42
- "@vitest/coverage-v8": "4.0.18",
43
- "@vitest/ui": "4.0.18",
44
- "husky": "^9.1.7",
45
- "jsdom": "28.1.0",
46
- "lint-staged": "^16.4.0",
47
- "tsup": "8.5.1",
48
- "typescript": "5.9.3",
49
- "vitest": "4.0.18"
50
- },
51
- "lint-staged": {
52
- "src/**/*.{ts,js,json}": [
53
- "pnpm format"
54
- ]
55
- },
56
- "scripts": {
57
- "build": "tsup src/index.ts --format cjs,esm --dts --clean",
58
- "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
59
- "dev:link": "pnpm build && pnpm link --global",
60
- "test": "vitest",
61
- "test:ui": "vitest --ui",
62
- "test:coverage": "vitest --coverage",
63
- "lint": "biome lint ./src",
64
- "format": "biome format --write ./src",
65
- "check": "biome check ./src",
66
- "typecheck": "tsc --noEmit"
67
- }
68
- }
70
+ }