Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeToBytes(value interface{}) ([]byte, error)
- func GetChainPrefix(name string) string
- func IsMultiSigTransfer(id msg.ChainId) bool
- type ChainCore
- func (bc *ChainCore) AssetIdToResourceId(api *gsrpc.SubstrateAPI, meta *types.Metadata, assetId xevents.AssetId) ([]byte, error)
- func (bc *ChainCore) CalculateAmountToEth(origin []byte, singleToken int64, fixedTokenFee int64, extraFeeRate int64, ...) (*big.Int, error)
- func (bc *ChainCore) CalculateAmountToSub(origin []byte, singleToken int64, fixedTokenFee int64, extraFeeRate int64, ...) (*big.Int, error)
- func (bc *ChainCore) ConvertResourceIdToAssetId(rId msg.ResourceId) (xevents.AssetId, error)
- func (bc *ChainCore) ConvertStringToResourceId(rId string) msg.ResourceId
- func (bc *ChainCore) GetAmountToEth(origin []byte, assetId xevents.AssetId) (*big.Int, error)
- func (bc *ChainCore) GetAmountToSub(origin []byte, assetId xevents.AssetId) (*big.Int, error)
- func (bc *ChainCore) GetCurrencyByAssetId(assetId xevents.AssetId) (*Currency, error)
- func (bc *ChainCore) GetCurrencyByResourceId(rId msg.ResourceId) (*Currency, error)
- func (bc *ChainCore) GetSubChainRecipient(m msg.Message) interface{}
- func (bc *ChainCore) InitializeClientPrefix(cli *client.Client)
- func (bc *ChainCore) MakeBalanceTransferCall(m msg.Message, meta *types.Metadata, assetId xevents.AssetId) (types.Call, error)
- func (bc *ChainCore) MakeCrossChainTansferCall(m msg.Message, meta *types.Metadata, assetId xevents.AssetId) (types.Call, error)
- func (bc *ChainCore) MakeXAssetTransferCall(m msg.Message, meta *types.Metadata, assetId xevents.AssetId) (types.Call, error)
- func (bc *ChainCore) ResourceIdToAssetId(api *gsrpc.SubstrateAPI, meta *types.Metadata, rId [32]byte) ([]byte, error)
- func (bc *ChainCore) ShortenAddress(addr string) string
- type ChainInfo
- type ChainType
- type Currency
- type OptionAssetId
Constants ¶
View Source
const ( NoneLike = iota EthLike PlatonLike SubLike PolkadotLike KusamaLike // ChainXV1Like ChainX V1 use Address Type ChainXV1Like ChainXAssetV1Like ChainXLike ChainXAssetLike )
View Source
const ( NameUnimplemented string = "unimplemented" NamePlaton string = "platon" NameAlaya string = "alaya" NameKusama string = "kusama" NamePolkadot string = "polkadot" )
/ Chain name constants
View Source
const ( TokenATP string = "ATP" TokenLAT string = "LAT" TokenDOT string = "DOT" TokenKSM string = "KSM" TokenPCX string = "PCX" TokenXBTC string = "XBTC" TokenXAsset string = "XASSET" )
View Source
const ( IdBSC msg.ChainId = 22 IdKovan msg.ChainId = 23 IdHeco msg.ChainId = 24 IdKusama msg.ChainId = 11 IdPolkadot msg.ChainId = 12 IdChainXPCXV1 msg.ChainId = 6 IdChainXPCXV2 msg.ChainId = 7 IdChainXBTCV1 msg.ChainId = 8 IdChainXBTCV2 msg.ChainId = 9 )
/ ChainId Type
View Source
const ( SingleKSM int64 = 1e12 SingleDOT int64 = 1e10 SinglePCX int64 = 1e8 )
The currency of Sub-Like
View Source
const ( DiffKSM = 1000000 /// KSM is 12 digits DiffDOT = 100000000 /// DOT is 10 digits DiffXBTC = 10000000000 /// XBTC is 8 digits DiffPCX = 10000000000 /// PCX is 8 digits DiffXAsset = 10000000000 /// XAsset is 8 digits )
The precision-difference constant between Eth-Like and Sub-Like
View Source
const ( FixedKSMFee = SingleKSM * 1 / 100 /// 0.01KSM FixedDOTFee = 0 ///SingleDOT * 6 / 10 /// 0.6DOT FixedPCXFee = SinglePCX * 1 / 10 /// 0.1PCX )
/ Fixed handling fee for cross-chain transactions
View Source
const ( ExtraFeeRate int64 = 1000 ExtraNoneFeeRate int64 = 0 )
ExtraFeeRate Additional formalities rate excluding fixed handling fee
View Source
const ( OriginAsset xevents.AssetId = 0 AssetXBTC xevents.AssetId = 1 XAssetId xevents.AssetId = 999 )
/ AssetId Type
View Source
const ( ResourceIdOrigin string = ResourceIdPrefix + "000" ResourceIdXBTC string = ResourceIdPrefix + "001" ResourceIdXAsset string = ResourceIdPrefix + "999" ResourceIdAKSM string = ResourceIdPrefix + "000" ResourceIdPDOT string = ResourceIdPrefix + "002" )
View Source
const ResourceIdPrefix = "0000000000000000000000000000000000000000000000000000000000000"
View Source
const XParameter uint8 = 255
Variables ¶
View Source
var ( ChainSets = [...]ChainInfo{ {NameAlaya, TokenATP, PlatonLike}, {NamePlaton, TokenLAT, PlatonLike}, {NameKusama, TokenKSM, KusamaLike}, {NamePolkadot, TokenDOT, PolkadotLike}, } )
View Source
var MultiSigLimit msg.ChainId = 100
Functions ¶
func EncodeToBytes ¶
func GetChainPrefix ¶
func IsMultiSigTransfer ¶
IsNativeTransfer Chain id distinguishes Tx types(Native, Fungible...)
Types ¶
type ChainCore ¶ added in v1.0.2
func NewChainCore ¶ added in v1.0.2
func (*ChainCore) AssetIdToResourceId ¶ added in v1.0.2
func (*ChainCore) CalculateAmountToEth ¶ added in v1.0.2
func (*ChainCore) CalculateAmountToSub ¶ added in v1.0.2
func (*ChainCore) ConvertResourceIdToAssetId ¶ added in v1.0.2
func (*ChainCore) ConvertStringToResourceId ¶ added in v1.0.2
func (bc *ChainCore) ConvertStringToResourceId(rId string) msg.ResourceId
func (*ChainCore) GetAmountToEth ¶ added in v1.0.2
func (*ChainCore) GetAmountToSub ¶ added in v1.0.2
func (*ChainCore) GetCurrencyByAssetId ¶ added in v1.0.2
func (*ChainCore) GetCurrencyByResourceId ¶ added in v1.0.2
func (bc *ChainCore) GetCurrencyByResourceId(rId msg.ResourceId) (*Currency, error)
func (*ChainCore) GetSubChainRecipient ¶ added in v1.0.2
func (*ChainCore) InitializeClientPrefix ¶ added in v1.0.2
func (*ChainCore) MakeBalanceTransferCall ¶ added in v1.0.2
func (*ChainCore) MakeCrossChainTansferCall ¶ added in v1.0.2
func (*ChainCore) MakeXAssetTransferCall ¶ added in v1.0.2
func (*ChainCore) ResourceIdToAssetId ¶ added in v1.0.2
func (*ChainCore) ShortenAddress ¶ added in v1.2.2
type ChainInfo ¶
func GetChainInfo ¶
type OptionAssetId ¶
func NewOptionAssetId ¶
func NewOptionAssetId(assetId xevents.AssetId) OptionAssetId
Click to show internal directories.
Click to hide internal directories.