6.0.3 • Published 1 day ago

hedgey-sdk v6.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
1 day ago

Hedgey SDK

TypeScript

Contains utilities and helpers used by the hedgey frontend apps.

Installation

To install the latest version run:

npm install hedgey-sdk --save

Modules

v2.streamVestingNft

Table of contents

Functions

Functions

createBatch

createBatch(web3, contractAddress, batchVesterContractAddress, sender, recipients, token, amounts, starts, cliffs, rates, vestingAdmin, mintType, safeDetails, timeout?): Promise<TransactionResult>

Create a batch of locked NFTs with a vesting schedule

Parameters

NameTypeDescription
web3defaultThe web3 object
contractAddressstringThe stream vesting NFT contract
batchVesterContractAddressstringThe batch contract address
senderstringThe address executing this transaction
recipientsstring[]The recipients of the NFT
tokenstringThe token to lock
amountsstring[]The amounts of tokens to lock
startsDate[]The start dates
cliffsDate[]The cliff dates
ratesstring[]The rates
vestingAdminstringAn admin address for this vesting schedule
mintTypenumberAn integer representing the product
safeDetailsSafeDetailsThe details of the safe
timeout?numberA timeout for requests

Returns

Promise<TransactionResult>

The transaction result

Defined in

src/v2/stream.vesting.nft.ts:147


createLockedBatch

createLockedBatch(web3, contractAddress, batchVesterContractAddress, sender, recipients, token, amounts, starts, cliffs, rates, vestingAdmin, unlockDates, transferableNFTLocker, mintType, safeDetails, timeout?): Promise<TransactionResult>

Create a batch of locked vesting NFTs

Parameters

NameTypeDescription
web3defaultThe web3 object
contractAddressstringThe contract address
batchVesterContractAddressstringThe batch contract address
senderstringThe address executing this transaction
recipientsstring[]An array of recipients
tokenstringThe token to lock
amountsstring[]The amounts of tokens to lock
startsDate[]The start dates
cliffsDate[]The cliff dates
ratesstring[]The rates
vestingAdminstringAn admin address for this vesting schedule
unlockDatesDate[]The unlock dates
transferableNFTLockerbooleanThe NFT to transfer remaining tokens to lock
mintTypenumberAn integer representing the product
safeDetailsSafeDetailsThe details of the safe
timeout?numberA timeout for requests

Returns

Promise<TransactionResult>

The transaction result

Defined in

src/v2/stream.vesting.nft.ts:258


createLockedNFT

createLockedNFT(web3, contractAddress, sender, recipient, token, amount, start, cliffDate, rate, vestingAdmin, unlockDate, transferableNFTLocker, safeDetails, timeout?): Promise<TransactionResult>

Create a locked NFT with a vesting schedule

Parameters

NameTypeDescription
web3defaultThe web3 object
contractAddressstringThe stream vesting NFT contract
senderstringThe address executing this transaction
recipientstringThe recipient of the NFT
tokenstringThe token to lock
amountstringThe amount of tokens to lock
startDateThe start date
cliffDateDateThe cliff date
ratestringThe rate
vestingAdminstringAn admin address for this vesting schedule
unlockDateDateThe unlock date
transferableNFTLockerbooleanThe NFT to transfer remaining tokens to lock
safeDetailsSafeDetailsThe details of the safe
timeout?numberA timeout for requests

Returns

Promise<TransactionResult>

The transaction result

Defined in

src/v2/stream.vesting.nft.ts:37


delegateAllNFTs

delegateAllNFTs(web3, accountAddress, delegateAddress, contractAddress, safeDetails, timeout?): Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Parameters

NameType
web3default
accountAddressstring
delegateAddressstring
contractAddressstring
safeDetailsSafeDetails
timeout?number

Returns

Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Defined in

src/v2/stream.vesting.nft.ts:392


delegateTokens

delegateTokens(web3, accountAddress, delegateAddress, contractAddress, tokenIds, safeDetails, timeout?): Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Parameters

NameType
web3default
accountAddressstring
delegateAddressstring
contractAddressstring
tokenIdsnumber[]
safeDetailsSafeDetails
timeout?number

