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

safe-global / safe-core-sdk / 12008523214

25 Nov 2024 10:55AM CUT coverage: 75.515%. Remained the same
12008523214

push

github

web-flow
feat(protocol-kit): Add react native compatibility (#1033)

241 of 390 branches covered (61.79%)

Branch coverage included in aggregate %.

786 of 970 relevant lines covered (81.03%)

3.76 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'
7✔
2
import SafeApiKit from '@safe-global/api-kit'
3
import { SafeTransaction } from '@safe-global/types-kit'
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 ({
7✔
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