Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.
Merged
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
39 changes: 39 additions & 0 deletions chain/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,44 @@ export namespace ethereum {
) {}
}

/**
* An Ethereum transaction receipt.
*/
export class TransactionReceipt {
constructor(
public transactionHash: Bytes,
public transactionIndex: BigInt,
public blockHash: Bytes,
public blockNumber: BigInt,
public cumulativeGasUsed: BigInt,
public gasUsed: BigInt,
public contractAddress: Address,
public logs: Array<Log>,
public status: BigInt,
public root: Bytes,
public logsBloom: Bytes,
) {}
}

/**
* An Ethereum event log.
*/
export class Log {
constructor(
public address: Address,
public topics: Array<Bytes>,
public data: Bytes,
public blockHash: Bytes,
public blockNumber: Bytes,
public transactionHash: Bytes,
public transactionIndex: BigInt,
public logIndex: BigInt,
public transactionLogIndex: BigInt,
public logType: string,
public removed: Wrapped<bool> | null,
) {}
}

/**
* Common representation for Ethereum smart contract calls.
*/
Expand All @@ -386,6 +424,7 @@ export namespace ethereum {
public block: Block,
public transaction: Transaction,
public parameters: Array<EventParam>,
public receipt: TransactionReceipt | null,
) {}
}

Expand Down
15 changes: 15 additions & 0 deletions global/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export enum TypeId {
ArrayF32 = 49,
ArrayF64 = 50,
ArrayBigDecimal = 51,
// Near types
NearArrayDataReceiver = 52,
NearArrayCryptoHash = 53,
NearArrayActionValue = 54,
Expand Down Expand Up @@ -100,6 +101,7 @@ export enum TypeId {
NearChunkHeader = 84,
NearBlock = 85,
NearReceiptWithOutcome = 86,
// Tendermint types
TendermintArrayEventTx = 87,
TendermintArrayEvent = 88,
TendermintArrayCommitSig = 89,
Expand Down Expand Up @@ -147,6 +149,11 @@ export enum TypeId {
TendermintDuration = 131,
TendermintTimestamp = 132,
TendermintEventData = 133,
// More ethereum types
TransactionReceipt = 134,
Log = 135,
ArrayH256 = 136,
ArrayLog = 137,
}

export function id_of_type(typeId: TypeId): usize {
Expand Down Expand Up @@ -420,6 +427,14 @@ export function id_of_type(typeId: TypeId): usize {
return idof<tendermint.Timestamp>()
case TypeId.TendermintEventData:
return idof<tendermint.EventData>()
case TypeId.TransactionReceipt:
return idof<ethereum.TransactionReceipt>()
case TypeId.Log:
return idof<ethereum.Log>()
case TypeId.ArrayH256:
return idof<Array<Uint8Array>>()
case TypeId.ArrayLog:
return idof<Array<ethereum.Log>>()
default:
return 0
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@graphprotocol/graph-ts",
"description": "TypeScript/AssemblyScript library for writing subgraph mappings for The Graph",
"version": "0.26.0",
"version": "0.27.0-alpha.0",
"module": "index.ts",
"types": "index.ts",
"main": "index.ts",
Expand Down