Skip to content

Commit

Permalink
Rename methods
Browse files Browse the repository at this point in the history
  • Loading branch information
yagopv committed May 9, 2024
1 parent 24adb97 commit a588b4e
Show file tree
Hide file tree
Showing 10 changed files with 625 additions and 578 deletions.
9 changes: 6 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"grammarly.files.include": ["**/*.md", "**/*.mdx"],
"vale.valeCLI.config": "${workspaceFolder}/.vale.ini"
}
"grammarly.files.include": ["**/*.md", "**/*.mdx"],
"vale.valeCLI.config": "${workspaceFolder}/.vale.ini",
"prettier.singleQuote": true,
"prettier.semi": false,
"prettier.trailingComma": "none"
}
106 changes: 52 additions & 54 deletions pages/core-api/transaction-service-guides/messages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,57 +17,49 @@ The different steps are implemented using [Curl](https://github.com/curl/curl) r
<Steps>
### Install dependencies

{/* <!-- vale off --> */}
{/* <!-- vale off --> */}

<Tabs items={['TypeScript', 'Python']}>
<Tabs.Tab>
```bash
yarn add @safe-global/api-kit @safe-global/protocol-kit @safe-global/safe-core-sdk-types
```
</Tabs.Tab>
<Tabs.Tab>
```bash
pip install safe-eth-py web3 hexbytes
```
</Tabs.Tab>
</Tabs>
{' '}
<Tabs items={['TypeScript', 'Python']}>
<Tabs.Tab>
```bash yarn add @safe-global/api-kit @safe-global/protocol-kit
@safe-global/safe-core-sdk-types ```
</Tabs.Tab>
<Tabs.Tab>```bash pip install safe-eth-py web3 hexbytes ```</Tabs.Tab>
</Tabs>
{/* <!-- vale on --> */}
{/* <!-- vale on --> */}
### Imports
### Imports
{/* <!-- vale off --> */}
{/* <!-- vale off --> */}
<Tabs items={['TypeScript', 'Python']}>
<Tabs.Tab>
```typescript
import SafeApiKit, { AddMessageProps } from '@safe-global/api-kit'
import Safe, { hashSafeMessage } from '@safe-global/protocol-kit'
```
</Tabs.Tab>
<Tabs.Tab>
```python
from datetime import datetime
from eth_account import Account
from eth_account.messages import defunct_hash_message
from gnosis.eth import EthereumClient, EthereumNetwork
from gnosis.safe import Safe
from gnosis.safe.api.transaction_service_api import TransactionServiceApi
```
</Tabs.Tab>
</Tabs>
{' '}
<Tabs items={['TypeScript', 'Python']}>
<Tabs.Tab>
```typescript import SafeApiKit, {AddMessageProps} from
'@safe-global/api-kit' import Safe, {hashSafeMessage} from
'@safe-global/protocol-kit' ```
</Tabs.Tab>
<Tabs.Tab>
```python from datetime import datetime from eth_account import Account from
eth_account.messages import defunct_hash_message from gnosis.eth import
EthereumClient, EthereumNetwork from gnosis.safe import Safe from
gnosis.safe.api.transaction_service_api import TransactionServiceApi ```
</Tabs.Tab>
</Tabs>
{/* <!-- vale on --> */}
{/* <!-- vale on --> */}
### Create a Safe message
### Create a Safe message
{/* <!-- vale off --> */}
{/* <!-- vale off --> */}
<Tabs items={['TypeScript', 'Python', 'Curl']}>
<Tabs.Tab>
```typescript
// Initialize the Protocol Kit with Owner A
const protocolKitOwnerA = await Safe.create({
const protocolKitOwnerA = await Safe.init({
provider: config.RPC_URL,
signer: config.OWNER_A_PRIVATE_KEY,
safeAddress: config.SAFE_ADDRESS
Expand Down Expand Up @@ -102,13 +94,14 @@ The different steps are implemented using [Curl](https://github.com/curl/curl) r
}'
```
</Tabs.Tab>

</Tabs>

{/* <!-- vale on --> */}
{/* <!-- vale on --> */}

### Sign the message
### Sign the message

{/* <!-- vale off --> */}
{/* <!-- vale off --> */}

<Tabs items={['TypeScript', 'Python', 'Curl']}>
<Tabs.Tab>
Expand All @@ -130,13 +123,14 @@ The different steps are implemented using [Curl](https://github.com/curl/curl) r
<Tabs.Tab>
We skip this step because the message we created in the Transaction Service using Curl already has the signature of the message creator. Check the [Create a Safe message](#create-a-safe-message) step.
</Tabs.Tab>

</Tabs>

{/* <!-- vale on --> */}
{/* <!-- vale on --> */}

### Send the message to the service
### Send the message to the service

{/* <!-- vale off --> */}
{/* <!-- vale off --> */}

<Tabs items={['TypeScript', 'Python', 'Curl']}>
<Tabs.Tab>
Expand Down Expand Up @@ -172,21 +166,22 @@ The different steps are implemented using [Curl](https://github.com/curl/curl) r
<Tabs.Tab>
We skip this step because the message we created using Curl is already in the Transaction Service. Check the [Create a Safe message](#create-a-safe-message) step.
</Tabs.Tab>

</Tabs>

{/* <!-- vale on --> */}
{/* <!-- vale on --> */}

### Collect the missing signatures
### Collect the missing signatures

#### Get the pending message
#### Get the pending message

{/* <!-- vale off --> */}
{/* <!-- vale off --> */}

<Tabs items={['TypeScript', 'Python', 'Curl']}>
<Tabs.Tab>
```typescript
// Initialize the Protocol Kit with Owner B
const protocolKitOwnerB = await Safe.create({
const protocolKitOwnerB = await Safe.init({
provider: config.RPC_URL,
signer: config.OWNER_B_PRIVATE_KEY,
safeAddress: config.SAFE_ADDRESS
Expand Down Expand Up @@ -214,13 +209,14 @@ The different steps are implemented using [Curl](https://github.com/curl/curl) r
-H 'accept: application/json' \
```
</Tabs.Tab>

</Tabs>

{/* <!-- vale on --> */}
{/* <!-- vale on --> */}

#### Add missing signatures
#### Add missing signatures

{/* <!-- vale off --> */}
{/* <!-- vale off --> */}

<Tabs items={['TypeScript', 'Python', 'Curl']}>
<Tabs.Tab>
Expand All @@ -230,7 +226,7 @@ The different steps are implemented using [Curl](https://github.com/curl/curl) r

// Get Owner B address
const ownerBAddress = '0x...'

// Send the message to the Transaction Service with the signature from Owner B
await apiKit.addMessageSignature(
safeMessageHash,
Expand Down Expand Up @@ -261,7 +257,9 @@ The different steps are implemented using [Curl](https://github.com/curl/curl) r
}'
```
</Tabs.Tab>

</Tabs>

{/* <!-- vale on --> */}
{/* <!-- vale on --> */}

</Steps>
Loading

0 comments on commit a588b4e

Please sign in to comment.