Returns

Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Defined in

src/v2/stream.vesting.nft.ts:411


redeemAllNFTs

redeemAllNFTs(web3, accountAddress, contractAddress, safeDetails, timeout?): Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Parameters

NameType
web3default
accountAddressstring
contractAddressstring
safeDetailsSafeDetails
timeout?number

Returns

Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Defined in

src/v2/stream.vesting.nft.ts:375


redeemNFTs

redeemNFTs(web3, contractAddress, accountAddress, tokenIds, safeDetails, timeout?): Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Parameters

NameType
web3default
contractAddressstring
accountAddressstring
tokenIdsnumber[]
safeDetailsSafeDetails
timeout?number

Returns

Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Defined in

src/v2/stream.vesting.nft.ts:432


revokeNFTs

revokeNFTs(web3, accountAddress, contractAddress, tokenIds, safeDetails, timeout?): Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Parameters

NameType
web3default
accountAddressstring
contractAddressstring
tokenIdsnumber[]
safeDetailsSafeDetails
timeout?number

Returns

Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Defined in

src/v2/stream.vesting.nft.ts:356

v2.streamBoundNft

Table of contents

Functions

Functions

createNFT

createNFT(web3, contractAddress, sender, recipient, token, amount, start, cliffDate, rate, safeDetails, timeout): Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Parameters

NameType
web3default
contractAddressstring
senderstring
recipientstring
tokenstring
amountstring
startDate
cliffDateDate
ratestring
safeDetailsSafeDetails
timeoutnumber

Returns

Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Defined in

src/v2/stream.bound.nft.ts:13


delegateAllNFTs

delegateAllNFTs(web3, accountAddress, delegateAddress, contractAddress, safeDetails, timeout?): Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Parameters

NameType
web3default
accountAddressstring
delegateAddressstring
contractAddressstring
safeDetailsSafeDetails
timeout?number

Returns

Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Defined in

src/v2/stream.bound.nft.ts:42


delegateTokens

delegateTokens(web3, accountAddress, delegateAddress, contractAddress, tokenIds, safeDetails, timeout?): Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Parameters

NameType
web3default
accountAddressstring
delegateAddressstring
contractAddressstring
tokenIdsnumber[]
safeDetailsSafeDetails
timeout?number

Returns

Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Defined in

src/v2/stream.bound.nft.ts:61


redeemAllNFTs

redeemAllNFTs(web3, accountAddress, contractAddress, safeDetails, timeout?): Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Parameters

NameType
web3default
accountAddressstring
contractAddressstring
safeDetailsSafeDetails
timeout?number

Returns

Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Defined in

src/v2/stream.bound.nft.ts:82


redeemNFTs

redeemNFTs(web3, contractAddress, accountAddress, tokenIds, safeDetails, timeout?): Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Parameters

NameType
web3default
contractAddressstring
accountAddressstring
tokenIdsnumber[]
safeDetailsSafeDetails
timeout?number

Returns

Promise<{ pending: boolean = false; safeTransaction: undefined = undefined; timeout: boolean = false; transactionHash: any = results.transactionHash } | { pending: boolean = true; safeTransaction: any = results.safeTxHash; timeout: boolean = false; transactionHash: undefined = undefined }>

Defined in

src/v2/stream.bound.nft.ts:99

common

isHedgeyContract

isHedgeyContract(appId, address): Promise<boolean>

Checks the passed address to see if it is a hedgey contract address

Parameters

NameTypeDescription
appIdstringThe realm app ID for graphql
addressstringThe address to check

Returns

Promise<boolean>

A boolean, true if the address matches on of the configured hedgey contracts

Defined in

src/common/index.ts:106

V2

Utils

Functions

Functions

prepareAmounts

prepareAmounts(amount, periods, frequency, decimals?): string[]

Prepare an array of amounts

Parameters

NameTypeDefault valueDescription
amountstringundefinedThe full amount
periodsnumberundefinedThe number of periods
frequencyFrequencyundefinedThe frequency
decimalsundefined | numberundefinedThe decimals for the amounts (if undefined amounts are used as is)

Returns

string[]

