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

Merge stable #251

Merged
merged 21 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from 20 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
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- beta
- develop
env:
NODE_VERSION: 18
NODE_VERSION: 20

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@
"@openzeppelin/upgrades-core": "^1.27.1",
"@types/mocha": "^9.1.0",
"ethers": "^5.7.2",
"hardhat": "2.8.3 - 2.16.1"
"hardhat": "^2.16.1"
}
}
20 changes: 0 additions & 20 deletions src/gnosis-safe.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import chalk from "chalk";
import { ethers } from "hardhat";
import { UnsignedTransaction } from "ethers";
import SafeApiKit from '@safe-global/api-kit'
import Safe, { EthersAdapter } from '@safe-global/protocol-kit'
import { MetaTransactionData, SafeTransactionDataPartial, SafeTransaction } from '@safe-global/safe-core-sdk-types'

Check failure on line 5 in src/gnosis-safe.ts

View workflow job for this annotation

GitHub Actions / test (18.x)

'SafeTransactionDataPartial' is defined but never used

Check failure on line 5 in src/gnosis-safe.ts

View workflow job for this annotation

GitHub Actions / test (20.x)

'SafeTransactionDataPartial' is defined but never used

Check failure on line 5 in src/gnosis-safe.ts

View workflow job for this annotation

GitHub Actions / test (20.x)

'SafeTransactionDataPartial' is defined but never used


enum Network {
Expand Down Expand Up @@ -53,30 +52,11 @@
safeSdk = await Safe.create({ ethAdapter, safeAddress }),
safeTransaction = await safeSdk.createTransaction({ safeTransactionData, options });

await estimateSafeTransaction(safeAddress, safeTransactionData);

await proposeTransaction(safeAddress, safeTransaction);
}

// private functions

async function estimateSafeTransaction(safeAddress: string, safeTransactionData: SafeTransactionDataPartial | MetaTransactionData[]) {
console.log("Estimate gas");
const safeService = await getSafeService();
for (const transaction of safeTransactionData as MetaTransactionData[]) {
const estimateResponse = await safeService.estimateSafeTransaction(
safeAddress,
{
to: transaction.to,
value: transaction.value,
data: transaction.data,
operation: transaction.operation || 0,
}
);
console.log(chalk.cyan(`Recommend to set gas limit to ${parseInt(estimateResponse.safeTxGas, 10)}`));
}
console.log(chalk.green("Send transaction to gnosis safe"));
}

async function proposeTransaction(safeAddress: string, safeTransaction: SafeTransaction) {
const
Expand Down
Loading