-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# API Kit: Migrating from v1 | ||
|
||
This guide aims to be a reference of the major changes between v1 and v2 to help those migrating an existing app. | ||
|
||
## API Kit constructor | ||
|
||
Now it won't be necessary to specify a `txServiceUrl` in those environments where Safe has a Transaction Service running, specifiying the chain ID will be enough. If you want to use your custom service or use the kit in a chain not supported by a Safe Transaction Service, you can add `txServiceUrl` parameter. | ||
Check failure on line 7 in safe-core-sdk/api-kit/migrating/v2.md GitHub Actions / vale[vale] safe-core-sdk/api-kit/migrating/v2.md#L7
Raw output
|
||
|
||
```js | ||
// old: | ||
constructor({ txServiceUrl, ethAdapter }: SafeApiKitConfig) | ||
|
||
// new: | ||
constructor({ chainId, txServiceUrl? }: SafeApiKitConfig) | ||
``` | ||
## Use the route you prefer | ||
API Kit v1 forced the use of a custom service hosted under `/api` route of the URL specified in `txServiceUrl`. This is not the case anymore, you can specify any route you prefer or subdomain. | ||
Check failure on line 19 in safe-core-sdk/api-kit/migrating/v2.md GitHub Actions / vale[vale] safe-core-sdk/api-kit/migrating/v2.md#L19
Raw output
|
||
## MasterCopy to Singleton | ||
To avoid confusion between terms that have been used as synonyms we aligned all our code to use the word `singleton`. | ||
- Rename type `MasterCopyResponse` to `SafeSingletonResponse` | ||
- Rename method `getServiceMasterCopiesInfo()` to `getServiceSingletonsInfo()` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Protocol Kit: Migrating from v1 | ||
|
||
This guide aims to be a reference of the major changes between v1 and v2 to help those migrating an existing app. | ||
|
||
## MasterCopy to Singleton | ||
|
||
To avoid confusion between terms that have been used as synonyms we aligned all our code to use the word `singleton`. | ||
|
||
- Rename `isL1SafeMasterCopy` to `isL1SafeSingleton` | ||
```js | ||
// old: | ||
SafeFactory.create({ ethAdapter, isL1SafeMasterCopy: true }) | ||
|
||
// new: | ||
SafeFactory.create({ ethAdapter, isL1SafeSingleton: true }) | ||
``` | ||
|
||
## Ethers v6 | ||
|
||
From protocolKit v2, EthersAdapter will only be compatible with ethers.js v6. If you still need to use v5 we recommend you to keep protocolKit v1, but encourage you to migrate to the latest version when you have the chance. | ||
Check failure on line 20 in safe-core-sdk/protocol-kit/migrating/v2.md GitHub Actions / vale[vale] safe-core-sdk/protocol-kit/migrating/v2.md#L20
Raw output
Check failure on line 20 in safe-core-sdk/protocol-kit/migrating/v2.md GitHub Actions / vale[vale] safe-core-sdk/protocol-kit/migrating/v2.md#L20
Raw output
|
||
|
||
## Protocol Kit createTransaction() accepts only transaction array | ||
|
||
In protocolKit v1 the `createTranasction()` method accepted either an object or an array as parameter. To avoid confusion we aligned to accept an array only. Migration can be done as the code below: | ||
Check failure on line 24 in safe-core-sdk/protocol-kit/migrating/v2.md GitHub Actions / vale[vale] safe-core-sdk/protocol-kit/migrating/v2.md#L24
Raw output
|
||
|
||
```js | ||
// old: | ||
const safeTransactionData = { | ||
to: '', | ||
data: '', | ||
value: '', | ||
nonce: '', | ||
safeTxGas: '' | ||
} | ||
const safeTransaction = protocolKit.createTransaction({ safeTransactionData }) | ||
|
||
// new: | ||
const safeTransactionData = { | ||
to: '', | ||
data: '', | ||
value: '' | ||
} | ||
const options = { | ||
nonce: '', | ||
safeTxGas: '' | ||
} | ||
const safeTransaction = protocolKit.createTransaction({ [safeTransactionData], options }) | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Relay Kit: Migrating from v1 | ||
|
||
This guide aims to be a reference of the major changes between v1 and v2 to help those migrating an existing app. | ||
|
||
## GelatoRelayPack | ||
|
||
- The `GelatoRelayPack` constructor now includes a mandatory `protocolKit` parameter as we made it required for any new pack extending the `RelayKitBasePack` | ||
|
||
```js | ||
constructor({ apiKey, protocolKit }: GelatoOptions) | ||
``` | ||
|
||
- We removed the `protocolKit` parameter from `createTransactionWithHandlePayment()`, `createTransactionWithTransfer()` and `executeRelayTransaction()` methods in the `GelatoRelayPack` as we now it's included in the constructor. | ||
|
||
- Removed the type `export interface RelayPack` as we use now an abstract class. |