An array of amounts represented as strings

Defined in

src/v2/utils.ts:39


prepareHolders

prepareHolders(periods, frequency, recipientAddress): string[]

Prepare an array of recipients

Parameters

NameTypeDescription
periodsnumberThe number of periods
frequencyFrequencyThe frequency
recipientAddressstringThe recipient

Returns

string[]

An array of holders represented as strings

Defined in

src/v2/utils.ts:63


prepareUnlockDates

prepareUnlockDates(firstUnlockDate, periods, frequency): string[]

Prepare an array of unlock dates

Parameters

NameTypeDescription
firstUnlockDateDateThe first unlock date
periodsnumberThe number of periods
frequencyFrequencyThe frequency

Returns

string[]

An array of dates represented as epoch strings

Defined in

src/v2/utils.ts:13

Type Aliases

DistributeResult

DistributeResult: Object

The return type for the Token Distribution

Type declaration

NameType
pendingboolean
safeTransactionstring | undefined
transactionHashstring | undefined

Defined in

src/v2/token.distribution.ts:21


SafeDetails

SafeDetails: Object

Safe details if the Token Distribution is a gnosis safe

Type declaration

NameType
attemptsnumber
pollIntervalnumber
safeboolean

Defined in

src/v2/token.distribution.ts:30

Functions

distribute

distribute(web3, batchMintContractAddress, nftContractAddress, tokenAddress, recipientAddress, amount, firstUnlockDate, frequency, sender, periods?, safeDetails?): Promise<DistributeResult>

Creates a Token Distribution

Parameters

NameTypeDefault valueDescription
web3defaultundefinedThe web3 object
batchMintContractAddressstringundefinedThe batch mint contract to use
nftContractAddressstringundefinedThe NFT contract to use
tokenAddressstringundefinedThe locked token address
recipientAddressstringundefinedThe recipient address
amountstringundefinedThe total amount
firstUnlockDateDateundefinedThe first unlock date
frequencyFrequencyundefinedThe frequency of the unlock
senderstringundefinedThe sender address
periodsnumber1The number of periods for unlock
safeDetailsSafeDetailsundefinedThe safe details object

Returns

Promise<DistributeResult>

The transaction hash or safe transaction hash

Defined in

src/v2/token.distribution.ts:54


SafeDetails

SafeDetails: Object

Type declaration

NameType
attemptsnumber
pollIntervalnumber
safeboolean

Defined in

src/v2/token.distribution.ts:21

Functions

distribute

distribute(web3, batchMintContractAddress, nftContractAddress, tokenAddress, recipientAddress, amount, firstUnlockDate, frequency, sender, periods?, safeDetails?): Promise<DistributeResult>

Parameters

NameTypeDefault value
web3defaultundefined
batchMintContractAddressstringundefined
nftContractAddressstringundefined
tokenAddressstringundefined
recipientAddressstringundefined
amountstringundefined
firstUnlockDateDateundefined
frequencyFrequencyundefined
senderstringundefined
periodsnumber1
safeDetailsSafeDetailsundefined

Returns

Promise<DistributeResult>

Defined in

src/v2/token.distribution.ts:29

Safe

ApprovalStatusDetails

ApprovalStatusDetails: Object

Type declaration

NameType
details?{ confirmations: string[] ; confirmationsRequired: number }
details.confirmationsstring[]
details.confirmationsRequirednumber
hasApprovalboolean

Defined in

src/safe/index.ts:16

Functions

approvalStatus

approvalStatus(chainId, safeAddress, contractAddress, token, allowance): Promise<ApprovalStatusDetails>

Returns the approval status from a gnosis safe, if there is an approval transaction queued the details will be returned

Parameters

NameTypeDescription
chainIdnumberThe chain ID the gnosis safe contract is deployed on
safeAddressstringThe safe wallet address
contractAddressstringThe spender contract address
tokenstringThe token contract address
allowancestringThe allowance needed

Returns

Promise<ApprovalStatusDetails>

The approval details if there is an approval transaction queued

Defined in

src/safe/index.ts:33

pendingTransactionSubmitted

