• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

safe-global / safe-core-sdk / 11029255652

25 Sep 2024 08:18AM CUT coverage: 77.534%. Remained the same
11029255652

push

github

dasanra
chore: set release versions

261 of 410 branches covered (63.66%)

Branch coverage included in aggregate %.

978 of 1188 relevant lines covered (82.32%)

3.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

18.18
/packages/sdk-starter-kit/src/utils/proposeTransaction.ts
1
import Safe, { EthSafeSignature, buildSignatureBytes } from '@safe-global/protocol-kit'
6✔
2
import SafeApiKit from '@safe-global/api-kit'
3
import { SafeTransaction } from '@safe-global/safe-core-sdk-types'
4

5
/**
6
 *  Propose a transaction to the Safe
7
 *
8
 * @param {SafeTransaction} safeTransaction The Safe transaction to propose
9
 * @param {Safe} protocolKit The Safe instance
10
 * @param {SafeApiKit} apiKit The SafeApiKit instance
11
 * @returns The Safe transaction hash
12
 */
13
export const proposeTransaction = async ({
6✔
14
  safeTransaction,
15
  protocolKit,
16
  apiKit
17
}: {
18
  safeTransaction: SafeTransaction
19
  protocolKit: Safe
20
  apiKit: SafeApiKit
21
}): Promise<string> => {
22
  safeTransaction = await protocolKit.signTransaction(safeTransaction)
×
23

24
  const signerAddress = (await protocolKit.getSafeProvider().getSignerAddress()) || '0x'
×
25
  const ethSig = safeTransaction.getSignature(signerAddress) as EthSafeSignature
×
26
  const safeTxHash = await protocolKit.getTransactionHash(safeTransaction)
×
27

28
  const txOptions = {
×
29
    safeAddress: await protocolKit.getAddress(),
30
    safeTransactionData: safeTransaction.data,
31
    safeTxHash,
32
    senderAddress: signerAddress,
33
    senderSignature: buildSignatureBytes([ethSig])
34
  }
35

36
  await apiKit.proposeTransaction(txOptions)
×
37

38
  return safeTxHash
×
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc