axie
Access to the AXIE Infinity API
Last updated 10 months ago by wehmoen .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install axie 
SYNC missed versions from official npm registry.

AXIE API

This is an AXIE

And this is a NPM package to interact with the AXIE API

Installation

npm install axie --save

Usage

const AXIE = require("axie");
let axie = new AXIE("0x07b37e682b100208c6288f2f121298a4d60d103c", false);

axie.getAccount().then(account => {
    console.log("Hello",account.name);
    axie.getBattleTeams().then(teams => {
        console.log("You have", teams.total, "teams:");
        console.log("Checking battle readiness...");
        console.log("=====");
        let battleStatus = [];

        teams.teams.forEach(team => {
            battleStatus.push(axie.canBattleTeamFight(team.teamId));
        });

        Promise.all(battleStatus).then(status => {
            status.forEach((battleTeam) => {
                let team = teams.teams.filter((team) => team.teamId === battleTeam.teamId);
                console.log(">",team[0].name);
                console.log("Can fight:", battleTeam.canFight.toString());
                console.log("=====");
            });
            return Promise.resolve();
        }).then(() => {
            axie.isCharmEnabled().then(charm => {
                if (charm.isCharmActivated) {
                    console.log("Great! Your charm is activated!");
                } else {
                    console.log("You should activate your charm!");
                }
            })
        })

    })
});

This should generate an output like:

Hello wehmoen
You have 4 teams:
Checking battle readiness...
=====
> The Gang
Can fight: false
=====
> Sushi Police
Can fight: false
=====
> Ballon Force One
Can fight: false
=====
> Steemit Inc.
Can fight: false
=====
Great! Your charm is activated!

Current Tags

  • 1.0.0                                ...           latest (10 months ago)

1 Versions

  • 1.0.0                                ...           10 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (1)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |