-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: return public key type #533
Conversation
- Adds skeleton for sending substrate transactions functionality - Example code that actually can send a transaction on edgeware test network (see Test_SubstrateCallExample)
- Removes subkey dependency - Coarse grained verify usage for testing singer sing method
opened against incorrect branch |
Xt types.Extrinsic | ||
} | ||
|
||
//func New(address string) (*SubstrateRPC, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commentFormatting: put a space between //
and comment text (from gocritic
)
|
||
func (e Signer) createSignature(signedData []byte) (*types.MultiSignature, error) { | ||
sig := types.NewSignature(signedData) | ||
switch e.privateKey.(type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type switch statements should only be cuddled with variables switched (from wsl
)
if err != nil { | ||
return nil, err | ||
} | ||
era := opts.Era |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assignments should only be cuddled with other assignments (from wsl
)
return nil, err | ||
} | ||
era := opts.Era | ||
if !opts.Era.IsMortalEra { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only one cuddle assignment allowed before if statement (from wsl
)
if !opts.Era.IsMortalEra { | ||
era = types.ExtrinsicEra{IsImmortalEra: true} | ||
} | ||
payload := types.ExtrinsicPayloadV3{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assignments should only be cuddled with other assignments (from wsl
)
return nil, err | ||
} | ||
signedData, err := e.privateKey.Sign(data) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only one cuddle assignment allowed before if statement (from wsl
)
return nil, err | ||
} | ||
signature, err := e.createSignature(signedData) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only one cuddle assignment allowed before if statement (from wsl
)
ext := &opts.Extrinsic | ||
ext.Signature = extSig | ||
ext.Version |= types.ExtrinsicBitSigned | ||
return ext, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return statements should not be cuddled if block has more than two lines (from wsl
)
if (blockHash == types.Hash{}) { | ||
return s.api.RPC.State.GetMetadataLatest() | ||
} | ||
return s.api.RPC.State.GetMetadata(blockHash) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return statements should not be cuddled if block has more than two lines (from wsl
)
} | ||
|
||
func (s SubstrateClient) SuggestGasPrice(ctx context.Context) (*big.Int, error) { | ||
return big.NewInt(32000), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mnd: Magic number: 32000, in detected (from gomnd
)
fixes #381