centchain

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrCentChainTransaction is a generic error type to be used for CentChain errors
	ErrCentChainTransaction = errors.Error("error on centchain tx layer")

	// ErrNonceTooLow nonce is too low
	ErrNonceTooLow = errors.Error("Priority is too low")

	// ErrInvalidTransaction wrapper for a general error
	// Used sometimes as stale extrinsic (nonce too low)
	ErrInvalidTransaction = errors.Error("Invalid Transaction")
)
View Source
const BootstrappedCentChainClient string = "BootstrappedCentChainClient"

BootstrappedCentChainClient is a key to mapped client in bootstrap context.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {

	// Call allows to make a read operation
	Call(result interface{}, method string, args ...interface{}) error

	// GetMetadataLatest returns latest metadata from the centrifuge chain.
	GetMetadataLatest() (*types.Metadata, error)

	// SubmitExtrinsic signs the given call with the provided KeyRingPair and submits an extrinsic.
	// Returns transaction hash, latest block number before extrinsic submission, and signature attached with the extrinsic.
	SubmitExtrinsic(ctx context.Context, meta *types.Metadata, c types.Call, krp signature.KeyringPair) (txHash types.Hash, bn types.BlockNumber, sig types.MultiSignature, err error)

	// SubmitAndWatch returns function that submits and watches an extrinsic, implements transaction.Submitter
	SubmitAndWatch(
		ctx context.Context, meta *types.Metadata, c types.Call, krp signature.KeyringPair) (ExtrinsicInfo, error)

	// GetStorageLatest returns latest value at the given key
	GetStorageLatest(key types.StorageKey, target interface{}) error
}

API exposes required functions to interact with Centrifuge Chain.

func NewAPI

func NewAPI(sapi substrateAPI, config Config, dispatcher jobs.Dispatcher) API

NewAPI returns a new centrifuge chain api.

type AssetID added in v1.3.0

type AssetID struct {
	RegistryID types.H160
	TokenID    types.U256
}

AssetID is a combination of RegistryID and TokenID

type Bootstrapper

type Bootstrapper struct{}

Bootstrapper implements bootstrap.Bootstrapper.

func (Bootstrapper) Bootstrap

func (Bootstrapper) Bootstrap(context map[string]interface{}) error

Bootstrap initialises centchain client.

type Config

type Config interface {
	GetCentChainIntervalRetry() time.Duration
	GetCentChainMaxRetries() int
	GetCentChainAccount() (acc config.CentChainAccount, err error)
}

Config defines functions to get centchain details

type EventChainWhitelisted

type EventChainWhitelisted struct {
	Phase       types.Phase
	Destination types.U8
	Topics      []types.Hash
}

EventChainWhitelisted is emitted when a new chain has been whitelisted to interact with the bridge

type EventFeeChanged

type EventFeeChanged struct {
	Phase    types.Phase
	Key      types.Hash
	NewPrice types.U128
	Topics   []types.Hash
}

EventFeeChanged is emitted when a fee for a given key is changed.

type EventFungibleTransfer

type EventFungibleTransfer struct {
	Phase        types.Phase
	Destination  types.U8
	DepositNonce types.U64
	ResourceID   types.Bytes32
	Amount       types.U32
	Recipient    types.Bytes
	Topics       []types.Hash
}

EventFungibleTransfer is emitted when a bridge fungible token transfer is executed

type EventGenericTransfer

type EventGenericTransfer struct {
	Phase        types.Phase
	Destination  types.U8
	DepositNonce types.U64
	ResourceID   types.Bytes32
	Metadata     types.Bytes
	Topics       []types.Hash
}

EventGenericTransfer is emitted when a bridge generic transfer is executed

type EventMultiAccountRemoved

type EventMultiAccountRemoved struct {
	Phase  types.Phase
	Who    types.AccountID
	Topics []types.Hash
}

EventMultiAccountRemoved is emitted when a multi account has been removed. First param is the multisig account.

type EventMultiAccountUpdated

type EventMultiAccountUpdated struct {
	Phase  types.Phase
	Who    types.AccountID
	Topics []types.Hash
}

EventMultiAccountUpdated is emitted when a multi account has been updated. First param is the multisig account.

type EventMultisigApproval

type EventMultisigApproval struct {
	Phase     types.Phase
	Who       types.AccountID
	TimePoint TimePoint
	ID        types.AccountID
	Topics    []types.Hash
}

EventMultisigApproval is emitted when a multisig operation has been approved by someone. First param is the account that is approving, third is the multisig account.

type EventMultisigCancelled

type EventMultisigCancelled struct {
	Phase     types.Phase
	Who       types.AccountID
	TimePoint TimePoint
	ID        types.AccountID
	Topics    []types.Hash
}

