Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions pages/api-references/genlayer-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,36 +69,36 @@ 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: [],
})
```

### Writing a transaction
```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
})

```
Expand Down
14 changes: 7 additions & 7 deletions pages/api-references/genlayer-py.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
)
```

Expand Down
Loading