Documentation ¶
Index ¶
- Constants
- func PrepareAppOptInTxns(validatorAppID uint64, address string, sp types.SuggestedParams) ([]types.Transaction, error)
- func PrepareAssetOptIn(assetID uint64, address string, sp types.SuggestedParams) ([]types.Transaction, error)
- type ASC
- type AssetAmount
- type BurnQuote
- type Client
- type Contract
- type Contracts
- type Logic
- type Node
- type Pool
- func (p *Pool) BurnQuote(liquidityAssetAmt uint64, slippage float64) BurnQuote
- func (p *Pool) FixedInputSwapQuote(assetID, amount uint64, slippage float64) (SwapQuote, error)
- func (p *Pool) MaximumAmount(assetID uint64, targetPrice float64) uint64
- func (p *Pool) PoolPosition(ctx context.Context, address string) (PoolPosition, error)
- func (p *Pool) PrepareSwapTransactions(ctx context.Context, assetInID, amountIn, amountOut uint64, swapType SwapType, ...) (*TransactionGroup, error)
- func (p *Pool) PrepareSwapTransactionsFromQuote(ctx context.Context, quote *SwapQuote, address string) (*TransactionGroup, error)
- func (p *Pool) Prices() (asset1Price, asset2Price float64)
- func (p *Pool) Refresh(ctx context.Context) error
- func (p *Pool) UpdateFromAccountInfo(ctx context.Context, accInfo models.Account) error
- type PoolPosition
- type SwapQuote
- type SwapType
- type TransactionGroup
- type Variable
Constants ¶
View Source
const ( AlgoExplorerTestnet = "https://api.testnet.algoexplorer.io" AlgoExplorerMainnet = "https://api.algoexplorer.io" IndexerTestnet = "https://testnet.algoexplorerapi.io" IndexerMainnet = "https://algoexplorerapi.io" TestnetValidatorAppIDV0 = 21580889 MainnetValidatorAppIDV0 = 350338509 TestnetValidatorAppIDV1 = 62368684 MainnetValidatorAppIDV1 = 552635992 BootstrapAppArgument = "Ym9vdHN0cmFw" BurnAppArgument = "YnVybg==" MintAppArgument = "bWludA==" RedeemAppArgument = "cmVkZWVt" SwapAppArgument = "c3dhcA==" TestnetValidatorAppID = TestnetValidatorAppIDV1 MainnetValidatorAppID = MainnetValidatorAppIDV1 )
Variables ¶
This section is empty.
Functions ¶
func PrepareAppOptInTxns ¶
func PrepareAppOptInTxns(validatorAppID uint64, address string, sp types.SuggestedParams) ([]types.Transaction, error)
PrepareAppOptInTxns ...
func PrepareAssetOptIn ¶
func PrepareAssetOptIn(assetID uint64, address string, sp types.SuggestedParams) ([]types.Transaction, error)
PrepareAssetOptInTxns ...
Types ¶
type ASC ¶
type ASC struct {
Contracts Contracts `json:"contracts"`
}
ASC ...
var TinymanContracts ASC
TinymanContracts ...
type BurnQuote ¶
type BurnQuote struct { AmountsOut map[uint64]AssetAmount LiquidityAssetAmount AssetAmount Slippage float64 }
BurnQuote ...
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client ...
func (*Client) PrepareAppOptInTxns ¶
func (c *Client) PrepareAppOptInTxns(ctx context.Context, address string) ([]types.Transaction, error)
PrepareAppOptInTxns ...
type Contract ¶
type Contract struct { Type string `json:"type"` Name string `json:"name"` Logic Logic `json:"logic"` }
Contract ...
type Contracts ¶
type Contracts struct {
PoolLogicSig Contract `json:"pool_logicsig"`
}
Contracts ...
type Logic ¶
type Logic struct { Bytecode string `json:"bytecode"` Address string `json:"address"` Size int `json:"size"` Variables []Variable `json:"variables"` }
Logic ...
type Pool ¶
type Pool struct { Client *Client Address string Asset1ID uint64 Asset2ID uint64 Asset1Decimals uint64 Asset2Decimals uint64 Asset1UnitName string Asset2UnitName string LiquidityAssetID uint64 LiquidityAssetName string Asset1Reserves uint64 Asset2Reserves uint64 IssuedLiquidity uint64 UnclaimedProtocolFees uint64 OutstandingAsset1Amount uint64 OutstandingAsset2Amount uint64 OutstandingLiquidityAssetAmount uint64 ValidatorAppID uint64 AlgoBalance uint64 Round uint64 }
Pool ...
func GetPoolInfo ¶
func GetPoolInfo(ctx context.Context, node *Node, validatorAppID, asset1ID, asset2ID uint64) (Pool, error)
GetPoolInfo ...
func GetPoolInfoFromAccountInfo ¶
GetPoolInfoFromAccountInfo ...
func (*Pool) FixedInputSwapQuote ¶
FixedInputSwapQuote ...
func (*Pool) MaximumAmount ¶
MaximumAmount ...
func (*Pool) PoolPosition ¶
PoolPosition ...
func (*Pool) PrepareSwapTransactions ¶
func (p *Pool) PrepareSwapTransactions(ctx context.Context, assetInID, amountIn, amountOut uint64, swapType SwapType, address string) (*TransactionGroup, error)
PrepareSwapTransactions ...
func (*Pool) PrepareSwapTransactionsFromQuote ¶
func (p *Pool) PrepareSwapTransactionsFromQuote(ctx context.Context, quote *SwapQuote, address string) (*TransactionGroup, error)
PrepareSwapTransactionsFromQuote ...
type PoolPosition ¶
type PoolPosition struct { Asset1 AssetAmount Asset2 AssetAmount LiquidityAsset AssetAmount }
PoolPosition ...
type SwapQuote ¶
type SwapQuote struct { SwapType SwapType AssetAmountIn AssetAmount AssetAmountOut AssetAmount SwapFees float64 Slippage float64 }
SwapQuote ...
func (*SwapQuote) AmountInWithSlippage ¶
AmountInWithSlippage ...
func (*SwapQuote) AmountOutWithSlippage ¶
AmountOutWithSlippage ...
func (*SwapQuote) PriceWithSlippage ¶
PriceWithSlippage ...
type TransactionGroup ¶
type TransactionGroup struct {
// contains filtered or unexported fields
}
TransactionGroup ...
func NewTransactionGroup ¶
func NewTransactionGroup(txns []types.Transaction) (*TransactionGroup, error)
NewTransactionGroup ...
func PrepareSwapTransactions ¶
func PrepareSwapTransactions( sp types.SuggestedParams, validatorAppID uint64, asset1ID, asset2ID, liquidityAssetID uint64, assetInID uint64, assetInAmt, assetOutAmt uint64, swapType SwapType, senderAdd string) (*TransactionGroup, error)
PrepareSwapTransactions one asset (ASA or Algo) for another with the Pool.
func (*TransactionGroup) RawSignedTransactions ¶
func (tg *TransactionGroup) RawSignedTransactions() []byte
RawSignedTransactions ...
func (*TransactionGroup) SignWithLogicSig ¶
func (tg *TransactionGroup) SignWithLogicSig(lsa crypto.LogicSigAccount) error
SignWithLogicSig ...
func (*TransactionGroup) SignWithPrivateKey ¶
func (tg *TransactionGroup) SignWithPrivateKey(pk ed25519.PrivateKey) error
SignWithPrivateKey ...
func (*TransactionGroup) Transactions ¶
func (tg *TransactionGroup) Transactions() []types.Transaction
Transactions ...
Click to show internal directories.
Click to hide internal directories.