tempo.ts 0.0.0 → 0.0.1
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 +92 -0
- package/dist/chains.d.ts +1477 -0
- package/dist/chains.d.ts.map +1 -0
- package/dist/chains.js +43 -0
- package/dist/chains.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/types.d.ts +284 -0
- package/dist/internal/types.d.ts.map +1 -0
- package/dist/internal/types.js +2 -0
- package/dist/internal/types.js.map +1 -0
- package/dist/ox/TokenId.d.ts +18 -0
- package/dist/ox/TokenId.d.ts.map +1 -0
- package/dist/ox/TokenId.js +29 -0
- package/dist/ox/TokenId.js.map +1 -0
- package/dist/ox/TokenRole.d.ts +11 -0
- package/dist/ox/TokenRole.d.ts.map +1 -0
- package/dist/ox/TokenRole.js +22 -0
- package/dist/ox/TokenRole.js.map +1 -0
- package/dist/ox/Transaction.d.ts +161 -0
- package/dist/ox/Transaction.d.ts.map +1 -0
- package/dist/ox/Transaction.js +117 -0
- package/dist/ox/Transaction.js.map +1 -0
- package/dist/ox/TransactionEnvelopeFeeToken.d.ts +393 -0
- package/dist/ox/TransactionEnvelopeFeeToken.d.ts.map +1 -0
- package/dist/ox/TransactionEnvelopeFeeToken.js +452 -0
- package/dist/ox/TransactionEnvelopeFeeToken.js.map +1 -0
- package/dist/ox/TransactionRequest.d.ts +62 -0
- package/dist/ox/TransactionRequest.d.ts.map +1 -0
- package/dist/ox/TransactionRequest.js +66 -0
- package/dist/ox/TransactionRequest.js.map +1 -0
- package/dist/ox/index.d.ts +5 -0
- package/dist/ox/index.d.ts.map +1 -0
- package/dist/ox/index.js +5 -0
- package/dist/ox/index.js.map +1 -0
- package/dist/prool/Instance.d.ts +92 -0
- package/dist/prool/Instance.d.ts.map +1 -0
- package/dist/prool/Instance.js +96 -0
- package/dist/prool/Instance.js.map +1 -0
- package/dist/prool/index.d.ts +2 -0
- package/dist/prool/index.d.ts.map +1 -0
- package/dist/prool/index.js +2 -0
- package/dist/prool/index.js.map +1 -0
- package/dist/viem/abis.d.ts +2058 -0
- package/dist/viem/abis.d.ts.map +1 -0
- package/dist/viem/abis.js +1599 -0
- package/dist/viem/abis.js.map +1 -0
- package/dist/viem/actions/amm.d.ts +2091 -0
- package/dist/viem/actions/amm.d.ts.map +1 -0
- package/dist/viem/actions/amm.js +876 -0
- package/dist/viem/actions/amm.js.map +1 -0
- package/dist/viem/actions/fee.d.ts +727 -0
- package/dist/viem/actions/fee.d.ts.map +1 -0
- package/dist/viem/actions/fee.js +230 -0
- package/dist/viem/actions/fee.js.map +1 -0
- package/dist/viem/actions/index.d.ts +5 -0
- package/dist/viem/actions/index.d.ts.map +1 -0
- package/dist/viem/actions/index.js +5 -0
- package/dist/viem/actions/index.js.map +1 -0
- package/dist/viem/actions/policy.d.ts +1900 -0
- package/dist/viem/actions/policy.d.ts.map +1 -0
- package/dist/viem/actions/policy.js +841 -0
- package/dist/viem/actions/policy.js.map +1 -0
- package/dist/viem/actions/token.d.ts +13759 -0
- package/dist/viem/actions/token.d.ts.map +1 -0
- package/dist/viem/actions/token.js +2579 -0
- package/dist/viem/actions/token.js.map +1 -0
- package/dist/viem/addresses.d.ts +8 -0
- package/dist/viem/addresses.d.ts.map +1 -0
- package/dist/viem/addresses.js +8 -0
- package/dist/viem/addresses.js.map +1 -0
- package/dist/viem/chain.d.ts +341 -0
- package/dist/viem/chain.d.ts.map +1 -0
- package/dist/viem/chain.js +22 -0
- package/dist/viem/chain.js.map +1 -0
- package/dist/viem/client.d.ts +27 -0
- package/dist/viem/client.d.ts.map +1 -0
- package/dist/viem/client.js +28 -0
- package/dist/viem/client.js.map +1 -0
- package/dist/viem/decorator.d.ts +1636 -0
- package/dist/viem/decorator.d.ts.map +1 -0
- package/dist/viem/decorator.js +95 -0
- package/dist/viem/decorator.js.map +1 -0
- package/dist/viem/formatters.d.ts +4 -0
- package/dist/viem/formatters.d.ts.map +1 -0
- package/dist/viem/formatters.js +69 -0
- package/dist/viem/formatters.js.map +1 -0
- package/dist/viem/index.d.ts +9 -0
- package/dist/viem/index.d.ts.map +1 -0
- package/dist/viem/index.js +9 -0
- package/dist/viem/index.js.map +1 -0
- package/dist/viem/transaction.d.ts +54 -0
- package/dist/viem/transaction.d.ts.map +1 -0
- package/dist/viem/transaction.js +108 -0
- package/dist/viem/transaction.js.map +1 -0
- package/dist/viem/transport.d.ts +16 -0
- package/dist/viem/transport.d.ts.map +1 -0
- package/dist/viem/transport.js +33 -0
- package/dist/viem/transport.js.map +1 -0
- package/dist/viem/types.d.ts +10 -0
- package/dist/viem/types.d.ts.map +1 -0
- package/dist/viem/types.js +2 -0
- package/dist/viem/types.js.map +1 -0
- package/dist/viem/utils.d.ts +8 -0
- package/dist/viem/utils.d.ts.map +1 -0
- package/dist/viem/utils.js +9 -0
- package/dist/viem/utils.js.map +1 -0
- package/package.json +100 -2
- package/src/chains.ts +46 -0
- package/src/index.ts +1 -0
- package/src/internal/types.ts +414 -0
- package/src/ox/TokenId.test.ts +29 -0
- package/src/ox/TokenId.ts +35 -0
- package/src/ox/TokenRole.test.ts +20 -0
- package/src/ox/TokenRole.ts +27 -0
- package/src/ox/Transaction.test.ts +257 -0
- package/src/ox/Transaction.ts +247 -0
- package/src/ox/TransactionEnvelopeFeeToken.test.ts +1215 -0
- package/src/ox/TransactionEnvelopeFeeToken.ts +717 -0
- package/src/ox/TransactionRequest.ts +100 -0
- package/src/ox/index.ts +4 -0
- package/src/prool/Instance.test.ts +43 -0
- package/src/prool/Instance.ts +190 -0
- package/src/prool/index.ts +1 -0
- package/src/prool/internal/chain.json +106 -0
- package/src/prool/internal/consensus.toml +32 -0
- package/src/viem/abis.ts +1606 -0
- package/src/viem/actions/amm.test.ts +425 -0
- package/src/viem/actions/amm.ts +1308 -0
- package/src/viem/actions/fee.test.ts +281 -0
- package/src/viem/actions/fee.ts +362 -0
- package/src/viem/actions/index.ts +4 -0
- package/src/viem/actions/policy.test.ts +514 -0
- package/src/viem/actions/policy.ts +1284 -0
- package/src/viem/actions/token.test.ts +2172 -0
- package/src/viem/actions/token.ts +3830 -0
- package/src/viem/addresses.ts +10 -0
- package/src/viem/chain.ts +27 -0
- package/src/viem/client.bench-d.ts +8 -0
- package/src/viem/client.test.ts +152 -0
- package/src/viem/client.ts +91 -0
- package/src/viem/decorator.bench-d.ts +11 -0
- package/src/viem/decorator.test.ts +35 -0
- package/src/viem/decorator.ts +1914 -0
- package/src/viem/e2e.test.ts +410 -0
- package/src/viem/formatters.ts +100 -0
- package/src/viem/index.ts +8 -0
- package/src/viem/transaction.ts +253 -0
- package/src/viem/transport.ts +47 -0
- package/src/viem/types.ts +55 -0
- package/src/viem/utils.ts +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Tempo TS
|
|
2
|
+
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> This is a temporary package for TypeScript tooling for Tempo.
|
|
5
|
+
> It will be merged into [Wevm](https://github.com/wevm) repositories soon.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm i tempo.ts
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
If you wish to use `tempo.ts/prool` for programmatic Tempo node instances, you will need
|
|
14
|
+
to have the `tempo` binary installed:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
gh repo clone tempoxyz/tempo && cd tempo
|
|
18
|
+
cargo install --path bin/tempo
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Entrypoints
|
|
22
|
+
|
|
23
|
+
| Entrypoint | Description |
|
|
24
|
+
| ---------------- | ---------------------------------------- |
|
|
25
|
+
| `tempo.ts/viem` | Tempo extension for Viem. |
|
|
26
|
+
| `tempo.ts/ox` | Tempo primitives for Ox. |
|
|
27
|
+
| `tempo.ts/prool` | Tempo instance for pooled HTTP/WS tests. |
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
### `tempo.ts/viem`
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { createClient, http, publicActions, walletActions } from 'viem';
|
|
35
|
+
import { tempo } from 'tempo.ts/chains';
|
|
36
|
+
|
|
37
|
+
const client = createClient({
|
|
38
|
+
chain: tempo,
|
|
39
|
+
transport: http(),
|
|
40
|
+
})
|
|
41
|
+
.extend(publicActions)
|
|
42
|
+
.extend(walletActions);
|
|
43
|
+
|
|
44
|
+
const hash = await client.sendTransaction({
|
|
45
|
+
calls: [
|
|
46
|
+
{ data: '0x...', to: '0x...' },
|
|
47
|
+
{ data: '0x...', to: '0x...' },
|
|
48
|
+
],
|
|
49
|
+
feeToken: '0x20c0000000000000000000000000000000000000',
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const transaction = await client.getTransaction({ hash });
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### `tempo.ts/ox`
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { Secp256k1, Value } from 'ox';
|
|
59
|
+
import { TransactionEnvelopeFeeToken as TxFeeToken } from 'tempo.ts/ox';
|
|
60
|
+
|
|
61
|
+
const envelope = TxFeeToken.from({
|
|
62
|
+
chainId: 1,
|
|
63
|
+
feeToken: '0x20c0000000000000000000000000000000000001',
|
|
64
|
+
maxFeePerGas: Value.fromGwei('10'),
|
|
65
|
+
maxPriorityFeePerGas: Value.fromGwei('1'),
|
|
66
|
+
to: '0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef',
|
|
67
|
+
value: Value.fromEther('1'),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const signature = Secp256k1.sign({
|
|
71
|
+
payload: TxFeeToken.getSignPayload(envelope),
|
|
72
|
+
privateKey: '0x...',
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const envelope_signed = TxFeeToken.from(envelope, {
|
|
76
|
+
signature,
|
|
77
|
+
});
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### `tempo.ts/prool`
|
|
81
|
+
|
|
82
|
+
You can programmatically start a Tempo node instance in TypeScript using `Instance.tempo`:
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import { Instance } from 'tempo.ts/prool';
|
|
86
|
+
|
|
87
|
+
const instance = Instance.tempo();
|
|
88
|
+
|
|
89
|
+
await instance.start();
|
|
90
|
+
// ...
|
|
91
|
+
await instance.stop();
|
|
92
|
+
```
|