Skip to content

Commit b545910

Browse files
committed
finish implementation
Add support for new contracts through server/asset/eth and client/asset/eth. Requires some modifications to client/core and client/asset to add more swap info to some methods. Differentiate wallet version from supported server versions.
1 parent 7a7241e commit b545910

41 files changed

Lines changed: 647 additions & 744 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

client/asset/bch/bch.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ var (
113113
rpcWalletDefinition,
114114
// electrumWalletDefinition, // getinfo RPC needs backport: https://github.com/Electron-Cash/Electron-Cash/pull/2399
115115
},
116+
ProtocolVersions: []uint32{0},
116117
}
117118
)
118119

client/asset/btc/btc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ var (
240240
electrumWalletDefinition,
241241
},
242242
LegacyWalletIndex: 1,
243+
ProtocolVersions: []uint32{0},
243244
}
244245
)
245246

client/asset/btc/electrum_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func TestElectrumExchangeWallet(t *testing.T) {
128128
}
129129

130130
// FindRedemption
131-
redeemCoin, secretBytes, err := eew.FindRedemption(ctx, toCoinID(swapTxHash, swapVout), contract)
131+
redeemCoin, secretBytes, err := eew.FindRedemption(ctx, toCoinID(swapTxHash, swapVout), contract, nil)
132132
if err != nil {
133133
t.Fatal(err)
134134
}

client/asset/dcr/dcr.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ var (
233233
ConfigOpts: append(rpcOpts, walletOpts...),
234234
},
235235
},
236+
ProtocolVersions: []uint32{0},
236237
}
237238
swapFeeBumpKey = "swapfeebump"
238239
splitKey = "swapsplit"

client/asset/dcr/simnet_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ func runTest(t *testing.T, splitTx bool) {
274274
confContract := receipts[0].Contract()
275275
checkConfs := func(n uint32, expSpent bool) {
276276
t.Helper()
277-
confs, spent, err := rig.beta().SwapConfirmations(tCtx, confCoin.ID(), confContract, tStart)
277+
confs, spent, err := rig.beta().SwapConfirmations(tCtx, confCoin.ID(), confContract, tStart, nil)
278278
if err != nil {
279279
t.Fatalf("error getting %d confs: %v", n, err)
280280
}
@@ -324,7 +324,7 @@ func runTest(t *testing.T, splitTx bool) {
324324
if swapOutput.Value() != swapVal {
325325
t.Fatalf("wrong contract value. wanted %d, got %d", swapVal, swapOutput.Value())
326326
}
327-
confs, spent, err := rig.alpha().SwapConfirmations(context.TODO(), swapOutput.ID(), receipt.Contract(), tStart)
327+
confs, spent, err := rig.alpha().SwapConfirmations(context.TODO(), swapOutput.ID(), receipt.Contract(), tStart, nil)
328328
if err != nil {
329329
t.Fatalf("error getting confirmations: %v", err)
330330
}
@@ -364,7 +364,7 @@ func runTest(t *testing.T, splitTx bool) {
364364
waitNetwork()
365365
ctx, cancel := context.WithDeadline(tCtx, time.Now().Add(time.Second*5))
366366
defer cancel()
367-
_, checkKey, err := rig.beta().FindRedemption(ctx, swapReceipt.Coin().ID(), nil)
367+
_, checkKey, err := rig.beta().FindRedemption(ctx, swapReceipt.Coin().ID(), nil, nil)
368368
if err != nil {
369369
t.Fatalf("error finding unconfirmed redemption: %v", err)
370370
}
@@ -384,7 +384,7 @@ func runTest(t *testing.T, splitTx bool) {
384384
}
385385
ctx, cancel2 := context.WithDeadline(tCtx, time.Now().Add(time.Second*5))
386386
defer cancel2()
387-
_, _, err = rig.beta().FindRedemption(ctx, swapReceipt.Coin().ID(), nil)
387+
_, _, err = rig.beta().FindRedemption(ctx, swapReceipt.Coin().ID(), nil, nil)
388388
if err != nil {
389389
t.Fatalf("error finding confirmed redemption: %v", err)
390390
}
@@ -420,7 +420,7 @@ func runTest(t *testing.T, splitTx bool) {
420420
swapReceipt = receipts[0]
421421

422422
waitNetwork()
423-
_, err = rig.beta().Refund(swapReceipt.Coin().ID(), swapReceipt.Contract(), tDCR.MaxFeeRate/4)
423+
_, err = rig.beta().Refund(swapReceipt.Coin().ID(), swapReceipt.Contract(), nil, tDCR.MaxFeeRate/4)
424424
if err != nil {
425425
t.Fatalf("refund error: %v", err)
426426
}

client/asset/doge/doge.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ var (
8888
DefaultConfigPath: dexbtc.SystemConfigPath("dogecoin"),
8989
ConfigOpts: configOpts,
9090
}},
91+
ProtocolVersions: []uint32{0},
9192
}
9293
)
9394

0 commit comments

Comments
 (0)