@dfares/constants v7.1.4
@dfares/constants
This package contains useful constants for use when interacting with the Dark Forest smart contracts within JavaScript or TypeScript.
Installation
You can install this package using npm or
yarn by running:
npm install --save @dfares/constantsyarn add @dfares/constantsWhen using this in a plugin, you might want to load it with skypack
import * as constants from 'http://cdn.skypack.dev/@dfares/constants';Table of contents
Variables
- BLOCKCHAIN_BRIDGE
- BLOCKCHAIN_NAME
- BLOCK_EXPLORER_URL
- CONTRACT_PRECISION
- DEFAULT_GAS_PRICES
- DEFAULT_MAX_CALL_RETRIES
- EMPTY_ADDRESS
- EMPTY_ARTIFACT_ID
- EMPTY_LOCATION_ID
- FIXED_DIGIT_NUMBER
- GAS_ADJUST_DELTA
- GAS_PRICES_INTERVAL_MS
- GAS_PRICE_API
- HAT_SIZES
- HOST_TEAM_NAME
- HOW_TO_ENABLE_POPUPS
- HOW_TO_TRANSFER_ETH_FROM_L2_TO_REDSTONE
- LOCATION_ID_UB
- MAX_ARTIFACT_RARITY
- MAX_ARTIFACT_TYPE
- MAX_AUTO_GAS_PRICE_GWEI
- MAX_AVATAR_TYPE
- MAX_BIOME
- MAX_HAT_TYPE
- MAX_LOGO_TYPE
- MAX_MEME_TYPE
- MAX_PLANET_LEVEL
- MAX_SPACESHIP_TYPE
- MIN_ARTIFACT_RARITY
- MIN_ARTIFACT_TYPE
- MIN_AVATAR_TYPE
- MIN_BIOME
- MIN_HAT_TYPE
- MIN_LOGO_TYPE
- MIN_MEME_TYPE
- MIN_PLANET_LEVEL
- MIN_SPACESHIP_TYPE
- PICTURE_URL
- PLANET_CLAIM_MIN_LEVEL
- PLAYER_GUIDE
- RECOMMENDED_MODAL_WIDTH
- SpecialKey
- THEGRAPH_API_URL
- TOKEN_NAME
- WIN_CONDITION_AND_PRIZES
Variables
BLOCKCHAIN_BRIDGE
• Const BLOCKCHAIN_BRIDGE: "https://relay.link/bridge/redstone/"
The URL to the bridge for the chain being used. Prepended to transaction links, etc
BLOCKCHAIN_NAME
• Const BLOCKCHAIN_NAME: "Redstone"
BLOCK_EXPLORER_URL
• Const BLOCK_EXPLORER_URL: "https://explorer.redstone.xyz"
The URL to the block explorer for the chain being used. Prepended to transaction links, etc
CONTRACT_PRECISION
• Const CONTRACT_PRECISION: 1000
The precision of Energy & Silver stored in the Dark Forest smart contracts.
Energy and Silver are not stored as floats in the smart contracts,
so any of those values coming from the contracts need to be divided by CONTRACT_PRECISION
and any values being sent to the contract need to be multiplied by CONTRACT_PRECISION.
DEFAULT_GAS_PRICES
• Const DEFAULT_GAS_PRICES: GasPrices
In case we cannot load gas prices from xDai, these are the default auto gas prices.
DEFAULT_MAX_CALL_RETRIES
• Const DEFAULT_MAX_CALL_RETRIES: 12
By default, the various {@link ContractCaller} will retry a blockchain read this many times.
EMPTY_ADDRESS
• Const EMPTY_ADDRESS: EthAddress
The 0x0 Ethereum address, which is used for unowned planets, artifacts without an owner, etc.
EMPTY_ARTIFACT_ID
• Const EMPTY_ARTIFACT_ID: ArtifactId
A blank ArtifactID (all zeros).
EMPTY_LOCATION_ID
• Const EMPTY_LOCATION_ID: LocationId
A blank LocationID (all zeros).
FIXED_DIGIT_NUMBER
• Const FIXED_DIGIT_NUMBER: 9
GAS_ADJUST_DELTA
• Const GAS_ADJUST_DELTA: "0.00000001"
GAS_PRICES_INTERVAL_MS
• Const GAS_PRICES_INTERVAL_MS: 60000
The amount of time between gas price refreshes when fetching prices from the oracle.
GAS_PRICE_API
• Const GAS_PRICE_API: "https://blockscout.com/xdai/mainnet/api/v1/gas-price-oracle"
The URL for xDai's API that returns the gas prices for 35th, 60th, and 90th percentiles of gas prices in the previous 200 blocks. Useful for auto gas price setting.
https://www.xdaichain.com/for-developers/developer-resources/gas-price-oracle
HAT_SIZES
• Const HAT_SIZES: string[]
HOST_TEAM_NAME
• Const HOST_TEAM_NAME: "DF Archon"
HOW_TO_ENABLE_POPUPS
• Const HOW_TO_ENABLE_POPUPS: "https://dfares.notion.site/How-to-enable-popups-d0f939dd9a114ae38ea5fbc7ed401828?pvs=74"
HOW_TO_TRANSFER_ETH_FROM_L2_TO_REDSTONE
• Const HOW_TO_TRANSFER_ETH_FROM_L2_TO_REDSTONE: "https://dfares.notion.site/How-to-transfer-ETH-from-L2-to-Redstone-Mainnet-f0be2d7a3d274e8a88f8e83d0ef4e212?pvs=74"
LOCATION_ID_UB
• Const LOCATION_ID_UB: BigInteger
The upper-bounds of a LocationID.
Represents the maximum possible value that the MiMC hash function (used for IDing locations in the universe) can output.
A LocationID must be less than LOCATION_ID_UB / PLANET_RARITY in order to be considered a valid planet.
MAX_ARTIFACT_RARITY
• Const MAX_ARTIFACT_RARITY: ArtifactRarity = ArtifactRarity.Mythic
The value of the maximum, valid artifact rarity
MAX_ARTIFACT_TYPE
• Const MAX_ARTIFACT_TYPE: ArtifactType = ArtifactType.ShipPink
The value of the maximum, valid artifact type
MAX_AUTO_GAS_PRICE_GWEI
• Const MAX_AUTO_GAS_PRICE_GWEI: 15
In case xDai's auto-price is something ridiculous, we don't want our players to insta run out of money.
MAX_AVATAR_TYPE
• Const MAX_AVATAR_TYPE: 24
MAX_BIOME
• Const MAX_BIOME: Biome = Biome.CORRUPTED
The value of the maximum, valid biome
MAX_HAT_TYPE
• Const MAX_HAT_TYPE: 10
MAX_LOGO_TYPE
• Const MAX_LOGO_TYPE: 22
MAX_MEME_TYPE
• Const MAX_MEME_TYPE: 10
MAX_PLANET_LEVEL
• Const MAX_PLANET_LEVEL: PlanetLevel = PlanetLevel.NINE
The value of the maximum, valid planet level
MAX_SPACESHIP_TYPE
• Const MAX_SPACESHIP_TYPE: ArtifactType = ArtifactType.ShipPink
The value of the maximum, valid spaceship type
MIN_ARTIFACT_RARITY
• Const MIN_ARTIFACT_RARITY: ArtifactRarity = ArtifactRarity.Common
The value of the minimum, valid artifact rarity
MIN_ARTIFACT_TYPE
• Const MIN_ARTIFACT_TYPE: ArtifactType = ArtifactType.Monolith
The value of the minimum, valid artifact type
MIN_AVATAR_TYPE
• Const MIN_AVATAR_TYPE: 1
MIN_BIOME
• Const MIN_BIOME: Biome = Biome.OCEAN
The value of the minimum, valid biome
MIN_HAT_TYPE
• Const MIN_HAT_TYPE: 1
MIN_LOGO_TYPE
• Const MIN_LOGO_TYPE: 1
MIN_MEME_TYPE
• Const MIN_MEME_TYPE: 1
MIN_PLANET_LEVEL
• Const MIN_PLANET_LEVEL: PlanetLevel = PlanetLevel.ZERO
The value of the minimum, valid planet level
MIN_SPACESHIP_TYPE
• Const MIN_SPACESHIP_TYPE: ArtifactType = ArtifactType.ShipMothership
The value of the minimum, valid spaceship type
PICTURE_URL
• Const PICTURE_URL: "https://dfares.xyz/public"
PLANET_CLAIM_MIN_LEVEL
• Const PLANET_CLAIM_MIN_LEVEL: 3
The minimum level required for claiming a planet.
PLAYER_GUIDE
• Const PLAYER_GUIDE: "https://dfares.notion.site/DFAres-Round-4-Guide-c52181824f21461f9fa50a9f7989555c?pvs=74"
RECOMMENDED_MODAL_WIDTH
• Const RECOMMENDED_MODAL_WIDTH: "400px"
{@link UnionContextPane} is this wide, and all the subpanes of that modal also try to stay this size as well.
SpecialKey
• Const SpecialKey: Object
Keys to handle in a special fashion when dealing with key presses
Type declaration
| Name | Type |
|---|---|
Control | "Control" |
Escape | "Escape" |
Shift | "Shift" |
Space | " " |
Tab | "Tab" |
THEGRAPH_API_URL
• Const THEGRAPH_API_URL: "https://api.thegraph.com/subgraphs/name/darkforest-eth/dark-forest-v06-round-5"
This should be updated every round.
TOKEN_NAME
• Const TOKEN_NAME: "ETH"
WIN_CONDITION_AND_PRIZES
• Const WIN_CONDITION_AND_PRIZES: "https://dfares.notion.site/1-1-Win-Conditions-Prizes-a284690f35b44a29b0d1100bbaa3e8e0?pvs=74"
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago