Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature]: docs: provide JSON examples for custom channel data #1438

Open
ZZiigguurraatt opened this issue Mar 12, 2025 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@ZZiigguurraatt
Copy link

We have some structs that can be used with json.Unmarshal to decode custom channel data (

package rfqmsg
// JsonAssetBalance is a struct that represents the balance of a single asset ID
// within a channel.
type JsonAssetBalance struct {
AssetID string `json:"asset_id"`
Name string `json:"name"`
LocalBalance uint64 `json:"local_balance"`
RemoteBalance uint64 `json:"remote_balance"`
}
// JsonAssetGenesis is a struct that represents the genesis information of an
// asset.
type JsonAssetGenesis struct {
GenesisPoint string `json:"genesis_point"`
Name string `json:"name"`
MetaHash string `json:"meta_hash"`
AssetID string `json:"asset_id"`
}
// JsonAssetUtxo is a struct that represents the UTXO information of an asset
// within a channel.
type JsonAssetUtxo struct {
Version int64 `json:"version"`
AssetGenesis JsonAssetGenesis `json:"asset_genesis"`
Amount uint64 `json:"amount"`
ScriptKey string `json:"script_key"`
DecimalDisplay uint8 `json:"decimal_display"`
}
// JsonAssetChanInfo is a struct that represents the channel information of a
// single asset within a channel.
type JsonAssetChanInfo struct {
AssetInfo JsonAssetUtxo `json:"asset_utxo"`
Capacity uint64 `json:"capacity"`
LocalBalance uint64 `json:"local_balance"`
RemoteBalance uint64 `json:"remote_balance"`
}
// JsonAssetChannel is a struct that represents the channel information of all
// assets within a channel.
type JsonAssetChannel struct {
Assets []JsonAssetChanInfo `json:"assets"`
}
// JsonAssetChannelBalances is a struct that represents the balance information
// of all assets within open and pending channels.
type JsonAssetChannelBalances struct {
OpenChannels map[string]*JsonAssetBalance `json:"open_channels"`
PendingChannels map[string]*JsonAssetBalance `json:"pending_channels"`
}
// JsonCloseOutput is a struct that represents the additional co-op close output
// information of asset channels.
type JsonCloseOutput struct {
BtcInternalKey string `json:"btc_internal_key"`
AssetInternalKey string `json:"asset_internal_key"`
ScriptKeys map[string]string `json:"script_keys"`
}
// JsonHtlcBalance is a struct that represents the balance of a single asset
// HTLC.
type JsonHtlcBalance struct {
AssetID string `json:"asset_id"`
Amount uint64 `json:"amount"`
}
// JsonHtlc is a struct that represents the asset information that can be
// transferred via an HTLC.
type JsonHtlc struct {
Balances []*JsonHtlcBalance `json:"balances"`
RfqID string `json:"rfq_id"`
}
), however, we could really use some examples of each of these in JSON format for people to easier understand and for people who don't even use golang.

@ZZiigguurraatt ZZiigguurraatt added the enhancement New feature or request label Mar 12, 2025
@guggero
Copy link
Member

guggero commented Mar 12, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants