redpacket

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2023 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const (
	RPAMethodCreate = "create"
	RPAMethodOpen   = "open"
	RPAMethodClose  = "close"
)
View Source
const (
	AptosName    = aptos.AptosName
	AptosSymbol  = aptos.AptosSymbol
	AptosDecimal = 8
)
View Source
const (
	ChainTypeEth   = "eth"
	ChainTypeAptos = "aptos"
	ChainTypeSui   = "sui"
)
View Source
const RedPacketABI = `` /* 4896-byte string literal not displayed */
View Source
const (
	SuiDecimal = 9
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContractConfig added in v0.0.4

type ContractConfig struct {
	SuiConfigAddress string
}

type RedPacketAction

type RedPacketAction struct {
	Method string

	CreateParams *RedPacketCreateParams
	OpenParams   *RedPacketOpenParams
	CloseParams  *RedPacketCloseParams
}

func NewRedPacketActionClose

func NewRedPacketActionClose(tokenAddress string, packetId int64, creator string, _ string) (*RedPacketAction, error)

NewRedPacketActionClose close red packet add empty arg to distinct with NewRedPacketActionCreate signature when build jar

func NewRedPacketActionCreate

func NewRedPacketActionCreate(tokenAddress string, count int, amount string) (*RedPacketAction, error)

用户发红包 的操作

func NewRedPacketActionOpen

func NewRedPacketActionOpen(tokenAddress string, packetId int64, addresses []string, amounts []string) (*RedPacketAction, error)

批量打开红包 的操作

func NewSuiRedPacketActionClose added in v0.0.4

func NewSuiRedPacketActionClose(tokenAddress string, packetObjectId string, creator string, _ string) (*RedPacketAction, error)

func NewSuiRedpacketActionOpen added in v0.0.4

func NewSuiRedpacketActionOpen(tokenAddress string, packetObjectId string, addresses []string, amounts []string) (*RedPacketAction, error)

type RedPacketCloseParams

type RedPacketCloseParams struct {
	TokenAddress   string
	PacketId       int64  // aptos/eth use packetId
	PacketObjectId string // sui use packetObjectId
	Creator        string
}

type RedPacketContract

type RedPacketContract interface {
	SendTransaction(base.Account, *RedPacketAction) (string, error)
	FetchRedPacketCreationDetail(hash string) (*RedPacketDetail, error)
	EstimateFee(*RedPacketAction) (string, error)                  // create red packet fee
	EstimateGasFee(base.Account, *RedPacketAction) (string, error) // gas fee = gasPrice * gasLimit
}

func NewAptosRedPacketContract

func NewAptosRedPacketContract(chain aptos.IChain, contractAddress string) RedPacketContract

func NewEthRedPacketContract

func NewEthRedPacketContract(chain eth.IChain, contractAddress string) RedPacketContract

func NewRedPacketContract

func NewRedPacketContract(chainType string, chain base.Chain, contractAddress string, config *ContractConfig) (RedPacketContract, error)

func NewSuiRedPacketContract added in v0.0.4

func NewSuiRedPacketContract(chain *sui.Chain, contractAddress string, config *ContractConfig) (RedPacketContract, error)

type RedPacketCreateParams

type RedPacketCreateParams struct {
	TokenAddress string // erc20 tokenAddress, aptos coin type
	Count        int
	Amount       string
}

type RedPacketDataError

type RedPacketDataError struct {
	// contains filtered or unexported fields
}

func (*RedPacketDataError) Error

func (e *RedPacketDataError) Error() string

type RedPacketDetail

type RedPacketDetail struct {
	*base.TransactionDetail

	AmountName      string
	AmountDecimal   int16
	RedPacketAmount string // 最后加入到红包里的 Amount,也即用户能够抢的那部分的 Amount
	ChainName       string
}

func NewRedPacketDetail

func NewRedPacketDetail() *RedPacketDetail

func NewRedPacketDetailWithJsonString

func NewRedPacketDetailWithJsonString(s string) (*RedPacketDetail, error)

func (*RedPacketDetail) JsonString

func (d *RedPacketDetail) JsonString() string

type RedPacketOpenParams

type RedPacketOpenParams struct {
	TokenAddress   string
	PacketId       int64  // aptos/eth use packetId
	PacketObjectId string // sui use packetObjectId
	Addresses      []string
	Amounts        []string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL