genlayer-js 0.24.0 → 0.25.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/README.md +16 -0
- package/dist/{index-BJI82mwC.d.cts → index-BVTLJo0j.d.cts} +13 -1
- package/dist/{index-DEWwFm0_.d.ts → index-Dc8L54mZ.d.ts} +13 -1
- package/dist/index.cjs +7 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -0
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -152,6 +152,22 @@ console.log(childTxIds);
|
|
|
152
152
|
// ["0xabc...", "0xdef..."]
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
+
### Debugging transaction execution
|
|
156
|
+
|
|
157
|
+
Use `debugTraceTransaction` to inspect the full execution trace of a transaction, including return data, errors, and GenVM logs:
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
const trace = await client.debugTraceTransaction({
|
|
161
|
+
hash: txHash,
|
|
162
|
+
round: 0, // optional, defaults to 0
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
console.log(trace.result_code); // 0=success, 1=user error, 2=VM error
|
|
166
|
+
console.log(trace.return_data); // hex-encoded contract return data
|
|
167
|
+
console.log(trace.stderr); // standard error output
|
|
168
|
+
console.log(trace.genvm_log); // detailed GenVM execution logs
|
|
169
|
+
```
|
|
170
|
+
|
|
155
171
|
### Staking Operations
|
|
156
172
|
|
|
157
173
|
The SDK provides staking functionality for validators and delegators on testnet-bradbury (and testnet-asimov).
|
|
@@ -150,6 +150,18 @@ type DecodedCallData = {
|
|
|
150
150
|
leaderOnly?: boolean;
|
|
151
151
|
type: TransactionType;
|
|
152
152
|
};
|
|
153
|
+
type DebugTraceResult = {
|
|
154
|
+
transaction_id: string;
|
|
155
|
+
result_code: number;
|
|
156
|
+
return_data: string;
|
|
157
|
+
stdout: string;
|
|
158
|
+
stderr: string;
|
|
159
|
+
genvm_log: Record<string, unknown>[];
|
|
160
|
+
storage_proof: string;
|
|
161
|
+
run_time: string;
|
|
162
|
+
eq_outputs: string[];
|
|
163
|
+
stored_at?: string;
|
|
164
|
+
};
|
|
153
165
|
interface LeaderReceipt {
|
|
154
166
|
calldata: string;
|
|
155
167
|
class_name: string;
|
|
@@ -2886,4 +2898,4 @@ type GenLayerClient<TGenLayerChain extends GenLayerChain> = Omit<Client<Transpor
|
|
|
2886
2898
|
}) => Promise<bigint>;
|
|
2887
2899
|
} & StakingActions;
|
|
2888
2900
|
|
|
2889
|
-
export { type
|
|
2901
|
+
export { type ValidatorDepositOptions as $, type SnapSource as A, type StakingContract as B, type CalldataEncodable as C, type DecodedDeployData as D, ExecutionResult as E, type ValidatorView as F, type GenLayerClient as G, type Hash as H, type ValidatorIdentity as I, type ValidatorInfo as J, type PendingWithdrawal as K, type LeaderReceipt as L, type MethodDescription as M, type Network as N, type BannedValidatorInfo as O, type PendingDeposit as P, type StakeInfo as Q, type EpochData as R, STAKING_ABI as S, type TransactionDataElement as T, type EpochInfo as U, VALIDATOR_WALLET_ABI as V, type WithdrawalCommit as W, type StakingTransactionResult as X, type ValidatorJoinResult as Y, type DelegatorJoinResult as Z, type ValidatorJoinOptions as _, type DecodedCallData as a, type ValidatorExitOptions as a0, type ValidatorClaimOptions as a1, type ValidatorPrimeOptions as a2, type SetOperatorOptions as a3, type SetIdentityOptions as a4, type DelegatorJoinOptions as a5, type DelegatorExitOptions as a6, type DelegatorClaimOptions as a7, type StakingActions as a8, type GenLayerRawTransaction as b, type GenLayerTransaction as c, type ContractSchema as d, CalldataAddress as e, type GenLayerMethod as f, type ContractParamsArraySchemaElement as g, type ContractParamsSchema as h, type ContractMethodBase as i, type ContractMethod as j, type TransactionHash as k, TransactionStatus as l, TransactionResult as m, transactionsStatusNameToNumber as n, DECIDED_STATES as o, isDecidedState as p, transactionResultNumberToName as q, TransactionResultNameToNumber as r, executionResultNumberToName as s, transactionsStatusNumberToName as t, VoteType as u, voteTypeNumberToName as v, voteTypeNameToNumber as w, type TransactionType as x, TransactionHashVariant as y, type DebugTraceResult as z };
|
|
@@ -150,6 +150,18 @@ type DecodedCallData = {
|
|
|
150
150
|
leaderOnly?: boolean;
|
|
151
151
|
type: TransactionType;
|
|
152
152
|
};
|
|
153
|
+
type DebugTraceResult = {
|
|
154
|
+
transaction_id: string;
|
|
155
|
+
result_code: number;
|
|
156
|
+
return_data: string;
|
|
157
|
+
stdout: string;
|
|
158
|
+
stderr: string;
|
|
159
|
+
genvm_log: Record<string, unknown>[];
|
|
160
|
+
storage_proof: string;
|
|
161
|
+
run_time: string;
|
|
162
|
+
eq_outputs: string[];
|
|
163
|
+
stored_at?: string;
|
|
164
|
+
};
|
|
153
165
|
interface LeaderReceipt {
|
|
154
166
|
calldata: string;
|
|
155
167
|
class_name: string;
|
|
@@ -2886,4 +2898,4 @@ type GenLayerClient<TGenLayerChain extends GenLayerChain> = Omit<Client<Transpor
|
|
|
2886
2898
|
}) => Promise<bigint>;
|
|
2887
2899
|
} & StakingActions;
|
|
2888
2900
|
|
|
2889
|
-
export { type
|
|
2901
|
+
export { type ValidatorDepositOptions as $, type SnapSource as A, type StakingContract as B, type CalldataEncodable as C, type DecodedDeployData as D, ExecutionResult as E, type ValidatorView as F, type GenLayerClient as G, type Hash as H, type ValidatorIdentity as I, type ValidatorInfo as J, type PendingWithdrawal as K, type LeaderReceipt as L, type MethodDescription as M, type Network as N, type BannedValidatorInfo as O, type PendingDeposit as P, type StakeInfo as Q, type EpochData as R, STAKING_ABI as S, type TransactionDataElement as T, type EpochInfo as U, VALIDATOR_WALLET_ABI as V, type WithdrawalCommit as W, type StakingTransactionResult as X, type ValidatorJoinResult as Y, type DelegatorJoinResult as Z, type ValidatorJoinOptions as _, type DecodedCallData as a, type ValidatorExitOptions as a0, type ValidatorClaimOptions as a1, type ValidatorPrimeOptions as a2, type SetOperatorOptions as a3, type SetIdentityOptions as a4, type DelegatorJoinOptions as a5, type DelegatorExitOptions as a6, type DelegatorClaimOptions as a7, type StakingActions as a8, type GenLayerRawTransaction as b, type GenLayerTransaction as c, type ContractSchema as d, CalldataAddress as e, type GenLayerMethod as f, type ContractParamsArraySchemaElement as g, type ContractParamsSchema as h, type ContractMethodBase as i, type ContractMethod as j, type TransactionHash as k, TransactionStatus as l, TransactionResult as m, transactionsStatusNameToNumber as n, DECIDED_STATES as o, isDecidedState as p, transactionResultNumberToName as q, TransactionResultNameToNumber as r, executionResultNumberToName as s, transactionsStatusNumberToName as t, VoteType as u, voteTypeNumberToName as v, voteTypeNameToNumber as w, type TransactionType as x, TransactionHashVariant as y, type DebugTraceResult as z };
|
package/dist/index.cjs
CHANGED
|
@@ -1328,6 +1328,13 @@ var transactionActions = (client, publicClient) => ({
|
|
|
1328
1328
|
});
|
|
1329
1329
|
return logs.map((log) => log.topics[1]).filter(Boolean);
|
|
1330
1330
|
},
|
|
1331
|
+
debugTraceTransaction: async ({ hash, round = 0 }) => {
|
|
1332
|
+
const result = await client.request({
|
|
1333
|
+
method: "gen_dbg_traceTransaction",
|
|
1334
|
+
params: [{ txID: hash, round }]
|
|
1335
|
+
});
|
|
1336
|
+
return result;
|
|
1337
|
+
},
|
|
1331
1338
|
cancelTransaction: async ({ hash }) => {
|
|
1332
1339
|
if (!client.chain.isStudio) {
|
|
1333
1340
|
throw new Error("cancelTransaction is only available on studio-based chains (localnet/studionet)");
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as viem from 'viem';
|
|
2
2
|
import { Account, Address, Hex } from 'viem';
|
|
3
3
|
import { G as GenLayerChain } from './chains-DqSbucSW.cjs';
|
|
4
|
-
import { G as GenLayerClient, D as DecodedDeployData, a as DecodedCallData, b as GenLayerRawTransaction, c as GenLayerTransaction, C as CalldataEncodable, T as TransactionDataElement, S as STAKING_ABI, V as VALIDATOR_WALLET_ABI, d as ContractSchema } from './index-
|
|
4
|
+
import { G as GenLayerClient, D as DecodedDeployData, a as DecodedCallData, b as GenLayerRawTransaction, c as GenLayerTransaction, C as CalldataEncodable, T as TransactionDataElement, S as STAKING_ABI, V as VALIDATOR_WALLET_ABI, d as ContractSchema } from './index-BVTLJo0j.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';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as viem from 'viem';
|
|
2
2
|
import { Account, Address, Hex } from 'viem';
|
|
3
3
|
import { G as GenLayerChain } from './chains-DqSbucSW.js';
|
|
4
|
-
import { G as GenLayerClient, D as DecodedDeployData, a as DecodedCallData, b as GenLayerRawTransaction, c as GenLayerTransaction, C as CalldataEncodable, T as TransactionDataElement, S as STAKING_ABI, V as VALIDATOR_WALLET_ABI, d as ContractSchema } from './index-
|
|
4
|
+
import { G as GenLayerClient, D as DecodedDeployData, a as DecodedCallData, b as GenLayerRawTransaction, c as GenLayerTransaction, C as CalldataEncodable, T as TransactionDataElement, S as STAKING_ABI, V as VALIDATOR_WALLET_ABI, d as ContractSchema } from './index-Dc8L54mZ.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';
|
package/dist/index.js
CHANGED
|
@@ -1328,6 +1328,13 @@ var transactionActions = (client, publicClient) => ({
|
|
|
1328
1328
|
});
|
|
1329
1329
|
return logs.map((log) => log.topics[1]).filter(Boolean);
|
|
1330
1330
|
},
|
|
1331
|
+
debugTraceTransaction: async ({ hash, round = 0 }) => {
|
|
1332
|
+
const result = await client.request({
|
|
1333
|
+
method: "gen_dbg_traceTransaction",
|
|
1334
|
+
params: [{ txID: hash, round }]
|
|
1335
|
+
});
|
|
1336
|
+
return result;
|
|
1337
|
+
},
|
|
1331
1338
|
cancelTransaction: async ({ hash }) => {
|
|
1332
1339
|
if (!client.chain.isStudio) {
|
|
1333
1340
|
throw new Error("cancelTransaction is only available on studio-based chains (localnet/studionet)");
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { Account, Address } from 'viem';
|
|
2
|
-
export {
|
|
2
|
+
export { O as BannedValidatorInfo, e as CalldataAddress, C as CalldataEncodable, j as ContractMethod, i as ContractMethodBase, g as ContractParamsArraySchemaElement, h as ContractParamsSchema, d as ContractSchema, o as DECIDED_STATES, z as DebugTraceResult, a as DecodedCallData, D as DecodedDeployData, a7 as DelegatorClaimOptions, a6 as DelegatorExitOptions, a5 as DelegatorJoinOptions, Z as DelegatorJoinResult, R as EpochData, U as EpochInfo, E as ExecutionResult, G as GenLayerClient, f as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, L as LeaderReceipt, M as MethodDescription, N as Network, P as PendingDeposit, K as PendingWithdrawal, a4 as SetIdentityOptions, a3 as SetOperatorOptions, A as SnapSource, Q as StakeInfo, a8 as StakingActions, B as StakingContract, X as StakingTransactionResult, k as TransactionHash, y as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, x as TransactionType, a1 as ValidatorClaimOptions, $ as ValidatorDepositOptions, a0 as ValidatorExitOptions, I as ValidatorIdentity, J as ValidatorInfo, _ as ValidatorJoinOptions, Y as ValidatorJoinResult, a2 as ValidatorPrimeOptions, F as ValidatorView, u as VoteType, W as WithdrawalCommit, s as executionResultNumberToName, p as isDecidedState, q as transactionResultNumberToName, n as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, w as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-BVTLJo0j.cjs';
|
|
3
3
|
export { G as GenLayerChain } from '../chains-DqSbucSW.cjs';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { Account, Address } from 'viem';
|
|
2
|
-
export {
|
|
2
|
+
export { O as BannedValidatorInfo, e as CalldataAddress, C as CalldataEncodable, j as ContractMethod, i as ContractMethodBase, g as ContractParamsArraySchemaElement, h as ContractParamsSchema, d as ContractSchema, o as DECIDED_STATES, z as DebugTraceResult, a as DecodedCallData, D as DecodedDeployData, a7 as DelegatorClaimOptions, a6 as DelegatorExitOptions, a5 as DelegatorJoinOptions, Z as DelegatorJoinResult, R as EpochData, U as EpochInfo, E as ExecutionResult, G as GenLayerClient, f as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, L as LeaderReceipt, M as MethodDescription, N as Network, P as PendingDeposit, K as PendingWithdrawal, a4 as SetIdentityOptions, a3 as SetOperatorOptions, A as SnapSource, Q as StakeInfo, a8 as StakingActions, B as StakingContract, X as StakingTransactionResult, k as TransactionHash, y as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, x as TransactionType, a1 as ValidatorClaimOptions, $ as ValidatorDepositOptions, a0 as ValidatorExitOptions, I as ValidatorIdentity, J as ValidatorInfo, _ as ValidatorJoinOptions, Y as ValidatorJoinResult, a2 as ValidatorPrimeOptions, F as ValidatorView, u as VoteType, W as WithdrawalCommit, s as executionResultNumberToName, p as isDecidedState, q as transactionResultNumberToName, n as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, w as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-Dc8L54mZ.js';
|
|
3
3
|
export { G as GenLayerChain } from '../chains-DqSbucSW.js';
|