pendingTransactionSubmitted(chainId, safeAddress, contractAddress, method): Promise<TransactionDetails[]>

Checks a pending transaction exists in a safe, for a transaction using the method name

Parameters

NameTypeDescription
chainIdnumberThe chain ID the gnosis safe contract is deployed on
safeAddressstringThe safe wallet address
contractAddressstringThe contract the safe is interacting with
methodstringThe method name

Returns

Promise<TransactionDetails[]>

A boolean, true if a pending transaction exists

Defined in

src/safe/index.ts:42

OTC

batchMintNFTs

batchMintNFTs(web3, address, contractAddress, nftContractAddress, mintingDetails): Promise<any>

Parameters

NameTypeDescription
web3defaultThe web3 object
addressstringThe address of the account used to mint the NFT
contractAddressstringThe batchMintNFT contract address
nftContractAddressstringThe NFT contract to call for minting
mintingDetailsObjectThe tokens and recipients to transfer the NFT to
mintingDetails.recipientsany-
mintingDetails.tokenTokenInformation-

Returns

Promise<any>

Defined in

src/otc/index.ts:261


buyDeal

buyDeal(web3, address, deal, positionSize): Promise<Transaction>

Buy a deal

Parameters

NameTypeDescription
web3defaultThe web3 object
addressstringThe users selected account address from their wallet
dealFormattedDealThe deal to buy from
positionSizenumberThe position size to buy

Returns

Promise<Transaction>

A promise for the on chain request

Defined in

src/otc/index.ts:67


cancelDeal

cancelDeal(web3, address, contractAddress, dealIndex): Promise<Transaction>

Cancels an open deal

Parameters

NameTypeDescription
web3defaultThe web3 object
addressstringThe users selected account address from their wallet
contractAddressstringThe deployed contract address
dealIndexnumberThe index of the deal to cancel

Returns

Promise<Transaction>

The resulting transaction

Defined in

src/otc/index.ts:105


createDeal

createDeal(web3, address, deal): Promise<Transaction>

Creates an OTC deal

Parameters

NameTypeDescription
web3defaultThe web3 object
addressstringThe users selected account address from their wallet
dealDealThe OTC deal to create

Returns

Promise<Transaction>

The transaction details

Defined in

src/otc/index.ts:20


getLockedTokenDetails

getLockedTokenDetails(web3, contractAddress, walletAddress, contractVersion): Promise<any[]>

Returns the details of the token locked within the NFT

Parameters

NameTypeDescription
web3defaultThe web3 object
contractAddressstringThe contract address
walletAddressstringThe wallet address
contractVersionnumberThe contract version

Returns

Promise<any[]>

An array of token details

Defined in

src/otc/index.ts:235


getNFTBalance

getNFTBalance(web3, address, contractAddress, contractVersion): Promise<any>

Returns the number of NFTs in the selected network

Parameters

NameTypeDescription
web3default-
addressstringThe users selected account address from their wallet
contractAddressstringThe NFT contract address
contractVersionnumberThe version of the NFT contract to use

Returns

Promise<any>

The balance value

Defined in

src/otc/index.ts:217


listDeals

listDeals(web3, contractAddress): Promise<any[]>

List all deals in the contract

Parameters

NameTypeDescription
web3defaultThe web3 object
contractAddressstringThe contract address

Returns

Promise<any[]>

An array of deals

Defined in

src/otc/index.ts:300


loadNFTs

loadNFTs(web3, ownerAddress, contractAddress, balance, contractVersion): Promise<{ contract: string ; index: number ; metadata: NFTMetaData }[]>

Returns the meta data for NFTs belonging to the owner address

Parameters

NameTypeDescription
web3defaultThe web3 object
ownerAddressstringThe owner address
contractAddressstringThe NFT contract address
balancenumber-
contractVersionnumber-

Returns

Promise<{ contract: string ; index: number ; metadata: NFTMetaData }[]>

A list of metadata for NFTs belonging to the owner address

Defined in

src/otc/index.ts:174


redeemNFT

redeemNFT(web3, address, contractAddress, index, contractVersion): Promise<any>

Redeem the NFT

Parameters

