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 14 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
2 changes: 1 addition & 1 deletion .github/workflows/test_contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
node-version: [18.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@v3
Expand Down
8 changes: 4 additions & 4 deletions packages/api-kit/tests/e2e/addMessage.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Safe from '@safe-global/protocol-kit'
import { EthAdapter } from '@safe-global/safe-core-sdk-types'
import { Eip1193Provider } from '@safe-global/safe-core-sdk-types'
import SafeApiKit from '@safe-global/api-kit/index'
import chai from 'chai'
import chaiAsPromised from 'chai-as-promised'
Expand All @@ -8,7 +8,7 @@ import { getServiceClient } from '../utils/setupServiceClient'
chai.use(chaiAsPromised)

let safeApiKit: SafeApiKit
let ethAdapter: EthAdapter
let provider: Eip1193Provider
let protocolKit: Safe

const generateRandomUUID = (): string => {
Expand All @@ -24,12 +24,12 @@ const safeAddress = '0x3296b3DD454B7c3912F7F477787B503918C50082'

describe('addMessage', () => {
before(async () => {
;({ safeApiKit, ethAdapter } = await getServiceClient(
;({ safeApiKit, provider } = await getServiceClient(
'0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d'
))

protocolKit = await Safe.create({
ethAdapter,
provider,
safeAddress
})
})
Expand Down
28 changes: 14 additions & 14 deletions packages/api-kit/tests/e2e/addMessageSignature.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Safe, {
SigningMethod,
buildContractSignature
} from '@safe-global/protocol-kit'
import { EthAdapter, SafeMessage } from '@safe-global/safe-core-sdk-types'
import { Eip1193Provider, SafeMessage } from '@safe-global/safe-core-sdk-types'
import SafeApiKit from '@safe-global/api-kit/index'
import chai from 'chai'
import chaiAsPromised from 'chai-as-promised'
Expand All @@ -15,8 +15,8 @@ chai.use(chaiAsPromised)

let safeApiKit1: SafeApiKit
let protocolKit: Safe
let ethAdapter1: EthAdapter
let ethAdapter2: EthAdapter
let provider1: Eip1193Provider
let provider2: Eip1193Provider

const generateRandomUUID = (): string => {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
Expand All @@ -32,11 +32,11 @@ const signerSafeAddress = '0x83aB93f078A8fbbe6a677b1C488819e0ae981128'

describe('addMessageSignature', () => {
before(async () => {
;({ safeApiKit: safeApiKit1, ethAdapter: ethAdapter1 } = await getServiceClient(
;({ safeApiKit: safeApiKit1, provider: provider1 } = await getServiceClient(
'0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d',
'https://safe-transaction-goerli.staging.5afe.dev/api'
))
;({ ethAdapter: ethAdapter2 } = await getServiceClient(
;({ provider: provider2 } = await getServiceClient(
'0x6cbed15c793ce57650b9877cf6fa156fbef513c4e6134f022a85b1ffdd59b2a1'
))
})
Expand All @@ -56,7 +56,7 @@ describe('addMessageSignature', () => {
describe('when adding a new message', () => {
beforeEach(async () => {
protocolKit = await Safe.create({
ethAdapter: ethAdapter1,
provider: provider1,
safeAddress
})
})
Expand All @@ -66,7 +66,7 @@ describe('addMessageSignature', () => {
let safeMessage: SafeMessage = protocolKit.createMessage(rawMessage)
safeMessage = await protocolKit.signMessage(safeMessage, 'eth_sign')

let signerAddress = (await ethAdapter1.getSignerAddress()) || '0x'
let signerAddress = (await protocolKit.getSafeProvider().getSignerAddress()) || '0x'

await chai.expect(
safeApiKit1.addMessage(safeAddress, {
Expand All @@ -75,11 +75,11 @@ describe('addMessageSignature', () => {
})
).to.be.fulfilled

protocolKit = await protocolKit.connect({ ethAdapter: ethAdapter2 })
protocolKit = await protocolKit.connect({ provider: provider2 })
safeMessage = await protocolKit.signMessage(safeMessage, 'eth_signTypedData_v4')

const safeMessageHash = await protocolKit.getSafeMessageHash(hashSafeMessage(rawMessage))
signerAddress = (await ethAdapter2.getSignerAddress()) || '0x'
signerAddress = (await protocolKit.getSafeProvider().getSignerAddress()) || '0x'

await chai.expect(
safeApiKit1.addMessageSignature(
Expand All @@ -95,7 +95,7 @@ describe('addMessageSignature', () => {

it('should allow to add a confirmation signature using a Safe signer', async () => {
protocolKit = await protocolKit.connect({
ethAdapter: ethAdapter1,
provider: provider1,
safeAddress
})

Expand All @@ -105,7 +105,7 @@ describe('addMessageSignature', () => {
let safeMessage: SafeMessage = protocolKit.createMessage(rawMessage)
safeMessage = await protocolKit.signMessage(safeMessage, 'eth_sign')

const signerAddress = (await ethAdapter1.getSignerAddress()) || '0x'
const signerAddress = (await protocolKit.getSafeProvider().getSignerAddress()) || '0x'
const ethSig = safeMessage.getSignature(signerAddress) as EthSafeSignature

await chai.expect(
Expand All @@ -116,7 +116,7 @@ describe('addMessageSignature', () => {
).to.be.fulfilled

protocolKit = await protocolKit.connect({
ethAdapter: ethAdapter1,
provider: provider1,
safeAddress: signerSafeAddress
})
let signerSafeMessage = protocolKit.createMessage(rawMessage)
Expand All @@ -127,7 +127,7 @@ describe('addMessageSignature', () => {
)

protocolKit = await protocolKit.connect({
ethAdapter: ethAdapter2,
provider: provider2,
safeAddress: signerSafeAddress
})
signerSafeMessage = await protocolKit.signMessage(
Expand All @@ -142,7 +142,7 @@ describe('addMessageSignature', () => {
)

protocolKit = await protocolKit.connect({
ethAdapter: ethAdapter1,
provider: provider1,
safeAddress
})

Expand Down
20 changes: 10 additions & 10 deletions packages/api-kit/tests/e2e/confirmTransaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Safe, {
SigningMethod,
buildContractSignature
} from '@safe-global/protocol-kit'
import { EthAdapter, SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types'
import { Eip1193Provider, SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types'
import SafeApiKit from '@safe-global/api-kit/index'
import chai from 'chai'
import chaiAsPromised from 'chai-as-promised'
Expand All @@ -14,27 +14,27 @@ chai.use(chaiAsPromised)

let safeApiKit1: SafeApiKit
let protocolKit: Safe
let ethAdapter1: EthAdapter
let ethAdapter2: EthAdapter
let provider1: Eip1193Provider
let provider2: Eip1193Provider

const safeAddress = '0x3296b3DD454B7c3912F7F477787B503918C50082'
const signerSafeAddress = '0x83aB93f078A8fbbe6a677b1C488819e0ae981128'

describe('proposeTransaction', () => {
before(async () => {
;({ safeApiKit: safeApiKit1, ethAdapter: ethAdapter1 } = await getServiceClient(
;({ safeApiKit: safeApiKit1, provider: provider1 } = await getServiceClient(
'0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d',
'https://safe-transaction-goerli.staging.5afe.dev/api'
))
;({ ethAdapter: ethAdapter2 } = await getServiceClient(
;({ provider: provider2 } = await getServiceClient(
'0x6cbed15c793ce57650b9877cf6fa156fbef513c4e6134f022a85b1ffdd59b2a1',
'https://safe-transaction-goerli.staging.5afe.dev/api'
))
})

beforeEach(async () => {
protocolKit = await Safe.create({
ethAdapter: ethAdapter1,
provider: provider1,
safeAddress
})
})
Expand All @@ -52,7 +52,7 @@ describe('proposeTransaction', () => {
// EOA signature
tx = await protocolKit.signTransaction(tx)

const signerAddress = (await ethAdapter1.getSignerAddress()) || '0x'
const signerAddress = (await provider1.getSignerAddress()) || '0x'
const ethSig = tx.getSignature(signerAddress) as EthSafeSignature

const txOptions = {
Expand All @@ -67,7 +67,7 @@ describe('proposeTransaction', () => {

// Signer Safe signature
protocolKit = await protocolKit.connect({
ethAdapter: ethAdapter1,
provider: provider1,
safeAddress: signerSafeAddress
})

Expand All @@ -81,7 +81,7 @@ describe('proposeTransaction', () => {
)

protocolKit = await protocolKit.connect({
ethAdapter: ethAdapter2,
provider: provider2,
safeAddress: signerSafeAddress
})
signerSafeTx = await protocolKit.signTransaction(
Expand All @@ -96,7 +96,7 @@ describe('proposeTransaction', () => {
)

protocolKit = await protocolKit.connect({
ethAdapter: ethAdapter1,
provider: provider1,
safeAddress
})

Expand Down
14 changes: 7 additions & 7 deletions packages/api-kit/tests/endpoint/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import SafeApiKit, {
} from '@safe-global/api-kit/index'
import * as httpRequests from '@safe-global/api-kit/utils/httpRequests'
import Safe from '@safe-global/protocol-kit'
import { EthAdapter } from '@safe-global/safe-core-sdk-types'
import { Eip1193Provider } from '@safe-global/safe-core-sdk-types'
import chai from 'chai'
import chaiAsPromised from 'chai-as-promised'
import sinon from 'sinon'
Expand All @@ -28,19 +28,19 @@ const tokenAddress = '0x210EC22dD6b1c174E5cA1A261DD9791e0755cc6D'
const eip3770TokenAddress = `${config.EIP_3770_PREFIX}:${tokenAddress}`
const safeTxHash = '0xede78ed72e9a8afd2b7a21f35c86f56cba5fffb2fff0838e253b7a41d19ceb48'
const txServiceBaseUrl = 'https://safe-transaction-goerli.safe.global/api'
const provider = getDefaultProvider(config.JSON_RPC)
const defaultProvider = getDefaultProvider(config.JSON_RPC)
const signer = new Wallet(
'0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d',
provider
defaultProvider
)
let ethAdapter: EthAdapter
let provider: Eip1193Provider
let safeApiKit: SafeApiKit
let delegatorAddress: string
let eip3770DelegatorAddress: string

describe('Endpoint tests', () => {
before(async () => {
;({ safeApiKit, ethAdapter } = await getServiceClient(
;({ safeApiKit, provider } = await getServiceClient(
'0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d'
))
delegatorAddress = await signer.getAddress()
Expand Down Expand Up @@ -364,7 +364,7 @@ describe('Endpoint tests', () => {
}
const origin = 'Safe Core SDK: Safe API Kit'
const signerAddress = await signer.getAddress()
const safeSdk = await Safe.create({ ethAdapter, safeAddress })
const safeSdk = await Safe.create({ provider, safeAddress })
const safeTransaction = await safeSdk.createTransaction({
transactions: [safeTransactionData],
options
Expand Down Expand Up @@ -413,7 +413,7 @@ describe('Endpoint tests', () => {
}
const origin = 'Safe Core SDK: Safe API Kit'
const signerAddress = await signer.getAddress()
const safeSdk = await Safe.create({ ethAdapter, safeAddress })
const safeSdk = await Safe.create({ provider, safeAddress })
const safeTransaction = await safeSdk.createTransaction({
transactions: [safeTransactionData],
options
Expand Down
34 changes: 8 additions & 26 deletions packages/api-kit/tests/utils/setupEthAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,17 @@
import { AbstractSigner, Provider } from 'ethers'
import { EthAdapter } from '@safe-global/safe-core-sdk-types'
import {
EthersAdapter,
EthersAdapterConfig,
Web3Adapter,
Web3AdapterConfig
} from '@safe-global/protocol-kit'
import { ethers, web3 } from 'hardhat'
import { Eip1193Provider } from '@safe-global/safe-core-sdk-types'

export async function getEthAdapter(
signerOrProvider: AbstractSigner | Provider
): Promise<EthAdapter> {
let ethAdapter: EthAdapter
export function getEip1193Provider(): Eip1193Provider {
switch (process.env.ETH_LIB) {
case 'web3':
const signerAddress =
signerOrProvider instanceof AbstractSigner ? await signerOrProvider.getAddress() : undefined

const web3AdapterConfig: Web3AdapterConfig = {
web3,
signerAddress
}

ethAdapter = new Web3Adapter(web3AdapterConfig)
break
return web3.currentProvider as Eip1193Provider
case 'ethers':
const ethersAdapterConfig: EthersAdapterConfig = { ethers, signerOrProvider }
ethAdapter = new EthersAdapter(ethersAdapterConfig)
break
return {
request: async (request) => {
return ethers.provider.send(request.method, [...((request.params as unknown[]) ?? [])])
}
}
default:
throw new Error('Ethereum library not supported')
}
return ethAdapter
}
14 changes: 7 additions & 7 deletions packages/api-kit/tests/utils/setupServiceClient.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { getDefaultProvider, Wallet } from 'ethers'
import { EthAdapter } from '@safe-global/safe-core-sdk-types'
import { Eip1193Provider } from '@safe-global/safe-core-sdk-types'
import SafeApiKit from '@safe-global/api-kit/index'
import config from '../utils/config'
import { getEthAdapter } from '../utils/setupEthAdapter'
import { getEip1193Provider } from '../utils/setupEthAdapter'

interface ServiceClientConfig {
safeApiKit: SafeApiKit
ethAdapter: EthAdapter
provider: Eip1193Provider
signer: Wallet
}

export async function getServiceClient(
signerPk: string,
txServiceUrl?: string
): Promise<ServiceClientConfig> {
const provider = getDefaultProvider(config.JSON_RPC)
const signer = new Wallet(signerPk, provider)
const ethAdapter = await getEthAdapter(signer)
const signer = new Wallet(signerPk, getDefaultProvider(config.JSON_RPC))
const provider = getEip1193Provider()
const safeApiKit = new SafeApiKit({ chainId: config.CHAIN_ID, txServiceUrl })
return { safeApiKit, ethAdapter, signer }

return { safeApiKit, provider, signer }
}
13 changes: 8 additions & 5 deletions packages/protocol-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
"test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && hardhat deploy && nyc hardhat test",
"test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && hardhat deploy && nyc hardhat test",
"test:hardhat:ethers:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && hardhat deploy && nyc hardhat test",
"test:hardhat:viem:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && hardhat deploy && nyc hardhat test",
"test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && hardhat deploy && nyc hardhat test",
"test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && hardhat deploy && nyc hardhat test",
"test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && hardhat deploy && nyc hardhat test",
"test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && hardhat deploy && nyc hardhat test",
"coverage": "nyc report --reporter=lcov",
"format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"",
"format": "prettier --write \"*/**/*.{js,json,md,ts}\"",
Expand Down Expand Up @@ -60,7 +65,6 @@
"@safe-global/safe-contracts-v1.4.1": "npm:@safe-global/[email protected]",
"@safe-global/safe-core-sdk-types": "^4.0.1",
"@typechain/ethers-v6": "^0.5.0",
"@typechain/web3-v1": "^6.0.7",
"@types/chai": "^4.3.11",
"@types/chai-as-promised": "^7.1.8",
"@types/mocha": "^10.0.6",
Expand All @@ -78,16 +82,15 @@
"nyc": "^15.1.0",
"tsconfig-paths": "^4.2.0",
"typechain": "^8.3.2",
"viem": "^2.9.19",
"web3": "^4.7.0",
"yargs": "^17.7.2"
},
"dependencies": {
"@noble/hashes": "^1.3.3",
"@safe-global/safe-deployments": "^1.33.0",
"ethereumjs-util": "^7.1.5",
"ethers": "^6.7.1",
"semver": "^7.5.4",
"web3": "^1.10.3",
"web3-core": "^1.10.3",
"web3-utils": "^1.10.3"
"semver": "^7.5.4"
}
}
Loading
Loading