Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotCommitted = errors.New("not committed")
)
View Source
var (
ErrUnsupportedTxType = errors.New("unsupported tx type")
)
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface { builder.Backend signer.Backend AcceptTx(ctx context.Context, tx *txs.Tx) error }
Backend defines the full interface required to support a P-chain wallet.
type Wallet ¶
type Wallet interface { // Builder returns the builder that will be used to create the transactions. Builder() builder.Builder // Signer returns the signer that will be used to sign the transactions. Signer() walletsigner.Signer // IssueBaseTx creates, signs, and issues a new simple value transfer. // // - [outputs] specifies all the recipients and amounts that should be sent // from this transaction. IssueBaseTx( outputs []*avax.TransferableOutput, options ...common.Option, ) (*txs.Tx, error) // IssueAddValidatorTx creates, signs, and issues a new validator of the // primary network. // // - [vdr] specifies all the details of the validation period such as the // startTime, endTime, stake weight, and nodeID. // - [rewardsOwner] specifies the owner of all the rewards this validator // may accrue during its validation period. // - [shares] specifies the fraction (out of 1,000,000) that this validator // will take from delegation rewards. If 1,000,000 is provided, 100% of // the delegation reward will be sent to the validator's [rewardsOwner]. IssueAddValidatorTx( vdr *txs.Validator, rewardsOwner *secp256k1fx.OutputOwners, shares uint32, options ...common.Option, ) (*txs.Tx, error) // IssueAddSupernetValidatorTx creates, signs, and issues a new validator of a // supernet. // // - [vdr] specifies all the details of the validation period such as the // startTime, endTime, sampling weight, nodeID, and supernetID. IssueAddSupernetValidatorTx( vdr *txs.SupernetValidator, options ...common.Option, ) (*txs.Tx, error) // IssueAddSupernetValidatorTx creates, signs, and issues a transaction that // removes a validator of a supernet. // // - [nodeID] is the validator being removed from [supernetID]. IssueRemoveSupernetValidatorTx( nodeID ids.NodeID, supernetID ids.ID, options ...common.Option, ) (*txs.Tx, error) // IssueAddDelegatorTx creates, signs, and issues a new delegator to a // validator on the primary network. // // - [vdr] specifies all the details of the delegation period such as the // startTime, endTime, stake weight, and validator's nodeID. // - [rewardsOwner] specifies the owner of all the rewards this delegator // may accrue at the end of its delegation period. IssueAddDelegatorTx( vdr *txs.Validator, rewardsOwner *secp256k1fx.OutputOwners, options ...common.Option, ) (*txs.Tx, error) // IssueCreateChainTx creates, signs, and issues a new chain in the named // supernet. // // - [supernetID] specifies the supernet to launch the chain in. // - [genesis] specifies the initial state of the new chain. // - [vmID] specifies the vm that the new chain will run. // - [fxIDs] specifies all the feature extensions that the vm should be // running with. // - [chainName] specifies a human readable name for the chain. // - [chainAssetID] specifies the main asset used by this chain to pay the fees IssueCreateChainTx( supernetID ids.ID, genesis []byte, vmID ids.ID, fxIDs []ids.ID, chainName string, chainAssetID ids.ID, options ...common.Option, ) (*txs.Tx, error) // IssueCreateSupernetTx creates, signs, and issues a new supernet with the // specified owner. // // - [owner] specifies who has the ability to create new chains and add new // validators to the supernet. IssueCreateSupernetTx( owner *secp256k1fx.OutputOwners, options ...common.Option, ) (*txs.Tx, error) // IssueTransferSupernetOwnershipTx creates, signs, and issues a transaction that // changes the owner of the named supernet. // // - [supernetID] specifies the supernet to be modified // - [owner] specifies who has the ability to create new chains and add new // validators to the supernet. IssueTransferSupernetOwnershipTx( supernetID ids.ID, owner *secp256k1fx.OutputOwners, options ...common.Option, ) (*txs.Tx, error) // IssueImportTx creates, signs, and issues an import transaction that // attempts to consume all the available UTXOs and import the funds to [to]. // // - [chainID] specifies the chain to be importing funds from. // - [to] specifies where to send the imported funds to. IssueImportTx( chainID ids.ID, to *secp256k1fx.OutputOwners, options ...common.Option, ) (*txs.Tx, error) // IssueExportTx creates, signs, and issues an export transaction that // attempts to send all the provided [outputs] to the requested [chainID]. // // - [chainID] specifies the chain to be exporting the funds to. // - [outputs] specifies the outputs to send to the [chainID]. IssueExportTx( chainID ids.ID, outputs []*avax.TransferableOutput, options ...common.Option, ) (*txs.Tx, error) // IssueTransformSupernetTx creates a transform supernet transaction that attempts // to convert the provided [supernetID] from a permissioned supernet to a // permissionless supernet. This transaction will convert // [initialRewardPoolSupply] of [assetID] to staking rewards. // // - [supernetID] specifies the supernet to transform. // - [assetID] specifies the asset to use to reward stakers on the supernet. // - [initialRewardPoolSupply] the amount of rewards that will be initially // available in the reward pool of the supernet. // - [startRewardShare] starting share of rewards given to validators. // - [startRewardTime] starting timestamp that will be used to calculate // the remaining percentage of rewards given to validators. // - [diminishingRewardShare] share of rewards given to validators at the start of diminishing year. // - [diminishingRewardTime] target timestamp that will be used to calculate // the remaining percentage of rewards given to validators. // - [targetRewardShare] target final share of rewards given to validators. // - [targetRewardTime] target timestamp that will be used to calculate // the remaining percentage of rewards given to validators. // - [minValidatorStake] is the minimum amount of funds required to become a // validator. // - [maxValidatorStake] is the maximum amount of funds a single validator // can be allocated, including delegated funds. // - [minStakeDuration] is the minimum number of seconds a staker can stake // for. // - [maxStakeDuration] is the maximum number of seconds a staker can stake // for. // - [stakePeriodRewardShare] the maximum period reward given for a // stake period equal to MaxStakePeriod. // - [minDelegationFee] the minimum percentage a validator must charge a // delegator for delegating. // - [maxDelegationFee] the maximum percentage a validator must charge a // delegator for delegating. // - [minDelegatorStake] is the minimum amount of funds required to become a // delegator. // - [maxValidatorWeightFactor] is the factor which calculates the maximum // amount of delegation a validator can receive. A value of 1 effectively // disables delegation. // - [uptimeRequirement] is the minimum percentage a validator must be // online and responsive to receive a reward. IssueTransformSupernetTx( supernetID ids.ID, assetID ids.ID, initialRewardPoolSupply uint64, startRewardShare uint64, startRewardTime uint64, diminishingRewardShare uint64, diminishingRewardTime uint64, targetRewardShare uint64, targetRewardTime uint64, minValidatorStake uint64, maxValidatorStake uint64, minStakeDuration time.Duration, maxStakeDuration time.Duration, stakePeriodRewardShare uint64, minDelegationFee uint32, maxDelegationFee uint32, minDelegatorStake uint64, maxValidatorWeightFactor byte, uptimeRequirement uint32, options ...common.Option, ) (*txs.Tx, error) // IssueAddPermissionlessValidatorTx creates, signs, and issues a new // validator of the specified supernet. // // - [vdr] specifies all the details of the validation period such as the // supernetID, startTime, endTime, stake weight, and nodeID. // - [signer] if the supernetID is the primary network, this is the BLS key // for this validator. Otherwise, this value should be the empty signer. // - [assetID] specifies the asset to stake. // - [validationRewardsOwner] specifies the owner of all the rewards this // validator earns for its validation period. // - [delegationRewardsOwner] specifies the owner of all the rewards this // validator earns for delegations during its validation period. // - [shares] specifies the fraction (out of 1,000,000) that this validator // will take from delegation rewards. If 1,000,000 is provided, 100% of // the delegation reward will be sent to the validator's [rewardsOwner]. IssueAddPermissionlessValidatorTx( vdr *txs.SupernetValidator, signer vmsigner.Signer, assetID ids.ID, validationRewardsOwner *secp256k1fx.OutputOwners, delegationRewardsOwner *secp256k1fx.OutputOwners, shares uint32, options ...common.Option, ) (*txs.Tx, error) // IssueAddPermissionlessDelegatorTx creates, signs, and issues a new // delegator of the specified supernet on the specified nodeID. // // - [vdr] specifies all the details of the delegation period such as the // supernetID, startTime, endTime, stake weight, and nodeID. // - [assetID] specifies the asset to stake. // - [rewardsOwner] specifies the owner of all the rewards this delegator // earns during its delegation period. IssueAddPermissionlessDelegatorTx( vdr *txs.SupernetValidator, assetID ids.ID, rewardsOwner *secp256k1fx.OutputOwners, options ...common.Option, ) (*txs.Tx, error) // IssueUnsignedTx signs and issues the unsigned tx. IssueUnsignedTx( utx txs.UnsignedTx, options ...common.Option, ) (*txs.Tx, error) // IssueTx issues the signed tx. IssueTx( tx *txs.Tx, options ...common.Option, ) error }
func NewWallet ¶
func NewWallet( builder builder.Builder, signer walletsigner.Signer, client platformvm.Client, backend Backend, ) Wallet
Click to show internal directories.
Click to hide internal directories.