-
Notifications
You must be signed in to change notification settings - Fork 222
/
Copy patharweave.ts
81 lines (76 loc) · 1.83 KB
/
arweave.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { Bytes } from '../common/collections';
// Most types from this namespace are direct mappings or adaptations from:
// https://github.com/ChainSafe/firehose-arweave/blob/master/proto/sf/arweave/type/v1/type.proto
export namespace arweave {
/**
* A key-value pair for arbitrary metadata
*/
export class Tag {
constructor(
public name: Bytes,
public value: Bytes,
) {}
}
export class ProofOfAccess {
constructor(
public option: string,
public txPath: Bytes,
public dataPath: Bytes,
public chunk: Bytes,
) {}
}
/**
* An Arweave block.
*/
export class Block {
constructor(
public timestamp: u64,
public lastRetarget: u64,
public height: u64,
public indepHash: Bytes,
public nonce: Bytes,
public previousBlock: Bytes,
public diff: Bytes,
public hash: Bytes,
public txRoot: Bytes,
public txs: Bytes[],
public walletList: Bytes,
public rewardAddr: Bytes,
public tags: Tag[],
public rewardPool: Bytes,
public weaveSize: Bytes,
public blockSize: Bytes,
public cumulativeDiff: Bytes,
public hashListMerkle: Bytes,
public poa: ProofOfAccess,
) {}
}
/**
* An Arweave transaction
*/
export class Transaction {
constructor(
public format: u32,
public id: Bytes,
public lastTx: Bytes,
public owner: Bytes,
public tags: Tag[],
public target: Bytes,
public quantity: Bytes,
public data: Bytes,
public dataSize: Bytes,
public dataRoot: Bytes,
public signature: Bytes,
public reward: Bytes,
) {}
}
/**
* An Arweave transaction with block ptr
*/
export class TransactionWithBlockPtr {
constructor(
public tx: Transaction,
public block: Block,
) {}
}
}