Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions cmd/wavecli/waveclicommands/devrpc/registry_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions cmd/wavewalletdk-wasm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ func walletCall(_ js.Value, args []js.Value) any {
case "status":
return promise(jsonNoArg(mobile.Status))

case "newAssetReceiveKeys":
return promise(jsonNoArg(mobile.NewAssetReceiveKeys))

case "newAssetFundingAddress":
return promise(jsonNoArg(mobile.NewAssetFundingAddress))

Expand All @@ -120,9 +117,6 @@ func walletCall(_ js.Value, args []js.Value) any {
case "deposit":
return promise(jsonVerb(req, mobile.Deposit))

case "importAssetProof":
return promise(jsonVerb(req, mobile.ImportAssetProof))

case "depositAsset":
return promise(jsonVerb(req, mobile.DepositAsset))

Expand Down
13 changes: 3 additions & 10 deletions docs/daemon_cli_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,24 +444,17 @@ wavecli recv --offchain --amt 5000 --memo coffee
wavecli dev daemon NewAddress
```

### `dev daemon NewAssetReceiveKeys` / `ImportAssetProof` / `ListOwnedAssets`
### `dev daemon ListOwnedAssets` / `NewAssetFundingAddress`

Receive a Taproot Asset on chain into the daemon's asset wallet and list what
it holds. `NewAssetReceiveKeys` returns the script key and the
anchor internal key a sender transfers the asset to. The sender hands over
the proof file of that transfer, and `ImportAssetProof` verifies it, checks
that it is of the asset named in `asset_ref`, and adds the asset to the
wallet.
`ListOwnedAssets` lists the Taproot Assets the daemon's asset wallet holds on
chain. The wallet receives assets at an address, described below.

An asset deposit spends the daemon wallet's Bitcoin.
`NewAssetFundingAddress` returns a backing-wallet address to send that
Bitcoin to.

```bash
wavecli dev daemon NewAssetFundingAddress
wavecli dev daemon NewAssetReceiveKeys
wavecli dev daemon ImportAssetProof --proof_file <base64 proof file> \
--asset_ref <asset id or group key>
wavecli dev daemon ListOwnedAssets
```

Expand Down
7 changes: 3 additions & 4 deletions docs/wavewalletdk_mobile.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The package is gated behind three build tags — `mobile`, `wavewalletrpc`, and

| Shape | Convention | Verbs |
|-------|-----------|-------|
| RPC verbs | **JSON `[]byte` in / out** (throwing) | `GetInfo`, `GenerateSeed`, `CreateWallet`, `UnlockWallet`, `OpenWalletFromPasskey`, `Balance`, `Deposit`, `Receive`, `PrepareSend`, `SendPrepared`, `List`, `Exit`, `ExitStatus`, `ExitSummary`, `GetExitPlan`, `SweepWallet`, `Status`, `NewAssetReceiveKeys`, `NewAssetFundingAddress`, `ImportAssetProof`, `ListOwnedAssets`, `NewAssetAddress`, `ListAssetAddresses`, `ListAssetReceives`, `DepositAsset`, `ListAssetDeposits`, `BoardAssetDeposit` |
| RPC verbs | **JSON `[]byte` in / out** (throwing) | `GetInfo`, `GenerateSeed`, `CreateWallet`, `UnlockWallet`, `OpenWalletFromPasskey`, `Balance`, `Deposit`, `Receive`, `PrepareSend`, `SendPrepared`, `List`, `Exit`, `ExitStatus`, `ExitSummary`, `GetExitPlan`, `SweepWallet`, `Status`, `NewAssetFundingAddress`, `ListOwnedAssets`, `NewAssetAddress`, `ListAssetAddresses`, `ListAssetReceives`, `DepositAsset`, `ListAssetDeposits`, `BoardAssetDeposit` |
| Lifecycle JSON | **JSON `[]byte` in / out** (throwing) | `StartExternalSeedWallet` |
| Streaming | **pull handle** `Subscription{ next() []byte; close() }` | `Subscribe` |
| Hot-path scalars | **plain `int64`/`bool`** | `ConfirmedBalanceSat`, `PendingInboundSat`, `WalletReady`, `IsRunning` |
Expand Down Expand Up @@ -219,9 +219,8 @@ the wallet's seed and database, so a phone or a browser tab holds assets with
no other daemon beside it. `asset_group_keys` lists the asset groups it trusts
as hex compressed public keys. Omitting `assets_enabled` keeps assets disabled.
The asset verbs take and return the `wavewalletdk` asset types
(`AssetReceiveKeys`, `AssetFundingAddress`, `ImportAssetProofRequest`,
`OwnedAsset`, `DepositAssetRequest`, `BoardAssetDepositRequest`,
`AssetDeposit`); keys are hex strings and `ProofFile` is base64. Asset
(`AssetFundingAddress`, `OwnedAsset`, `DepositAssetRequest`,
`BoardAssetDepositRequest`, `AssetDeposit`); keys are hex strings. Asset
amounts (`Amount`, `AssetAmount`) are decimal strings, because an asset
amount can exceed the largest integer JavaScript reads exactly from a JSON
number; Bitcoin amounts stay numbers. A deposit spends the wallet's own
Expand Down
22 changes: 0 additions & 22 deletions rpc/restclient/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,28 +763,6 @@ func (c *DaemonServiceClient) ClaimAssetDeposit(ctx context.Context,
return out, err
}

// NewAssetReceiveKeys derives the keys an asset is sent to on chain.
func (c *DaemonServiceClient) NewAssetReceiveKeys(ctx context.Context,
in *waverpc.NewAssetReceiveKeysRequest, _ ...grpc.CallOption) (
*waverpc.AssetReceiveKeys, error) {

out := new(waverpc.AssetReceiveKeys)
err := c.client.Post(ctx, "/v1/daemon/new-asset-receive-keys", in, out)

return out, err
}

// ImportAssetProof adds a received asset to the daemon's asset wallet.
func (c *DaemonServiceClient) ImportAssetProof(ctx context.Context,
in *waverpc.ImportAssetProofRequest, _ ...grpc.CallOption) (
*waverpc.OwnedAsset, error) {

out := new(waverpc.OwnedAsset)
err := c.client.Post(ctx, "/v1/daemon/import-asset-proof", in, out)

return out, err
}

// ListOwnedAssets returns the assets the daemon's asset wallet holds on
// chain.
func (c *DaemonServiceClient) ListOwnedAssets(ctx context.Context,
Expand Down
9 changes: 4 additions & 5 deletions sdk/wavewalletdk/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,10 @@ For field-level detail, use `go doc github.com/lightninglabs/wavelength/sdk/wave
- `CreditPreview`, `SendRail`, `SendQuoteStatus` — embedded in
`PrepareSendResult`; describe whether a prepared send will draw on
sat-native server credits and how complete the prepare-time quote is.
- Asset types and methods (`assets.go`) — `NewAssetReceiveKeys`,
`NewAssetFundingAddress`, `ImportAssetProof`, `ListOwnedAssets`,
`DepositAsset`, `ListAssetDeposits` and `BoardAssetDeposit` wrap the
daemon's asset RPCs with wrapper-owned DTOs (`AssetReceiveKeys`,
`AssetFundingAddress`, `OwnedAsset`, `AssetDeposit`). They call
- Asset types and methods (`assets.go`) — `NewAssetFundingAddress`,
`ListOwnedAssets`, `DepositAsset`, `ListAssetDeposits` and
`BoardAssetDeposit` wrap the daemon's asset RPCs with wrapper-owned DTOs
(`AssetFundingAddress`, `OwnedAsset`, `AssetDeposit`). They call
`waverpc` directly, so they do not depend on the `wavewalletrpc` tag.
Asset amounts are `AssetUnits`, which encode as decimal strings in JSON,
since they can exceed the largest integer JavaScript reads exactly from a
Expand Down
9 changes: 4 additions & 5 deletions sdk/wavewalletdk/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,10 @@ For field-level detail, use `go doc github.com/lightninglabs/wavelength/sdk/wave
- `CreditPreview`, `SendRail`, `SendQuoteStatus` — embedded in
`PrepareSendResult`; describe whether a prepared send will draw on
sat-native server credits and how complete the prepare-time quote is.
- Asset types and methods (`assets.go`) — `NewAssetReceiveKeys`,
`NewAssetFundingAddress`, `ImportAssetProof`, `ListOwnedAssets`,
`DepositAsset`, `ListAssetDeposits` and `BoardAssetDeposit` wrap the
daemon's asset RPCs with wrapper-owned DTOs (`AssetReceiveKeys`,
`AssetFundingAddress`, `OwnedAsset`, `AssetDeposit`). They call
- Asset types and methods (`assets.go`) — `NewAssetFundingAddress`,
`ListOwnedAssets`, `DepositAsset`, `ListAssetDeposits` and
`BoardAssetDeposit` wrap the daemon's asset RPCs with wrapper-owned DTOs
(`AssetFundingAddress`, `OwnedAsset`, `AssetDeposit`). They call
`waverpc` directly, so they do not depend on the `wavewalletrpc` tag.
Asset amounts are `AssetUnits`, which encode as decimal strings in JSON,
since they can exceed the largest integer JavaScript reads exactly from a
Expand Down
62 changes: 0 additions & 62 deletions sdk/wavewalletdk/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,36 +38,12 @@ func (u *AssetUnits) UnmarshalJSON(data []byte) error {
return nil
}

// AssetReceiveKeys are the keys a sender transfers a Taproot Asset to on
// chain. All keys are hex compressed public keys.
type AssetReceiveKeys struct {
// ScriptKey is the Taproot output key the asset is sent to.
ScriptKey string

// RawScriptKey is the key ScriptKey is the BIP-86 output key of.
RawScriptKey string

// AnchorInternalKey is the internal key of the anchor output that
// carries the asset.
AnchorInternalKey string
}

// AssetFundingAddress is a backing-wallet address. Bitcoin sent to it pays
// for asset deposits.
type AssetFundingAddress struct {
Address string
}

// ImportAssetProofRequest adds a received asset to the asset wallet.
type ImportAssetProofRequest struct {
// ProofFile is the proof file of the asset output.
ProofFile []byte

// AssetRef is the asset the caller expects: the asset ID, or the
// group key of a grouped asset.
AssetRef string
}

// OwnedAsset is one asset output the asset wallet holds on chain.
type OwnedAsset struct {
// AssetRef is the group key of a grouped asset, else the asset ID.
Expand Down Expand Up @@ -200,26 +176,6 @@ type AssetDeposit struct {
Claimed bool
}

// NewAssetReceiveKeys derives the keys a sender transfers an asset to.
func (c *Client) NewAssetReceiveKeys(ctx context.Context) (*AssetReceiveKeys,
error) {

resp, err := c.daemon.NewAssetReceiveKeys(
ctx, &waverpc.NewAssetReceiveKeysRequest{},
)
if err != nil {
return nil, fmt.Errorf("derive asset receive keys: %w", err)
}

return &AssetReceiveKeys{
ScriptKey: hex.EncodeToString(resp.GetScriptKey()),
RawScriptKey: hex.EncodeToString(resp.GetRawScriptKey()),
AnchorInternalKey: hex.EncodeToString(
resp.GetAnchorInternalKey(),
),
}, nil
}

// NewAssetFundingAddress returns a new backing-wallet address. Bitcoin sent
// to it pays for asset deposits: the deposit output's value and the miner
// fee.
Expand All @@ -236,24 +192,6 @@ func (c *Client) NewAssetFundingAddress(ctx context.Context) (
return &AssetFundingAddress{Address: resp.GetAddress()}, nil
}

// ImportAssetProof verifies a received asset's proof file and adds the asset
// to the asset wallet.
func (c *Client) ImportAssetProof(ctx context.Context,
req ImportAssetProofRequest) (*OwnedAsset, error) {

resp, err := c.daemon.ImportAssetProof(
ctx, &waverpc.ImportAssetProofRequest{
ProofFile: req.ProofFile,
AssetRef: req.AssetRef,
},
)
if err != nil {
return nil, fmt.Errorf("import asset proof: %w", err)
}

return ownedAssetFromProto(resp), nil
}

// ListOwnedAssets returns the assets the asset wallet holds on chain.
func (c *Client) ListOwnedAssets(ctx context.Context) ([]OwnedAsset, error) {
resp, err := c.daemon.ListOwnedAssets(
Expand Down
3 changes: 1 addition & 2 deletions sdk/wavewalletdk/mobile/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ application-facing wallet API.
and returns `Results` / `Destination`. Every result must be inspected even
on nil error. It uses the daemon lifecycle context, like singular `Exit`;
unknown outcomes require reconciliation rather than replay or unroll.
- Asset verbs (`assets.go`: `NewAssetReceiveKeys`,
`NewAssetFundingAddress`, `ImportAssetProof`, `ListOwnedAssets`,
- Asset verbs (`assets.go`: `NewAssetFundingAddress`, `ListOwnedAssets`,
`NewAssetAddress`, `ListAssetAddresses`, `ListAssetReceives`,
`SyncAssetReceives`, `DepositAsset`, `ListAssetDeposits`,
`BoardAssetDeposit`) — the asset wallet, its Taproot Asset addresses and
Expand Down
3 changes: 1 addition & 2 deletions sdk/wavewalletdk/mobile/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ application-facing wallet API.
and returns `Results` / `Destination`. Every result must be inspected even
on nil error. It uses the daemon lifecycle context, like singular `Exit`;
unknown outcomes require reconciliation rather than replay or unroll.
- Asset verbs (`assets.go`: `NewAssetReceiveKeys`,
`NewAssetFundingAddress`, `ImportAssetProof`, `ListOwnedAssets`,
- Asset verbs (`assets.go`: `NewAssetFundingAddress`, `ListOwnedAssets`,
`NewAssetAddress`, `ListAssetAddresses`, `ListAssetReceives`,
`SyncAssetReceives`, `DepositAsset`, `ListAssetDeposits`,
`BoardAssetDeposit`) — the asset wallet, its Taproot Asset addresses and
Expand Down
43 changes: 0 additions & 43 deletions sdk/wavewalletdk/mobile/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,6 @@ import (
// funds and publishes a transaction.
const assetWriteTimeout = 2 * time.Minute

// NewAssetReceiveKeys derives the keys a sender transfers a Taproot Asset to.
// The response is wavewalletdk.AssetReceiveKeys.
func NewAssetReceiveKeys() ([]byte, error) {
client, parentCtx, err := activeClient()
if err != nil {
return nil, err
}
ctx, cancel := readContext(parentCtx)
defer cancel()

keys, err := client.NewAssetReceiveKeys(ctx)
if err != nil {
return nil, err
}

return marshal(keys)
}

// NewAssetFundingAddress returns a new backing-wallet address whose coins pay
// for asset deposits. The response is wavewalletdk.AssetFundingAddress.
func NewAssetFundingAddress() ([]byte, error) {
Expand All @@ -49,31 +31,6 @@ func NewAssetFundingAddress() ([]byte, error) {
return marshal(addr)
}

// ImportAssetProof adds a received asset to the asset wallet. reqJSON decodes
// to wavewalletdk.ImportAssetProofRequest; the response is
// wavewalletdk.OwnedAsset.
func ImportAssetProof(reqJSON []byte) ([]byte, error) {
client, parentCtx, err := activeClient()
if err != nil {
return nil, err
}

var req wavewalletdk.ImportAssetProofRequest
if err := decode(reqJSON, &req); err != nil {
return nil, err
}

ctx, cancel := context.WithTimeout(parentCtx, assetWriteTimeout)
defer cancel()

held, err := client.ImportAssetProof(ctx, req)
if err != nil {
return nil, err
}

return marshal(held)
}

// ListOwnedAssets returns the assets the asset wallet holds on chain, as a
// JSON array of wavewalletdk.OwnedAsset.
func ListOwnedAssets() ([]byte, error) {
Expand Down
15 changes: 5 additions & 10 deletions waved/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,11 @@ For field-level detail, use `go doc github.com/lightninglabs/wavelength/waved.<S
reads headers from a backend that implements
`chainsource.BlockHeaderSource`, or from lnd's chain kit.
- A proof of a grouped asset verifies on the asset engine only for a
trusted group. Trust comes from `assets.groupkeys`, from the asset a
caller names (`groupTrustingVerifier` for a round's asset VTXO,
`ImportAssetProof` for a received asset), and from the assets the wallet
holds.
- `NewAssetReceiveKeys`, `ImportAssetProof` and `ListOwnedAssets` are the
asset wallet through tap-sdk: keys a sender transfers an asset to, the
import of that transfer's proof, and the on-chain holdings.
`ImportAssetProof` checks that the proof is of the asset the caller
names, and verifies the file, before it stores anything: the engine holds
the proofs of a file before it verifies them.
trusted group. Trust comes from `assets.groupkeys`, from the asset of a
round's asset VTXO (`groupTrustingVerifier`), and from the assets the
wallet holds.
- `ListOwnedAssets` lists the asset wallet's on-chain holdings through
tap-sdk.
- `NewAssetFundingAddress` hands out a backing-wallet address through
`NewWalletAddress`. A deposit spends the daemon wallet's coins, and a
wallet SDK host has no other way to learn an address of that wallet.
Expand Down
15 changes: 5 additions & 10 deletions waved/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,11 @@ For field-level detail, use `go doc github.com/lightninglabs/wavelength/waved.<S
reads headers from a backend that implements
`chainsource.BlockHeaderSource`, or from lnd's chain kit.
- A proof of a grouped asset verifies on the asset engine only for a
trusted group. Trust comes from `assets.groupkeys`, from the asset a
caller names (`groupTrustingVerifier` for a round's asset VTXO,
`ImportAssetProof` for a received asset), and from the assets the wallet
holds.
- `NewAssetReceiveKeys`, `ImportAssetProof` and `ListOwnedAssets` are the
asset wallet through tap-sdk: keys a sender transfers an asset to, the
import of that transfer's proof, and the on-chain holdings.
`ImportAssetProof` checks that the proof is of the asset the caller
names, and verifies the file, before it stores anything: the engine holds
the proofs of a file before it verifies them.
trusted group. Trust comes from `assets.groupkeys`, from the asset of a
round's asset VTXO (`groupTrustingVerifier`), and from the assets the
wallet holds.
- `ListOwnedAssets` lists the asset wallet's on-chain holdings through
tap-sdk.
- `NewAssetFundingAddress` hands out a backing-wallet address through
`NewWalletAddress`. A deposit spends the daemon wallet's coins, and a
wallet SDK host has no other way to learn an address of that wallet.
Expand Down
Loading
Loading