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

feat(protocol-kit): Add EIP-1193 provider support #770

Merged
merged 117 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 116 commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
113d9e0
Initial commit
yagopv Apr 9, 2024
bdb702c
Initial commit
yagopv Apr 10, 2024
5ba6c40
Initial commit
yagopv Apr 11, 2024
53f54f2
Initial commit
yagopv Apr 11, 2024
77b95ff
Initial commit
yagopv Apr 12, 2024
872ca76
Initial commit
yagopv Apr 12, 2024
4b871e4
Initial commit
yagopv Apr 15, 2024
0ba231b
Initial commit
yagopv Apr 15, 2024
66ac7e2
Initial commit
yagopv Apr 15, 2024
861330b
Initial commit
yagopv Apr 15, 2024
625e0e5
Add viem
yagopv Apr 16, 2024
d613bab
Remove signer from getEip1193Provider()
yagopv Apr 16, 2024
960dc27
Remove web3-utils
yagopv Apr 16, 2024
18f1405
Update api-kit tests
yagopv Apr 16, 2024
fbcae3d
Merge branch 'Abitype-1_3_0-safe-contract' of https://github.com/safe…
yagopv Apr 17, 2024
a4eefbb
Fix issues
yagopv Apr 18, 2024
18592e7
Fix issues
yagopv Apr 18, 2024
39b4bcc
Fix issues
yagopv Apr 18, 2024
b839dc5
Fix issues
yagopv Apr 18, 2024
c4744c3
Fix issues
yagopv Apr 18, 2024
6ec87c6
Fix issues
yagopv Apr 18, 2024
dbd721c
Fix issues
yagopv Apr 18, 2024
784fa19
Fix issues
yagopv Apr 18, 2024
12611fc
Remove file
yagopv Apr 18, 2024
8a48136
Fix issues
yagopv Apr 18, 2024
152de8a
Fix issues
yagopv Apr 18, 2024
bf3d422
Fix imports
yagopv Apr 19, 2024
b3cfc6a
Fix moduleManager
yagopv Apr 19, 2024
403a192
Fix build
yagopv Apr 19, 2024
1086e7a
Remove ISafeProvider
yagopv Apr 19, 2024
0896cf6
Merge BaseContract and BaseContractEthers features
yagopv Apr 19, 2024
1dd2b16
Merge types in the same file
yagopv Apr 19, 2024
22fcd69
Remove file
yagopv Apr 19, 2024
bd1272d
Remove unnecessary README
yagopv Apr 19, 2024
ea8de96
Merge some directories
yagopv Apr 19, 2024
a36d0d4
Move SafeFactory to the root level
yagopv Apr 19, 2024
3ef0580
Rename signerAddress to signer
yagopv Apr 19, 2024
7992141
Rename SafeProvider properties
yagopv Apr 19, 2024
5a2b60a
Rename files with EthAdapter suffix
yagopv Apr 19, 2024
a6f2079
Rename files
yagopv Apr 19, 2024
696aaa2
Remove _Ethers
yagopv Apr 19, 2024
804a3eb
Remove Ethers suffix from contracts
yagopv Apr 19, 2024
13f4091
Fix errors in all the projects
yagopv Apr 21, 2024
5bb337a
Remove remaining EthersAdapter instances
yagopv Apr 22, 2024
e4e81c8
Merge branch 'Abitype-1_3_0-safe-contract' of https://github.com/safe…
yagopv Apr 22, 2024
d445099
Update protocol-kit code after merge
yagopv Apr 22, 2024
753ce90
latest changes and build
yagopv Apr 22, 2024
c0e8a72
Simplify provider retrieval in test
yagopv Apr 22, 2024
334e414
Skip getModulesPaginated
yagopv Apr 23, 2024
60d49e3
Fix api-kit tests
yagopv Apr 23, 2024
25f5555
Remove Ganache
yagopv Apr 23, 2024
125d56b
Remove ganache
yagopv Apr 23, 2024
044bbdc
Merge branch 'feat/add-eip1193-provider' of https://github.com/safe-g…
yagopv Apr 23, 2024
48e2788
Add hardhat again to e2e
yagopv Apr 23, 2024
4396c77
Remove web3 specific related tests
yagopv Apr 23, 2024
ae0b9d4
Remove web3 gas options
yagopv Apr 24, 2024
00442fd
Remove test
yagopv Apr 24, 2024
d8b4dbb
Add viem specific error handling
yagopv Apr 24, 2024
e4c5e0a
Rename props in SafeProvider
yagopv Apr 24, 2024
e8ee338
Fix SafProvider instantiation
yagopv Apr 24, 2024
2c72b5e
Improve some imports
yagopv Apr 24, 2024
bcb2bbe
Improve imports
yagopv Apr 24, 2024
0f47dd9
Removed unnecessary types
yagopv Apr 24, 2024
c6f4e5b
Remove unnecesary awaits
yagopv Apr 24, 2024
fecfac9
Update api-kit playgrounds
yagopv Apr 24, 2024
e170263
Update relay-kit playgrounds
yagopv Apr 25, 2024
2a81071
Organize protocol-kit types and export from barrel
yagopv Apr 25, 2024
6f23e0b
Move SafeFactory types to types folder
yagopv Apr 25, 2024
7a0386d
Remove EthersAdapter information
yagopv Apr 25, 2024
0977866
Remove EthAdapter from error message
yagopv Apr 25, 2024
a6ef23c
Remove imports
yagopv Apr 25, 2024
4cbd72b
Fix protocol-kit playgrounds and improve eip1271 one
yagopv Apr 25, 2024
172b228
Add viem support for api-kit testing
yagopv Apr 26, 2024
1085a53
Remove import
yagopv Apr 26, 2024
dd0f6b2
Fix issue
yagopv Apr 26, 2024
7a8d74c
Wrong flow
yagopv Apr 26, 2024
c23f26d
Update action names
yagopv Apr 26, 2024
0129d52
Try executing only ethers in api-kit
yagopv Apr 26, 2024
d654a66
Try to execute in sequence
yagopv Apr 26, 2024
8c0a43e
Remove EthersTransactionOptions and EthersTransactionResultTypes
yagopv Apr 26, 2024
ccb0f0e
Remove Adapter from the specific contract function
yagopv Apr 26, 2024
c72c439
Remove ethers deps from types
yagopv Apr 26, 2024
858a6bd
Update .github/workflows/api-kit-e2e-test.yml
yagopv Apr 26, 2024
8b92691
try actions without web3
yagopv Apr 26, 2024
0bdf76b
Add web3 again
yagopv Apr 26, 2024
10e0a93
Add replacer to the stringify function inside the createMemoizedFunction
yagopv Apr 26, 2024
46c0856
Fix test
yagopv Apr 26, 2024
b3d0d8d
Fix code snippet
yagopv Apr 29, 2024
1445086
Skip some tests
yagopv Apr 29, 2024
f03d793
Revert "Skip some tests"
yagopv Apr 29, 2024
bd782aa
fix(auth-kit/onramp-kit): Migrate to Sepolia + various small fixes (#…
tmjssz Apr 29, 2024
26e5fff
Fix BaseContract not selecting specific chain deployments
yagopv Apr 29, 2024
6bdc705
Merge branch 'feat/add-eip1193-provider' of https://github.com/safe-g…
yagopv Apr 29, 2024
707c1ec
Fix deploySafe
yagopv Apr 29, 2024
9090d93
Fix safeTxGas estimation for viem
DaniSomoza Apr 29, 2024
595dc90
Update contracts being memoized in the dev branch. Now seems to be wo…
yagopv Apr 30, 2024
80b80e7
Remove memoization resolver
yagopv Apr 30, 2024
783abf4
Add memoize again
yagopv Apr 30, 2024
9d83225
Fix replacer
yagopv Apr 30, 2024
46b0515
Allow tests to continue on error to see all the errors in the actions
yagopv Apr 30, 2024
4641a8e
Remove continue-onerror
yagopv Apr 30, 2024
e10c7e7
Remove spaces
yagopv Apr 30, 2024
4d94af6
Improve memoizing
yagopv Apr 30, 2024
e087a6b
Add workflow_dispatch for e2e in protocol-kit
yagopv Apr 30, 2024
b6ec4c8
Fix account abstraction kit tests
yagopv May 6, 2024
cf5b5ee
Remove RPC from playground config and use fixed sepolia one
yagopv May 6, 2024
21c8ab7
remove goerli etherscan url's
yagopv May 6, 2024
c28de44
Fix signer not propagated
yagopv May 6, 2024
cf8908b
Add delay in flaky test
yagopv May 8, 2024
51ff27b
Update guides/integrating-the-safe-core-sdk.md
yagopv May 8, 2024
d967c32
Update guides/integrating-the-safe-core-sdk.md
yagopv May 8, 2024
4dba881
Remove unnecessary ethers specific itifs
yagopv May 8, 2024
729fecb
Update packages/protocol-kit/tests/e2e/offChainSignatures.test.ts
yagopv May 8, 2024
6e3ca0a
Update packages/protocol-kit/tests/e2e/offChainSignatures.test.ts
yagopv May 8, 2024
85d1958
Restore test
yagopv May 8, 2024
28a4a10
Merge branch 'feat/add-eip1193-provider' of https://github.com/safe-g…
yagopv May 8, 2024
e0aeefd
fix(protocol kit): Get modules paginated incorrect interface (#787)
leonardotc May 8, 2024
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: e2e Test
name: API Kit - E2E Tests
on:
pull_request:
push:
Expand All @@ -18,7 +18,15 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- run: |
yarn install --frozen-lockfile
yarn build
yarn test:ci
- name: Yarn install
run: yarn install --frozen-lockfile

- name: Build
run: yarn build

- name: Test
run: |
cd packages/api-kit
yarn test:ci:ethers
yarn test:ci:web3
yarn test:ci:viem
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Safe Core SDK Test - Contracts
name: Protocol Kit - E2E Tests
on:
workflow_dispatch:
pull_request:
push:
branches:
Expand All @@ -11,7 +12,7 @@ jobs:
strategy:
matrix:
node-version: [20.x]
provider: [ethers, web3]
provider: [ethers, web3, viem]
contract-version: [v1.0.0, v1.1.1, v1.2.0, v1.3.0, v1.4.1]
steps:
- uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Monorepo Test
name: SDK - Unit Tests
on:
pull_request:
push:
Expand Down
89 changes: 44 additions & 45 deletions guides/integrating-the-safe-core-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ To integrate the [Safe Core SDK](https://github.com/safe-global/safe-core-sdk) i

## <a name="initialize-sdks">2. Initialize the SDK’s</a>

### Instantiate an EthAdapter
### Select your Ethereum `provider` and `signer`

First of all, we need to create an `EthAdapter`, which contains all the required utilities for the SDKs to interact with the blockchain. It acts as a wrapper for [web3.js](https://web3js.readthedocs.io/) or [ethers.js](https://docs.ethers.org/v6/) Ethereum libraries.
To use our kits, you need to provide an Ethereum provider and a signer. The provider is the connection to the Ethereum network, while the signer is an account that will sign the transactions (a Safe owner). When using an injected provider like MetaMask, the signer is the account selected in the wallet.

Depending on the library used by the Dapp, there are two options:
In the examples below, you can see `provider` and `signer` properties, which represent:

- [Create an `EthersAdapter` instance](https://github.com/safe-global/safe-core-sdk/tree/main/packages/protocol-kit/src/adapters/ethers)
- [Create a `Web3Adapter` instance](https://github.com/safe-global/safe-core-sdk/tree/main/packages/protocol-kit/src/adapters/web3)

Once the instance of `EthersAdapter` or `Web3Adapter` is created, it can be used in the SDK initialization.
- `provider`: You can provide an EIP-1193 compatible provider or an HTTP/WebSocket RPC URL.
- `signer`: This is an optional parameter. It should be the provider's address you want to use or a private key. If not set, it will try to fetch a connected account from the provider.

### Initialize the Safe API Kit

Expand All @@ -59,27 +57,28 @@ const safeService = new SafeApiKit({
```js
import Safe, { SafeFactory } from '@safe-global/protocol-kit'

const safeFactory = await SafeFactory.create({ ethAdapter })
const safeFactory = await SafeFactory.create({ provider, signer })

const safeSdk = await Safe.create({ ethAdapter, safeAddress })
const safeSdk = await Safe.create({ provider, signer, safeAddress })
```

There are two versions of the Safe contracts: [Safe.sol](https://github.com/safe-global/safe-contracts/blob/v1.4.1/contracts/Safe.sol) that does not trigger events in order to save gas and [SafeL2.sol](https://github.com/safe-global/safe-contracts/blob/v1.4.1/contracts/SafeL2.sol) that does, which is more appropriate for L2 networks.

By default `Safe.sol` will be only used on Ethereum Mainnet. For the rest of the networks where the Safe contracts are already deployed, the `SafeL2.sol` contract will be used unless you add the property `isL1SafeSingleton` to force the use of the `Safe.sol` contract.

```js
const safeFactory = await SafeFactory.create({ ethAdapter, isL1SafeSingleton: true })
const safeFactory = await SafeFactory.create({ provider, signer, isL1SafeSingleton: true })

const safeSdk = await Safe.create({ ethAdapter, safeAddress, isL1SafeSingleton: true })
const safeSdk = await Safe.create({ provider, signer, safeAddress, isL1SafeSingleton: true })
```

If the Safe contracts are not deployed to your current network, the property `contractNetworks` will be required to point to the addresses of the Safe contracts previously deployed by you.

```js
import { ContractNetworksConfig } from '@safe-global/protocol-kit'
import { ContractNetworksConfig, SafeProvider } from '@safe-global/protocol-kit'

const chainId = await ethAdapter.getChainId()
const safeProvider = new SafeProvider({ provider, signer })
const chainId = await safeProvider.getChainId()
const contractNetworks: ContractNetworksConfig = {
[chainId]: {
safeSingletonAddress: '<SINGLETON_ADDRESS>',
Expand All @@ -101,16 +100,16 @@ const contractNetworks: ContractNetworksConfig = {
}
}

const safeFactory = await SafeFactory.create({ ethAdapter, contractNetworks })
const safeFactory = await SafeFactory.create({ provider, signer, contractNetworks })

const safeSdk = await Safe.create({ ethAdapter, safeAddress, contractNetworks })
const safeSdk = await Safe.create({ provider, signer, safeAddress, contractNetworks })
```

The `SafeFactory` constructor also accepts the property `safeVersion` to specify the Safe contract version that will be deployed. This string can take the values `1.0.0`, `1.1.1`, `1.2.0`, `1.3.0` or `1.4.1`. If not specified, the `DEFAULT_SAFE_VERSION` value will be used.

```js
const safeVersion = 'X.Y.Z'
const safeFactory = await SafeFactory.create({ ethAdapter, safeVersion })
const safeFactory = await SafeFactory.create({ provider, signer, safeVersion })
```

## <a name="deploy-safe">3. Deploy a new Safe</a>
Expand Down Expand Up @@ -140,37 +139,37 @@ This method takes an array of `MetaTransactionData` objects that represent the i

When the array contains only one transaction, it is not wrapped in the MultiSend.

```js
import { SafeTransactionOptionalProps } from '@safe-global/protocol-kit'
import { MetaTransactionData } from '@safe-global/safe-core-sdk-types'

const transactions: MetaTransactionData[] = [
{
to,
data,
value,
operation
},
{
to,
data,
value,
operation
}
// ...
]

const options: SafeTransactionOptionalProps = {
safeTxGas, // Optional
baseGas, // Optional
gasPrice, // Optional
gasToken, // Optional
refundReceiver, // Optional
nonce // Optional
```js
import { SafeTransactionOptionalProps } from '@safe-global/protocol-kit'
import { MetaTransactionData } from '@safe-global/safe-core-sdk-types'

const transactions: MetaTransactionData[] = [
{
to,
data,
value,
operation
},
{
to,
data,
value,
operation
}
// ...
]

const options: SafeTransactionOptionalProps = {
safeTxGas, // Optional
baseGas, // Optional
gasPrice, // Optional
gasToken, // Optional
refundReceiver, // Optional
nonce // Optional
}

const safeTransaction = await safeSdk.createTransaction({ transactions, options })
```
const safeTransaction = await safeSdk.createTransaction({ transactions, options })
```

We can specify the `nonce` of our Safe transaction as long as it is not lower than the current Safe nonce. If multiple transactions are created but not executed they will share the same `nonce` if no `nonce` is specified, validating the first executed transaction and invalidating all the rest. We can prevent this by calling the method `getNextNonce` from the Safe API Kit instance. This method takes all queued/pending transactions into account when calculating the next nonce, creating a unique one for all different transactions.

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"build": "lerna run build --stream",
"lint:check": "eslint './packages/**/*.{js,jsx,ts,tsx}'",
"test": "FORCE_COLOR=1 lerna run test --stream",
"test:ci": "FORCE_COLOR=1 lerna run test:ci --stream",
"play": "ts-node ./playground/config/run.ts",
"format": "lerna run format && prettier --write \"playground/**/*.ts\"",
"prepare": "husky install"
Expand Down
75 changes: 40 additions & 35 deletions packages/account-abstraction-kit/src/AccountAbstraction.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Safe, { predictSafeAddress, EthAdapter } from '@safe-global/protocol-kit'
import Safe, { predictSafeAddress, SafeProvider } from '@safe-global/protocol-kit'
import { GelatoRelayPack } from '@safe-global/relay-kit'
import { SafeTransaction } from '@safe-global/safe-core-sdk-types'
import AccountAbstraction from './AccountAbstraction'
Expand All @@ -9,67 +9,72 @@ jest.mock('@safe-global/relay-kit')
const GelatoRelayPackMock = GelatoRelayPack as jest.MockedClass<typeof GelatoRelayPack>
const predictSafeAddressMock = predictSafeAddress as jest.MockedFunction<typeof predictSafeAddress>
const SafeMock = Safe as jest.MockedClass<typeof Safe>
const SafeProviderMock = SafeProvider as jest.MockedClass<typeof SafeProvider>

describe('AccountAbstraction', () => {
const ethersAdapter = {
getSignerAddress: jest.fn(),
isContractDeployed: jest.fn(),
getChainId: jest.fn()
const provider = {
request: jest.fn()
}

const signerAddress = '0xSignerAddress'
const predictSafeAddress = '0xPredictSafeAddressMock'

beforeEach(() => {
jest.clearAllMocks()
ethersAdapter.getSignerAddress.mockResolvedValue(signerAddress)
predictSafeAddressMock.mockResolvedValue(predictSafeAddress)
SafeProviderMock.prototype.getSignerAddress.mockResolvedValue(signerAddress)
})

describe('init', () => {
const accountAbstraction = new AccountAbstraction(ethersAdapter as unknown as EthAdapter)
const accountAbstraction = new AccountAbstraction({ provider, signer: signerAddress })

it('should initialize a Safe instance with its address if contract is deployed already', async () => {
ethersAdapter.isContractDeployed.mockResolvedValueOnce(true)
SafeProviderMock.prototype.isContractDeployed.mockResolvedValueOnce(true)

await accountAbstraction.init()

expect(ethersAdapter.getSignerAddress).toHaveBeenCalledTimes(1)
expect(SafeProviderMock.prototype.getSignerAddress).toHaveBeenCalledTimes(1)
expect(predictSafeAddressMock).toHaveBeenCalledTimes(1)
expect(predictSafeAddressMock).toHaveBeenCalledWith({
ethAdapter: ethersAdapter,
safeAccountConfig: { owners: ['0xSignerAddress'], threshold: 1 }
})
expect(predictSafeAddressMock).toHaveBeenCalledWith(
expect.objectContaining({
safeAccountConfig: { owners: ['0xSignerAddress'], threshold: 1 }
})
)
expect(SafeMock.create).toHaveBeenCalledTimes(1)
expect(SafeMock.create).toHaveBeenCalledWith({
ethAdapter: ethersAdapter,
safeAddress: predictSafeAddress
})
expect(SafeMock.create).toHaveBeenCalledWith(
expect.objectContaining({
safeAddress: predictSafeAddress
})
)
})

it('should initialize a Safe instance with a config if contract is NOT deployed yet', async () => {
ethersAdapter.isContractDeployed.mockResolvedValueOnce(false)
SafeProviderMock.prototype.isContractDeployed.mockResolvedValueOnce(false)

await accountAbstraction.init()

expect(ethersAdapter.getSignerAddress).toHaveBeenCalledTimes(1)
expect(SafeProviderMock.prototype.getSignerAddress).toHaveBeenCalledTimes(1)
expect(predictSafeAddressMock).toHaveBeenCalledTimes(1)
expect(predictSafeAddressMock).toHaveBeenCalledWith({
ethAdapter: ethersAdapter,
safeAccountConfig: { owners: ['0xSignerAddress'], threshold: 1 }
})
expect(predictSafeAddressMock).toHaveBeenCalledWith(
expect.objectContaining({
safeAccountConfig: { owners: ['0xSignerAddress'], threshold: 1 }
})
)
expect(SafeMock.create).toHaveBeenCalledTimes(1)
expect(SafeMock.create).toHaveBeenCalledWith({
ethAdapter: ethersAdapter,
predictedSafe: { safeAccountConfig: { owners: ['0xSignerAddress'], threshold: 1 } }
})
expect(SafeMock.create).toHaveBeenCalledWith(
expect.objectContaining({
predictedSafe: { safeAccountConfig: { owners: ['0xSignerAddress'], threshold: 1 } }
})
)
})

it('should throw an error if the provider has not a signer', async () => {
ethersAdapter.getSignerAddress.mockResolvedValueOnce(undefined)
SafeProviderMock.prototype.getSignerAddress.mockResolvedValueOnce(undefined)

expect(accountAbstraction.init()).rejects.toThrow(
`There's no signer in the provided EthAdapter`
`There's no signer available with the provided config (provider, signer)`
)

expect(SafeMock.create).not.toHaveBeenCalled()
})
})
Expand All @@ -83,7 +88,7 @@ describe('AccountAbstraction', () => {
}

const initAccountAbstraction = async () => {
const accountAbstraction = new AccountAbstraction(ethersAdapter as unknown as EthAdapter)
const accountAbstraction = new AccountAbstraction({ provider })
await accountAbstraction.init()
return accountAbstraction
}
Expand All @@ -107,7 +112,7 @@ describe('AccountAbstraction', () => {
})

it('should not be called if the protocol-kit is not initialized', async () => {
const accountAbstraction = new AccountAbstraction(ethersAdapter as unknown as EthAdapter)
const accountAbstraction = new AccountAbstraction({ provider })
expect(accountAbstraction.protocolKit).toBe(undefined)
expect(safeInstanceMock.getNonce).not.toHaveBeenCalled()
})
Expand All @@ -124,7 +129,7 @@ describe('AccountAbstraction', () => {
})

it('should not be called if the protocol-kit is not initialized', async () => {
const accountAbstraction = new AccountAbstraction(ethersAdapter as unknown as EthAdapter)
const accountAbstraction = new AccountAbstraction({ provider })
expect(accountAbstraction.protocolKit).toBe(undefined)
expect(safeInstanceMock.getAddress).not.toHaveBeenCalled()
})
Expand All @@ -139,7 +144,7 @@ describe('AccountAbstraction', () => {
})

it('should not be called if the protocol-kit is not initialized', async () => {
const accountAbstraction = new AccountAbstraction(ethersAdapter as unknown as EthAdapter)
const accountAbstraction = new AccountAbstraction({ provider })
expect(accountAbstraction.protocolKit).toBe(undefined)
expect(safeInstanceMock.isSafeDeployed).not.toHaveBeenCalled()
})
Expand Down Expand Up @@ -181,7 +186,7 @@ describe('AccountAbstraction', () => {
})

it('should throw if the protocol-kit is not initialized', async () => {
const accountAbstraction = new AccountAbstraction(ethersAdapter as unknown as EthAdapter)
const accountAbstraction = new AccountAbstraction({ provider })
accountAbstraction.setRelayKit(
new GelatoRelayPack({ protocolKit: accountAbstraction.protocolKit })
)
Expand All @@ -196,7 +201,7 @@ describe('AccountAbstraction', () => {
})

it('should throw if relay-kit is not initialized', async () => {
const accountAbstraction = new AccountAbstraction(ethersAdapter as unknown as EthAdapter)
const accountAbstraction = new AccountAbstraction({ provider })
await accountAbstraction.init()

expect(accountAbstraction.relayTransaction(transactionsMock, optionsMock)).rejects.toThrow(
Expand Down
Loading
Loading