Skip to content

Commit

Permalink
normalize terminology again. dynamic tx gas limit
Browse files Browse the repository at this point in the history
  • Loading branch information
buck54321 committed Feb 1, 2025
1 parent abde7e5 commit 5642b7b
Show file tree
Hide file tree
Showing 17 changed files with 328 additions and 406 deletions.
12 changes: 6 additions & 6 deletions client/asset/btc/btc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2197,7 +2197,7 @@ func testAvailableFund(t *testing.T, segwit bool, walletType string) {
}

ord := &asset.Order{
Version: version,
AssetVersion: version,
Value: 0,
MaxSwapCount: 1,
MaxFeeRate: tBTC.MaxFeeRate,
Expand Down Expand Up @@ -2762,7 +2762,7 @@ func TestFundEdges(t *testing.T) {
unspents := []*ListUnspentResult{p2pkhUnspent}
node.listUnspent = unspents
ord := &asset.Order{
Version: version,
AssetVersion: version,
Value: swapVal,
MaxSwapCount: lots,
MaxFeeRate: tBTC.MaxFeeRate,
Expand Down Expand Up @@ -2986,7 +2986,7 @@ func TestFundEdgesSegwit(t *testing.T) {
unspents := []*ListUnspentResult{p2wpkhUnspent}
node.listUnspent = unspents
ord := &asset.Order{
Version: version,
AssetVersion: version,
Value: swapVal,
MaxSwapCount: lots,
MaxFeeRate: tBTC.MaxFeeRate,
Expand Down Expand Up @@ -4365,7 +4365,7 @@ func testPreSwap(t *testing.T, segwit bool, walletType string) {
}

form := &asset.PreSwapForm{
Version: version,
AssetVersion: version,
LotSize: tLotSize,
Lots: lots,
MaxFeeRate: tBTC.MaxFeeRate,
Expand Down Expand Up @@ -4411,8 +4411,8 @@ func testPreRedeem(t *testing.T, segwit bool, walletType string) {
defer shutdown()

preRedeem, err := wallet.PreRedeem(&asset.PreRedeemForm{
Version: version,
Lots: 5,
AssetVersion: version,
Lots: 5,
})
// Shouldn't actually be any path to error.
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion client/asset/btc/livetest/livetest.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func Run(t *testing.T, cfg *Config) {
checkAmt("second", rig.secondWallet)

ord := &asset.Order{
Version: 0,
AssetVersion: 0,
Value: contractValue * 3,
MaxSwapCount: lots * 3,
MaxFeeRate: cfg.Asset.MaxFeeRate,
Expand Down
2 changes: 1 addition & 1 deletion client/asset/btc/simnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ func testWalletTxBalanceSync(t *testing.T, fromWallet, toWallet *ExchangeWalletF
}

order := &asset.Order{
Value: toSatoshi(1),
AssetVersion: toSatoshi(1),
FeeSuggestion: 10,
MaxSwapCount: 1,
MaxFeeRate: 20,
Expand Down
10 changes: 5 additions & 5 deletions client/asset/dcr/dcr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ func TestAvailableFund(t *testing.T) {
}

ord := &asset.Order{
Version: version,
AssetVersion: version,
Value: 0,
MaxSwapCount: 1,
MaxFeeRate: tDCR.MaxFeeRate,
Expand Down Expand Up @@ -2595,7 +2595,7 @@ func TestFundEdges(t *testing.T) {

node.unspent = []walletjson.ListUnspentResult{p2pkhUnspent}
ord := &asset.Order{
Version: version,
AssetVersion: version,
Value: swapVal,
MaxSwapCount: lots,
MaxFeeRate: tDCR.MaxFeeRate,
Expand Down Expand Up @@ -3871,7 +3871,7 @@ func TestPreSwap(t *testing.T) {
node.unspent = []walletjson.ListUnspentResult{p2pkhUnspent}

form := &asset.PreSwapForm{
Version: version,
AssetVersion: version,
LotSize: tLotSize,
Lots: lots,
MaxFeeRate: tDCR.MaxFeeRate,
Expand Down Expand Up @@ -3913,8 +3913,8 @@ func TestPreRedeem(t *testing.T) {
defer shutdown()

preRedeem, err := wallet.PreRedeem(&asset.PreRedeemForm{
Version: version,
Lots: 5,
AssetVersion: version,
Lots: 5,
})
// Shouldn't actually be any path to error.
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion client/asset/dcr/simnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ func runTest(t *testing.T, splitTx bool) {
}

ord := &asset.Order{
Version: tDCR.Version,
AssetVersion: tDCR.Version,
Value: contractValue * 3,
MaxSwapCount: lots * 3,
MaxFeeRate: tDCR.MaxFeeRate,
Expand Down
10 changes: 6 additions & 4 deletions client/asset/estimation.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ type RedeemEstimate struct {

// PreSwapForm can be used to get a swap fees estimate.
type PreSwapForm struct {
// Version is the asset version. Most backends only support one version.
Version uint32
// AssetVersion is the server's asset version. Most backends only support
// one version.
AssetVersion uint32
// LotSize is the lot size for the calculation. For quote assets, LotSize
// should be based on either the user's limit order rate, or some measure
// of the current market rate.
Expand Down Expand Up @@ -83,8 +84,9 @@ type PreSwap struct {

// PreRedeemForm can be used to get a redemption estimate.
type PreRedeemForm struct {
// Version is the asset version. Most backends only support one version.
Version uint32
// AssetVersion is the asset version. Most backends only support one
// version.
AssetVersion uint32
// Lots is the number of lots in the order.
Lots uint64
// FeeSuggestion is a suggested fee from the server.
Expand Down
Loading

0 comments on commit 5642b7b

Please sign in to comment.