@brninpay/evm 0.1.0 → 1.1.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/.turbo/turbo-build.log +4 -4
- package/.turbo/turbo-typecheck.log +4 -0
- package/CHANGELOG.md +23 -0
- package/LICENSE +1 -1
- package/README.md +108 -4
- package/package.json +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
> @brninpay/evm@
|
|
3
|
-
> tsc
|
|
4
|
-
|
|
1
|
+
|
|
2
|
+
> @brninpay/evm@1.1.0 build /home/bernieweb3/Downloads/runtimee/packages/evm
|
|
3
|
+
> tsc
|
|
4
|
+
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @brninpay/evm
|
|
2
|
+
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ea45d4c: Minor fixes
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [ea45d4c]
|
|
12
|
+
- @brninpay/core@1.1.0
|
|
13
|
+
|
|
14
|
+
## 1.0.0
|
|
15
|
+
|
|
16
|
+
### Major Changes
|
|
17
|
+
|
|
18
|
+
- 5fc7f42: Brninpay is here! From BernieWeb3 a.k.a NxBern with love :3
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [5fc7f42]
|
|
23
|
+
- @brninpay/core@1.0.0
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,7 +1,111 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @brninpay/evm
|
|
2
2
|
|
|
3
|
-
EVM execution adapter for
|
|
3
|
+
EVM execution adapter for Brninpay. Implements the `ExecutionProvider` interface for Base + USDC.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install @brninpay/evm
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Requires `@brninpay/core` as a peer dependency.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Execution Provider
|
|
16
|
+
|
|
17
|
+
Create an EVM provider that simulates, signs, and broadcasts transactions:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { createEVMProvider, createViemBroadcaster } from '@brninpay/evm'
|
|
21
|
+
import { createWalletClient, http } from 'viem'
|
|
22
|
+
import { base } from 'viem/chains'
|
|
23
|
+
|
|
24
|
+
const walletClient = createWalletClient({
|
|
25
|
+
chain: base,
|
|
26
|
+
transport: http('https://base-mainnet.g.alchemy.com/v2/YOUR_KEY'),
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const broadcaster = createViemBroadcaster({
|
|
30
|
+
publicClient: walletClient,
|
|
31
|
+
confirmationBlocks: 2,
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const provider = createEVMProvider(
|
|
35
|
+
{ signerAddress: '0x...', publicClient: walletClient },
|
|
36
|
+
{ /* optional Signer */ }
|
|
37
|
+
)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Transaction Building
|
|
41
|
+
|
|
42
|
+
Build and encode USDC transfer transactions:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { encodeUsdcTransfer, buildEvmTransaction } from '@brninpay/evm'
|
|
46
|
+
|
|
47
|
+
const txData = encodeUsdcTransfer('0xrecipient...', 1000000n) // 1 USDC
|
|
48
|
+
|
|
49
|
+
const tx = buildEvmTransaction({
|
|
50
|
+
to: '0xrecipient...',
|
|
51
|
+
from: '0xsender...',
|
|
52
|
+
amount: 1000000n,
|
|
53
|
+
chainId: 8453,
|
|
54
|
+
nonce: 0,
|
|
55
|
+
gasLimit: 100000n,
|
|
56
|
+
})
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Gas Strategy
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { estimateGasWithBuffer } from '@brninpay/evm'
|
|
63
|
+
|
|
64
|
+
const gasLimit = estimateGasWithBuffer(80000n) // adds 20% buffer
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Broadcaster
|
|
68
|
+
|
|
69
|
+
Broadcast signed transactions and wait for confirmations:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
const broadcaster = createViemBroadcaster({
|
|
73
|
+
publicClient: walletClient,
|
|
74
|
+
confirmationBlocks: 2,
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
const txHash = await broadcaster.broadcast(signedTx)
|
|
78
|
+
const receipt = await broadcaster.waitForTransaction(txHash)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## API
|
|
82
|
+
|
|
83
|
+
### `createEVMProvider(config, signer?)` → `ExecutionProvider`
|
|
84
|
+
|
|
85
|
+
Creates an EVM execution provider with optional signer. Implements `simulate()`, `sign()`, `broadcast()`.
|
|
86
|
+
|
|
87
|
+
### `encodeUsdcTransfer(recipient, amount)` → `Hex`
|
|
88
|
+
|
|
89
|
+
Encodes a USDC `transfer()` call for the Base USDC contract.
|
|
90
|
+
|
|
91
|
+
### `buildEvmTransaction(params)` → `EvmTransaction`
|
|
92
|
+
|
|
93
|
+
Builds a transaction object from intent parameters.
|
|
94
|
+
|
|
95
|
+
### `createViemBroadcaster(config)` → `Broadcaster`
|
|
96
|
+
|
|
97
|
+
Creates a broadcaster using Viem. Supports configurable confirmation blocks.
|
|
98
|
+
|
|
99
|
+
### `estimateGasWithBuffer(estimate)` → `bigint`
|
|
100
|
+
|
|
101
|
+
Adds a 20% buffer to gas estimates.
|
|
102
|
+
|
|
103
|
+
### Constants
|
|
104
|
+
|
|
105
|
+
- `USDC_DECIMALS` — `6`
|
|
106
|
+
- `USDC_ADDRESS_BASE` — Base USDC contract address
|
|
107
|
+
- `USDC_ABI` — Minimal USDC ERC-20 ABI
|
|
108
|
+
|
|
109
|
+
### Type Exports
|
|
110
|
+
|
|
111
|
+
`ExecutionProvider`, `Signer`, `Broadcaster`, `EVMProviderConfig`, `BroadcasterConfig`, `BuildTxParams`, `EvmTransaction`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brninpay/evm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"viem": "^2.21.0",
|
|
15
|
-
"@brninpay/core": "
|
|
15
|
+
"@brninpay/core": "1.1.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "^25.9.1",
|