Skip to content

Commit

Permalink
fix: start fixing elixir
Browse files Browse the repository at this point in the history
  • Loading branch information
Kodylow committed Apr 25, 2024
1 parent f2725a0 commit 19edb0c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# fedimint-clientd: A Fedimint Client for Server Side Applications
# fedimint-clientd: A Fedimint Client for Server Side Applications

fedimint-clientd runs a fedimint client with Ecash, Lightning, and Onchain modules to let a server side application hold and use Bitcoin with Fedimint. It exposes a REST API & provides wrappers in typescript, python, and golang. It uses the `multimint` crate to manages clients connected to multiple Federations from a single `fedimint-clientd` instance.
fedimint-clientd runs a fedimint client with Ecash, Lightning, and Onchain modules to let a server side application hold and use Bitcoin with Fedimint. It exposes a REST API & provides wrappers in typescript, python, goland, and elixir. It uses the `multimint` crate to manage clients connected to multiple Federations from a single `fedimint-clientd` instance.

This project is intended to be an easy-to-use starting point for those interested in adding Fedimint client support to their applications. Fedimint-clientd only exposes Fedimint's default modules, and any more complex Fedimint integration will require custom implementation using [Fedimint's rust crates](https://github.com/fedimint/fedimint).

Expand Down Expand Up @@ -49,7 +49,7 @@ curl http://localhost:3333/fedimint/v2/admin/info -H 'Authorization: Bearer some

- `/fedimint/v2/mint/reissue`: Reissue notes received from a third party to avoid double spends.
- `/fedimint/v2/mint/spend`: Prepare notes to send to a third party as a payment.
- `/fedimint/v2/mint/validate`: Verifies the signatures of e-cash notes, but *not* if they have been spent already.
- `/fedimint/v2/mint/validate`: Verifies the signatures of e-cash notes, but _not_ if they have been spent already.
- `/fedimint/v2/mint/split`: Splits a string containing multiple e-cash notes (e.g. from the `spend` command) into ones that contain exactly one.
- `/fedimint/v2/mint/combine`: Combines two or more serialized e-cash notes strings.

Expand Down
8 changes: 4 additions & 4 deletions wrappers/fedimintex/lib/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ defmodule Fedimintex.Client do
admin: atom(),
mint: atom(),
ln: atom(),
wallet: atom()
onchain: atom()
}

@type http_response :: {:ok, map()} | {:error, String.t()}

defstruct base_url: nil, password: nil, admin: nil, mint: nil, ln: nil, wallet: nil
defstruct base_url: nil, password: nil, admin: nil, mint: nil, ln: nil, onchain: nil

@doc """
Creates a new `Fedimintex.Client` struct.
Expand All @@ -32,12 +32,12 @@ defmodule Fedimintex.Client do
@spec new(String.t(), String.t()) :: t()
def new(base_url, password) do
%__MODULE__{
base_url: base_url <> "/fedimint/v2",
base_url: base_url <> "/v2",
password: password,
admin: Fedimintex.Admin,
mint: Fedimintex.Mint,
ln: Fedimintex.Ln,
wallet: Fedimintex.Wallet
onchain: Fedimintex.Wallet
}
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# wallet.ex
defmodule Fedimintex.Wallet do
# onchain.ex
defmodule Fedimintex.Onchain do
import Fedimintex.Client, only: [post: 3]

@type deposit_address_request :: %{timeout: integer()}
Expand All @@ -8,7 +8,7 @@ defmodule Fedimintex.Wallet do
@spec create_deposit_address(Fedimintex.Client.t(), deposit_address_request()) ::
{:ok, deposit_address_response()} | {:error, String.t()}
def create_deposit_address(client, request) do
post(client, "/wallet/deposit-address", request)
post(client, "/onchain/deposit-address", request)
end

@type await_deposit_request :: %{operation_id: String.t()}
Expand All @@ -17,7 +17,7 @@ defmodule Fedimintex.Wallet do
@spec await_deposit(Fedimintex.Client.t(), await_deposit_request()) ::
{:ok, await_deposit_response()} | {:error, String.t()}
def await_deposit(client, request) do
post(client, "/wallet/await-deposit", request)
post(client, "/onchain/await-deposit", request)
end

@type withdraw_request :: %{address: String.t(), amount_msat: String.t()}
Expand All @@ -26,6 +26,6 @@ defmodule Fedimintex.Wallet do
@spec withdraw(Fedimintex.Client.t(), withdraw_request()) ::
{:ok, withdraw_response()} | {:error, String.t()}
def withdraw(client, request) do
post(client, "/wallet/withdraw", request)
post(client, "/onchain/withdraw", request)
end
end
File renamed without changes.

0 comments on commit 19edb0c

Please sign in to comment.