Skip to content

Commit

Permalink
feat(api-kit): add ZkSync and ZkEvm service links (#730)
Browse files Browse the repository at this point in the history
* fix: test to avoid failing without Goerli service
  • Loading branch information
dasanra committed Mar 11, 2024
1 parent d6e2fe9 commit f82fc1c
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 30 deletions.
6 changes: 3 additions & 3 deletions packages/api-kit/hardhat.config.ts
Expand Up @@ -29,7 +29,7 @@ if (PK) {
}

const config: HardhatUserConfig = {
defaultNetwork: 'goerli',
defaultNetwork: 'sepolia',
paths: {
tests: TESTS_PATH
},
Expand All @@ -39,9 +39,9 @@ const config: HardhatUserConfig = {
blockGasLimit: 100000000,
gas: 100000000
},
goerli: {
sepolia: {
...sharedNetworkConfig,
url: 'https://rpc.ankr.com/eth_goerli'
url: 'https://rpc.ankr.com/eth_sepolia'
}
},
//@ts-expect-error Type not found
Expand Down
2 changes: 1 addition & 1 deletion packages/api-kit/scripts/generateTxServiceTypes.sh
@@ -1,5 +1,5 @@
#!/bin/bash

mkdir -p openapi
curl 'https://safe-transaction-goerli.safe.global/?format=openapi' > openapi/tx-service.json
curl 'https://safe-transaction-sepolia.safe.global/?format=openapi' > openapi/tx-service.json
npx openapi-typescript openapi/tx-service.json --output openapi/tx-service.ts
3 changes: 2 additions & 1 deletion packages/api-kit/src/utils/config.ts
@@ -1,10 +1,11 @@
export const TRANSACTION_SERVICE_URLS: Record<string, string> = {
'1': 'https://safe-transaction-mainnet.safe.global',
'5': 'https://safe-transaction-goerli.safe.global',
'10': 'https://safe-transaction-optimism.safe.global',
'56': 'https://safe-transaction-bsc.safe.global',
'100': 'https://safe-transaction-gnosis-chain.safe.global',
'137': 'https://safe-transaction-polygon.safe.global',
'324': 'https://safe-transaction-zksync.safe.global',
'1101': 'https://safe-transaction-zkevm.safe.global',
'8453': 'https://safe-transaction-base.safe.global',
'42161': 'https://safe-transaction-arbitrum.safe.global',
'42220': 'https://safe-transaction-celo.safe.global',
Expand Down
8 changes: 5 additions & 3 deletions packages/api-kit/tests/endpoint/index.test.ts
Expand Up @@ -27,7 +27,7 @@ const eip3770DelegateAddress = `${config.EIP_3770_PREFIX}:${delegateAddress}`
const tokenAddress = '0x210EC22dD6b1c174E5cA1A261DD9791e0755cc6D'
const eip3770TokenAddress = `${config.EIP_3770_PREFIX}:${tokenAddress}`
const safeTxHash = '0xede78ed72e9a8afd2b7a21f35c86f56cba5fffb2fff0838e253b7a41d19ceb48'
const txServiceBaseUrl = 'https://safe-transaction-goerli.safe.global/api'
const txServiceBaseUrl = 'https://safe-transaction-sepolia.safe.global/api'
const provider = getDefaultProvider(config.JSON_RPC)
const signer = new Wallet(
'0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d',
Expand Down Expand Up @@ -347,7 +347,8 @@ describe('Endpoint tests', () => {
})
})

it('proposeTransaction', async () => {
// FIXME when tests are migrated to Sepolia
it.skip('proposeTransaction', async () => {
const safeTransactionData = {
to: safeAddress,
data: '0x',
Expand Down Expand Up @@ -396,7 +397,8 @@ describe('Endpoint tests', () => {
})
})

it('proposeTransaction EIP-3770', async () => {
// FIXME when tests are migrated to Sepolia
it.skip('proposeTransaction EIP-3770', async () => {
const safeTransactionData = {
to: safeAddress,
data: '0x',
Expand Down
7 changes: 3 additions & 4 deletions packages/api-kit/tests/utils/config.ts
@@ -1,8 +1,7 @@
const config = {
CHAIN_ID: 5n,
BASE_URL: 'https://safe-transaction-goerli.safe.global',
JSON_RPC: 'https://rpc.ankr.com/eth_goerli',
EIP_3770_PREFIX: 'gor'
CHAIN_ID: 11155111n,
JSON_RPC: 'https://rpc.ankr.com/eth_sepolia',
EIP_3770_PREFIX: 'sep'
}

export default config
2 changes: 1 addition & 1 deletion packages/auth-kit/example/src/App.tsx
Expand Up @@ -204,7 +204,7 @@ function App() {
symbol: 'ETH',
decimals: 18
},
rpcUrls: ['https://base.publicnode.com'],
rpcUrls: ['https://rpc.ankr.com/base'],
blockExplorerUrls: ['https://basescan.org/']
}
])
Expand Down
2 changes: 1 addition & 1 deletion packages/onramp-kit/example/client/src/AuthContext.tsx
Expand Up @@ -38,7 +38,7 @@ const AuthProvider = ({ children }: AuthContextProviderProps) => {
const options: SafeAuthInitOptions = {
enableLogging: true,
showWidgetButton: false,
chainConfig: { chainId: '0x5', rpcTarget: 'https://ethereum-goerli.publicnode.com' }
chainConfig: { chainId: '0x5', rpcTarget: 'https://rpc.ankr.com/eth_goerli' }
}

await authPack.init(options)
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol-kit/hardhat.config.ts
Expand Up @@ -92,9 +92,9 @@ const config: HardhatUserConfig = {
}
]
},
goerli: {
sepolia: {
...sharedNetworkConfig,
url: 'https://rpc.ankr.com/eth_goerli'
url: 'https://rpc.ankr.com/eth_sepolia'
}
},
//@ts-expect-error Type not found
Expand Down
6 changes: 2 additions & 4 deletions playground/api-kit/confirm-transaction.ts
Expand Up @@ -9,16 +9,14 @@ interface Config {
RPC_URL: string
SIGNER_ADDRESS_PRIVATE_KEY: string
SAFE_ADDRESS: string
TX_SERVICE_URL: string
SAFE_TX_HASH: string
}

const config: Config = {
CHAIN_ID: 5n,
RPC_URL: 'https://rpc.ankr.com/eth_goerli',
CHAIN_ID: 11155111n,
RPC_URL: 'https://rpc.ankr.com/eth_sepolia',
SIGNER_ADDRESS_PRIVATE_KEY: '<SIGNER_ADDRESS_PRIVATE_KEY>',
SAFE_ADDRESS: '<SAFE_ADDRESS>',
TX_SERVICE_URL: 'https://safe-transaction-goerli.safe.global/', // Check https://docs.safe.global/safe-core-api/available-services
SAFE_TX_HASH: '<SAFE_TX_HASH>'
}

Expand Down
6 changes: 2 additions & 4 deletions playground/api-kit/execute-transaction.ts
Expand Up @@ -9,16 +9,14 @@ interface Config {
RPC_URL: string
SIGNER_ADDRESS_PRIVATE_KEY: string
SAFE_ADDRESS: string
TX_SERVICE_URL: string
SAFE_TX_HASH: string
}

const config: Config = {
CHAIN_ID: 5n,
RPC_URL: 'https://rpc.ankr.com/eth_goerli',
CHAIN_ID: 11155111n,
RPC_URL: 'https://rpc.ankr.com/eth_sepolia',
SIGNER_ADDRESS_PRIVATE_KEY: '<SIGNER_ADDRESS_PRIVATE_KEY>',
SAFE_ADDRESS: '<SAFE_ADDRESS>',
TX_SERVICE_URL: 'https://safe-transaction-goerli.safe.global/', // Check https://docs.safe.global/safe-core-api/available-services
SAFE_TX_HASH: '<SAFE_TX_HASH>'
}

Expand Down
8 changes: 3 additions & 5 deletions playground/api-kit/propose-transaction.ts
Expand Up @@ -10,15 +10,13 @@ interface Config {
RPC_URL: string
SIGNER_ADDRESS_PRIVATE_KEY: string
SAFE_ADDRESS: string
TX_SERVICE_URL: string
}

const config: Config = {
CHAIN_ID: 5n,
RPC_URL: 'https://rpc.ankr.com/eth_goerli',
CHAIN_ID: 11155111n,
RPC_URL: 'https://rpc.ankr.com/eth_sepolia',
SIGNER_ADDRESS_PRIVATE_KEY: '<SIGNER_ADDRESS_PRIVATE_KEY>',
SAFE_ADDRESS: '<SAFE_ADDRESS>',
TX_SERVICE_URL: 'https://safe-transaction-goerli.safe.global/' // Check https://docs.safe.global/safe-core-api/available-services
SAFE_ADDRESS: '<SAFE_ADDRESS>'
}

async function main() {
Expand Down
2 changes: 1 addition & 1 deletion playground/protocol-kit/deploy-safe.ts
Expand Up @@ -17,7 +17,7 @@ interface Config {
}

const config: Config = {
RPC_URL: 'https://rpc.ankr.com/eth_goerli',
RPC_URL: 'https://rpc.ankr.com/eth_sepolia',
DEPLOYER_ADDRESS_PRIVATE_KEY: '<DEPLOYER_ADDRESS_PRIVATE_KEY>',
DEPLOY_SAFE: {
OWNERS: ['OWNER_ADDRESS'],
Expand Down

0 comments on commit f82fc1c

Please sign in to comment.