From a4e5159ba689c96b63267eb1910c3f9be6a3b62f Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 11 Sep 2023 11:56:36 -0400 Subject: [PATCH] Add Mint and Burn receipts to fuel-explorer (#1342) --- .../schema/fuel_explorer.schema.graphql | 19 ++++++++++ .../fuel-explorer/fuel-explorer/src/lib.rs | 35 ++++++++++++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/examples/fuel-explorer/fuel-explorer/schema/fuel_explorer.schema.graphql b/examples/fuel-explorer/fuel-explorer/schema/fuel_explorer.schema.graphql index 1650b44bf..91ab44bf4 100644 --- a/examples/fuel-explorer/fuel-explorer/schema/fuel_explorer.schema.graphql +++ b/examples/fuel-explorer/fuel-explorer/schema/fuel_explorer.schema.graphql @@ -358,6 +358,23 @@ type MessageOutReceipt @entity(virtual: true) { is_message_out: Boolean! } +type MintReceipt @entity(virtual: true) { + sub_id: Bytes32! + contract_id: ContractId! + val: UInt8! + pc: UInt8! + isr: UInt8! +} + + +type BurnReceipt @entity(virtual: true) { + sub_id: Bytes32! + contract_id: ContractId! + val: UInt8! + pc: UInt8! + isr: UInt8! +} + union Receipt = CallReceipt | ReturnReceipt @@ -370,6 +387,8 @@ union Receipt = | TransferOutReceipt | ScriptResultReceipt | MessageOutReceipt + | MintReceipt + | BurnReceipt type VariableOutput @entity { id: ID! diff --git a/examples/fuel-explorer/fuel-explorer/src/lib.rs b/examples/fuel-explorer/fuel-explorer/src/lib.rs index 7c9b574ca..fff8a515a 100644 --- a/examples/fuel-explorer/fuel-explorer/src/lib.rs +++ b/examples/fuel-explorer/fuel-explorer/src/lib.rs @@ -714,7 +714,40 @@ impl From for Receipt { Self::from(receipt) } - fuel::Receipt::Mint { .. } | fuel::Receipt::Burn { .. } => todo!(), + fuel::Receipt::Mint { + sub_id, + contract_id, + val, + pc, + is, + } => { + let receipt = MintReceipt { + sub_id, + contract_id, + val, + pc, + isr: is, + }; + + Self::from(receipt) + } + fuel::Receipt::Burn { + sub_id, + contract_id, + val, + pc, + is, + } => { + let receipt = BurnReceipt { + sub_id, + contract_id, + val, + pc, + isr: is, + }; + + Self::from(receipt) + } } } }