From 8690126fc30fd56f37ea3f3e064818cd5645c4c3 Mon Sep 17 00:00:00 2001 From: scorpiotzh <835598264@qq.com> Date: Mon, 4 Jul 2022 18:25:05 +0800 Subject: [PATCH 01/15] feat: add recycle_expired_account tx action --- go.mod | 2 +- go.sum | 4 ++-- tables/t_transaction_info.go | 11 ++++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 0066ed86..62eb3cbb 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module das_register_server go 1.15 require ( - github.com/dotbitHQ/das-lib v0.0.0-20220701093247-062a260f7014 + github.com/dotbitHQ/das-lib v0.0.0-20220704075725-877a1cd0f68f github.com/elazarl/goproxy v0.0.0-20220417044921-416226498f94 // indirect github.com/ethereum/go-ethereum v1.10.17 github.com/fsnotify/fsnotify v1.5.3 diff --git a/go.sum b/go.sum index b21fa159..eeb9fb57 100644 --- a/go.sum +++ b/go.sum @@ -106,8 +106,8 @@ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5O github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= -github.com/dotbitHQ/das-lib v0.0.0-20220701093247-062a260f7014 h1:XfDRX1VnhdtUe0jdo891BthgbHXDJzjS/GqQAYf9bvk= -github.com/dotbitHQ/das-lib v0.0.0-20220701093247-062a260f7014/go.mod h1:cjxR/SvT6w9U2fvNpADeyB31ukYLSrfffC67puHOZ/c= +github.com/dotbitHQ/das-lib v0.0.0-20220704075725-877a1cd0f68f h1:moaYZttKejT+eVV8oElYxvozFFwpjIuBfZrklLlzH6g= +github.com/dotbitHQ/das-lib v0.0.0-20220704075725-877a1cd0f68f/go.mod h1:cjxR/SvT6w9U2fvNpADeyB31ukYLSrfffC67puHOZ/c= github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/elazarl/goproxy v0.0.0-20220417044921-416226498f94 h1:VIy7cdK7ufs7ctpTFkXJHm1uP3dJSnCGSPysEICB1so= diff --git a/tables/t_transaction_info.go b/tables/t_transaction_info.go index 9d2a244d..551fdb8a 100644 --- a/tables/t_transaction_info.go +++ b/tables/t_transaction_info.go @@ -61,9 +61,10 @@ const ( ActionEditOfferSub TxAction = 21 ActionOrderRefund TxAction = 22 - ActionEnableSubAccount TxAction = 23 - ActionCreateSubAccount TxAction = 24 - ActionBalanceDeposit TxAction = 25 + ActionEnableSubAccount TxAction = 23 + ActionCreateSubAccount TxAction = 24 + ActionBalanceDeposit TxAction = 25 + ActionRecycleExpiredAccount TxAction = 26 DasActionTransferBalance = "transfer_balance" DasActionBalanceDeposit = "balance_deposit" @@ -129,6 +130,8 @@ func FormatTxAction(action string) TxAction { return ActionEnableSubAccount case common.DasActionCreateSubAccount: return ActionCreateSubAccount + case common.DasActionRecycleExpiredAccount: + return ActionRecycleExpiredAccount } return ActionUndefined } @@ -181,6 +184,8 @@ func FormatActionType(actionType TxAction) string { return DasActionOfferAccepted case ActionOrderRefund: return DasActionOrderRefund + case ActionRecycleExpiredAccount: + return common.DasActionRecycleExpiredAccount } return "" } From b0058dc76a7ca77734519ee2674068114605be61 Mon Sep 17 00:00:00 2001 From: scorpiotzh <835598264@qq.com> Date: Tue, 5 Jul 2022 11:02:44 +0800 Subject: [PATCH 02/15] feat: update get balance func --- go.mod | 2 +- go.sum | 4 ++-- http_server/handle/balance_info.go | 22 ++++++++++++++++++---- http_server/handle/transaction_list.go | 2 +- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 62eb3cbb..7416e458 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module das_register_server go 1.15 require ( - github.com/dotbitHQ/das-lib v0.0.0-20220704075725-877a1cd0f68f + github.com/dotbitHQ/das-lib v0.0.0-20220704113819-e31ee2e97389 github.com/elazarl/goproxy v0.0.0-20220417044921-416226498f94 // indirect github.com/ethereum/go-ethereum v1.10.17 github.com/fsnotify/fsnotify v1.5.3 diff --git a/go.sum b/go.sum index eeb9fb57..11079aef 100644 --- a/go.sum +++ b/go.sum @@ -106,8 +106,8 @@ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5O github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= -github.com/dotbitHQ/das-lib v0.0.0-20220704075725-877a1cd0f68f h1:moaYZttKejT+eVV8oElYxvozFFwpjIuBfZrklLlzH6g= -github.com/dotbitHQ/das-lib v0.0.0-20220704075725-877a1cd0f68f/go.mod h1:cjxR/SvT6w9U2fvNpADeyB31ukYLSrfffC67puHOZ/c= +github.com/dotbitHQ/das-lib v0.0.0-20220704113819-e31ee2e97389 h1:wcDHr50iXtAXWmxWqvxgbuwvzArnl6dSc9XA3QvK9qg= +github.com/dotbitHQ/das-lib v0.0.0-20220704113819-e31ee2e97389/go.mod h1:cjxR/SvT6w9U2fvNpADeyB31ukYLSrfffC67puHOZ/c= github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/elazarl/goproxy v0.0.0-20220417044921-416226498f94 h1:VIy7cdK7ufs7ctpTFkXJHm1uP3dJSnCGSPysEICB1so= diff --git a/http_server/handle/balance_info.go b/http_server/handle/balance_info.go index 716fbf9b..09e392fe 100644 --- a/http_server/handle/balance_info.go +++ b/http_server/handle/balance_info.go @@ -101,7 +101,7 @@ func (h *HttpHandle) doBalanceInfo(req *ReqBalanceInfo, apiResp *api_code.ApiRes } // not 712 if req.ChainType == common.ChainTypeEth { - dasLockScript, dasTypeScript, err := h.dasCore.Daf().HexToScript(core.DasAddressHex{ + dasLockScript, _, err := h.dasCore.Daf().HexToScript(core.DasAddressHex{ DasAlgorithmId: req.ChainType.ToDasAlgorithmId(false), AddressHex: req.Address, IsMulti: false, @@ -111,7 +111,14 @@ func (h *HttpHandle) doBalanceInfo(req *ReqBalanceInfo, apiResp *api_code.ApiRes apiResp.ApiRespErr(api_code.ApiCodeError500, "get das lock err") return fmt.Errorf("HexToScript not 712 err: %s", err.Error()) } - _, dasLockAmount, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), nil, dasLockScript, dasTypeScript, 0, 0) + _, dasLockAmount, err := h.dasCore.GetBalanceCells(&core.ParamGetBalanceCells{ + DasCache: nil, + LockScript: dasLockScript, + CapacityNeed: 0, + CapacityForChange: 0, + SearchOrder: indexer.SearchOrderDesc, + }) + //_, dasLockAmount, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), nil, dasLockScript, dasTypeScript, 0, 0) if err != nil { *apiResp = api_code.ApiRespErr(api_code.ApiCodeError500, "get das balance err") return fmt.Errorf("GetSatisfiedCapacityLiveCell not 712 err: %s", err.Error()) @@ -120,7 +127,7 @@ func (h *HttpHandle) doBalanceInfo(req *ReqBalanceInfo, apiResp *api_code.ApiRes } // 712 - dasLockScript, dasTypeScript, err := h.dasCore.Daf().HexToScript(core.DasAddressHex{ + dasLockScript, _, err := h.dasCore.Daf().HexToScript(core.DasAddressHex{ DasAlgorithmId: req.ChainType.ToDasAlgorithmId(true), AddressHex: req.Address, IsMulti: false, @@ -130,7 +137,14 @@ func (h *HttpHandle) doBalanceInfo(req *ReqBalanceInfo, apiResp *api_code.ApiRes apiResp.ApiRespErr(api_code.ApiCodeError500, "get das lock err") return fmt.Errorf("FormatAddressToDasLockScript err: %s", err.Error()) } - _, dasLockAmount, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), nil, dasLockScript, dasTypeScript, 0, 0) + _, dasLockAmount, err := h.dasCore.GetBalanceCells(&core.ParamGetBalanceCells{ + DasCache: nil, + LockScript: dasLockScript, + CapacityNeed: 0, + CapacityForChange: 0, + SearchOrder: indexer.SearchOrderDesc, + }) + //_, dasLockAmount, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), nil, dasLockScript, dasTypeScript, 0, 0) if err != nil { *apiResp = api_code.ApiRespErr(api_code.ApiCodeError500, "get 712 das balance err") return fmt.Errorf("GetSatisfiedCapacityLiveCell err: %s", err.Error()) diff --git a/http_server/handle/transaction_list.go b/http_server/handle/transaction_list.go index d9e77188..672ab3cf 100644 --- a/http_server/handle/transaction_list.go +++ b/http_server/handle/transaction_list.go @@ -103,7 +103,7 @@ func (h *HttpHandle) doTransactionList(req *ReqTransactionList, apiResp *api_cod Timestamp: v.BlockTimestamp, }) } - // 总记录数 + // count, err := h.dbDao.GetTransactionListTotal(req.ChainType, req.Address) if err != nil { apiResp.ApiRespErr(api_code.ApiCodeDbError, "search tx count err") From 11492a84eb804f02aae4c293fa58a275026cf8f4 Mon Sep 17 00:00:00 2001 From: scorpiotzh <835598264@qq.com> Date: Tue, 5 Jul 2022 11:17:25 +0800 Subject: [PATCH 03/15] feat: test balance func --- http_server/handle/balance_withdraw.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/http_server/handle/balance_withdraw.go b/http_server/handle/balance_withdraw.go index 39045452..d2c57ce0 100644 --- a/http_server/handle/balance_withdraw.go +++ b/http_server/handle/balance_withdraw.go @@ -160,7 +160,14 @@ func (h *HttpHandle) doBalanceWithdraw(req *ReqBalanceWithdraw, apiResp *api_cod if req.WithdrawAll { allAmount = uint64(0) } - liveCell, totalAmount, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), h.dasCache, dasLockScript, dasTypeScript, allAmount, common.DasLockWithBalanceTypeOccupiedCkb) + liveCell, totalAmount, err := h.dasCore.GetBalanceCells(&core.ParamGetBalanceCells{ + DasCache: h.dasCache, + LockScript: dasLockScript, + CapacityNeed: allAmount, + CapacityForChange: common.DasLockWithBalanceTypeOccupiedCkb, + SearchOrder: indexer.SearchOrderDesc, + }) + //liveCell, totalAmount, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), h.dasCache, dasLockScript, dasTypeScript, allAmount, common.DasLockWithBalanceTypeOccupiedCkb) if err != nil { if err == core.ErrRejectedOutPoint { apiResp.ApiRespErr(api_code.ApiCodeRejectedOutPoint, core.ErrRejectedOutPoint.Error()) From 017679afbd3de9c97ca7324cda67024abfbcfc92 Mon Sep 17 00:00:00 2001 From: scorpiotzh <835598264@qq.com> Date: Tue, 5 Jul 2022 11:21:37 +0800 Subject: [PATCH 04/15] feat: test balance func --- http_server/handle/balance_withdraw.go | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/http_server/handle/balance_withdraw.go b/http_server/handle/balance_withdraw.go index d2c57ce0..dfec8c5a 100644 --- a/http_server/handle/balance_withdraw.go +++ b/http_server/handle/balance_withdraw.go @@ -121,22 +121,15 @@ func (h *HttpHandle) doBalanceWithdraw(req *ReqBalanceWithdraw, apiResp *api_cod apiResp.ApiRespErr(api_code.ApiCodeParamsInvalid, fmt.Sprintf("amount [%s] is invalid", req.Amount)) return fmt.Errorf("amount not enough: %s", req.Amount) } - ownerHex, _, err := h.dasCore.Daf().ArgsToHex(parseAddress.Script.Args) + balContract, err := core.GetDasContractInfo(common.DasContractNameBalanceCellType) if err != nil { - apiResp.ApiRespErr(api_code.ApiCodeError500, "ArgsToHex err") - return fmt.Errorf("ArgsToHex err: %s", err.Error()) + apiResp.ApiRespErr(api_code.ApiCodeError500, "get balance type id fail") + return fmt.Errorf("GetDasContractInfo: %s", err.Error()) } - if ownerHex.DasAlgorithmId == common.DasAlgorithmIdEth712 { - balContract, err := core.GetDasContractInfo(common.DasContractNameBalanceCellType) - if err != nil { - apiResp.ApiRespErr(api_code.ApiCodeError500, "get balance type id fail") - return fmt.Errorf("GetDasContractInfo: %s", err.Error()) - } - toTypeScript = &types.Script{ - CodeHash: balContract.ContractTypeId, - HashType: types.HashTypeType, - Args: nil, - } + toTypeScript = &types.Script{ + CodeHash: balContract.ContractTypeId, + HashType: types.HashTypeType, + Args: nil, } } } else { From 949d856025b518e692e03eadf86eea0278a52d2f Mon Sep 17 00:00:00 2001 From: scorpiotzh <835598264@qq.com> Date: Tue, 5 Jul 2022 11:54:00 +0800 Subject: [PATCH 05/15] feat: test GetBalanceCells --- http_server/handle/balance_deposit.go | 11 +++++++++-- http_server/handle/balance_info.go | 4 ++-- http_server/handle/balance_pay.go | 11 +++++++++-- http_server/handle/balance_transfer.go | 22 ++++++++++++++++++---- http_server/handle/balance_withdraw.go | 2 +- http_server/handle/reverse_declare.go | 11 +++++++++-- txtool/apply.go | 11 +++++++++-- txtool/pre_register.go | 12 ++++++++++-- txtool/renew.go | 11 +++++++++-- 9 files changed, 76 insertions(+), 19 deletions(-) diff --git a/http_server/handle/balance_deposit.go b/http_server/handle/balance_deposit.go index 11e382ab..eb94a1e3 100644 --- a/http_server/handle/balance_deposit.go +++ b/http_server/handle/balance_deposit.go @@ -127,7 +127,14 @@ func (h *HttpHandle) doBalanceDeposit(req *ReqBalanceDeposit, apiResp *api_code. } fee := uint64(1e4) - liveCell, total, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), h.dasCache, fromAddress.Script, fromTypeScript, req.Amount+fee, common.DasLockWithBalanceTypeOccupiedCkb) + liveCell, total, err := h.dasCore.GetBalanceCells(&core.ParamGetBalanceCells{ + DasCache: h.dasCache, + LockScript: fromAddress.Script, + CapacityNeed: req.Amount + fee, + CapacityForChange: common.DasLockWithBalanceTypeOccupiedCkb, + SearchOrder: indexer.SearchOrderDesc, + }) + //liveCell, total, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), h.dasCache, fromAddress.Script, fromTypeScript, req.Amount+fee, common.DasLockWithBalanceTypeOccupiedCkb) if err != nil { if err == core.ErrRejectedOutPoint { apiResp.ApiRespErr(api_code.ApiCodeRejectedOutPoint, err.Error()) @@ -140,7 +147,7 @@ func (h *HttpHandle) doBalanceDeposit(req *ReqBalanceDeposit, apiResp *api_code. return nil } else { apiResp.ApiRespErr(api_code.ApiCodeError500, err.Error()) - return fmt.Errorf("GetSatisfiedCapacityLiveCell err: %s", err.Error()) + return fmt.Errorf("GetBalanceCells err: %s", err.Error()) } } diff --git a/http_server/handle/balance_info.go b/http_server/handle/balance_info.go index 09e392fe..59f2fe8d 100644 --- a/http_server/handle/balance_info.go +++ b/http_server/handle/balance_info.go @@ -121,7 +121,7 @@ func (h *HttpHandle) doBalanceInfo(req *ReqBalanceInfo, apiResp *api_code.ApiRes //_, dasLockAmount, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), nil, dasLockScript, dasTypeScript, 0, 0) if err != nil { *apiResp = api_code.ApiRespErr(api_code.ApiCodeError500, "get das balance err") - return fmt.Errorf("GetSatisfiedCapacityLiveCell not 712 err: %s", err.Error()) + return fmt.Errorf("GetBalanceCells not 712 err: %s", err.Error()) } resp.TransferAddressAmount += dasLockAmount } @@ -147,7 +147,7 @@ func (h *HttpHandle) doBalanceInfo(req *ReqBalanceInfo, apiResp *api_code.ApiRes //_, dasLockAmount, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), nil, dasLockScript, dasTypeScript, 0, 0) if err != nil { *apiResp = api_code.ApiRespErr(api_code.ApiCodeError500, "get 712 das balance err") - return fmt.Errorf("GetSatisfiedCapacityLiveCell err: %s", err.Error()) + return fmt.Errorf("GetBalanceCells err: %s", err.Error()) } resp.DasLockAmount = dasLockAmount diff --git a/http_server/handle/balance_pay.go b/http_server/handle/balance_pay.go index b09de4e0..2397d591 100644 --- a/http_server/handle/balance_pay.go +++ b/http_server/handle/balance_pay.go @@ -115,7 +115,14 @@ func (h *HttpHandle) doBalancePay(req *ReqBalancePay, apiResp *api_code.ApiResp) } fee := uint64(1e4) needCapacity := order.PayAmount.BigInt().Uint64() + fee - liveCells, totalCapacity, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), h.dasCache, dasLock, dasType, needCapacity, common.DasLockWithBalanceTypeOccupiedCkb) + liveCells, totalCapacity, err := h.dasCore.GetBalanceCells(&core.ParamGetBalanceCells{ + DasCache: h.dasCache, + LockScript: dasLock, + CapacityNeed: needCapacity, + CapacityForChange: common.DasLockWithBalanceTypeOccupiedCkb, + SearchOrder: indexer.SearchOrderDesc, + }) + //liveCells, totalCapacity, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), h.dasCache, dasLock, dasType, needCapacity, common.DasLockWithBalanceTypeOccupiedCkb) if err != nil { if err == core.ErrRejectedOutPoint { apiResp.ApiRespErr(api_code.ApiCodeRejectedOutPoint, err.Error()) @@ -128,7 +135,7 @@ func (h *HttpHandle) doBalancePay(req *ReqBalancePay, apiResp *api_code.ApiResp) return nil } else { apiResp.ApiRespErr(api_code.ApiCodeError500, err.Error()) - return fmt.Errorf("GetSatisfiedCapacityLiveCell err: %s", err.Error()) + return fmt.Errorf("GetBalanceCells err: %s", err.Error()) } } diff --git a/http_server/handle/balance_transfer.go b/http_server/handle/balance_transfer.go index e502c76c..7b20314b 100644 --- a/http_server/handle/balance_transfer.go +++ b/http_server/handle/balance_transfer.go @@ -105,10 +105,17 @@ func (h *HttpHandle) doBalanceTransfer(req *ReqBalanceTransfer, apiResp *api_cod apiResp.ApiRespErr(api_code.ApiCodeError500, "HexToScript err") return fmt.Errorf("HexToScript err: %s", err.Error()) } - liveCells, totalAmount, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), nil, fromLock, nil, 0, 0) + liveCells, totalAmount, err := h.dasCore.GetBalanceCells(&core.ParamGetBalanceCells{ + DasCache: nil, + LockScript: fromLock, + CapacityNeed: 0, + CapacityForChange: 0, + SearchOrder: indexer.SearchOrderDesc, + }) + //liveCells, totalAmount, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), nil, fromLock, nil, 0, 0) if err != nil { apiResp.ApiRespErr(api_code.ApiCodeError500, "check balance err: "+err.Error()) - return fmt.Errorf("GetSatisfiedCapacityLiveCell err: %s", err.Error()) + return fmt.Errorf("GetBalanceCells err: %s", err.Error()) } else if totalAmount <= common.DasLockWithBalanceTypeOccupiedCkb { // 余额不足 if req.TransferAddress != "" { parseAddress, err := address.Parse(req.TransferAddress) @@ -121,10 +128,17 @@ func (h *HttpHandle) doBalanceTransfer(req *ReqBalanceTransfer, apiResp *api_cod return fmt.Errorf("full address: %s", req.TransferAddress) } fromLock = parseAddress.Script - liveCells, totalAmount, err = core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), nil, fromLock, nil, 0, 0) + liveCells, totalAmount, err = h.dasCore.GetBalanceCells(&core.ParamGetBalanceCells{ + DasCache: nil, + LockScript: fromLock, + CapacityNeed: 0, + CapacityForChange: 0, + SearchOrder: indexer.SearchOrderDesc, + }) + //liveCells, totalAmount, err = core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), nil, fromLock, nil, 0, 0) if err != nil { apiResp.ApiRespErr(api_code.ApiCodeError500, "check balance err: "+err.Error()) - return fmt.Errorf("GetSatisfiedCapacityLiveCell err: %s", err.Error()) + return fmt.Errorf("GetBalanceCells err: %s", err.Error()) } if totalAmount <= common.DasLockWithBalanceTypeOccupiedCkb { // 余额不足 apiResp.ApiRespErr(api_code.ApiCodeInsufficientBalance, "insufficient balance") diff --git a/http_server/handle/balance_withdraw.go b/http_server/handle/balance_withdraw.go index dfec8c5a..f7415b2b 100644 --- a/http_server/handle/balance_withdraw.go +++ b/http_server/handle/balance_withdraw.go @@ -171,7 +171,7 @@ func (h *HttpHandle) doBalanceWithdraw(req *ReqBalanceWithdraw, apiResp *api_cod } else { apiResp.ApiRespErr(api_code.ApiCodeError500, "check balance err: "+err.Error()) } - return fmt.Errorf("GetSatisfiedCapacityLiveCell err: %s [%s]", err.Error(), req.ReceiverAddress) + return fmt.Errorf("GetBalanceCells err: %s [%s]", err.Error(), req.ReceiverAddress) } if req.WithdrawAll { withdrawAmount = totalAmount - fee diff --git a/http_server/handle/reverse_declare.go b/http_server/handle/reverse_declare.go index dbc39706..1709f31b 100644 --- a/http_server/handle/reverse_declare.go +++ b/http_server/handle/reverse_declare.go @@ -144,7 +144,14 @@ func (h *HttpHandle) doReverseDeclare(req *ReqReverseDeclare, apiResp *api_code. preparedFeeCapacity, _ := configCellBuilder.RecordPreparedFeeCapacity() needCapacity := baseCapacity + preparedFeeCapacity feeCapacity, _ := configCellBuilder.RecordCommonFee() - liveCells, totalCapacity, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), h.dasCache, dasLock, dasType, needCapacity+feeCapacity, common.DasLockWithBalanceTypeOccupiedCkb) + liveCells, totalCapacity, err := h.dasCore.GetBalanceCells(&core.ParamGetBalanceCells{ + DasCache: h.dasCache, + LockScript: dasLock, + CapacityNeed: needCapacity + feeCapacity, + CapacityForChange: common.DasLockWithBalanceTypeOccupiedCkb, + SearchOrder: indexer.SearchOrderDesc, + }) + //liveCells, totalCapacity, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), h.dasCache, dasLock, dasType, needCapacity+feeCapacity, common.DasLockWithBalanceTypeOccupiedCkb) if err != nil { if err == core.ErrRejectedOutPoint { apiResp.ApiRespErr(api_code.ApiCodeRejectedOutPoint, core.ErrRejectedOutPoint.Error()) @@ -155,7 +162,7 @@ func (h *HttpHandle) doReverseDeclare(req *ReqReverseDeclare, apiResp *api_code. } else { apiResp.ApiRespErr(api_code.ApiCodeError500, "get capacity err") } - return fmt.Errorf("GetSatisfiedCapacityLiveCell err: %s", err.Error()) + return fmt.Errorf("GetBalanceCells err: %s", err.Error()) } // build tx diff --git a/txtool/apply.go b/txtool/apply.go index f8bfec65..7d8c51a0 100644 --- a/txtool/apply.go +++ b/txtool/apply.go @@ -131,9 +131,16 @@ func (t *TxTool) buildOrderApplyTx(p *applyTxParams) (*txbuilder.BuildTransactio feeCapacity := uint64(1e4) splitCapacity := 1000 * common.OneCkb needCapacity := feeCapacity + applyOutputs.Capacity - liveCell, totalCapacity, err := core.GetSatisfiedCapacityLiveCellWithOrder(t.DasCore.Client(), t.DasCache, t.ServerScript, nil, needCapacity+splitCapacity, common.MinCellOccupiedCkb, indexer.SearchOrderAsc) + liveCell, totalCapacity, err := t.DasCore.GetBalanceCells(&core.ParamGetBalanceCells{ + DasCache: t.DasCache, + LockScript: t.ServerScript, + CapacityNeed: needCapacity + splitCapacity, + CapacityForChange: common.MinCellOccupiedCkb, + SearchOrder: indexer.SearchOrderAsc, + }) + //liveCell, totalCapacity, err := core.GetSatisfiedCapacityLiveCellWithOrder(t.DasCore.Client(), t.DasCache, t.ServerScript, nil, needCapacity+splitCapacity, common.MinCellOccupiedCkb, indexer.SearchOrderAsc) if err != nil { - return nil, fmt.Errorf("GetSatisfiedCapacityLiveCell err: %s", err.Error()) + return nil, fmt.Errorf("GetBalanceCells err: %s", err.Error()) } if change := totalCapacity - needCapacity; change > 0 { changeList, err := core.SplitOutputCell(change, 500*common.OneCkb, 2, t.ServerScript, nil) diff --git a/txtool/pre_register.go b/txtool/pre_register.go index 7640c784..521a0d9c 100644 --- a/txtool/pre_register.go +++ b/txtool/pre_register.go @@ -296,9 +296,17 @@ func (t *TxTool) buildOrderPreRegisterTx(p *preRegisterTxParams) (*txbuilder.Bui // search balance feeCapacity := uint64(1112663) needCapacity := feeCapacity + preOutputs.Capacity - applyCapacity - liveCell, totalCapacity, err := core.GetSatisfiedCapacityLiveCellWithOrder(t.DasCore.Client(), t.DasCache, t.ServerScript, nil, needCapacity, common.MinCellOccupiedCkb, indexer.SearchOrderAsc) + + liveCell, totalCapacity, err := t.DasCore.GetBalanceCells(&core.ParamGetBalanceCells{ + DasCache: t.DasCache, + LockScript: t.ServerScript, + CapacityNeed: needCapacity, + CapacityForChange: common.MinCellOccupiedCkb, + SearchOrder: indexer.SearchOrderAsc, + }) + //liveCell, totalCapacity, err := core.GetSatisfiedCapacityLiveCellWithOrder(t.DasCore.Client(), t.DasCache, t.ServerScript, nil, needCapacity, common.MinCellOccupiedCkb, indexer.SearchOrderAsc) if err != nil { - return nil, fmt.Errorf("GetSatisfiedCapacityLiveCell err: %s", err.Error()) + return nil, fmt.Errorf("GetBalanceCells err: %s", err.Error()) } if change := totalCapacity - needCapacity; change > 0 { txParams.Outputs = append(txParams.Outputs, &types.CellOutput{ diff --git a/txtool/renew.go b/txtool/renew.go index 15c14aed..861ea209 100644 --- a/txtool/renew.go +++ b/txtool/renew.go @@ -183,9 +183,16 @@ func (t *TxTool) buildOrderRenewTx(p *renewTxParams) (*txbuilder.BuildTransactio feeCapacity := uint64(1e4) splitCapacity := 1000 * common.OneCkb needCapacity := feeCapacity + incomeCell.incomeCell.Capacity - liveCell, totalCapacity, err := core.GetSatisfiedCapacityLiveCellWithOrder(t.DasCore.Client(), t.DasCache, t.ServerScript, nil, needCapacity+splitCapacity, common.MinCellOccupiedCkb, indexer.SearchOrderAsc) + liveCell, totalCapacity, err := t.DasCore.GetBalanceCells(&core.ParamGetBalanceCells{ + DasCache: t.DasCache, + LockScript: t.ServerScript, + CapacityNeed: needCapacity + splitCapacity, + CapacityForChange: common.MinCellOccupiedCkb, + SearchOrder: indexer.SearchOrderAsc, + }) + //liveCell, totalCapacity, err := core.GetSatisfiedCapacityLiveCellWithOrder(t.DasCore.Client(), t.DasCache, t.ServerScript, nil, needCapacity+splitCapacity, common.MinCellOccupiedCkb, indexer.SearchOrderAsc) if err != nil { - return nil, fmt.Errorf("GetSatisfiedCapacityLiveCell err: %s", err.Error()) + return nil, fmt.Errorf("GetBalanceCells err: %s", err.Error()) } // inputs From b91fb94ce7681ab5ca5828f6c8ecc27bd7a858a2 Mon Sep 17 00:00:00 2001 From: scorpiotzh <835598264@qq.com> Date: Tue, 5 Jul 2022 14:00:27 +0800 Subject: [PATCH 06/15] feat: test GetBalanceCells --- http_server/handle/balance_deposit.go | 1 - http_server/handle/balance_info.go | 2 -- http_server/handle/balance_pay.go | 1 - http_server/handle/balance_transfer.go | 2 -- http_server/handle/balance_withdraw.go | 1 - http_server/handle/order_renew.go | 2 +- http_server/handle/reverse_declare.go | 1 - txtool/apply.go | 1 - txtool/pre_register.go | 1 - txtool/renew.go | 1 - 10 files changed, 1 insertion(+), 12 deletions(-) diff --git a/http_server/handle/balance_deposit.go b/http_server/handle/balance_deposit.go index eb94a1e3..799d92c5 100644 --- a/http_server/handle/balance_deposit.go +++ b/http_server/handle/balance_deposit.go @@ -134,7 +134,6 @@ func (h *HttpHandle) doBalanceDeposit(req *ReqBalanceDeposit, apiResp *api_code. CapacityForChange: common.DasLockWithBalanceTypeOccupiedCkb, SearchOrder: indexer.SearchOrderDesc, }) - //liveCell, total, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), h.dasCache, fromAddress.Script, fromTypeScript, req.Amount+fee, common.DasLockWithBalanceTypeOccupiedCkb) if err != nil { if err == core.ErrRejectedOutPoint { apiResp.ApiRespErr(api_code.ApiCodeRejectedOutPoint, err.Error()) diff --git a/http_server/handle/balance_info.go b/http_server/handle/balance_info.go index 59f2fe8d..be06c452 100644 --- a/http_server/handle/balance_info.go +++ b/http_server/handle/balance_info.go @@ -118,7 +118,6 @@ func (h *HttpHandle) doBalanceInfo(req *ReqBalanceInfo, apiResp *api_code.ApiRes CapacityForChange: 0, SearchOrder: indexer.SearchOrderDesc, }) - //_, dasLockAmount, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), nil, dasLockScript, dasTypeScript, 0, 0) if err != nil { *apiResp = api_code.ApiRespErr(api_code.ApiCodeError500, "get das balance err") return fmt.Errorf("GetBalanceCells not 712 err: %s", err.Error()) @@ -144,7 +143,6 @@ func (h *HttpHandle) doBalanceInfo(req *ReqBalanceInfo, apiResp *api_code.ApiRes CapacityForChange: 0, SearchOrder: indexer.SearchOrderDesc, }) - //_, dasLockAmount, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), nil, dasLockScript, dasTypeScript, 0, 0) if err != nil { *apiResp = api_code.ApiRespErr(api_code.ApiCodeError500, "get 712 das balance err") return fmt.Errorf("GetBalanceCells err: %s", err.Error()) diff --git a/http_server/handle/balance_pay.go b/http_server/handle/balance_pay.go index 2397d591..ceaadd31 100644 --- a/http_server/handle/balance_pay.go +++ b/http_server/handle/balance_pay.go @@ -122,7 +122,6 @@ func (h *HttpHandle) doBalancePay(req *ReqBalancePay, apiResp *api_code.ApiResp) CapacityForChange: common.DasLockWithBalanceTypeOccupiedCkb, SearchOrder: indexer.SearchOrderDesc, }) - //liveCells, totalCapacity, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), h.dasCache, dasLock, dasType, needCapacity, common.DasLockWithBalanceTypeOccupiedCkb) if err != nil { if err == core.ErrRejectedOutPoint { apiResp.ApiRespErr(api_code.ApiCodeRejectedOutPoint, err.Error()) diff --git a/http_server/handle/balance_transfer.go b/http_server/handle/balance_transfer.go index 7b20314b..8acf5b21 100644 --- a/http_server/handle/balance_transfer.go +++ b/http_server/handle/balance_transfer.go @@ -112,7 +112,6 @@ func (h *HttpHandle) doBalanceTransfer(req *ReqBalanceTransfer, apiResp *api_cod CapacityForChange: 0, SearchOrder: indexer.SearchOrderDesc, }) - //liveCells, totalAmount, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), nil, fromLock, nil, 0, 0) if err != nil { apiResp.ApiRespErr(api_code.ApiCodeError500, "check balance err: "+err.Error()) return fmt.Errorf("GetBalanceCells err: %s", err.Error()) @@ -135,7 +134,6 @@ func (h *HttpHandle) doBalanceTransfer(req *ReqBalanceTransfer, apiResp *api_cod CapacityForChange: 0, SearchOrder: indexer.SearchOrderDesc, }) - //liveCells, totalAmount, err = core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), nil, fromLock, nil, 0, 0) if err != nil { apiResp.ApiRespErr(api_code.ApiCodeError500, "check balance err: "+err.Error()) return fmt.Errorf("GetBalanceCells err: %s", err.Error()) diff --git a/http_server/handle/balance_withdraw.go b/http_server/handle/balance_withdraw.go index f7415b2b..286e5f3e 100644 --- a/http_server/handle/balance_withdraw.go +++ b/http_server/handle/balance_withdraw.go @@ -160,7 +160,6 @@ func (h *HttpHandle) doBalanceWithdraw(req *ReqBalanceWithdraw, apiResp *api_cod CapacityForChange: common.DasLockWithBalanceTypeOccupiedCkb, SearchOrder: indexer.SearchOrderDesc, }) - //liveCell, totalAmount, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), h.dasCache, dasLockScript, dasTypeScript, allAmount, common.DasLockWithBalanceTypeOccupiedCkb) if err != nil { if err == core.ErrRejectedOutPoint { apiResp.ApiRespErr(api_code.ApiCodeRejectedOutPoint, core.ErrRejectedOutPoint.Error()) diff --git a/http_server/handle/order_renew.go b/http_server/handle/order_renew.go index 688b58e8..2a8215e1 100644 --- a/http_server/handle/order_renew.go +++ b/http_server/handle/order_renew.go @@ -128,7 +128,7 @@ func (h *HttpHandle) doOrderRenew(req *ReqOrderRenew, apiResp *api_code.ApiResp) } // account limit - _ = h.rc.SetAccountLimit(req.Account, time.Minute*2) + _ = h.rc.SetAccountLimit(req.Account, time.Minute) apiResp.ApiRespOK(resp) return nil } diff --git a/http_server/handle/reverse_declare.go b/http_server/handle/reverse_declare.go index 1709f31b..c688fb91 100644 --- a/http_server/handle/reverse_declare.go +++ b/http_server/handle/reverse_declare.go @@ -151,7 +151,6 @@ func (h *HttpHandle) doReverseDeclare(req *ReqReverseDeclare, apiResp *api_code. CapacityForChange: common.DasLockWithBalanceTypeOccupiedCkb, SearchOrder: indexer.SearchOrderDesc, }) - //liveCells, totalCapacity, err := core.GetSatisfiedCapacityLiveCell(h.dasCore.Client(), h.dasCache, dasLock, dasType, needCapacity+feeCapacity, common.DasLockWithBalanceTypeOccupiedCkb) if err != nil { if err == core.ErrRejectedOutPoint { apiResp.ApiRespErr(api_code.ApiCodeRejectedOutPoint, core.ErrRejectedOutPoint.Error()) diff --git a/txtool/apply.go b/txtool/apply.go index 7d8c51a0..dd5a3a6b 100644 --- a/txtool/apply.go +++ b/txtool/apply.go @@ -138,7 +138,6 @@ func (t *TxTool) buildOrderApplyTx(p *applyTxParams) (*txbuilder.BuildTransactio CapacityForChange: common.MinCellOccupiedCkb, SearchOrder: indexer.SearchOrderAsc, }) - //liveCell, totalCapacity, err := core.GetSatisfiedCapacityLiveCellWithOrder(t.DasCore.Client(), t.DasCache, t.ServerScript, nil, needCapacity+splitCapacity, common.MinCellOccupiedCkb, indexer.SearchOrderAsc) if err != nil { return nil, fmt.Errorf("GetBalanceCells err: %s", err.Error()) } diff --git a/txtool/pre_register.go b/txtool/pre_register.go index 521a0d9c..1532c4b3 100644 --- a/txtool/pre_register.go +++ b/txtool/pre_register.go @@ -304,7 +304,6 @@ func (t *TxTool) buildOrderPreRegisterTx(p *preRegisterTxParams) (*txbuilder.Bui CapacityForChange: common.MinCellOccupiedCkb, SearchOrder: indexer.SearchOrderAsc, }) - //liveCell, totalCapacity, err := core.GetSatisfiedCapacityLiveCellWithOrder(t.DasCore.Client(), t.DasCache, t.ServerScript, nil, needCapacity, common.MinCellOccupiedCkb, indexer.SearchOrderAsc) if err != nil { return nil, fmt.Errorf("GetBalanceCells err: %s", err.Error()) } diff --git a/txtool/renew.go b/txtool/renew.go index 861ea209..a11839cf 100644 --- a/txtool/renew.go +++ b/txtool/renew.go @@ -190,7 +190,6 @@ func (t *TxTool) buildOrderRenewTx(p *renewTxParams) (*txbuilder.BuildTransactio CapacityForChange: common.MinCellOccupiedCkb, SearchOrder: indexer.SearchOrderAsc, }) - //liveCell, totalCapacity, err := core.GetSatisfiedCapacityLiveCellWithOrder(t.DasCore.Client(), t.DasCache, t.ServerScript, nil, needCapacity+splitCapacity, common.MinCellOccupiedCkb, indexer.SearchOrderAsc) if err != nil { return nil, fmt.Errorf("GetBalanceCells err: %s", err.Error()) } From a806a44f955609c661c98bfb58429f8edfee3180 Mon Sep 17 00:00:00 2001 From: scorpiotzh <835598264@qq.com> Date: Tue, 5 Jul 2022 18:05:38 +0800 Subject: [PATCH 07/15] feat: check account grace period --- http_server/api_code/api_code.go | 1 + http_server/handle/order_renew.go | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/http_server/api_code/api_code.go b/http_server/api_code/api_code.go index 6b5f9fe2..2c077683 100644 --- a/http_server/api_code/api_code.go +++ b/http_server/api_code/api_code.go @@ -46,6 +46,7 @@ const ( ApiCodeSigErr ApiCode = 30034 // contracte -31 ApiCodeOnCross ApiCode = 30035 ApiCodeSubAccountNotEnabled ApiCode = 30036 + ApiCodeAfterGracePeriod ApiCode = 30037 ) const ( diff --git a/http_server/handle/order_renew.go b/http_server/handle/order_renew.go index 2a8215e1..d7721430 100644 --- a/http_server/handle/order_renew.go +++ b/http_server/handle/order_renew.go @@ -240,4 +240,16 @@ func (h *HttpHandle) checkRenewOrder(req *ReqOrderRenew, apiResp *api_code.ApiRe apiResp.ApiRespErr(api_code.ApiCodeOnCross, "account on cross") return } + builder, err := h.dasCore.ConfigCellDataBuilderByTypeArgsList( + common.ConfigCellTypeArgsAccount, + ) + if err != nil { + apiResp.ApiRespErr(api_code.ApiCodeError500, fmt.Sprintf("ConfigCellDataBuilderByTypeArgsList err: %s", err.Error())) + return + } + expirationGracePeriod, _ := builder.ExpirationGracePeriod() + if int64(acc.ExpiredAt+uint64(expirationGracePeriod)) <= time.Now().Unix() { + apiResp.ApiRespErr(api_code.ApiCodeAfterGracePeriod, "after the grace period") + return + } } From 214141db524e8ddc17d9942148cf76210e8e3e58 Mon Sep 17 00:00:00 2001 From: scorpiotzh <835598264@qq.com> Date: Tue, 5 Jul 2022 19:12:29 +0800 Subject: [PATCH 08/15] feat: check history order --- txtool/apply.go | 2 +- txtool/pre_register.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/txtool/apply.go b/txtool/apply.go index dd5a3a6b..749941a1 100644 --- a/txtool/apply.go +++ b/txtool/apply.go @@ -49,7 +49,7 @@ func (t *TxTool) DoOrderApplyTx(order *tables.TableDasOrderInfo) error { preOrder, err := t.DbDao.GetPreRegisteredOrderByAccountId(order.AccountId) if err != nil { return fmt.Errorf("GetPreRegisteredOrderByAccountId err: %s", err.Error()) - } else if preOrder.Id > 0 { // refund + } else if preOrder.Id > 0 && time.Now().Unix() < (preOrder.Timestamp/1e3)+2592000 { // refund log.Info("UpdateOrderToRefund:", order.OrderId) if err := t.DbDao.UpdateOrderToRefund(order.OrderId); err != nil { return fmt.Errorf("UpdateOrderToRefund err: %s [%s]", err.Error(), order.OrderId) diff --git a/txtool/pre_register.go b/txtool/pre_register.go index 1532c4b3..7087d8c8 100644 --- a/txtool/pre_register.go +++ b/txtool/pre_register.go @@ -84,7 +84,7 @@ func (t *TxTool) DoOrderPreRegisterTx(order *tables.TableDasOrderInfo) error { preOrder, err := t.DbDao.GetPreRegisteredOrderByAccountId(order.AccountId) if err != nil { return fmt.Errorf("GetPreRegisteredOrderByAccountId err: %s", err.Error()) - } else if preOrder.Id > 0 { // refund + } else if preOrder.Id > 0 && time.Now().Unix() < (preOrder.Timestamp/1e3)+2592000 { // refund log.Info("UpdateOrderToRefund:", order.OrderId) if err := t.DbDao.UpdateOrderToRefund(order.OrderId); err != nil { return fmt.Errorf("UpdateOrderToRefund err: %s [%s]", err.Error(), order.OrderId) From 8123d07b3a688e0239dc8eb789fab9891ec6e5f2 Mon Sep 17 00:00:00 2001 From: scorpiotzh <835598264@qq.com> Date: Tue, 5 Jul 2022 19:23:26 +0800 Subject: [PATCH 09/15] feat: add action ActionForceRecoverAccountStatus --- tables/t_transaction_info.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tables/t_transaction_info.go b/tables/t_transaction_info.go index 551fdb8a..bd4630bc 100644 --- a/tables/t_transaction_info.go +++ b/tables/t_transaction_info.go @@ -61,10 +61,11 @@ const ( ActionEditOfferSub TxAction = 21 ActionOrderRefund TxAction = 22 - ActionEnableSubAccount TxAction = 23 - ActionCreateSubAccount TxAction = 24 - ActionBalanceDeposit TxAction = 25 - ActionRecycleExpiredAccount TxAction = 26 + ActionEnableSubAccount TxAction = 23 + ActionCreateSubAccount TxAction = 24 + ActionBalanceDeposit TxAction = 25 + ActionRecycleExpiredAccount TxAction = 26 + ActionForceRecoverAccountStatus TxAction = 27 DasActionTransferBalance = "transfer_balance" DasActionBalanceDeposit = "balance_deposit" @@ -132,6 +133,8 @@ func FormatTxAction(action string) TxAction { return ActionCreateSubAccount case common.DasActionRecycleExpiredAccount: return ActionRecycleExpiredAccount + case common.DasActionForceRecoverAccountStatus: + return ActionForceRecoverAccountStatus } return ActionUndefined } @@ -186,6 +189,8 @@ func FormatActionType(actionType TxAction) string { return DasActionOrderRefund case ActionRecycleExpiredAccount: return common.DasActionRecycleExpiredAccount + case ActionForceRecoverAccountStatus: + return common.DasActionForceRecoverAccountStatus } return "" } From 19eaa40cf022e3986b1ead483a6484354a1350f2 Mon Sep 17 00:00:00 2001 From: scorpiotzh <835598264@qq.com> Date: Tue, 5 Jul 2022 19:51:18 +0800 Subject: [PATCH 10/15] feat: fix search account list --- dao/t_account_info.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dao/t_account_info.go b/dao/t_account_info.go index 248bac92..e8394224 100644 --- a/dao/t_account_info.go +++ b/dao/t_account_info.go @@ -1,6 +1,7 @@ package dao import ( + "das_register_server/config" "das_register_server/tables" "github.com/dotbitHQ/das-lib/common" "gorm.io/gorm" @@ -35,7 +36,11 @@ func (d *DbDao) SearchAccountListWithPage(chainType common.ChainType, address, k db = db.Where("expired_at>=? AND expired_at<=?", expiredAt, expiredAt30Days) case tables.CategoryToBeRecycled: expiredAt := time.Now().Unix() - db = db.Where("expired_at<=?", expiredAt) + recycledAt := time.Now().Add(-time.Hour * 24 * 90).Unix() + if config.Cfg.Server.Net != common.DasNetTypeMainNet { + recycledAt = time.Now().Add(-time.Hour * 24 * 3).Unix() + } + db = db.Where("expired_at<=? AND expired_at>=?", expiredAt, recycledAt) } if keyword != "" { @@ -63,7 +68,11 @@ func (d *DbDao) GetAccountsCount(chainType common.ChainType, address, keyword st db = db.Where("expired_at>=? AND expired_at<=?", expiredAt, expiredAt30Days) case tables.CategoryToBeRecycled: expiredAt := time.Now().Unix() - db = db.Where("expired_at<=?", expiredAt) + recycledAt := time.Now().Add(-time.Hour * 24 * 90).Unix() + if config.Cfg.Server.Net != common.DasNetTypeMainNet { + recycledAt = time.Now().Add(-time.Hour * 24 * 3).Unix() + } + db = db.Where("expired_at<=? AND expired_at>=?", expiredAt, recycledAt) } if keyword != "" { From ad833b4e7d021b4c4a85f70383f16c47d436d8bc Mon Sep 17 00:00:00 2001 From: slagga <957766762@qq.com> Date: Fri, 8 Jul 2022 17:06:54 +0800 Subject: [PATCH 11/15] fix: filter account on cross --- dao/t_account_info.go | 2 ++ dao/t_records_info.go | 4 ++-- http_server/handle/account_records.go | 21 +++++++++++++++++++-- http_server/handle/reverse_latest.go | 6 ++++-- http_server/handle/reverse_list.go | 11 +++++++++++ 5 files changed, 38 insertions(+), 6 deletions(-) diff --git a/dao/t_account_info.go b/dao/t_account_info.go index e8394224..911bc7f7 100644 --- a/dao/t_account_info.go +++ b/dao/t_account_info.go @@ -21,6 +21,7 @@ func (d *DbDao) SearchAccountList(chainType common.ChainType, address string) (l func (d *DbDao) SearchAccountListWithPage(chainType common.ChainType, address, keyword string, limit, offset int, category tables.Category) (list []tables.TableAccountInfo, err error) { db := d.parserDb.Where("((owner_chain_type=? AND owner=?)OR(manager_chain_type=? AND manager=?))", chainType, address, chainType, address) + db = db.Where("status!=?", tables.AccountStatusOnCross) switch category { //case tables.CategoryDefault: @@ -53,6 +54,7 @@ func (d *DbDao) SearchAccountListWithPage(chainType common.ChainType, address, k func (d *DbDao) GetAccountsCount(chainType common.ChainType, address, keyword string, category tables.Category) (count int64, err error) { db := d.parserDb.Model(tables.TableAccountInfo{}).Where("((owner_chain_type=? AND owner=?)OR(manager_chain_type=? AND manager=?))", chainType, address, chainType, address) + db = db.Where("status!=?", tables.AccountStatusOnCross) switch category { //case tables.CategoryDefault: diff --git a/dao/t_records_info.go b/dao/t_records_info.go index df4d2823..724c3e01 100644 --- a/dao/t_records_info.go +++ b/dao/t_records_info.go @@ -10,8 +10,8 @@ func (d *DbDao) SearchAccountReverseRecords(account, address string) (record tab return } -func (d *DbDao) SearchRecordsByAccount(account string) (list []tables.TableRecordsInfo, err error) { - err = d.parserDb.Where(" account=? ", account).Find(&list).Error +func (d *DbDao) SearchRecordsByAccount(accountId string) (list []tables.TableRecordsInfo, err error) { + err = d.parserDb.Where(" account_id=? ", accountId).Find(&list).Error if err == gorm.ErrRecordNotFound { err = nil } diff --git a/http_server/handle/account_records.go b/http_server/handle/account_records.go index cb245b99..95946163 100644 --- a/http_server/handle/account_records.go +++ b/http_server/handle/account_records.go @@ -2,8 +2,10 @@ package handle import ( "das_register_server/http_server/api_code" + "das_register_server/tables" "encoding/json" "fmt" + "github.com/dotbitHQ/das-lib/common" "github.com/gin-gonic/gin" "github.com/scorpiotzh/toolib" "net/http" @@ -69,9 +71,24 @@ func (h *HttpHandle) AccountRecords(ctx *gin.Context) { func (h *HttpHandle) doAccountRecords(req *ReqAccountRecords, apiResp *api_code.ApiResp) error { var resp RespAccountRecords - resp.Records = make([]RespAccountRecordsData, 0) - list, err := h.dbDao.SearchRecordsByAccount(req.Account) + + // account + accountId := common.Bytes2Hex(common.GetAccountIdByAccount(req.Account)) + acc, err := h.dbDao.GetAccountInfoByAccountId(accountId) + if err != nil { + apiResp.ApiRespErr(api_code.ApiCodeDbError, "search account err") + return fmt.Errorf("SearchAccount err: %s", err.Error()) + } + if acc.Id == 0 { + apiResp.ApiRespOK(resp) + return nil + } else if acc.Status == tables.AccountStatusOnCross { + apiResp.ApiRespOK(resp) + return nil + } + + list, err := h.dbDao.SearchRecordsByAccount(accountId) if err != nil { apiResp.ApiRespErr(api_code.ApiCodeDbError, "search records err") return fmt.Errorf("SearchRecordsByAccount err: %s", err.Error()) diff --git a/http_server/handle/reverse_latest.go b/http_server/handle/reverse_latest.go index 5016d241..ca04a7b9 100644 --- a/http_server/handle/reverse_latest.go +++ b/http_server/handle/reverse_latest.go @@ -2,6 +2,7 @@ package handle import ( "das_register_server/http_server/api_code" + "das_register_server/tables" "encoding/json" "fmt" "github.com/dotbitHQ/das-lib/common" @@ -93,7 +94,6 @@ func (h *HttpHandle) doReverseLatest(req *ReqReverseLatest, apiResp *api_code.Ap } // account - accountId := common.Bytes2Hex(common.GetAccountIdByAccount(reverse.Account)) acc, err := h.dbDao.GetAccountInfoByAccountId(accountId) if err != nil { @@ -105,6 +105,9 @@ func (h *HttpHandle) doReverseLatest(req *ReqReverseLatest, apiResp *api_code.Ap if acc.Id == 0 { apiResp.ApiRespOK(resp) return nil + } else if acc.Status == tables.AccountStatusOnCross { + apiResp.ApiRespOK(resp) + return nil } else { if strings.EqualFold(req.Address, acc.Owner) { resp.IsValid = true @@ -119,7 +122,6 @@ func (h *HttpHandle) doReverseLatest(req *ReqReverseLatest, apiResp *api_code.Ap } // records - record, err := h.dbDao.SearchAccountReverseRecords(acc.Account, req.Address) if err != nil { if err != gorm.ErrRecordNotFound { diff --git a/http_server/handle/reverse_list.go b/http_server/handle/reverse_list.go index f387a4ce..6ee95d4d 100644 --- a/http_server/handle/reverse_list.go +++ b/http_server/handle/reverse_list.go @@ -2,6 +2,7 @@ package handle import ( "das_register_server/http_server/api_code" + "das_register_server/tables" "encoding/json" "fmt" "github.com/dotbitHQ/das-lib/common" @@ -90,6 +91,16 @@ func (h *HttpHandle) doReverseList(req *ReqReverseList, apiResp *api_code.ApiRes return fmt.Errorf("SearchLatestReverse err: %s", err.Error()) } for _, v := range list { + // account + acc, err := h.dbDao.GetAccountInfoByAccountId(v.AccountId) + if err != nil { + apiResp.ApiRespErr(api_code.ApiCodeDbError, "search account err") + return fmt.Errorf("SearchAccount err: %s", err.Error()) + } + if acc.Id == 0 || acc.Status == tables.AccountStatusOnCross { + continue + } + hash, index := common.String2OutPoint(v.Outpoint) resp.List = append(resp.List, ReverseListData{ Account: v.Account, From cdbb5f261f136885ff938f4d0e53176a8efa9f04 Mon Sep 17 00:00:00 2001 From: scorpiotzh <835598264@qq.com> Date: Mon, 11 Jul 2022 15:33:36 +0800 Subject: [PATCH 12/15] feat: account detail add custom script info --- cmd/main.go | 3 ++- example/renew_test.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- http_server/handle/account_detail.go | 17 +++++++++++++++++ 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index b23bfb92..42be3d33 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -213,7 +213,8 @@ func initDasCore() (*core.DasCore, *dascache.DasCache, error) { env := core.InitEnvOpt(config.Cfg.Server.Net, common.DasContractNameConfigCellType, common.DasContractNameAccountCellType, common.DasContractNameBalanceCellType, common.DasContractNameDispatchCellType, common.DasContractNameApplyRegisterCellType, common.DasContractNamePreAccountCellType, common.DasContractNameProposalCellType, common.DasContractNameReverseRecordCellType, - common.DasContractNameIncomeCellType, common.DasContractNameAlwaysSuccess, common.DASContractNameEip712LibCellType) + common.DasContractNameIncomeCellType, common.DasContractNameAlwaysSuccess, common.DASContractNameEip712LibCellType, + common.DASContractNameSubAccountCellType) ops := []core.DasCoreOption{ core.WithClient(ckbClient), core.WithDasContractArgs(env.ContractArgs), diff --git a/example/renew_test.go b/example/renew_test.go index ec5fc57e..2d6f6353 100644 --- a/example/renew_test.go +++ b/example/renew_test.go @@ -14,7 +14,7 @@ func TestRenew(t *testing.T) { //fmt.Println(list,len(list)) for _, v := range list { - a := fmt.Sprintf(`curl -X POST http://127.0.0.1:8119/v1/account/renew -d'{"chain_type":1,"address":"0x15a33588908cf8edb27d1abe3852bf287abd3891","account":"%s","renew_years":2}'`, strings.TrimSpace(v)) + a := fmt.Sprintf(`curl -X POST http://127.0.0.1:8119/v1/account/renew -d'{"chain_type":1,"address":"0x15a33588908cf8edb27d1abe3852bf287abd3891","account":"%s","renew_years":1}'`, strings.TrimSpace(v)) fmt.Println(a) } diff --git a/go.mod b/go.mod index 7416e458..09943d05 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module das_register_server go 1.15 require ( - github.com/dotbitHQ/das-lib v0.0.0-20220704113819-e31ee2e97389 + github.com/dotbitHQ/das-lib v0.0.0-20220708070324-3331fbcb8f06 github.com/elazarl/goproxy v0.0.0-20220417044921-416226498f94 // indirect github.com/ethereum/go-ethereum v1.10.17 github.com/fsnotify/fsnotify v1.5.3 diff --git a/go.sum b/go.sum index 11079aef..fd94e1b9 100644 --- a/go.sum +++ b/go.sum @@ -106,8 +106,8 @@ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5O github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= -github.com/dotbitHQ/das-lib v0.0.0-20220704113819-e31ee2e97389 h1:wcDHr50iXtAXWmxWqvxgbuwvzArnl6dSc9XA3QvK9qg= -github.com/dotbitHQ/das-lib v0.0.0-20220704113819-e31ee2e97389/go.mod h1:cjxR/SvT6w9U2fvNpADeyB31ukYLSrfffC67puHOZ/c= +github.com/dotbitHQ/das-lib v0.0.0-20220708070324-3331fbcb8f06 h1:UkuYVM5AErGyfP6f6ZgWCMj1RE1hEpMGU6Qt9EFKFtk= +github.com/dotbitHQ/das-lib v0.0.0-20220708070324-3331fbcb8f06/go.mod h1:cjxR/SvT6w9U2fvNpADeyB31ukYLSrfffC67puHOZ/c= github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/elazarl/goproxy v0.0.0-20220417044921-416226498f94 h1:VIy7cdK7ufs7ctpTFkXJHm1uP3dJSnCGSPysEICB1so= diff --git a/http_server/handle/account_detail.go b/http_server/handle/account_detail.go index ef2c3d06..979a1a3e 100644 --- a/http_server/handle/account_detail.go +++ b/http_server/handle/account_detail.go @@ -9,6 +9,7 @@ import ( "fmt" "github.com/dotbitHQ/das-lib/common" "github.com/dotbitHQ/das-lib/core" + "github.com/dotbitHQ/das-lib/witness" "github.com/gin-gonic/gin" "github.com/minio/blake2b-simd" "github.com/scorpiotzh/toolib" @@ -37,6 +38,7 @@ type RespAccountDetail struct { EnableSubAccount tables.EnableSubAccount `json:"enable_sub_account"` RenewSubAccountPrice uint64 `json:"renew_sub_account_price"` Nonce uint64 `json:"nonce"` + CustomScript string `json:"custom_script"` } func (h *HttpHandle) RpcAccountDetail(p json.RawMessage, apiResp *api_code.ApiResp) { @@ -192,6 +194,21 @@ func (h *HttpHandle) doAccountDetail(req *ReqAccountDetail, apiResp *api_code.Ap resp.EnableSubAccount = acc.EnableSubAccount resp.RenewSubAccountPrice = acc.RenewSubAccountPrice resp.Nonce = acc.Nonce + + // check custom-script + if acc.EnableSubAccount == tables.AccountEnableStatusOn { + subAccLiveCell, err := h.dasCore.GetSubAccountCell(acc.AccountId) + if err != nil { + apiResp.ApiRespErr(api_code.ApiCodeError500, err.Error()) + return nil + } + detailSub := witness.ConvertSubAccountCellOutputData(subAccLiveCell.OutputData) + defaultCS := make([]byte, 33) + if len(detailSub.CustomScriptArgs) > 0 && bytes.Compare(defaultCS, detailSub.CustomScriptArgs) != 0 { + resp.CustomScript = common.Bytes2Hex(detailSub.CustomScriptArgs) + } + } + apiResp.ApiRespOK(resp) return nil } From 3d7532e6bae1986d0cad3af7cd664f18be8956ee Mon Sep 17 00:00:00 2001 From: slagga <957766762@qq.com> Date: Tue, 12 Jul 2022 16:55:42 +0800 Subject: [PATCH 13/15] fix: add cross_refund action --- tables/t_transaction_info.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tables/t_transaction_info.go b/tables/t_transaction_info.go index bd4630bc..6f5fc552 100644 --- a/tables/t_transaction_info.go +++ b/tables/t_transaction_info.go @@ -66,6 +66,7 @@ const ( ActionBalanceDeposit TxAction = 25 ActionRecycleExpiredAccount TxAction = 26 ActionForceRecoverAccountStatus TxAction = 27 + ActionCrossRefund TxAction = 28 DasActionTransferBalance = "transfer_balance" DasActionBalanceDeposit = "balance_deposit" @@ -75,6 +76,7 @@ const ( DasActionEditOfferAdd = "offer_edit_add" DasActionEditOfferSub = "offer_edit_sub" DasActionOrderRefund = "order_refund" + DasActionCrossRefund = "cross_refund" ) func FormatTxAction(action string) TxAction { @@ -135,6 +137,8 @@ func FormatTxAction(action string) TxAction { return ActionRecycleExpiredAccount case common.DasActionForceRecoverAccountStatus: return ActionForceRecoverAccountStatus + case DasActionCrossRefund: + return ActionCrossRefund } return ActionUndefined } @@ -191,6 +195,8 @@ func FormatActionType(actionType TxAction) string { return common.DasActionRecycleExpiredAccount case ActionForceRecoverAccountStatus: return common.DasActionForceRecoverAccountStatus + case ActionCrossRefund: + return DasActionCrossRefund } return "" } From fb9fdceb814660702f45561210753f8ce214b236 Mon Sep 17 00:00:00 2001 From: scorpiotzh <835598264@qq.com> Date: Wed, 13 Jul 2022 15:24:31 +0800 Subject: [PATCH 14/15] feat: add char set witness by used --- go.mod | 2 +- go.sum | 4 ++-- txtool/pre_register.go | 20 +++++++++++++++++--- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 09943d05..dd400b53 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module das_register_server go 1.15 require ( - github.com/dotbitHQ/das-lib v0.0.0-20220708070324-3331fbcb8f06 + github.com/dotbitHQ/das-lib v0.0.0-20220713060612-eee6ca713df5 github.com/elazarl/goproxy v0.0.0-20220417044921-416226498f94 // indirect github.com/ethereum/go-ethereum v1.10.17 github.com/fsnotify/fsnotify v1.5.3 diff --git a/go.sum b/go.sum index fd94e1b9..19859fcf 100644 --- a/go.sum +++ b/go.sum @@ -106,8 +106,8 @@ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5O github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= -github.com/dotbitHQ/das-lib v0.0.0-20220708070324-3331fbcb8f06 h1:UkuYVM5AErGyfP6f6ZgWCMj1RE1hEpMGU6Qt9EFKFtk= -github.com/dotbitHQ/das-lib v0.0.0-20220708070324-3331fbcb8f06/go.mod h1:cjxR/SvT6w9U2fvNpADeyB31ukYLSrfffC67puHOZ/c= +github.com/dotbitHQ/das-lib v0.0.0-20220713060612-eee6ca713df5 h1:uKaoBkjb+aU3NpnraY6pGVizkpJJy9ItDu3fY45vIa8= +github.com/dotbitHQ/das-lib v0.0.0-20220713060612-eee6ca713df5/go.mod h1:cjxR/SvT6w9U2fvNpADeyB31ukYLSrfffC67puHOZ/c= github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/elazarl/goproxy v0.0.0-20220417044921-416226498f94 h1:VIy7cdK7ufs7ctpTFkXJHm1uP3dJSnCGSPysEICB1so= diff --git a/txtool/pre_register.go b/txtool/pre_register.go index 7087d8c8..c0611c3d 100644 --- a/txtool/pre_register.go +++ b/txtool/pre_register.go @@ -248,6 +248,10 @@ func (t *TxTool) buildOrderPreRegisterTx(p *preRegisterTxParams) (*txbuilder.Bui accountId := common.GetAccountIdByAccount(p.order.Account) accountChars := tables.AccountCharSetListToMoleculeAccountChars(p.accountChars) + // char type + var accountCharTypeMap = make(map[common.AccountCharType]struct{}) + common.GetAccountCharType(accountCharTypeMap, p.accountChars) + // witness var preBuilder witness.PreAccountCellDataBuilder preWitness, preData, err := preBuilder.GenWitness(&witness.PreAccountCellParam{ @@ -385,13 +389,23 @@ func (t *TxTool) buildOrderPreRegisterTx(p *preRegisterTxParams) (*txbuilder.Bui priceConfig.ToCellDep(), applyConfig.ToCellDep(), accountConfig.ToCellDep(), - emojiConfig.ToCellDep(), - digitConfig.ToCellDep(), - enConfig.ToCellDep(), + //emojiConfig.ToCellDep(), + //digitConfig.ToCellDep(), + //enConfig.ToCellDep(), releaseConfig.ToCellDep(), unavailableConfig.ToCellDep(), PreservedAccountConfig.ToCellDep(), ) + for k, _ := range accountCharTypeMap { + switch k { + case common.AccountCharTypeEmoji: + txParams.CellDeps = append(txParams.CellDeps, emojiConfig.ToCellDep()) + case common.AccountCharTypeNumber: + txParams.CellDeps = append(txParams.CellDeps, digitConfig.ToCellDep()) + case common.AccountCharTypeEn: + txParams.CellDeps = append(txParams.CellDeps, enConfig.ToCellDep()) + } + } return &txParams, nil } From 3db43a8b70e3d4c54460d5af9d67a731a5a67f1c Mon Sep 17 00:00:00 2001 From: slagga <957766762@qq.com> Date: Mon, 18 Jul 2022 10:38:26 +0800 Subject: [PATCH 15/15] fix: update to go1.16 --- go.mod | 4 ++-- go.sum | 10 ++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index dd400b53..9f5c6eb9 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,9 @@ module das_register_server -go 1.15 +go 1.16 require ( - github.com/dotbitHQ/das-lib v0.0.0-20220713060612-eee6ca713df5 + github.com/dotbitHQ/das-lib v0.0.0-20220718022750-cfcd2c5b88b7 github.com/elazarl/goproxy v0.0.0-20220417044921-416226498f94 // indirect github.com/ethereum/go-ethereum v1.10.17 github.com/fsnotify/fsnotify v1.5.3 diff --git a/go.sum b/go.sum index 19859fcf..722afdbc 100644 --- a/go.sum +++ b/go.sum @@ -37,7 +37,6 @@ github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNu github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= @@ -106,13 +105,12 @@ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5O github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= -github.com/dotbitHQ/das-lib v0.0.0-20220713060612-eee6ca713df5 h1:uKaoBkjb+aU3NpnraY6pGVizkpJJy9ItDu3fY45vIa8= -github.com/dotbitHQ/das-lib v0.0.0-20220713060612-eee6ca713df5/go.mod h1:cjxR/SvT6w9U2fvNpADeyB31ukYLSrfffC67puHOZ/c= +github.com/dotbitHQ/das-lib v0.0.0-20220718022750-cfcd2c5b88b7 h1:f+c3ZCGxUnrdkvemla/ZNdMDWtMhJaFUKVSPP43J+ck= +github.com/dotbitHQ/das-lib v0.0.0-20220718022750-cfcd2c5b88b7/go.mod h1:cjxR/SvT6w9U2fvNpADeyB31ukYLSrfffC67puHOZ/c= github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/elazarl/goproxy v0.0.0-20220417044921-416226498f94 h1:VIy7cdK7ufs7ctpTFkXJHm1uP3dJSnCGSPysEICB1so= github.com/elazarl/goproxy v0.0.0-20220417044921-416226498f94/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= -github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 h1:dWB6v3RcOy03t/bUadywsbyrQwCqZeNIEX6M1OtSZOM= github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= @@ -141,10 +139,8 @@ github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1T github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= @@ -287,7 +283,6 @@ github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM52 github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= @@ -520,7 +515,6 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=