genlayer-js 0.14.2 → 0.15.0
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/CHANGELOG.md +7 -0
- package/dist/index.cjs +6 -2
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -2
- package/package.json +1 -1
- package/src/client/client.ts +7 -2
- package/src/global.d.ts +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
## 0.15.0 (2025-08-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add custom provider support for wallet framework integration ([#105](https://github.com/genlayerlabs/genlayer-js/issues/105)) ([9fdaf6f](https://github.com/genlayerlabs/genlayer-js/commit/9fdaf6f7b52c58cabe8aee48e31317757be7637b))
|
|
9
|
+
|
|
3
10
|
## 0.14.2 (2025-08-14)
|
|
4
11
|
|
|
5
12
|
## 0.14.1 (2025-08-13)
|
package/dist/index.cjs
CHANGED
|
@@ -1127,9 +1127,13 @@ var getCustomTransportConfig = (config) => {
|
|
|
1127
1127
|
async request({ method, params = [] }) {
|
|
1128
1128
|
if (method.startsWith("eth_") && isAddress) {
|
|
1129
1129
|
try {
|
|
1130
|
-
|
|
1130
|
+
const provider = config.provider || window.ethereum;
|
|
1131
|
+
if (!provider) {
|
|
1132
|
+
throw new Error("No wallet provider available");
|
|
1133
|
+
}
|
|
1134
|
+
return await provider.request({ method, params });
|
|
1131
1135
|
} catch (err) {
|
|
1132
|
-
console.warn(`Error using
|
|
1136
|
+
console.warn(`Error using provider for method ${method}:`, err);
|
|
1133
1137
|
throw err;
|
|
1134
1138
|
}
|
|
1135
1139
|
} else {
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1127,9 +1127,13 @@ var getCustomTransportConfig = (config) => {
|
|
|
1127
1127
|
async request({ method, params = [] }) {
|
|
1128
1128
|
if (method.startsWith("eth_") && isAddress) {
|
|
1129
1129
|
try {
|
|
1130
|
-
|
|
1130
|
+
const provider = config.provider || window.ethereum;
|
|
1131
|
+
if (!provider) {
|
|
1132
|
+
throw new Error("No wallet provider available");
|
|
1133
|
+
}
|
|
1134
|
+
return await provider.request({ method, params });
|
|
1131
1135
|
} catch (err) {
|
|
1132
|
-
console.warn(`Error using
|
|
1136
|
+
console.warn(`Error using provider for method ${method}:`, err);
|
|
1133
1137
|
throw err;
|
|
1134
1138
|
}
|
|
1135
1139
|
} else {
|
package/package.json
CHANGED
package/src/client/client.ts
CHANGED
|
@@ -29,6 +29,7 @@ interface ClientConfig {
|
|
|
29
29
|
};
|
|
30
30
|
endpoint?: string; // Custom RPC endpoint
|
|
31
31
|
account?: Account | Address;
|
|
32
|
+
provider?: EthereumProvider; // Custom provider for wallet framework integration
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
const getCustomTransportConfig = (config: ClientConfig) => {
|
|
@@ -38,9 +39,13 @@ const getCustomTransportConfig = (config: ClientConfig) => {
|
|
|
38
39
|
async request({method, params = []}: {method: string; params: any[]}) {
|
|
39
40
|
if (method.startsWith("eth_") && isAddress) {
|
|
40
41
|
try {
|
|
41
|
-
|
|
42
|
+
const provider = config.provider || window.ethereum;
|
|
43
|
+
if (!provider) {
|
|
44
|
+
throw new Error('No wallet provider available');
|
|
45
|
+
}
|
|
46
|
+
return await provider.request({method, params});
|
|
42
47
|
} catch (err) {
|
|
43
|
-
console.warn(`Error using
|
|
48
|
+
console.warn(`Error using provider for method ${method}:`, err);
|
|
44
49
|
throw err;
|
|
45
50
|
}
|
|
46
51
|
} else {
|
package/src/global.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// global.d.ts
|
|
2
|
+
interface EthereumProvider {
|
|
3
|
+
isMetaMask?: boolean;
|
|
4
|
+
request: (args: {method: string; params?: any}) => Promise<any>;
|
|
5
|
+
}
|
|
6
|
+
|
|
2
7
|
interface Window {
|
|
3
|
-
ethereum?:
|
|
4
|
-
isMetaMask?: boolean;
|
|
5
|
-
request: any
|
|
6
|
-
};
|
|
8
|
+
ethereum?: EthereumProvider;
|
|
7
9
|
}
|