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

WIP: Safe transaction decoder #4800

Open
wants to merge 7 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
4 changes: 4 additions & 0 deletions typescript/infra/scripts/safes/ethereum-safe-tx-oct-30.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surely you can read this via the api directly

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha yeah it does do this, I'll remove this

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions typescript/infra/scripts/safes/parse-multicall.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { stringifyObject } from '@hyperlane-xyz/utils';

import { TransactionReader } from '../../src/tx/transaction-reader.js';
import { getArgs } from '../agent-utils.js';
import { getEnvironmentConfig, getHyperlaneCore } from '../core-utils.js';

import tx from './ethereum-safe-tx-oct-30.json';

async function main() {
const { environment } = await getArgs().argv;
const config = getEnvironmentConfig(environment);
const multiProvider = await config.getMultiProvider();
const { chainAddresses } = await getHyperlaneCore(environment, multiProvider);

const reader = new TransactionReader(
environment,
multiProvider,
'ethereum',
chainAddresses,
config.core,
);
const results = await reader.read('ethereum', tx);

console.log(stringifyObject(results, 'yaml', 2));

if (reader.errors.length) {
console.error('❌❌❌❌❌ Encountered fatal errors ❌❌❌❌❌');
console.log(stringifyObject(reader.errors, 'yaml', 2));
console.error('❌❌❌❌❌ Encountered fatal errors ❌❌❌❌❌');
process.exit(1);
}
}

main().catch((err) => {
console.error('Error:', err);
process.exit(1);
});
Loading
Loading