Skip to content
Merged
Show file tree
Hide file tree
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
39 changes: 39 additions & 0 deletions .github/workflows/create-integrity-file.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Create publish info file

on:
release:
types: [created]
workflow_dispatch:
push:
branches:
- prepare-release

permissions:
contents: read

jobs:
generate-publish-info:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- run: |
yarn install --frozen-lockfile
yarn build

- name: Run integrity check script
run: |
yarn generate-publish-info

- name: Upload YAML artifact
uses: actions/upload-artifact@v4
with:
name: publish-info
path: ./publish-info

- name: Show YAML output
run: cat ./publish-info/*.yml
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ openapi/
yalc.lock
# Local Netlify folder
.netlify

publish-info/
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"test": "FORCE_COLOR=1 lerna run test --stream",
"play": "ts-node ./playground/config/run.ts",
"format": "lerna run format && prettier --write \"playground/**/*.ts\"",
"prepare": "husky"
"prepare": "husky",
"generate-publish-info": "ts-node ./scripts/generate-publish-info.ts"
},
"workspaces": {
"packages": [
Expand Down
6 changes: 3 additions & 3 deletions packages/api-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"homepage": "https://github.com/safe-global/safe-core-sdk#readme",
"devDependencies": {
"@safe-global/relay-kit": "^3.4.6",
"@safe-global/testing-kit": "^0.1.2",
"@safe-global/testing-kit": "^0.1.3",
"@types/chai": "^4.3.20",
"@types/chai-as-promised": "^7.1.8",
"@types/mocha": "^10.0.10",
Expand All @@ -58,8 +58,8 @@
"web3": "^4.12.1"
},
"dependencies": {
"@safe-global/protocol-kit": "^5.2.5",
"@safe-global/types-kit": "^1.0.4",
"@safe-global/protocol-kit": "^5.2.6",
"@safe-global/types-kit": "^1.0.5",
"node-fetch": "^2.7.0",
"viem": "^2.21.8"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/api-kit/tests/e2e/getMultisigTransactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('getMultisigTransactions', () => {
})

it('should return an empty list if there are no multisig transactions', async () => {
const safeAddress = '0x3e04a375aC5847C690A7f2fF54b45c59f7eeD6f0' // Safe without multisig transactions
const safeAddress = '0x513697456eDb113aDCAA1bbDA5bE59D9D7A2efd1' // Safe without multisig transactions
const safeMultisigTransactionListResponse =
await safeApiKit.getMultisigTransactions(safeAddress)
chai.expect(safeMultisigTransactionListResponse.count).to.be.equal(0)
Expand Down
8 changes: 4 additions & 4 deletions packages/api-kit/tests/e2e/getPendingTransactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,22 @@ describe('getPendingTransactions', () => {
})

it('should return the the transaction list', async () => {
const safeAddress = '0xCa2f5A815b642c79FC530B60BC15Aee4eF6252b3' // Safe with pending transaction
const safeAddress = '0x95eF108E0dcC050c129fbBEB0456D1121c98A59c' // Safe with pending transaction
const transactionList = await safeApiKit.getPendingTransactions(safeAddress)
chai.expect(transactionList.count).to.be.equal(10)
chai.expect(transactionList.results.length).to.be.equal(10)
})

it('should return the the transaction list EIP-3770', async () => {
const safeAddress = '0xCa2f5A815b642c79FC530B60BC15Aee4eF6252b3' // Safe with pending transaction
const safeAddress = '0x95eF108E0dcC050c129fbBEB0456D1121c98A59c' // Safe with pending transaction
const eip3770SafeAddress = `${config.EIP_3770_PREFIX}:${safeAddress}`
const transactionList = await safeApiKit.getPendingTransactions(eip3770SafeAddress)
chai.expect(transactionList.count).to.be.equal(10)
chai.expect(transactionList.results.length).to.be.equal(10)
})

it('should return a maximum of 2 transactions with limit = 2', async () => {
const safeAddress = '0xCa2f5A815b642c79FC530B60BC15Aee4eF6252b3' // Safe with pending transaction
const safeAddress = '0x95eF108E0dcC050c129fbBEB0456D1121c98A59c' // Safe with pending transaction
const transactionList = await safeApiKit.getPendingTransactions(safeAddress, {
limit: 2
})
Expand All @@ -61,7 +61,7 @@ describe('getPendingTransactions', () => {
})

it('should return all pending transactions excluding the first one with offset = 1', async () => {
const safeAddress = '0xCa2f5A815b642c79FC530B60BC15Aee4eF6252b3' // Safe with pending transaction
const safeAddress = '0x95eF108E0dcC050c129fbBEB0456D1121c98A59c' // Safe with pending transaction
const transactionList = await safeApiKit.getPendingTransactions(safeAddress, {
offset: 1
})
Expand Down
2 changes: 1 addition & 1 deletion packages/api-kit/tests/e2e/getTransaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('getTransaction', () => {
})

it('should return the transaction with the given safeTxHash', async () => {
const safeTxHash = '0x317834aea988fd3cfa54fd8b2be2c96b4fd70a14d8c9470a7110576b01e6480a'
const safeTxHash = '0x71eb4e7daac8a5461c6b946c95895c5732281de9cb9dad6efa139fc42a063229'
const transaction = await safeApiKit.getTransaction(safeTxHash)
chai.expect(transaction.safeTxHash).to.be.equal(safeTxHash)
chai.expect(transaction.safe).to.be.eq(API_TESTING_SAFE.address)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('getTransactionConfirmations', () => {
})

it('should return the transaction with the given safeTxHash', async () => {
const safeTxHash = '0x317834aea988fd3cfa54fd8b2be2c96b4fd70a14d8c9470a7110576b01e6480a'
const safeTxHash = '0x71eb4e7daac8a5461c6b946c95895c5732281de9cb9dad6efa139fc42a063229'
const transactionConfirmations = await safeApiKit.getTransactionConfirmations(safeTxHash)
chai.expect(transactionConfirmations.count).to.be.equal(2)
chai.expect(transactionConfirmations.results.length).to.be.equal(2)
Expand Down
2 changes: 1 addition & 1 deletion packages/api-kit/tests/helpers/safe.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const API_TESTING_SAFE = {
address: '0xF8ef84392f7542576F6b9d1b140334144930Ac78',
nonce: '11',
nonce: '10',
threshold: 2,
owners: [
'0x56e2C102c664De6DfD7315d12c0178b61D16F171',
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol-kit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@safe-global/protocol-kit",
"version": "5.2.5",
"version": "5.2.6",
"description": "SDK that facilitates the interaction with Safe Smart Accounts",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down Expand Up @@ -52,7 +52,7 @@
],
"homepage": "https://github.com/safe-global/safe-core-sdk#readme",
"devDependencies": {
"@safe-global/testing-kit": "^0.1.2",
"@safe-global/testing-kit": "^0.1.3",
"@types/chai": "^4.3.20",
"@types/chai-as-promised": "^7.1.8",
"@types/mocha": "^10.0.10",
Expand All @@ -70,7 +70,7 @@
"dependencies": {
"@safe-global/safe-deployments": "^1.37.31",
"@safe-global/safe-modules-deployments": "^2.2.7",
"@safe-global/types-kit": "^1.0.4",
"@safe-global/types-kit": "^1.0.5",
"abitype": "^1.0.2",
"semver": "^7.6.3",
"viem": "^2.21.8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function updateLocalNetworks(networks: NetworkShortName[]) {
const startIndex =
content.indexOf('export const networks: NetworkShortName[] = [') +
'export const networks: NetworkShortName[] = ['.length
const endIndex = content.indexOf(']\n\nif (process.env.TEST_NETWORK ===')
const endIndex = content.indexOf(']\n\ntry {')

const sortedNetworks = networks
.sort((a, b) => Number(a.chainId - b.chainId))
Expand Down
16 changes: 10 additions & 6 deletions packages/protocol-kit/src/contracts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

const ZKSYNC_MAINNET = 324n
const ZKSYNC_TESTNET = 300n
const ZKSYNC_LENS = 232n
// For bundle size efficiency we store SafeProxy.sol/GnosisSafeProxy.sol zksync bytecode hash in hex.
// To get the values below we need to:
// 1. Compile Safe smart contracts for zksync
Expand All @@ -62,6 +63,9 @@
} = {
'1.3.0': {
deployedBytecodeHash: '0x0100004124426fb9ebb25e27d670c068e52f9ba631bd383279a188be47e3f86d'
},
'1.4.1': {
deployedBytecodeHash: '0x0100003b6cfa15bd7d1cae1c9c022074524d7785d34859ad0576d8fab4305d4f'
}
}

Expand Down Expand Up @@ -369,10 +373,10 @@

const from = safeProxyFactoryContract.getAddress()

// On the zkSync Era chain, the counterfactual deployment address is calculated differently
const isZkSyncEraChain = [ZKSYNC_MAINNET, ZKSYNC_TESTNET].includes(chainId)
if (isZkSyncEraChain) {
const proxyAddress = zkSyncEraCreate2Address(from, safeVersion, salt, asHex(input))
// On the zkSync chains, the counterfactual deployment address is calculated differently
const isZkSyncChain = [ZKSYNC_MAINNET, ZKSYNC_TESTNET, ZKSYNC_LENS].includes(chainId)
if (isZkSyncChain) {
const proxyAddress = zkSyncCreate2Address(from, safeVersion, salt, asHex(input))

return safeProvider.getChecksummedAddress(proxyAddress)
}
Expand Down Expand Up @@ -472,9 +476,9 @@
* @param {`0x${string}`} salt - The salt used for address derivation.
* @param {`0x${string}`} input - Additional input data for the derivation.
*
* @returns {string} The derived zkSync Era address.
* @returns {string} The derived zkSync address.
*/
export function zkSyncEraCreate2Address(
export function zkSyncCreate2Address(
from: string,
safeVersion: SafeVersion,
salt: Hex,
Expand Down Expand Up @@ -504,7 +508,7 @@
}
}

export function isTypedDataSigner(signer: any): signer is Client {

Check warning on line 511 in packages/protocol-kit/src/contracts/utils.ts

View workflow job for this annotation

GitHub Actions / eslint

Unexpected any. Specify a different type
const isPasskeySigner = !!signer?.passkeyRawId
return (signer as unknown as WalletClient).signTypedData !== undefined || !isPasskeySigner
}
Expand Down
20 changes: 10 additions & 10 deletions packages/protocol-kit/src/types/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,43 +87,43 @@ export type GetContractProps = {

export type ContractNetworkConfig = {
/** safeSingletonAddress - Address of the Safe Singleton contract deployed on a specific network */
safeSingletonAddress: string
safeSingletonAddress?: string
/** safeSingletonAbi - Abi of the Safe Singleton contract deployed on a specific network */
safeSingletonAbi?: Abi
/** safeProxyFactoryAddress - Address of the SafeProxyFactory contract deployed on a specific network */
safeProxyFactoryAddress: string
safeProxyFactoryAddress?: string
/** safeProxyFactoryAbi - Abi of the SafeProxyFactory contract deployed on a specific network */
safeProxyFactoryAbi?: Abi
/** multiSendAddress - Address of the MultiSend contract deployed on a specific network */
multiSendAddress: string
multiSendAddress?: string
/** multiSendAbi - Abi of the MultiSend contract deployed on a specific network */
multiSendAbi?: Abi
/** multiSendCallOnlyAddress - Address of the MultiSendCallOnly contract deployed on a specific network */
multiSendCallOnlyAddress: string
multiSendCallOnlyAddress?: string
/** multiSendCallOnlyAbi - Abi of the MultiSendCallOnly contract deployed on a specific network */
multiSendCallOnlyAbi?: Abi
/** fallbackHandlerAddress - Address of the Fallback Handler contract deployed on a specific network */
fallbackHandlerAddress: string
fallbackHandlerAddress?: string
/** fallbackHandlerAbi - Abi of the Fallback Handler contract deployed on a specific network */
fallbackHandlerAbi?: Abi
/** signMessageLibAddress - Address of the SignMessageLib contract deployed on a specific network */
signMessageLibAddress: string
signMessageLibAddress?: string
/** signMessageLibAbi - Abi of the SignMessageLib contract deployed on a specific network */
signMessageLibAbi?: Abi
/** createCallAddress - Address of the CreateCall contract deployed on a specific network */
createCallAddress: string
createCallAddress?: string
/** createCallAbi - Abi of the CreateCall contract deployed on a specific network */
createCallAbi?: Abi
/** simulateTxAccessorAddress - Address of the SimulateTxAccessor contract deployed on a specific network */
simulateTxAccessorAddress: string
simulateTxAccessorAddress?: string
/** simulateTxAccessorAbi - Abi of the SimulateTxAccessor contract deployed on a specific network */
simulateTxAccessorAbi?: Abi
/** safeWebAuthnSignerFactoryAddress - Address of the SafeWebAuthnSignerFactory contract deployed on a specific network */
safeWebAuthnSignerFactoryAddress: string
safeWebAuthnSignerFactoryAddress?: string
/** safeWebAuthnSignerFactoryAbi - Abi of the SafeWebAuthnSignerFactory contract deployed on a specific network */
safeWebAuthnSignerFactoryAbi?: Abi
/** safeWebAuthnSharedSignerAddress - Address of the SafeWebAuthnSharedSigner contract deployed on a specific network */
safeWebAuthnSharedSignerAddress: string
safeWebAuthnSharedSignerAddress?: string
/** safeWebAuthnSharedSignerAbi - Abi of the SafeWebAuthnSharedSigner contract deployed on a specific network */
safeWebAuthnSharedSignerAbi?: Abi
}
Expand Down
8 changes: 6 additions & 2 deletions packages/protocol-kit/src/utils/eip-3770/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,10 @@ export const networks: NetworkShortName[] = [
{ chainId: 920637907288165n, shortName: 'kkrt-starknet-sepolia' }
]

if (process.env.TEST_NETWORK === 'hardhat') {
networks.push({ shortName: 'local', chainId: 31337n })
try {
if (process.env.TEST_NETWORK === 'hardhat') {
networks.push({ shortName: 'local', chainId: 31337n })
}
} catch {
// When process is not available we run on a browser environment
}
2 changes: 1 addition & 1 deletion packages/protocol-kit/src/utils/getProtocolKitVersion.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const getProtocolKitVersion = () => '5.2.5'
export const getProtocolKitVersion = () => '5.2.6'
5 changes: 1 addition & 4 deletions packages/protocol-kit/tests/e2e/utils/setupProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,11 @@ export function getSafeProviderFromNetwork(network: Network, account?: Account):
case 'gnosis':
rpcUrl = 'https://rpc.gnosischain.com'
break
case 'goerli':
rpcUrl = 'https://rpc.ankr.com/eth_goerli'
break
case 'sepolia':
rpcUrl = 'https://sepolia.gateway.tenderly.co'
break
case 'mainnet':
rpcUrl = 'https://rpc.ankr.com/eth'
rpcUrl = 'https://ethereum-rpc.publicnode.com'
break
default:
throw new Error('Chain not supported')
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol-kit/tests/e2e/utilsContracts.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import chai from 'chai'
import { polygon, optimism, bsc, gnosis, base, avalanche } from 'viem/chains'
import { polygon, optimism, gnosis, base, avalanche } from 'viem/chains'
import { getEip1193Provider, getSafeProviderFromNetwork } from './utils/setupProvider'
import {
getSafeAddressFromDeploymentTx,
Expand Down Expand Up @@ -548,7 +548,7 @@ describe('Contract utils', () => {
)

itif(safeVersionDeployed === '1.3.0')(
'returns the predicted address for Safes deployed on zkSync Era',
'returns the predicted address for Safes deployed on zkSync EVM',
async () => {
const { contractNetworks } = await setupTests()

Expand Down Expand Up @@ -730,7 +730,7 @@ describe('Contract utils', () => {
})

const protocolKitBNB = await Safe.init({
provider: bsc.rpcUrls.default.http[0],
provider: 'https://bsc-rpc.publicnode.com', // bsc.rpcUrls.default.http[0],
predictedSafe: {
safeAccountConfig,
safeDeploymentConfig
Expand Down
4 changes: 2 additions & 2 deletions packages/relay-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
},
"dependencies": {
"@gelatonetwork/relay-sdk": "^5.5.0",
"@safe-global/protocol-kit": "^5.2.5",
"@safe-global/protocol-kit": "^5.2.6",
"@safe-global/safe-modules-deployments": "^2.2.7",
"@safe-global/types-kit": "^1.0.4",
"@safe-global/types-kit": "^1.0.5",
"semver": "^7.6.3",
"viem": "^2.21.8"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk-starter-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
},
"dependencies": {
"@safe-global/api-kit": "^2.5.11",
"@safe-global/protocol-kit": "^5.2.5",
"@safe-global/protocol-kit": "^5.2.6",
"@safe-global/relay-kit": "^3.4.6",
"@safe-global/types-kit": "^1.0.4",
"@safe-global/types-kit": "^1.0.5",
"viem": "^2.21.8"
}
}
6 changes: 3 additions & 3 deletions packages/testing-kit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@safe-global/testing-kit",
"version": "0.1.2",
"version": "0.1.3",
"description": "Helper package providing testing utilities",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down Expand Up @@ -39,8 +39,8 @@
"@nomicfoundation/hardhat-viem": "^2.0.6",
"@openzeppelin/contracts": "^2.5.1",
"@safe-global/safe-contracts-v1.4.1": "npm:@safe-global/safe-contracts@1.4.1",
"@safe-global/safe-passkey": "0.2.0-alpha.1",
"@safe-global/types-kit": "^1.0.4",
"@safe-global/safe-passkey": "0.2.0",
"@safe-global/types-kit": "^1.0.5",
"@types/semver": "^7.5.8",
"hardhat": "^2.19.3",
"hardhat-deploy": "^0.12.4",
Expand Down
Loading
Loading