Merge branch 'fix/assets-endpoint' into main
This commit is contained in:
commit
6eb13e995e
@ -18,7 +18,7 @@ import {
|
|||||||
DEFAULT_PROJECT_ID,
|
DEFAULT_PROJECT_ID,
|
||||||
DEFAULT_RELAY_URL,
|
DEFAULT_RELAY_URL,
|
||||||
} from "../constants";
|
} from "../constants";
|
||||||
import { AccountBalances, apiGetAccountAssets } from "../helpers";
|
import { AccountBalances, apiGetAccountBalance } from "../helpers";
|
||||||
import { ERROR, getAppMetadata } from "@walletconnect/utils";
|
import { ERROR, getAppMetadata } from "@walletconnect/utils";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,8 +73,8 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac
|
|||||||
_accounts.map(async account => {
|
_accounts.map(async account => {
|
||||||
const [namespace, reference, address] = account.split(":");
|
const [namespace, reference, address] = account.split(":");
|
||||||
const chainId = `${namespace}:${reference}`;
|
const chainId = `${namespace}:${reference}`;
|
||||||
const assets = await apiGetAccountAssets(address, chainId);
|
const assets = await apiGetAccountBalance(address, chainId);
|
||||||
return { account, assets };
|
return { account, assets: [assets] };
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -19,6 +19,15 @@ export async function apiGetAccountAssets(address: string, chainId: string): Pro
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function apiGetAccountBalance(address: string, chainId: string): Promise<AssetData> {
|
||||||
|
const ethChainId = chainId.split(":")[1];
|
||||||
|
const response = await ethereumApi.get(
|
||||||
|
`/account-balance?address=${address}&chainId=${ethChainId}`,
|
||||||
|
);
|
||||||
|
const { result } = response.data;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
export async function apiGetAccountTransactions(
|
export async function apiGetAccountTransactions(
|
||||||
address: string,
|
address: string,
|
||||||
chainId: string,
|
chainId: string,
|
||||||
|
Loading…
Reference in New Issue
Block a user