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

Update docs #109

Merged
merged 5 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 1 addition & 2 deletions packages/guides/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Read about the basics of Gnosis Safe and how it compares to other solutions [her

The [Safe Core SDK](https://github.com/gnosis/safe-core-sdk) is a monorepo that contains software developer tools that allows interaction with the [Safe contracts](https://github.com/gnosis/safe-contracts) and the [Safe Transaction Service](https://github.com/gnosis/safe-transaction-service).

In this guide we will be using the following packages to deploy new Safes, create transactions, collect the off-chain signatures and execute those transactions:

In this guide we will use the following packages to deploy new Safes, create transactions, collect off-chain signatures and execute transactions:
* **safe-core-sdk-types**

Contains the types that are shared among the different packages inside the monorepo.
Expand Down
18 changes: 9 additions & 9 deletions packages/guides/integrating-the-safe-core-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
8. [Execute the transaction](#execute-transaction)
9. [Interface checks](#interface-checks)

## 1. Install the dependencies <a name="install-dependencies"></a>
## <a name="install-dependencies">1. Install the dependencies</a>

To integrate the [Safe Core SDK](https://github.com/gnosis/safe-core-sdk) into your Dapp or script you will need to install these dependencies:

Expand All @@ -22,7 +22,7 @@ To integrate the [Safe Core SDK](https://github.com/gnosis/safe-core-sdk) into y
@gnosis.pm/safe-service-client
```

## 2. Initialize the SDK’s <a name="initialize-sdks"></a>
## <a name="initialize-sdks">2. Initialize the SDK’s</a>

### Initialize the Safe Service Client

Expand Down Expand Up @@ -117,7 +117,7 @@ const safeVersion = 'X.Y.Z'
const safeFactory = await SafeFactory.create({ ethAdapter, safeVersion })
```

## 3. Deploy a new Safe <a name="deploy-safe"></a>
## <a name="deploy-safe">3. Deploy a new Safe</a>

The Safe Core SDK library allows the deployment of new Safes using the `safeFactory` instance we just created.

Expand All @@ -136,7 +136,7 @@ const safeSdk = await safeFactory.deploySafe(safeAccountConfig)

Calling the method `deploySafe` will deploy the desired Safe and return a Safe Core SDK initialized instance ready to be used.

## 4. Create a transaction <a name="create-transaction"></a>
## <a name="create-transaction">4. Create a transaction</a>

The Safe Core SDK supports the execution of single Safe transactions but also MultiSend transactions. We can create a transaction object by calling the method `createTransaction` in our `Safe` instance.

Expand Down Expand Up @@ -206,7 +206,7 @@ We can specify the `nonce` of our Safe transaction as long as it is not lower th
const nonce = await safeService.getNextNonce(safeAddress)
```

## 5. Propose the transaction to the service <a name="propose-transaction"></a>
## <a name="propose-transaction">5. Propose the transaction to the service</a>

Once we have the Safe transaction object we can share it with the other owners of the Safe so they can sign it. To send the transaction to the Safe Transaction Service we need to call the method `proposeTransaction` from the Safe Service Client instance and pass an object with the properties:
- `safeAddress`: The Safe address.
Expand All @@ -225,7 +225,7 @@ await safeService.proposeTransaction({
})
```

## 6. Get the transaction from the service <a name="get-transaction"></a>
## <a name="get-transaction">6. Get the transaction from the service</a>

The transaction is then available on the Safe Transaction Service and the owners can retrieve it by finding it in the pending transaction list, or by getting its Safe transaction hash.

Expand Down Expand Up @@ -286,7 +286,7 @@ type SafeMultisigTransactionResponse = {
}
```

## 7. Confirm/reject the transaction <a name="confirm-transaction"></a>
## <a name="confirm-transaction">7. Confirm/reject the transaction</a>

The owners of the Safe can now sign the transaction obtained from the Safe Transaction Service by calling the method `signTransactionHash` from the Safe Core SDK to generate the signature and by calling the method `confirmTransaction` from the Safe Service Client to add the signature to the service.

Expand All @@ -298,7 +298,7 @@ let signature = await safeSdk.signTransactionHash(hash)
await safeService.confirmTransaction(hash, signature.data)
```

## 8. Execute the transaction <a name="execute-transaction"></a>
## <a name="execute-transaction">8. Execute the transaction</a>

Once there are enough confirmations in the service the transaction is ready to be executed. The account that will execute the transaction needs to retrieve it from the service with all the required signatures and call the method `executeTransaction` from the Safe Core SDK.

Expand Down Expand Up @@ -331,7 +331,7 @@ const executeTxResponse = await safeSdk.executeTransaction(safeTransaction)
const receipt = executeTxResponse.transactionResponse && (await executeTxResponse.transactionResponse.wait())
```

## 9. Interface checks <a name="interface-checks"></a>
## <a name="interface-checks">9. Interface checks</a>

During the process of collecting the signatures/executing transactions, some useful checks can be made in the interface to display or hide a button to confirm or execute the transaction depending on the current number of confirmations, the address of accounts that confirmed the transaction and the Safe threshold:

Expand Down
Loading