From 0c9825c13651b07b33854ee5924aac828e4529ae Mon Sep 17 00:00:00 2001 From: wregulski Date: Mon, 10 Jul 2023 09:21:18 +0200 Subject: [PATCH] docs: adds comments for epxorted methods --- mappings/admin.go | 1 + mappings/common/common.go | 1 + mappings/destination.go | 2 ++ mappings/fee_unit.go | 2 ++ mappings/paymail_address.go | 3 +++ mappings/script_output.go | 2 ++ mappings/sync_config.go | 2 ++ mappings/transaction.go | 13 +++++++++++++ mappings/utxo.go | 4 ++++ mappings/xpub.go | 1 + 10 files changed, 31 insertions(+) diff --git a/mappings/admin.go b/mappings/admin.go index c9ef826e3..a6ff441b7 100644 --- a/mappings/admin.go +++ b/mappings/admin.go @@ -5,6 +5,7 @@ import ( buxmodels "github.com/BuxOrg/bux-models" ) +// MapToAdminStatsContract will map the model from bux to the bux-models contract func MapToAdminStatsContract(s *bux.AdminStats) *buxmodels.AdminStats { return &buxmodels.AdminStats{ Balance: s.Balance, diff --git a/mappings/common/common.go b/mappings/common/common.go index 3c5f0c8fe..a57b2e777 100644 --- a/mappings/common/common.go +++ b/mappings/common/common.go @@ -16,6 +16,7 @@ func MapToContract(m *bux.Model) *common.Model { } } +// MapToModel will map the bux-models contract to the common bux model func MapToModel(m *common.Model) *bux.Model { return &bux.Model{ CreatedAt: m.CreatedAt, diff --git a/mappings/destination.go b/mappings/destination.go index 40cbad155..a045f5705 100644 --- a/mappings/destination.go +++ b/mappings/destination.go @@ -6,6 +6,7 @@ import ( "github.com/BuxOrg/bux-server/mappings/common" ) +// MapToDestinationContract will map the bux destination model to the bux-models contract func MapToDestinationContract(d *bux.Destination) *buxmodels.Destination { return &buxmodels.Destination{ Model: *common.MapToContract(&d.Model), @@ -21,6 +22,7 @@ func MapToDestinationContract(d *bux.Destination) *buxmodels.Destination { } } +// MapToDestinationBux will map the bux-models destination contract to the bux destination model func MapToDestinationBux(d *buxmodels.Destination) *bux.Destination { return &bux.Destination{ Model: *common.MapToModel(&d.Model), diff --git a/mappings/fee_unit.go b/mappings/fee_unit.go index 6fae885fe..63aea7769 100644 --- a/mappings/fee_unit.go +++ b/mappings/fee_unit.go @@ -5,6 +5,7 @@ import ( "github.com/BuxOrg/bux/utils" ) +// MapToFeeUnitContract will map the fee-unit model from bux to the bux-models contract func MapToFeeUnitContract(fu *utils.FeeUnit) (fc *buxmodels.FeeUnit) { return &buxmodels.FeeUnit{ Satoshis: fu.Satoshis, @@ -12,6 +13,7 @@ func MapToFeeUnitContract(fu *utils.FeeUnit) (fc *buxmodels.FeeUnit) { } } +// MapToFeeUnitBux will map the fee-unit model from bux-models to the bux contract func MapToFeeUnitBux(fu *buxmodels.FeeUnit) (fc *utils.FeeUnit) { return &utils.FeeUnit{ Satoshis: fu.Satoshis, diff --git a/mappings/paymail_address.go b/mappings/paymail_address.go index ccd206bc6..13d5c1e1d 100644 --- a/mappings/paymail_address.go +++ b/mappings/paymail_address.go @@ -6,6 +6,7 @@ import ( "github.com/BuxOrg/bux-server/mappings/common" ) +// MapToPaymailContract will map the bux paymail-address model to the bux-models contract func MapToPaymailContract(pa *bux.PaymailAddress) *buxmodels.PaymailAddress { return &buxmodels.PaymailAddress{ Model: *common.MapToContract(&pa.Model), @@ -19,6 +20,7 @@ func MapToPaymailContract(pa *bux.PaymailAddress) *buxmodels.PaymailAddress { } } +// MapToPaymailP4Contract will map the bux-models paymail-address contract to the bux paymail-address model func MapToPaymailP4Contract(p *bux.PaymailP4) *buxmodels.PaymailP4 { return &buxmodels.PaymailP4{ Alias: p.Alias, @@ -32,6 +34,7 @@ func MapToPaymailP4Contract(p *bux.PaymailP4) *buxmodels.PaymailP4 { } } +// MapToPaymailP4Bux will map the bux-models paymail-address contract to the bux paymail-address model func MapToPaymailP4Bux(p *buxmodels.PaymailP4) *bux.PaymailP4 { return &bux.PaymailP4{ Alias: p.Alias, diff --git a/mappings/script_output.go b/mappings/script_output.go index 8dd787d21..d67c228c4 100644 --- a/mappings/script_output.go +++ b/mappings/script_output.go @@ -5,6 +5,7 @@ import ( buxmodels "github.com/BuxOrg/bux-models" ) +// MapToScriptOutputContract will map the script-output model from bux to the bux-models contract func MapToScriptOutputContract(so *bux.ScriptOutput) (sc *buxmodels.ScriptOutput) { return &buxmodels.ScriptOutput{ Address: so.Address, @@ -14,6 +15,7 @@ func MapToScriptOutputContract(so *bux.ScriptOutput) (sc *buxmodels.ScriptOutput } } +// MapToScriptOutputBux will map the script-output model from bux-models to the bux contract func MapToScriptOutputBux(so *buxmodels.ScriptOutput) (sc *bux.ScriptOutput) { return &bux.ScriptOutput{ Address: so.Address, diff --git a/mappings/sync_config.go b/mappings/sync_config.go index 4f05441cd..b705afebd 100644 --- a/mappings/sync_config.go +++ b/mappings/sync_config.go @@ -5,6 +5,7 @@ import ( buxmodels "github.com/BuxOrg/bux-models" ) +// MapToSyncConfigContract will map the sync-config model from bux to the bux-models contract func MapToSyncConfigContract(sc *bux.SyncConfig) *buxmodels.SyncConfig { return &buxmodels.SyncConfig{ Broadcast: sc.Broadcast, @@ -14,6 +15,7 @@ func MapToSyncConfigContract(sc *bux.SyncConfig) *buxmodels.SyncConfig { } } +// MapToSyncConfigBux will map the sync-config model from bux-models to the bux contract func MapToSyncConfigBux(sc *buxmodels.SyncConfig) *bux.SyncConfig { return &bux.SyncConfig{ Broadcast: sc.Broadcast, diff --git a/mappings/transaction.go b/mappings/transaction.go index 822ad76f4..85fbb3ddf 100644 --- a/mappings/transaction.go +++ b/mappings/transaction.go @@ -6,6 +6,7 @@ import ( "github.com/BuxOrg/bux-server/mappings/common" ) +// MapToTransactionContract will map the model from bux to the bux-models contract func MapToTransactionContract(t *bux.Transaction) *buxmodels.Transaction { return &buxmodels.Transaction{ Model: *common.MapToContract(&t.Model), @@ -26,6 +27,7 @@ func MapToTransactionContract(t *bux.Transaction) *buxmodels.Transaction { } } +// MapToTransactionBux will map the model from bux-models to the bux contract func MapToTransactionBux(t *buxmodels.Transaction) *bux.Transaction { return &bux.Transaction{ Model: *common.MapToModel(&t.Model), @@ -45,6 +47,7 @@ func MapToTransactionBux(t *buxmodels.Transaction) *bux.Transaction { } } +// MapToTransactionConfigBux will map the transaction-config model from bux to the bux-models contract func MapToTransactionConfigBux(tx *buxmodels.TransactionConfig) *bux.TransactionConfig { destinations := make([]*bux.Destination, 0) for _, destination := range tx.ChangeDestinations { @@ -89,6 +92,7 @@ func MapToTransactionConfigBux(tx *buxmodels.TransactionConfig) *bux.Transaction } } +// MapToTransactionConfigContract will map the transaction-config model from bux-models to the bux contract func MapToTransactionConfigContract(tx *bux.TransactionConfig) *buxmodels.TransactionConfig { destinations := make([]*buxmodels.Destination, 0) for _, destination := range tx.ChangeDestinations { @@ -132,6 +136,7 @@ func MapToTransactionConfigContract(tx *bux.TransactionConfig) *buxmodels.Transa } } +// MapToDraftTransactionContract will map the transaction-output model from bux to the bux-models contract func MapToDraftTransactionContract(tx *bux.DraftTransaction) *buxmodels.DraftTransaction { return &buxmodels.DraftTransaction{ Model: *common.MapToContract(&tx.Model), @@ -143,6 +148,7 @@ func MapToDraftTransactionContract(tx *bux.DraftTransaction) *buxmodels.DraftTra } } +// MapToTransactionInputContract will map the transaction-output model from bux-models to the bux contract func MapToTransactionInputContract(inp *bux.TransactionInput) *buxmodels.TransactionInput { return &buxmodels.TransactionInput{ Utxo: *MapToUtxoContract(&inp.Utxo), @@ -150,6 +156,7 @@ func MapToTransactionInputContract(inp *bux.TransactionInput) *buxmodels.Transac } } +// MapToTransactionInputBux will map the transaction-output model from bux to the bux-models contract func MapToTransactionInputBux(inp *buxmodels.TransactionInput) *bux.TransactionInput { return &bux.TransactionInput{ Utxo: *MapToUtxoBux(&inp.Utxo), @@ -157,6 +164,7 @@ func MapToTransactionInputBux(inp *buxmodels.TransactionInput) *bux.TransactionI } } +// MapToTransactionOutputContract will map the transaction-output model from bux to the bux-models contract func MapToTransactionOutputContract(out *bux.TransactionOutput) *buxmodels.TransactionOutput { scriptOutputs := make([]*buxmodels.ScriptOutput, 0) for _, scriptOutput := range out.Scripts { @@ -174,6 +182,7 @@ func MapToTransactionOutputContract(out *bux.TransactionOutput) *buxmodels.Trans } } +// MapToTransactionOutputBux will map the transaction-output model from bux-models to the bux contract func MapToTransactionOutputBux(out *buxmodels.TransactionOutput) *bux.TransactionOutput { scriptOutputs := make([]*bux.ScriptOutput, 0) for _, scriptOutput := range out.Scripts { @@ -191,6 +200,7 @@ func MapToTransactionOutputBux(out *buxmodels.TransactionOutput) *bux.Transactio } } +// MapToMapProtocolContract will map the transaction-output model from bux to the bux-models contract func MapToMapProtocolContract(mp *bux.MapProtocol) *buxmodels.MapProtocol { return &buxmodels.MapProtocol{ App: mp.App, @@ -199,6 +209,7 @@ func MapToMapProtocolContract(mp *bux.MapProtocol) *buxmodels.MapProtocol { } } +// MapToMapProtocolBux will map the transaction-output model from bux-models to the bux contract func MapToMapProtocolBux(mp *buxmodels.MapProtocol) *bux.MapProtocol { return &bux.MapProtocol{ App: mp.App, @@ -207,6 +218,7 @@ func MapToMapProtocolBux(mp *buxmodels.MapProtocol) *bux.MapProtocol { } } +// MapToOpReturnContract will map the transaction-output model from bux to the bux-models contract func MapToOpReturnContract(op *bux.OpReturn) *buxmodels.OpReturn { return &buxmodels.OpReturn{ Hex: op.Hex, @@ -216,6 +228,7 @@ func MapToOpReturnContract(op *bux.OpReturn) *buxmodels.OpReturn { } } +// MapToOpReturnBux will map the op-return model from bux-models to the bux contract func MapToOpReturnBux(op *buxmodels.OpReturn) *bux.OpReturn { return &bux.OpReturn{ Hex: op.Hex, diff --git a/mappings/utxo.go b/mappings/utxo.go index bd3002667..8afecc572 100644 --- a/mappings/utxo.go +++ b/mappings/utxo.go @@ -7,6 +7,7 @@ import ( customtypes "github.com/mrz1836/go-datastore/custom_types" ) +// MapToUtxoPointer will map the utxo-pointer model from bux to the bux-models contract func MapToUtxoPointer(u *bux.UtxoPointer) *buxmodels.UtxoPointer { return &buxmodels.UtxoPointer{ TransactionID: u.TransactionID, @@ -14,6 +15,7 @@ func MapToUtxoPointer(u *bux.UtxoPointer) *buxmodels.UtxoPointer { } } +// MapToUtxoPointerBux will map the utxo-pointer model from bux-models to the bux contract func MapToUtxoPointerBux(u *buxmodels.UtxoPointer) *bux.UtxoPointer { return &bux.UtxoPointer{ TransactionID: u.TransactionID, @@ -21,6 +23,7 @@ func MapToUtxoPointerBux(u *buxmodels.UtxoPointer) *bux.UtxoPointer { } } +// MapToUtxoContract will map the utxo model from bux to the bux-models contract func MapToUtxoContract(u *bux.Utxo) *buxmodels.Utxo { return &buxmodels.Utxo{ Model: *common.MapToContract(&u.Model), @@ -36,6 +39,7 @@ func MapToUtxoContract(u *bux.Utxo) *buxmodels.Utxo { } } +// MapToUtxoBux will map the utxo model from bux-models to the bux contract func MapToUtxoBux(u *buxmodels.Utxo) *bux.Utxo { var draftID customtypes.NullString draftID.String = u.DraftID diff --git a/mappings/xpub.go b/mappings/xpub.go index 9c504ae63..0b70af8d4 100644 --- a/mappings/xpub.go +++ b/mappings/xpub.go @@ -6,6 +6,7 @@ import ( "github.com/BuxOrg/bux-server/mappings/common" ) +// MapToXpubContract will map the xpub model from bux to the bux-models contract func MapToXpubContract(xpub *bux.Xpub) *buxmodels.Xpub { return &buxmodels.Xpub{ Model: *common.MapToContract(&xpub.Model),