Skip to content

Commit

Permalink
Remove signing-service references
Browse files Browse the repository at this point in the history
  • Loading branch information
marino39 committed Jan 15, 2024
1 parent c42599e commit 6fd278e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 233 deletions.
38 changes: 0 additions & 38 deletions guard/guard.go

This file was deleted.

131 changes: 0 additions & 131 deletions guard/guard_test.go

This file was deleted.

64 changes: 0 additions & 64 deletions wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"math/big"

"github.com/0xsequence/ethkit"
"github.com/0xsequence/ethkit/ethcoder"
"github.com/0xsequence/ethkit/ethrpc"
"github.com/0xsequence/ethkit/ethtxn"
Expand All @@ -15,8 +14,6 @@ import (
v1 "github.com/0xsequence/go-sequence/core/v1"
v2 "github.com/0xsequence/go-sequence/core/v2"
"github.com/0xsequence/go-sequence/sessions/proto"
"github.com/0xsequence/go-sequence/signing_service"
proto_signing_service "github.com/0xsequence/go-sequence/signing_service/proto"
)

type WalletOptions[C core.WalletConfig] struct {
Expand Down Expand Up @@ -428,16 +425,6 @@ func (w *Wallet[C]) GetTransactionCount(optBlockNum ...*big.Int) (*big.Int, erro

func (w *Wallet[C]) SignMessage(msg []byte) ([]byte, error) {
ctx := context.Background()

signContext := signing_service.SignContextFromContext(ctx)
if signContext == nil {
signContext = &proto_signing_service.SignContext{}
ctx = signing_service.ContextWithSignContext(ctx, signContext)
}

signContext.WalletAddress = ethkit.ToPtr(w.address.Hex())
signContext.Message = ethkit.ToPtr(string(msg))

return w.SignDigest(ctx, MessageDigest(msg))
}

Expand All @@ -463,17 +450,6 @@ func (w *Wallet[C]) SignDigest(ctx context.Context, digest common.Hash, optChain
chainID = w.chainID
}

signContext := signing_service.SignContextFromContext(ctx)
if signContext == nil {
signContext = &proto_signing_service.SignContext{}
signContext.WalletAddress = ethkit.ToPtr(w.address.Hex())
ctx = signing_service.ContextWithSignContext(ctx, signContext)
}

signContext.PreImage = digest.Hex()
signContext.SigneeWalletAddress = w.address.Hex()
signContext.ChainId = chainID.Uint64()

subDigest, err := SubDigest(chainID, w.Address(), digest)
if err != nil {
return nil, fmt.Errorf("SignDigest, subDigestOf: %w", err)
Expand All @@ -488,28 +464,6 @@ func (w *Wallet[C]) SignDigest(ctx context.Context, digest common.Hash, optChain
return 0, nil, core.ErrSigningNoSigner
}

var signCtx = signing_service.SignContextFromContext(ctx)
if signCtx != nil {
signCtx = signing_service.SignContextCopy(signCtx)
ctx = signing_service.ContextWithSignContext(ctx, signCtx)
}

// add the signature to the aux data if available
if len(signatures) != 0 {
if signCtx != nil {
signature := signatures[0]
sig, _, _ := w.buildSignature(ctx, func(ctx context.Context, signer common.Address, signatures []core.SignerSignature) (core.SignerSignatureType, []byte, error) {
if signer == signature.Signer {
return signature.Type, signature.Signature, nil
} else {
return 0, nil, core.ErrSigningNoSigner
}
})

signCtx.Signature = ethcoder.HexEncode(sig)
}
}

switch signerTyped := signer.(type) {
// sequence.Wallet / Signing Service / Guard
case DigestSigner:
Expand Down Expand Up @@ -598,24 +552,6 @@ func (w *Wallet[C]) SignTransactions(ctx context.Context, txns Transactions) (*S
return nil, err
}

// Set SignContext
signContext := signing_service.SignContextFromContext(ctx)
if signContext == nil {
signContext = &proto_signing_service.SignContext{}
ctx = signing_service.ContextWithSignContext(ctx, signContext)
}

signContext.Nonce = ethkit.ToPtr(nonce.Uint64())
signContext.WalletAddress = ethkit.ToPtr(w.Address().Hex())
signContext.ChainId = w.chainID.Uint64()

encTxn, err := txns.EncodeRaw()
if err != nil {
return nil, err
}

signContext.Transactions = ethkit.ToPtr(ethcoder.HexEncode(encTxn))

// Sign the transactions
sig, err := w.SignDigest(ctx, digest)
if err != nil {
Expand Down

0 comments on commit 6fd278e

Please sign in to comment.