EventMultisigCancelled is emitted when a multisig operation has been cancelled by someone. First param is the account that is approving, third is the multisig account.

type EventMultisigExecuted

type EventMultisigExecuted struct {
	Phase     types.Phase
	Who       types.AccountID
	TimePoint TimePoint
	ID        types.AccountID
	Result    types.DispatchResult
	Topics    []types.Hash
}

EventMultisigExecuted is emitted when a multisig operation has been executed by someone. First param is the account that is approving, third is the multisig account.

type EventNFTDeposited

type EventNFTDeposited struct {
	Phase  types.Phase
	Asset  types.Hash
	Topics []types.Hash
}

EventNFTDeposited is emitted when NFT is ready to be deposited to other chain.

type EventNFTMint added in v1.3.0

type EventNFTMint struct {
	Phase      types.Phase
	RegistryID types.H160
	TokenID    types.U256
	Topics     []types.Hash
}

EventNFTMint is emitted when an NFT with tokenID is minted in a given registryID

type EventNFTTransferred added in v1.3.0

type EventNFTTransferred struct {
	Phase      types.Phase
	RegistryID types.H160
	AssetID    AssetID
	AccountID  types.AccountID
	Topics     []types.Hash
}

EventNFTTransferred is emitted when an NFT is transferred to a new owner

type EventNewMultiAccount

type EventNewMultiAccount struct {
	Phase   types.Phase
	Who, ID types.AccountID
	Topics  []types.Hash
}

EventNewMultiAccount is emitted when a multi account has been created. First param is the account that created it, second is the multisig account.

type EventNewMultisig

type EventNewMultisig struct {
	Phase   types.Phase
	Who, ID types.AccountID
	Topics  []types.Hash
}

EventNewMultisig is emitted when a new multisig operation has begun. First param is the account that is approving, second is the multisig account.

type EventNonFungibleTransfer

type EventNonFungibleTransfer struct {
	Phase        types.Phase
	Destination  types.U8
	DepositNonce types.U64
	ResourceID   types.Bytes32
	TokenID      types.Bytes
	Recipient    types.Bytes
	Metadata     types.Bytes
	Topics       []types.Hash
}

EventNonFungibleTransfer is emitted when a bridge non fungible token transfer is executed

type EventRegistryCreated added in v1.3.0

type EventRegistryCreated struct {
	Phase      types.Phase
	RegistryID types.H160
	Topics     []types.Hash
}

EventRegistryCreated is emitted when a new registry is created

type EventRelayerAdded

type EventRelayerAdded struct {
	Phase   types.Phase
	Relayer types.AccountID
	Topics  []types.Hash
}

EventRelayerAdded is emitted when a new bridge relayer has been whitelisted

type EventRelayerThresholdChanged

type EventRelayerThresholdChanged struct {
	Phase     types.Phase
	Threshold types.U32
	Topics    []types.Hash
}

EventRelayerThresholdChanged is emitted when the relayer threshold is changed

type Events

type Events struct {
	types.EventRecords

	ChainBridge_FungibleTransfer        []EventFungibleTransfer        //nolint:stylecheck,revive
	ChainBridge_NonFungibleTransfer     []EventNonFungibleTransfer     //nolint:stylecheck,revive
	ChainBridge_GenericTransfer         []EventGenericTransfer         //nolint:stylecheck,revive
	ChainBridge_ChainWhitelisted        []EventChainWhitelisted        //nolint:stylecheck,revive
	ChainBridge_RelayerAdded            []EventRelayerAdded            //nolint:stylecheck,revive
	ChainBridge_RelayerThresholdChanged []EventRelayerThresholdChanged //nolint:stylecheck,revive
	Registry_RegistryCreated            []EventRegistryCreated         //nolint:stylecheck,revive
	Registry_Mint                       []EventNFTMint                 //nolint:stylecheck,revive
	Nft_Transferred                     []EventNFTTransferred          //nolint:stylecheck,revive
	// contains filtered or unexported fields
}

Events holds the default events and custom events for centrifuge chain

type ExtrinsicInfo added in v1.3.0

type ExtrinsicInfo struct {
	Hash      types.Hash
	BlockHash types.Hash
	Index     uint // index number of extrinsic in a block

	// EventsRaw contains all the events in the given block
	// if you want to filter events for an extrinsic, use the Index
	EventsRaw types.EventRecordsRaw
}

ExtrinsicInfo holds details of a successful extrinsic

func (ExtrinsicInfo) Events added in v1.3.0

func (e ExtrinsicInfo) Events(meta *types.Metadata) (events Events, err error)

Events returns all the events occurred in a given block

type TimePoint

type TimePoint struct {
	Height types.BlockNumber
	Index  types.U32
}

TimePoint contains height and index

Jump to

Keyboard shortcuts

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