Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(providers): refactor minascan to blockberry #236

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,9 @@ 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`
console.log(">>>>ARGS", args, url)
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Mina } from "@palladxyz/mina-core"
import { Blockberry } from "../../src"

const explorerUrl =
process.env.ARCHIVE_NODE_URL || "https://minascan.io/devnet/api/"
process.env.ARCHIVE_NODE_URL || "https://pallad.co/api/proxy/mina-devnet"
const publicKey =
process.env.PUBLIC_KEY ||
"B62qjsV6WQwTeEWrNrRRBP6VaaLvQhwWTnFi4WP4LQjGvpfZEumXzxb"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Tx } from "@palladxyz/pallad-core"
import { type ProviderConfig, createChainProvider } from "../../src"

const explorerUrl =
process.env.EXPLORER_URL || "https://minascan.io/devnet/api/"
process.env.EXPLORER_URL || "https://pallad.co/api/proxy/mina-devnet"
const nodeUrl =
process.env.NODE_URL || "https://api.minascan.io/node/devnet/v1/graphql"
const publicKey =
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
Loading