| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Unofficial DeFi Kingdoms SDK
Install the module using NPM:
npm install @thanpolas/degenking --save
const { getHeroesChain } = require('@thanpolas/degenking');
const [hero] = await getHeroesChain([10000]);
console.log(hero);Since v1.0.0 DegenKing has been multi-chain so it can support both Serendale and Crystalvale. The way multi-chain is accomplished is through two critical parts:
As you can see bellow on the Configuring RPC section, the property chainId has been introduced which declares for which network the call will be made. If that property is not valid an error will be thrown.
Each supported network will have its own, dedicated addresses constants module. As such, DegenKing exposes the following address constants:
It is by convention, that all address constant modules maintain the exact same naming scheme so you can easily get the correct address for the network you want.
Key function to this operation is the getAddresses() function:
Will return the appropriate addresses constant module based on the given chainId.
const { getAddresses } = require('@thanpolas/degenking');
const addresses = getAddresses(1666600000);
console.log(addresses);
// Prints all the available contract addresses for this network...All Address constant modules (except noted) will contain the following constants:
By default the library will use the Official Harmony RPC. You may override this by configuring degenking:
degenKing.config('getProvider', async (chainId) => {
// getProvider() will be invoked with the chainId indicating which
// network needs to be queried.
return {
name: 'Pokt',
provider: new ethers.providers.JsonRpcProvider('https://....'),
chainId: 1666600000,
};
});What has been done above is to set the configuration key named getProvider and give it a value of a callback function. This function will be invoked by the library and it expects to receive an object with the following properties:
ℹ️ The callback function can be a Promise returning function.
The config function accepts an object as well:
degenKing.config({
getProvider: {
name: 'Pokt',
provider: new ethers.providers.JsonRpcProvider('https://....'),
chainId: 1666600000,
},
maxRetries: 8,
concurrentBlockChainRequests: 50,
});Will fetch and normalize heroes from the blockchain using provided hero ids. It will augment the hero object using multiple queries and functions to also include sales data, owner profile and decode all stat and visual genes.
const { getHeroesChain } = require('@thanpolas/degenking');
const [hero] = await getHeroesChain(1666600000, [10000]);
console.log(hero);Available since v1.0.4, wraps around getHeroesChain() and will query all available networks for the provided heroes. It will then check which heroes are on which network based on the owner address field (if they belong to the bridge contract) and return the appropriate hero state based on the chain they are on.
const { getHeroesAnyChain } = require('@thanpolas/degenking');
const [hero] = await getHeroesAnyChain([10000]);
console.log(hero);Fetches and normalizes heroes based on the owner.
const { fetchHeroesByOwnerChain } = require('@thanpolas/degenking');
const heroes = await fetchHeroesByOwnerChain(myAddress);
console.log(heroes);Fetches hero IDs of all heroes owned by the owner address.
const { fetchHeroIdsByOwnerChain } = require('@thanpolas/degenking');
const heroIds = await fetchHeroIdsByOwnerChain(myAddress);
console.log(heroIds);
// [1, 2, 3, 4]Fetches and normalizes heroes based on the owner and profession.
const {
fetchHeroesByOwnerAndProfessionChain,
} = require('@thanpolas/degenking');
const myAddress = '0x....';
const heroes = await fetchHeroesByOwnerAndProfessionChain(myAddress, 'mining');
console.log(heroes);Note: There is no per-profession filter on the blockchain, all of the address' heroes will be fetched and filter at runtime.
Renders the normalized hero object into a string representation.
const { heroToString, getHeroesChain } = require('@thanpolas/degenking');
const [hero] = await getHeroesChain([10000]);
const heroStr = await heroToString(hero, { cli: true });
console.log(heroStr);Find bellow the different ways the heroToString() renders:
Default Rendering as well as all other renderings will produce a string that can be used on Discord, the **word** notation you see, will render the text as bold when used on discord.
**Owner**:Ceebs - **10000** - **SD** - **G2** - **⛏️ mining** - **pirate:warrior** - **Rare(2)** - **⛏️ 55%, 👨🌾 11%, 🌳 34%, 🎣 39%** - **CR**:37 - **JM**:32.7488 - **B1**:INT 🌳 - **B2**:DEX 🌳 - **RGMC**:WAR, WIZ, THF - **RGSC**:PIR, WIZ, MON - **RGP**:👨🌾, ⛏️, 🌳 - **XP**:914/2000 - **L**:1 - **PS**:⛏️: 5.9, 🌳: 0.2, 🎣: 2.4 - **SMN**:0/8 - **STA**:25/25 - **HP**:145 - **MP**:30
All renderings accept the {cli: true} modifier, which will remove the **word** notation for use on the CLI or logging.
Owner:Ceebs - 10000 -SD - G2 - ⛏️ mining - pirate:warrior - Rare(2) - ⛏️ 55%, 👨🌾 11%, 🌳 34%, 🎣 39% - CR:37 - JM:32.7488 - B1:INT 🌳 - B2:DEX 🌳 - RGMC:WAR, WIZ, THF - RGSC:PIR, WIZ, MON - RGP:👨🌾, ⛏️, 🌳 - XP:914/2000 - L:1 - PS:⛏️: 5.9, 🌳: 0.2, 🎣: 2.4 - SMN:0/8 - STA:25/25 - HP:145 - MP:30
Will also render Active/Passive traits
Owner:Ceebs - 10000 - SD - G2 - ⛏️ mining - pirate:warrior - Rare(2) - ⛏️ 55%, 👨🌾 11%, 🌳 34%, 🎣 39% - CR:37 - JM:32.7488 - B1:INT 🌳 - B2:DEX 🌳 - RGMC:WAR, WIZ, THF - RGSC:PIR, WIZ, MON - RGP:👨🌾, ⛏️, 🌳 - XP:914/2000 - L:1 - PS:⛏️: 5.9, 🌳: 0.2, 🎣: 2.4 - SMN:0/8 - A1:B8 - A2:B3 - P1:B5 - P2:B2 - STA:25/25 - HP:145 - MP:30
Owner:Ceebs - 10000 - SD - G2 - ⛏️ mining - pirate:warrior - Rare(2) - ⛏️ 55%, 👨🌾 11%, 🌳 34%, 🎣 39% - CR:37 - JM:32.7488 - B1:INT 🌳 - B2:DEX 🌳 - RGMC:WAR, WIZ, THF - RGSC:PIR, WIZ, MON - RGP:👨🌾, ⛏️, 🌳 - XP:914/2000 - L:1 - PS:⛏️: 5.9, 🌳: 0.2, 🎣: 2.4 - SMN:0/8 - STR:10 - AGI:8 - INT:7 - WIS:6 - LCK:10 - VIT:9 - END:7 - DEX:9 - STA:25/25 - HP:145 - MP:30
Owner:Ceebs - 10000 - SD - G2 - ⛏️ mining - pirate:warrior - RGMC:WAR, WIZ, THF - RGSC:PIR, WIZ, MON - RGP:👨🌾, ⛏️, 🌳 - XP:914/2000 - L:1 - PS:⛏️: 5.9, 🌳: 0.2, 🎣: 2.4 - SMN:0/8 - STA:25/25 - HP:145 - MP:30
Ceebs - id:10000 - G:2 - ⛏️ mining - pirate:warrior - Rare - 0/8 - L:1
Ceebs - id:10000 - SD - G:2 - ⛏️ - pirate:warrior - Rare - L:1 - STA:25/25 - XP:100/2000
id:10000 - SD - L:1 - STA:25/25 - XP:100/2000
Calculates and returns the remaining stamina of the hero.
const {
calculateRemainingStamina,
getHeroesChain,
} = require('@thanpolas/degenking');
const [hero] = await getHeroesChain([10000]);
const heroStamina = await calculateRemainingStamina(hero);
console.log(heroStamina);
// 20Calculates the needed runes to level up a hero at the provided level.
const { calculateRuneRequirements } = require('@thanpolas/degenking');
const requiredRunes = calculateRuneRequirements(30);
console.log(requiredRunes);
// [
// { rune: 'courageRune', quantity: 1 },
// { rune: 'hopeRune', quantity: 5 },
// { rune: 'mokshaRune', quantity: 1 },
// { rune: 'shvasRune', quantity: 1 },
// ];Decodes the raw stat genes string.
const statGenes =
'55595053337262517174437940546058771473513094722680050621928661284030532';
const decodedStatGenes = decodeStatGenes(statGenes);!!! Breaking Change Since 1.3.0
The return has been further normalized and labeled:
{
recessives: {
r1: {
class: 5,
subClass: 0,
profession: 2,
passive1: 3,
passive2: 2,
active1: 2,
active2: 7,
statBoost1: 10,
statBoost2: 14,
statsUnknown1: 4,
element: 0,
statsUnknown2: 0,
classDescr: 'wizard',
subClassDescr: 'warrior',
professionDescr: 'gardening',
passive1Mut: 'Basic4',
passive2Mut: 'Basic3',
active1Mut: 'Basic3',
active2Mut: 'Basic8',
statsUnknown1Mut: 'Basic5',
statsUnknown2Mut: 'Basic1',
statBoost1Descr: 'VIT',
statBoost2Descr: 'DEX',
elementDescr: 'fire'
},
r2: {
class: 0,
subClass: 6,
profession: 0,
passive1: 3,
passive2: 3,
active1: 4,
active2: 7,
statBoost1: 2,
statBoost2: 14,
statsUnknown1: 5,
element: 10,
statsUnknown2: 10,
classDescr: 'warrior',
subClassDescr: 'monk',
professionDescr: 'mining',
passive1Mut: 'Basic4',
passive2Mut: 'Basic4',
active1Mut: 'Basic5',
active2Mut: 'Basic8',
statsUnknown1Mut: 'Basic6',
statsUnknown2Mut: 'Basic11',
statBoost1Descr: 'AGI',
statBoost2Descr: 'DEX',
elementDescr: 'ice'
},
r3: {
class: 8,
subClass: 8,
profession: 4,
passive1: 1,
passive2: 1,
active1: 0,
active2: 6,
statBoost1: 2,
statBoost2: 6,
statsUnknown1: 6,
element: 10,
statsUnknown2: 6,
classDescr: 'berserker',
subClassDescr: 'berserker',
professionDescr: 'fishing',
passive1Mut: 'Basic2',
passive2Mut: 'Basic2',
active1Mut: 'Basic1',
active2Mut: 'Basic7',
statsUnknown1Mut: 'Basic7',
statsUnknown2Mut: 'Basic7',
statBoost1Descr: 'AGI',
statBoost2Descr: 'WIS',
elementDescr: 'ice'
}
},
class: 8,
subClass: 9,
profession: 4,
passive1: 3,
passive2: 7,
active1: 5,
active2: 3,
statBoost1: 6,
statBoost2: 10,
statsUnknown1: 3,
element: 8,
statsUnknown2: 10,
classDescr: 'berserker',
subClassDescr: 'seer',
professionDescr: 'fishing',
passive1Mut: 'Basic4',
passive2Mut: 'Basic8',
active1Mut: 'Basic6',
active2Mut: 'Basic4',
statsUnknown1Mut: 'Basic4',
statsUnknown2Mut: 'Basic11',
statBoost1Descr: 'WIS',
statBoost2Descr: 'VIT',
elementDescr: 'lightning'
}Decodes the raw visuals genes string.
const visualGenes =
'170877259497388213840353281232231169976585066888929467746175634464967719';
const decodedVisualGenes = decodeStatGenes(visualGenes);!!! Breaking Change Since 1.3.0
The return has been further normalized and labeled:
const decodedVisualGenes = {
recessives: {
r1: {
gender: 1,
headAppendage: 5,
backAppendage: 2,
background: 6,
hairStyle: 4,
hairColor: 7,
visualUnknown1: 4,
eyeColor: 2,
skinColor: 2,
appendageColor: 6,
backAppendageColor: 6,
visualUnknown2: 7,
genderDescr: 'male',
backgroundDescr: 'island',
headAppendageDescr: 'Cat Ears',
headAppendageMut: 'Basic6',
backAppendageDescr: 'Cat Tail',
backAppendageMut: 'Basic3',
hairStyleDescr: 'Pixel',
hairStyleMut: 'Basic5',
hairColorHex: '62a7e6',
hairColorMut: 'Basic8',
eyeColorHex: '896693',
eyeColorMut: 'Basic3',
skinColorHex: 'f1ca9e',
skinColorMut: 'Basic3',
appendageColorHex: '830e18',
appendageColorMut: 'Basic7',
backAppendageColorHex: '830e18',
backAppendageColorMut: 'Basic7',
visualUnknown1Mut: 'Basic5',
visualUnknown2Mut: 'Basic8',
},
r2: {
gender: 1,
headAppendage: 6,
backAppendage: 6,
background: 10,
hairStyle: 9,
hairColor: 1,
visualUnknown1: 4,
eyeColor: 4,
skinColor: 14,
appendageColor: 4,
backAppendageColor: 8,
visualUnknown2: 2,
genderDescr: 'male',
backgroundDescr: 'mountains',
headAppendageDescr: 'Minotaur Horns',
headAppendageMut: 'Basic7',
backAppendageDescr: 'Kitsune Tail',
backAppendageMut: 'Basic7',
hairStyleDescr: 'Faded Topknot',
hairStyleMut: 'Basic10',
hairColorHex: 'af3853',
hairColorMut: 'Basic2',
eyeColorHex: 'bb3f55',
eyeColorMut: 'Basic5',
skinColorHex: 'aa5c38',
skinColorMut: undefined,
appendageColorHex: '2a386d',
appendageColorMut: 'Basic5',
backAppendageColorHex: 'cddef0',
backAppendageColorMut: 'Basic9',
visualUnknown1Mut: 'Basic5',
visualUnknown2Mut: 'Basic3',
},
r3: {
gender: 1,
headAppendage: 2,
backAppendage: 5,
background: 12,
hairStyle: 4,
hairColor: 4,
visualUnknown1: 4,
eyeColor: 6,
skinColor: 0,
appendageColor: 7,
backAppendageColor: 7,
visualUnknown2: 3,
genderDescr: 'male',
backgroundDescr: 'city',
headAppendageDescr: 'Satyr Horns',
headAppendageMut: 'Basic3',
backAppendageDescr: 'Daishō',
backAppendageMut: 'Basic6',
hairStyleDescr: 'Pixel',
hairStyleMut: 'Basic5',
hairColorHex: '48321e',
hairColorMut: 'Basic5',
eyeColorHex: '0d7634',
eyeColorMut: 'Basic7',
skinColorHex: 'c58135',
skinColorMut: 'Basic1',
appendageColorHex: '6f3a3c',
appendageColorMut: 'Basic8',
backAppendageColorHex: '6f3a3c',
backAppendageColorMut: 'Basic8',
visualUnknown1Mut: 'Basic5',
visualUnknown2Mut: 'Basic4',
},
},
gender: 3,
headAppendage: 6,
backAppendage: 8,
background: 0,
hairStyle: 9,
hairColor: 9,
visualUnknown1: 1,
eyeColor: 2,
skinColor: 4,
appendageColor: 1,
backAppendageColor: 3,
visualUnknown2: 2,
genderDescr: 'female',
backgroundDescr: 'desert',
headAppendageDescr: 'Minotaur Horns',
headAppendageMut: 'Basic7',
backAppendageDescr: 'Skeletal Wings',
backAppendageMut: 'Basic9',
hairStyleDescr: 'Lamia',
hairStyleMut: 'Basic10',
hairColorHex: '326988',
hairColorMut: 'Basic10',
eyeColorHex: '896693',
eyeColorMut: 'Basic3',
skinColorHex: '985e1c',
skinColorMut: 'Basic5',
appendageColorHex: 'a88b47',
appendageColorMut: 'Basic2',
backAppendageColorHex: '566f7d',
backAppendageColorMut: 'Basic4',
visualUnknown1Mut: 'Basic2',
visualUnknown2Mut: 'Basic3',
};!!! WARNING !!! Deprecated - Use decodeStatGenes() or decodeVisualGenes()
Decodes the raw stat genes to produce recessive genes.
const statGenes =
'119067243983457416993287681075686535166558725967282153752039019969001550';
const recessiveGenes = decodeStatGenes(statGenes);
console.log(recessiveGenes);
// {
// mainClassGenes: ['pirate','warrior','wizard','thief'],
// subClassGenes: ['warrior', 'pirate', 'wizard', 'monk'],
// professionGenes: ['mining','gardening','mining','foraging'],
// }Will query the blockchain, profile contract, for the member data that belong to the provided address.
const { getProfileByAddress } = require('@thanpolas/degenking');
const profile = await getProfileByAddress(
'0x67221b267cee49427bAa0974ceac988682192977',
);
console.log(profile);
// {
// id: 0,
// owner: '0x67221b267cee49427baa0974ceac988682192977',
// name: 'Degen Heroes',
// created: new Date('2022-02-11T15:00:57.000Z'),
// picId: 0,
// heroId: 1,
// points: 0,
// }const hero = {
rawHero: { /** Raw hero object as fetched from blockchain **/ },
source: 'chain',
id: 59760,
ownerId: 19192,
ownerName: 'miamiblue',
ownerAddress: '0x6e9426c100dec5abc50bebe309cd85d304209096',
mainClass: 'warrior',
subClass: 'archer',
profession: 'gardening',
generation: 1,
summons: 7,
maxSummons: 10,
statBoost1: 'LCK',
statBoost2: 'DEX',
active1: 'Basic8',
active2: 'Basic3',
passive1: 'Basic6',
passive2: 'Basic4',
rarity: 0,
rarityStr: 'Common',
mining: 0.5,
gardening: 0,
foraging: 0.7,
fishing: 1.1,
craft1: 0,
craft2: 0,
shiny: false,
xp: 1298,
level: 1,
statGenes: {
class: 'warrior',
subClass: 'archer',
profession: 'gardening',
passive1: 'Basic6',
passive2: 'Basic4',
active1: 'Basic8',
active2: 'Basic3',
statBoost1: 'LCK',
statBoost2: 'DEX',
statsUnknown1: 0,
element: 'lightning',
statsUnknown2: undefined
},
visualGenes: {
gender: 'male',
headAppendage: 5,
backAppendage: 5,
background: 'mountains',
hairStyle: 5,
hairColor: '62a7e6',
visualUnknown1: 5,
eyeColor: 'bb3f55',
skinColor: '985e1c',
appendageColor: '566f7d',
backAppendageColor: '566f7d',
visualUnknown2: 0
},
statGenesRaw: '112261588165465148833973414848613658505090605198079167959458376446967944',
visualGenesRaw: '167531060423278867008632326821039556379772927070476330103731967115858144',
summonedTime: 2021-12-07T23:03:23.000Z,
nextSummonTime: 2021-12-21T23:09:05.000Z,
summonerId: 83,
assistantId: 747,
staminaFullAt: 2022-01-17T17:02:16.000Z,
hpFullAt: 1970-01-01T00:00:00.000Z,
mpFullAt: 1970-01-01T00:00:00.000Z,
currentQuest: '0x0000000000000000000000000000000000000000',
isQuesting: false,
sp: 0,
status: 0,
intelligence: 5,
luck: 9,
vitality: 9,
dexterity: 8,
strength: 11,
wisdom: 5,
agility: 7,
endurance: 8,
statsSum: 62,
hp: 150,
mp: 25,
stamina: 25,
onSale: true,
auctionId: 611485,
seller: '0x6e9426c100Dec5AbC50bEbe309Cd85d304209096',
startingPrice: 45,
endingPrice: 45,
startingPriceFormatted: '45',
endingPriceFormatted: '45',
duration: 60,
startedAt: 2022-01-26T15:19:26.000Z,
summonCost: 30,
classTier: 'basic',
summonMinTears: 10,
summonMaxTears: 10,
equipmentEquippedSlots: 1,
equipmentPetId: 2000000022783,
equipmentWeapon1Id: 0,
equipmentWeapon2Id: 0,
equipmentOffhand1Id: 0,
equipmentOffhand2Id: 0,
equipmentArmorId: 0,
equipmentAccessoryId: 0,
equipedPet: {
id: 2000000022783,
originId: 0,
name: '',
season: 1,
eggTypeId: 2,
eggTypeName: 'Green Pet Egg',
rarityId: 4,
rarityName: 'Mythic',
elementId: 6,
elementName: 'Light',
bonusCount: 3,
petProfessionName: 'Gardening',
petProfessionInstanceId: '5',
petHasQuestProfessionBonus: false,
profBonusId: 171,
profBonusName: 'Innate Greenskeeper',
profBonusScalar: 0.1,
craftBonusId: 160,
craftBonusName: 'Unrevealed',
craftBonusScalar: 0,
combatBonusId: 80,
combatBonusName: 'Unrevealed',
combatBonusScalar: 0,
craftingBonusType: 'Enchanting',
appearanceId: 139,
backgroundId: 3,
backgroundName: 'Vithraven Outskirts',
shinyId: 1,
hungryAt: 2021-10-01T00:00:00.000Z,
equippableAt: 1970-01-01T00:00:00.000Z,
equippedTo: 1000000166827,
fedBy: '0x4cc6ba1127c9d84eba64fd86a2c0836b152756aa',
foodTypeId: 3
},
currentStamina: 25,
currentRank: 14,
estJewelPerTick: 0.26188,
estJewelPer100Ticks: 26.1875,
mainClassGenes: [ 'warrior', 'thief', 'knight', 'thief' ],
subClassGenes: [ 'archer', 'warrior', 'knight', 'pirate' ],
professionGenes: [ 'gardening', 'gardening', 'gardening', 'gardening' ],
chainId: 1666600000,
realm: 'SD',
networkName: 'Harmony',
}Consumes a potion for the given hero. Does not approve consumption, you have to do it manually (for now).
const { getAddresses, consumePotion } = require('@thanpolas/degenking');
const addresses = getAddresses(1666600000);
// Get the stamina vial address, which will be consumed.
const { CONSUMABLE_STAMINA_VIAL } = addresses;
// Invoke consumption
const response = await consumePotion(CONSUMABLE_STAMINA_VIAL, heroId, privKey);
console.log(response);
// {
// playerAddress: '0x.....',
// itemAddress: '0x....',
// itemName: 'CONSUMABLE_STAMINA_VIAL',
// heroId: 100000,
// oldHero: {
// // Normalized hero object representing state
// // of hero before consumption
// },
// newHero: {
// // Normalized hero object representing state
// // of hero after consumption
// }
// }Consumable potion addresses are available as constants on the ADDRESS constant:
const { getAddresses } = require('@thanpolas/degenking');
const addresses = getAddresses(1666600000);
// All the available potions to consume
const {
CONSUMABLE_HEALTH_VIAL,
CONSUMABLE_FULL_HEALTH_POTION,
CONSUMABLE_MANA_VIAL,
CONSUMABLE_FULL_MANA_POTION,
CONSUMABLE_STAMINA_VIAL,
CONSUMABLE_ANTI_POISON_POTION,
CONSUMABLE_ANTI_BLINDING_POTION,
CONSUMABLE_MAGIC_RESISTANCE_POTION,
CONSUMABLE_TOUGHNESS_POTION,
CONSUMABLE_SWIFTNESS_POTION,
} = addresses;Get balance of the consumable item for the given address.
const { getAddresses, consumableBalance } = require('@thanpolas/degenking');
const addresses = getAddresses(1666600000);
// Get the stamina vial address, which will be consumed.
const { CONSUMABLE_STAMINA_VIAL } = addresses;
const myAddress = '0x.....';
const balance = await consumableBalance(myAddress, CONSUMABLE_STAMINA_VIAL);
console.log(balance);
// 10Queries blockchain and returns auction (sales) data of hero.
const { getSalesAuctionChainByHeroId } = require('@thanpolas/degenking');
const salesData = await getSalesAuctionChainByHeroId(10000);
console.log(salesData);
// {
// onSale: false,
// auctionId: null,
// seller: '',
// startingPrice: 0,
// endingPrice: 0,
// duration: 0,
// startedAt: 0,
// };DEPRECATION WARN: This function was used to be called getSalesData() which will be deprecated by v0.5.0.
Queries the GraphQL API for a sales auction based on auction id.
const { getSalesAuctionGqlByAuctionId } = require('@thanpolas/degenking');
const auctionData = await getSalesAuctionGqlByAuctionId(1029620);
console.log(auctionData);
// {
// auctionId: 1029620,
// sellerAddress: '0xcf45c7227db5577dbbefec665821f06981243b63',
// sellerName: 'Introverse',
// heroId: 52261,
// startingPrice: '55000000000000000000',
// endingPrice: '55000000000000000000',
// duration: 60,
// startedAt: new Date('2022-03-21T14:27:36.000Z'),
// endedAt: new Date('2022-03-21T14:27:36.000Z'),
// buyerAddress: '0x9e30ba74500a2a66e7884d623d409563a38ef687',
// buyerName: 'Ariana Sundae',
// open: false,
// purchasePrice: '55000000000000000000',
// }"Game Tokens" are the respective tokens used on each chain the same is at, so currently there are:
Fetches the locked game tokens of the provided address from the blockchain using the appropriate network as provided by chainId.
const { fetchLockedTokensByOwnerChain } = require('@thanpolas/degenking');
const HARMONY_CHAIN_ID = 1666600000;
const lockedJewel = await fetchLockedTokensByOwnerChain(
HARMONY_CHAIN_ID,
'0x....',
);
console.log(lockedJewel);
// 12.9Fetches rich information from on-chain about a specific quest id. There are a few interesting things happening behind the scenes with this one:
const { queryQuest } = require('@thanpolas/degenking');
const questData = await queryQuest(100000);
console.log(questData);{
version: 1, // QuestCore Version
id: 100000, // Quest id
// Quest contract address
questAddress: '0x569E6a4c2e3aF31B337Be00657B4C040C828Dd73',
// Quest contract address lowercased
questAddressLower: '0x569e6a4c2e3af31b337be00657b4c040c828dd73',
// Quest name
questName: 'MINING_GOLD',
// Player's address
playerAddress: '0x0000000000000000000000000000000000000000',
// Player's address lowercase
playerAddressLower: '0x0000000000000000000000000000000000000000',
// In game name of the player (profile)
profileName: 'ingamename'
startBlock: 27383000, // Block number rquest started
startAtTime: 2022-06-04T21:51:23.000Z, // Native JS data
completeAtTime: 2022-06-05T00:01:23.000Z, // Native JS data
attempts: 1, // Quest Attempts
// Quest Status:
// 1: In Progress
// 2: Complete
status: 2,
// Array of hero ids
heroIds: [ 49162, 128862, 146194, 146091, 159853, 173313 ],
// Array of full objects of heroes as fetched from the chain
// at the time of the "startBlock" value.
allHeroes: [{}]
// String representation of heroes optimized for questing, as an Array
heroesQuestAr: [
'id:49162 Stam:14 JPT100:37.76978J R:104 Q:Y',
'id:128862 Stam:14 JPT100:37.02038J R:94 Q:Y',
'id:146194 Stam:13 JPT100:36.27098J R:84 Q:Y',
'id:146091 Stam:13 JPT100:36.1211J R:82 Q:Y',
'id:159853 Stam:13 JPT100:35.82134J R:78 Q:Y',
'id:173313 Stam:26 JPT100:33.4982J R:47 Q:Y'
],
// String representation of heroes optimized for questing, as a string
heroesQuestStr: 'id:49162 Stam:14 JPT100:37.76978J R:104 Q:Y, id:128862 Stam:14 JPT100:37.02038J R:94 Q:Y, id:146194 Stam:13 JPT100:36.27098J R:84 Q:Y, id:146091 Stam:13 JPT100:36.1211J R:82 Q:Y, id:159853 Stam:13 JPT100:35.82134J R:78 Q:Y, id:173313 Stam:26 JPT100:33.4982J R:47 Q:Y',
}Update the following modules:
When a new node version is available you need to updated it in the following:
Copyright © Thanos Polychronakis and Authors, Licensed under ISC.
thanpolas.eth - 0x67221b267cee49427bAa0974ceac988682192977
| Back | FazBrowse Home | New Git URL |