Skip to content

Commit

Permalink
fix: /onchain
Browse files Browse the repository at this point in the history
  • Loading branch information
Kodylow committed Apr 15, 2024
1 parent c6f8d9b commit 00226d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 26 deletions.
20 changes: 0 additions & 20 deletions Cargo.lock

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

9 changes: 3 additions & 6 deletions wrappers/fedimint-go/pkg/fedimint/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ func (fc *FedimintClient) post(endpoint string, body interface{}) ([]byte, error
return fc.fetchWithAuth(endpoint, "POST", jsonBody)
}


// postWithFederationId takes any request object, marshals it to JSON, optionally adds a federationId, and makes a POST request.
func (fc *FedimintClient) postWithFederationId(endpoint string, requestBody interface{}, federationId *string) ([]byte, error) {
// Initialize an empty map for the request body.
Expand Down Expand Up @@ -162,7 +161,6 @@ func (fc *FedimintClient) postWithFederationId(endpoint string, requestBody inte
return nil, fmt.Errorf("failed to marshal modified request map: %w", err)
}


fmt.Printf("modifiedRequestJSON: %s\n", modifiedRequestJSON)

// Proceed to make the POST request with the modified JSON body.
Expand Down Expand Up @@ -319,7 +317,7 @@ func (fc *FedimintClient) Join(inviteCode string, setActiveFederationId bool, us

func (onchain *OnchainModule) CreateDepositAddress(timeout int, federationId *string) (*modules.OnchainDepositAddressResponse, error) {
request := modules.OnchainDepositAddressRequest{Timeout: timeout}
resp, err := onchain.Client.postWithFederationId("/wallet/deposit-address", request, federationId)
resp, err := onchain.Client.postWithFederationId("/onchain/deposit-address", request, federationId)
if err != nil {
return nil, err
}
Expand All @@ -333,7 +331,7 @@ func (onchain *OnchainModule) CreateDepositAddress(timeout int, federationId *st

func (onchain *OnchainModule) AwaitDeposit(operationId string, federationId *string) (*modules.OnchainAwaitDepositResponse, error) {
request := modules.OnchainAwaitDepositRequest{OperationId: operationId}
resp, err := onchain.Client.postWithFederationId("/wallet/await-deposit", request, federationId)
resp, err := onchain.Client.postWithFederationId("/onchain/await-deposit", request, federationId)
if err != nil {
return nil, err
}
Expand All @@ -347,7 +345,7 @@ func (onchain *OnchainModule) AwaitDeposit(operationId string, federationId *str

func (onchain *OnchainModule) Withdraw(address string, amountSat int, federationId *string) (*modules.OnchainWithdrawResponse, error) {
request := modules.OnchainWithdrawRequest{Address: address, AmountSat: amountSat}
resp, err := onchain.Client.postWithFederationId("/wallet/withdraw", request, federationId)
resp, err := onchain.Client.postWithFederationId("/onchain/withdraw", request, federationId)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -547,7 +545,6 @@ func (ln *LnModule) ClaimPubkeyReceive(privateKey string, gatewayId string, fede
return &infoResp, nil
}


func (ln *LnModule) ClaimPubkeyTweakReceive(privateKey string, tweaks []uint64, gatewayId string, federationId string) (*types.InfoResponse, error) {
request := modules.LnClaimPubkeyTweakedRequest{PrivateKey: privateKey, Tweaks: tweaks}
resp, err := ln.Client.postWithGatewayIdAndFederationId("/ln/claim-external-receive-tweaked", request, &gatewayId, &federationId)
Expand Down

0 comments on commit 00226d0

Please sign in to comment.