genlayer-js 0.12.1 → 0.14.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 CHANGED
@@ -1,5 +1,19 @@
1
1
 
2
2
 
3
+ ## 0.14.0 (2025-07-30)
4
+
5
+
6
+ ### Features
7
+
8
+ * expose encode and decode methods ([#102](https://github.com/genlayerlabs/genlayer-js/issues/102)) ([c9e0719](https://github.com/genlayerlabs/genlayer-js/commit/c9e07191c52cd4fecc9295172a7087ade896ccd7))
9
+
10
+ ## 0.13.0 (2025-07-23)
11
+
12
+
13
+ ### Features
14
+
15
+ * simplify transaction receipt ([#101](https://github.com/genlayerlabs/genlayer-js/issues/101)) ([be78ac6](https://github.com/genlayerlabs/genlayer-js/commit/be78ac6b5871a4d61349bacf87b5fb0da61b1a90))
16
+
3
17
  ## 0.12.1 (2025-07-21)
4
18
 
5
19
 
package/README.md CHANGED
@@ -38,6 +38,31 @@ const transactionHash = "0x...";
38
38
  const transaction = await client.getTransaction({ hash: transactionHash })
39
39
  ```
40
40
 
41
+ ### Waiting for Transaction Receipt
42
+ ```typescript
43
+ import { localnet } from 'genlayer-js/chains';
44
+ import { createClient } from "genlayer-js";
45
+ import { TransactionStatus } from "genlayer-js/types";
46
+
47
+ const client = createClient({
48
+ chain: localnet,
49
+ });
50
+
51
+ // Get simplified receipt (default - removes binary data, keeps execution results)
52
+ const receipt = await client.waitForTransactionReceipt({
53
+ hash: "0x...",
54
+ status: TransactionStatus.FINALIZED,
55
+ fullTransaction: false // Default - simplified for readability
56
+ });
57
+
58
+ // Get complete receipt with all fields
59
+ const fullReceipt = await client.waitForTransactionReceipt({
60
+ hash: "0x...",
61
+ status: TransactionStatus.FINALIZED,
62
+ fullTransaction: true // Complete receipt with all internal data
63
+ });
64
+ ```
65
+
41
66
  ### Reading a contract
42
67
  ```typescript
43
68
  import { localnet } from 'genlayer-js/chains';
@@ -74,7 +99,11 @@ const transactionHash = await client.writeContract({
74
99
  value: 0, // value is optional, if you want to send some native token to the contract
75
100
  });
76
101
 
77
- const receipt = await client.waitForTransactionReceipt({ hash: txHash, status: TransactionStatus.FINALIZED}) //or ACCEPTED
102
+ const receipt = await client.waitForTransactionReceipt({
103
+ hash: txHash,
104
+ status: TransactionStatus.FINALIZED, // or ACCEPTED
105
+ fullTransaction: false // False by default - returns simplified receipt for better readability
106
+ })
78
107
 
79
108
  ```
80
109
  ## 🚀 Key Features
@@ -376,4 +376,4 @@ type GenLayerClient<TGenLayerChain extends GenLayerChain> = Omit<Client<Transpor
376
376
  }) => Promise<any>;
377
377
  };
378
378
 
379
- export { type CalldataEncodable as C, type DecodedDeployData as D, type GenLayerClient as G, type Hash as H, type MethodDescription as M, type Network as N, type SnapSource as S, type TransactionDataElement as T, VoteType as V, CalldataAddress as a, type GenLayerMethod as b, type ContractParamsArraySchemaElement as c, type ContractParamsSchema as d, type ContractMethodBase as e, type ContractMethod as f, type ContractSchema as g, type TransactionHash as h, TransactionStatus as i, TransactionResult as j, transactionsStatusNameToNumber as k, transactionResultNumberToName as l, TransactionResultNameToNumber as m, voteTypeNameToNumber as n, type TransactionType as o, TransactionHashVariant as p, type DecodedCallData as q, type GenLayerTransaction as r, type GenLayerRawTransaction as s, transactionsStatusNumberToName as t, voteTypeNumberToName as v };
379
+ export { type CalldataEncodable as C, type DecodedDeployData as D, type GenLayerClient as G, type Hash as H, type MethodDescription as M, type Network as N, type SnapSource as S, type TransactionDataElement as T, VoteType as V, type DecodedCallData as a, type GenLayerRawTransaction as b, type GenLayerTransaction as c, CalldataAddress as d, type GenLayerMethod as e, type ContractParamsArraySchemaElement as f, type ContractParamsSchema as g, type ContractMethodBase as h, type ContractMethod as i, type ContractSchema as j, type TransactionHash as k, TransactionStatus as l, TransactionResult as m, transactionsStatusNameToNumber as n, transactionResultNumberToName as o, TransactionResultNameToNumber as p, voteTypeNameToNumber as q, type TransactionType as r, TransactionHashVariant as s, transactionsStatusNumberToName as t, voteTypeNumberToName as v };
@@ -376,4 +376,4 @@ type GenLayerClient<TGenLayerChain extends GenLayerChain> = Omit<Client<Transpor
376
376
  }) => Promise<any>;
377
377
  };
378
378
 
379
- export { type CalldataEncodable as C, type DecodedDeployData as D, type GenLayerClient as G, type Hash as H, type MethodDescription as M, type Network as N, type SnapSource as S, type TransactionDataElement as T, VoteType as V, CalldataAddress as a, type GenLayerMethod as b, type ContractParamsArraySchemaElement as c, type ContractParamsSchema as d, type ContractMethodBase as e, type ContractMethod as f, type ContractSchema as g, type TransactionHash as h, TransactionStatus as i, TransactionResult as j, transactionsStatusNameToNumber as k, transactionResultNumberToName as l, TransactionResultNameToNumber as m, voteTypeNameToNumber as n, type TransactionType as o, TransactionHashVariant as p, type DecodedCallData as q, type GenLayerTransaction as r, type GenLayerRawTransaction as s, transactionsStatusNumberToName as t, voteTypeNumberToName as v };
379
+ export { type CalldataEncodable as C, type DecodedDeployData as D, type GenLayerClient as G, type Hash as H, type MethodDescription as M, type Network as N, type SnapSource as S, type TransactionDataElement as T, VoteType as V, type DecodedCallData as a, type GenLayerRawTransaction as b, type GenLayerTransaction as c, CalldataAddress as d, type GenLayerMethod as e, type ContractParamsArraySchemaElement as f, type ContractParamsSchema as g, type ContractMethodBase as h, type ContractMethod as i, type ContractSchema as j, type TransactionHash as k, TransactionStatus as l, TransactionResult as m, transactionsStatusNameToNumber as n, transactionResultNumberToName as o, TransactionResultNameToNumber as p, voteTypeNameToNumber as q, type TransactionType as r, TransactionHashVariant as s, transactionsStatusNumberToName as t, voteTypeNumberToName as v };
package/dist/index.cjs CHANGED
@@ -57,6 +57,7 @@ var calldata_exports = {};
57
57
  _chunk75ZPJI57cjs.__export.call(void 0, calldata_exports, {
58
58
  decode: () => decode,
59
59
  encode: () => encode,
60
+ makeCalldataObject: () => makeCalldataObject,
60
61
  toString: () => toString
61
62
  });
62
63
 
@@ -203,6 +204,32 @@ function encode(data) {
203
204
  encodeImpl(arr, data);
204
205
  return new Uint8Array(arr);
205
206
  }
207
+ function makeCalldataObject(method, args, kwargs) {
208
+ let ret = {};
209
+ if (method) {
210
+ ret["method"] = method;
211
+ }
212
+ if (args && args.length > 0) {
213
+ ret["args"] = args;
214
+ }
215
+ if (kwargs) {
216
+ if (kwargs instanceof Map) {
217
+ if (kwargs.size > 0) {
218
+ ret["kwargs"] = kwargs;
219
+ }
220
+ } else {
221
+ let hasVal = false;
222
+ for (const _k in kwargs) {
223
+ hasVal = true;
224
+ break;
225
+ }
226
+ if (hasVal) {
227
+ ret["kwargs"] = kwargs;
228
+ }
229
+ }
230
+ }
231
+ return ret;
232
+ }
206
233
 
207
234
  // src/abi/calldata/decoder.ts
208
235
  function readULeb128(data, index) {
@@ -381,32 +408,6 @@ function serialize(data) {
381
408
 
382
409
  // src/contracts/actions.ts
383
410
 
384
- function makeCalldataObject(method, args, kwargs) {
385
- let ret = {};
386
- if (method) {
387
- ret["method"] = method;
388
- }
389
- if (args && args.length > 0) {
390
- ret["args"] = args;
391
- }
392
- if (kwargs) {
393
- if (kwargs instanceof Map) {
394
- if (kwargs.size > 0) {
395
- ret["kwargs"] = kwargs;
396
- }
397
- } else {
398
- let hasVal = false;
399
- for (const _k in kwargs) {
400
- hasVal = true;
401
- break;
402
- }
403
- if (hasVal) {
404
- ret["kwargs"] = kwargs;
405
- }
406
- }
407
- }
408
- return ret;
409
- }
410
411
  var contractActions = (client, publicClient) => {
411
412
  return {
412
413
  getContractSchema: async (address) => {
@@ -682,65 +683,51 @@ function resultToUserFriendlyJson(cd64) {
682
683
  };
683
684
  }
684
685
 
685
- // src/transactions/actions.ts
686
+ // src/transactions/decoders.ts
686
687
 
687
- var receiptActions = (client, publicClient) => ({
688
- waitForTransactionReceipt: async ({
689
- hash,
690
- status = "ACCEPTED" /* ACCEPTED */,
691
- interval = transactionsConfig.waitInterval,
692
- retries = transactionsConfig.retries
693
- }) => {
694
- const transaction = await client.getTransaction({
695
- hash
696
- });
697
- if (!transaction) {
698
- throw new Error("Transaction not found");
699
- }
700
- const transactionStatusString = String(transaction.status);
701
- const transactionStatusFinalized = _chunkH4ZYXVV2cjs.transactionsStatusNameToNumber["FINALIZED" /* FINALIZED */];
702
- const requestedStatus = _chunkH4ZYXVV2cjs.transactionsStatusNameToNumber[status];
703
- if (transactionStatusString === requestedStatus || status === "ACCEPTED" /* ACCEPTED */ && transactionStatusString === transactionStatusFinalized) {
704
- if (client.chain.id === _chunkZKBMABRAcjs.localnet.id) {
705
- return _decodeLocalnetTransaction(transaction);
706
- }
707
- return transaction;
708
- }
709
- if (retries === 0) {
710
- throw new Error("Transaction status is not " + status);
711
- }
712
- await sleep(interval);
713
- return receiptActions(client, publicClient).waitForTransactionReceipt({
714
- hash,
715
- status,
716
- interval,
717
- retries: retries - 1
718
- });
719
- }
720
- });
721
- var transactionActions = (client, publicClient) => ({
722
- getTransaction: async ({ hash }) => {
723
- if (client.chain.id === _chunkZKBMABRAcjs.localnet.id) {
724
- const transaction2 = await client.getTransaction({ hash });
725
- const localnetStatus = transaction2.status === "ACTIVATED" ? "PENDING" /* PENDING */ : transaction2.status;
726
- transaction2.status = Number(_chunkH4ZYXVV2cjs.transactionsStatusNameToNumber[localnetStatus]);
727
- transaction2.statusName = localnetStatus;
728
- return _decodeLocalnetTransaction(transaction2);
729
- }
730
- const transaction = await publicClient.readContract({
731
- address: _optionalChain([client, 'access', _25 => _25.chain, 'access', _26 => _26.consensusDataContract, 'optionalAccess', _27 => _27.address]),
732
- abi: _optionalChain([client, 'access', _28 => _28.chain, 'access', _29 => _29.consensusDataContract, 'optionalAccess', _30 => _30.abi]),
733
- functionName: "getTransactionData",
734
- args: [
735
- hash,
736
- Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3)
737
- // unix seconds
738
- ]
739
- });
740
- return _decodeTransaction(transaction);
741
- }
742
- });
743
- var _decodeInputData = (rlpEncodedAppData, recipient) => {
688
+ var FIELDS_TO_REMOVE = [
689
+ "raw",
690
+ "contract_state",
691
+ "base64",
692
+ "consensus_history",
693
+ "tx_data",
694
+ "eq_blocks_outputs",
695
+ "r",
696
+ "s",
697
+ "v",
698
+ "created_timestamp",
699
+ "current_timestamp",
700
+ "tx_execution_hash",
701
+ "random_seed",
702
+ "states",
703
+ "contract_code",
704
+ "appeal_failed",
705
+ "appeal_leader_timeout",
706
+ "appeal_processing_time",
707
+ "appeal_undetermined",
708
+ "appealed",
709
+ "timestamp_appeal",
710
+ "config_rotation_rounds",
711
+ "rotation_count",
712
+ "queue_position",
713
+ "queue_type",
714
+ "leader_timeout_validators",
715
+ "triggered_by",
716
+ "num_of_initial_validators",
717
+ "timestamp_awaiting_finalization",
718
+ "last_vote_timestamp",
719
+ "read_state_block_range",
720
+ "tx_slot",
721
+ "blockHash",
722
+ "blockNumber",
723
+ "to",
724
+ "transactionIndex"
725
+ ];
726
+ var FIELD_NAME_MAPPINGS = {
727
+ statusName: "status_name",
728
+ typeHex: "type"
729
+ };
730
+ var decodeInputData = (rlpEncodedAppData, recipient) => {
744
731
  if (!rlpEncodedAppData || rlpEncodedAppData === "0x" || rlpEncodedAppData.length <= 2) {
745
732
  return null;
746
733
  }
@@ -778,8 +765,8 @@ var _decodeInputData = (rlpEncodedAppData, recipient) => {
778
765
  return null;
779
766
  }
780
767
  };
781
- var _decodeTransaction = (tx) => {
782
- const txDataDecoded = _decodeInputData(tx.txData, tx.recipient);
768
+ var decodeTransaction = (tx) => {
769
+ const txDataDecoded = decodeInputData(tx.txData, tx.recipient);
783
770
  const decodedTx = {
784
771
  ...tx,
785
772
  txData: tx.txData,
@@ -814,10 +801,81 @@ var _decodeTransaction = (tx) => {
814
801
  };
815
802
  return decodedTx;
816
803
  };
817
- var _decodeLocalnetTransaction = (tx) => {
804
+ var simplifyTransactionReceipt = (tx) => {
805
+ const simplifyObject = (obj, path = "") => {
806
+ if (obj === null || obj === void 0) return obj;
807
+ if (Array.isArray(obj)) {
808
+ return obj.map((item) => simplifyObject(item, path)).filter((item) => item !== void 0);
809
+ }
810
+ if (typeof obj === "object") {
811
+ const result = {};
812
+ for (const [key, value] of Object.entries(obj)) {
813
+ const currentPath = path ? `${path}.${key}` : key;
814
+ if (FIELDS_TO_REMOVE.includes(key)) {
815
+ continue;
816
+ }
817
+ if (key === "node_config" && !path.includes("consensus_data")) {
818
+ continue;
819
+ }
820
+ if (key === "consensus_data" && typeof value === "object" && value !== null) {
821
+ const simplifiedConsensus = {};
822
+ if ("votes" in value) {
823
+ simplifiedConsensus.votes = value.votes;
824
+ }
825
+ if ("leader_receipt" in value && Array.isArray(value.leader_receipt)) {
826
+ simplifiedConsensus.leader_receipt = value.leader_receipt.map((receipt) => {
827
+ const simplifiedReceipt = {};
828
+ ["execution_result", "genvm_result", "mode", "vote", "node_config"].forEach((field) => {
829
+ if (field in receipt) {
830
+ simplifiedReceipt[field] = receipt[field];
831
+ }
832
+ });
833
+ if (receipt.calldata && typeof receipt.calldata === "object" && "readable" in receipt.calldata) {
834
+ simplifiedReceipt.calldata = { readable: receipt.calldata.readable };
835
+ }
836
+ if (receipt.eq_outputs) {
837
+ simplifiedReceipt.eq_outputs = simplifyObject(receipt.eq_outputs, currentPath);
838
+ }
839
+ if (receipt.result) {
840
+ simplifiedReceipt.result = simplifyObject(receipt.result, currentPath);
841
+ }
842
+ return simplifiedReceipt;
843
+ });
844
+ }
845
+ if ("validators" in value && Array.isArray(value.validators)) {
846
+ const simplifiedValidators = value.validators.map((validator) => {
847
+ const simplifiedValidator = {};
848
+ ["execution_result", "genvm_result", "mode", "vote", "node_config"].forEach((field) => {
849
+ if (field in validator) {
850
+ simplifiedValidator[field] = validator[field];
851
+ }
852
+ });
853
+ return simplifiedValidator;
854
+ }).filter((validator) => Object.keys(validator).length > 0);
855
+ if (simplifiedValidators.length > 0) {
856
+ simplifiedConsensus.validators = simplifiedValidators;
857
+ }
858
+ }
859
+ result[key] = simplifiedConsensus;
860
+ continue;
861
+ }
862
+ const simplifiedValue = simplifyObject(value, currentPath);
863
+ const shouldInclude = simplifiedValue !== void 0 && !(typeof simplifiedValue === "object" && simplifiedValue !== null && Object.keys(simplifiedValue).length === 0);
864
+ if (shouldInclude || simplifiedValue === 0) {
865
+ const mappedKey = FIELD_NAME_MAPPINGS[key] || key;
866
+ result[mappedKey] = simplifiedValue;
867
+ }
868
+ }
869
+ return result;
870
+ }
871
+ return obj;
872
+ };
873
+ return simplifyObject({ ...tx });
874
+ };
875
+ var decodeLocalnetTransaction = (tx) => {
818
876
  if (!tx.data) return tx;
819
877
  try {
820
- const leaderReceipt = _optionalChain([tx, 'access', _31 => _31.consensus_data, 'optionalAccess', _32 => _32.leader_receipt]);
878
+ const leaderReceipt = _optionalChain([tx, 'access', _25 => _25.consensus_data, 'optionalAccess', _26 => _26.leader_receipt]);
821
879
  if (leaderReceipt) {
822
880
  const receipts = Array.isArray(leaderReceipt) ? leaderReceipt : [leaderReceipt];
823
881
  receipts.forEach((receipt) => {
@@ -831,26 +889,99 @@ var _decodeLocalnetTransaction = (tx) => {
831
889
  };
832
890
  }
833
891
  if (receipt.eq_outputs) {
834
- receipt.eq_outputs = Object.fromEntries(
835
- Object.entries(receipt.eq_outputs).map(([key, value]) => {
836
- return [key, resultToUserFriendlyJson(String(value))];
837
- })
838
- );
892
+ const decodedOutputs = {};
893
+ for (const [key, value] of Object.entries(receipt.eq_outputs)) {
894
+ if (typeof value === "object" && value !== null) {
895
+ decodedOutputs[key] = value;
896
+ } else {
897
+ try {
898
+ decodedOutputs[key] = resultToUserFriendlyJson(value);
899
+ } catch (e) {
900
+ console.warn(`Error decoding eq_output ${key}: ${e}`);
901
+ decodedOutputs[key] = value;
902
+ }
903
+ }
904
+ }
905
+ receipt.eq_outputs = decodedOutputs;
839
906
  }
840
907
  });
841
908
  }
842
- if (_optionalChain([tx, 'access', _33 => _33.data, 'optionalAccess', _34 => _34.calldata]) && typeof tx.data.calldata === "string") {
909
+ if (_optionalChain([tx, 'access', _27 => _27.data, 'optionalAccess', _28 => _28.calldata]) && typeof tx.data.calldata === "string") {
843
910
  tx.data.calldata = {
844
911
  base64: tx.data.calldata,
845
912
  ...calldataToUserFriendlyJson(b64ToArray(tx.data.calldata))
846
913
  };
847
914
  }
848
915
  } catch (e) {
849
- console.error("Error in _decodeLocalnetTransaction:", e);
916
+ console.error("Error in decodeLocalnetTransaction:", e);
850
917
  }
851
918
  return tx;
852
919
  };
853
920
 
921
+ // src/transactions/actions.ts
922
+ var receiptActions = (client, publicClient) => ({
923
+ waitForTransactionReceipt: async ({
924
+ hash,
925
+ status = "ACCEPTED" /* ACCEPTED */,
926
+ interval = transactionsConfig.waitInterval,
927
+ retries = transactionsConfig.retries,
928
+ fullTransaction = false
929
+ }) => {
930
+ const transaction = await client.getTransaction({
931
+ hash
932
+ });
933
+ if (!transaction) {
934
+ throw new Error("Transaction not found");
935
+ }
936
+ const transactionStatusString = String(transaction.status);
937
+ const transactionStatusFinalized = _chunkH4ZYXVV2cjs.transactionsStatusNameToNumber["FINALIZED" /* FINALIZED */];
938
+ const requestedStatus = _chunkH4ZYXVV2cjs.transactionsStatusNameToNumber[status];
939
+ if (transactionStatusString === requestedStatus || status === "ACCEPTED" /* ACCEPTED */ && transactionStatusString === transactionStatusFinalized) {
940
+ let finalTransaction = transaction;
941
+ if (client.chain.id === _chunkZKBMABRAcjs.localnet.id) {
942
+ finalTransaction = decodeLocalnetTransaction(transaction);
943
+ }
944
+ if (!fullTransaction) {
945
+ return simplifyTransactionReceipt(finalTransaction);
946
+ }
947
+ return finalTransaction;
948
+ }
949
+ if (retries === 0) {
950
+ throw new Error("Transaction status is not " + status);
951
+ }
952
+ await sleep(interval);
953
+ return receiptActions(client, publicClient).waitForTransactionReceipt({
954
+ hash,
955
+ status,
956
+ interval,
957
+ retries: retries - 1,
958
+ fullTransaction
959
+ });
960
+ }
961
+ });
962
+ var transactionActions = (client, publicClient) => ({
963
+ getTransaction: async ({ hash }) => {
964
+ if (client.chain.id === _chunkZKBMABRAcjs.localnet.id) {
965
+ const transaction2 = await client.getTransaction({ hash });
966
+ const localnetStatus = transaction2.status === "ACTIVATED" ? "PENDING" /* PENDING */ : transaction2.status;
967
+ transaction2.status = Number(_chunkH4ZYXVV2cjs.transactionsStatusNameToNumber[localnetStatus]);
968
+ transaction2.statusName = localnetStatus;
969
+ return decodeLocalnetTransaction(transaction2);
970
+ }
971
+ const transaction = await publicClient.readContract({
972
+ address: _optionalChain([client, 'access', _29 => _29.chain, 'access', _30 => _30.consensusDataContract, 'optionalAccess', _31 => _31.address]),
973
+ abi: _optionalChain([client, 'access', _32 => _32.chain, 'access', _33 => _33.consensusDataContract, 'optionalAccess', _34 => _34.abi]),
974
+ functionName: "getTransactionData",
975
+ args: [
976
+ hash,
977
+ Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3)
978
+ // unix seconds
979
+ ]
980
+ });
981
+ return decodeTransaction(transaction);
982
+ }
983
+ });
984
+
854
985
  // src/config/snapID.ts
855
986
  var snapID = {
856
987
  local: "local:http://localhost:8081",
@@ -1078,4 +1209,8 @@ var createAccount = (accountPrivateKey) => {
1078
1209
 
1079
1210
 
1080
1211
 
1081
- exports.abi = abi_exports; exports.chains = _chunkZKBMABRAcjs.chains_exports; exports.createAccount = createAccount; exports.createClient = createClient; exports.generatePrivateKey = generatePrivateKey;
1212
+
1213
+
1214
+
1215
+
1216
+ 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;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as viem from 'viem';
2
- import { Account, Address } from 'viem';
2
+ import { Account, Address, Hex } from 'viem';
3
3
  import { G as GenLayerChain } from './chains-BYSCF33g.cjs';
4
- import { G as GenLayerClient, C as CalldataEncodable, T as TransactionDataElement } from './index-icLJcrDm.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-IViMPpkl.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';
@@ -53,7 +53,15 @@ declare const createAccount: (accountPrivateKey?: `0x${string}`) => {
53
53
  type: "local";
54
54
  };
55
55
 
56
+ declare const decodeInputData: (rlpEncodedAppData: Hex | undefined | null, recipient: Address) => DecodedDeployData | DecodedCallData | null;
57
+ declare const decodeTransaction: (tx: GenLayerRawTransaction) => GenLayerTransaction;
58
+ declare const simplifyTransactionReceipt: (tx: GenLayerTransaction) => GenLayerTransaction;
59
+ declare const decodeLocalnetTransaction: (tx: GenLayerTransaction) => GenLayerTransaction;
60
+
56
61
  declare function encode(data: CalldataEncodable): Uint8Array;
62
+ declare function makeCalldataObject(method: string | undefined, args: CalldataEncodable[] | undefined, kwargs: {
63
+ [key: string]: CalldataEncodable;
64
+ } | Map<string, CalldataEncodable> | undefined): CalldataEncodable;
57
65
 
58
66
  declare function decode(data: Uint8Array): CalldataEncodable;
59
67
 
@@ -61,9 +69,10 @@ declare function toString(data: CalldataEncodable): string;
61
69
 
62
70
  declare const cd_decode: typeof decode;
63
71
  declare const cd_encode: typeof encode;
72
+ declare const cd_makeCalldataObject: typeof makeCalldataObject;
64
73
  declare const cd_toString: typeof toString;
65
74
  declare namespace cd {
66
- export { cd_decode as decode, cd_encode as encode, cd_toString as toString };
75
+ export { cd_decode as decode, cd_encode as encode, cd_makeCalldataObject as makeCalldataObject, cd_toString as toString };
67
76
  }
68
77
 
69
78
  declare function serializeOne(data: TransactionDataElement): `0x${string}`;
@@ -84,4 +93,4 @@ declare namespace index {
84
93
  export { index_calldata as calldata, index_transactions as transactions };
85
94
  }
86
95
 
87
- export { index as abi, createAccount, createClient, generatePrivateKey };
96
+ export { index as abi, createAccount, createClient, decodeInputData, decodeLocalnetTransaction, decodeTransaction, generatePrivateKey, simplifyTransactionReceipt };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as viem from 'viem';
2
- import { Account, Address } from 'viem';
2
+ import { Account, Address, Hex } from 'viem';
3
3
  import { G as GenLayerChain } from './chains-BYSCF33g.js';
4
- import { G as GenLayerClient, C as CalldataEncodable, T as TransactionDataElement } from './index-TWCEN45Z.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-CgHl4W-5.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';
@@ -53,7 +53,15 @@ declare const createAccount: (accountPrivateKey?: `0x${string}`) => {
53
53
  type: "local";
54
54
  };
55
55
 
56
+ declare const decodeInputData: (rlpEncodedAppData: Hex | undefined | null, recipient: Address) => DecodedDeployData | DecodedCallData | null;
57
+ declare const decodeTransaction: (tx: GenLayerRawTransaction) => GenLayerTransaction;
58
+ declare const simplifyTransactionReceipt: (tx: GenLayerTransaction) => GenLayerTransaction;
59
+ declare const decodeLocalnetTransaction: (tx: GenLayerTransaction) => GenLayerTransaction;
60
+
56
61
  declare function encode(data: CalldataEncodable): Uint8Array;
62
+ declare function makeCalldataObject(method: string | undefined, args: CalldataEncodable[] | undefined, kwargs: {
63
+ [key: string]: CalldataEncodable;
64
+ } | Map<string, CalldataEncodable> | undefined): CalldataEncodable;
57
65
 
58
66
  declare function decode(data: Uint8Array): CalldataEncodable;
59
67
 
@@ -61,9 +69,10 @@ declare function toString(data: CalldataEncodable): string;
61
69
 
62
70
  declare const cd_decode: typeof decode;
63
71
  declare const cd_encode: typeof encode;
72
+ declare const cd_makeCalldataObject: typeof makeCalldataObject;
64
73
  declare const cd_toString: typeof toString;
65
74
  declare namespace cd {
66
- export { cd_decode as decode, cd_encode as encode, cd_toString as toString };
75
+ export { cd_decode as decode, cd_encode as encode, cd_makeCalldataObject as makeCalldataObject, cd_toString as toString };
67
76
  }
68
77
 
69
78
  declare function serializeOne(data: TransactionDataElement): `0x${string}`;
@@ -84,4 +93,4 @@ declare namespace index {
84
93
  export { index_calldata as calldata, index_transactions as transactions };
85
94
  }
86
95
 
87
- export { index as abi, createAccount, createClient, generatePrivateKey };
96
+ export { index as abi, createAccount, createClient, decodeInputData, decodeLocalnetTransaction, decodeTransaction, generatePrivateKey, simplifyTransactionReceipt };