Skip to content

Commit

Permalink
chore(providers): refactor minascan to blockberry
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcnk committed Dec 18, 2024
1 parent c44a491 commit 80bbbf8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ export interface TransactionsByAddressesArgs {
chainInfo?: Chain
}

export type TransactionsByHashesArgs = { ids: TxHash; chainInfo?: Chain }
export type TransactionsByHashesArgs = {
ids: TxHash
publicKey: ChainAddress
chainInfo?: Chain
}

export interface ChainHistoryProvider extends Provider {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ const convertToTransactionBody = (
): Mina.TransactionBody[] => {
return data.map((item) => ({
type: item.type.toLowerCase() as Mina.TransactionType,
from: item.direction === "OUT" ? address : item.account,
to: item.direction === "OUT" ? item.account : address,
from: item.direction === "OUT" ? address : item.accountAddress,
to: item.direction === "OUT" ? item.accountAddress : address,
fee: item.fee,
nonce: "", // Not available
amount: item.amount,
memo: item.memo,
validUntil: "", // Not available
blockHeight: item.block,
blockHeight: item.blockHeight,
token: "", // Not available
hash: item.transactionHash,
hash: item.txHash,
failureReason: "", // Not available
dateTime: new Date(item.age).toISOString(),
isDelegation: item.type === "delegation",
Expand All @@ -35,8 +35,8 @@ export const createChainHistoryProvider = (
const transactionsByAddresses = async (
args: TransactionsByAddressesArgs,
): Promise<Tx[]> => {
const limit = 20
const endpoint = `${url}/api/core/accounts/${args.addresses[0]}/activity?page=0&limit=${limit}&sortBy=age&orderBy=DESC&size=${limit}&pk=${args.addresses[0]}&direction=all`
const limit = 50
const endpoint = `${url}/v1/accounts/${args.addresses[0]}/txs?page=0&sortBy=AGE&orderBy=DESC&size=${limit}&direction=ALL`
const response = await fetch(endpoint)
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
Expand Down
4 changes: 2 additions & 2 deletions packages/vault/src/network-info/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const DEFAULT_NETWORK_INFO: Record<NetworkId, ProviderConfig> = {
},
archiveNodeEndpoint: {
providerName: "mina-scan",
url: "https://minascan.io/devnet/api/",
url: "https://pallad.co/api/proxy/mina-devnet",
},
explorer: {
transactionUrl: "https://minascan.io/devnet/tx/{hash}/txInfo",
Expand All @@ -36,7 +36,7 @@ export const DEFAULT_NETWORK_INFO: Record<NetworkId, ProviderConfig> = {
},
archiveNodeEndpoint: {
providerName: "mina-scan",
url: "https://minascan.io/mainnet/api/",
url: "https://pallad.co/api/proxy/mina-mainnet",
},
explorer: {
transactionUrl: "https://minascan.io/mainnet/tx/{hash}/txInfo",
Expand Down

0 comments on commit 80bbbf8

Please sign in to comment.