Skip to content

Commit 557b25b

Browse files
authored
chore(providers): refactor minascan to blockberry (#236)
* chore(providers): refactor minascan to blockberry * fix(providers): fix devnet tests
1 parent c44a491 commit 557b25b

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

packages/pallad-core/src/Pallad/providers/chain-history-provider/types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ export interface TransactionsByAddressesArgs {
77
chainInfo?: Chain
88
}
99

10-
export type TransactionsByHashesArgs = { ids: TxHash; chainInfo?: Chain }
10+
export type TransactionsByHashesArgs = {
11+
ids: TxHash
12+
publicKey: ChainAddress
13+
chainInfo?: Chain
14+
}
1115

1216
export interface ChainHistoryProvider extends Provider {
1317
/**

packages/providers/src/blockberry-provider/chain-history/chain-history-provider.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ const convertToTransactionBody = (
1313
): Mina.TransactionBody[] => {
1414
return data.map((item) => ({
1515
type: item.type.toLowerCase() as Mina.TransactionType,
16-
from: item.direction === "OUT" ? address : item.account,
17-
to: item.direction === "OUT" ? item.account : address,
16+
from: item.direction === "OUT" ? address : item.accountAddress,
17+
to: item.direction === "OUT" ? item.accountAddress : address,
1818
fee: item.fee,
1919
nonce: "", // Not available
2020
amount: item.amount,
2121
memo: item.memo,
2222
validUntil: "", // Not available
23-
blockHeight: item.block,
23+
blockHeight: item.blockHeight,
2424
token: "", // Not available
25-
hash: item.transactionHash,
25+
hash: item.txHash,
2626
failureReason: "", // Not available
2727
dateTime: new Date(item.age).toISOString(),
2828
isDelegation: item.type === "delegation",
@@ -35,8 +35,9 @@ export const createChainHistoryProvider = (
3535
const transactionsByAddresses = async (
3636
args: TransactionsByAddressesArgs,
3737
): Promise<Tx[]> => {
38-
const limit = 20
39-
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`
38+
console.log(">>>>ARGS", args, url)
39+
const limit = 50
40+
const endpoint = `${url}/v1/accounts/${args.addresses[0]}/txs?page=0&sortBy=AGE&orderBy=DESC&size=${limit}&direction=ALL`
4041
const response = await fetch(endpoint)
4142
if (!response.ok) {
4243
throw new Error(`HTTP error! status: ${response.status}`)

packages/providers/test/blockberry/chain-history-provider.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { Mina } from "@palladxyz/mina-core"
44
import { Blockberry } from "../../src"
55

66
const explorerUrl =
7-
process.env.ARCHIVE_NODE_URL || "https://minascan.io/devnet/api/"
7+
process.env.ARCHIVE_NODE_URL || "https://pallad.co/api/proxy/mina-devnet"
88
const publicKey =
99
process.env.PUBLIC_KEY ||
1010
"B62qjsV6WQwTeEWrNrRRBP6VaaLvQhwWTnFi4WP4LQjGvpfZEumXzxb"

packages/providers/test/unified-providers/unified-provider.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { Tx } from "@palladxyz/pallad-core"
55
import { type ProviderConfig, createChainProvider } from "../../src"
66

77
const explorerUrl =
8-
process.env.EXPLORER_URL || "https://minascan.io/devnet/api/"
8+
process.env.EXPLORER_URL || "https://pallad.co/api/proxy/mina-devnet"
99
const nodeUrl =
1010
process.env.NODE_URL || "https://api.minascan.io/node/devnet/v1/graphql"
1111
const publicKey =

packages/vault/src/network-info/default.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const DEFAULT_NETWORK_INFO: Record<NetworkId, ProviderConfig> = {
1515
},
1616
archiveNodeEndpoint: {
1717
providerName: "mina-scan",
18-
url: "https://minascan.io/devnet/api/",
18+
url: "https://pallad.co/api/proxy/mina-devnet",
1919
},
2020
explorer: {
2121
transactionUrl: "https://minascan.io/devnet/tx/{hash}/txInfo",
@@ -36,7 +36,7 @@ export const DEFAULT_NETWORK_INFO: Record<NetworkId, ProviderConfig> = {
3636
},
3737
archiveNodeEndpoint: {
3838
providerName: "mina-scan",
39-
url: "https://minascan.io/mainnet/api/",
39+
url: "https://pallad.co/api/proxy/mina-mainnet",
4040
},
4141
explorer: {
4242
transactionUrl: "https://minascan.io/mainnet/tx/{hash}/txInfo",

0 commit comments

Comments
 (0)