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 Abitype for contract types and use EIP-1193 #604

Merged
merged 201 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 183 commits
Commits
Show all changes
201 commits
Select commit Hold shift + click to select a range
40d4f76
Add abitype
DaniSomoza Nov 24, 2023
6ec1e63
removed unrelated @truffle/hdwallet-provider
DaniSomoza Nov 24, 2023
982c84c
removed v1.3.0 Safe contract for Ethers from Typechain
DaniSomoza Nov 24, 2023
f353665
Add Jsdoc
DaniSomoza Nov 26, 2023
a9f0dc1
Merge branch 'development' into Abitype-1_3_0-safe-contract
dasanra Dec 1, 2023
a491fb2
remove duplicated import
DaniSomoza Dec 11, 2023
6b390de
feat(protocol-kit): Add Abitype for Safe Contract 1.3.0 + Web3.js (#633)
tmjssz Dec 13, 2023
f2ec327
feat(protocol-kit): Add Abitype for Safe Contract v1.4.1 + ethers.js …
tmjssz Dec 13, 2023
42f6535
Merge branch 'development' into Abitype-1_3_0-safe-contract
dasanra Dec 27, 2023
61c7520
feat(protocol-kit): Migrate Safe Contract v1.1.1 to Abitype (#643)
tmjssz Jan 11, 2024
cb26aad
feat(protocol-kit): Migrate Safe Contract v1.2.0 for web3.js to Abity…
tmjssz Jan 18, 2024
47f49c6
feat(protocol-kit): Add AbiType for Multisend (#663)
yagopv Jan 19, 2024
717fe5a
feat(protocol-kit): Add AbiType for SignMessageLib (#676)
yagopv Jan 26, 2024
b764320
feat(protocol-kit): Migrate Safe Proxy Factory contract to Abitype (#…
tmjssz Feb 2, 2024
653b92a
Merge branch 'development' into Abitype-1_3_0-safe-contract
dasanra Mar 6, 2024
e1edac4
feat(protocol-kit): Migrate v1.0.0 to Abitype (#727)
dasanra Mar 6, 2024
cca8d86
feat(protocol-kit): Migrate SimulateTxAccessor contract to Abitype (#…
tmjssz Mar 27, 2024
dd5e412
Refactor SafeProxyFactory contract types
tmjssz Mar 27, 2024
8c5bbd7
feat(protocol-kit): Migrate CreateCall contract to Abitype (#742)
tmjssz Mar 27, 2024
60c0d2a
Merge branch 'Abitype-1_3_0-safe-contract' into Abitype-Compatibility…
tmjssz Mar 27, 2024
ff4a9c5
Define base type + class for CompatibilityFallbackHandler contract
tmjssz Mar 27, 2024
ef8d893
Create adapter-specific base classes for CompatibilityFallbackHandler…
tmjssz Mar 27, 2024
9aeed20
Define version-specific types for CompatibilityFallbackHandler contra…
tmjssz Mar 27, 2024
2e5a729
Implement CompatibilityFallbackHandler contract for Ethers.js
tmjssz Mar 27, 2024
ffd320f
Implement CompatibilityFallbackHandler contract for Web3.js
tmjssz Mar 28, 2024
1853e39
Remove CompatibilityFallbackHandler contract from typechain generatio…
tmjssz Mar 28, 2024
fa7e59a
Remove comment
tmjssz Mar 28, 2024
f31d624
Refactor CreateCallBaseContract type to use the common BaseContract type
tmjssz Mar 28, 2024
ee50e1e
Refactor MultiSendContract type to use the common BaseContract type
tmjssz Mar 28, 2024
4b57840
Refactor SafeBaseContract type to use the common BaseContract type
tmjssz Mar 28, 2024
8929c3d
Refactor SignMessageLibBaseContract type to use the common BaseContra…
tmjssz Mar 28, 2024
0e9e473
Refactor SimulateTxAccessorBaseContract type to use the common BaseCo…
tmjssz Mar 28, 2024
6763ce7
fix: typo
dasanra Apr 1, 2024
e42e429
Use AbiTypes in SignMessageLib and SimulateTxAccessor
dasanra Apr 2, 2024
f33a4d0
feat(protocol-kit): refactor and improve contract classes for Abitype…
tmjssz Apr 5, 2024
8f30cf1
Merge pull request #747 from safe-global/Abitype-CompatibilityFallbac…
dasanra Apr 5, 2024
cf9b052
remove mapToTypechain function
DaniSomoza Apr 5, 2024
113d9e0
Initial commit
yagopv Apr 9, 2024
bdb702c
Initial commit
yagopv Apr 10, 2024
7653d63
fix contract in web3 issues
DaniSomoza Apr 11, 2024
d82e6b6
Merge branch 'Abitype-1_3_0-safe-contract' into remove-mapToTypechain…
DaniSomoza Apr 11, 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
a0eff73
fix build issues
DaniSomoza Apr 16, 2024
64a3af4
removed typechain from build files
DaniSomoza Apr 16, 2024
ffa1275
removed abi.d.ts file
DaniSomoza Apr 16, 2024
f816db3
fix types in monerium tests
DaniSomoza Apr 16, 2024
1a319d7
fix protocol-kit tests
DaniSomoza Apr 17, 2024
96b259c
fix contract imports in protocol-kit
DaniSomoza Apr 17, 2024
e318ce5
fix web3 contract imports in protocol-kit
DaniSomoza Apr 17, 2024
fc67afd
fix dist import in protocol-kit
DaniSomoza Apr 17, 2024
a0a41d8
removed adapter folder
DaniSomoza Apr 17, 2024
b41d51b
restored adapter folder
DaniSomoza Apr 17, 2024
502de7b
Update packages/protocol-kit/src/adapters/ethers/utils/index.ts
DaniSomoza Apr 17, 2024
eb86adb
fix import in ethers adapter
DaniSomoza Apr 17, 2024
6972ef5
Merge pull request #760 from safe-global/remove-mapToTypechain-function
dasanra Apr 17, 2024
f949a3c
Merge branch 'development' into Abitype-1_3_0-safe-contract
dasanra Apr 17, 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
2ffa228
Merge branch 'development' of https://github.com/safe-global/safe-cor…
yagopv Apr 22, 2024
6cb6016
Restore deleted files
yagopv Apr 22, 2024
a0a04ff
Add missing getModulesPaginated
yagopv Apr 22, 2024
ef05dd7
Add getModulesPaginated
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
b718932
Merge pull request #770 from safe-global/feat/add-eip1193-provider
yagopv May 8, 2024
1c74c39
Move abitype to dependencies
yagopv May 8, 2024
574fb51
Remove safe-deployments as dep
yagopv May 8, 2024
04ebc77
Merge pull request #807 from safe-global/fix/abitype-as-dep
yagopv May 8, 2024
5e9a8c3
Merge branch 'development' into Abitype-1_3_0-safe-contract
dasanra May 9, 2024
3f98f03
Release alpha version
dasanra May 9, 2024
17b9607
chore: bump dependencies with minor changes
dasanra May 9, 2024
16b26f9
Rename methods
yagopv May 9, 2024
8e32572
Remove some draft code
yagopv May 9, 2024
fc5498f
Rename ContractManager to follow same approach
yagopv May 9, 2024
c73d1a1
fix BaseContract provider (#811)
DaniSomoza May 9, 2024
fefb3c2
remove unused properties from contract assets (#809)
dasanra May 9, 2024
8936d78
Remove draft code
yagopv May 10, 2024
1428cc6
Remove return types in initializers
yagopv May 10, 2024
3532f54
Merge pull request #810 from safe-global/feat/rename-method-create-to…
yagopv May 10, 2024
907fe87
chore: add CONTRIBUTING and SUPPORT files (#815)
dasanra May 15, 2024
ef1a610
Merge branch 'development' into Abitype-1_3_0-safe-contract
dasanra May 15, 2024
f7d4e50
chore: fix parameter name
dasanra May 15, 2024
1b09a06
Test api-kit with an alternative RPC
yagopv May 15, 2024
3b6bc0f
Change RPC
yagopv May 15, 2024
3f78bbc
fix: remove unused util
dasanra May 15, 2024
c96755d
fix: use EMPTY_DATA constant value
dasanra May 15, 2024
70eb7d4
Add tests for externalProvider and externalSigner
yagopv May 15, 2024
781de86
Update sepolia rpc as the ankr one is not working
yagopv May 15, 2024
d096679
Merge branch 'development' of https://github.com/safe-global/safe-cor…
yagopv May 15, 2024
df0dfc6
Merge branch 'development' into Abitype-1_3_0-safe-contract
dasanra May 15, 2024
9d585f5
Merge branch 'Abitype-1_3_0-safe-contract' of https://github.com/safe…
yagopv May 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
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
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ cache
artifacts
deployments

# Typechain
typechain

openapi/

.idea
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
9 changes: 4 additions & 5 deletions 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 All @@ -20,20 +19,20 @@
"author": "Safe (https://safe.global)",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.5.11",
"@types/jest": "^29.5.12",
"@types/node": "^18.18.8",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-prettier": "^5.1.3",
"husky": "^8.0.3",
"jest": "^29.7.0",
"lerna": "^7.4.2",
"lint-staged": "^14.0.1",
"prettier": "^3.1.1",
"prettier": "^3.2.5",
"rimraf": "^3.0.2",
"ts-jest": "^29.1.1",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"tsc-alias": "^1.8.8",
"typescript": "^5.3.3"
Expand Down
1 change: 0 additions & 1 deletion packages/account-abstraction-kit/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const config = {
'^.+\\.ts?$': 'ts-jest'
},
moduleNameMapper: {
'^@safe-global/protocol-kit/typechain/(.*)$': '<rootDir>/../protocol-kit/typechain/$1',
'^@safe-global/protocol-kit/(.*)$': '<rootDir>/../protocol-kit/src/$1',
'^@safe-global/relay-kit/(.*)$': '<rootDir>/../relay-kit/src/$1',
'^@safe-global/account-abstraction-kit-poc/(.*)$': '<rootDir>/src/$1'
Expand Down
8 changes: 4 additions & 4 deletions packages/account-abstraction-kit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@safe-global/account-abstraction-kit-poc",
"version": "2.1.0",
"version": "3.0.0-alpha.0",
"description": "Safe Account Abstraction Kit PoC",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
Expand Down Expand Up @@ -34,8 +34,8 @@
"access": "public"
},
"dependencies": {
"@safe-global/protocol-kit": "^3.1.0",
"@safe-global/relay-kit": "^2.1.0",
"@safe-global/safe-core-sdk-types": "^4.1.0"
"@safe-global/protocol-kit": "^4.0.0-alpha.0",
"@safe-global/relay-kit": "^3.0.0-alpha.0",
"@safe-global/safe-core-sdk-types": "^5.0.0-alpha.0"
}
}
Loading
Loading