Skip to content

Commit

Permalink
v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Ejhfast committed Aug 16, 2017
1 parent e31c0f2 commit f09b8b3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ export const getAPIEndpoint = (net) => {
// get node RPC endpoint on MainNet or TestNet based on block height status from neon wallet API
export const getRPCEndpoint = (net) => {
const apiEndpoint = getAPIEndpoint(net);
return axios.get(apiEndpoint + '/v1/network/best_node').then((response) => {
return axios.get(apiEndpoint + '/v2/network/best_node').then((response) => {
return response.data.node;
});
};

// get all available claim on an account using neon wallet API
export const getAvailableClaim = (net, address) => {
const apiEndpoint = getAPIEndpoint(net);
return axios.get(apiEndpoint + '/v1/address/claims/' + address).then((res) => {
return axios.get(apiEndpoint + '/v2/address/claims/' + address).then((res) => {
return parseInt(res.data.total_claim);
});
}
Expand All @@ -53,7 +53,7 @@ export const getAvailableClaim = (net, address) => {
// get the balance at an address using the neon wallet API
export const getBalance = (net, address) => {
const apiEndpoint = getAPIEndpoint(net);
return axios.get(apiEndpoint + '/v1/address/balance/' + address)
return axios.get(apiEndpoint + '/v2/address/balance/' + address)
.then((res) => {
const ans = res.data.NEO.balance;
const anc = res.data.GAS.balance;
Expand Down Expand Up @@ -84,15 +84,15 @@ export const getMarketPriceUSD = (amount) => {
// get history of balance over time using neon wallet API
export const getTransactionHistory = (net, address) => {
const apiEndpoint = getAPIEndpoint(net);
return axios.get(apiEndpoint + '/v1/address/history/' + address).then((response) => {
return axios.get(apiEndpoint + '/v2/address/history/' + address).then((response) => {
return response.data.history;
});
};

// get block height reported by neon wallet API
export const getWalletDBHeight = (net) => {
const apiEndpoint = getAPIEndpoint(net);
return axios.get(apiEndpoint + '/v1/block/height').then((response) => {
return axios.get(apiEndpoint + '/v2/block/height').then((response) => {
return parseInt(response.data.block_height);
});
}
Expand Down Expand Up @@ -127,7 +127,7 @@ export const claimAllGAS = (net, fromWif) => {
const apiEndpoint = getAPIEndpoint(net);
const account = getAccountsFromWIFKey(fromWif)[0];
// TODO: when fully working replace this with mainnet/testnet switch
return axios.get(apiEndpoint + "/v1/address/claims/" + account.address).then((response) => {
return axios.get(apiEndpoint + "/v2/address/claims/" + account.address).then((response) => {
console.log(response.data['claims']);
const claims = response.data["claims"];
const total_claim = response.data["total_claim"];
Expand Down

0 comments on commit f09b8b3

Please sign in to comment.