NameTypeDescription
web3defaultThe web3 object
addressstringThe users selected account address from their wallet
contractAddressstringThe NFT contract address
indexnumberThe NFT index
contractVersionnumberThe NFT contract version (defaults to 1)

Returns

Promise<any>

The result of calling the contract

Defined in

src/otc/index.ts:150


transferNFT

transferNFT(web3, address, contractAddress, index, toAddress, contractVersion): Promise<any>

Transfer the NFT

Parameters

NameTypeDescription
web3defaultThe web3 object
addressstringThe users selected account address from their wallet
contractAddressstringThe NFT contract address
indexnumberThe NFT index
toAddressstringThe address to transfer the NFT to
contractVersionnumberThe NFT contract version

Returns

Promise<any>

The result of calling the contract

Defined in

src/otc/index.ts:126

Treasury Pools

approveToken

approveToken(web3, address, hedgeyAddress, erc20Address, approvalAmount?): Promise<string>

Gets approval for hedgey to spend from the selected account on behalf of the user

Parameters

NameTypeDescription
web3defaultThe web3 object
addressstringThe users selected account address from their wallet
hedgeyAddressstringThe hedgey address
erc20AddressstringThe erc20 The currency address
approvalAmount?stringAn optional amount to use for approval, if not set max value is used

Returns

Promise<string>

  • The transaction hash for the approval transaction

Defined in

src/treasurypools/index.ts:81


buyOption

buyOption(web3, address, option, positionSize): Promise<Transaction>

Calls the relevant hedgey smart contract to buy an option

Parameters

NameTypeDescription
web3defaultThe web3 object
addressstringThe users selected account address from their wallet
optionOptionThe option to buy
positionSizenumberAmount to buy from the pool

Returns

Promise<Transaction>

A promise that resolves to the completed transaction

Defined in

src/treasurypools/index.ts:100


cancelOpenOrder

cancelOpenOrder(web3, address, option): Promise<boolean>

Calls the relevant hedgey cancel smart contract to cancel an open option

Parameters

NameTypeDescription
web3defaultThe Web3 object
addressstringThe users selected account address from their wallet
optionOptionThe option to cancel

Returns

Promise<boolean>

A promise that resolves to true if the contract method was successful

Defined in

src/treasurypools/index.ts:197


exerciseOption

exerciseOption(web3, address, option, cashClose?): Promise<Transaction>

Excercises the option

Parameters

NameTypeDefault valueDescription
web3defaultundefinedThe Web3 object
addressstringundefinedThe users selected account address from their wallet
optionOptionundefinedThe option to excercise
cashClosebooleanfalseReturn the payment currency instead of the underlying asset

Returns

Promise<Transaction>

A promise that resolves to the completed transaction

Defined in

src/treasurypools/index.ts:246


findBestAMM

findBestAMM(web3, type, network, assetAddress, paymentAddress): Promise<MarketMaker>

Returns the best market maker

Parameters

NameTypeDescription
web3defaultThe Web3 object
typestringThe option type
networkNetworkThe network
assetAddressstringAsset currency address
paymentAddressstringPayment currency address

Returns

Promise<MarketMaker>

A promise that resolves to a MarketMaker

Defined in

src/treasurypools/index.ts:358


getAMMExchangeRate

getAMMExchangeRate(web3, option): Promise<BigNumber>

Get automated market maker exchange rate, calls relevant smart contract to return exchange rate

Parameters

NameTypeDescription
web3defaultThe web3 object
optionOptionThe option

Returns

Promise<BigNumber>

Returns the estimated rate

Defined in

src/treasurypools/index.ts:300


getBalance

getBalance(web3, address, decimals?, erc20Address?): Promise<BigNumber>

Gets the balance of the users selected account from the web3 wallet

Parameters

NameTypeDefault valueDescription
web3defaultundefinedThe web3 object
addressstringundefinedThe users selected account address from their wallet
decimalsnumber18currency decimals (defaults to 18)
erc20Address?stringundefinedThe ERC20 address (if applicable)

Returns

Promise<BigNumber>

The balance of the users selected account

Defined in

src/treasurypools/index.ts:26


getERC20ContractInfo

getERC20ContractInfo(web3, erc20Address): Promise<TokenInformation>

Returns token information for the ERC20 token

Parameters

NameTypeDescription
web3defaultThe Web3 object
erc20AddressstringThe ERC20 token address to query

Returns

Promise<TokenInformation>

A promise that resolves to the token information object

Defined in

src/treasurypools/index.ts:323


hasApprovals

hasApprovals(web3, address, hedgeyAddress, erc20Address, approvalAmount?): Promise<boolean>

Checks if hedgey is approved to spend from the selected account on behalf of the user

Parameters

NameTypeDescription
web3defaultThe web3 object
addressstringThe users selected account address from their wallet
hedgeyAddressstringThe hedgey contract address
erc20AddressstringThe erc20 The currency address
approvalAmount?string-

Returns

Promise<boolean>

A boolean value, true if the address has approval

Defined in

src/treasurypools/index.ts:51


launchNewPair

launchNewPair(web3, address, factoryAddress, assetAddress, paymentAddress): Promise<Transaction>

Creates a new currency pair

Parameters

NameTypeDescription
web3defaultThe Web3 object
addressstringThe users selected account address from their wallet
factoryAddressstringThe factory address
assetAddressstringAsset currency address
paymentAddressstringPayment currency address

Returns

Promise<Transaction>

A promise that resolves to the completed transaction

Defined in

src/treasurypools/index.ts:433


returnExpired

returnExpired(web3, address, option, indices): Promise<Transaction>

Returns the expired tokens to the user wallet

Parameters

NameTypeDescription
web3defaultThe Web3 object
addressstringThe users selected account address from their wallet
optionOptionThe expired option
indicesnumber[]The indices of the options to return

Returns

Promise<Transaction>

A promise that resolves to the completed transaction

Defined in

src/treasurypools/index.ts:284


setPrice

setPrice(web3, address, option, newPrice, tradeable?): Promise<any>

Sets the price on an open option

Parameters

NameTypeDefault valueDescription
web3defaultundefinedThe Web3 object
addressstringundefinedThe users selected account address from their wallet
optionOptionundefinedThe option to set the price on
newPricenumberundefinedThe new price
tradeablebooleantrueIf the option is tradeable, defaults to true

Returns

Promise<any>

A promise that resolves to true if the contract method was successful

Defined in

src/treasurypools/index.ts:224


switchChain

switchChain(network): Promise<boolean>

Swtich chain to a new network

Parameters

NameTypeDescription
networkNetworkThe network to switch to

Returns

Promise<boolean>

A promise that resolves to true on a successful switch

Defined in

src/treasurypools/index.ts:461


writeOption

writeOption(web3, address, pair, option): Promise<Transaction>

Calls the relevant hedgey smart contract to create a new option

Parameters

NameTypeDescription
web3defaultThe web3 object
addressstringThe users selected account address from their wallet
pairPairThe currency pair
optionOptionThe option to create

Returns

Promise<Transaction>

A promise that resolves to the completed transaction

Defined in

src/treasurypools/index.ts:154

Hedgey common

addTokenToWallet

addTokenToWallet(web3, network): Promise<any>

Prompts the user to add the network base token to their wallet

Parameters

NameTypeDescription
web3defaultThe web3 object
networkNetworkThe network

Returns

Promise<any>

The transaction promise

Defined in

src/common/index.ts:62

estimateGas

estimateGas(web3, contract, from, method, params, value?): Promise<{ gasEstimation: null | number ; gasPrice: null | string }>

Estimates the cost of gas

Parameters

NameTypeDefault valueDescription
web3defaultundefinedThe web3 object
contractContractundefinedThe contract
fromstringundefinedThe address sending the transaction
methodstringundefinedThe method of the contract to call
paramsany[]undefinedThe parameters that will be sent to the contract method
valuestring'0'If any tokens are being sent

Returns

Promise<{ gasEstimation: null | number ; gasPrice: null | string }>

The gas price and gas estimation amount

Defined in

src/common/index.ts:15

wrapTokens

