The hardhat plugin for deploying via safe doesn't work.
I read in an old answer to use performCreate
of CreateCall.sol
contract to smart contracts, so I'm using this script for creating a transaction to deploy a contract
const createCallTransaction = await (
await safeProvider.getCreateCallContract({ safeVersion: "1.4.1" })
).performCreate([0n, BYTECODE], {});
console.log("Tx", createCallTransaction)
to which I get a result
Tx {
hash: '0xb...e31',
options: { gasLimit: '4389740' },
transactionResponse: ContractTransactionResponse {
provider: JsonRpcProvider {},
blockNumber: null,
blockHash: null,
index: undefined,
hash: '0xb...e31',
type: 0,
to: '0x9b35Af71d77eaf8d7e40252370304687390A1A52',
from: '0x1...81D8',
nonce: 99,
gasLimit: 4389740n,
gasPrice: 1000000000n,
maxPriorityFeePerGas: null,
maxFeePerGas: null,
maxFeePerBlobGas: null,
data: '0x4c8c...'
value: 0n,
chainId: 476462898n,
signature: Signature { r: "0x2...", s: "0x18...", yParity: 0, networkV: 952925831 },
accessList: null,
blobVersionedHashes: null
}
}
This createCallTransaction
is of type TransactionResult
of safe-core-sdk
. Now when I use it with apiKit.proposeTransaction()
to send it for approval from other owners, it requires the transaction to be of type SafeTransactionData
await apiKit.proposeTransaction({
safeAddress: "0xf...28",
safeTransactionData: createCallTransaction.transactionResponse.data,
safeTxHash: createCallTransaction.hash,
senderAddress: "0x...D8",
senderSignature: createCallTransaction.transactionResponse.signature,
});
How can I deploy contracts from my Safe (and perform other smart contract calls)