|
| 1 | +// Copyright 2024 Blink Labs Software |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +package common |
| 16 | + |
| 17 | +import ( |
| 18 | + "github.com/blinklabs-io/gouroboros/cbor" |
| 19 | + |
| 20 | + utxorpc "github.com/utxorpc/go-codegen/utxorpc/v1alpha/cardano" |
| 21 | +) |
| 22 | + |
| 23 | +type Transaction interface { |
| 24 | + TransactionBody |
| 25 | + Metadata() *cbor.LazyValue |
| 26 | + IsValid() bool |
| 27 | + Consumed() []TransactionInput |
| 28 | + Produced() []Utxo |
| 29 | +} |
| 30 | + |
| 31 | +type TransactionBody interface { |
| 32 | + Cbor() []byte |
| 33 | + Fee() uint64 |
| 34 | + Hash() string |
| 35 | + Inputs() []TransactionInput |
| 36 | + Outputs() []TransactionOutput |
| 37 | + TTL() uint64 |
| 38 | + ProtocolParametersUpdate() map[Blake2b224]any |
| 39 | + ValidityIntervalStart() uint64 |
| 40 | + ReferenceInputs() []TransactionInput |
| 41 | + Collateral() []TransactionInput |
| 42 | + CollateralReturn() TransactionOutput |
| 43 | + TotalCollateral() uint64 |
| 44 | + Certificates() []Certificate |
| 45 | + Withdrawals() map[*Address]uint64 |
| 46 | + AuxDataHash() *Blake2b256 |
| 47 | + RequiredSigners() []Blake2b224 |
| 48 | + AssetMint() *MultiAsset[MultiAssetTypeMint] |
| 49 | + ScriptDataHash() *Blake2b256 |
| 50 | + VotingProcedures() VotingProcedures |
| 51 | + ProposalProcedures() []ProposalProcedure |
| 52 | + CurrentTreasuryValue() int64 |
| 53 | + Donation() uint64 |
| 54 | + Utxorpc() *utxorpc.Tx |
| 55 | +} |
| 56 | + |
| 57 | +type TransactionInput interface { |
| 58 | + Id() Blake2b256 |
| 59 | + Index() uint32 |
| 60 | + Utxorpc() *utxorpc.TxInput |
| 61 | +} |
| 62 | + |
| 63 | +type TransactionOutput interface { |
| 64 | + Address() Address |
| 65 | + Amount() uint64 |
| 66 | + Assets() *MultiAsset[MultiAssetTypeOutput] |
| 67 | + Datum() *cbor.LazyValue |
| 68 | + DatumHash() *Blake2b256 |
| 69 | + Cbor() []byte |
| 70 | + Utxorpc() *utxorpc.TxOutput |
| 71 | +} |
| 72 | + |
| 73 | +type Utxo struct { |
| 74 | + Id TransactionInput |
| 75 | + Output TransactionOutput |
| 76 | +} |
0 commit comments