Skip to content

Commit

Permalink
feat: fix less acc witness
Browse files Browse the repository at this point in the history
  • Loading branch information
scorpiotzh committed Jun 7, 2022
1 parent 46eb56f commit 6696c0b
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 10 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module das_sub_account
go 1.15

require (
github.com/DeAccountSystems/das-lib v0.0.0-20220531040850-ea68b195348f
github.com/DeAccountSystems/das-lib v0.0.0-20220607033455-1b6e6e92f767
github.com/elazarl/goproxy v0.0.0-20220115173737-adb46da277ac // indirect
github.com/fsnotify/fsnotify v1.4.9
github.com/gin-gonic/gin v1.7.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/DeAccountSystems/das-lib v0.0.0-20220531040850-ea68b195348f h1:oXB2ZKFGInqU7e4AhFOrkHuMEG47vTH6l8uiBQ4BHzk=
github.com/DeAccountSystems/das-lib v0.0.0-20220531040850-ea68b195348f/go.mod h1:ige8f+izCtnfXlKpc4iLR4CJHoaqYIoypL531X/KJp0=
github.com/DeAccountSystems/das-lib v0.0.0-20220607033455-1b6e6e92f767 h1:kvLl8SOlreDvs9zUnocjjQgiY6YoFD1HDO+o9pH5waU=
github.com/DeAccountSystems/das-lib v0.0.0-20220607033455-1b6e6e92f767/go.mod h1:ige8f+izCtnfXlKpc4iLR4CJHoaqYIoypL531X/KJp0=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8=
Expand Down
26 changes: 22 additions & 4 deletions txtool/edit_sub_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,42 @@ func (s *SubAccountTxTool) BuildEditSubAccountTx(p *ParamBuildEditSubAccountTx)
txParams.Witnesses = append(txParams.Witnesses, v) // smt witness
}

// account cell witness
accTx, err := s.DasCore.Client().GetTransaction(s.Ctx, p.AccountOutPoint.TxHash)
if err != nil {
return nil, fmt.Errorf("GetTransaction acc tx err: %s", err.Error())
}
accBuilderMap, err := witness.AccountIdCellDataBuilderFromTx(accTx.Transaction, common.DataTypeNew)
if err != nil {
return nil, fmt.Errorf("AccountIdCellDataBuilderFromTx err: %s", err.Error())
}
accBuilder, ok := accBuilderMap[p.Account.AccountId]
if !ok {
return nil, fmt.Errorf("accBuilderMap is nil: %s", p.Account.AccountId)
}
accWitness, _, _ := accBuilder.GenWitness(&witness.AccountCellParam{
OldIndex: 0,
Action: common.DasActionEditSubAccount,
})
txParams.Witnesses = append(txParams.Witnesses, accWitness)
// so
soEd25519, _ := core.GetDasSoScript(common.SoScriptTypeEd25519)
soEth, _ := core.GetDasSoScript(common.SoScriptTypeEth)
soTron, _ := core.GetDasSoScript(common.SoScriptTypeTron)

// cell deps
txParams.CellDeps = append(txParams.CellDeps,
&types.CellDep{
OutPoint: p.AccountOutPoint,
DepType: types.DepTypeCode,
},
p.BaseInfo.ConfigCellAcc.ToCellDep(),
p.BaseInfo.ContractDas.ToCellDep(),
p.BaseInfo.ContractSubAcc.ToCellDep(),
p.BaseInfo.HeightCell.ToCellDep(),
p.BaseInfo.TimeCell.ToCellDep(),
p.BaseInfo.ConfigCellSubAcc.ToCellDep(),
p.BaseInfo.ConfigCellRecordNamespace.ToCellDep(),
&types.CellDep{
OutPoint: p.AccountOutPoint,
DepType: types.DepTypeCode,
},
soEd25519.ToCellDep(),
soEth.ToCellDep(),
soTron.ToCellDep(),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# github.com/Andrew-M-C/go.emoji v0.0.0-20211011074904-61cf526972e1
github.com/Andrew-M-C/go.emoji/official
# github.com/DeAccountSystems/das-lib v0.0.0-20220531040850-ea68b195348f
# github.com/DeAccountSystems/das-lib v0.0.0-20220607033455-1b6e6e92f767
## explicit
github.com/DeAccountSystems/das-lib/common
github.com/DeAccountSystems/das-lib/core
Expand Down

0 comments on commit 6696c0b

Please sign in to comment.