From d59012d41eddb831c478aa8f47f0d46ce858c7a3 Mon Sep 17 00:00:00 2001 From: jkrvivian Date: Wed, 27 Sep 2023 09:11:06 +0800 Subject: [PATCH 1/7] Use AccountOutputBuilder from iota.go --- pkg/tests/accounts_test.go | 12 +- pkg/testsuite/transactions_framework.go | 139 +++++++----------------- 2 files changed, 40 insertions(+), 111 deletions(-) diff --git a/pkg/tests/accounts_test.go b/pkg/tests/accounts_test.go index f994b9ccc..5fda4839f 100644 --- a/pkg/tests/accounts_test.go +++ b/pkg/tests/accounts_test.go @@ -128,16 +128,8 @@ func Test_TransitionAccount(t *testing.T) { &iotago.StateControllerAddressUnlockCondition{Address: ts.TransactionFramework.DefaultAddress()}, &iotago.GovernorAddressUnlockCondition{Address: ts.TransactionFramework.DefaultAddress()}, }), - testsuite.WithBlockIssuerFeature(&iotago.BlockIssuerFeature{ - BlockIssuerKeys: iotago.BlockIssuerKeys{newAccountBlockIssuerKey}, - ExpirySlot: newAccountExpirySlot, - }), - testsuite.WithStakingFeature(&iotago.StakingFeature{ - StakedAmount: 10000, - FixedCost: 421, - StartEpoch: 0, - EndEpoch: 10, - }), + testsuite.WithBlockIssuerFeature(iotago.BlockIssuerKeys{newAccountBlockIssuerKey}, newAccountExpirySlot), + testsuite.WithStakingFeature(10000, 421, 0, 10), ) destroyedAccountInput, destructionOutputs, destroyWallets := ts.TransactionFramework.DestroyAccount("TX1:0") diff --git a/pkg/testsuite/transactions_framework.go b/pkg/testsuite/transactions_framework.go index 393074aa4..e3d8ab976 100644 --- a/pkg/testsuite/transactions_framework.go +++ b/pkg/testsuite/transactions_framework.go @@ -175,20 +175,15 @@ func (t *TransactionFramework) CreateBasicOutputs(amountDistribution []iotago.Ba return inputStates, outputStates, []*mock.HDWallet{t.wallet} } -func (t *TransactionFramework) CreateAccountFromInput(inputAlias string, opts ...options.Option[iotago.AccountOutput]) (utxoledger.Outputs, iotago.Outputs[iotago.Output], []*mock.HDWallet) { +func (t *TransactionFramework) CreateAccountFromInput(inputAlias string, opts ...options.Option[builder.AccountOutputBuilder]) (utxoledger.Outputs, iotago.Outputs[iotago.Output], []*mock.HDWallet) { input := t.Output(inputAlias) - accountOutput := options.Apply(&iotago.AccountOutput{ - Amount: input.BaseTokenAmount(), - Mana: input.StoredMana(), - NativeTokens: iotago.NativeTokens{}, - Conditions: iotago.AccountOutputUnlockConditions{ + accountOutput := options.Apply(builder.NewAccountOutputBuilder(t.DefaultAddress(), t.DefaultAddress(), input.BaseTokenAmount()). + Mana(input.StoredMana()). + UnlockConditions(iotago.AccountOutputUnlockConditions{ &iotago.StateControllerAddressUnlockCondition{Address: t.DefaultAddress()}, &iotago.GovernorAddressUnlockCondition{Address: t.DefaultAddress()}, - }, - Features: iotago.AccountOutputFeatures{}, - ImmutableFeatures: iotago.AccountOutputImmFeatures{}, - }, opts) + }), opts).MustBuild() outputStates := iotago.Outputs[iotago.Output]{accountOutput} @@ -286,7 +281,7 @@ func (t *TransactionFramework) DestroyAccount(alias string) (consumedInputs *utx return output, outputStates, []*mock.HDWallet{t.wallet} } -func (t *TransactionFramework) TransitionAccount(alias string, opts ...options.Option[iotago.AccountOutput]) (consumedInput *utxoledger.Output, outputs iotago.Outputs[iotago.Output], signingWallets []*mock.HDWallet) { +func (t *TransactionFramework) TransitionAccount(alias string, opts ...options.Option[builder.AccountOutputBuilder]) (consumedInput *utxoledger.Output, outputs iotago.Outputs[iotago.Output], signingWallets []*mock.HDWallet) { output, exists := t.states[alias] if !exists { panic(fmt.Sprintf("account with alias %s does not exist", alias)) @@ -297,7 +292,8 @@ func (t *TransactionFramework) TransitionAccount(alias string, opts ...options.O panic(fmt.Sprintf("output with alias %s is not *iotago.AccountOutput", alias)) } - accountOutput = options.Apply(accountOutput, opts) + accountBuilder := builder.NewAccountOutputBuilderFromPrevious(accountOutput) + accountOutput = options.Apply(accountBuilder, opts).MustBuild() return output, iotago.Outputs[iotago.Output]{accountOutput}, []*mock.HDWallet{t.wallet} } @@ -380,121 +376,62 @@ func WithDelegationAmount(amount iotago.BaseToken) options.Option[iotago.Delegat // BlockIssuer options -func WithBlockIssuerFeature(blockIssuerFeature *iotago.BlockIssuerFeature) options.Option[iotago.AccountOutput] { - return func(accountOutput *iotago.AccountOutput) { - for idx, feature := range accountOutput.Features { - if feature.Type() == iotago.FeatureBlockIssuer { - accountOutput.Features[idx] = blockIssuerFeature - return - } - } - - accountOutput.Features = append(accountOutput.Features, blockIssuerFeature) +func WithBlockIssuerFeature(keys iotago.BlockIssuerKeys, expirySlot iotago.SlotIndex) options.Option[builder.AccountOutputBuilder] { + return func(accountBuilder *builder.AccountOutputBuilder) { + accountBuilder.BlockIssuer(keys, expirySlot) } } -func AddBlockIssuerKey(key iotago.BlockIssuerKey) options.Option[iotago.AccountOutput] { - return func(accountOutput *iotago.AccountOutput) { - blockIssuer := accountOutput.FeatureSet().BlockIssuer() - if blockIssuer == nil { - panic("cannot add block issuer key to account without BlockIssuer feature") - } - blockIssuer.BlockIssuerKeys = append(blockIssuer.BlockIssuerKeys, key) - - blockIssuer.BlockIssuerKeys.Sort() +func AddBlockIssuerKey(key iotago.BlockIssuerKey) options.Option[builder.AccountOutputBuilder] { + return func(accountBuilder *builder.AccountOutputBuilder) { + transition := accountBuilder.GovernanceTransition() + transition.BlockIssuerTransition().AddKeys(key) } } -func WithBlockIssuerKeys(keys iotago.BlockIssuerKeys) options.Option[iotago.AccountOutput] { - return func(accountOutput *iotago.AccountOutput) { - blockIssuer := accountOutput.FeatureSet().BlockIssuer() - if blockIssuer == nil { - panic("cannot set block issuer keys to account without BlockIssuer feature") - } - blockIssuer.BlockIssuerKeys = keys +func WithBlockIssuerKeys(keys iotago.BlockIssuerKeys) options.Option[builder.AccountOutputBuilder] { + return func(accountBuilder *builder.AccountOutputBuilder) { + transition := accountBuilder.GovernanceTransition() + transition.BlockIssuerTransition().Keys(keys) } } -func WithBlockIssuerExpirySlot(expirySlot iotago.SlotIndex) options.Option[iotago.AccountOutput] { - return func(accountOutput *iotago.AccountOutput) { - blockIssuer := accountOutput.FeatureSet().BlockIssuer() - if blockIssuer == nil { - panic("cannot set block issuer expiry slot to account without BlockIssuer feature") - } - blockIssuer.ExpirySlot = expirySlot +func WithBlockIssuerExpirySlot(expirySlot iotago.SlotIndex) options.Option[builder.AccountOutputBuilder] { + return func(accountBuilder *builder.AccountOutputBuilder) { + transition := accountBuilder.GovernanceTransition() + transition.BlockIssuerTransition().ExpirySlot(expirySlot) } } -func WithStakingFeature(stakingFeature *iotago.StakingFeature) options.Option[iotago.AccountOutput] { - return func(accountOutput *iotago.AccountOutput) { - for idx, feature := range accountOutput.Features { - if feature.Type() == iotago.FeatureStaking { - accountOutput.Features[idx] = stakingFeature - return - } - } - - accountOutput.Features = append(accountOutput.Features, stakingFeature) - } -} - -func WithStakingEndEpoch(endEpoch iotago.EpochIndex) options.Option[iotago.AccountOutput] { - return func(accountOutput *iotago.AccountOutput) { - staking := accountOutput.FeatureSet().Staking() - if staking == nil { - panic("cannot update staking end epoch on account without Staking feature") - } - staking.EndEpoch = endEpoch +func WithStakingFeature(amount iotago.BaseToken, fixedCost iotago.Mana, startEpoch iotago.EpochIndex, optEndEpoch ...iotago.EpochIndex) options.Option[builder.AccountOutputBuilder] { + return func(accountBuilder *builder.AccountOutputBuilder) { + accountBuilder.Staking(amount, fixedCost, startEpoch, optEndEpoch...) } } // Account options -func WithAccountMana(mana iotago.Mana) options.Option[iotago.AccountOutput] { - return func(accountOutput *iotago.AccountOutput) { - accountOutput.Mana = mana - } -} - -func WithAccountAmount(amount iotago.BaseToken) options.Option[iotago.AccountOutput] { - return func(accountOutput *iotago.AccountOutput) { - accountOutput.Amount = amount - } -} - -func WithAccountIncreasedStateIndex() options.Option[iotago.AccountOutput] { - return func(accountOutput *iotago.AccountOutput) { - accountOutput.StateIndex++ - } -} - -func WithAccountIncreasedFoundryCounter(diff uint32) options.Option[iotago.AccountOutput] { - return func(accountOutput *iotago.AccountOutput) { - accountOutput.FoundryCounter += diff - } -} - -func WithAccountFeatures(features iotago.AccountOutputFeatures) options.Option[iotago.AccountOutput] { - return func(accountOutput *iotago.AccountOutput) { - accountOutput.Features = features +func WithAccountMana(mana iotago.Mana) options.Option[builder.AccountOutputBuilder] { + return func(accountBuilder *builder.AccountOutputBuilder) { + accountBuilder.Mana(mana) } } -func WithAccountImmutableFeatures(features iotago.AccountOutputImmFeatures) options.Option[iotago.AccountOutput] { - return func(accountOutput *iotago.AccountOutput) { - accountOutput.ImmutableFeatures = features +func WithAccountAmount(amount iotago.BaseToken) options.Option[builder.AccountOutputBuilder] { + return func(accountBuilder *builder.AccountOutputBuilder) { + accountBuilder.Amount(amount) } } -func WithAccountConditions(conditions iotago.AccountOutputUnlockConditions) options.Option[iotago.AccountOutput] { - return func(accountOutput *iotago.AccountOutput) { - accountOutput.Conditions = conditions +func WithAccountConditions(conditions iotago.AccountOutputUnlockConditions) options.Option[builder.AccountOutputBuilder] { + return func(accountBuilder *builder.AccountOutputBuilder) { + accountBuilder.UnlockConditions(conditions) } } -func WithAccountNativeTokens(nativeTokens iotago.NativeTokens) options.Option[iotago.AccountOutput] { - return func(accountOutput *iotago.AccountOutput) { - accountOutput.NativeTokens = nativeTokens +func WithAccountNativeTokens(nativeTokens iotago.NativeTokens) options.Option[builder.AccountOutputBuilder] { + return func(accountBuilder *builder.AccountOutputBuilder) { + accountBuilder.NativeTokens(nativeTokens) } } From 5e9c79b012513aa6514cdb0b21807ad8edcc8c0d Mon Sep 17 00:00:00 2001 From: jkrvivian Date: Wed, 27 Sep 2023 11:50:49 +0800 Subject: [PATCH 2/7] Use DelegationOutputBuilder from iota.go --- pkg/testsuite/transactions_framework.go | 62 +++++++++++-------------- 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/pkg/testsuite/transactions_framework.go b/pkg/testsuite/transactions_framework.go index e3d8ab976..80cbfe382 100644 --- a/pkg/testsuite/transactions_framework.go +++ b/pkg/testsuite/transactions_framework.go @@ -206,20 +206,12 @@ func (t *TransactionFramework) CreateAccountFromInput(inputAlias string, opts .. // CreateDelegationFromInput creates a new DelegationOutput with given options from an input. If the remainder Output // is not created, then StoredMana from the input is not passed and can potentially be burned. // In order not to burn it, it needs to be assigned manually in another output in the transaction. -func (t *TransactionFramework) CreateDelegationFromInput(inputAlias string, opts ...options.Option[iotago.DelegationOutput]) (utxoledger.Outputs, iotago.Outputs[iotago.Output], []*mock.HDWallet) { +func (t *TransactionFramework) CreateDelegationFromInput(inputAlias string, opts ...options.Option[builder.DelegationOutputBuilder]) (utxoledger.Outputs, iotago.Outputs[iotago.Output], []*mock.HDWallet) { input := t.Output(inputAlias) - delegationOutput := options.Apply(&iotago.DelegationOutput{ - Amount: input.BaseTokenAmount(), - DelegatedAmount: input.BaseTokenAmount(), - DelegationID: iotago.DelegationID{}, - ValidatorAddress: &iotago.AccountAddress{}, - StartEpoch: 0, - EndEpoch: 0, - Conditions: iotago.DelegationOutputUnlockConditions{ - &iotago.AddressUnlockCondition{Address: t.DefaultAddress()}, - }, - }, opts) + delegationOutput := options.Apply(builder.NewDelegationOutputBuilder(&iotago.AccountAddress{}, t.DefaultAddress(), input.BaseTokenAmount()). + DelegatedAmount(input.BaseTokenAmount()), + opts).MustBuild() if delegationOutput.ValidatorAddress.AccountID() == iotago.EmptyAccountID() || delegationOutput.DelegatedAmount == 0 || @@ -252,17 +244,17 @@ func (t *TransactionFramework) DelayedClaimingTransition(inputAlias string, dele panic(ierrors.Errorf("%s is not a delegation output, cannot transition to delayed claiming state", inputAlias)) } - delegationOutput, ok := input.Output().Clone().(*iotago.DelegationOutput) + prevOutput, ok := input.Output().Clone().(*iotago.DelegationOutput) if !ok { panic(ierrors.Errorf("cloned output %s is not a delegation output, cannot transition to delayed claiming state", inputAlias)) } - if delegationOutput.DelegationID == iotago.EmptyDelegationID() { - delegationOutput.DelegationID = iotago.DelegationIDFromOutputID(input.OutputID()) + delegationBuilder := builder.NewDelegationOutputBuilderFromPrevious(prevOutput).EndEpoch(delegationEndEpoch) + if prevOutput.DelegationID == iotago.EmptyDelegationID() { + delegationBuilder.DelegationID(iotago.DelegationIDFromOutputID(input.OutputID())) } - delegationOutput.EndEpoch = delegationEndEpoch - return utxoledger.Outputs{input}, iotago.Outputs[iotago.Output]{delegationOutput}, []*mock.HDWallet{t.wallet} + return utxoledger.Outputs{input}, iotago.Outputs[iotago.Output]{delegationBuilder.MustBuild()}, []*mock.HDWallet{t.wallet} } func (t *TransactionFramework) DestroyAccount(alias string) (consumedInputs *utxoledger.Output, outputs iotago.Outputs[iotago.Output], signingWallets []*mock.HDWallet) { @@ -338,39 +330,39 @@ func (t *TransactionFramework) DefaultAddress() iotago.Address { // DelegationOutput options -func WithDelegatedAmount(delegatedAmount iotago.BaseToken) options.Option[iotago.DelegationOutput] { - return func(delegationOutput *iotago.DelegationOutput) { - delegationOutput.DelegatedAmount = delegatedAmount +func WithDelegatedAmount(delegatedAmount iotago.BaseToken) options.Option[builder.DelegationOutputBuilder] { + return func(delegationBuilder *builder.DelegationOutputBuilder) { + delegationBuilder.DelegatedAmount(delegatedAmount) } } -func WithDelegatedValidatorAddress(validatorAddress *iotago.AccountAddress) options.Option[iotago.DelegationOutput] { - return func(delegationOutput *iotago.DelegationOutput) { - delegationOutput.ValidatorAddress = validatorAddress +func WithDelegatedValidatorAddress(validatorAddress *iotago.AccountAddress) options.Option[builder.DelegationOutputBuilder] { + return func(delegationBuilder *builder.DelegationOutputBuilder) { + delegationBuilder.ValidatorAddress(validatorAddress) } } -func WithDelegationStartEpoch(startEpoch iotago.EpochIndex) options.Option[iotago.DelegationOutput] { - return func(delegationOutput *iotago.DelegationOutput) { - delegationOutput.StartEpoch = startEpoch +func WithDelegationStartEpoch(startEpoch iotago.EpochIndex) options.Option[builder.DelegationOutputBuilder] { + return func(delegationBuilder *builder.DelegationOutputBuilder) { + delegationBuilder.StartEpoch(startEpoch) } } -func WithDelegationEndEpoch(endEpoch iotago.EpochIndex) options.Option[iotago.DelegationOutput] { - return func(delegationOutput *iotago.DelegationOutput) { - delegationOutput.EndEpoch = endEpoch +func WithDelegationEndEpoch(endEpoch iotago.EpochIndex) options.Option[builder.DelegationOutputBuilder] { + return func(delegationBuilder *builder.DelegationOutputBuilder) { + delegationBuilder.EndEpoch(endEpoch) } } -func WithDelegationConditions(delegationConditions iotago.DelegationOutputUnlockConditions) options.Option[iotago.DelegationOutput] { - return func(delegationOutput *iotago.DelegationOutput) { - delegationOutput.Conditions = delegationConditions +func WithDelegationConditions(delegationConditions iotago.DelegationOutputUnlockConditions) options.Option[builder.DelegationOutputBuilder] { + return func(delegationBuilder *builder.DelegationOutputBuilder) { + delegationBuilder.Address(delegationConditions.MustSet().Address().Address) } } -func WithDelegationAmount(amount iotago.BaseToken) options.Option[iotago.DelegationOutput] { - return func(delegationOutput *iotago.DelegationOutput) { - delegationOutput.Amount = amount +func WithDelegationAmount(amount iotago.BaseToken) options.Option[builder.DelegationOutputBuilder] { + return func(delegationBuilder *builder.DelegationOutputBuilder) { + delegationBuilder.Amount(amount) } } From dd94b9469617b7f11f114ea63649cb7daeb75711 Mon Sep 17 00:00:00 2001 From: jkrvivian Date: Wed, 27 Sep 2023 15:32:22 +0800 Subject: [PATCH 3/7] Use unlockCondition methods from AccountOutputBuilder --- pkg/testsuite/transactions_framework.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pkg/testsuite/transactions_framework.go b/pkg/testsuite/transactions_framework.go index 5a5efbf91..17012dad2 100644 --- a/pkg/testsuite/transactions_framework.go +++ b/pkg/testsuite/transactions_framework.go @@ -180,10 +180,9 @@ func (t *TransactionFramework) CreateAccountFromInput(inputAlias string, opts .. accountOutput := options.Apply(builder.NewAccountOutputBuilder(t.DefaultAddress(), t.DefaultAddress(), input.BaseTokenAmount()). Mana(input.StoredMana()). - UnlockConditions(iotago.AccountOutputUnlockConditions{ - &iotago.StateControllerAddressUnlockCondition{Address: t.DefaultAddress()}, - &iotago.GovernorAddressUnlockCondition{Address: t.DefaultAddress()}, - }), opts).MustBuild() + StateController(t.DefaultAddress()). + Governor(t.DefaultAddress()), + opts).MustBuild() outputStates := iotago.Outputs[iotago.Output]{accountOutput} @@ -417,7 +416,14 @@ func WithAccountAmount(amount iotago.BaseToken) options.Option[builder.AccountOu func WithAccountConditions(conditions iotago.AccountOutputUnlockConditions) options.Option[builder.AccountOutputBuilder] { return func(accountBuilder *builder.AccountOutputBuilder) { - accountBuilder.UnlockConditions(conditions) + for _, condition := range conditions.MustSet() { + switch condition.Type() { + case iotago.UnlockConditionStateControllerAddress: + accountBuilder.StateController(condition.(*iotago.StateControllerAddressUnlockCondition).Address) + case iotago.UnlockConditionGovernorAddress: + accountBuilder.Governor(condition.(*iotago.GovernorAddressUnlockCondition).Address) + } + } } } From 14b7ec3a004e0b31552a243e0916256feaaf9f1f Mon Sep 17 00:00:00 2001 From: jkrvivian Date: Wed, 27 Sep 2023 18:09:44 +0800 Subject: [PATCH 4/7] Update iota.go version --- go.mod | 2 +- go.sum | 4 ++-- tools/evil-spammer/go.mod | 2 +- tools/evil-spammer/go.sum | 4 ++-- tools/gendoc/go.mod | 2 +- tools/gendoc/go.sum | 4 ++-- tools/genesis-snapshot/go.mod | 2 +- tools/genesis-snapshot/go.sum | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 7357c8603..db66cfa78 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65 github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230925153303-c7fbe63a0ab4 github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230925152824-4bfa09b8c132 - github.com/iotaledger/iota.go/v4 v4.0.0-20230926162636-b083397f465c + github.com/iotaledger/iota.go/v4 v4.0.0-20230927100454-2c0310088757 github.com/labstack/echo/v4 v4.11.1 github.com/labstack/gommon v0.4.0 github.com/libp2p/go-libp2p v0.30.0 diff --git a/go.sum b/go.sum index 63ee04f88..350261caa 100644 --- a/go.sum +++ b/go.sum @@ -305,8 +305,8 @@ github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230925153303-c7fbe63a0ab4 h1:pbw/e github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230925153303-c7fbe63a0ab4/go.mod h1:KbmEuxbhax3fyVrxF4RjBD1/MWLFxHLNDFBnDYUzok4= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230925152824-4bfa09b8c132 h1:YHvgNY3/TRx84UxqizkFe7vVUxAMQB2DOuEL8wjHxpg= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230925152824-4bfa09b8c132/go.mod h1:DIFr5lt73HLIyn/Lg2jtzfakwhIT0mMZjMFFji3GXeI= -github.com/iotaledger/iota.go/v4 v4.0.0-20230926162636-b083397f465c h1:VuCRlEpzrQSBf00P6YVW+ykKjVed1kV3bsmiiFrdCyc= -github.com/iotaledger/iota.go/v4 v4.0.0-20230926162636-b083397f465c/go.mod h1:vkwlPaUyG+VjTGaqEMVB7UXB8/dFoPduwSqJ1PZZA6c= +github.com/iotaledger/iota.go/v4 v4.0.0-20230927100454-2c0310088757 h1:D7ezZEvaniOUW8biCHVERfRcGktzJfq51kmcQoTWs9A= +github.com/iotaledger/iota.go/v4 v4.0.0-20230927100454-2c0310088757/go.mod h1:vkwlPaUyG+VjTGaqEMVB7UXB8/dFoPduwSqJ1PZZA6c= github.com/ipfs/boxo v0.10.0 h1:tdDAxq8jrsbRkYoF+5Rcqyeb91hgWe2hp7iLu7ORZLY= github.com/ipfs/boxo v0.10.0/go.mod h1:Fg+BnfxZ0RPzR0nOodzdIq3A7KgoWAOWsEIImrIQdBM= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= diff --git a/tools/evil-spammer/go.mod b/tools/evil-spammer/go.mod index ffb3e697d..0e9b8820e 100644 --- a/tools/evil-spammer/go.mod +++ b/tools/evil-spammer/go.mod @@ -17,7 +17,7 @@ require ( github.com/iotaledger/hive.go/runtime v0.0.0-20230926122307-d671b36a4a65 github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 github.com/iotaledger/iota-core/tools/genesis-snapshot v0.0.0-00010101000000-000000000000 - github.com/iotaledger/iota.go/v4 v4.0.0-20230926162636-b083397f465c + github.com/iotaledger/iota.go/v4 v4.0.0-20230927100454-2c0310088757 github.com/mr-tron/base58 v1.2.0 go.uber.org/atomic v1.11.0 ) diff --git a/tools/evil-spammer/go.sum b/tools/evil-spammer/go.sum index ea2b825fc..89d4cbf91 100644 --- a/tools/evil-spammer/go.sum +++ b/tools/evil-spammer/go.sum @@ -195,8 +195,8 @@ github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230926122307-d671b36 github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230926122307-d671b36a4a65/go.mod h1:IJgaaxbgKCsNat18jlJJEAxCY2oVYR3F30B+M4vJ89I= github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65 h1:3OmUR8yYlCENhbosY99eM3bIJQJCiLijtebt+Q6sQEs= github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/iota.go/v4 v4.0.0-20230926162636-b083397f465c h1:VuCRlEpzrQSBf00P6YVW+ykKjVed1kV3bsmiiFrdCyc= -github.com/iotaledger/iota.go/v4 v4.0.0-20230926162636-b083397f465c/go.mod h1:vkwlPaUyG+VjTGaqEMVB7UXB8/dFoPduwSqJ1PZZA6c= +github.com/iotaledger/iota.go/v4 v4.0.0-20230927100454-2c0310088757 h1:D7ezZEvaniOUW8biCHVERfRcGktzJfq51kmcQoTWs9A= +github.com/iotaledger/iota.go/v4 v4.0.0-20230927100454-2c0310088757/go.mod h1:vkwlPaUyG+VjTGaqEMVB7UXB8/dFoPduwSqJ1PZZA6c= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= diff --git a/tools/gendoc/go.mod b/tools/gendoc/go.mod index 86d6fe8b9..8f0b5bcfa 100644 --- a/tools/gendoc/go.mod +++ b/tools/gendoc/go.mod @@ -72,7 +72,7 @@ require ( github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65 // indirect github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230925153303-c7fbe63a0ab4 // indirect github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230925152824-4bfa09b8c132 // indirect - github.com/iotaledger/iota.go/v4 v4.0.0-20230926162636-b083397f465c // indirect + github.com/iotaledger/iota.go/v4 v4.0.0-20230927100454-2c0310088757 // indirect github.com/ipfs/boxo v0.10.0 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-datastore v0.6.0 // indirect diff --git a/tools/gendoc/go.sum b/tools/gendoc/go.sum index 1b7f2b10a..c8f25d976 100644 --- a/tools/gendoc/go.sum +++ b/tools/gendoc/go.sum @@ -311,8 +311,8 @@ github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230925153303-c7fbe63a0ab4 h1:pbw/e github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230925153303-c7fbe63a0ab4/go.mod h1:KbmEuxbhax3fyVrxF4RjBD1/MWLFxHLNDFBnDYUzok4= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230925152824-4bfa09b8c132 h1:YHvgNY3/TRx84UxqizkFe7vVUxAMQB2DOuEL8wjHxpg= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230925152824-4bfa09b8c132/go.mod h1:DIFr5lt73HLIyn/Lg2jtzfakwhIT0mMZjMFFji3GXeI= -github.com/iotaledger/iota.go/v4 v4.0.0-20230926162636-b083397f465c h1:VuCRlEpzrQSBf00P6YVW+ykKjVed1kV3bsmiiFrdCyc= -github.com/iotaledger/iota.go/v4 v4.0.0-20230926162636-b083397f465c/go.mod h1:vkwlPaUyG+VjTGaqEMVB7UXB8/dFoPduwSqJ1PZZA6c= +github.com/iotaledger/iota.go/v4 v4.0.0-20230927100454-2c0310088757 h1:D7ezZEvaniOUW8biCHVERfRcGktzJfq51kmcQoTWs9A= +github.com/iotaledger/iota.go/v4 v4.0.0-20230927100454-2c0310088757/go.mod h1:vkwlPaUyG+VjTGaqEMVB7UXB8/dFoPduwSqJ1PZZA6c= github.com/ipfs/boxo v0.10.0 h1:tdDAxq8jrsbRkYoF+5Rcqyeb91hgWe2hp7iLu7ORZLY= github.com/ipfs/boxo v0.10.0/go.mod h1:Fg+BnfxZ0RPzR0nOodzdIq3A7KgoWAOWsEIImrIQdBM= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= diff --git a/tools/genesis-snapshot/go.mod b/tools/genesis-snapshot/go.mod index d9f982840..727fb5b9f 100644 --- a/tools/genesis-snapshot/go.mod +++ b/tools/genesis-snapshot/go.mod @@ -10,7 +10,7 @@ require ( github.com/iotaledger/hive.go/lo v0.0.0-20230926122307-d671b36a4a65 github.com/iotaledger/hive.go/runtime v0.0.0-20230926122307-d671b36a4a65 github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 - github.com/iotaledger/iota.go/v4 v4.0.0-20230926162636-b083397f465c + github.com/iotaledger/iota.go/v4 v4.0.0-20230927100454-2c0310088757 github.com/mr-tron/base58 v1.2.0 github.com/spf13/pflag v1.0.5 golang.org/x/crypto v0.13.0 diff --git a/tools/genesis-snapshot/go.sum b/tools/genesis-snapshot/go.sum index 164bb51bb..369be7c8e 100644 --- a/tools/genesis-snapshot/go.sum +++ b/tools/genesis-snapshot/go.sum @@ -50,8 +50,8 @@ github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230926122307-d671b36 github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230926122307-d671b36a4a65/go.mod h1:IJgaaxbgKCsNat18jlJJEAxCY2oVYR3F30B+M4vJ89I= github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65 h1:3OmUR8yYlCENhbosY99eM3bIJQJCiLijtebt+Q6sQEs= github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/iota.go/v4 v4.0.0-20230926162636-b083397f465c h1:VuCRlEpzrQSBf00P6YVW+ykKjVed1kV3bsmiiFrdCyc= -github.com/iotaledger/iota.go/v4 v4.0.0-20230926162636-b083397f465c/go.mod h1:vkwlPaUyG+VjTGaqEMVB7UXB8/dFoPduwSqJ1PZZA6c= +github.com/iotaledger/iota.go/v4 v4.0.0-20230927100454-2c0310088757 h1:D7ezZEvaniOUW8biCHVERfRcGktzJfq51kmcQoTWs9A= +github.com/iotaledger/iota.go/v4 v4.0.0-20230927100454-2c0310088757/go.mod h1:vkwlPaUyG+VjTGaqEMVB7UXB8/dFoPduwSqJ1PZZA6c= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= From 9d871be3a69161cbd763bc2031e9c780243ce7bf Mon Sep 17 00:00:00 2001 From: jkrvivian Date: Thu, 28 Sep 2023 13:55:50 +0800 Subject: [PATCH 5/7] Update iota.go version --- go.mod | 2 +- go.sum | 4 ++-- tools/evil-spammer/go.mod | 2 +- tools/evil-spammer/go.sum | 4 ++-- tools/gendoc/go.mod | 2 +- tools/gendoc/go.sum | 4 ++-- tools/genesis-snapshot/go.mod | 2 +- tools/genesis-snapshot/go.sum | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index f4c757b77..833384bb9 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65 github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230927112840-e982cb6707c9 github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230925152824-4bfa09b8c132 - github.com/iotaledger/iota.go/v4 v4.0.0-20230927081440-4c25f83b8c40 + github.com/iotaledger/iota.go/v4 v4.0.0-20230927125610-ddf51789ec4d github.com/labstack/echo/v4 v4.11.1 github.com/labstack/gommon v0.4.0 github.com/libp2p/go-libp2p v0.30.0 diff --git a/go.sum b/go.sum index 9cb8aac5b..9a4199455 100644 --- a/go.sum +++ b/go.sum @@ -305,8 +305,8 @@ github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230927112840-e982cb6707c9 h1:vRGNf github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230927112840-e982cb6707c9/go.mod h1:KbmEuxbhax3fyVrxF4RjBD1/MWLFxHLNDFBnDYUzok4= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230925152824-4bfa09b8c132 h1:YHvgNY3/TRx84UxqizkFe7vVUxAMQB2DOuEL8wjHxpg= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230925152824-4bfa09b8c132/go.mod h1:DIFr5lt73HLIyn/Lg2jtzfakwhIT0mMZjMFFji3GXeI= -github.com/iotaledger/iota.go/v4 v4.0.0-20230927081440-4c25f83b8c40 h1:NwmJf+JBVNZX/EUqRbdzIvfY2taGYJVRqvv7jzsuB3Y= -github.com/iotaledger/iota.go/v4 v4.0.0-20230927081440-4c25f83b8c40/go.mod h1:wR9xBbsofns9hFyRHFZ2bDYIb861qsfmQPVMBKcPvDo= +github.com/iotaledger/iota.go/v4 v4.0.0-20230927125610-ddf51789ec4d h1:lhYbBhVORcS2LLNviaO/yTmom1suDskJLA1wSvvsLiU= +github.com/iotaledger/iota.go/v4 v4.0.0-20230927125610-ddf51789ec4d/go.mod h1:wR9xBbsofns9hFyRHFZ2bDYIb861qsfmQPVMBKcPvDo= github.com/ipfs/boxo v0.10.0 h1:tdDAxq8jrsbRkYoF+5Rcqyeb91hgWe2hp7iLu7ORZLY= github.com/ipfs/boxo v0.10.0/go.mod h1:Fg+BnfxZ0RPzR0nOodzdIq3A7KgoWAOWsEIImrIQdBM= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= diff --git a/tools/evil-spammer/go.mod b/tools/evil-spammer/go.mod index d5e37943c..861cfb4a5 100644 --- a/tools/evil-spammer/go.mod +++ b/tools/evil-spammer/go.mod @@ -17,7 +17,7 @@ require ( github.com/iotaledger/hive.go/runtime v0.0.0-20230926122307-d671b36a4a65 github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 github.com/iotaledger/iota-core/tools/genesis-snapshot v0.0.0-00010101000000-000000000000 - github.com/iotaledger/iota.go/v4 v4.0.0-20230927120336-ea2ee8c85df7 + github.com/iotaledger/iota.go/v4 v4.0.0-20230927125610-ddf51789ec4d github.com/mr-tron/base58 v1.2.0 go.uber.org/atomic v1.11.0 ) diff --git a/tools/evil-spammer/go.sum b/tools/evil-spammer/go.sum index 6c87e4f10..9138a9753 100644 --- a/tools/evil-spammer/go.sum +++ b/tools/evil-spammer/go.sum @@ -195,8 +195,8 @@ github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230926122307-d671b36 github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230926122307-d671b36a4a65/go.mod h1:IJgaaxbgKCsNat18jlJJEAxCY2oVYR3F30B+M4vJ89I= github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65 h1:3OmUR8yYlCENhbosY99eM3bIJQJCiLijtebt+Q6sQEs= github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/iota.go/v4 v4.0.0-20230927120336-ea2ee8c85df7 h1:0ofS8G16U+IBoXjqufCzx10Qgw9koQtzUqu4cXnD2xA= -github.com/iotaledger/iota.go/v4 v4.0.0-20230927120336-ea2ee8c85df7/go.mod h1:wR9xBbsofns9hFyRHFZ2bDYIb861qsfmQPVMBKcPvDo= +github.com/iotaledger/iota.go/v4 v4.0.0-20230927125610-ddf51789ec4d h1:lhYbBhVORcS2LLNviaO/yTmom1suDskJLA1wSvvsLiU= +github.com/iotaledger/iota.go/v4 v4.0.0-20230927125610-ddf51789ec4d/go.mod h1:wR9xBbsofns9hFyRHFZ2bDYIb861qsfmQPVMBKcPvDo= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= diff --git a/tools/gendoc/go.mod b/tools/gendoc/go.mod index b9b519eae..8d65ec86c 100644 --- a/tools/gendoc/go.mod +++ b/tools/gendoc/go.mod @@ -72,7 +72,7 @@ require ( github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65 // indirect github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230927112840-e982cb6707c9 // indirect github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230925152824-4bfa09b8c132 // indirect - github.com/iotaledger/iota.go/v4 v4.0.0-20230927120336-ea2ee8c85df7 // indirect + github.com/iotaledger/iota.go/v4 v4.0.0-20230927125610-ddf51789ec4d // indirect github.com/ipfs/boxo v0.10.0 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-datastore v0.6.0 // indirect diff --git a/tools/gendoc/go.sum b/tools/gendoc/go.sum index 3b219a011..340fab5af 100644 --- a/tools/gendoc/go.sum +++ b/tools/gendoc/go.sum @@ -311,8 +311,8 @@ github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230927112840-e982cb6707c9 h1:vRGNf github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230927112840-e982cb6707c9/go.mod h1:KbmEuxbhax3fyVrxF4RjBD1/MWLFxHLNDFBnDYUzok4= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230925152824-4bfa09b8c132 h1:YHvgNY3/TRx84UxqizkFe7vVUxAMQB2DOuEL8wjHxpg= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230925152824-4bfa09b8c132/go.mod h1:DIFr5lt73HLIyn/Lg2jtzfakwhIT0mMZjMFFji3GXeI= -github.com/iotaledger/iota.go/v4 v4.0.0-20230927120336-ea2ee8c85df7 h1:0ofS8G16U+IBoXjqufCzx10Qgw9koQtzUqu4cXnD2xA= -github.com/iotaledger/iota.go/v4 v4.0.0-20230927120336-ea2ee8c85df7/go.mod h1:wR9xBbsofns9hFyRHFZ2bDYIb861qsfmQPVMBKcPvDo= +github.com/iotaledger/iota.go/v4 v4.0.0-20230927125610-ddf51789ec4d h1:lhYbBhVORcS2LLNviaO/yTmom1suDskJLA1wSvvsLiU= +github.com/iotaledger/iota.go/v4 v4.0.0-20230927125610-ddf51789ec4d/go.mod h1:wR9xBbsofns9hFyRHFZ2bDYIb861qsfmQPVMBKcPvDo= github.com/ipfs/boxo v0.10.0 h1:tdDAxq8jrsbRkYoF+5Rcqyeb91hgWe2hp7iLu7ORZLY= github.com/ipfs/boxo v0.10.0/go.mod h1:Fg+BnfxZ0RPzR0nOodzdIq3A7KgoWAOWsEIImrIQdBM= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= diff --git a/tools/genesis-snapshot/go.mod b/tools/genesis-snapshot/go.mod index efc9e9ef7..b75541880 100644 --- a/tools/genesis-snapshot/go.mod +++ b/tools/genesis-snapshot/go.mod @@ -10,7 +10,7 @@ require ( github.com/iotaledger/hive.go/lo v0.0.0-20230926122307-d671b36a4a65 github.com/iotaledger/hive.go/runtime v0.0.0-20230926122307-d671b36a4a65 github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 - github.com/iotaledger/iota.go/v4 v4.0.0-20230927120336-ea2ee8c85df7 + github.com/iotaledger/iota.go/v4 v4.0.0-20230927125610-ddf51789ec4d github.com/mr-tron/base58 v1.2.0 github.com/spf13/pflag v1.0.5 golang.org/x/crypto v0.13.0 diff --git a/tools/genesis-snapshot/go.sum b/tools/genesis-snapshot/go.sum index 3d48e7240..1b24bf02e 100644 --- a/tools/genesis-snapshot/go.sum +++ b/tools/genesis-snapshot/go.sum @@ -50,8 +50,8 @@ github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230926122307-d671b36 github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230926122307-d671b36a4a65/go.mod h1:IJgaaxbgKCsNat18jlJJEAxCY2oVYR3F30B+M4vJ89I= github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65 h1:3OmUR8yYlCENhbosY99eM3bIJQJCiLijtebt+Q6sQEs= github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/iota.go/v4 v4.0.0-20230927120336-ea2ee8c85df7 h1:0ofS8G16U+IBoXjqufCzx10Qgw9koQtzUqu4cXnD2xA= -github.com/iotaledger/iota.go/v4 v4.0.0-20230927120336-ea2ee8c85df7/go.mod h1:wR9xBbsofns9hFyRHFZ2bDYIb861qsfmQPVMBKcPvDo= +github.com/iotaledger/iota.go/v4 v4.0.0-20230927125610-ddf51789ec4d h1:lhYbBhVORcS2LLNviaO/yTmom1suDskJLA1wSvvsLiU= +github.com/iotaledger/iota.go/v4 v4.0.0-20230927125610-ddf51789ec4d/go.mod h1:wR9xBbsofns9hFyRHFZ2bDYIb861qsfmQPVMBKcPvDo= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= From ff0d6749e0bbdead62bd8af16100a36b2a115683 Mon Sep 17 00:00:00 2001 From: jkrvivian Date: Thu, 28 Sep 2023 14:13:42 +0800 Subject: [PATCH 6/7] Resolve comments --- pkg/tests/accounts_test.go | 2 +- pkg/testsuite/transactions_framework.go | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/pkg/tests/accounts_test.go b/pkg/tests/accounts_test.go index 07ca9d5f2..057e7a51a 100644 --- a/pkg/tests/accounts_test.go +++ b/pkg/tests/accounts_test.go @@ -65,7 +65,7 @@ func Test_TransitionAccount(t *testing.T) { accountInput, accountOutputs, accountWallets := ts.TransactionFramework.TransitionAccount( "Genesis:1", - testsuite.AddBlockIssuerKey(newGenesisOutputKey), + testsuite.WithAddBlockIssuerKey(newGenesisOutputKey), testsuite.WithBlockIssuerExpirySlot(1), ) consumedInputs, equalOutputs, equalWallets := ts.TransactionFramework.CreateBasicOutputsEqually(2, "Genesis:0") diff --git a/pkg/testsuite/transactions_framework.go b/pkg/testsuite/transactions_framework.go index 2de732635..ac9686ca8 100644 --- a/pkg/testsuite/transactions_framework.go +++ b/pkg/testsuite/transactions_framework.go @@ -373,7 +373,7 @@ func WithBlockIssuerFeature(keys iotago.BlockIssuerKeys, expirySlot iotago.SlotI } } -func AddBlockIssuerKey(key iotago.BlockIssuerKey) options.Option[builder.AccountOutputBuilder] { +func WithAddBlockIssuerKey(key iotago.BlockIssuerKey) options.Option[builder.AccountOutputBuilder] { return func(accountBuilder *builder.AccountOutputBuilder) { transition := accountBuilder.GovernanceTransition() transition.BlockIssuerTransition().AddKeys(key) @@ -414,6 +414,25 @@ func WithAccountAmount(amount iotago.BaseToken) options.Option[builder.AccountOu } } +func WithAccountIncreasedFoundryCounter(diff uint32) options.Option[builder.AccountOutputBuilder] { + return func(accountBuilder *builder.AccountOutputBuilder) { + accountBuilder.FoundriesToGenerate(diff) + } +} + +func WithAccountImmutableFeatures(features iotago.AccountOutputImmFeatures) options.Option[builder.AccountOutputBuilder] { + return func(accountBuilder *builder.AccountOutputBuilder) { + for _, feature := range features.MustSet() { + switch feature.Type() { + case iotago.FeatureMetadata: + accountBuilder.ImmutableMetadata(feature.(*iotago.MetadataFeature).Data) + case iotago.FeatureSender: + accountBuilder.ImmutableSender(feature.(*iotago.SenderFeature).Address) + } + } + } +} + func WithAccountConditions(conditions iotago.AccountOutputUnlockConditions) options.Option[builder.AccountOutputBuilder] { return func(accountBuilder *builder.AccountOutputBuilder) { for _, condition := range conditions.MustSet() { From 4c293fc4c92b558a4017a29776d9d703ef42a3e1 Mon Sep 17 00:00:00 2001 From: jkrvivian Date: Thu, 28 Sep 2023 14:37:26 +0800 Subject: [PATCH 7/7] Add nolint:forcetypeassert --- pkg/testsuite/transactions_framework.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/testsuite/transactions_framework.go b/pkg/testsuite/transactions_framework.go index ac9686ca8..eea7bc2e7 100644 --- a/pkg/testsuite/transactions_framework.go +++ b/pkg/testsuite/transactions_framework.go @@ -425,8 +425,10 @@ func WithAccountImmutableFeatures(features iotago.AccountOutputImmFeatures) opti for _, feature := range features.MustSet() { switch feature.Type() { case iotago.FeatureMetadata: + //nolint:forcetypeassert accountBuilder.ImmutableMetadata(feature.(*iotago.MetadataFeature).Data) case iotago.FeatureSender: + //nolint:forcetypeassert accountBuilder.ImmutableSender(feature.(*iotago.SenderFeature).Address) } } @@ -438,8 +440,10 @@ func WithAccountConditions(conditions iotago.AccountOutputUnlockConditions) opti for _, condition := range conditions.MustSet() { switch condition.Type() { case iotago.UnlockConditionStateControllerAddress: + //nolint:forcetypeassert accountBuilder.StateController(condition.(*iotago.StateControllerAddressUnlockCondition).Address) case iotago.UnlockConditionGovernorAddress: + //nolint:forcetypeassert accountBuilder.Governor(condition.(*iotago.GovernorAddressUnlockCondition).Address) } }