wrapTokens(web3, assetAmount, wrappedTokenAddress, address): Promise<TransactionReceipt>

Will wrap the network token

Parameters

NameTypeDescription
web3defaultThe web3 object
assetAmountstringThe amount to wrap
wrappedTokenAddressstringThe wrapped token contract address
addressstringThe users wallet address

Returns

Promise<TransactionReceipt>

The transaction promise

Defined in

src/common/index.ts:45

6.0.3

1 day ago

6.0.2

1 day ago

6.0.1

7 days ago

6.0.0

8 days ago

5.0.40

9 days ago

5.0.37

27 days ago

5.0.35

28 days ago

5.0.36

28 days ago

5.0.33

1 month ago

5.0.34

1 month ago

5.0.30

1 month ago

5.0.31

1 month ago

5.0.32

1 month ago

5.0.29

1 month ago

5.0.28

1 month ago

5.0.27

2 months ago

5.0.25

2 months ago

5.0.26

2 months ago

5.0.23

2 months ago

5.0.22

2 months ago

5.0.20

2 months ago

5.0.21

2 months ago

5.0.19

2 months ago

5.0.18

3 months ago

5.0.17

3 months ago

5.0.16

4 months ago

5.0.15

4 months ago

5.0.12

4 months ago

5.0.14

4 months ago

5.0.10

5 months ago

5.0.11

5 months ago

5.0.9

5 months ago

5.0.8

5 months ago

5.0.7

5 months ago

5.0.6

5 months ago

5.0.5

5 months ago

5.0.4

5 months ago

5.0.2

5 months ago

5.0.1

5 months ago

5.0.0

5 months ago

4.0.7

5 months ago

4.0.5

5 months ago

4.0.6

5 months ago

3.0.85

7 months ago

4.0.4

5 months ago

4.0.3

6 months ago

4.0.2

7 months ago

3.1.7

7 months ago

3.1.6

7 months ago

3.1.5

7 months ago

3.1.4

7 months ago

3.1.9

6 months ago

3.1.8

6 months ago

3.1.12

6 months ago

3.1.14

6 months ago

3.1.13

6 months ago

3.1.16

6 months ago

3.1.10

6 months ago

3.0.81

7 months ago

3.0.80

8 months ago

3.0.83

7 months ago

3.0.84

7 months ago

4.0.1

8 months ago

4.0.0

8 months ago

3.0.67

8 months ago

3.0.68

8 months ago

3.0.65

8 months ago

3.0.66

8 months ago

3.0.69

8 months ago

3.0.63

8 months ago

3.0.64

8 months ago

3.0.61

8 months ago

3.1.3

7 months ago

3.0.78

8 months ago

3.1.2

7 months ago

3.0.79

8 months ago

3.1.1

7 months ago

3.0.76

8 months ago

3.1.0

7 months ago

3.0.77

8 months ago

3.0.70

8 months ago

3.0.71

8 months ago

3.0.74

8 months ago

3.0.75

8 months ago

3.0.72

8 months ago

3.0.73

8 months ago

3.0.60

8 months ago

3.0.56

8 months ago

3.0.57

8 months ago

3.0.54

8 months ago

3.0.55

8 months ago

3.0.58

8 months ago

3.0.59

8 months ago

3.0.52

8 months ago

3.0.53

8 months ago

3.0.12

10 months ago

3.0.13

10 months ago

3.0.10

10 months ago

3.0.11

10 months ago

3.0.16

10 months ago

3.0.17

10 months ago

3.0.14

10 months ago

3.0.15

10 months ago

2.1.38

11 months ago

2.1.39

10 months ago

2.1.36

11 months ago

2.1.37

11 months ago

2.1.34

12 months ago

2.1.35

11 months ago

2.1.33

12 months ago

3.0.45

9 months ago

3.0.46

9 months ago

3.0.43

9 months ago

3.0.44

9 months ago

3.0.49

9 months ago

3.0.47

9 months ago

3.0.48

9 months ago

3.0.41

9 months ago

3.0.42

9 months ago

3.0.40

9 months ago

2.1.40

10 months ago

3.0.4

10 months ago

3.0.3

