genlayer-js 0.18.3 → 0.18.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.18.4 (2025-11-11)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * differentiate chains using the studio from testnet ([#122](https://github.com/genlayerlabs/genlayer-js/issues/122)) ([1fa8d4c](https://github.com/genlayerlabs/genlayer-js/commit/1fa8d4cd0856d9eb437902f330feb1de4782d112))
9
+
3
10
  ## 0.18.3 (2025-11-03)
4
11
 
5
12
 
@@ -2,10 +2,10 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkZKBMABRAcjs = require('../chunk-ZKBMABRA.cjs');
5
+ var _chunkSMGWE7OHcjs = require('../chunk-SMGWE7OH.cjs');
6
6
  require('../chunk-75ZPJI57.cjs');
7
7
 
8
8
 
9
9
 
10
10
 
11
- exports.localnet = _chunkZKBMABRAcjs.localnet; exports.studionet = _chunkZKBMABRAcjs.studionet; exports.testnetAsimov = _chunkZKBMABRAcjs.testnetAsimov;
11
+ exports.localnet = _chunkSMGWE7OHcjs.localnet; exports.studionet = _chunkSMGWE7OHcjs.studionet; exports.testnetAsimov = _chunkSMGWE7OHcjs.testnetAsimov;
@@ -1,3 +1,3 @@
1
- export { l as localnet, s as studionet, t as testnetAsimov } from '../index-Bw-kn7CF.cjs';
2
- import '../chains-BYSCF33g.cjs';
1
+ export { l as localnet, s as studionet, t as testnetAsimov } from '../index-C5zeayBB.cjs';
2
+ import '../chains-BIe_Q0mF.cjs';
3
3
  import 'viem';
@@ -1,3 +1,3 @@
1
- export { l as localnet, s as studionet, t as testnetAsimov } from '../index-DCzgdyMa.js';
2
- import '../chains-BYSCF33g.js';
1
+ export { l as localnet, s as studionet, t as testnetAsimov } from '../index-BpFWfpio.js';
2
+ import '../chains-BIe_Q0mF.js';
3
3
  import 'viem';
@@ -2,7 +2,7 @@ import {
2
2
  localnet,
3
3
  studionet,
4
4
  testnetAsimov
5
- } from "../chunk-GEN4SJ6K.js";
5
+ } from "../chunk-NO75TOQL.js";
6
6
  import "../chunk-MLKGABMK.js";
7
7
  export {
8
8
  localnet,
@@ -1,6 +1,7 @@
1
1
  import { Chain, Address } from 'viem';
2
2
 
3
3
  type GenLayerChain = Chain & {
4
+ isStudio: boolean;
4
5
  consensusMainContract: {
5
6
  address: Address;
6
7
  abi: any[];
@@ -1,6 +1,7 @@
1
1
  import { Chain, Address } from 'viem';
2
2
 
3
3
  type GenLayerChain = Chain & {
4
+ isStudio: boolean;
4
5
  consensusMainContract: {
5
6
  address: Address;
6
7
  abi: any[];
@@ -3997,6 +3997,7 @@ var CONSENSUS_DATA_CONTRACT = {
3997
3997
  };
3998
3998
  var localnet = defineChain({
3999
3999
  id: 61999,
4000
+ isStudio: true,
4000
4001
  name: "Genlayer Localnet",
4001
4002
  rpcUrls: {
4002
4003
  default: {
@@ -8009,6 +8010,7 @@ var CONSENSUS_DATA_CONTRACT2 = {
8009
8010
  };
8010
8011
  var studionet = defineChain2({
8011
8012
  id: 61999,
8013
+ isStudio: true,
8012
8014
  name: "Genlayer Studio Network",
8013
8015
  rpcUrls: {
8014
8016
  default: {
@@ -12009,6 +12011,7 @@ var CONSENSUS_DATA_CONTRACT3 = {
12009
12011
  };
12010
12012
  var testnetAsimov = defineChain3({
12011
12013
  id: 4221,
12014
+ isStudio: false,
12012
12015
  name: "Genlayer Asimov Testnet",
12013
12016
  rpcUrls: {
12014
12017
  default: {
@@ -3997,6 +3997,7 @@ var CONSENSUS_DATA_CONTRACT = {
3997
3997
  };
3998
3998
  var localnet = _viem.defineChain.call(void 0, {
3999
3999
  id: 61999,
4000
+ isStudio: true,
4000
4001
  name: "Genlayer Localnet",
4001
4002
  rpcUrls: {
4002
4003
  default: {
@@ -8009,6 +8010,7 @@ var CONSENSUS_DATA_CONTRACT2 = {
8009
8010
  };
8010
8011
  var studionet = _viem.defineChain.call(void 0, {
8011
8012
  id: 61999,
8013
+ isStudio: true,
8012
8014
  name: "Genlayer Studio Network",
8013
8015
  rpcUrls: {
8014
8016
  default: {
@@ -12009,6 +12011,7 @@ var CONSENSUS_DATA_CONTRACT3 = {
12009
12011
  };
12010
12012
  var testnetAsimov = _viem.defineChain.call(void 0, {
12011
12013
  id: 4221,
12014
+ isStudio: false,
12012
12015
  name: "Genlayer Asimov Testnet",
12013
12016
  rpcUrls: {
12014
12017
  default: {
@@ -1,5 +1,5 @@
1
1
  import { Hex, Address, Client, Transport, WalletActions, PublicActions, Account } from 'viem';
2
- import { G as GenLayerChain } from './chains-BYSCF33g.js';
2
+ import { G as GenLayerChain } from './chains-BIe_Q0mF.js';
3
3
 
4
4
  declare class CalldataAddress {
5
5
  bytes: Uint8Array;
@@ -1,5 +1,5 @@
1
1
  import { Hex, Address, Client, Transport, WalletActions, PublicActions, Account } from 'viem';
2
- import { G as GenLayerChain } from './chains-BYSCF33g.cjs';
2
+ import { G as GenLayerChain } from './chains-BIe_Q0mF.cjs';
3
3
 
4
4
  declare class CalldataAddress {
5
5
  bytes: Uint8Array;
@@ -1,4 +1,4 @@
1
- import { G as GenLayerChain } from './chains-BYSCF33g.js';
1
+ import { G as GenLayerChain } from './chains-BIe_Q0mF.js';
2
2
 
3
3
  declare const localnet: GenLayerChain;
4
4
 
@@ -1,4 +1,4 @@
1
- import { G as GenLayerChain } from './chains-BYSCF33g.cjs';
1
+ import { G as GenLayerChain } from './chains-BIe_Q0mF.cjs';
2
2
 
3
3
  declare const localnet: GenLayerChain;
4
4
 
package/dist/index.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkZKBMABRAcjs = require('./chunk-ZKBMABRA.cjs');
6
+ var _chunkSMGWE7OHcjs = require('./chunk-SMGWE7OH.cjs');
7
7
 
8
8
 
9
9
 
@@ -29,7 +29,7 @@ var _viem = require('viem');
29
29
  function accountActions(client) {
30
30
  return {
31
31
  fundAccount: async ({ address, amount }) => {
32
- if (_optionalChain([client, 'access', _ => _.chain, 'optionalAccess', _2 => _2.id]) !== _chunkZKBMABRAcjs.localnet.id) {
32
+ if (_optionalChain([client, 'access', _ => _.chain, 'optionalAccess', _2 => _2.id]) !== _chunkSMGWE7OHcjs.localnet.id) {
33
33
  throw new Error("Client is not connected to the localnet");
34
34
  }
35
35
  return client.request({
@@ -512,7 +512,7 @@ function _toJsonSafeDeep(value, seen) {
512
512
  var contractActions = (client, publicClient) => {
513
513
  return {
514
514
  getContractCode: async (address) => {
515
- if (client.chain.id !== _chunkZKBMABRAcjs.localnet.id) {
515
+ if (client.chain.id !== _chunkSMGWE7OHcjs.localnet.id) {
516
516
  throw new Error("Getting contract code is not supported on this network");
517
517
  }
518
518
  const result = await client.request({
@@ -523,7 +523,7 @@ var contractActions = (client, publicClient) => {
523
523
  return new TextDecoder().decode(codeBytes);
524
524
  },
525
525
  getContractSchema: async (address) => {
526
- if (client.chain.id !== _chunkZKBMABRAcjs.localnet.id) {
526
+ if (client.chain.id !== _chunkSMGWE7OHcjs.localnet.id) {
527
527
  throw new Error("Contract schema is not supported on this network");
528
528
  }
529
529
  const schema = await client.request({
@@ -533,7 +533,7 @@ var contractActions = (client, publicClient) => {
533
533
  return schema;
534
534
  },
535
535
  getContractSchemaForCode: async (contractCode) => {
536
- if (client.chain.id !== _chunkZKBMABRAcjs.localnet.id) {
536
+ if (client.chain.id !== _chunkSMGWE7OHcjs.localnet.id) {
537
537
  throw new Error("Contract schema is not supported on this network");
538
538
  }
539
539
  const schema = await client.request({
@@ -1050,7 +1050,7 @@ var receiptActions = (client, publicClient) => ({
1050
1050
  const requestedStatus = _chunkFPZNF3JHcjs.transactionsStatusNameToNumber[status];
1051
1051
  if (transactionStatusString === requestedStatus || status === "ACCEPTED" /* ACCEPTED */ && _chunkFPZNF3JHcjs.isDecidedState.call(void 0, transactionStatusString)) {
1052
1052
  let finalTransaction = transaction;
1053
- if (client.chain.id === _chunkZKBMABRAcjs.localnet.id) {
1053
+ if (client.chain.id === _chunkSMGWE7OHcjs.localnet.id) {
1054
1054
  finalTransaction = decodeLocalnetTransaction(transaction);
1055
1055
  }
1056
1056
  if (!fullTransaction) {
@@ -1073,7 +1073,7 @@ var receiptActions = (client, publicClient) => ({
1073
1073
  });
1074
1074
  var transactionActions = (client, publicClient) => ({
1075
1075
  getTransaction: async ({ hash }) => {
1076
- if (client.chain.id === _chunkZKBMABRAcjs.localnet.id) {
1076
+ if (client.chain.isStudio) {
1077
1077
  const transaction2 = await client.getTransaction({ hash });
1078
1078
  const localnetStatus = transaction2.status === "ACTIVATED" ? "PENDING" /* PENDING */ : transaction2.status;
1079
1079
  transaction2.status = Number(_chunkFPZNF3JHcjs.transactionsStatusNameToNumber[localnetStatus]);
@@ -1115,9 +1115,9 @@ var snapID = {
1115
1115
 
1116
1116
  // src/wallet/connect.ts
1117
1117
  var networks = {
1118
- localnet: _chunkZKBMABRAcjs.localnet,
1119
- studionet: _chunkZKBMABRAcjs.studionet,
1120
- testnetAsimov: _chunkZKBMABRAcjs.testnetAsimov
1118
+ localnet: _chunkSMGWE7OHcjs.localnet,
1119
+ studionet: _chunkSMGWE7OHcjs.studionet,
1120
+ testnetAsimov: _chunkSMGWE7OHcjs.testnetAsimov
1121
1121
  };
1122
1122
  var connect = async (client, network = "studionet", snapSource = "npm") => {
1123
1123
  if (!window.ethereum) {
@@ -1216,7 +1216,7 @@ function walletActions(client) {
1216
1216
  function chainActions(client) {
1217
1217
  return {
1218
1218
  initializeConsensusSmartContract: async (forceReset = false) => {
1219
- if (_optionalChain([client, 'access', _54 => _54.chain, 'optionalAccess', _55 => _55.id]) === _chunkZKBMABRAcjs.testnetAsimov.id) {
1219
+ if (_optionalChain([client, 'access', _54 => _54.chain, 'optionalAccess', _55 => _55.id]) === _chunkSMGWE7OHcjs.testnetAsimov.id) {
1220
1220
  return;
1221
1221
  }
1222
1222
  if (!forceReset && _optionalChain([client, 'access', _56 => _56.chain, 'access', _57 => _57.consensusMainContract, 'optionalAccess', _58 => _58.address]) && _optionalChain([client, 'access', _59 => _59.chain, 'access', _60 => _60.consensusMainContract, 'optionalAccess', _61 => _61.abi])) {
@@ -1289,8 +1289,8 @@ var getCustomTransportConfig = (config) => {
1289
1289
  }
1290
1290
  };
1291
1291
  };
1292
- var createClient = (config = { chain: _chunkZKBMABRAcjs.localnet }) => {
1293
- const chainConfig = config.chain || _chunkZKBMABRAcjs.localnet;
1292
+ var createClient = (config = { chain: _chunkSMGWE7OHcjs.localnet }) => {
1293
+ const chainConfig = config.chain || _chunkSMGWE7OHcjs.localnet;
1294
1294
  if (config.endpoint) {
1295
1295
  chainConfig.rpcUrls.default.http = [config.endpoint];
1296
1296
  }
@@ -1345,4 +1345,4 @@ var createAccount = (accountPrivateKey) => {
1345
1345
 
1346
1346
 
1347
1347
 
1348
- exports.abi = abi_exports; exports.chains = _chunkZKBMABRAcjs.chains_exports; exports.createAccount = createAccount; exports.createClient = createClient; exports.decodeInputData = decodeInputData; exports.decodeLocalnetTransaction = decodeLocalnetTransaction; exports.decodeTransaction = decodeTransaction; exports.generatePrivateKey = generatePrivateKey; exports.simplifyTransactionReceipt = simplifyTransactionReceipt;
1348
+ exports.abi = abi_exports; exports.chains = _chunkSMGWE7OHcjs.chains_exports; exports.createAccount = createAccount; exports.createClient = createClient; exports.decodeInputData = decodeInputData; exports.decodeLocalnetTransaction = decodeLocalnetTransaction; exports.decodeTransaction = decodeTransaction; exports.generatePrivateKey = generatePrivateKey; exports.simplifyTransactionReceipt = simplifyTransactionReceipt;
package/dist/index.d.cts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as viem from 'viem';
2
2
  import { Account, Address, Hex } from 'viem';
3
- import { G as GenLayerChain } from './chains-BYSCF33g.cjs';
4
- import { G as GenLayerClient, D as DecodedDeployData, a as DecodedCallData, b as GenLayerRawTransaction, c as GenLayerTransaction, C as CalldataEncodable, T as TransactionDataElement } from './index-tixobC8m.cjs';
3
+ import { G as GenLayerChain } from './chains-BIe_Q0mF.cjs';
4
+ import { G as GenLayerClient, D as DecodedDeployData, a as DecodedCallData, b as GenLayerRawTransaction, c as GenLayerTransaction, C as CalldataEncodable, T as TransactionDataElement } from './index-BYma5s90.cjs';
5
5
  import * as abitype from 'abitype';
6
6
  import * as viem__types_types_authorization from 'viem/_types/types/authorization';
7
7
  import * as viem_accounts from 'viem/accounts';
8
- export { i as chains } from './index-Bw-kn7CF.cjs';
8
+ export { i as chains } from './index-C5zeayBB.cjs';
9
9
 
10
10
  interface ClientConfig {
11
11
  chain?: {
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as viem from 'viem';
2
2
  import { Account, Address, Hex } from 'viem';
3
- import { G as GenLayerChain } from './chains-BYSCF33g.js';
4
- import { G as GenLayerClient, D as DecodedDeployData, a as DecodedCallData, b as GenLayerRawTransaction, c as GenLayerTransaction, C as CalldataEncodable, T as TransactionDataElement } from './index-Rls_T310.js';
3
+ import { G as GenLayerChain } from './chains-BIe_Q0mF.js';
4
+ import { G as GenLayerClient, D as DecodedDeployData, a as DecodedCallData, b as GenLayerRawTransaction, c as GenLayerTransaction, C as CalldataEncodable, T as TransactionDataElement } from './index-B2AY6_eD.js';
5
5
  import * as abitype from 'abitype';
6
6
  import * as viem__types_types_authorization from 'viem/_types/types/authorization';
7
7
  import * as viem_accounts from 'viem/accounts';
8
- export { i as chains } from './index-DCzgdyMa.js';
8
+ export { i as chains } from './index-BpFWfpio.js';
9
9
 
10
10
  interface ClientConfig {
11
11
  chain?: {
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  localnet,
4
4
  studionet,
5
5
  testnetAsimov
6
- } from "./chunk-GEN4SJ6K.js";
6
+ } from "./chunk-NO75TOQL.js";
7
7
  import {
8
8
  CalldataAddress,
9
9
  isDecidedState,
@@ -1073,7 +1073,7 @@ var receiptActions = (client, publicClient) => ({
1073
1073
  });
1074
1074
  var transactionActions = (client, publicClient) => ({
1075
1075
  getTransaction: async ({ hash }) => {
1076
- if (client.chain.id === localnet.id) {
1076
+ if (client.chain.isStudio) {
1077
1077
  const transaction2 = await client.getTransaction({ hash });
1078
1078
  const localnetStatus = transaction2.status === "ACTIVATED" ? "PENDING" /* PENDING */ : transaction2.status;
1079
1079
  transaction2.status = Number(transactionsStatusNameToNumber[localnetStatus]);
@@ -1,3 +1,3 @@
1
1
  export { Account, Address } from 'viem';
2
- export { d as CalldataAddress, C as CalldataEncodable, i as ContractMethod, h as ContractMethodBase, f as ContractParamsArraySchemaElement, g as ContractParamsSchema, j as ContractSchema, o as DECIDED_STATES, a as DecodedCallData, D as DecodedDeployData, G as GenLayerClient, e as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, M as MethodDescription, N as Network, S as SnapSource, k as TransactionHash, w as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, u as TransactionType, V as VoteType, p as isDecidedState, q as transactionResultNumberToName, n as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, s as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-tixobC8m.cjs';
3
- export { G as GenLayerChain } from '../chains-BYSCF33g.cjs';
2
+ export { d as CalldataAddress, C as CalldataEncodable, i as ContractMethod, h as ContractMethodBase, f as ContractParamsArraySchemaElement, g as ContractParamsSchema, j as ContractSchema, o as DECIDED_STATES, a as DecodedCallData, D as DecodedDeployData, G as GenLayerClient, e as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, M as MethodDescription, N as Network, S as SnapSource, k as TransactionHash, w as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, u as TransactionType, V as VoteType, p as isDecidedState, q as transactionResultNumberToName, n as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, s as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-BYma5s90.cjs';
3
+ export { G as GenLayerChain } from '../chains-BIe_Q0mF.cjs';
@@ -1,3 +1,3 @@
1
1
  export { Account, Address } from 'viem';
2
- export { d as CalldataAddress, C as CalldataEncodable, i as ContractMethod, h as ContractMethodBase, f as ContractParamsArraySchemaElement, g as ContractParamsSchema, j as ContractSchema, o as DECIDED_STATES, a as DecodedCallData, D as DecodedDeployData, G as GenLayerClient, e as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, M as MethodDescription, N as Network, S as SnapSource, k as TransactionHash, w as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, u as TransactionType, V as VoteType, p as isDecidedState, q as transactionResultNumberToName, n as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, s as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-Rls_T310.js';
3
- export { G as GenLayerChain } from '../chains-BYSCF33g.js';
2
+ export { d as CalldataAddress, C as CalldataEncodable, i as ContractMethod, h as ContractMethodBase, f as ContractParamsArraySchemaElement, g as ContractParamsSchema, j as ContractSchema, o as DECIDED_STATES, a as DecodedCallData, D as DecodedDeployData, G as GenLayerClient, e as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, M as MethodDescription, N as Network, S as SnapSource, k as TransactionHash, w as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, u as TransactionType, V as VoteType, p as isDecidedState, q as transactionResultNumberToName, n as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, s as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-B2AY6_eD.js';
3
+ export { G as GenLayerChain } from '../chains-BIe_Q0mF.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "genlayer-js",
3
3
  "type": "module",
4
- "version": "0.18.3",
4
+ "version": "0.18.4",
5
5
  "description": "GenLayer JavaScript SDK",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -3989,6 +3989,7 @@ const CONSENSUS_DATA_CONTRACT = {
3989
3989
 
3990
3990
  export const localnet: GenLayerChain = defineChain({
3991
3991
  id: 61_999,
3992
+ isStudio: true,
3992
3993
  name: "Genlayer Localnet",
3993
3994
  rpcUrls: {
3994
3995
  default: {
@@ -3990,6 +3990,7 @@ const CONSENSUS_DATA_CONTRACT = {
3990
3990
 
3991
3991
  export const studionet: GenLayerChain = defineChain({
3992
3992
  id: 61_999,
3993
+ isStudio: true,
3993
3994
  name: "Genlayer Studio Network",
3994
3995
  rpcUrls: {
3995
3996
  default: {