genlayer-js 0.6.3 → 0.6.4

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 CHANGED
@@ -1,5 +1,12 @@
1
1
 
2
2
 
3
+ ## 0.6.4 (2025-02-04)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * override chain endpoint if extra config provided ([#68](https://github.com/yeagerai/genlayer-js/issues/68)) ([215185a](https://github.com/yeagerai/genlayer-js/commit/215185a4f96d44a60ea1ad4b55c71bd0bdc489f6))
9
+
3
10
  ## 0.6.3 (2025-01-28)
4
11
 
5
12
  ## 0.6.2 (2025-01-20)
package/dist/index.cjs CHANGED
@@ -575,7 +575,9 @@ function chainActions(client) {
575
575
  // src/client/client.ts
576
576
  var createClient = (config = { chain: _chunkXAQMWSP4cjs.simulator }) => {
577
577
  const chainConfig = config.chain || _chunkXAQMWSP4cjs.simulator;
578
- const rpcUrl = config.endpoint || chainConfig.rpcUrls.default.http[0];
578
+ if (config.endpoint) {
579
+ chainConfig.rpcUrls.default.http = [config.endpoint];
580
+ }
579
581
  const isAddress = typeof config.account !== "object";
580
582
  const customTransport = {
581
583
  async request({ method, params }) {
@@ -588,7 +590,7 @@ var createClient = (config = { chain: _chunkXAQMWSP4cjs.simulator }) => {
588
590
  }
589
591
  } else {
590
592
  try {
591
- const response = await fetch(rpcUrl, {
593
+ const response = await fetch(chainConfig.rpcUrls.default.http[0], {
592
594
  method: "POST",
593
595
  headers: {
594
596
  "Content-Type": "application/json"
package/dist/index.js CHANGED
@@ -575,7 +575,9 @@ function chainActions(client) {
575
575
  // src/client/client.ts
576
576
  var createClient = (config = { chain: simulator }) => {
577
577
  const chainConfig = config.chain || simulator;
578
- const rpcUrl = config.endpoint || chainConfig.rpcUrls.default.http[0];
578
+ if (config.endpoint) {
579
+ chainConfig.rpcUrls.default.http = [config.endpoint];
580
+ }
579
581
  const isAddress = typeof config.account !== "object";
580
582
  const customTransport = {
581
583
  async request({ method, params }) {
@@ -588,7 +590,7 @@ var createClient = (config = { chain: simulator }) => {
588
590
  }
589
591
  } else {
590
592
  try {
591
- const response = await fetch(rpcUrl, {
593
+ const response = await fetch(chainConfig.rpcUrls.default.http[0], {
592
594
  method: "POST",
593
595
  headers: {
594
596
  "Content-Type": "application/json"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "genlayer-js",
3
3
  "type": "module",
4
- "version": "0.6.3",
4
+ "version": "0.6.4",
5
5
  "description": "GenLayer JavaScript SDK",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -21,7 +21,9 @@ interface ClientConfig {
21
21
 
22
22
  export const createClient = (config: ClientConfig = {chain: simulator}) => {
23
23
  const chainConfig = config.chain || simulator;
24
- const rpcUrl = config.endpoint || chainConfig.rpcUrls.default.http[0];
24
+ if (config.endpoint) {
25
+ chainConfig.rpcUrls.default.http = [config.endpoint];
26
+ }
25
27
  const isAddress = typeof config.account !== "object";
26
28
 
27
29
  const customTransport = {
@@ -35,7 +37,7 @@ export const createClient = (config: ClientConfig = {chain: simulator}) => {
35
37
  }
36
38
  } else {
37
39
  try {
38
- const response = await fetch(rpcUrl, {
40
+ const response = await fetch(chainConfig.rpcUrls.default.http[0], {
39
41
  method: "POST",
40
42
  headers: {
41
43
  "Content-Type": "application/json",