Skip to content

fix CI #7

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
97 changes: 0 additions & 97 deletions .github/workflows/vaults-and-reserve-metrics-testing.yml

This file was deleted.

This file was deleted.

This file was deleted.

15 changes: 7 additions & 8 deletions gcp-graphql-pipeline/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,18 @@ exports.fetchAndStoreTransactions = async (req, res) => {

hasNextPage = data.fastUsdcTransactions.pageInfo.hasNextPage;
endCursor = data.fastUsdcTransactions.pageInfo.endCursor;

} while (hasNextPage);

console.log(`Finished fetching. Total transactions: ${allTransactions.length}`);

const rows = allTransactions.map((txn) => {
// Ensure risksIdentified is handled correctly (null, array, or string)
let risksIdentifiedStr = txn.risksIdentified;
if (Array.isArray(txn.risksIdentified)) {
risksIdentifiedStr = txn.risksIdentified.join(', ');
} else if (txn.risksIdentified === null || typeof txn.risksIdentified === 'undefined') {
risksIdentifiedStr = ''; // Represent null/undefined as empty string in the sheet
}
// Ensure risksIdentified is handled correctly (null, array, or string)
let risksIdentifiedStr = txn.risksIdentified;
if (Array.isArray(txn.risksIdentified)) {
risksIdentifiedStr = txn.risksIdentified.join(', ');
} else if (txn.risksIdentified === null || typeof txn.risksIdentified === 'undefined') {
risksIdentifiedStr = ''; // Represent null/undefined as empty string in the sheet
}

return [
txn.id,
Expand Down
24 changes: 11 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
"author": "Agoric OpCo",
"license": "Apache-2.0",
"devDependencies": {
"@agoric/fast-usdc": "0.1.1-dev-7186681.0",
"@agoric/inter-protocol": "0.16.2-dev-7186681.0",
"@agoric/internal": "0.3.3-dev-7186681.0",
"@agoric/smart-wallet": "patch:@agoric/smart-wallet@npm%3A0.5.4-dev-7186681.0#~/.yarn/patches/@agoric-smart-wallet-npm-0.5.4-dev-7186681.0-de3e51742e.patch",
"@agoric/fast-usdc": "dev",
"@agoric/inter-protocol": "dev",
"@agoric/internal": "dev",
"@agoric/smart-wallet": "dev",
"@cosmjs/stargate": "^0.32.4",
"@endo/eventual-send": "^1.2.8",
"@subql/cli": "^5.7.0",
"@subql/node-cosmos": "^4.5.1",
"@subql/testing": "latest",
"@subql/cli": "~5.10.0",
"@subql/node-cosmos": "~5.0.3",
"@subql/testing": "~2.2.4",
"@types/text-encoding": "^0",
"execa": "^9.5.2",
"prettier": "^3.4.2",
Expand All @@ -41,18 +41,16 @@
},
"dependencies": {
"@agoric/cosmic-proto": "0.4.1-dev-7186681.0",
"@subql/types-cosmos": "^4.1.0",
"@subql/utils": "^2.18.0",
"@subql/types-cosmos": "^4.1.1",
"@subql/utils": "^2.18.1",
"@types/node": "^17.0.45",
"bech32": "^2.0.0",
"js-sha256": "^0.11.0",
"pino": "^7.11.0",
"text-encoding": "^0.7.0"
},
"packageManager": "yarn@4.6.0",
"packageManager": "yarn@4.9.1",
"resolutions": {
"@agoric/smart-wallet@npm:0.5.4-dev-7186681.0+7186681": "patch:@agoric/smart-wallet@npm%3A0.5.4-dev-7186681.0#~/.yarn/patches/@agoric-smart-wallet-npm-0.5.4-dev-7186681.0-de3e51742e.patch",
"@subql/x-cosmology-telescope@npm:^1.4.14": "patch:@subql/x-cosmology-telescope@npm%3A1.4.14#~/.yarn/patches/@subql-x-cosmology-telescope-npm-1.4.14-f7014b8f33.patch",
"@agoric/orchestration@npm:0.1.1-dev-7186681.0+7186681": "patch:@agoric/orchestration@npm%3A0.1.1-dev-7186681.0#~/.yarn/patches/@agoric-orchestration-npm-0.1.1-dev-7186681.0-53a06224f4.patch"
"@subql/x-cosmology-telescope@npm:^1.4.14": "patch:@subql/x-cosmology-telescope@npm%3A1.4.14#~/.yarn/patches/@subql-x-cosmology-telescope-npm-1.4.14-f7014b8f33.patch"
}
}
4 changes: 3 additions & 1 deletion schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ enum FastUsdcTransactionStatus {
}

type FastUsdcTransaction @entity {
id: ID! @index(unique: true)
# XXX causes 'index can not be added on field id' due to https://github.com/subquery/subql/blob/9e16bcc35439d926a14b126adf2d4746fa187fdc/packages/utils/src/graphql/entities.ts#L215-L237
# id: ID! @index(unique: true)
id: ID!
"""
EVM address from which the USCD funds originated
"""
Expand Down
71 changes: 32 additions & 39 deletions scripts/dump-transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,50 @@
*/

// module
export { };
export {};

/**
* Fetches GraphQL data, converts it to a table, and prints it as TSV.
* @param {string} graphqlEndpoint - The GraphQL endpoint URL.
* @param {string} query - The GraphQL query string.
*/
export async function dumpTransactions(
graphqlEndpoint: string,
query: string,
): Promise<void> {
try {
// Fetch the GraphQL response
const response = await fetch(graphqlEndpoint, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ query }),
});
export async function dumpTransactions(graphqlEndpoint: string, query: string): Promise<void> {
try {
// Fetch the GraphQL response
const response = await fetch(graphqlEndpoint, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ query }),
});

if (!response.ok) {
throw new Error(
`GraphQL request failed with status ${response.status}: ${response.statusText}`,
);
}
if (!response.ok) {
throw new Error(`GraphQL request failed with status ${response.status}: ${response.statusText}`);
}

const { data } = await response.json();
const { data } = await response.json();

if (!data) {
throw new Error('No data received from GraphQL response');
}
if (!data) {
throw new Error('No data received from GraphQL response');
}

const transactions = data.fastUsdcTransactions.edges.map(
(edge: any) => edge.node,
);
const transactions = data.fastUsdcTransactions.edges.map((edge: any) => edge.node);

// Convert the data to a table format
const rows: string[][] = [];
const headers = Object.keys(transactions[0]);
rows.push(headers);
// Convert the data to a table format
const rows: string[][] = [];
const headers = Object.keys(transactions[0]);
rows.push(headers);

for (const txn of transactions) {
rows.push(headers.map(header => String(txn[header] ?? '')));
}
for (const txn of transactions) {
rows.push(headers.map((header) => String(txn[header] ?? '')));
}

// Print the table as TSV
for (const row of rows) {
console.log(row.join('\t'));
}
} catch (error) {
console.error('Error dumping transactions:', error);
// Print the table as TSV
for (const row of rows) {
console.log(row.join('\t'));
}
} catch (error) {
console.error('Error dumping transactions:', error);
}
}

const graphqlEndpoint = 'https://api.subquery.network/sq/agoric-labs/internal';
Expand Down Expand Up @@ -90,6 +83,6 @@ query TransactionsQuery {
}
`;

dumpTransactions(graphqlEndpoint, query).catch(err => {
console.error('Unhandled error:', err);
dumpTransactions(graphqlEndpoint, query).catch((err) => {
console.error('Unhandled error:', err);
});
Loading
Loading