Documentation ¶
Overview ¶
Package solana privides structures and constants that are used when interacting with the gateway program on Solana chain.
Index ¶
- Constants
- Variables
- func ParseGatewayWithPDA(gatewayAddress string) (solana.PublicKey, solana.PublicKey, error)
- func RecoverSigner(msgHash []byte, msgSig []byte) (signer common.Address, err error)
- func RentPayerPDA(gateway solana.PublicKey) (solana.PublicKey, error)
- type Account
- type Arg
- type Deposit
- type DepositInstructionParams
- type DepositSPLInstructionParams
- type Error
- type Field
- type IDL
- type InitializeParams
- type InitializeRentPayerParams
- type Instruction
- type Metadata
- type MsgWhitelist
- func (msg *MsgWhitelist) ChainID() uint64
- func (msg *MsgWhitelist) Hash() [32]byte
- func (msg *MsgWhitelist) Nonce() uint64
- func (msg *MsgWhitelist) SetSignature(signature [65]byte) *MsgWhitelist
- func (msg *MsgWhitelist) SigRS() [64]byte
- func (msg *MsgWhitelist) SigRSV() [65]byte
- func (msg *MsgWhitelist) SigV() uint8
- func (msg *MsgWhitelist) Signer() (common.Address, error)
- func (msg *MsgWhitelist) WhitelistCandidate() solana.PublicKey
- func (msg *MsgWhitelist) WhitelistEntry() solana.PublicKey
- type MsgWithdraw
- func (msg *MsgWithdraw) Amount() uint64
- func (msg *MsgWithdraw) ChainID() uint64
- func (msg *MsgWithdraw) Hash() [32]byte
- func (msg *MsgWithdraw) Nonce() uint64
- func (msg *MsgWithdraw) SetSignature(signature [65]byte) *MsgWithdraw
- func (msg *MsgWithdraw) SigRS() [64]byte
- func (msg *MsgWithdraw) SigRSV() [65]byte
- func (msg *MsgWithdraw) SigV() uint8
- func (msg *MsgWithdraw) Signer() (common.Address, error)
- func (msg *MsgWithdraw) To() solana.PublicKey
- type MsgWithdrawSPL
- func (msg *MsgWithdrawSPL) Amount() uint64
- func (msg *MsgWithdrawSPL) ChainID() uint64
- func (msg *MsgWithdrawSPL) Decimals() uint8
- func (msg *MsgWithdrawSPL) Hash() [32]byte
- func (msg *MsgWithdrawSPL) MintAccount() solana.PublicKey
- func (msg *MsgWithdrawSPL) Nonce() uint64
- func (msg *MsgWithdrawSPL) RecipientAta() solana.PublicKey
- func (msg *MsgWithdrawSPL) SetSignature(signature [65]byte) *MsgWithdrawSPL
- func (msg *MsgWithdrawSPL) SigRS() [64]byte
- func (msg *MsgWithdrawSPL) SigRSV() [65]byte
- func (msg *MsgWithdrawSPL) SigV() uint8
- func (msg *MsgWithdrawSPL) Signer() (common.Address, error)
- func (msg *MsgWithdrawSPL) To() solana.PublicKey
- type OutboundInstruction
- type PDA
- type PdaInfo
- type Seed
- type Type
- type TypeField
- type WhitelistInstructionParams
- type WithdrawInstructionParams
- type WithdrawSPLInstructionParams
Constants ¶
const ( // PDASeed is the seed for the Solana gateway program derived address PDASeed = "meta" // RentPayerPDASeed is the seed for the Solana gateway program derived address RentPayerPDASeed = "rent-payer" )
const (
// MaxSignaturesPerTicker is the maximum number of signatures to process on a ticker
MaxSignaturesPerTicker = 100
)
Variables ¶
var ( // DiscriminatorInitialize returns the discriminator for Solana gateway 'initialize' instruction DiscriminatorInitialize = idlgateway.IDLGateway.GetDiscriminator("initialize") // DiscriminatorInitializeRentPayer returns the discriminator for Solana gateway 'initialize_rent_payer' instruction DiscriminatorInitializeRentPayer = idlgateway.IDLGateway.GetDiscriminator("initialize_rent_payer") // DiscriminatorDeposit returns the discriminator for Solana gateway 'deposit' instruction DiscriminatorDeposit = idlgateway.IDLGateway.GetDiscriminator("deposit") // DiscriminatorDepositSPL returns the discriminator for Solana gateway 'deposit_spl_token' instruction DiscriminatorDepositSPL = idlgateway.IDLGateway.GetDiscriminator("deposit_spl_token") // DiscriminatorWithdraw returns the discriminator for Solana gateway 'withdraw' instruction DiscriminatorWithdraw = idlgateway.IDLGateway.GetDiscriminator("withdraw") // DiscriminatorWithdrawSPL returns the discriminator for Solana gateway 'withdraw_spl_token' instruction DiscriminatorWithdrawSPL = idlgateway.IDLGateway.GetDiscriminator("withdraw_spl_token") // DiscriminatorWhitelist returns the discriminator for Solana gateway 'whitelist_spl_mint' instruction DiscriminatorWhitelistSplMint = idlgateway.IDLGateway.GetDiscriminator("whitelist_spl_mint") )
Functions ¶
func ParseGatewayWithPDA ¶
ParseGatewayWithPDA parses the gateway id and program derived address from the given string
func RecoverSigner ¶
RecoverSigner recover the ECDSA signer from given message hash and signature
func RentPayerPDA ¶
func RentPayerPDA(gateway solana.PublicKey) (solana.PublicKey, error)
ParseRentPayerPDA parses the rent payer program derived address from the given string
Types ¶
type Deposit ¶
type DepositInstructionParams ¶
type DepositInstructionParams struct { // Discriminator is the unique identifier for the deposit instruction Discriminator [8]byte // Amount is the lamports amount for the deposit Amount uint64 // Memo is the memo for the deposit Memo []byte }
DepositInstructionParams contains the parameters for a gateway deposit instruction
type DepositSPLInstructionParams ¶
type DepositSPLInstructionParams struct { // Discriminator is the unique identifier for the deposit instruction Discriminator [8]byte // Amount is the lamports amount for the deposit Amount uint64 // Memo is the memo for the deposit Memo []byte }
DepositSPLInstructionParams contains the parameters for a gateway deposit spl instruction
type InitializeParams ¶
type InitializeParams struct { // Discriminator is the unique identifier for the initialize instruction Discriminator [8]byte // TssAddress is the TSS address TssAddress [20]byte // ChainID is the chain ID for the gateway program ChainID uint64 }
InitializeParams contains the parameters for a gateway initialize instruction
type InitializeRentPayerParams ¶
type InitializeRentPayerParams struct { // Discriminator is the unique identifier for the initialize_rent_payer instruction Discriminator [8]byte }
InitializeRentPayerParams contains the parameters for a gateway initialize_rent_payer instruction
type Instruction ¶
type MsgWhitelist ¶
type MsgWhitelist struct {
// contains filtered or unexported fields
}
MsgWhitelist is the message for the Solana gateway whitelist_spl_mint instruction
func NewMsgWhitelist ¶
func NewMsgWhitelist( whitelistCandidate solana.PublicKey, whitelistEntry solana.PublicKey, chainID, nonce uint64, ) *MsgWhitelist
NewMsgWhitelist returns a new whitelist_spl_mint message
func (*MsgWhitelist) ChainID ¶
func (msg *MsgWhitelist) ChainID() uint64
ChainID returns the chain ID of the message
func (*MsgWhitelist) Hash ¶
func (msg *MsgWhitelist) Hash() [32]byte
Hash packs the whitelist message and computes the hash
func (*MsgWhitelist) Nonce ¶
func (msg *MsgWhitelist) Nonce() uint64
Nonce returns the nonce of the message
func (*MsgWhitelist) SetSignature ¶
func (msg *MsgWhitelist) SetSignature(signature [65]byte) *MsgWhitelist
SetSignature attaches the signature to the message
func (*MsgWhitelist) SigRS ¶
func (msg *MsgWhitelist) SigRS() [64]byte
SigRS returns the 64-byte [R+S] core part of the signature
func (*MsgWhitelist) SigRSV ¶
func (msg *MsgWhitelist) SigRSV() [65]byte
SigRSV returns the full 65-byte [R+S+V] signature
func (*MsgWhitelist) SigV ¶
func (msg *MsgWhitelist) SigV() uint8
SigV returns the V part (recovery ID) of the signature
func (*MsgWhitelist) Signer ¶
func (msg *MsgWhitelist) Signer() (common.Address, error)
Signer returns the signer of the message
func (*MsgWhitelist) WhitelistCandidate ¶
func (msg *MsgWhitelist) WhitelistCandidate() solana.PublicKey
To returns the recipient address of the message
func (*MsgWhitelist) WhitelistEntry ¶
func (msg *MsgWhitelist) WhitelistEntry() solana.PublicKey
type MsgWithdraw ¶
type MsgWithdraw struct {
// contains filtered or unexported fields
}
MsgWithdraw is the message for the Solana gateway withdraw instruction
func NewMsgWithdraw ¶
func NewMsgWithdraw(chainID, nonce, amount uint64, to solana.PublicKey) *MsgWithdraw
NewMsgWithdraw returns a new withdraw message
func (*MsgWithdraw) Amount ¶
func (msg *MsgWithdraw) Amount() uint64
Amount returns the amount of the message
func (*MsgWithdraw) ChainID ¶
func (msg *MsgWithdraw) ChainID() uint64
ChainID returns the chain ID of the message
func (*MsgWithdraw) Hash ¶
func (msg *MsgWithdraw) Hash() [32]byte
Hash packs the withdraw message and computes the hash
func (*MsgWithdraw) Nonce ¶
func (msg *MsgWithdraw) Nonce() uint64
Nonce returns the nonce of the message
func (*MsgWithdraw) SetSignature ¶
func (msg *MsgWithdraw) SetSignature(signature [65]byte) *MsgWithdraw
SetSignature attaches the signature to the message
func (*MsgWithdraw) SigRS ¶
func (msg *MsgWithdraw) SigRS() [64]byte
SigRS returns the 64-byte [R+S] core part of the signature
func (*MsgWithdraw) SigRSV ¶
func (msg *MsgWithdraw) SigRSV() [65]byte
SigRSV returns the full 65-byte [R+S+V] signature
func (*MsgWithdraw) SigV ¶
func (msg *MsgWithdraw) SigV() uint8
SigV returns the V part (recovery ID) of the signature
func (*MsgWithdraw) Signer ¶
func (msg *MsgWithdraw) Signer() (common.Address, error)
Signer returns the signer of the message
func (*MsgWithdraw) To ¶
func (msg *MsgWithdraw) To() solana.PublicKey
To returns the recipient address of the message
type MsgWithdrawSPL ¶
type MsgWithdrawSPL struct {
// contains filtered or unexported fields
}
MsgWithdrawSPL is the message for the Solana gateway withdraw_spl instruction
func NewMsgWithdrawSPL ¶
func NewMsgWithdrawSPL( chainID, nonce, amount uint64, decimals uint8, mintAccount, to, toAta solana.PublicKey, ) *MsgWithdrawSPL
NewMsgWithdrawSPL returns a new withdraw spl message
func (*MsgWithdrawSPL) Amount ¶
func (msg *MsgWithdrawSPL) Amount() uint64
Amount returns the amount of the message
func (*MsgWithdrawSPL) ChainID ¶
func (msg *MsgWithdrawSPL) ChainID() uint64
ChainID returns the chain ID of the message
func (*MsgWithdrawSPL) Decimals ¶
func (msg *MsgWithdrawSPL) Decimals() uint8
func (*MsgWithdrawSPL) Hash ¶
func (msg *MsgWithdrawSPL) Hash() [32]byte
Hash packs the withdraw spl message and computes the hash
func (*MsgWithdrawSPL) MintAccount ¶
func (msg *MsgWithdrawSPL) MintAccount() solana.PublicKey
func (*MsgWithdrawSPL) Nonce ¶
func (msg *MsgWithdrawSPL) Nonce() uint64
Nonce returns the nonce of the message
func (*MsgWithdrawSPL) RecipientAta ¶
func (msg *MsgWithdrawSPL) RecipientAta() solana.PublicKey
func (*MsgWithdrawSPL) SetSignature ¶
func (msg *MsgWithdrawSPL) SetSignature(signature [65]byte) *MsgWithdrawSPL
SetSignature attaches the signature to the message
func (*MsgWithdrawSPL) SigRS ¶
func (msg *MsgWithdrawSPL) SigRS() [64]byte
SigRS returns the 64-byte [R+S] core part of the signature
func (*MsgWithdrawSPL) SigRSV ¶
func (msg *MsgWithdrawSPL) SigRSV() [65]byte
SigRSV returns the full 65-byte [R+S+V] signature
func (*MsgWithdrawSPL) SigV ¶
func (msg *MsgWithdrawSPL) SigV() uint8
SigV returns the V part (recovery ID) of the signature
func (*MsgWithdrawSPL) Signer ¶
func (msg *MsgWithdrawSPL) Signer() (common.Address, error)
Signer returns the signer of the message
func (*MsgWithdrawSPL) To ¶
func (msg *MsgWithdrawSPL) To() solana.PublicKey
To returns the recipient address of the message
type OutboundInstruction ¶
type OutboundInstruction interface { // Signer returns the signer of the instruction Signer() (common.Address, error) // GatewayNonce returns the nonce of the instruction GatewayNonce() uint64 // TokenAmount returns the amount of the instruction TokenAmount() uint64 }
OutboundInstruction is the interface for all gateway outbound instructions
type PdaInfo ¶
type PdaInfo struct { // Discriminator is the unique identifier for the PDA Discriminator [8]byte // Nonce is the current nonce for the PDA Nonce uint64 // TssAddress is the TSS address for the PDA TssAddress [20]byte // Authority is the authority for the PDA Authority [32]byte // ChainId is the Solana chain id ChainID uint64 }
PdaInfo represents the PDA for the gateway program
type WhitelistInstructionParams ¶
type WhitelistInstructionParams struct { // Discriminator is the unique identifier for the whitelist instruction Discriminator [8]byte // Signature is the ECDSA signature (by TSS) for the whitelist Signature [64]byte // RecoveryID is the recovery ID used to recover the public key from ECDSA signature RecoveryID uint8 // MessageHash is the hash of the message signed by TSS MessageHash [32]byte // Nonce is the nonce for the whitelist Nonce uint64 }
WhitelistInstructionParams contains the parameters for a gateway whitelist_spl_mint instruction
func ParseInstructionWhitelist ¶
func ParseInstructionWhitelist(instruction solana.CompiledInstruction) (*WhitelistInstructionParams, error)
ParseInstructionWhitelist tries to parse the instruction as a 'whitelist_spl_mint'. It returns nil if the instruction can't be parsed as a 'whitelist_spl_mint'.
func (*WhitelistInstructionParams) GatewayNonce ¶
func (inst *WhitelistInstructionParams) GatewayNonce() uint64
GatewayNonce returns the nonce of the instruction
func (*WhitelistInstructionParams) Signer ¶
func (inst *WhitelistInstructionParams) Signer() (signer common.Address, err error)
Signer returns the signer of the signature contained
func (*WhitelistInstructionParams) TokenAmount ¶
func (inst *WhitelistInstructionParams) TokenAmount() uint64
TokenAmount returns the amount of the instruction
type WithdrawInstructionParams ¶
type WithdrawInstructionParams struct { // Discriminator is the unique identifier for the withdraw instruction Discriminator [8]byte // Amount is the lamports amount for the withdraw Amount uint64 // Signature is the ECDSA signature (by TSS) for the withdraw Signature [64]byte // RecoveryID is the recovery ID used to recover the public key from ECDSA signature RecoveryID uint8 // MessageHash is the hash of the message signed by TSS MessageHash [32]byte // Nonce is the nonce for the withdraw Nonce uint64 }
WithdrawInstructionParams contains the parameters for a gateway withdraw instruction
func ParseInstructionWithdraw ¶
func ParseInstructionWithdraw(instruction solana.CompiledInstruction) (*WithdrawInstructionParams, error)
ParseInstructionWithdraw tries to parse the instruction as a 'withdraw'. It returns nil if the instruction can't be parsed as a 'withdraw'.
func (*WithdrawInstructionParams) GatewayNonce ¶
func (inst *WithdrawInstructionParams) GatewayNonce() uint64
GatewayNonce returns the nonce of the instruction
func (*WithdrawInstructionParams) Signer ¶
func (inst *WithdrawInstructionParams) Signer() (signer common.Address, err error)
Signer returns the signer of the signature contained
func (*WithdrawInstructionParams) TokenAmount ¶
func (inst *WithdrawInstructionParams) TokenAmount() uint64
TokenAmount returns the amount of the instruction
type WithdrawSPLInstructionParams ¶
type WithdrawSPLInstructionParams struct { // Discriminator is the unique identifier for the withdraw instruction Discriminator [8]byte // Decimals is decimals for spl token Decimals uint8 // Amount is the lamports amount for the withdraw Amount uint64 // Signature is the ECDSA signature (by TSS) for the withdraw Signature [64]byte // RecoveryID is the recovery ID used to recover the public key from ECDSA signature RecoveryID uint8 // MessageHash is the hash of the message signed by TSS MessageHash [32]byte // Nonce is the nonce for the withdraw Nonce uint64 }
func ParseInstructionWithdrawSPL ¶
func ParseInstructionWithdrawSPL(instruction solana.CompiledInstruction) (*WithdrawSPLInstructionParams, error)
ParseInstructionWithdraw tries to parse the instruction as a 'withdraw'. It returns nil if the instruction can't be parsed as a 'withdraw'.
func (*WithdrawSPLInstructionParams) GatewayNonce ¶
func (inst *WithdrawSPLInstructionParams) GatewayNonce() uint64
GatewayNonce returns the nonce of the instruction
func (*WithdrawSPLInstructionParams) Signer ¶
func (inst *WithdrawSPLInstructionParams) Signer() (signer common.Address, err error)
Signer returns the signer of the signature contained
func (*WithdrawSPLInstructionParams) TokenAmount ¶
func (inst *WithdrawSPLInstructionParams) TokenAmount() uint64
TokenAmount returns the amount of the instruction