Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/safe-global/safe-cor…
Browse files Browse the repository at this point in the history
…e-sdk into feat/add-react-native-compatibility
  • Loading branch information
yagopv committed Nov 11, 2024
2 parents 87d149c + 32b408b commit c6693cd
Show file tree
Hide file tree
Showing 13 changed files with 101 additions and 42 deletions.
6 changes: 3 additions & 3 deletions packages/api-kit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@safe-global/api-kit",
"version": "2.5.3",
"version": "2.5.4",
"description": "SDK that facilitates the interaction with the Safe Transaction Service API",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
Expand Down Expand Up @@ -39,7 +39,7 @@
],
"homepage": "https://github.com/safe-global/safe-core-sdk#readme",
"devDependencies": {
"@safe-global/relay-kit": "^3.2.3",
"@safe-global/relay-kit": "^3.2.4",
"@safe-global/testing-kit": "^0.1.1",
"@types/chai": "^4.3.19",
"@types/chai-as-promised": "^7.1.8",
Expand All @@ -58,7 +58,7 @@
"web3": "^4.12.1"
},
"dependencies": {
"@safe-global/protocol-kit": "^5.0.3",
"@safe-global/protocol-kit": "^5.0.4",
"@safe-global/types-kit": "^1.0.0",
"node-fetch": "^2.7.0",
"viem": "^2.21.8"
Expand Down
4 changes: 2 additions & 2 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.0.3",
"version": "5.0.4",
"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 @@ -67,7 +67,7 @@
},
"dependencies": {
"@noble/hashes": "^1.3.3",
"@safe-global/safe-deployments": "^1.37.12",
"@safe-global/safe-deployments": "^1.37.14",
"@safe-global/safe-modules-deployments": "^2.2.4",
"@safe-global/types-kit": "^1.0.0",
"abitype": "^1.0.2",
Expand Down
42 changes: 28 additions & 14 deletions packages/protocol-kit/src/contracts/safeDeploymentContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,15 @@ export async function getCompatibilityFallbackHandlerContract({
export async function getMultiSendContract({
safeProvider,
safeVersion,
customContracts
customContracts,
deploymentType
}: GetContractInstanceProps): Promise<MultiSendContractImplementationType> {
const multiSendContract = await getMultiSendContractInstance(
safeVersion,
safeProvider,
customContracts?.multiSendAddress,
customContracts?.multiSendAbi
customContracts?.multiSendAbi,
deploymentType
)

const isContractDeployed = await safeProvider.isContractDeployed(multiSendContract.getAddress())
Expand All @@ -131,13 +133,15 @@ export async function getMultiSendContract({
export async function getMultiSendCallOnlyContract({
safeProvider,
safeVersion,
customContracts
customContracts,
deploymentType
}: GetContractInstanceProps): Promise<MultiSendCallOnlyContractImplementationType> {
const multiSendCallOnlyContract = await getMultiSendCallOnlyContractInstance(
safeVersion,
safeProvider,
customContracts?.multiSendCallOnlyAddress,
customContracts?.multiSendCallOnlyAbi
customContracts?.multiSendCallOnlyAbi,
deploymentType
)

const isContractDeployed = await safeProvider.isContractDeployed(
Expand All @@ -152,13 +156,15 @@ export async function getMultiSendCallOnlyContract({
export async function getSignMessageLibContract({
safeProvider,
safeVersion,
customContracts
customContracts,
deploymentType
}: GetContractInstanceProps): Promise<SignMessageLibContractImplementationType> {
const signMessageLibContract = await getSignMessageLibContractInstance(
safeVersion,
safeProvider,
customContracts?.signMessageLibAddress,
customContracts?.signMessageLibAbi
customContracts?.signMessageLibAbi,
deploymentType
)

const isContractDeployed = await safeProvider.isContractDeployed(
Expand All @@ -173,13 +179,15 @@ export async function getSignMessageLibContract({
export async function getCreateCallContract({
safeProvider,
safeVersion,
customContracts
customContracts,
deploymentType
}: GetContractInstanceProps): Promise<CreateCallContractImplementationType> {
const createCallContract = await getCreateCallContractInstance(
safeVersion,
safeProvider,
customContracts?.createCallAddress,
customContracts?.createCallAbi
customContracts?.createCallAbi,
deploymentType
)

const isContractDeployed = await safeProvider.isContractDeployed(createCallContract.getAddress())
Expand All @@ -192,13 +200,15 @@ export async function getCreateCallContract({
export async function getSimulateTxAccessorContract({
safeProvider,
safeVersion,
customContracts
customContracts,
deploymentType
}: GetContractInstanceProps): Promise<SimulateTxAccessorContractImplementationType> {
const simulateTxAccessorContract = await getSimulateTxAccessorContractInstance(
safeVersion,
safeProvider,
customContracts?.simulateTxAccessorAddress,
customContracts?.simulateTxAccessorAbi
customContracts?.simulateTxAccessorAbi,
deploymentType
)

const isContractDeployed = await safeProvider.isContractDeployed(
Expand All @@ -213,13 +223,15 @@ export async function getSimulateTxAccessorContract({
export async function getSafeWebAuthnSignerFactoryContract({
safeProvider,
safeVersion,
customContracts
customContracts,
deploymentType
}: GetContractInstanceProps): Promise<SafeWebAuthnSignerFactoryContractImplementationType> {
const safeWebAuthnSignerFactoryContract = await getSafeWebAuthnSignerFactoryContractInstance(
safeVersion,
safeProvider,
customContracts?.safeWebAuthnSignerFactoryAddress,
customContracts?.safeWebAuthnSignerFactoryAbi
customContracts?.safeWebAuthnSignerFactoryAbi,
deploymentType
)

const isContractDeployed = await safeProvider.isContractDeployed(
Expand All @@ -234,13 +246,15 @@ export async function getSafeWebAuthnSignerFactoryContract({
export async function getSafeWebAuthnSharedSignerContract({
safeProvider,
safeVersion,
customContracts
customContracts,
deploymentType
}: GetContractInstanceProps): Promise<SafeWebAuthnSharedSignerContractImplementationType> {
const safeWebAuthnSharedSignerContract = await getSafeWebAuthnSharedSignerContractInstance(
safeVersion,
safeProvider,
customContracts?.safeWebAuthnSharedSignerAddress,
customContracts?.safeWebAuthnSharedSignerAbi
customContracts?.safeWebAuthnSharedSignerAbi,
deploymentType
)

const isContractDeployed = await safeProvider.isContractDeployed(
Expand Down
6 changes: 4 additions & 2 deletions packages/protocol-kit/src/managers/contractManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,15 @@ class ContractManager {
this.#multiSendContract = await getMultiSendContract({
safeProvider,
safeVersion,
customContracts
customContracts,
deploymentType: predictedSafe?.safeDeploymentConfig?.deploymentType
})

this.#multiSendCallOnlyContract = await getMultiSendCallOnlyContract({
safeProvider,
safeVersion,
customContracts
customContracts,
deploymentType: predictedSafe?.safeDeploymentConfig?.deploymentType
})
}

Expand Down
12 changes: 11 additions & 1 deletion packages/protocol-kit/src/utils/eip-3770/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const networks: NetworkShortName[] = [
{ chainId: 81n, shortName: 'joc' },
{ chainId: 82n, shortName: 'meter' },
{ chainId: 83n, shortName: 'meter-test' },
{ chainId: 88n, shortName: 'tomo' },
{ chainId: 88n, shortName: 'vic' },
{ chainId: 97n, shortName: 'bnbt' },
{ chainId: 100n, shortName: 'gno' },
{ chainId: 106n, shortName: 'vlx' },
Expand All @@ -56,6 +56,7 @@ export const networks: NetworkShortName[] = [
{ chainId: 195n, shortName: 'tokb' },
{ chainId: 196n, shortName: 'okb' },
{ chainId: 204n, shortName: 'opbnb' },
{ chainId: 240n, shortName: 'zkTCRO' },
{ chainId: 246n, shortName: 'ewt' },
{ chainId: 250n, shortName: 'ftm' },
{ chainId: 252n, shortName: 'fraxtal' },
Expand Down Expand Up @@ -110,6 +111,7 @@ export const networks: NetworkShortName[] = [
{ chainId: 1329n, shortName: 'sei' },
{ chainId: 1337n, shortName: 'geth' },
{ chainId: 1442n, shortName: 'testnet-zkEVM-mango' },
{ chainId: 1513n, shortName: 'Story' },
{ chainId: 1559n, shortName: 'tenet' },
{ chainId: 1625n, shortName: 'gravity' },
{ chainId: 1663n, shortName: 'Gobi' },
Expand All @@ -128,12 +130,15 @@ export const networks: NetworkShortName[] = [
{ chainId: 2020n, shortName: 'pmint' },
{ chainId: 2021n, shortName: 'edg' },
{ chainId: 2039n, shortName: 'aleph' },
{ chainId: 2187n, shortName: 'g7' },
{ chainId: 2192n, shortName: 'snax' },
{ chainId: 2221n, shortName: 'tkava' },
{ chainId: 2222n, shortName: 'kava' },
{ chainId: 2331n, shortName: 'rss3-testnet' },
{ chainId: 2358n, shortName: 'kroma-sepolia' },
{ chainId: 2442n, shortName: 'zkevm-testnet-cardona' },
{ chainId: 2810n, shortName: 'hmorph' },
{ chainId: 2818n, shortName: 'morph' },
{ chainId: 3338n, shortName: 'PEAQ' },
{ chainId: 3636n, shortName: 'BTNX' },
{ chainId: 3737n, shortName: 'csb' },
Expand All @@ -153,6 +158,7 @@ export const networks: NetworkShortName[] = [
{ chainId: 5000n, shortName: 'mantle' },
{ chainId: 5001n, shortName: 'mantle-testnet' },
{ chainId: 5003n, shortName: 'mnt-sep' },
{ chainId: 5115n, shortName: 'citrea-testnet' },
{ chainId: 5165n, shortName: 'ftn' },
{ chainId: 5700n, shortName: 'tsys' },
{ chainId: 6001n, shortName: 'bouncebit-mainnet' },
Expand Down Expand Up @@ -199,6 +205,7 @@ export const networks: NetworkShortName[] = [
{ chainId: 13337n, shortName: 'beam-testnet' },
{ chainId: 13371n, shortName: 'imx' },
{ chainId: 13473n, shortName: 'imx-testnet' },
{ chainId: 13746n, shortName: 'g7t' },
{ chainId: 14800n, shortName: 'vana-moksha' },
{ chainId: 17000n, shortName: 'holesky' },
{ chainId: 17069n, shortName: 'garnet' },
Expand All @@ -212,6 +219,7 @@ export const networks: NetworkShortName[] = [
{ chainId: 28979n, shortName: 'kimbonet-testnet' },
{ chainId: 32769n, shortName: 'zil' },
{ chainId: 33101n, shortName: 'zil-testnet' },
{ chainId: 33139n, shortName: 'apechain' },
{ chainId: 33401n, shortName: 'slingshot' },
{ chainId: 34443n, shortName: 'mode' },
{ chainId: 35441n, shortName: 'q' },
Expand Down Expand Up @@ -283,6 +291,8 @@ export const networks: NetworkShortName[] = [
{ chainId: 808813n, shortName: 'bob-sepolia' },
{ chainId: 810180n, shortName: 'zklink-nova' },
{ chainId: 978657n, shortName: 'treasure-ruby' },
{ chainId: 3441006n, shortName: 'mantaSepoliaTestnet' },
{ chainId: 4457845n, shortName: 'zero-sepolia' },
{ chainId: 6038361n, shortName: 'azkyt' },
{ chainId: 7225878n, shortName: 'saakuru' },
{ chainId: 7777777n, shortName: 'zora' },
Expand Down
4 changes: 2 additions & 2 deletions packages/relay-kit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@safe-global/relay-kit",
"version": "3.2.3",
"version": "3.2.4",
"description": "SDK for Safe Smart Accounts with support for ERC-4337 and Relay",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
Expand Down Expand Up @@ -39,7 +39,7 @@
},
"dependencies": {
"@gelatonetwork/relay-sdk": "^5.5.0",
"@safe-global/protocol-kit": "^5.0.3",
"@safe-global/protocol-kit": "^5.0.4",
"@safe-global/safe-modules-deployments": "^2.2.4",
"@safe-global/types-kit": "^1.0.0",
"viem": "^2.21.8"
Expand Down
6 changes: 4 additions & 2 deletions packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ export class Safe4337Pack extends RelayKitBasePack<{
if (isBatch) {
const multiSendContract = await getMultiSendContract({
safeProvider,
safeVersion
safeVersion,
deploymentType: options.deploymentType || undefined
})

const batchData = encodeFunctionData({
Expand All @@ -315,7 +316,8 @@ export class Safe4337Pack extends RelayKitBasePack<{
predictedSafe: {
safeDeploymentConfig: {
safeVersion,
saltNonce: options.saltNonce || undefined
saltNonce: options.saltNonce || undefined,
deploymentType: options.deploymentType || undefined
},
safeAccountConfig: {
owners: options.owners,
Expand Down
3 changes: 2 additions & 1 deletion packages/relay-kit/src/packs/safe-4337/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Account, Address, Chain, Hash, Hex, PublicClient, PublicRpcSchema, Transport } from 'viem'
import Safe, { SafeProviderConfig } from '@safe-global/protocol-kit'
import Safe, { DeploymentType, SafeProviderConfig } from '@safe-global/protocol-kit'
import {
EstimateGasData,
MetaTransactionData,
Expand All @@ -19,6 +19,7 @@ type PredictedSafeOptions = {
threshold: number
safeVersion?: SafeVersion
saltNonce?: string
deploymentType?: DeploymentType
}

export type SponsoredPaymasterOption = {
Expand Down
8 changes: 4 additions & 4 deletions packages/sdk-starter-kit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@safe-global/sdk-starter-kit",
"version": "1.0.3",
"version": "1.0.4",
"description": "SDK that provides the basic tools to interact with the Safe Smart Account.",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
Expand Down Expand Up @@ -36,9 +36,9 @@
"access": "public"
},
"dependencies": {
"@safe-global/api-kit": "^2.5.3",
"@safe-global/protocol-kit": "^5.0.3",
"@safe-global/relay-kit": "^3.2.3",
"@safe-global/api-kit": "^2.5.4",
"@safe-global/protocol-kit": "^5.0.4",
"@safe-global/relay-kit": "^3.2.4",
"@safe-global/types-kit": "^1.0.0",
"viem": "^2.21.8"
}
Expand Down
4 changes: 4 additions & 0 deletions packages/sdk-starter-kit/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { DeploymentType } from '@safe-global/protocol-kit'

export const DEFAULT_DEPLOYMENT_TYPE: DeploymentType = 'canonical'

export enum SafeClientTxStatus {
DEPLOYED_AND_EXECUTED = 'DEPLOYED_AND_EXECUTED',
DEPLOYED_AND_PENDING_SIGNATURES = 'DEPLOYED_AND_PENDING_SIGNATURES',
Expand Down
Loading

0 comments on commit c6693cd

Please sign in to comment.