Skip to content

Commit

Permalink
Merge pull request #14 from Chia-Network/cat-transactions
Browse files Browse the repository at this point in the history
Cat transactions
  • Loading branch information
cmmarslender authored Apr 28, 2022
2 parents 0faa649 + 3a1d4ea commit 821207e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
main.go
main
bin/
.idea/*
31 changes: 31 additions & 0 deletions pkg/rpc/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,34 @@ func (s *WalletService) SendTransaction(opts *SendTransactionOptions) (*SendTran

return r, resp, nil
}

// CatSpendOptions represents the options for cat_spend
type CatSpendOptions struct {
WalletID uint32 `json:"wallet_id"`
Amount uint64 `json:"amount"`
Address string `json:"inner_address"`
Fee uint64 `json:"fee"`
}

// CatSpendResponse represents the response from cat_spend
type CatSpendResponse struct {
Success bool `json:"success"`
TransactionID string `json:"transaction_id"`
Transaction types.TransactionRecord `json:"transaction"`
}

// CatSpend sends a transaction
func (s *WalletService) CatSpend(opts *CatSpendOptions) (*CatSpendResponse, *http.Response, error) {
request, err := s.NewRequest("cat_spend", opts)
if err != nil {
return nil, nil, err
}

r := &CatSpendResponse{}
resp, err := s.Do(request, r)
if err != nil {
return nil, resp, err
}

return r, resp, nil
}

0 comments on commit 821207e

Please sign in to comment.