0

The SafeSdk & the gateway API is great, but can it support full offchain signing?

From the doc:

User1 signs: safeSdk.signTransaction() is offchain,
User2 signs with: safeSdk.approveTransactionHash()   <-- but this is an onchain call and requires gas.

Can user2~n just call safeSdk.signTransaction() as well and have this recorded on the safe-gateway so that its available in the queue (from getTransactionQueue)??

Thanks

1 Answer 1

0

Yes, all the signers can sign a transaction off-chain and send the signature to the Safe Transaction Service, so it appears on the queue in the web UI.

The @gnosis.pm/safe-core-sdk package allows to sign a transaction off-chain like this:

...

const safeTxHash = await safeCoreSdk.getTransactionHash(safeTransaction)
const signature = await safeCoreSdk.signTransactionHash(safeTxHash)

The @gnosis.pm/safe-service-client package allows to send that signature to the Transaction Service:

import SafeServiceClient from '@gnosis.pm/safe-service-client'

...

const safeService = new SafeServiceClient({ txServiceUrl, ethAdapter })
await safeService.confirmTransaction(safeTxHash, signature.data)

You will find a more complete answer following this guide: https://github.com/safe-global/safe-core-sdk/blob/main/guides/integrating-the-safe-core-sdk.md#confirm-transaction

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.