Skip to content

Commit dd79025

Browse files
committed
add docs
1 parent e50d284 commit dd79025

File tree

13 files changed

+3408
-10
lines changed

13 files changed

+3408
-10
lines changed

README.md

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,35 @@ php artisan vendor:publish --tag="laravel-evm-config"
2424

2525

2626
## env
27-
EVM_CHAIN_ID=137
28-
EVM_RPC_1=https://polygon-mainnet.g.alchemy.com/v2/KEY
29-
EVM_PRIVATE_KEY=0xabc123...64hex
30-
QUEUE_CONNECTION=redis
27+
```dotenv
28+
EVM_CHAIN_ID=137
29+
EVM_RPC_1=https://polygon-mainnet.g.alchemy.com/v2/KEY
30+
EVM_PRIVATE_KEY=0xabc123...64hex
31+
QUEUE_CONNECTION=redis
32+
```
3133

32-
## Usage
34+
## Usage (Quick Glimpse)
3335

3436
```php
3537
use LaravelEvm; // Facade alias defined in composer.json
3638

37-
$abi = file_get_contents(storage_path('app/abi/IntegrityAnchorSimple.abi.json'));
39+
$abi = file_get_contents(storage_path('app/abi/MyContract.abi.json'));
3840
$contract = LaravelEvm::at('0xYourContract', $abi);
3941

40-
// read
41-
$res = $contract->call('isAnchored', [1, '0x'.$hashHex]);
42+
// Read call
43+
$balance = $contract->call('balanceOf', ['0xUser']);
44+
45+
// Write (async)
46+
$jobId = $contract->sendAsync('transfer', ['0xRecipient', 100]);
47+
```
4248

43-
// write non blocking
44-
$jobId = $contract->sendAsync('anchor', [1, '0x'.$hashHex, 'meta']);
49+
Wait for a known tx hash:
50+
```php
51+
$receipt = $contract->wait('0xTxHash');
4552
```
4653

54+
More examples & full documentation: See the VitePress docs in `docs/pages` or visit the published site.
55+
4756
### Generate new addresses
4857

4958
The package ships with a helper to generate fresh Ethereum keypairs (using `kornrunner/ethereum-address`).
@@ -74,6 +83,28 @@ Sample JSON response:
7483

7584
Security note: Private keys are shown once. Persist them securely (e.g. Vault, KMS). Never commit them.
7685

86+
### Facades Overview
87+
88+
Facade aliases (registered in `composer.json`):
89+
90+
| Facade | Binding |
91+
|--------|---------|
92+
| `LaravelEvm` | ContractClient |
93+
| `EvmContract` | ContractClient |
94+
| `EvmRpc` | RpcClient |
95+
| `EvmSigner` | Signer |
96+
| `EvmFees` | FeePolicy |
97+
| `EvmNonce` | NonceManager |
98+
99+
Example usage:
100+
```php
101+
$symbol = \LaravelEvm::at('0xContract', $abi)->call('symbol');
102+
$health = \EvmRpc::health();
103+
$address = \EvmSigner::getAddress();
104+
// Suggest fees (implement suggest() if missing in your FeePolicy)
105+
// $fees = \EvmFees::suggest();
106+
```
107+
77108
## Testing
78109

79110
```bash

docs/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*.log
2+
*.tgz
3+
.DS_Store
4+
.idea
5+
.temp
6+
.vite_opt_cache
7+
.vscode
8+
dist
9+
cache
10+
temp
11+
node_modules

docs/.vitepress/config.mts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { defineConfig } from 'vitepress';
2+
3+
export default defineConfig({
4+
title: 'Laravel EVM',
5+
description: 'Reliable EVM interaction for Laravel (contracts, async transactions, fees, nonces, multi-RPC)',
6+
srcDir: '.',
7+
outDir: '../build/docs',
8+
cleanUrls: true,
9+
lastUpdated: true,
10+
themeConfig: {
11+
nav: [
12+
{ text: 'Guide', link: '/pages/README' },
13+
{ text: 'Architecture', link: '/pages/architecture' },
14+
{ text: 'Configuration', link: '/pages/configuration' },
15+
{ text: 'Transactions', link: '/pages/transactions' },
16+
{ text: 'Events', link: '/pages/events' },
17+
{ text: 'Facades', link: '/pages/facades' },
18+
{ text: 'Examples', link: '/pages/examples' }
19+
],
20+
sidebar: {
21+
'/pages/': [
22+
{
23+
text: 'Overview',
24+
items: [
25+
{ text: 'Introduction', link: '/pages/README#introduction' },
26+
{ text: 'Quick Start', link: '/pages/README#quick-start' },
27+
{ text: 'Core Concepts', link: '/pages/README#core-concepts' }
28+
]
29+
},
30+
{
31+
text: 'Architecture',
32+
items: [
33+
{ text: 'Component Diagram', link: '/pages/architecture#component-diagram' },
34+
{ text: 'Transaction Lifecycle', link: '/pages/architecture#transaction-job-lifecycle' },
35+
{ text: 'Events', link: '/pages/events' }
36+
]
37+
},
38+
{
39+
text: 'Runtime',
40+
items: [
41+
{ text: 'Configuration', link: '/pages/configuration' },
42+
{ text: 'Facades', link: '/pages/facades' },
43+
{ text: 'Transactions', link: '/pages/transactions' },
44+
{ text: 'Events', link: '/pages/events' },
45+
{ text: 'Examples', link: '/pages/examples' }
46+
]
47+
},
48+
{
49+
text: 'Advanced',
50+
items: [
51+
{ text: 'Extensibility Points', link: '/pages/architecture#extensibility-points' },
52+
{ text: 'Concurrency Model', link: '/pages/architecture#concurrency-model' },
53+
{ text: 'Security Considerations', link: '/pages/architecture#security-considerations' }
54+
]
55+
}
56+
]
57+
},
58+
socialLinks: [
59+
{ icon: 'github', link: 'https://github.com/farbcodegmbh/laravel-evm' }
60+
],
61+
footer: {
62+
message: 'MIT Licensed',
63+
copyright: 'Copyright © 2025 Farbcode GmbH'
64+
}
65+
}
66+
});

0 commit comments

Comments
 (0)