mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
Merge pull request #1054 from lightninglabs/taprpc-module
tapd: use taprpc module
This commit is contained in:
commit
c0bd649ce2
10 changed files with 52 additions and 1147 deletions
37
.github/actions/setup-go/action.yml
vendored
37
.github/actions/setup-go/action.yml
vendored
|
|
@ -7,12 +7,6 @@ inputs:
|
|||
key-prefix:
|
||||
description: "A prefix to use for the cache key, to separate cache entries from other workflows"
|
||||
required: false
|
||||
use-build-cache:
|
||||
description: "Whether to use the build cache"
|
||||
required: false
|
||||
# Boolean values aren't supported in the workflow syntax, so we use a
|
||||
# string. To not confuse the value with true/false, we use 'yes' and 'no'.
|
||||
default: 'yes'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
|
|
@ -29,37 +23,6 @@ runs:
|
|||
with:
|
||||
go-version: '${{ inputs.go-version }}'
|
||||
|
||||
- name: go module and build cache
|
||||
if: ${{ inputs.use-build-cache == 'yes' }}
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
# In order:
|
||||
# * Module download cache
|
||||
# * Build cache (Linux)
|
||||
# * Build cache (Mac)
|
||||
# * Build cache (Windows)
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/.cache/go-build
|
||||
~/Library/Caches/go-build
|
||||
~\AppData\Local\go-build
|
||||
key: ${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-${{ github.job }}-
|
||||
${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-
|
||||
|
||||
- name: go module cache
|
||||
if: ${{ inputs.use-build-cache == 'no' }}
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
# Just the module download cache.
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-no-build-cache-${{ github.job }}-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-no-build-cache-${{ github.job }}-
|
||||
${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-no-build-cache-
|
||||
|
||||
- name: set GOPATH
|
||||
shell: bash
|
||||
run: |
|
||||
|
|
|
|||
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
|
@ -125,8 +125,6 @@ jobs:
|
|||
uses: ./.github/actions/setup-go
|
||||
with:
|
||||
go-version: '${{ env.GO_VERSION }}'
|
||||
key-prefix: cross-compile
|
||||
use-build-cache: 'no'
|
||||
|
||||
- name: build release for all architectures (skip app build)
|
||||
run: make go-release sys="${{ matrix.sys }}"
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ import (
|
|||
"github.com/lightninglabs/taproot-assets/asset"
|
||||
"github.com/lightninglabs/taproot-assets/rfq"
|
||||
"github.com/lightninglabs/taproot-assets/rfqmath"
|
||||
"github.com/lightninglabs/taproot-assets/rpcutils"
|
||||
"github.com/lightninglabs/taproot-assets/taprpc"
|
||||
"github.com/lightninglabs/taproot-assets/taprpc/rfqrpc"
|
||||
tchrpc "github.com/lightninglabs/taproot-assets/taprpc/tapchannelrpc"
|
||||
"github.com/lightningnetwork/lnd/cmd/commands"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
|
|
@ -218,7 +218,7 @@ func (w *resultStreamWrapper) Recv() (*lnrpc.Payment, error) {
|
|||
case *tchrpc.SendPaymentResponse_AcceptedSellOrder:
|
||||
quote := r.AcceptedSellOrder
|
||||
rpcRate := quote.BidAssetRate
|
||||
rate, err := rfqrpc.UnmarshalFixedPoint(rpcRate)
|
||||
rate, err := rpcutils.UnmarshalRfqFixedPoint(rpcRate)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to unmarshal fixed "+
|
||||
"point: %w", err)
|
||||
|
|
|
|||
13
go.mod
13
go.mod
|
|
@ -22,13 +22,14 @@ require (
|
|||
github.com/lightninglabs/lightning-terminal/autopilotserverrpc v0.0.2
|
||||
github.com/lightninglabs/lightning-terminal/litrpc v1.0.1
|
||||
github.com/lightninglabs/lndclient v0.19.0-4
|
||||
github.com/lightninglabs/loop v0.31.0-beta.0.20250425065236-7e81916829d9
|
||||
github.com/lightninglabs/loop/looprpc v1.0.6
|
||||
github.com/lightninglabs/loop/swapserverrpc v1.0.13
|
||||
github.com/lightninglabs/loop v0.31.0-beta.0.20250502080242-8ef7584f9f56
|
||||
github.com/lightninglabs/loop/looprpc v1.0.7
|
||||
github.com/lightninglabs/loop/swapserverrpc v1.0.14
|
||||
github.com/lightninglabs/pool v0.6.5-beta.0.20250305125211-4e860ec4e77f
|
||||
github.com/lightninglabs/pool/auctioneerrpc v1.1.3-0.20250305125211-4e860ec4e77f
|
||||
github.com/lightninglabs/pool/poolrpc v1.0.1-0.20250305125211-4e860ec4e77f
|
||||
github.com/lightninglabs/taproot-assets v0.5.2-0.20250501125658-7b383050ae89
|
||||
github.com/lightninglabs/taproot-assets v0.5.2-0.20250502070549-52257227c8f8
|
||||
github.com/lightninglabs/taproot-assets/taprpc v1.0.1
|
||||
github.com/lightningnetwork/lnd v0.19.0-beta.rc3
|
||||
github.com/lightningnetwork/lnd/cert v1.2.2
|
||||
github.com/lightningnetwork/lnd/clock v1.1.1
|
||||
|
|
@ -49,7 +50,7 @@ require (
|
|||
golang.org/x/sync v0.12.0
|
||||
google.golang.org/grpc v1.65.0
|
||||
google.golang.org/protobuf v1.34.2
|
||||
gopkg.in/macaroon-bakery.v2 v2.1.0
|
||||
gopkg.in/macaroon-bakery.v2 v2.3.0
|
||||
gopkg.in/macaroon.v2 v2.1.0
|
||||
modernc.org/sqlite v1.34.5
|
||||
)
|
||||
|
|
@ -97,6 +98,7 @@ require (
|
|||
github.com/fortytw2/leaktest v1.3.0 // indirect
|
||||
github.com/go-logr/logr v1.4.2 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-macaroon-bakery/macaroonpb v1.0.0 // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
|
||||
github.com/goccy/go-yaml v1.15.23 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
|
|
@ -130,7 +132,6 @@ require (
|
|||
github.com/jonboulle/clockwork v0.2.2 // indirect
|
||||
github.com/jrick/logrotate v1.1.2 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/juju/loggo v1.0.0 // indirect
|
||||
github.com/kkdai/bstream v1.0.0 // indirect
|
||||
github.com/klauspost/compress v1.17.9 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import (
|
|||
"github.com/lightninglabs/taproot-assets/rfq"
|
||||
"github.com/lightninglabs/taproot-assets/rfqmath"
|
||||
"github.com/lightninglabs/taproot-assets/rfqmsg"
|
||||
"github.com/lightninglabs/taproot-assets/rpcutils"
|
||||
"github.com/lightninglabs/taproot-assets/tapfreighter"
|
||||
"github.com/lightninglabs/taproot-assets/taprpc"
|
||||
"github.com/lightninglabs/taproot-assets/taprpc/assetwalletrpc"
|
||||
|
|
@ -1396,7 +1397,7 @@ func payInvoiceWithAssets(t *testing.T, payer, rfqPeer *HarnessNode,
|
|||
require.Equal(t, peerPubKey, rfqPeer.PubKeyStr)
|
||||
|
||||
rpcRate := acceptedQuote.BidAssetRate
|
||||
rate, err := rfqrpc.UnmarshalFixedPoint(rpcRate)
|
||||
rate, err := rpcutils.UnmarshalRfqFixedPoint(rpcRate)
|
||||
require.NoError(t, err)
|
||||
|
||||
rateVal = *rate
|
||||
|
|
@ -1504,7 +1505,7 @@ func createAssetInvoice(t *testing.T, dstRfqPeer, dst *HarnessNode,
|
|||
require.NoError(t, err)
|
||||
|
||||
rpcRate := resp.AcceptedBuyQuote.AskAssetRate
|
||||
rate, err := rfqrpc.UnmarshalFixedPoint(rpcRate)
|
||||
rate, err := rpcutils.UnmarshalRfqFixedPoint(rpcRate)
|
||||
require.NoError(t, err)
|
||||
|
||||
t.Logf("Got quote for %v asset units per BTC", rate)
|
||||
|
|
@ -1694,7 +1695,7 @@ func createAssetHodlInvoice(t *testing.T, dstRfqPeer, dst *HarnessNode,
|
|||
require.NoError(t, err)
|
||||
|
||||
rpcRate := resp.AcceptedBuyQuote.AskAssetRate
|
||||
rate, err := rfqrpc.UnmarshalFixedPoint(rpcRate)
|
||||
rate, err := rpcutils.UnmarshalRfqFixedPoint(rpcRate)
|
||||
require.NoError(t, err)
|
||||
|
||||
assetUnits := rfqmath.NewBigIntFixedPoint(assetAmount, 0)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import (
|
|||
"github.com/lightninglabs/taproot-assets/proof"
|
||||
"github.com/lightninglabs/taproot-assets/rfqmath"
|
||||
"github.com/lightninglabs/taproot-assets/rfqmsg"
|
||||
"github.com/lightninglabs/taproot-assets/rpcutils"
|
||||
"github.com/lightninglabs/taproot-assets/taprpc"
|
||||
"github.com/lightninglabs/taproot-assets/taprpc/mintrpc"
|
||||
oraclerpc "github.com/lightninglabs/taproot-assets/taprpc/priceoraclerpc"
|
||||
|
|
@ -4173,7 +4174,7 @@ func testCustomChannelsForwardBandwidth(ctx context.Context,
|
|||
|
||||
// We calculate the milli-satoshi amount one below the equivalent of a
|
||||
// single asset unit.
|
||||
rate, err := oraclerpc.UnmarshalFixedPoint(&oraclerpc.FixedPoint{
|
||||
rate, err := rpcutils.UnmarshalFixedPoint(&oraclerpc.FixedPoint{
|
||||
Coefficient: quote.AcceptedQuote.AskAssetRate.Coefficient,
|
||||
Scale: quote.AcceptedQuote.AskAssetRate.Scale,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import (
|
|||
"github.com/lightninglabs/taproot-assets/asset"
|
||||
"github.com/lightninglabs/taproot-assets/rfqmath"
|
||||
"github.com/lightninglabs/taproot-assets/rfqmsg"
|
||||
"github.com/lightninglabs/taproot-assets/rpcutils"
|
||||
oraclerpc "github.com/lightninglabs/taproot-assets/taprpc/priceoraclerpc"
|
||||
"github.com/lightningnetwork/lnd/cert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
|
@ -114,7 +115,7 @@ func (o *oracleHarness) getAssetRates(id asset.ID,
|
|||
}
|
||||
|
||||
// Marshal subject asset rate to RPC format.
|
||||
rpcSubjectAssetToBtcRate, err := oraclerpc.MarshalBigIntFixedPoint(
|
||||
rpcSubjectAssetToBtcRate, err := rpcutils.MarshalBigIntFixedPoint(
|
||||
subjectAssetRate,
|
||||
)
|
||||
if err != nil {
|
||||
|
|
@ -122,7 +123,7 @@ func (o *oracleHarness) getAssetRates(id asset.ID,
|
|||
}
|
||||
|
||||
// Marshal payment asset rate to RPC format.
|
||||
rpcPaymentAssetToBtcRate, err := oraclerpc.MarshalBigIntFixedPoint(
|
||||
rpcPaymentAssetToBtcRate, err := rpcutils.MarshalBigIntFixedPoint(
|
||||
rfqmsg.MilliSatPerBtc,
|
||||
)
|
||||
if err != nil {
|
||||
|
|
@ -168,7 +169,7 @@ func (o *oracleHarness) QueryAssetRates(_ context.Context,
|
|||
|
||||
// Ensure that the payment asset is BTC. We only support BTC as the
|
||||
// payment asset in this example.
|
||||
if !oraclerpc.IsAssetBtc(req.PaymentAsset) {
|
||||
if !rpcutils.IsAssetBtc(req.PaymentAsset) {
|
||||
log.Infof("Payment asset is not BTC: %v", req.PaymentAsset)
|
||||
|
||||
return &oraclerpc.QueryAssetRatesResponse{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import (
|
|||
"github.com/lightninglabs/lndclient"
|
||||
"github.com/lightninglabs/loop"
|
||||
"github.com/lightninglabs/loop/loopd"
|
||||
"github.com/lightninglabs/loop/loopd/perms"
|
||||
"github.com/lightninglabs/loop/looprpc"
|
||||
"github.com/lightninglabs/taproot-assets/fn"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
|
|
@ -127,7 +126,7 @@ func (l *loopSubServer) MacPath() string {
|
|||
//
|
||||
// NOTE: this is part of the SubServer interface.
|
||||
func (l *loopSubServer) Permissions() map[string][]bakery.Op {
|
||||
return perms.RequiredPermissions
|
||||
return looprpc.RequiredPermissions
|
||||
}
|
||||
|
||||
// WhiteListedURLs returns a map of all the sub-server's URLs that can be
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import (
|
|||
tap "github.com/lightninglabs/taproot-assets"
|
||||
"github.com/lightninglabs/taproot-assets/address"
|
||||
"github.com/lightninglabs/taproot-assets/fn"
|
||||
"github.com/lightninglabs/taproot-assets/perms"
|
||||
"github.com/lightninglabs/taproot-assets/tapcfg"
|
||||
"github.com/lightninglabs/taproot-assets/taprpc"
|
||||
"github.com/lightninglabs/taproot-assets/taprpc/assetwalletrpc"
|
||||
|
|
@ -224,7 +223,7 @@ func (t *taprootAssetsSubServer) MacPath() string {
|
|||
//
|
||||
// NOTE: this is part of the SubServer interface.
|
||||
func (t *taprootAssetsSubServer) Permissions() map[string][]bakery.Op {
|
||||
return perms.RequiredPermissions
|
||||
return taprpc.RequiredPermissions
|
||||
}
|
||||
|
||||
// WhiteListedURLs returns a map of all the sub-server's URLs that can be
|
||||
|
|
@ -248,7 +247,7 @@ func (t *taprootAssetsSubServer) WhiteListedURLs() map[string]struct{} {
|
|||
string(tap.UniversePublicAccessStatusWrite),
|
||||
)
|
||||
|
||||
return perms.MacaroonWhitelist(
|
||||
return taprpc.MacaroonWhitelist(
|
||||
publicUniRead || t.remote, publicUniWrite || t.remote,
|
||||
t.cfg.RpcConf.AllowPublicUniProofCourier || t.remote,
|
||||
t.cfg.RpcConf.AllowPublicStats || t.remote,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue