-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dev #1
Open
kenlau666
wants to merge
14
commits into
main
Choose a base branch
from
dev
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Dev #1
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
16fbafe
added project structure
kenlau666 43aef27
added utils
kenlau666 3fb50f7
.
kenlau666 74f6d74
.
kenlau666 e6184e6
added client api
kenlau666 e1dcc6d
refactor to v2
kenlau666 f25e4e1
added client.go
kenlau666 2172655
added signing key in client
kenlau666 abd35da
added accounts markets orders client
kenlau666 2454404
fixed markets type bug
kenlau666 a306f2f
added todo
kenlau666 141d8da
fixed pr comment
kenlau666 b47a230
.
kenlau666 9bb7cf8
added App
kenlau666 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package cmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package api | ||
|
||
import ( | ||
"github.com/deltadefi-protocol/go-sdk/pkg/utils" | ||
) | ||
|
||
type ApiNetwork string | ||
|
||
const ( | ||
ApiNetworkPreprod ApiNetwork = "preprod" | ||
ApiNetworkMainnet ApiNetwork = "mainnet" | ||
) | ||
|
||
type ApiConfig struct { | ||
Network *ApiNetwork `json:"network,omitempty"` | ||
// TODO: AppWalletKeyType | ||
SigningKey int `json:"signingKey,omitempty"` | ||
utils.AuthHeaders | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package requests | ||
|
||
import ( | ||
rmodels "github.com/sidan-lab/rum/models" | ||
) | ||
|
||
type InputUtxos struct { | ||
TxHash string `json:"tx_hash"` | ||
TxID string `json:"tx_id"` | ||
Amount []rmodels.Asset `json:"amount"` | ||
Address string `json:"address"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package requests | ||
|
||
import ( | ||
"github.com/deltadefi-protocol/go-sdk/pkg/models" | ||
rmodels "github.com/sidan-lab/rum/models" | ||
) | ||
|
||
type SignInRequest struct { | ||
WalletAddress string `json:"wallet_address"` | ||
AuthKey string `json:"auth_key"` | ||
} | ||
|
||
// type BuildSendRefScriptsTransactionRequest struct { | ||
// InputUTxOs []rmodels.UTxO `json:"input_utxos"` | ||
// TotalDepositAmount []rmodels.Asset `json:"total_deposit_amount"` | ||
// } | ||
|
||
// type SubmitSendRefScriptsTransactionRequest struct { | ||
// SignedTx string `json:"signed_tx"` | ||
// } | ||
|
||
// type PostOrderRequest = BuildPostOrderTransactionRequest | ||
|
||
// type SubmitDeleteAccountTransactionRequest struct { | ||
// SignedTx string `json:"signed_tx"` | ||
// } | ||
type BuildDepositTransactionRequest struct { | ||
DepositAmount []rmodels.Asset `json:"deposit_amount"` | ||
InputUtxos []*rmodels.UTxO `json:"input_utxos"` | ||
} | ||
|
||
type BuildWithdrawalTransactionRequest struct { | ||
WithdrawalAmount []rmodels.Asset `json:"withdrawal_amount"` | ||
} | ||
|
||
type SubmitDepositTransactionRequest struct { | ||
SignedTx string `json:"signed_tx"` | ||
} | ||
|
||
type SubmitWithdrawalTransactionRequest struct { | ||
SignedTxs []string `json:"signed_txs"` | ||
} | ||
|
||
type GetMarketDepthRequest struct { | ||
Pair models.TradingSymbol `json:"pair"` | ||
} | ||
|
||
type GetMarketPriceRequest struct { | ||
Pair string `json:"pair"` | ||
} | ||
|
||
type Interval string | ||
|
||
const ( | ||
Interval15m Interval = "15m" | ||
Interval30m Interval = "30m" | ||
Interval1h Interval = "1h" | ||
Interval1d Interval = "1d" | ||
Interval1w Interval = "1w" | ||
Interval1M Interval = "1M" | ||
) | ||
|
||
type GetAggregatedPriceRequest struct { | ||
Pair string `json:"pair"` | ||
Interval Interval `json:"interval"` | ||
Start *int64 `json:"start,omitempty"` // timestamp | ||
End *int64 `json:"end,omitempty"` // timestamp | ||
} | ||
|
||
type BuildPlaceOrderTransactionRequest struct { | ||
Pair models.TradingSymbol `json:"pair"` | ||
Side models.OrderSide `json:"side"` | ||
Type models.OrderType `json:"type"` | ||
Quantity float64 `json:"quantity"` | ||
Price *float64 `json:"price,omitempty"` | ||
BasisPoint *float64 `json:"basis_point,omitempty"` | ||
} | ||
|
||
type SubmitPlaceOrderTransactionRequest struct { | ||
OrderID string `json:"order_id"` | ||
SignedTx string `json:"signed_tx"` | ||
} | ||
|
||
type SubmitCancelOrderTransactionRequest struct { | ||
SignedTx string `json:"signed_tx"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
package responses | ||
|
||
import ( | ||
"github.com/deltadefi-protocol/go-sdk/pkg/models" | ||
rmodels "github.com/sidan-lab/rum/models" | ||
) | ||
|
||
type SignInResponse struct { | ||
Token string `json:"token"` | ||
IsReady bool `json:"is_ready"` | ||
} | ||
|
||
type BuildSendRefScriptsTransactionResponse struct { | ||
TxHex string `json:"tx_hex"` | ||
} | ||
|
||
type SubmitSendRefScriptsTransactionResponse struct { | ||
TxHash string `json:"tx_hash"` | ||
} | ||
type SubmitPostOrderTransactionResponse struct { | ||
Order *models.OrderJSON `json:"order"` | ||
TxHexes string `json:"tx_hexes"` | ||
} | ||
|
||
type PostOrderResponse = *SubmitPostOrderTransactionResponse | ||
|
||
type DepositRecord struct { | ||
CreatedAt string `json:"created_at"` | ||
Assets []rmodels.Asset `json:"assets"` | ||
TxHash string `json:"tx_hash"` | ||
} | ||
|
||
type GetDepositRecordsResponse []*DepositRecord | ||
|
||
type GetOrderRecordResponse struct { | ||
Orders []*models.OrderJSON `json:"Orders"` | ||
} | ||
|
||
type WithdrawalRecord struct { | ||
CreatedAt string `json:"created_at"` | ||
Assets []rmodels.Asset `json:"assets"` | ||
} | ||
|
||
type GetWithdrawalRecordsResponse []*WithdrawalRecord | ||
|
||
type AssetBalance struct { | ||
Asset string `json:"asset"` | ||
Free int64 `json:"free"` | ||
Locked int64 `json:"locked"` | ||
} | ||
|
||
type GetAccountBalanceResponse []*AssetBalance | ||
|
||
type GenerateNewAPIKeyResponse struct { | ||
APIKey string `json:"api_key"` | ||
} | ||
|
||
type BuildDepositTransactionResponse struct { | ||
TxHex string `json:"tx_hex"` | ||
} | ||
|
||
type BuildWithdrawalTransactionResponse struct { | ||
TxHex string `json:"tx_hex"` | ||
} | ||
|
||
type SubmitDepositTransactionResponse struct { | ||
TxHash string `json:"tx_hash"` | ||
} | ||
|
||
type SubmitWithdrawalTransactionResponse struct { | ||
TxHash string `json:"tx_hash"` | ||
} | ||
|
||
type GetTermsAndConditionResponse struct { | ||
Value string `json:"value"` | ||
} | ||
|
||
type MarketDepth struct { | ||
Price float64 `json:"price"` | ||
Quantity float64 `json:"quantity"` | ||
} | ||
|
||
type GetMarketDepthResponse struct { | ||
Bids []MarketDepth `json:"bids"` | ||
Asks []MarketDepth `json:"asks"` | ||
} | ||
|
||
type GetMarketPriceResponse struct { | ||
Price float64 `json:"price"` | ||
} | ||
|
||
type Trade struct { | ||
Time string `json:"time"` | ||
Symbol string `json:"symbol"` | ||
Open float64 `json:"open"` | ||
High float64 `json:"high"` | ||
Low float64 `json:"low"` | ||
Close float64 `json:"close"` | ||
Volume float64 `json:"volume"` | ||
} | ||
|
||
type GetAggregatedPriceResponse []*Trade | ||
|
||
type BuildPlaceOrderTransactionResponse struct { | ||
OrderID string `json:"order_id"` | ||
TxHex string `json:"tx_hex"` | ||
} | ||
|
||
type BuildCancelOrderTransactionResponse struct { | ||
TxHex string `json:"tx_hex"` | ||
} | ||
|
||
type SubmitPlaceOrderTransactionResponse struct { | ||
Order *models.OrderJSON `json:"order"` | ||
} | ||
|
||
type SubmitCancelOrderTransactionResponse struct { | ||
TxHash string `json:"txhash"` | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[]*rmodels.UTxO
is * necessary here?