@@ -8,13 +8,12 @@ import (
88 "fmt"
99 "math/big"
1010 "strconv"
11- "strings"
1211
1312 "github.com/google/uuid"
1413 "github.com/sirupsen/logrus"
1514 "github.com/vultisig/mobile-tss-lib/tss"
1615 "github.com/vultisig/plugin/common"
17- "github.com/vultisig/recipes/chain "
16+ rcommon "github.com/vultisig/recipes/common "
1817 "github.com/vultisig/recipes/engine"
1918 reth "github.com/vultisig/recipes/ethereum"
2019 resolver "github.com/vultisig/recipes/resolver"
@@ -83,12 +82,6 @@ func (fp *FeePlugin) proposeTransactions(ctx context.Context, policy vtypes.Plug
8382 }
8483 magicConstantRecipientValue = rtypes .MagicConstant (iv )
8584 }
86- if constraint .ParameterName == "token" {
87- if constraint .Constraint .Type != rtypes .ConstraintType_CONSTRAINT_TYPE_FIXED {
88- return nil , fmt .Errorf ("token constraint is not a fixed value" )
89- }
90- token = constraint .Constraint .GetFixedValue ()
91- }
9285 }
9386 default :
9487 return nil , fmt .Errorf ("unsupported rule: %v" , rule .Id )
@@ -248,27 +241,16 @@ func (fp *FeePlugin) ValidateProposedTransactions(policy vtypes.PluginPolicy, tx
248241 // Validate each proposed transaction
249242 for _ , tx := range txs {
250243 for _ , keysignMessage := range tx .Messages {
251- // Get the chain for the transaction
252- messageChain , err := chain .GetChain (strings .ToLower (keysignMessage .Chain .String ()))
244+ txBytes , err := base64 .StdEncoding .DecodeString (keysignMessage .Message )
253245 if err != nil {
254- return fmt .Errorf ("failed to get chain: %w" , err )
255- }
256-
257- // Parse the transaction to validate its structure
258- decodedTx , err := messageChain .ParseTransaction (keysignMessage .Message )
259- if err != nil {
260- return fmt .Errorf ("failed to parse transaction: %w" , err )
246+ return fmt .Errorf ("failed to decode transaction: %w" , err )
261247 }
262248
263249 // Evaluate if the transaction is allowed by the policy
264- transactionAllowed , _ , err : = eng .Evaluate (recipe , messageChain , decodedTx )
250+ _ , err = eng .Evaluate (recipe , rcommon . Chain ( keysignMessage . Chain ), txBytes )
265251 if err != nil {
266252 return fmt .Errorf ("failed to evaluate transaction: %w" , err )
267253 }
268-
269- if ! transactionAllowed {
270- return fmt .Errorf ("transaction %s on %s not allowed by policy" , keysignMessage .Hash , keysignMessage .Chain )
271- }
272254 }
273255 }
274256
0 commit comments