Documentation
¶
Overview ¶
****************************************************************************** * (c) 2020 Zondax GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************
Index ¶
- type MultisigPaymentParams
- type MultisigPaymentRequest
- type PaymentRequest
- type RemoveAuthorizedPartyParams
- type RemoveAuthorizedPartyRequest
- type RosettaConstructionFilecoin
- func (r RosettaConstructionFilecoin) ConstructMultisigPayment(request *MultisigPaymentRequest, destinationActorId cid.Cid) (string, error)
- func (r RosettaConstructionFilecoin) ConstructPayment(request *PaymentRequest) (string, error)
- func (r RosettaConstructionFilecoin) ConstructRemoveAuthorizedParty(request *RemoveAuthorizedPartyRequest, destinationActorId cid.Cid) (string, error)
- func (r RosettaConstructionFilecoin) ConstructSwapAuthorizedParty(request *SwapAuthorizedPartyRequest, destinationActorId cid.Cid) (string, error)
- func (r RosettaConstructionFilecoin) DeriveFromPublicKey(publicKey []byte, network filAddr.Network) (string, error)
- func (r RosettaConstructionFilecoin) EncodeTx(unsignedTxJson string) ([]byte, error)
- func (r RosettaConstructionFilecoin) Hash(signedMessage string) (string, error)
- func (r RosettaConstructionFilecoin) ParseParamsMultisigTx(unsignedMultisigTx string, destinationActorId cid.Cid) (string, error)
- func (r RosettaConstructionFilecoin) ParseTx(messageCbor []byte) (string, error)
- func (r RosettaConstructionFilecoin) SignRaw(message []byte, sk []byte) ([]byte, error)
- func (r RosettaConstructionFilecoin) SignTx(unsignedTx []byte, privateKey []byte) ([]byte, error)
- func (r RosettaConstructionFilecoin) SignTxJSON(unsignedTxJson string, privateKey []byte) (string, error)
- func (r RosettaConstructionFilecoin) VerifyRaw(message []byte, publicKey []byte, signature []byte) error
- type RosettaConstructionTool
- type SwapAuthorizedPartyParams
- type SwapAuthorizedPartyRequest
- type TxMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MultisigPaymentParams ¶
MultisigPaymentParams defines params for MultisigPaymentRequest
type MultisigPaymentRequest ¶
type MultisigPaymentRequest struct {
Multisig string `json:"multisig"`
From string `json:"from"`
Quantity string `json:"quantity"`
Metadata TxMetadata `json:"metadata"`
Params MultisigPaymentParams `json:"params"`
}
MultisigPaymentRequest defines the input to ConstructMultisigPayment
type PaymentRequest ¶
type PaymentRequest struct {
From string `json:"from"`
To string `json:"to"`
Quantity string `json:"quantity"`
Metadata TxMetadata `json:"metadata"`
}
PaymentRequest defines the input to ConstructPayment
type RemoveAuthorizedPartyParams ¶ added in v1.102.0
type RemoveAuthorizedPartyParams struct {
ToRemove string `json:"toRemove"`
Decrease bool `json:"decrease"`
}
RemoveAuthorizedPartyParams defines the params
type RemoveAuthorizedPartyRequest ¶ added in v1.102.0
type RemoveAuthorizedPartyRequest struct {
Multisig string `json:"multisig"`
From string `json:"from"`
Metadata TxMetadata `json:"metadata"`
Params RemoveAuthorizedPartyParams `json:"params"`
}
RemoveAuthorizedPartyRequest defines the input to ConstructRemoveAuthorizedParty
type RosettaConstructionFilecoin ¶
type RosettaConstructionFilecoin struct {
Mainnet bool
}
func (RosettaConstructionFilecoin) ConstructMultisigPayment ¶
func (r RosettaConstructionFilecoin) ConstructMultisigPayment(request *MultisigPaymentRequest, destinationActorId cid.Cid) (string, error)
func (RosettaConstructionFilecoin) ConstructPayment ¶
func (r RosettaConstructionFilecoin) ConstructPayment(request *PaymentRequest) (string, error)
func (RosettaConstructionFilecoin) ConstructRemoveAuthorizedParty ¶ added in v1.102.0
func (r RosettaConstructionFilecoin) ConstructRemoveAuthorizedParty(request *RemoveAuthorizedPartyRequest, destinationActorId cid.Cid) (string, error)
func (RosettaConstructionFilecoin) ConstructSwapAuthorizedParty ¶
func (r RosettaConstructionFilecoin) ConstructSwapAuthorizedParty(request *SwapAuthorizedPartyRequest, destinationActorId cid.Cid) (string, error)
func (RosettaConstructionFilecoin) DeriveFromPublicKey ¶
func (RosettaConstructionFilecoin) EncodeTx ¶ added in v0.8.1
func (r RosettaConstructionFilecoin) EncodeTx(unsignedTxJson string) ([]byte, error)
func (RosettaConstructionFilecoin) Hash ¶
func (r RosettaConstructionFilecoin) Hash(signedMessage string) (string, error)
func (RosettaConstructionFilecoin) ParseParamsMultisigTx ¶ added in v0.8.1
func (r RosettaConstructionFilecoin) ParseParamsMultisigTx(unsignedMultisigTx string, destinationActorId cid.Cid) (string, error)
func (RosettaConstructionFilecoin) ParseTx ¶
func (r RosettaConstructionFilecoin) ParseTx(messageCbor []byte) (string, error)
func (RosettaConstructionFilecoin) SignRaw ¶ added in v0.8.1
func (r RosettaConstructionFilecoin) SignRaw(message []byte, sk []byte) ([]byte, error)
func (RosettaConstructionFilecoin) SignTx ¶
func (r RosettaConstructionFilecoin) SignTx(unsignedTx []byte, privateKey []byte) ([]byte, error)
func (RosettaConstructionFilecoin) SignTxJSON ¶ added in v0.8.1
func (r RosettaConstructionFilecoin) SignTxJSON(unsignedTxJson string, privateKey []byte) (string, error)
type RosettaConstructionTool ¶
type RosettaConstructionTool interface {
// DeriveFromPublicKey defines the function to derive the address from an public key (secp256k1)
// @return
// - derivedAddress [string]
// - error when deriving address from the public key
DeriveFromPublicKey(publicKey []byte, network address.Network) (string, error)
// Sign defines the function to sign an arbitrary message with the secret key (secp256k1)
// @message [[]byte] a digest
// @return (secp256k1)
// - signature [string] the signature after the message is signed with the private key
// - error when signing a message
SignRaw(message []byte, sk []byte) ([]byte, error)
// Verify defines the function to verify the signature of an arbitrary message with the public key (secp256k1)
// @message [[]byte] a digest
// @return
// - error if invalid signature
VerifyRaw(message []byte, publicKey []byte, signature []byte) error
// ConstructPayment creates transaction for a normal send
// @return
// - unsigned transaction as json [string]
// - error while constructing the normal send transaction
ConstructPayment(request *PaymentRequest) (string, error)
// ConstructMultisigPayment creates transaction for a multisig send
// @return
// - unsigned transaction as json [string]
// - error while constructing the multisig send transaction
ConstructMultisigPayment(request *MultisigPaymentRequest, destinationActorId cid.Cid) (string, error)
// ConstructSwapAuthorizedParty creates transaction for a multisig SwapAuthorizedParty call
// @return
// - unsigned transaction as json [string]
// - error while constructing the multisig SwapAuthorizedParty call
ConstructSwapAuthorizedParty(request *MultisigPaymentRequest, destinationActorId cid.Cid) (string, error)
// ConstructRemoveAuthorizedParty creates transaction for a multisig RemoveAuthorizedParty call
// @return
// - unsigned transaction as json [string]
// - error while constructing the multisig RemoveAuthorizedParty call
ConstructRemoveAuthorizedParty(request *MultisigPaymentRequest, destinationActorId cid.Cid) (string, error)
// SignTx signs an unsignedTx (CBOR) using the secret key (secp256k1) and returns a signedTx
// @unsignedTransaction [string] unsigned transaction as CBOR
// @sk [[]byte] secp256k1 secret key
// @return
// - signedTx [string] the signed transaction as CBOR
// - error when signing a transaction
SignTx(unsignedTx []byte, sk []byte) ([]byte, error)
// SignTxJSON signs an unsignedTx (JSON) using the secret key (secp256k1) and return a signedTx
// @unsignedTransaction [string] unsigned transaction as JSON
// @sk [[]byte] secp256k1 secret key
// @return
// - signedTx [string] the signed transaction
// - error when signing a transaction
SignTxJSON(unsignedTransaction string, sk []byte) (string, error)
// ParseTx parses CBOR encoded transaction
// @tx [[]byte] signed or unsigned transaction CBOR encoded
// @return
// - message [string] the parsed transaction (message or unsigned message) represented as a JSON string
// - error when parsing a transaction
ParseTx(messageCbor []byte) (string, error)
// ParseParamsMultisigTx parses a JSON encoded transaction and decodes actor paramss assuming the destination
// address correspond to a multisig actor
// @tx [string] signed or unsigned transaction JSON encoded
// @return
// - message [string] the parsed params represented as a JSON string
// - error when parsing a transaction
ParseParamsMultisigTx(message string, destinationActorId cid.Cid) (string, error)
// Hash defines the function to calculate a tx hash
// @signedTx [string] base64 encoded signed transaction
// @return
// - txHash [string] transaction hash
// - error when calculating the tx hash
Hash(signedTx string) (string, error)
}
type SwapAuthorizedPartyParams ¶
SwapAuthorizedPartyParams defines the params
type SwapAuthorizedPartyRequest ¶
type SwapAuthorizedPartyRequest struct {
Multisig string `json:"multisig"`
From string `json:"from"`
Metadata TxMetadata `json:"metadata"`
Params SwapAuthorizedPartyParams `json:"params"`
}
SwapAuthorizedPartyRequest defines the input to ConstructSwapAuthorizedParty
type TxMetadata ¶
type TxMetadata struct {
Nonce uint64 `json:"nonce"`
GasFeeCap string `json:"gasFeeCap"`
GasPremium string `json:"gasPremium"`
GasLimit int64 `json:"gasLimit,omitempty"`
ChainID string `json:"chainId,omitempty"`
Method uint64 `json:"method,omitempty"`
Params []byte `json:"params,omitempty"`
}
Modify this as needed to add in new fields