Skip to content

Commit

Permalink
Move aut-kit changes to a separate PR
Browse files Browse the repository at this point in the history
  • Loading branch information
dasanra committed Nov 27, 2023
1 parent e153325 commit f6f2584
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
8 changes: 4 additions & 4 deletions safe-core-sdk/auth-kit/guides/web3auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Once connected, you can use any of the methods available in the [Protocol Kit](h
import { ethers } from 'ethers'
import { EthersAdapter } from '@safe-global/protocol-kit'

provider = new ethers.BrowserProvider(web3AuthModalPack.getProvider())
provider = new ethers.providers.Web3Provider(web3AuthModalPack.getProvider())
signer = provider.getSigner()

const ethAdapter = new EthersAdapter({
Expand All @@ -162,10 +162,10 @@ const safeSDK = await Safe.create({
const safeTransactionData: MetaTransactionData = {
to: '0x',
data: '0x',
value: ethers.parseUnits('0.0001', 'ether').toString()
value: ethers.utils.parseUnits('0.0001', 'ether').toString()
}

const safeTransaction = await safeSDK.createTransaction({ transactions: [safeTransactionData] })
const safeTransaction = await safeSDK.createTransaction({ safeTransactionData })
```

## Sign messages using the `Web3AuthModalPack`
Expand All @@ -183,7 +183,7 @@ const address = '0x...'
await web3.eth.personal.sign(message, address)

// Using ethers
const provider = new ethers.BrowserProvider(web3AuthModalPack.getProvider())
const provider = new ethers.providers.Web3Provider(web3AuthModalPack.getProvider())
const signer = provider.getSigner()

await signer.sendTransaction(tx)
Expand Down
13 changes: 6 additions & 7 deletions safe-core-sdk/auth-kit/reference/AuthKitBasePack.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ class MyPack extends AuthKitBasePack {

These methods are the common interface for all the Auth packs. Check each pack's documentation to get more details.

### `init(options?): Promise<void>`
### `init(options?)`

Provides the initialization options for the required packages, classes and properties.

### `signIn(): Promise<AuthKitSignInData>`
### `signIn(): authKitSignInData`

Provides a mechanism to connect to the provider services and returns an Ethereum address that will be used as a signer along with the associated Safe addresses.

### `signOut(): Promise<void>`
### `signOut()`

Disconnects the provider services and cleans up any data related to the current user.

### `getProvider(): Eip1193Provider | null`
### `getProvider(): web3Provider`

Returns a Web3 provider that can be used to interact with the blockchain (`web3.js` or `ethers.js` for example).

Expand All @@ -63,13 +63,12 @@ Returns the Ethereum address extracted from the provider retrieved by `getProvid
**Returns**
- `address`: The Ethereum address extracted from the provider.

### `getSafes(chainId, txServiceUrl?): safes[]`
### `getSafes(txServiceUrl): safes[]`

Returns the list of Safes associated with the signer address by calling the `getAddress()` method internally.

**Params**
- `chainId`: Indicate the chain ID.
- `txServiceUrl`(optional): The Safe Transaction Service URL to retrieve the Safes associated with the owner (signer).
- `txServiceUrl`: The Safe Transaction Service url to retrieve the Safes associated with the owner (signer).

**Returns**
- `safes[]`: The list of Safes associated with the owner (signer).
4 changes: 2 additions & 2 deletions safe-core-sdk/auth-kit/reference/Web3AuthModalPack.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ The `Web3AuthModalPack` enables the use of [Web3Auth modal SDK](https://web3auth
To use the `Web3AuthModalPack`, you need to install some extra dependencies in addition to the `@safe-global/auth-kit` package.

```bash
yarn add @safe-global/auth-kit @web3auth/base @web3auth/modal
yarn add @safe-global/auth-kit @web3auth/base@4.6.0 @web3auth/modal@4.6.2
```

Choose the adapters to use with Web3Auth, and add them. For example, to use the [OpenLogin](https://web3auth.io/docs/sdk/pnp/web/adapters/openlogin) adapter, you must install the following dependency:

```bash
yarn add @web3auth/openlogin-adapter
yarn add @web3auth/openlogin-adapter@4.6.0
```

Refer to the [supported adapters](https://web3auth.io/docs/sdk/pnp/web/adapters/#currently-available-wallet-adapters) in the official documentation.
Expand Down

0 comments on commit f6f2584

Please sign in to comment.