genlayer-js 0.14.1 → 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 +9 -0
- package/dist/index.cjs +8 -3
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -3
- package/package.json +1 -1
- package/src/client/client.ts +7 -2
- package/src/contracts/actions.ts +1 -0
- package/src/global.d.ts +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
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
|
+
|
|
10
|
+
## 0.14.2 (2025-08-14)
|
|
11
|
+
|
|
3
12
|
## 0.14.1 (2025-08-13)
|
|
4
13
|
|
|
5
14
|
## 0.14.0 (2025-07-30)
|
package/dist/index.cjs
CHANGED
|
@@ -597,7 +597,8 @@ var _sendTransaction = async ({
|
|
|
597
597
|
from: transactionRequest.from,
|
|
598
598
|
to: transactionRequest.to,
|
|
599
599
|
data: encodedData,
|
|
600
|
-
value: transactionRequest.value ? `0x${transactionRequest.value.toString(16)}` : "0x0"
|
|
600
|
+
value: transactionRequest.value ? `0x${transactionRequest.value.toString(16)}` : "0x0",
|
|
601
|
+
gas: transactionRequest.gas ? `0x${transactionRequest.gas.toString(16)}` : "0x5208"
|
|
601
602
|
};
|
|
602
603
|
return await client.request({
|
|
603
604
|
method: "eth_sendTransaction",
|
|
@@ -1126,9 +1127,13 @@ var getCustomTransportConfig = (config) => {
|
|
|
1126
1127
|
async request({ method, params = [] }) {
|
|
1127
1128
|
if (method.startsWith("eth_") && isAddress) {
|
|
1128
1129
|
try {
|
|
1129
|
-
|
|
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 });
|
|
1130
1135
|
} catch (err) {
|
|
1131
|
-
console.warn(`Error using
|
|
1136
|
+
console.warn(`Error using provider for method ${method}:`, err);
|
|
1132
1137
|
throw err;
|
|
1133
1138
|
}
|
|
1134
1139
|
} else {
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -597,7 +597,8 @@ var _sendTransaction = async ({
|
|
|
597
597
|
from: transactionRequest.from,
|
|
598
598
|
to: transactionRequest.to,
|
|
599
599
|
data: encodedData,
|
|
600
|
-
value: transactionRequest.value ? `0x${transactionRequest.value.toString(16)}` : "0x0"
|
|
600
|
+
value: transactionRequest.value ? `0x${transactionRequest.value.toString(16)}` : "0x0",
|
|
601
|
+
gas: transactionRequest.gas ? `0x${transactionRequest.gas.toString(16)}` : "0x5208"
|
|
601
602
|
};
|
|
602
603
|
return await client.request({
|
|
603
604
|
method: "eth_sendTransaction",
|
|
@@ -1126,9 +1127,13 @@ var getCustomTransportConfig = (config) => {
|
|
|
1126
1127
|
async request({ method, params = [] }) {
|
|
1127
1128
|
if (method.startsWith("eth_") && isAddress) {
|
|
1128
1129
|
try {
|
|
1129
|
-
|
|
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 });
|
|
1130
1135
|
} catch (err) {
|
|
1131
|
-
console.warn(`Error using
|
|
1136
|
+
console.warn(`Error using provider for method ${method}:`, err);
|
|
1132
1137
|
throw err;
|
|
1133
1138
|
}
|
|
1134
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/contracts/actions.ts
CHANGED
|
@@ -256,6 +256,7 @@ const _sendTransaction = async ({
|
|
|
256
256
|
to: transactionRequest.to,
|
|
257
257
|
data: encodedData,
|
|
258
258
|
value: transactionRequest.value ? `0x${transactionRequest.value.toString(16)}` : "0x0",
|
|
259
|
+
gas: transactionRequest.gas ? `0x${transactionRequest.gas.toString(16)}` : "0x5208",
|
|
259
260
|
};
|
|
260
261
|
|
|
261
262
|
return await client.request({
|
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
|
}
|