From 614a1294d2c95e93de238b8575f3a8501840cb2d Mon Sep 17 00:00:00 2001 From: Alexander Sporn Date: Fri, 8 Mar 2024 11:56:44 +0100 Subject: [PATCH] Updated to latest iota.go --- go.mod | 28 +++++----- go.sum | 56 ++++++++++---------- pkg/evilwallet/evilwallet.go | 38 +++++++------- pkg/evilwallet/faucetfunds.go | 2 +- pkg/models/connector.go | 15 ++++-- pkg/models/output.go | 1 - pkg/spammer/spammer.go | 2 +- pkg/utils/await.go | 56 ++++++++++---------- pkg/utils/utils.go | 69 ------------------------- pkg/walletmanager/accountcreation.go | 4 +- pkg/walletmanager/accountdestruction.go | 8 +-- pkg/walletmanager/accountupdate.go | 4 +- pkg/walletmanager/claim.go | 4 +- pkg/walletmanager/delegation.go | 19 +++---- tools/gendoc/go.mod | 28 +++++----- tools/gendoc/go.sum | 56 ++++++++++---------- 16 files changed, 165 insertions(+), 225 deletions(-) diff --git a/go.mod b/go.mod index 9e2a40b..9215d8b 100644 --- a/go.mod +++ b/go.mod @@ -6,19 +6,19 @@ toolchain go1.22.0 require ( github.com/iotaledger/hive.go/app v0.0.0-20240216135101-261e99d9d84a - github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240216135101-261e99d9d84a - github.com/iotaledger/hive.go/crypto v0.0.0-20240216135101-261e99d9d84a - github.com/iotaledger/hive.go/ds v0.0.0-20240216135101-261e99d9d84a - github.com/iotaledger/hive.go/ierrors v0.0.0-20240216135101-261e99d9d84a - github.com/iotaledger/hive.go/lo v0.0.0-20240216135101-261e99d9d84a - github.com/iotaledger/hive.go/log v0.0.0-20240216135101-261e99d9d84a - github.com/iotaledger/hive.go/runtime v0.0.0-20240216135101-261e99d9d84a + github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240305162344-4b8be588e1cf + github.com/iotaledger/hive.go/crypto v0.0.0-20240305162344-4b8be588e1cf + github.com/iotaledger/hive.go/ds v0.0.0-20240305162344-4b8be588e1cf + github.com/iotaledger/hive.go/ierrors v0.0.0-20240305162344-4b8be588e1cf + github.com/iotaledger/hive.go/lo v0.0.0-20240305162344-4b8be588e1cf + github.com/iotaledger/hive.go/log v0.0.0-20240223134921-02b9a2022431 + github.com/iotaledger/hive.go/runtime v0.0.0-20240305162344-4b8be588e1cf github.com/iotaledger/iota-crypto-demo v0.0.0-20240216103559-27ca8dffd1e7 - github.com/iotaledger/iota.go/v4 v4.0.0-20240216140514-c867d6524642 + github.com/iotaledger/iota.go/v4 v4.0.0-20240307175623-0904c71fcb38 github.com/mr-tron/base58 v1.2.0 go.uber.org/atomic v1.11.0 go.uber.org/dig v1.17.1 - golang.org/x/crypto v0.19.0 + golang.org/x/crypto v0.21.0 ) require ( @@ -26,7 +26,7 @@ require ( github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/eclipse/paho.mqtt.golang v1.4.3 // indirect - github.com/ethereum/go-ethereum v1.13.12 // indirect + github.com/ethereum/go-ethereum v1.13.14 // indirect github.com/fatih/structs v1.1.0 // indirect github.com/felixge/fgprof v0.9.3 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect @@ -37,9 +37,9 @@ require ( github.com/hashicorp/go-version v1.6.0 // indirect github.com/holiman/uint256 v1.2.4 // indirect github.com/iancoleman/orderedmap v0.3.0 // indirect - github.com/iotaledger/hive.go/constraints v0.0.0-20240216135101-261e99d9d84a // indirect - github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240216135101-261e99d9d84a // indirect - github.com/iotaledger/hive.go/stringify v0.0.0-20240216135101-261e99d9d84a // indirect + github.com/iotaledger/hive.go/constraints v0.0.0-20240305162344-4b8be588e1cf // indirect + github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240305162344-4b8be588e1cf // indirect + github.com/iotaledger/hive.go/stringify v0.0.0-20240305162344-4b8be588e1cf // indirect github.com/knadh/koanf v1.5.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect @@ -55,7 +55,7 @@ require ( github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e // indirect golang.org/x/net v0.21.0 // indirect golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index abff72d..05ef9f3 100644 --- a/go.sum +++ b/go.sum @@ -57,8 +57,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ethereum/go-ethereum v1.13.12 h1:iDr9UM2JWkngBHGovRJEQn4Kor7mT4gt9rUZqB5M29Y= -github.com/ethereum/go-ethereum v1.13.12/go.mod h1:hKL2Qcj1OvStXNSEDbucexqnEt1Wh4Cz329XsjAalZY= +github.com/ethereum/go-ethereum v1.13.14 h1:EwiY3FZP94derMCIam1iW4HFVrSgIcpsu0HwTQtm6CQ= +github.com/ethereum/go-ethereum v1.13.14/go.mod h1:TN8ZiHrdJwSe8Cb6x+p0hs5CxhJZPbqB7hHkaUXcmIU= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= @@ -175,30 +175,30 @@ github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJ github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/iotaledger/hive.go/app v0.0.0-20240216135101-261e99d9d84a h1:o5viyYlzi6kgClLNgUW5Pay0tXMylc0FPivYgSlAc4g= github.com/iotaledger/hive.go/app v0.0.0-20240216135101-261e99d9d84a/go.mod h1:O9agBfrnt1ykrDOzF6GXZf4ivcw+SxM9c9C86YtbxLU= -github.com/iotaledger/hive.go/constraints v0.0.0-20240216135101-261e99d9d84a h1:9xeffzciYdw9L/ebAOPg/39Bqn3p5iyOROQhQHaAEUs= -github.com/iotaledger/hive.go/constraints v0.0.0-20240216135101-261e99d9d84a/go.mod h1:JF7jjkL6tSUOXm23SWadBzBrl7eJk1DQRLc/fNoVZ+o= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240216135101-261e99d9d84a h1:+l3NjL4v700Iv+ZF7KjPALkygFOxzkByoRIoSK9bOzc= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240216135101-261e99d9d84a/go.mod h1:9HM/YmzOfdlWXYHVEWVjYhKQHOlgxBVMsr5Vf5yn5IE= -github.com/iotaledger/hive.go/crypto v0.0.0-20240216135101-261e99d9d84a h1:ux81+J6mcxYw6usZpEPLZjE6J+TNs3RaRcTHa9+5ERM= -github.com/iotaledger/hive.go/crypto v0.0.0-20240216135101-261e99d9d84a/go.mod h1:7kZh98nwJInQsIybiPXSABc/on/IsDdXyeiPLfaH+2I= -github.com/iotaledger/hive.go/ds v0.0.0-20240216135101-261e99d9d84a h1:7M1+k0H53jahg2ZDN10SociepCB+jymIZoiYaSenpbQ= -github.com/iotaledger/hive.go/ds v0.0.0-20240216135101-261e99d9d84a/go.mod h1:sE/HabIH9FWTvgaHioLN6o4rrxFMf4BuqRQwloxcamo= -github.com/iotaledger/hive.go/ierrors v0.0.0-20240216135101-261e99d9d84a h1:ugcQ43xbMZo5XYTfanIHOxQGKNpxhcatcz9ZXcX6W1o= -github.com/iotaledger/hive.go/ierrors v0.0.0-20240216135101-261e99d9d84a/go.mod h1:GQY0/35sjgT9Poi1Vrs9kFVvAkuKzGXfVh4j6CBXsAA= -github.com/iotaledger/hive.go/lo v0.0.0-20240216135101-261e99d9d84a h1:eUAtyEIYRlAPeZ2qhlEA+7T8DVoYK2h9eotlst/84SU= -github.com/iotaledger/hive.go/lo v0.0.0-20240216135101-261e99d9d84a/go.mod h1:0ycE1W59kkNjQ87odL6H4x5Ik9bXhbNk88wmo+mIYt0= -github.com/iotaledger/hive.go/log v0.0.0-20240216135101-261e99d9d84a h1:XzIuUsWPtDP7h9UbQPFW5/bjeqVjodcSCMRuF7zP5jk= -github.com/iotaledger/hive.go/log v0.0.0-20240216135101-261e99d9d84a/go.mod h1:JCv/LVVTAMoCPLzou534RoIif7CAezcWZlGYabrHsck= -github.com/iotaledger/hive.go/runtime v0.0.0-20240216135101-261e99d9d84a h1:qmfoYLK2XyPOXfldG21qHyCrbIf0sl7iJoFirvTrnO0= -github.com/iotaledger/hive.go/runtime v0.0.0-20240216135101-261e99d9d84a/go.mod h1:lAR3vbqE9g65M9VwWHiaXab2q+d89dBOFjhKgnDfK7c= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240216135101-261e99d9d84a h1:ahUFo0X9Th+8/aE6KSWiy7Eap5p0YFL6CDapP1o8dLo= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240216135101-261e99d9d84a/go.mod h1:yXQNGZUz++dB1T9RAHhWSresuTLzTC856ntdins9ivo= -github.com/iotaledger/hive.go/stringify v0.0.0-20240216135101-261e99d9d84a h1:xLreq/rXeSPdb86RnZNEPH3PUIWt56BQxK1+11+hM4I= -github.com/iotaledger/hive.go/stringify v0.0.0-20240216135101-261e99d9d84a/go.mod h1:O4p7UmsfoeLqtAUwrKbq0lXMxjY/MLQSpZSavvvvGig= +github.com/iotaledger/hive.go/constraints v0.0.0-20240305162344-4b8be588e1cf h1:SHtB0Nf1MdOAk+adIQfQGWZ++EcvrfFE4kCTMbZ7Qys= +github.com/iotaledger/hive.go/constraints v0.0.0-20240305162344-4b8be588e1cf/go.mod h1:JF7jjkL6tSUOXm23SWadBzBrl7eJk1DQRLc/fNoVZ+o= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240305162344-4b8be588e1cf h1:CxqQWH3cHX+jUx94zDeeCIe93gmygem1Y5jMrcAWJA4= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240305162344-4b8be588e1cf/go.mod h1:73ODTHUJxAoGUN0InOtuQ29LVq85pDf7GckM9d0ziqo= +github.com/iotaledger/hive.go/crypto v0.0.0-20240305162344-4b8be588e1cf h1:msheCEl+Q1y8LQjfP9VOf6t38LeCOndhHkuw3AgMfK8= +github.com/iotaledger/hive.go/crypto v0.0.0-20240305162344-4b8be588e1cf/go.mod h1:aREIB19gIhSYdY0Hl/37sg1JRH7+j3ajeJxBIQf6mig= +github.com/iotaledger/hive.go/ds v0.0.0-20240305162344-4b8be588e1cf h1:TyGz03gRMdFECQVc0gExs9W1k4lB10MPeRQohNilnmk= +github.com/iotaledger/hive.go/ds v0.0.0-20240305162344-4b8be588e1cf/go.mod h1:wfjeJj9B+MM/3yeUHfvT8Gj8bRsdl9utyh2dZg+1+B0= +github.com/iotaledger/hive.go/ierrors v0.0.0-20240305162344-4b8be588e1cf h1:aBMpx2sHnG7Esai4S7b47aUERBTV+JgoSjJKT1U4LxE= +github.com/iotaledger/hive.go/ierrors v0.0.0-20240305162344-4b8be588e1cf/go.mod h1:GQY0/35sjgT9Poi1Vrs9kFVvAkuKzGXfVh4j6CBXsAA= +github.com/iotaledger/hive.go/lo v0.0.0-20240305162344-4b8be588e1cf h1:ADrQgsSpsoMSfIlSsMHo66ush8y0z8AaFn0Nae5dztY= +github.com/iotaledger/hive.go/lo v0.0.0-20240305162344-4b8be588e1cf/go.mod h1:67oLzWYiBLGt5PN7IBVHdbt9P6oBYCx9UvMEL8ExDAc= +github.com/iotaledger/hive.go/log v0.0.0-20240223134921-02b9a2022431 h1:CxoorcruX5zlz+I3iwPxdfs1D3DJt/NQ60Kb0+YvEKs= +github.com/iotaledger/hive.go/log v0.0.0-20240223134921-02b9a2022431/go.mod h1:H5tmswUbT3o5+QiM6UPtBv7VnPf+lJtlantgpp2lzUI= +github.com/iotaledger/hive.go/runtime v0.0.0-20240305162344-4b8be588e1cf h1:gELL3pOfJADq6kLC6HkbEtFwAiVOm1cPuVy92noqjPk= +github.com/iotaledger/hive.go/runtime v0.0.0-20240305162344-4b8be588e1cf/go.mod h1:pueoYXud+HmTY2x9j/S6+ZX3M5ZyENFKPDrx3EtcwWs= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240305162344-4b8be588e1cf h1:PAwjwceOCwCclmvCzbSJb0A7EolaDJsjWqw0ixRys0M= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240305162344-4b8be588e1cf/go.mod h1:NK05G4PxwZF1m4jGANJWLhAQ2hP1Nt0L8mgCTFLsSCw= +github.com/iotaledger/hive.go/stringify v0.0.0-20240305162344-4b8be588e1cf h1:gLQTQtZZTwZBFZdx0tuM7WHpWtF1liC3c6FflZiNGXc= +github.com/iotaledger/hive.go/stringify v0.0.0-20240305162344-4b8be588e1cf/go.mod h1:O4p7UmsfoeLqtAUwrKbq0lXMxjY/MLQSpZSavvvvGig= github.com/iotaledger/iota-crypto-demo v0.0.0-20240216103559-27ca8dffd1e7 h1:t6k4MqiUov0FrBb2o2JhKlOVSdlPbIQWM8ivYHL0G0g= github.com/iotaledger/iota-crypto-demo v0.0.0-20240216103559-27ca8dffd1e7/go.mod h1:do+N3LpeDEi9qselEC4XcjqGoRc7cWGiqBtIeBOKEMs= -github.com/iotaledger/iota.go/v4 v4.0.0-20240216140514-c867d6524642 h1:s3nISWsyLwNA4+fh19yp1CQip3pHpIgsbYIRITpl8aA= -github.com/iotaledger/iota.go/v4 v4.0.0-20240216140514-c867d6524642/go.mod h1:IZNS0qmVdoRjIbFe4VTPG7k3bzSJQBvAHL2eC/2kFT0= +github.com/iotaledger/iota.go/v4 v4.0.0-20240307175623-0904c71fcb38 h1:NizJ3CALLCcJowtAtkNuDlpE4gd4qjaWZkp/kTZfeYk= +github.com/iotaledger/iota.go/v4 v4.0.0-20240307175623-0904c71fcb38/go.mod h1:8UQOTI7CC5R/3TurawUFuBZbkb37RzW8m4q8Hp7ct30= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= @@ -348,8 +348,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE= golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= @@ -425,8 +425,8 @@ golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= diff --git a/pkg/evilwallet/evilwallet.go b/pkg/evilwallet/evilwallet.go index b80970f..0b91b08 100644 --- a/pkg/evilwallet/evilwallet.go +++ b/pkg/evilwallet/evilwallet.go @@ -140,7 +140,7 @@ func (e *EvilWallet) PrepareAndPostBlockWithPayload(ctx context.Context, clt mod return blockID, nil } -func (e *EvilWallet) PrepareAndPostBlockWithTxBuildData(ctx context.Context, clt models.Client, txBuilder *builder.TransactionBuilder, signingKeys []iotago.AddressKeys, issuer wallet.Account) (iotago.BlockID, *iotago.Transaction, error) { +func (e *EvilWallet) PrepareAndPostBlockWithTxBuildData(ctx context.Context, clt models.Client, txBuilder *builder.TransactionBuilder, issuer wallet.Account) (iotago.BlockID, *iotago.Transaction, error) { congestionResp, issuerResp, version, err := e.accManager.RequestBlockIssuanceData(ctx, clt, issuer) if err != nil { return iotago.EmptyBlockID, nil, ierrors.Wrap(err, "failed to get block built data") @@ -148,7 +148,7 @@ func (e *EvilWallet) PrepareAndPostBlockWithTxBuildData(ctx context.Context, clt // handle allotment strategy txBuilder.AllotAllMana(txBuilder.CreationSlot(), issuer.ID(), 0) - signedTx, err := txBuilder.Build(iotago.NewInMemoryAddressSigner(signingKeys...)) + signedTx, err := txBuilder.Build() if err != nil { return iotago.EmptyBlockID, nil, ierrors.Wrap(err, "failed to build and sign transaction") } @@ -255,11 +255,9 @@ func (e *EvilWallet) CreateTransaction(ctx context.Context, options ...Option) ( addrAliasMap[tempID] = alias } } - txBuilder, signingKeys := e.prepareTransactionBuild(inputs, outputs, buildOptions.inputWallet) issuanceData := &models.PayloadIssuanceData{ Type: iotago.PayloadSignedTransaction, - TransactionBuilder: txBuilder, - TxSigningKeys: signingKeys, + TransactionBuilder: e.prepareTransactionBuild(inputs, outputs, buildOptions.inputWallet), } addedOutputs := e.addOutputsToOutputManager(outputs, buildOptions.outputWallet, tempWallet, tempAddresses) @@ -524,25 +522,12 @@ func (e *EvilWallet) updateOutputBalances(ctx context.Context, buildOptions *Opt return } -func (e *EvilWallet) prepareTransactionBuild(inputs []*models.OutputData, outputs iotago.Outputs[iotago.Output], w *Wallet) (tx *builder.TransactionBuilder, keys []iotago.AddressKeys) { +func (e *EvilWallet) prepareTransactionBuild(inputs []*models.OutputData, outputs iotago.Outputs[iotago.Output], w *Wallet) *builder.TransactionBuilder { clt := e.Connector().GetClient() currentTime := time.Now() targetSlot := clt.LatestAPI().TimeProvider().SlotFromTime(currentTime) targetAPI := clt.APIForSlot(targetSlot) - txBuilder := builder.NewTransactionBuilder(targetAPI) - - for _, input := range inputs { - txBuilder.AddInput(&builder.TxInput{UnlockTarget: input.Address, InputID: input.OutputID, Input: input.OutputStruct}) - } - - for _, output := range outputs { - txBuilder.AddOutput(output) - } - - randomPayload := tpkg.Rand12ByteArray() - txBuilder.AddTaggedDataPayload(&iotago.TaggedData{Tag: randomPayload[:], Data: randomPayload[:]}) - walletKeys := make([]iotago.AddressKeys, len(inputs)) for i, input := range inputs { addr := input.Address @@ -558,9 +543,22 @@ func (e *EvilWallet) prepareTransactionBuild(inputs []*models.OutputData, output walletKeys[i] = iotago.AddressKeys{Address: addr, Keys: inputPrivateKey} } + txBuilder := builder.NewTransactionBuilder(targetAPI, iotago.NewInMemoryAddressSigner(walletKeys...)) + + for _, input := range inputs { + txBuilder.AddInput(&builder.TxInput{UnlockTarget: input.Address, InputID: input.OutputID, Input: input.OutputStruct}) + } + + for _, output := range outputs { + txBuilder.AddOutput(output) + } + + randomPayload := tpkg.Rand12ByteArray() + txBuilder.AddTaggedDataPayload(&iotago.TaggedData{Tag: randomPayload[:], Data: randomPayload[:]}) + txBuilder.SetCreationSlot(targetSlot) - return txBuilder, walletKeys + return txBuilder } func (e *EvilWallet) PrepareCustomConflictsSpam(ctx context.Context, scenario *EvilScenario) (txsData [][]*models.PayloadIssuanceData, allAliases ScenarioAlias, err error) { diff --git a/pkg/evilwallet/faucetfunds.go b/pkg/evilwallet/faucetfunds.go index 891c03a..5acea28 100644 --- a/pkg/evilwallet/faucetfunds.go +++ b/pkg/evilwallet/faucetfunds.go @@ -122,7 +122,7 @@ func (e *EvilWallet) splitOutput(ctx context.Context, splitOutput *models.Output return iotago.EmptyTransactionID, err } - _, tx, err := e.PrepareAndPostBlockWithTxBuildData(ctx, e.connector.GetClient(), issuanceData.TransactionBuilder, issuanceData.TxSigningKeys, genesisAccount) + _, tx, err := e.PrepareAndPostBlockWithTxBuildData(ctx, e.connector.GetClient(), issuanceData.TransactionBuilder, genesisAccount) if err != nil { return iotago.EmptyTransactionID, err } diff --git a/pkg/models/connector.go b/pkg/models/connector.go index 8449bee..e5b4295 100644 --- a/pkg/models/connector.go +++ b/pkg/models/connector.go @@ -193,6 +193,8 @@ type Client interface { GetOutput(ctx context.Context, outputID iotago.OutputID) iotago.Output // GetTransaction gets the transaction. GetTransaction(ctx context.Context, txID iotago.TransactionID) (resp *iotago.SignedTransaction, err error) + // GetTransactionMetadata gets the transaction metadata. + GetTransactionMetadata(ctx context.Context, txID iotago.TransactionID) (resp *api.TransactionMetadataResponse, err error) // GetBlockIssuance returns the latest commitment and data needed to create a new block. GetBlockIssuance(ctx context.Context) (resp *api.IssuanceBlockHeaderResponse, err error) // GetCongestion returns congestion data such as rmc or issuing readiness. @@ -205,8 +207,8 @@ type Client interface { GetCommittee(ctx context.Context) (*api.CommitteeResponse, error) // GetValidators returns the validators for the current epoch. GetValidators(ctx context.Context) (*api.ValidatorsResponse, bool, error) - // GetStaking returns the staking data of a given accountAddress. - GetStaking(ctx context.Context, accountAddress *iotago.AccountAddress) (resp *api.ValidatorResponse, err error) + // GetValidator returns the validator data of a given accountAddress. + GetValidator(ctx context.Context, accountAddress *iotago.AccountAddress) (resp *api.ValidatorResponse, err error) // GetRewards returns the rewards of a given outputID. GetRewards(ctx context.Context, outputID iotago.OutputID) (resp *api.ManaRewardsResponse, err error) @@ -387,6 +389,11 @@ func (c *WebClient) GetTransaction(ctx context.Context, txID iotago.TransactionI return tx, nil } +// GetTransactionMetadata gets the transaction metadata. +func (c *WebClient) GetTransactionMetadata(ctx context.Context, txID iotago.TransactionID) (*api.TransactionMetadataResponse, error) { + return c.client.TransactionMetadata(ctx, txID) +} + func (c *WebClient) GetBlockIssuance(ctx context.Context) (resp *api.IssuanceBlockHeaderResponse, err error) { return c.client.BlockIssuance(ctx) } @@ -403,8 +410,8 @@ func (c *WebClient) GetValidators(ctx context.Context) (*api.ValidatorsResponse, return c.client.ValidatorsAll(ctx) } -func (c *WebClient) GetStaking(ctx context.Context, accountAddress *iotago.AccountAddress) (resp *api.ValidatorResponse, err error) { - return c.client.StakingAccount(ctx, accountAddress) +func (c *WebClient) GetValidator(ctx context.Context, accountAddress *iotago.AccountAddress) (resp *api.ValidatorResponse, err error) { + return c.client.Validator(ctx, accountAddress) } func (c *WebClient) GetRewards(ctx context.Context, outputID iotago.OutputID) (*api.ManaRewardsResponse, error) { diff --git a/pkg/models/output.go b/pkg/models/output.go index fc5ea53..a60bb4e 100644 --- a/pkg/models/output.go +++ b/pkg/models/output.go @@ -82,7 +82,6 @@ type PayloadIssuanceData struct { Type iotago.PayloadType TransactionBuilder *builder.TransactionBuilder Payload iotago.Payload - TxSigningKeys []iotago.AddressKeys } type TempOutputID [32]byte diff --git a/pkg/spammer/spammer.go b/pkg/spammer/spammer.go index 2fca872..47f7e87 100644 --- a/pkg/spammer/spammer.go +++ b/pkg/spammer/spammer.go @@ -274,7 +274,7 @@ func (s *Spammer) PrepareAndPostBlock(ctx context.Context, issuanceData *models. case iotago.PayloadTaggedData: blockID, err = s.EvilWallet.PrepareAndPostBlockWithPayload(ctx, clt, issuanceData.Payload, issuerAccount) case iotago.PayloadSignedTransaction: - blockID, tx, err = s.EvilWallet.PrepareAndPostBlockWithTxBuildData(ctx, clt, issuanceData.TransactionBuilder, issuanceData.TxSigningKeys, issuerAccount) + blockID, tx, err = s.EvilWallet.PrepareAndPostBlockWithTxBuildData(ctx, clt, issuanceData.TransactionBuilder, issuerAccount) default: // unknown payload type s.logError(ErrUnknownPayloadType) diff --git a/pkg/utils/await.go b/pkg/utils/await.go index e5091de..970ff15 100644 --- a/pkg/utils/await.go +++ b/pkg/utils/await.go @@ -27,13 +27,13 @@ func isBlockStateAtLeastAccepted(blockState api.BlockState) bool { func isTransactionStateAtLeastAccepted(transactionState api.TransactionState) bool { return transactionState == api.TransactionStateAccepted || - transactionState == api.TransactionStateConfirmed || + transactionState == api.TransactionStateCommitted || transactionState == api.TransactionStateFinalized } func isBlockStateFailure(blockState api.BlockState) bool { - return blockState == api.BlockStateFailed || - blockState == api.BlockStateRejected + return blockState == api.BlockStateDropped || + blockState == api.BlockStateOrphaned } func isTransactionStateFailure(transactionState api.TransactionState) bool { @@ -41,21 +41,14 @@ func isTransactionStateFailure(transactionState api.TransactionState) bool { } func evaluateBlockIssuanceResponse(resp *api.BlockMetadataResponse) (accepted bool, err error) { - if resp.TransactionMetadata == nil { - return false, ierrors.New("no transaction metadata in block metadata response") - } - - if isBlockStateAtLeastAccepted(resp.BlockState) && isTransactionStateAtLeastAccepted(resp.TransactionMetadata.TransactionState) { + if isBlockStateAtLeastAccepted(resp.BlockState) { return true, nil } - if isBlockStateFailure(resp.BlockState) || isTransactionStateFailure(resp.TransactionMetadata.TransactionState) { + if isBlockStateFailure(resp.BlockState) { err = ierrors.Errorf("block status failure") if isBlockStateFailure(resp.BlockState) { - err = ierrors.Wrapf(err, "block failure reason: %d", resp.BlockFailureReason) - } - if isTransactionStateFailure(resp.TransactionMetadata.TransactionState) { - err = ierrors.Wrapf(err, "transaction failure reason: %d", resp.TransactionMetadata.TransactionFailureReason) + err = ierrors.Wrapf(err, "block failure reason: %s", resp.BlockState.String()) } return false, err @@ -64,6 +57,18 @@ func evaluateBlockIssuanceResponse(resp *api.BlockMetadataResponse) (accepted bo return false, nil } +func evaluateTransactionIssuanceResponse(resp *api.TransactionMetadataResponse) (accepted bool, err error) { + if isTransactionStateAtLeastAccepted(resp.TransactionState) { + return true, nil + } + + if isTransactionStateFailure(resp.TransactionState) { + return false, ierrors.Wrapf(err, "transaction failure reason: %d", resp.TransactionFailureReason) + } + + return false, nil +} + // AwaitBlockAndPayloadAcceptance waits for the block and, if provided, tx to be accepted. func AwaitBlockAndPayloadAcceptance(ctx context.Context, logger log.Logger, clt models.Client, blockID iotago.BlockID) error { for t := time.Now(); time.Since(t) < MaxAcceptanceAwait; time.Sleep(AwaitInterval) { @@ -75,18 +80,17 @@ func AwaitBlockAndPayloadAcceptance(ctx context.Context, logger log.Logger, clt } accepted, err := evaluateBlockIssuanceResponse(resp) - if err != nil { - logger.LogErrorf("Block %s issuance failure, err: %v", blockID.ToHex(), err.Error()) - - return err - } - if accepted { - logger.LogDebugf("Block %s issuance success, status: %s, transaction state: %s", blockID.ToHex(), resp.BlockState, resp.TransactionMetadata.TransactionState) + logger.LogDebugf("Block %s issuance success, status: %s", blockID.ToHex(), resp.BlockState) return nil } + if err != nil { + logger.LogDebugf("Block %s issuance failure, block failure reason: %s", blockID.ToHex(), resp.BlockState.String()) + + return err + } } return ierrors.Errorf("failed to await block confirmation or failure: %s", blockID.ToHex()) @@ -95,20 +99,20 @@ func AwaitBlockAndPayloadAcceptance(ctx context.Context, logger log.Logger, clt // AwaitBlockWithTransactionToBeAccepted awaits for acceptance of a single transaction. func AwaitBlockWithTransactionToBeAccepted(ctx context.Context, logger log.Logger, clt models.Client, txID iotago.TransactionID) error { for t := time.Now(); time.Since(t) < MaxAcceptanceAwait; time.Sleep(AwaitInterval) { - resp, _ := clt.GetBlockStateFromTransaction(ctx, txID) + resp, _ := clt.GetTransactionMetadata(ctx, txID) if resp == nil { continue } - accepted, err := evaluateBlockIssuanceResponse(resp) + accepted, err := evaluateTransactionIssuanceResponse(resp) if accepted { - logger.LogDebugf("Transaction %s issuance success, state: %s", txID.ToHex(), resp.TransactionMetadata.TransactionState) + logger.LogDebugf("Transaction %s issuance success, state: %s", txID.ToHex(), resp.TransactionState) return nil } if err != nil { - logger.LogDebugf("Transaction %s issuance failure, tx failure reason: %d, block failure reason: %d", txID.ToHex(), resp.TransactionMetadata.TransactionFailureReason, resp.BlockFailureReason) + logger.LogDebugf("Transaction %s issuance failure, tx failure reason: %d", txID.ToHex(), resp.TransactionFailureReason) return err } @@ -152,12 +156,12 @@ func AwaitAddressUnspentOutputToBeAccepted(ctx context.Context, logger log.Logge // Useful when we have only an address and no transactionID, e.g. faucet funds request. func AwaitOutputToBeAccepted(ctx context.Context, clt models.Client, outputID iotago.OutputID) error { for t := time.Now(); time.Since(t) < MaxAcceptanceAwait; time.Sleep(AwaitInterval) { - resp, err := clt.GetBlockStateFromTransaction(ctx, outputID.TransactionID()) + resp, err := clt.GetTransactionMetadata(ctx, outputID.TransactionID()) if err != nil { continue } - if isTransactionStateAtLeastAccepted(resp.TransactionMetadata.TransactionState) { + if isTransactionStateAtLeastAccepted(resp.TransactionState) { return nil } } diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 898451f..06b48f4 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -7,10 +7,7 @@ import ( "github.com/iotaledger/evil-tools/pkg/models" hiveEd25519 "github.com/iotaledger/hive.go/crypto/ed25519" "github.com/iotaledger/hive.go/ierrors" - "github.com/iotaledger/hive.go/lo" iotago "github.com/iotaledger/iota.go/v4" - "github.com/iotaledger/iota.go/v4/builder" - "github.com/iotaledger/iota.go/v4/tpkg" ) func DelegationEnd(apiForSlot iotago.API, issuingSlot iotago.SlotIndex, commitmentSlot iotago.SlotIndex) iotago.EpochIndex { @@ -68,69 +65,3 @@ func SumOutputsBalance(outputs []*models.OutputData) iotago.BaseToken { return balance } - -func PrepareDummyTransactionBuilder(api iotago.API, basicInputCount, basicOutputCount int, accountInput bool, accountOutput bool) *builder.TransactionBuilder { - txBuilder := builder.NewTransactionBuilder(api) - txBuilder.SetCreationSlot(100) - for i := 0; i < basicInputCount; i++ { - txBuilder.AddInput(&builder.TxInput{ - UnlockTarget: tpkg.RandEd25519Address(), - InputID: iotago.EmptyOutputID, - Input: tpkg.RandBasicOutput(iotago.AddressEd25519), - }) - } - for i := 0; i < basicOutputCount; i++ { - txBuilder.AddOutput(tpkg.RandBasicOutput(iotago.AddressEd25519)) - } - - if accountInput { - out := builder.NewAccountOutputBuilder(tpkg.RandAccountAddress(), 100). - Mana(100). - BlockIssuer(tpkg.RandBlockIssuerKeys(1), iotago.MaxSlotIndex).MustBuild() - txBuilder.AddInput(&builder.TxInput{ - UnlockTarget: tpkg.RandEd25519Address(), - InputID: iotago.EmptyOutputID, - Input: out, - }) - } - - if accountOutput { - out := builder.NewAccountOutputBuilder(tpkg.RandAccountAddress(), 100). - Mana(100). - BlockIssuer(tpkg.RandBlockIssuerKeys(1), iotago.MaxSlotIndex).MustBuild() - txBuilder.AddOutput(out) - } - - if accountInput || accountOutput { - txBuilder.AddBlockIssuanceCreditInput(&iotago.BlockIssuanceCreditInput{AccountID: iotago.EmptyAccountID}) - txBuilder.AddCommitmentInput(&iotago.CommitmentInput{CommitmentID: iotago.EmptyCommitmentID}) - } - - return txBuilder -} - -func MinIssuerAccountAmount(protocolParameters iotago.ProtocolParameters) iotago.BaseToken { - // create a dummy account with a block issuer feature to calculate the storage score. - dummyAccountOutput := &iotago.AccountOutput{ - Amount: 0, - Mana: 0, - AccountID: iotago.EmptyAccountID, - FoundryCounter: 0, - UnlockConditions: iotago.AccountOutputUnlockConditions{ - &iotago.AddressUnlockCondition{ - Address: &iotago.Ed25519Address{}, - }, - }, - Features: iotago.AccountOutputFeatures{ - &iotago.BlockIssuerFeature{ - BlockIssuerKeys: iotago.BlockIssuerKeys{ - &iotago.Ed25519PublicKeyHashBlockIssuerKey{}, - }, - }, - }, - ImmutableFeatures: iotago.AccountOutputImmFeatures{}, - } - storageScoreStructure := iotago.NewStorageScoreStructure(protocolParameters.StorageScoreParameters()) - - return lo.PanicOnErr(storageScoreStructure.MinDeposit(dummyAccountOutput)) -} diff --git a/pkg/walletmanager/accountcreation.go b/pkg/walletmanager/accountcreation.go index f3cfdda..94b246d 100644 --- a/pkg/walletmanager/accountcreation.go +++ b/pkg/walletmanager/accountcreation.go @@ -174,7 +174,7 @@ func (m *Manager) createAccountCreationTransaction(clt models.Client, wallet *Wa return nil, ierrors.Wrap(err, "failed to get address signer") } - txBuilder := builder.NewTransactionBuilder(apiForSlot) + txBuilder := builder.NewTransactionBuilder(apiForSlot, addrSigner) for _, output := range inputs { txBuilder.AddInput(&builder.TxInput{ UnlockTarget: output.Address, @@ -192,7 +192,7 @@ func (m *Manager) createAccountCreationTransaction(clt models.Client, wallet *Wa // allot required mana to the implicit account logMissingMana(m.Logger, txBuilder, congestionResp.ReferenceManaCost, accountID) - signedTx, err := txBuilder.Build(addrSigner) + signedTx, err := txBuilder.Build() if err != nil { return nil, ierrors.Wrap(err, "failed to build tx") } diff --git a/pkg/walletmanager/accountdestruction.go b/pkg/walletmanager/accountdestruction.go index 8d48d04..4088227 100644 --- a/pkg/walletmanager/accountdestruction.go +++ b/pkg/walletmanager/accountdestruction.go @@ -127,7 +127,7 @@ func (m *Manager) destroyAccount(ctx context.Context, alias string) error { func (m *Manager) changeExpirySlotTransaction(ctx context.Context, clt models.Client, newExpirySlot iotago.SlotIndex, issuingSlot iotago.SlotIndex, accData *models.AccountData, commitmentID iotago.CommitmentID, addressSigner iotago.AddressSigner) (*iotago.SignedTransaction, error) { // start building the transaction apiForSlot := clt.APIForSlot(issuingSlot) - txBuilder := builder.NewTransactionBuilder(apiForSlot) + txBuilder := builder.NewTransactionBuilder(apiForSlot, addressSigner) accountOutput := clt.GetOutput(ctx, accData.OutputID) // add the account output as input @@ -152,13 +152,13 @@ func (m *Manager) changeExpirySlotTransaction(ctx context.Context, clt models.Cl // set the transaction capabilities to be able to do anything txBuilder.WithTransactionCapabilities(iotago.TransactionCapabilitiesBitMaskWithCapabilities(iotago.WithTransactionCanDoAnything())) // build the transaction - return txBuilder.Build(addressSigner) + return txBuilder.Build() } func (m *Manager) destroyAccountTransaction(ctx context.Context, clt models.Client, issuingSlot iotago.SlotIndex, alias string, accData *models.AccountData, commitmentID iotago.CommitmentID, addressSigner iotago.AddressSigner) (*iotago.SignedTransaction, error) { // start building the transaction apiForSlot := clt.APIForSlot(issuingSlot) - txBuilder := builder.NewTransactionBuilder(apiForSlot) + txBuilder := builder.NewTransactionBuilder(apiForSlot, addressSigner) expiredAccountOutput := clt.GetOutput(ctx, accData.OutputID) txBuilder.AddInput(&builder.TxInput{ UnlockTarget: expiredAccountOutput.UnlockConditionSet().Address().Address, @@ -183,5 +183,5 @@ func (m *Manager) destroyAccountTransaction(ctx context.Context, clt models.Clie txBuilder.WithTransactionCapabilities(iotago.TransactionCapabilitiesBitMaskWithCapabilities(iotago.WithTransactionCanDoAnything())) // build the transaction - return txBuilder.Build(addressSigner) + return txBuilder.Build() } diff --git a/pkg/walletmanager/accountupdate.go b/pkg/walletmanager/accountupdate.go index 4cc22d5..a2d370f 100644 --- a/pkg/walletmanager/accountupdate.go +++ b/pkg/walletmanager/accountupdate.go @@ -56,7 +56,7 @@ func (m *Manager) createAllotTransaction(inputs []*models.OutputData, w *Wallet, return nil, ierrors.Wrap(err, "failed to get address signer") } - txBuilder := builder.NewTransactionBuilder(apiForSlot) + txBuilder := builder.NewTransactionBuilder(apiForSlot, addrSigner) for _, output := range inputs { txBuilder.AddInput(&builder.TxInput{ UnlockTarget: output.Address, @@ -73,7 +73,7 @@ func (m *Manager) createAllotTransaction(inputs []*models.OutputData, w *Wallet, //WithTransactionCapabilities(iotago.TransactionCapabilitiesBitMaskWithCapabilities(iotago.WithTransactionCanDoAnything())) AllotAllMana(txBuilder.CreationSlot(), accountID, 0) - signedTx, err := txBuilder.Build(addrSigner) + signedTx, err := txBuilder.Build() if err != nil { return nil, ierrors.Wrap(err, "failed to build tx") } diff --git a/pkg/walletmanager/claim.go b/pkg/walletmanager/claim.go index 458a581..451ea30 100644 --- a/pkg/walletmanager/claim.go +++ b/pkg/walletmanager/claim.go @@ -98,7 +98,7 @@ func (m *Manager) createClaimingTransaction(input *models.OutputData, rewardsRes return nil, ierrors.Wrap(err, "failed to get address signer") } - txBuilder := builder.NewTransactionBuilder(apiForSlot) + txBuilder := builder.NewTransactionBuilder(apiForSlot, addrSigner) totalMana := iotago.Mana(0) potentialMana, err := iotago.PotentialMana(apiForSlot.ManaDecayProvider(), apiForSlot.StorageScoreStructure(), input.OutputStruct, input.OutputID.Slot(), currentSlot) if err != nil { @@ -129,7 +129,7 @@ func (m *Manager) createClaimingTransaction(input *models.OutputData, rewardsRes SetCreationSlot(currentSlot). AllotAllMana(txBuilder.CreationSlot(), accountID, 0) - signedTx, err := txBuilder.Build(addrSigner) + signedTx, err := txBuilder.Build() if err != nil { return nil, ierrors.Wrap(err, "failed to build tx") } diff --git a/pkg/walletmanager/delegation.go b/pkg/walletmanager/delegation.go index caa7c07..f6f09f6 100644 --- a/pkg/walletmanager/delegation.go +++ b/pkg/walletmanager/delegation.go @@ -23,7 +23,7 @@ func (m *Manager) delegateToAccount(ctx context.Context, params *DelegateAccount // check the pool stake before delegating var poolStakeBefore, poolStakeAfter iotago.BaseToken if params.CheckPool { - validatorResp, err := m.Client.GetStaking(ctx, accountAddress) + validatorResp, err := m.Client.GetValidator(ctx, accountAddress) if err != nil { return ierrors.Wrap(err, "failed to get staking data from node") } @@ -85,7 +85,7 @@ func (m *Manager) delegateToAccount(ctx context.Context, params *DelegateAccount } // check the pool stake after delegating - validatorResp, err := m.Client.GetStaking(ctx, accountAddress) + validatorResp, err := m.Client.GetValidator(ctx, accountAddress) if err != nil { return ierrors.Wrap(err, "failed to get staking data from node") } @@ -191,8 +191,14 @@ func (m *Manager) createDelegationOutputs(wallet *Wallet, inputAmount iotago.Bas func (m *Manager) createDelegationTransaction(wallet *Wallet, params *DelegateAccountParams, toAccountAddress *iotago.AccountAddress, inputs []*models.OutputData, commitmentID iotago.CommitmentID, issuingSlot iotago.SlotIndex) (*iotago.SignedTransaction, *models.OutputData, error) { // create a transaction with the delegation output apiForSlot := m.Client.APIForSlot(issuingSlot) + + addressSigner, err := wallet.GetAddrSignerForIndexes(inputs...) + if err != nil { + return nil, nil, ierrors.Wrap(err, "failed to get address signer") + } + var totalInputAmount iotago.BaseToken - txBuilder := builder.NewTransactionBuilder(apiForSlot) + txBuilder := builder.NewTransactionBuilder(apiForSlot, addressSigner) for _, input := range inputs { txBuilder.AddInput(&builder.TxInput{ UnlockTarget: input.Address, @@ -212,12 +218,7 @@ func (m *Manager) createDelegationTransaction(wallet *Wallet, params *DelegateAc txBuilder.SetCreationSlot(issuingSlot) txBuilder.WithTransactionCapabilities(iotago.TransactionCapabilitiesBitMaskWithCapabilities(iotago.WithTransactionCanDoAnything())) - addressSigner, err := wallet.GetAddrSignerForIndexes(inputs...) - if err != nil { - return nil, nil, ierrors.Wrap(err, "failed to get address signer") - } - - signedTx, err := txBuilder.Build(addressSigner) + signedTx, err := txBuilder.Build() if err != nil { return nil, nil, ierrors.Wrap(err, "failed to build tx") } diff --git a/tools/gendoc/go.mod b/tools/gendoc/go.mod index 5ec1e4f..1072322 100644 --- a/tools/gendoc/go.mod +++ b/tools/gendoc/go.mod @@ -17,7 +17,7 @@ require ( github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/eclipse/paho.mqtt.golang v1.4.3 // indirect - github.com/ethereum/go-ethereum v1.13.12 // indirect + github.com/ethereum/go-ethereum v1.13.14 // indirect github.com/fatih/structs v1.1.0 // indirect github.com/fbiville/markdown-table-formatter v0.3.0 // indirect github.com/felixge/fgprof v0.9.3 // indirect @@ -29,18 +29,18 @@ require ( github.com/hashicorp/go-version v1.6.0 // indirect github.com/holiman/uint256 v1.2.4 // indirect github.com/iancoleman/orderedmap v0.3.0 // indirect - github.com/iotaledger/hive.go/constraints v0.0.0-20240216135101-261e99d9d84a // indirect - github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240216135101-261e99d9d84a // indirect - github.com/iotaledger/hive.go/crypto v0.0.0-20240216135101-261e99d9d84a // indirect - github.com/iotaledger/hive.go/ds v0.0.0-20240216135101-261e99d9d84a // indirect - github.com/iotaledger/hive.go/ierrors v0.0.0-20240216135101-261e99d9d84a // indirect - github.com/iotaledger/hive.go/lo v0.0.0-20240216135101-261e99d9d84a // indirect - github.com/iotaledger/hive.go/log v0.0.0-20240216135101-261e99d9d84a // indirect - github.com/iotaledger/hive.go/runtime v0.0.0-20240216135101-261e99d9d84a // indirect - github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240216135101-261e99d9d84a // indirect - github.com/iotaledger/hive.go/stringify v0.0.0-20240216135101-261e99d9d84a // indirect + github.com/iotaledger/hive.go/constraints v0.0.0-20240305162344-4b8be588e1cf // indirect + github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240305162344-4b8be588e1cf // indirect + github.com/iotaledger/hive.go/crypto v0.0.0-20240305162344-4b8be588e1cf // indirect + github.com/iotaledger/hive.go/ds v0.0.0-20240305162344-4b8be588e1cf // indirect + github.com/iotaledger/hive.go/ierrors v0.0.0-20240305162344-4b8be588e1cf // indirect + github.com/iotaledger/hive.go/lo v0.0.0-20240305162344-4b8be588e1cf // indirect + github.com/iotaledger/hive.go/log v0.0.0-20240223134921-02b9a2022431 // indirect + github.com/iotaledger/hive.go/runtime v0.0.0-20240305162344-4b8be588e1cf // indirect + github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240305162344-4b8be588e1cf // indirect + github.com/iotaledger/hive.go/stringify v0.0.0-20240305162344-4b8be588e1cf // indirect github.com/iotaledger/iota-crypto-demo v0.0.0-20240216103559-27ca8dffd1e7 // indirect - github.com/iotaledger/iota.go/v4 v4.0.0-20240216140514-c867d6524642 // indirect + github.com/iotaledger/iota.go/v4 v4.0.0-20240307175623-0904c71fcb38 // indirect github.com/knadh/koanf v1.5.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect @@ -56,10 +56,10 @@ require ( github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.17.1 // indirect - golang.org/x/crypto v0.19.0 // indirect + golang.org/x/crypto v0.21.0 // indirect golang.org/x/net v0.21.0 // indirect golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/tools/gendoc/go.sum b/tools/gendoc/go.sum index e6ee0fb..12be626 100644 --- a/tools/gendoc/go.sum +++ b/tools/gendoc/go.sum @@ -57,8 +57,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ethereum/go-ethereum v1.13.12 h1:iDr9UM2JWkngBHGovRJEQn4Kor7mT4gt9rUZqB5M29Y= -github.com/ethereum/go-ethereum v1.13.12/go.mod h1:hKL2Qcj1OvStXNSEDbucexqnEt1Wh4Cz329XsjAalZY= +github.com/ethereum/go-ethereum v1.13.14 h1:EwiY3FZP94derMCIam1iW4HFVrSgIcpsu0HwTQtm6CQ= +github.com/ethereum/go-ethereum v1.13.14/go.mod h1:TN8ZiHrdJwSe8Cb6x+p0hs5CxhJZPbqB7hHkaUXcmIU= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= @@ -179,30 +179,30 @@ github.com/iotaledger/hive.go/app v0.0.0-20240216135101-261e99d9d84a h1:o5viyYlz github.com/iotaledger/hive.go/app v0.0.0-20240216135101-261e99d9d84a/go.mod h1:O9agBfrnt1ykrDOzF6GXZf4ivcw+SxM9c9C86YtbxLU= github.com/iotaledger/hive.go/apputils v0.0.0-20230829152614-7afc7a4d89b3 h1:4aVJTc0KS77uEw0Tny4r0n1ORwcbAQDECaCclgf/6lE= github.com/iotaledger/hive.go/apputils v0.0.0-20230829152614-7afc7a4d89b3/go.mod h1:TZeAqieDu+xDOZp2e9+S+8pZp1PrfgcwLUnxmd8IgLU= -github.com/iotaledger/hive.go/constraints v0.0.0-20240216135101-261e99d9d84a h1:9xeffzciYdw9L/ebAOPg/39Bqn3p5iyOROQhQHaAEUs= -github.com/iotaledger/hive.go/constraints v0.0.0-20240216135101-261e99d9d84a/go.mod h1:JF7jjkL6tSUOXm23SWadBzBrl7eJk1DQRLc/fNoVZ+o= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240216135101-261e99d9d84a h1:+l3NjL4v700Iv+ZF7KjPALkygFOxzkByoRIoSK9bOzc= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240216135101-261e99d9d84a/go.mod h1:9HM/YmzOfdlWXYHVEWVjYhKQHOlgxBVMsr5Vf5yn5IE= -github.com/iotaledger/hive.go/crypto v0.0.0-20240216135101-261e99d9d84a h1:ux81+J6mcxYw6usZpEPLZjE6J+TNs3RaRcTHa9+5ERM= -github.com/iotaledger/hive.go/crypto v0.0.0-20240216135101-261e99d9d84a/go.mod h1:7kZh98nwJInQsIybiPXSABc/on/IsDdXyeiPLfaH+2I= -github.com/iotaledger/hive.go/ds v0.0.0-20240216135101-261e99d9d84a h1:7M1+k0H53jahg2ZDN10SociepCB+jymIZoiYaSenpbQ= -github.com/iotaledger/hive.go/ds v0.0.0-20240216135101-261e99d9d84a/go.mod h1:sE/HabIH9FWTvgaHioLN6o4rrxFMf4BuqRQwloxcamo= -github.com/iotaledger/hive.go/ierrors v0.0.0-20240216135101-261e99d9d84a h1:ugcQ43xbMZo5XYTfanIHOxQGKNpxhcatcz9ZXcX6W1o= -github.com/iotaledger/hive.go/ierrors v0.0.0-20240216135101-261e99d9d84a/go.mod h1:GQY0/35sjgT9Poi1Vrs9kFVvAkuKzGXfVh4j6CBXsAA= -github.com/iotaledger/hive.go/lo v0.0.0-20240216135101-261e99d9d84a h1:eUAtyEIYRlAPeZ2qhlEA+7T8DVoYK2h9eotlst/84SU= -github.com/iotaledger/hive.go/lo v0.0.0-20240216135101-261e99d9d84a/go.mod h1:0ycE1W59kkNjQ87odL6H4x5Ik9bXhbNk88wmo+mIYt0= -github.com/iotaledger/hive.go/log v0.0.0-20240216135101-261e99d9d84a h1:XzIuUsWPtDP7h9UbQPFW5/bjeqVjodcSCMRuF7zP5jk= -github.com/iotaledger/hive.go/log v0.0.0-20240216135101-261e99d9d84a/go.mod h1:JCv/LVVTAMoCPLzou534RoIif7CAezcWZlGYabrHsck= -github.com/iotaledger/hive.go/runtime v0.0.0-20240216135101-261e99d9d84a h1:qmfoYLK2XyPOXfldG21qHyCrbIf0sl7iJoFirvTrnO0= -github.com/iotaledger/hive.go/runtime v0.0.0-20240216135101-261e99d9d84a/go.mod h1:lAR3vbqE9g65M9VwWHiaXab2q+d89dBOFjhKgnDfK7c= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240216135101-261e99d9d84a h1:ahUFo0X9Th+8/aE6KSWiy7Eap5p0YFL6CDapP1o8dLo= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240216135101-261e99d9d84a/go.mod h1:yXQNGZUz++dB1T9RAHhWSresuTLzTC856ntdins9ivo= -github.com/iotaledger/hive.go/stringify v0.0.0-20240216135101-261e99d9d84a h1:xLreq/rXeSPdb86RnZNEPH3PUIWt56BQxK1+11+hM4I= -github.com/iotaledger/hive.go/stringify v0.0.0-20240216135101-261e99d9d84a/go.mod h1:O4p7UmsfoeLqtAUwrKbq0lXMxjY/MLQSpZSavvvvGig= +github.com/iotaledger/hive.go/constraints v0.0.0-20240305162344-4b8be588e1cf h1:SHtB0Nf1MdOAk+adIQfQGWZ++EcvrfFE4kCTMbZ7Qys= +github.com/iotaledger/hive.go/constraints v0.0.0-20240305162344-4b8be588e1cf/go.mod h1:JF7jjkL6tSUOXm23SWadBzBrl7eJk1DQRLc/fNoVZ+o= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240305162344-4b8be588e1cf h1:CxqQWH3cHX+jUx94zDeeCIe93gmygem1Y5jMrcAWJA4= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240305162344-4b8be588e1cf/go.mod h1:73ODTHUJxAoGUN0InOtuQ29LVq85pDf7GckM9d0ziqo= +github.com/iotaledger/hive.go/crypto v0.0.0-20240305162344-4b8be588e1cf h1:msheCEl+Q1y8LQjfP9VOf6t38LeCOndhHkuw3AgMfK8= +github.com/iotaledger/hive.go/crypto v0.0.0-20240305162344-4b8be588e1cf/go.mod h1:aREIB19gIhSYdY0Hl/37sg1JRH7+j3ajeJxBIQf6mig= +github.com/iotaledger/hive.go/ds v0.0.0-20240305162344-4b8be588e1cf h1:TyGz03gRMdFECQVc0gExs9W1k4lB10MPeRQohNilnmk= +github.com/iotaledger/hive.go/ds v0.0.0-20240305162344-4b8be588e1cf/go.mod h1:wfjeJj9B+MM/3yeUHfvT8Gj8bRsdl9utyh2dZg+1+B0= +github.com/iotaledger/hive.go/ierrors v0.0.0-20240305162344-4b8be588e1cf h1:aBMpx2sHnG7Esai4S7b47aUERBTV+JgoSjJKT1U4LxE= +github.com/iotaledger/hive.go/ierrors v0.0.0-20240305162344-4b8be588e1cf/go.mod h1:GQY0/35sjgT9Poi1Vrs9kFVvAkuKzGXfVh4j6CBXsAA= +github.com/iotaledger/hive.go/lo v0.0.0-20240305162344-4b8be588e1cf h1:ADrQgsSpsoMSfIlSsMHo66ush8y0z8AaFn0Nae5dztY= +github.com/iotaledger/hive.go/lo v0.0.0-20240305162344-4b8be588e1cf/go.mod h1:67oLzWYiBLGt5PN7IBVHdbt9P6oBYCx9UvMEL8ExDAc= +github.com/iotaledger/hive.go/log v0.0.0-20240223134921-02b9a2022431 h1:CxoorcruX5zlz+I3iwPxdfs1D3DJt/NQ60Kb0+YvEKs= +github.com/iotaledger/hive.go/log v0.0.0-20240223134921-02b9a2022431/go.mod h1:H5tmswUbT3o5+QiM6UPtBv7VnPf+lJtlantgpp2lzUI= +github.com/iotaledger/hive.go/runtime v0.0.0-20240305162344-4b8be588e1cf h1:gELL3pOfJADq6kLC6HkbEtFwAiVOm1cPuVy92noqjPk= +github.com/iotaledger/hive.go/runtime v0.0.0-20240305162344-4b8be588e1cf/go.mod h1:pueoYXud+HmTY2x9j/S6+ZX3M5ZyENFKPDrx3EtcwWs= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240305162344-4b8be588e1cf h1:PAwjwceOCwCclmvCzbSJb0A7EolaDJsjWqw0ixRys0M= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240305162344-4b8be588e1cf/go.mod h1:NK05G4PxwZF1m4jGANJWLhAQ2hP1Nt0L8mgCTFLsSCw= +github.com/iotaledger/hive.go/stringify v0.0.0-20240305162344-4b8be588e1cf h1:gLQTQtZZTwZBFZdx0tuM7WHpWtF1liC3c6FflZiNGXc= +github.com/iotaledger/hive.go/stringify v0.0.0-20240305162344-4b8be588e1cf/go.mod h1:O4p7UmsfoeLqtAUwrKbq0lXMxjY/MLQSpZSavvvvGig= github.com/iotaledger/iota-crypto-demo v0.0.0-20240216103559-27ca8dffd1e7 h1:t6k4MqiUov0FrBb2o2JhKlOVSdlPbIQWM8ivYHL0G0g= github.com/iotaledger/iota-crypto-demo v0.0.0-20240216103559-27ca8dffd1e7/go.mod h1:do+N3LpeDEi9qselEC4XcjqGoRc7cWGiqBtIeBOKEMs= -github.com/iotaledger/iota.go/v4 v4.0.0-20240216140514-c867d6524642 h1:s3nISWsyLwNA4+fh19yp1CQip3pHpIgsbYIRITpl8aA= -github.com/iotaledger/iota.go/v4 v4.0.0-20240216140514-c867d6524642/go.mod h1:IZNS0qmVdoRjIbFe4VTPG7k3bzSJQBvAHL2eC/2kFT0= +github.com/iotaledger/iota.go/v4 v4.0.0-20240307175623-0904c71fcb38 h1:NizJ3CALLCcJowtAtkNuDlpE4gd4qjaWZkp/kTZfeYk= +github.com/iotaledger/iota.go/v4 v4.0.0-20240307175623-0904c71fcb38/go.mod h1:8UQOTI7CC5R/3TurawUFuBZbkb37RzW8m4q8Hp7ct30= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= @@ -351,8 +351,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE= golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= @@ -428,8 +428,8 @@ golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=