From c491b5ccc2c06e69ff9d799b25a7ce384633e4a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgars=20Nem=C5=A1e?= Date: Mon, 31 Aug 2026 10:05:45 +0100 Subject: [PATCH] docs: fix SDK API reference snippets --- pages/api-references/genlayer-js.md | 18 +++++++++--------- pages/api-references/genlayer-py.md | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pages/api-references/genlayer-js.md b/pages/api-references/genlayer-js.md index 6b8a52b4..5c7a8828 100644 --- a/pages/api-references/genlayer-js.md +++ b/pages/api-references/genlayer-js.md @@ -69,11 +69,10 @@ const client = createClient({ }); const result = await client.readContract({ - // account: account, Account is optional when reading from contracts + // account is optional when reading from contracts address: contractAddress, functionName: 'get_complete_storage', - args: [] - stateStatus: "accepted", + args: [], }) ``` @@ -81,24 +80,25 @@ const result = await client.readContract({ ```typescript import { localnet } from 'genlayer-js/chains'; import { createClient, createAccount } from "genlayer-js"; +import { TransactionStatus } from "genlayer-js/types"; const client = createClient({ - network: localnet, + chain: localnet, }); const account = createAccount(); const transactionHash = await client.writeContract({ - account: account, // using this account for this transaction + account, // using this account for this transaction address: contractAddress, - functionName: 'account', + functionName: 'update_storage', args: ['new_storage'], - value: 0, // value is optional, if you want to send some native token to the contract + value: BigInt(0), // native token value to send with the transaction }); const receipt = await client.waitForTransactionReceipt({ - hash: txHash, + hash: transactionHash, status: TransactionStatus.FINALIZED, // or ACCEPTED - fullTransaction: false // False by default - returns simplified receipt for better readability + fullTransaction: false, // False by default - returns simplified receipt for better readability }) ``` diff --git a/pages/api-references/genlayer-py.md b/pages/api-references/genlayer-py.md index 0df4eae1..7688c547 100644 --- a/pages/api-references/genlayer-py.md +++ b/pages/api-references/genlayer-py.md @@ -79,8 +79,9 @@ result = client.read_contract( ### Writing a transaction ```python -from genlayer_py.chains import localnet from genlayer_py import create_client, create_account +from genlayer_py.chains import localnet +from genlayer_py.types import TransactionStatus client = create_client( chain=localnet, @@ -90,16 +91,15 @@ account = create_account() transaction_hash = client.write_contract( account=account, - transaction=transaction, address=contract_address, - function_name='account', + function_name='update_storage', args=['new_storage'], - value=0, // value is optional, if you want to send some native token to the contract + value=0, # native token value to send with the transaction ) receipt = client.wait_for_transaction_receipt( - hash=transaction_hash, - status=TransactionStatus.FINALIZED, // or ACCEPTED - full_transaction=False // False by default - returns simplified receipt for better readability + transaction_hash=transaction_hash, + status=TransactionStatus.FINALIZED, # or ACCEPTED + full_transaction=False, # False by default - returns simplified receipt for better readability ) ```