10 months ago

3.0.2

10 months ago

3.0.1

10 months ago

3.0.8

10 months ago

3.0.7

10 months ago

3.0.6

10 months ago

3.0.5

10 months ago

3.0.0

10 months ago

3.0.51

9 months ago

3.0.23

10 months ago

3.0.24

9 months ago

3.0.21

10 months ago

3.0.22

10 months ago

3.0.27

9 months ago

3.0.28

9 months ago

3.0.25

9 months ago

3.0.26

9 months ago

3.0.20

10 months ago

3.0.18

10 months ago

3.0.19

10 months ago

3.0.9

10 months ago

3.0.34

9 months ago

3.0.35

9 months ago

3.0.32

9 months ago

3.0.33

9 months ago

3.0.38

9 months ago

3.0.39

9 months ago

3.0.36

9 months ago

3.0.37

9 months ago

3.0.30

9 months ago

3.0.31

9 months ago

3.0.29

9 months ago

2.1.32

12 months ago

2.1.16

1 year ago

2.1.17

1 year ago

2.1.14

1 year ago

2.1.12

1 year ago

2.1.13

1 year ago

2.1.11

1 year ago

2.1.18

1 year ago

2.1.19

1 year ago

2.1.27

1 year ago

2.1.28

1 year ago

2.1.25

1 year ago

2.1.26

1 year ago

2.1.23

1 year ago

2.1.22

1 year ago

2.1.20

1 year ago

2.1.29

1 year ago

2.1.30

1 year ago

2.1.31

1 year ago

2.1.9

1 year ago

2.1.10

1 year ago

2.0.59

1 year ago

2.0.58

1 year ago

2.0.55

1 year ago

2.0.56

1 year ago

2.0.54

1 year ago

2.0.68

1 year ago

2.0.69

1 year ago

2.0.66

1 year ago

2.0.67

1 year ago

2.0.64

1 year ago

2.0.65

1 year ago

2.0.62

1 year ago

2.0.63

1 year ago

2.0.60

1 year ago

2.0.61

1 year ago

2.0.73

1 year ago

2.0.74

1 year ago

2.0.71

1 year ago

2.0.72

1 year ago

2.0.70

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.4

1 year ago

2.1.3

1 year ago

2.1.6

1 year ago

2.1.8

1 year ago

2.1.7

1 year ago

2.1.0

1 year ago

2.0.28

1 year ago

2.0.29

1 year ago

2.0.37

1 year ago

2.0.38

1 year ago

2.0.35

1 year ago

2.0.36

1 year ago

2.0.33

1 year ago

2.0.34

1 year ago

2.0.31

1 year ago

2.0.32

1 year ago

2.0.30

1 year ago

2.0.39

1 year ago

2.0.49

1 year ago

2.0.46

1 year ago

2.0.47

1 year ago

2.0.44

1 year ago

2.0.45

1 year ago

2.0.43

1 year ago

2.0.40

1 year ago

2.0.51

1 year ago

2.0.52

1 year ago

2.0.50

1 year ago

2.0.26

1 year ago

2.0.27

1 year ago

2.0.25

1 year ago

2.0.23

1 year ago

2.0.22

2 years ago

2.0.20

2 years ago

2.0.21

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.9

2 years ago

2.0.8

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.5

2 years ago

2.0.15

2 years ago

2.0.16

2 years ago

2.0.13

2 years ago

2.0.14

2 years ago

2.0.11

2 years ago

2.0.12

2 years ago

2.0.10

2 years ago

2.0.19

2 years ago

2.0.17

2 years ago

2.0.18

2 years ago

1.1.1

2 years ago

1.0.2

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

0.0.37

2 years ago

0.0.38

2 years ago

0.0.39

2 years ago

0.0.31

2 years ago

0.0.32

2 years ago

0.0.33

2 years ago

0.0.34

2 years ago

0.0.35

2 years ago

0.0.36

2 years ago

0.0.29

2 years ago

0.0.28

2 years ago

0.0.27

2 years ago

0.0.26

2 years ago

0.0.25

2 years ago

0.0.24

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.21

2 years ago