Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Tanay Pant <7481165+tanay1337@users.noreply.github.com>
  • Loading branch information
dasanra and tanay1337 authored Nov 29, 2023
1 parent 3e4abbe commit 65a244f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
22 changes: 11 additions & 11 deletions safe-core-sdk/api-kit/reference/migrating/v1.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# API Kit: Migrating from `safe-service-client`

This guide references the major changes between `safe-service-client` and `api-kit v1` to help those migrating an existing app.
This guide references the major changes between `safe-service-client` and `api-kit` v1 to help those migrating an existing application.

**It's recommended to go through this guide before migrating to `api-kit v2`**
**Note:** Follow this guide before migrating to `api-kit` v2.

You can remove `@safe-global/safe-service-client` from your `package.json` after completing this guide.
After completing this guide, you can remove `@safe-global/safe-service-client` from your package.json`.

## Adding the new dependency

To add the API Kit to your project, run:
To add the API Kit to your project, run the following:

```bash
yarn add @safe-global/api-kit@1.3.1
```

Then change your initialization like this:
Change your initialization like this:

```typescript
// old
Expand All @@ -36,7 +36,7 @@ const apiKit = new SafeApiKit({

## `getSafeDelegates()`

The `getSafeDelegates` was updated to accept more filtering parameters. Now it accepts an object with multiple properties instead of only `safeAddress` parameter.
The `getSafeDelegates` was updated to accept more filtering parameters. Now, it accepts an object with multiple properties instead of only the `safeAddress` parameter.

```typescript
const delegateConfig: GetSafeDelegateProps = {
Expand Down Expand Up @@ -77,11 +77,11 @@ await apiKit.addSafeDelegate(delegateConfig)

## `removeAllSafeDelegates()`

Method was deprecated and removed.
The method was deprecated and removed.

## `removeSafeDelegate()`

Parameter object properties were updated as follow:
Parameter object properties were updated as follows:

```typescript
// old
Expand All @@ -103,12 +103,12 @@ await apiKit.removeSafeDelegate(delegateConfig)

## `getBalances()`

Method was deprecated and removed.
The method was deprecated and removed.

## `getUSDBalances()`

Method was deprecated and removed.
The method was deprecated and removed.

## `getCollectibles()`

Method was deprecated and removed.
The method was deprecated and removed.
30 changes: 15 additions & 15 deletions safe-core-sdk/protocol-kit/reference/migrating/v1.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Protocol Kit: Migrating from `safe-core-sdk`

This guide references the major changes between `safe-core-sdk` and `protocol-kit v1` to help those migrating an existing app.
This guide references the major changes between `safe-core-sdk` and `protocol-kit` v1 to help those migrating an existing application.

**It's recommended to go through this guide before migrating to `protocol-kit v2`**
**Note:** Follow this guide before migrating to `protocol-kit` v2.

You can remove `@safe-global/safe-core-sdk` from your `package.json` after completing this guide.

## Adding the new dependency

To add the Protocol Kit to your project, run:
To add the Protocol Kit to your project, run the following:

```bash
yarn add @safe-global/protocol-kit@1.3.0
```

If you use the types library you will need to update to v2.3.0:
If you use the types library, you will need to update to v2.3.0:

```bash
yarn add @safe-global/safe-core-sdk-types@2.3.0
Expand All @@ -24,7 +24,7 @@ yarn add @safe-global/safe-core-sdk-types@2.3.0

### `EthersAdapter` (safe-ethers-lib)

`EthersAdapter` isn't in a separate package anymore. Now it's provided inside the `protocol-kit` package.
`EthersAdapter` isn't in a separate package anymore. Now, it's provided inside the `protocol-kit` package.

**`protocol-kit v1` only supports `ethers v5`**

Expand All @@ -36,13 +36,13 @@ import EthersAdapter from '@safe-global/safe-ethers-lib'
import { EthersAdapter } from '@safe-global/protocol-kit'
```

You can remove `@safe-global/safe-ethers-lib` from your `package.json` after this change.
After this change, you can remove `@safe-global/safe-ethers-lib` from your `package.json`.

### `Web3Adapter` (safe-web3-lib)

`Web3Adapter` is not in a separate package anymore. Now it's provided inside the `protocol-kit` package.
`Web3Adapter` isn't in a separate package anymore. Now, it's part of the `protocol-kit` package.

**`protocol-kit v1` only supports `Web3.js v1`**
**Note:** `protocol-kit` v1 only supports Web3.js v1.

```typescript
// old
Expand All @@ -52,13 +52,13 @@ import Web3Adapter from '@safe-global/safe-web3-lib'
import { Web3Adapter } from '@safe-global/protocol-kit'
```

You can remove `@safe-global/safe-web3-lib` from your `package.json` after this change.
After this change, you can remove `@safe-global/safe-web3-lib` from your `package.json`.

### Types changes
### Type changes

There are type changes affecting web3 and ethers adapter libraries.
Type changes are affecting the web3 and ethers adapter libraries.

`getSafeContract`, `getMultisendContract`, `getMultisendCallOnlyContract`, `getCompatibilityFallbackHandlerContract`, `getSafeProxyFactoryContract`, `getSignMessageLibContract` and `getCreateCallContract` don't need the `chainId` parameter any more, they will use the chain set on the provider. Also they return a `Promise` now.
`getSafeContract`, `getMultisendContract`, `getMultisendCallOnlyContract`, `getCompatibilityFallbackHandlerContract`, `getSafeProxyFactoryContract`, `getSignMessageLibContract` and `getCreateCallContract` don't need the `chainId` parameter anymore, they will use the chain set on the provider. Also, they return a `Promise` now.

`estimateGas` returns now a `string` instead of a `number`

Expand Down Expand Up @@ -87,7 +87,7 @@ const safeSdk = await safeFactory.deploySafe({ safeAccountConfig, saltNonce })

## `getAddress()`

The get address method now returns a Promise.
The `getAddress()` method now returns a `Promise`.

```typescript
// old
Expand All @@ -97,6 +97,6 @@ const safeAddress = safeSdk.getAddress()
const safeAddress = await protocolKit.getAddress()
```

## General types changes
## General type changes

If you set `safeTxGas`, `baseGas`, or `gasPrice` you must use type `string` instead of `number`.
If you set `safeTxGas`, `baseGas`, or `gasPrice`, you must use the type `string` instead of `number`.
2 changes: 1 addition & 1 deletion safe-core-sdk/protocol-kit/reference/migrating/v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This guide references the major changes between v1 and v2 to help those migrating an existing app.

**When upgrading to `protocol-kit v2` it's necessary to upgrade `safe-core-sdk-types v3`**
**Note:** When upgrading to `protocol-kit` v2, it's necessary to upgrade to `safe-core-sdk-types` v3.

## MasterCopy to Singleton

Expand Down

0 comments on commit 65a244f

Please sign in to comment.