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

Fix safe-core-sdk README #56

Merged
merged 1 commit into from
Aug 13, 2021
Merged
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
Fix safe-core-sdk README
  • Loading branch information
antomor committed Aug 12, 2021
commit ad8747952cceb9b4679bd611135d4466988990af
21 changes: 11 additions & 10 deletions packages/safe-core-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const ethAdapterOwner2 = new EthersAdapter({ ethers, signer: owner2 })
const safeSdk2 = await safeSdk.connect({ ethAdapter: ethAdapterOwner2, safeAddress })
const txHash = await safeSdk2.getTransactionHash(safeTransaction)
const approveTxResponse = await safeSdk2.approveTransactionHash(txHash)
await approveTxResponse.wait()
await approveTxResponse.transactionResponse?.wait()
```

### 4. Transaction execution
Expand All @@ -134,7 +134,7 @@ Lastly, `owner3` account is connected to the SDK as a signer and executor of the
const ethAdapterOwner3 = new EthersAdapter({ ethers, signer: owner3 })
const safeSdk3 = await safeSdk2.connect({ ethAdapter: ethAdapterOwner3, safeAddress })
const executeTxResponse = await safeSdk3.executeTransaction(safeTransaction)
await executeTxResponse.wait()
await executeTxResponse.transactionResponse?.wait()
```

All the signatures used to execute the transaction are now available at `safeTransaction.signatures`.
Expand Down Expand Up @@ -349,7 +349,7 @@ const transactions: SafeTransactionDataPartial[] = [{
const safeTransaction = await safeSdk.createTransaction(...transactions)
const txHash = await safeSdk.getTransactionHash(safeTransaction)
const txResponse = await safeSdk.approveTransactionHash(txHash)
await txResponse.wait()
await txResponse.transactionResponse?.wait()
```

### getOwnersWhoApprovedTx
Expand All @@ -372,7 +372,7 @@ Returns a Safe transaction ready to be signed that will enable a Safe module.
```js
const safeTransaction = await safeSdk.getEnableModuleTx(moduleAddress)
const txResponse = await safeSdk.executeTransaction(safeTransaction)
await txResponse.wait()
await txResponse.transactionResponse?.wait()
```

### getDisableModuleTx
Expand All @@ -382,7 +382,7 @@ Returns a Safe transaction ready to be signed that will disable a Safe module.
```js
const safeTransaction = await safeSdk.getDisableModuleTx(moduleAddress)
const txResponse = await safeSdk.executeTransaction(safeTransaction)
await txResponse.wait()
await txResponse.transactionResponse?.wait()
```

### getAddOwnerTx
Expand All @@ -392,7 +392,7 @@ Returns the Safe transaction to add an owner and update the threshold.
```js
const safeTransaction = await safeSdk.getAddOwnerTx(newOwnerAddress, newThreshold)
const txResponse = await safeSdk.executeTransaction(safeTransaction)
await txResponse.wait()
await txResponse.transactionResponse?.wait()
```

If `threshold` is not provided, the current threshold will not change.
Expand All @@ -408,7 +408,7 @@ Returns the Safe transaction to remove an owner and update the threshold.
```js
const safeTransaction = await safeSdk.getRemoveOwnerTx(ownerAddress, newThreshold)
const txResponse = await safeSdk.executeTransaction(safeTransaction)
await txResponse.wait()
await txResponse.transactionResponse?.wait()
```

If `threshold` is not provided, the current threshold will be decreased by one.
Expand All @@ -424,7 +424,7 @@ Returns the Safe transaction to replace an owner of the Safe with a new one.
```js
const safeTransaction = await safeSdk.getSwapOwnerTx(oldOwnerAddress, newOwnerAddress)
const txResponse = await safeSdk.executeTransaction(safeTransaction)
await txResponse.wait()
await txResponse.transactionResponse?.wait()
```

### getChangeThresholdTx
Expand All @@ -434,7 +434,7 @@ Returns the Safe transaction to change the threshold.
```js
const safeTransaction = await safeSdk.getChangeThresholdTx(newThreshold)
const txResponse = await safeSdk.executeTransaction(safeTransaction)
await txResponse.wait()
await txResponse.transactionResponse?.wait()
```

### executeTransaction
Expand All @@ -447,7 +447,7 @@ const transactions: SafeTransactionDataPartial[] = [{
}]
const safeTransaction = await safeSdk.createTransaction(...transactions)
const txResponse = await safeSdk.executeTransaction(safeTransaction)
await txResponse.wait()
await txResponse.transactionResponse?.wait()
```

Optionally, `gasLimit` and `gasPrice` values can be passed as execution options, avoiding the gas estimation.
Expand All @@ -458,6 +458,7 @@ const options: TransactionOptions = {
gasPrice: 123 // Optional parameter.
}
const txResponse = await safeSdk.executeTransaction(safeTransaction, options)
await txResponse.transactionResponse?.wait()
```

## License
Expand Down